/** * guardToolRegistry — the agent-runtime tool-table boundary (guard-tool-registry-SPEC v1.0). * * The layer ABOVE the shipped `guardToolCall`: it takes the host's raw tool list and returns a tool * table in which every mutating capability is wrapped so it cannot execute without entering * `guardToolCall`, and construction FAILS CLOSED if a mutator would remain raw. That is a property * of the returned table — tools the host registers elsewhere are outside it. * * Scope honesty (enforcement-architecture §1): this secures **Placement A — the agent-host runtime * tool boundary ONLY**. It NEVER claims merge (Placement B / sibling #7) or deploy inescapability; * `claim.inescapable_merge` / `claim.inescapable_deploy` are ALWAYS false here. * * Determinism (§7): same tool names + classes + config flags → same registry, coverage, guarded set. * Anti-fabrication: unknown tools default to MUTATING (never a false COMPLETE); never invent a tool. * Non-leakage (§1.2): each raw `execute` is captured in a NEW closure, is never a property of the * returned ProtectedTool, the tools array + each tool are frozen, and raw executors live only in a * WeakMap keyed by the protected object. `result.tools` is the sole return surface. */ import type { GuardConfig, ToolCallDescriptor } from './types.js'; export type ToolMutationClass = 'readonly' | 'mutating' | 'mutating_shell' | 'mutating_vcs' | 'mutating_deploy' | 'mutating_publish' | 'mutating_schema'; export type RawTool = { name: string; description?: string; inputSchema?: unknown; execute: (args: unknown, execution?: import('./types.js').ExecutionGrantCallContext) => Promise | unknown; mutationClass?: ToolMutationClass; meta?: Record; }; export type ProtectedTool = { readonly name: string; readonly description?: string; readonly inputSchema?: unknown; readonly meta?: Record; /** The ONLY entry point exposed to the agent runtime (guarded for mutators, direct for readonly). */ readonly execute: (args: unknown) => Promise; readonly _coderifts: { readonly guarded: boolean; readonly mutationClass: ToolMutationClass; /** guard operation bound for this tool (diagnostic; mutators only). */ readonly operation?: string; }; }; export type EnforcementCoverage = 'COMPLETE' | 'PARTIAL' | 'BYPASSED' | 'UNKNOWN'; export type RegistryCoverageReport = { version: 'guard-tool-registry-report/1.0'; coverage: EnforcementCoverage; protected_tools: string[]; guarded_mutators: string[]; readonly_passthrough: string[]; unguarded_mutators: string[]; unknown_treated_as: 'mutating' | 'readonly' | 'reject'; claim: { inescapable_runtime: boolean; inescapable_merge: false; inescapable_deploy: false; }; siblings: { merge_gate: 'required_separate_#7'; artifact_resolver: 'sibling_#4'; }; warnings: string[]; }; export type ToolBinder = (tool: RawTool, args: unknown, cls: ToolMutationClass) => ToolCallDescriptor; export type GuardToolRegistryConfig = { guard?: GuardConfig; unknownToolPolicy?: 'mutating' | 'readonly' | 'reject'; classify?: Record; failOnUnguardedMutator?: boolean; binders?: Record; forceReadonly?: string[]; }; export type RegistryResult = { tools: ProtectedTool[]; coverage: EnforcementCoverage; report: RegistryCoverageReport; }; export type RegistryConstructionErrorCode = 'GUARD_CONFIG_INVALID' | 'UNKNOWN_TOOL' | 'DUPLICATE_TOOL_NAME' | 'INVALID_TOOL' | 'FORCE_READONLY_MUTATOR'; /** Fail-closed construction error (§3) — thrown at CONSTRUCTION, never at first agent call. */ export declare class RegistryConstructionError extends Error { readonly code: RegistryConstructionErrorCode; readonly toolName?: string; constructor(code: RegistryConstructionErrorCode, message: string, toolName?: string); } /** * Construct the frozen, fail-closed protected tool registry (§1.3). Pure + deterministic. * @throws {RegistryConstructionError} per §3 (default failOnUnguardedMutator=true). */ export declare function guardToolRegistry(rawTools: RawTool[], config?: GuardToolRegistryConfig): RegistryResult; //# sourceMappingURL=tool-registry.d.ts.map