/** * Zoe SDK — Hook executor * * Wraps a user-supplied `Hooks` object in a safe executor that: * - treats missing hooks as no-ops * - awaits async hooks * - catches and logs hook errors without failing the main flow */ import type { Hooks, StepResult, ZoeError, GenerateTextResult } from "./types.js"; export interface HookExecutor { beforeToolCall(call: { name: string; args: Record; }): Promise; afterToolCall(result: { name: string; output: string; duration: number; }): Promise; onStep(step: StepResult): Promise; onError(error: ZoeError): Promise; onFinish(result: GenerateTextResult): Promise; } /** * Create a safe hook executor from an optional `Hooks` object. * * Every method on the returned `HookExecutor` is safe to call even when * the caller provided no hooks — undefined hooks are treated as no-ops, * and any error thrown by a hook is caught, logged, and swallowed so * the main agent loop is never disrupted. * * @param hooks Optional user-supplied hooks * @returns A `HookExecutor` whose methods are always safe to invoke */ export declare function createHookExecutor(hooks?: Hooks): HookExecutor;