import type { HookEvent } from '../types/hooks.js'; import type { Logger } from '../types/logger.js'; import { type HookRegistry } from './registry.js'; /** Minimal run-state the runner reads. `Context` structurally satisfies it. */ export interface HookRunEnv { cwd: string; signal?: AbortSignal | undefined; } export interface HookRunnerOptions { registry: HookRegistry; logger?: Logger | undefined; /** * When false, ordinary hooks are skipped across every transport; * `policy: true` enforcement hooks still run. */ allowNonPolicy?: boolean | undefined; /** Resolves the active session id for the `HookInput` payload. */ sessionId?: (() => string) | undefined; } export interface PreToolUseResult { block?: boolean | undefined; reason?: string | undefined; /** Present only when a hook replaced the tool input. */ input?: Record; } export interface PromptResult { block?: boolean | undefined; reason?: string | undefined; additionalContext?: string | undefined; } /** * Drives the registered hooks at each lifecycle phase. Pure orchestration — * the executor / pipeline / agent extension call the matching method and act on * the returned decision. Fail-open hooks are skipped on failure; fail-closed * policy hooks turn failures into explicit denials without prompting the user. */ export declare class HookRunner { private readonly opts; private readonly registry; /** * Background hooks are advisory and must never form an unbounded work queue. * Keep at most one invocation running plus the latest pending payload for * each registered hook. */ private readonly backgroundRuns; constructor(opts: HookRunnerOptions); /** Cheap guard so callers can skip building payloads when nothing listens. */ has(event: HookEvent): boolean; preToolUse(toolName: string, toolInput: Record, env: HookRunEnv): Promise; postToolUse(toolName: string, toolInput: unknown, result: { content: string; isError: boolean; }, env: HookRunEnv): Promise<{ additionalContext?: string | undefined; contextAs?: 'inline' | 'separate'; }>; userPromptSubmit(prompt: string, env: HookRunEnv): Promise; sessionStart(env: HookRunEnv): Promise<{ additionalContext?: string | undefined; }>; stop(env: HookRunEnv): Promise; private base; private matching; private scheduleBackground; private invoke; private invokeInProcess; private failureOutcome; private collectContext; } //# sourceMappingURL=runner.d.ts.map