export type HookBackend = 'claude' | 'pi'; export type AgentHookEvent = 'agent:pre-tool' | 'agent:post-tool' | 'agent:session-start' | 'agent:session-end' | 'agent:pre-compact' | 'agent:user-prompt' | 'agent:turn-end'; export type HookEvent = AgentHookEvent | `cc:${string}` | `pi:${string}` | `cortex:${string}`; export type HookRun = ({ script: string; command?: never; } | { command: string; script?: never; }) & { timeout?: number; }; export type HookFilterValue = string | number | boolean | null; export type HookResultMode = 'hook-result' | 'stdout-as-prompt' | 'none'; export interface HookEntry { id: string; event: HookEvent; matcher?: string | Record; run: HookRun; scope?: { backends?: HookBackend[]; requiresTool?: string; }; blocking?: { mode: 'webhook'; ttlMin: number; }; result?: HookResultMode; enabled?: boolean; version?: string; } export interface HookFilterCriteria { event?: HookEvent; backend?: HookBackend; availableTools?: ReadonlySet; } export declare const HOOK_SOURCES: readonly ["managed", "user", "template-scoped"]; export type HookSource = typeof HOOK_SOURCES[number]; export interface HookRegistryRecord { entry: HookEntry; filePath: string; source: HookSource; } export type HookPhase = 'start' | 'transition' | 'end'; export interface MountedHookSummary { id: string; event: HookEntry['event']; enabled: boolean; source: HookSource; } export interface RegistryHook extends MountedHookSummary { kind: 'registry'; entry: HookEntry; filePath: string; } export interface TemplateRun { command: string; args?: string[]; timeout?: number; } export interface TemplateHook extends MountedHookSummary { kind: 'template'; run: TemplateRun; template: string; phase: HookPhase; } export type MountedHook = RegistryHook | TemplateHook; export declare const RESULT_CAPABILITY_BY_EVENT: ReadonlyMap>; export declare function classifyHookSource(entry: { version?: unknown; }, location?: 'registry' | 'template'): HookSource; export declare function validateHookEntry(value: unknown): HookEntry; export declare function loadHookRegistryRecords(directory?: string): HookRegistryRecord[]; export declare function loadHookRegistry(directory?: string): HookEntry[]; export declare function loadMountedHooks(registryDir?: string, templateDir?: string): MountedHook[]; export declare function summarizeMountedHook(hook: MountedHook): MountedHookSummary; export declare function loadMountedHookSummaries(registryDir?: string, templateDir?: string): MountedHookSummary[]; /** * The backends an entry actually compiles to: the set implied by its event prefix, narrowed by an * explicit `scope.backends`. Exported so the UI can show mount targets without re-deriving the rule. */ export declare function effectiveHookBackends(entry: HookEntry): HookBackend[]; export declare function filterHookEntries(entries: readonly HookEntry[], criteria?: HookFilterCriteria): HookEntry[];