/** * Option A safe dispatcher — per-framework execute wrappers that run a tool call * through the protected table AND always return a proof-bound framework message. * * Closes the manual-binder gap (audit D): hosts that use these faces cannot * forget bind*GuardOutcome — the return type is ONLY the ProofBound* brand. * * MECHANISM (measured, tool-registry.ts wrapWithGuard): * ProtectedTool.execute for mutators returns guardToolCall(...) → GuardOutcome. * No parallel guard path: the dispatcher only calls tool.execute on the table. * * REACHABILITY (do not overclaim): * Same residual as GuardExecutionProof.limits.calls_outside_guarded_path_invisible * and withCodeRifts composition honesty — calls outside the returned table remain * invisible. This dispatcher only covers calls it is given against the table. * * BLOCK branch: binder no-result path (never fabricates a tool result) + measured * DecisionResultEnvelope fields surfaced when present (decision_id, decision, * execution_action, required_action, next_actions, breaking_changes). No invented * remediation (ID850 lives in the app, not here). */ import type { GuardOutcome, DecisionResultEnvelope } from './types.js'; import type { ProtectedTool } from './tool-registry.js'; import { type BindOpenAIGuardOutcomeArgs, type ProofBoundOpenAIToolMessage } from './adapters/openai.js'; import { type BindAnthropicGuardOutcomeArgs, type ProofBoundAnthropicToolResult } from './adapters/anthropic.js'; import { type BindGeminiGuardOutcomeArgs, type ProofBoundGeminiFunctionResponse } from './adapters/gemini.js'; import { type BindLangGraphGuardOutcomeArgs, type ProofBoundLangGraphToolMessage } from './adapters/langgraph.js'; import { type BindVercelGuardOutcomeArgs, type ProofBoundVercelToolResult } from './adapters/vercel.js'; /** * Accepts a bare ProtectedTool[] or a withCodeRifts / withCodeRifts* result that * carries `tools` and/or `protected_tools`. */ export type ProtectedToolTableInput = readonly ProtectedTool[] | { /** Core withCodeRifts tools[], or a provider shape record/array (ignored unless it has execute). */ tools?: readonly ProtectedTool[] | Record; protected_tools?: readonly ProtectedTool[]; }; /** Measured shape: every arm has executed + executionAttempted + proof + verdict. */ export declare function isGuardOutcome(x: unknown): x is GuardOutcome; /** * Locate tool by name on the protected table and invoke its execute. * Mutators return GuardOutcome (guardToolCall); unknown → typed refusal outcome. * * Does NOT claim reachability outside the table * (limits.calls_outside_guarded_path_invisible). */ export declare function executeProtectedTool(table: ProtectedToolTableInput, toolName: string, args: unknown): Promise>; /** * Fields lifted only when present on DecisionResultEnvelope (producer schema). * required_action is DISPLAY ONLY per schema — never a control source / remediation enginge. * No invented remediation structures (ID850 is app-side). */ export type SurfacedEnvelopeFields = { decision_id?: string; decision?: string; execution_action?: string; required_action?: string | null; next_actions?: unknown; breaking_changes?: number | null; /** * ── THE CITABLE PAIR (1534) ──────────────────────────────────────────────────────────── * * `grant_id` and `receipt_digest` already exist on a decision this guard has already verified. * MEASURED before they were added: this surface lifted decision_id / decision / * execution_action / required_action / next_actions / breaking_changes and NEITHER of them, so * the block a model actually reads carried no token it could quote. * * Lifted, never computed. Both are read off the envelope the guard verified; a value this * function derived would be a number the guard published rather than one it checked. */ grant_id?: string | null; receipt_digest?: string | null; }; export declare function surfaceEnvelopeFields(envelope: DecisionResultEnvelope | null | undefined): SurfacedEnvelopeFields | null; export type ExecuteOpenAIToolCallArgs = { /** Protected table or withCodeRifts / withCodeRiftsOpenAI result. */ tools: ProtectedToolTableInput; /** Model tool_call_id this message answers. */ tool_call_id: string; /** Function/tool name as returned by the model. */ name: string; /** Tool arguments (object or JSON string). */ arguments?: unknown; serialize?: BindOpenAIGuardOutcomeArgs['serialize']; }; /** * OpenAI face: protected table + one tool_call → ProofBoundOpenAIToolMessage only. * Return type is branded — host cannot type-check a forgotten-proof path. */ export declare function executeOpenAIToolCall(args: ExecuteOpenAIToolCallArgs): Promise; export type ExecuteAnthropicToolCallArgs = { tools: ProtectedToolTableInput; tool_use_id: string; name: string; arguments?: unknown; serialize?: BindAnthropicGuardOutcomeArgs['serialize']; }; export declare function executeAnthropicToolCall(args: ExecuteAnthropicToolCallArgs): Promise; export type ExecuteGeminiToolCallArgs = { tools: ProtectedToolTableInput; /** Gemini function name (also used as BindGemini name). */ name: string; arguments?: unknown; serialize?: BindGeminiGuardOutcomeArgs['serialize']; }; export declare function executeGeminiToolCall(args: ExecuteGeminiToolCallArgs): Promise; export type ExecuteLangGraphToolCallArgs = { tools: ProtectedToolTableInput; tool_call_id: string; name: string; arguments?: unknown; serialize?: BindLangGraphGuardOutcomeArgs['serialize']; }; export declare function executeLangGraphToolCall(args: ExecuteLangGraphToolCallArgs): Promise; export type ExecuteVercelToolCallArgs = { tools: ProtectedToolTableInput; /** Vercel toolCallId this tool-result answers. */ toolCallId: string; name: string; arguments?: unknown; serialize?: BindVercelGuardOutcomeArgs['serialize']; }; /** * Vercel AI SDK face: protected table + one tool call → ProofBoundVercelToolResult only. * Return type is branded — host cannot type-check a forgotten-proof path. */ export declare function executeVercelToolCall(args: ExecuteVercelToolCallArgs): Promise; //# sourceMappingURL=execute-tool-call.d.ts.map