export type HookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'SessionStop'; export interface HookDef { event: HookEvent; match: string; command: string; timeout?: number; blocking?: boolean; enabled?: boolean; } export interface HooksConfig { hooks: HookDef[]; } export interface HookContext { event: HookEvent; toolName?: string; toolInput?: Record; toolOutput?: string; sessionId?: string; cwd: string; /** * Current permission mode at the time the hook fires. Passed to the * hook script as $COMPACT_AGENT_PERMISSION_MODE / $CROWCODER_PERMISSION_MODE * so checks like GateGuard can no-op in 'yolo' (where the user has * explicitly opted in to "approve everything" and pedantic gates * contradict that contract). */ permissionMode?: string; } export interface HookResult { allowed: boolean; message?: string; } export declare function initHooksDir(): void; export declare function runHooks(ctx: HookContext): Promise; /** * Reset the quarantine list — used by /reset-config when the user has * fixed their hooks.json and wants to re-enable hooks without restarting. */ export declare function clearQuarantinedHooks(): void; export declare function saveHooksConfig(config: HooksConfig): void; export declare function listHooks(): HookDef[]; export declare function addHook(hook: HookDef): void; export declare function removeHook(index: number): boolean;