/** * HookEngine — dispatches lifecycle events to loaded hooks. * * Decision semantics (blocking events only): * exit 0 → allow * exit 2 → deny * stdout {"decision":"deny",...} → deny, regardless of exit code * timeout / crash / spawn failure → allow (fail-open) + logged * * Handlers run sequentially per event; the first deny short-circuits. * Non-blocking events run every matching handler and always resolve allow. */ import { type HookDecision, type HookEvent, type HookInput, type LoadedHook } from './types.js'; export declare class HookEngine { private hooks; private byEvent; /** Hooks are read once at engine construction (session start). */ constructor(opts: { workDir: string; hooks?: LoadedHook[]; }); /** Fast path so call sites skip envelope construction when nothing listens. */ hasHooks(event: HookEvent): boolean; listHooks(): ReadonlyArray; /** * Run every hook registered for `event` whose matcher accepts the tool name. * Returns the aggregate decision; always 'allow' for non-blocking events. */ dispatch(event: HookEvent, input: HookInput): Promise; private runHandler; }