export type HookEvent = "SessionStart" | "SessionEnd" | "UserPromptSubmit" | "PreToolUse" | "PermissionRequest" | "PostToolUse" | "PostToolUseFailure" | "SubagentStart" | "SubagentStop" | "Stop" | "Notification" | "PreCompact" | "PostCompact" | "AgentBeforeDecision" | "AgentAfterOutcome" | "SkillUsed" | "SkillRevised"; export interface BasePayload { sessionId: string; [key: string]: unknown; } export interface SessionStartPayload extends BasePayload { agentName: string; tools: string[]; } export interface SessionEndPayload extends BasePayload { reason: string; turns: number; } export interface UserPromptPayload extends BasePayload { prompt: string; } export interface PreToolUsePayload extends BasePayload { toolName: string; input: Record; } export interface PostToolUsePayload extends BasePayload { toolName: string; input: Record; output: unknown; durationMs?: number; } export interface PostToolUseFailurePayload extends BasePayload { toolName: string; input: Record; error: Error | string; } export interface StopPayload extends BasePayload { response: string; } export interface PreCompactPayload extends BasePayload { messageCount: number; estimatedTokens: number; } export interface PostCompactPayload extends BasePayload { beforeCount: number; afterCount: number; estimatedTokensAfter?: number; summarized?: boolean; } export interface SubagentPayload extends BasePayload { agentName: string; parentSessionId?: string; } export interface AgentBeforeDecisionPayload extends BasePayload { agentId: string; currentMetrics: Record; recentHistory: import("../swarm/self-improvement/experiment-log.js").ExperimentRecord[]; } export interface AgentAfterOutcomePayload extends BasePayload { agentId: string; hypothesis: string; success: boolean; metricBefore: number; metricAfter: number | null; } export interface SkillUsedPayload extends BasePayload { skillName: string; outcome: "success" | "failure"; context: string; } export interface SkillRevisedPayload extends BasePayload { skillName: string; previousSuccessRate: number; newSuccessRate: number | null; committed: boolean; } export interface HookResult { decision: "allow" | "deny" | "block" | "escalate"; reason?: string; additionalContext?: string; modifiedInput?: Record; } export interface HookDefinition { /** Regex/pattern for tool name filtering. Supports pipe OR, wildcard, arg patterns. */ matcher?: string; handler: (payload: BasePayload) => Promise | HookResult; timeout?: number; description?: string; } export type HooksConfig = Partial>; export declare class HooksEngine { private hooks; private anyListeners; on(event: HookEvent, definition: HookDefinition): void; configure(config: HooksConfig): void; off(event: HookEvent): void; clear(): void; onAny(listener: (event: HookEvent, payload: BasePayload) => void): () => void; fire(event: HookEvent, payload: BasePayload): Promise; private matches; static withSecurityGuardrails(): HooksEngine; static withQualityGate(validate: (response: string) => string | null): HooksEngine; static compose(...engines: HooksEngine[]): HooksEngine; } //# sourceMappingURL=hooks-engine.d.ts.map