/** * Hooks System Type Definitions * * Provides comprehensive TypeScript types for the Wave Code hooks system, * enabling automated actions at specific workflow points. */ export type { WaveConfiguration, HookConfiguration, PartialHookConfiguration, HookConfigurationRecord, } from "./configuration.js"; export type HookEvent = "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "Stop" | "SubagentStop" | "PermissionRequest" | "WorktreeCreate" | "WorktreeRemove" | "CwdChanged" | "SessionStart" | "SessionEnd" | "PreCompact" | "PostCompact"; export interface HookCommand { type: "command"; command: string; async?: boolean; timeout?: number; pluginRoot?: string; } export interface HookEventConfig { matcher?: string; hooks: HookCommand[]; } export interface HookExecutionContext { event: HookEvent; toolName?: string; projectDir: string; timestamp: Date; worktreeName?: string; worktreePath?: string; planFilePath?: string; } export interface HookExecutionResult { success: boolean; exitCode?: number; stdout?: string; stderr?: string; duration: number; timedOut: boolean; } export interface HookExecutionOptions { timeout?: number; cwd?: string; continueOnFailure?: boolean; } export interface HookValidationResult { valid: boolean; errors: string[]; } export declare class HookExecutionError extends Error { readonly hookCommand: string; readonly originalError: Error; readonly context: HookExecutionContext; constructor(hookCommand: string, originalError: Error, context: HookExecutionContext); } export declare class HookConfigurationError extends Error { readonly configPath: string; readonly validationErrors: string[]; constructor(configPath: string, validationErrors: string[]); } export type SessionStartSource = "startup" | "compact" | "clear"; export type SessionEndSource = "exit" | "stop" | "compact" | "clear"; export declare function isValidHookEvent(event: string): event is HookEvent; export declare function isValidHookCommand(cmd: unknown): cmd is HookCommand; export declare function isValidHookEventConfig(config: unknown): config is HookEventConfig; export interface HookJsonInput { session_id: string; transcript_path: string; cwd: string; hook_event_name: HookEvent; tool_name?: string; tool_input?: unknown; tool_response?: unknown; plan_file_path?: string; user_prompt?: string; subagent_type?: string; name?: string; worktree_path?: string; old_cwd?: string; new_cwd?: string; source?: SessionStartSource; agent_type?: string; end_source?: SessionEndSource; compact_instructions?: string; compact_summary?: string; background_tasks?: BackgroundTaskInfo[]; session_crons?: SessionCronInfo[]; last_assistant_message?: string; } export interface BackgroundTaskInfo { id: string; type: "shell" | "subagent" | "workflow"; status: string; description: string; command?: string; agent_type?: string; name?: string; } export interface SessionCronInfo { id: string; schedule: string; recurring: boolean; prompt: string; } export interface ExtendedHookExecutionContext extends HookExecutionContext { sessionId?: string; transcriptPath?: string; cwd?: string; toolInput?: unknown; toolResponse?: unknown; env?: Record; userPrompt?: string; subagentType?: string; worktreeName?: string; oldCwd?: string; newCwd?: string; source?: SessionStartSource; agentType?: string; endSource?: SessionEndSource; compactInstructions?: string; compactSummary?: string; backgroundTasks?: BackgroundTaskInfo[]; sessionCrons?: SessionCronInfo[]; lastAssistantMessage?: string; } export interface HookEnvironment { WAVE_PROJECT_DIR: string; [key: string]: string; }