import type { ExtensionAPI, ExtensionContext, ToolCallEvent, ToolResultEvent, ToolCallReturn } from './pi-ext-types.js'; /** Map a PI lowercase/snake_case tool name to the Claude-native PascalCase name. */ export declare function toClaude(piName: string): string; /** * Normalize PI tool input for hook scripts. * PI's built-in read/write/edit use `path`; Claude hook scripts expect `file_path`. * Copies `input.path → input.file_path` for those three tools. * Grep passes through unchanged (memory-ref-tracker reads `tool_input.path` for Grep). */ export declare function normalizePiInput(toolName: string, input: Record): Record; /** * Derive the Cortex session ID from the PI extension context. * Falls back to CORTEX_SESSION_ID env var, then 'unknown'. * Guards for getSessionFile() returning undefined (PI --no-session or pre-session state). */ export declare function getSessionId(ctx: ExtensionContext): string; /** Shape of stdin JSON payload that Cortex hook scripts expect (mirrors Claude Code). */ interface ClaudeHookPayload { hook_event_name: 'PreToolUse' | 'PostToolUse' | 'SessionStart'; session_id: string; tool_name: string; tool_input: Record; tool_use_id: string; /** Working directory passed to hook scripts (mirrors Claude Code's cwd field). * sensitive-file-edit.mjs uses this to compute the cwd-relative .claude/ path check. */ cwd?: string; tool_response?: unknown; tool_output?: string; is_error?: boolean; } /** Parsed hook script stdout output shape. */ interface HookResult { hookSpecificOutput?: { permissionDecision?: string; permissionDecisionReason?: string; }; } /** * Invoke a single hook script as a subprocess with the given payload on stdin. * Returns the parsed stdout JSON, or {} if the script produces no output. */ export declare function runHookScript(scriptPath: string, payload: ClaudeHookPayload): HookResult; /** * Handle PreToolUse for edit/write tools. * Runs sensitive-file-edit.mjs; returns {block:true} if it denies. */ export declare function handlePreToolUse(event: ToolCallEvent, ctx: ExtensionContext): ToolCallReturn; /** * Handle PostToolUse for read/grep/edit/write/skill tools. * Fires hooks fire-and-forget; errors are caught and logged, never rethrown. * Returns content modifications for PI's extension runner, which uses the * return value (not event mutation) to apply changes (PI runner.js emitToolResult). */ export declare function handlePostToolUse(event: ToolResultEvent, ctx: ExtensionContext): { content?: unknown; } | void; /** PI extension entry point: registers tool_call, tool_result, and before_agent_start event handlers. */ export default function hookBridge(pi: ExtensionAPI): void; export {};