import type { AgentProposal, JsonObject, McpToolProfile } from "@decionis/agent-safe-pipeline"; import { type Sha256 } from "../JcsDigest.js"; import { type McpInvocation, type McpToolBinding } from "./McpInvocation.js"; export declare class McpBindingError extends Error { readonly code: McpBindingCode; constructor(code: McpBindingCode); } export type McpBindingCode = "MCP_INVOCATION_INVALID" | "MCP_TOOL_NOT_BOUND" | "MCP_TOOL_MISMATCH" | "MCP_ARGUMENTS_INVALID" | "MCP_TARGET_UNRESOLVED" | "SUBJECT_SESSION_REQUIRED" | "SUBJECT_ABSENT" | "SUBJECT_MISMATCH"; /** What the runtime knows, as against what the model sent. */ export interface McpTrustedContext { /** The principal the host authenticated, if it authenticated one. */ readonly principal?: string; /** A fallback idempotency key when the invocation carries none. */ readonly idempotencyKey: string; /** * The subject the host's session is pinned to: the customer the identity * provider named for this conversation, verified by the host, never sent * by the model. */ readonly subject?: string; } export interface BoundMcpInvocation { readonly proposal: AgentProposal; /** The trusted context the runtime computes; never anything the model sent as context. */ readonly context: JsonObject; readonly idempotencyKey: string; readonly correlationId: string | undefined; /** * The canonical digest of the arguments as bound. The guard recomputes it * immediately before dispatch: arguments that changed after the authority * was issued are a refusal, not an execution. */ readonly argumentsDigest: Sha256; } /** * The gate between the MCP transport and the action. * * A tool name and a bag of arguments arrive from a model. What leaves is an * Agent-Safe proposal: an action the operator named, a target derived from * the arguments rather than accepted from the caller, and the arguments * themselves, validated whole. * * Every refusal here happens before the authority is asked, so none of them * costs a decision or a dossier: * * - a tool with no binding is refused rather than passed through, so adding * a consequential tool to a server cannot quietly add an ungoverned path; * - an argument the tool's schema does not name is refused rather than * dropped, because a dropped argument is one the authority never saw and * the tool might still act on; * - a target that cannot be resolved from the arguments is refused rather * than guessed; * - a tool that names a subject argument is refused without a session * subject, or when the argument names another subject or none, the rule * `agent-safe.profile.api/1` holds a read to. * * What it does not do is authorize anything. It produces a proposal; the * authority decides, and the claim is what makes a dispatch legal. */ export declare function bindMcpInvocation(input: McpInvocation, binding: McpToolBinding, trusted: McpTrustedContext): BoundMcpInvocation; /** * A tool's binding as an `agent-safe.profile.mcp/1` profile declares it: the * same shape a binding written in code has, read from data. Null when the * profile does not declare the tool. */ export declare function profiledBinding(profile: McpToolProfile, tool: string): McpToolBinding | null; /** The binding for a tool, or a refusal naming the tool as ungoverned. */ export declare function bindingFor(bindings: ReadonlyMap, tool: string): McpToolBinding; //# sourceMappingURL=McpIntentBinder.d.ts.map