import { type ScanReport, type ScanDeps } from './scan.js'; /** * Claude Code hooks. * * `hook session-start` scans the MCP servers Claude Code starts for this project * (project `.mcp.json`, and the user's and this project's entries in * `~/.claude.json`), records the verdicts for the session, and tells both the * user and the model which servers were blocked — by server name, finding code * and tool name only. A blocked tool's description is never echoed into the * model's context: that text is the attack. * * `hook pre-tool-use` denies a call to an `mcp____` tool when the * session-start scan blocked that server or that tool. It reads one small file * and starts nothing, so it adds no network or process cost to a tool call. * * What this does not do: catch a server that changes its tools after the * session started (use `warden-mcp wrap` for that — it re-checks before every * call), or vet servers that plugins and claude.ai connectors provide (they are * not in these files; calls to them get no decision unless WARDEN_HOOK_STRICT=1, * which asks the user instead). */ export declare const SESSION_TTL_MS: number; export interface SessionVerdicts { version: 1; scannedAt: string; cwd: string; servers: Array<{ key: string; normalized: string; allow: boolean | null; status: string; codes: string[]; blockedTools: string[]; }>; } /** Claude Code's form of a server or tool name inside `mcp____`. */ export declare function normalizeName(name: string): string; /** A tool or server name safe to place in the model's context: short, plain, or withheld. */ export declare function contextSafeName(name: string): string; export declare function sessionPath(stateDir: string, sessionId: string): string; export declare function verdictsFrom(report: ScanReport, cwd: string): SessionVerdicts; export declare function sessionStartOutput(report: ScanReport): object | undefined; export declare function sessionStart(input: Record, env?: NodeJS.ProcessEnv, deps?: ScanDeps): Promise; export interface PreToolDecision { permissionDecision: 'deny' | 'ask'; permissionDecisionReason: string; } /** The decision for one tool call, given the session's verdicts. Pure; shared with the plugin's script by test. */ export declare function decide(toolName: string, verdicts: SessionVerdicts | undefined, strict: boolean): PreToolDecision | undefined; /** * Flow policy `"mode": "deny"` means nobody is asked, for the MCP scan's strict questions too: a runtime without a * person (`claude -p`, a skip-permissions daemon) may run a call it was only asked about. */ export declare function withDenyMode(decision: PreToolDecision | undefined, env?: NodeJS.ProcessEnv): PreToolDecision | undefined; /** The stricter of two decisions: deny beats ask beats none. */ export declare function stricter(a: PreToolDecision | undefined, b: PreToolDecision | undefined): PreToolDecision | undefined; export declare function preToolUse(input: Record, env?: NodeJS.ProcessEnv): Promise; /** Records what a tool's result brought into the session (outside text, private data) for the flow guard. */ export declare function postToolUse(input: Record, env?: NodeJS.ProcessEnv): Promise; /** `warden-mcp hook session-start|pre-tool-use` reads the hook JSON on stdin. */ export declare function runHookCli(argv: string[]): Promise; //# sourceMappingURL=claude-hook.d.ts.map