/** * TOOL_HANDLERS dispatch map — explicit whitelist for 7 write tool proxies. * * Per D-SC02-09: TOOL_HANDLERS is an explicit whitelist. Adding an 8th tool * requires adding a new entry to this map + a new POST route stub in * routes/tools.ts. The whitelist is the source of truth; routes/tools.ts * enumerates it at module load to assert the invariant. * * @module sidecar/server/tool-proxy/router */ import type { SidecarDependencyRegistry } from "../registry.js"; /** * Signature for a tool handler function. * * @typeParam TArgs - Parsed request arguments. * @typeParam TResult - Response data type on success. */ export type ToolHandler = (args: TArgs, registry: SidecarDependencyRegistry) => Promise<{ ok: true; data: TResult; } | { ok: false; error: { code: string; message: string; }; }>; /** * Registered write tool handlers. Each entry maps a tool name to its * async handler function. */ export declare const TOOL_HANDLERS: Record; export interface DispatchOptions { registry: SidecarDependencyRegistry; toolName: string; args: unknown; } /** * Dispatch a tool call to the registered TOOL_HANDLERS entry. * * @param options - Dispatch options including tool name, args, and registry. * @returns Tool response or UNKNOWN_TOOL error. */ export declare function dispatchToolHandler(options: DispatchOptions): Promise<{ ok: true; data: unknown; } | { ok: false; error: { code: string; message: string; }; }>; /** * List of registered write tool names, derived from TOOL_HANDLERS keys. * Used by routes/tools.ts and handler.test.ts to assert the whitelist invariant. */ export declare const REGISTERED_WRITE_TOOLS: Array; //# sourceMappingURL=router.d.ts.map