/** * Unified hooks system — types + HookConfigManager. * * Provides a harness-agnostic format for hook payloads and results so amux * can dispatch to user-registered hooks and programmatic built-ins regardless * of which harness emitted the event. * * Configs are stored at: * - `~/.amux/hooks.json` (global) * - `/.amux/hooks.json` (project — overrides global by id) */ import type { AgentName } from './types.js'; /** Unified hook payload shape. */ export interface UnifiedHookPayload { agent: AgentName; hookType: string; sessionId?: string; timestamp: string; /** Normalized fields: tool_name, tool_input, tool_output, prompt, message, etc. */ data: Record; /** The original harness-specific payload (for round-trip). */ raw: Record; } /** Unified hook result. */ export interface UnifiedHookResult { decision?: 'allow' | 'deny' | 'modify'; message?: string; modifiedInput?: Record; stdout?: string; exitCode?: number; } /** Registration entry in hooks.json. */ export interface HookRegistration { id: string; agent: AgentName | '*'; hookType: string | '*'; handler: 'builtin' | 'command' | 'script'; target: string; priority?: number; enabled?: boolean; metadata?: Record; } /** Scope selector for add/set operations. */ export type HookScope = 'global' | 'project'; /** * Manages user-registered hook registrations across global + project scope. */ export declare class HookConfigManager { readonly globalPath: string; readonly projectPath: string; constructor(globalPath?: string, projectPath?: string); /** Returns the merged hook list (project overrides global by id). */ list(): Promise; add(reg: HookRegistration, scope?: HookScope): Promise; remove(id: string, scope?: HookScope): Promise; set(id: string, patch: Partial): Promise; /** Returns matching hooks sorted by priority asc (default 100). Only enabled. */ getForAgent(agent: AgentName, hookType: string): Promise; }