/**
 * Capture-flow Tools for Studiograph Agent
 *
 * Single tool used by the quick-capture surface (POST /api/capture[/stream]).
 * When the agent decides nothing in the user's input is worth saving as an
 * entity, it calls `nothing_to_capture(reason)` and stops. The server
 * captures the structured reason and surfaces it in the toast — no freeform
 * assistant prose, no followup-suggestion marker leaking through.
 *
 * The tool is registered globally on every agent (so the Anthropic tool
 * schema is consistent across sessions), but it's only meaningful when the
 * capture flow has wired up `onNothingToCapture` in the AgentContext. In
 * other contexts the callback is absent and the tool is effectively a
 * no-op confirming back to the agent.
 */
import { Type as T } from 'typebox';
import { wrapToolResult } from './graph-tools.js';
export function createCaptureTools(onNothingToCapture) {
    return [
        {
            name: 'nothing_to_capture',
            label: 'Nothing to Capture',
            description: 'Use ONLY in the quick-capture flow when the user\'s input contains no substantive content worth saving as an entity (e.g. an error page, an empty URL fetch, a redirect-only page, or pure noise). Call this with a brief one-line reason and STOP — do not produce any assistant text after, do not emit followups. Do not use this when the input is a normal note or article you should save: in that case call create_entity instead.',
            parameters: T.Object({
                reason: T.String({ description: 'One short sentence explaining why nothing is worth capturing. Shown to the user verbatim.' }),
            }),
            execute: async (_toolCallId, params) => {
                const reason = String(params?.reason ?? '').trim();
                if (!reason) {
                    return wrapToolResult({ success: false, error: 'reason is required' });
                }
                const cb = onNothingToCapture();
                if (cb)
                    cb(reason);
                return wrapToolResult({ success: true, recorded: true });
            },
        },
    ];
}
//# sourceMappingURL=capture-tools.js.map