import type { AgentTool } from "@mariozechner/pi-agent-core"; export interface HookDefinition { script: string; description?: string; baseDir?: string; _handler?: (ctx: Record) => Promise | HookResult; } export interface HooksConfig { hooks: { on_session_start?: HookDefinition[]; pre_tool_use?: HookDefinition[]; post_tool_failure?: HookDefinition[]; post_response?: HookDefinition[]; pre_query?: HookDefinition[]; file_changed?: HookDefinition[]; on_error?: HookDefinition[]; }; } export interface HookResult { action: "allow" | "block" | "modify"; reason?: string; args?: Record; } export declare function loadHooksConfig(agentDir: string): Promise; export declare function runHooks(hooks: HookDefinition[] | undefined, agentDir: string, input: Record): Promise; /** * Wraps a tool's execute function with pre_tool_use hook support. */ export declare function wrapToolWithHooks>(tool: T, hooksConfig: HooksConfig, agentDir: string, sessionId: string): T;