/** * PipelineHooks — Strategy Pattern for Execution Observability * * Defines the hook interface used to instrument the tool execution * pipeline without duplicating the core flow. The fast path passes * no hooks (zero overhead); debug and traced paths supply their * strategy via factory methods. * * @module */ import { type ToolResponse } from '../response.js'; /** * Hooks for observability instrumentation on each pipeline step. * * Each hook is called at the corresponding step of the execution * pipeline: route → resolve → validate → middleware → execute. */ export interface PipelineHooks { /** When true, runChain rethrows exceptions (traced path handles them). */ readonly rethrow?: boolean; onRouteError?(): void; onRouteOk?(action: string): void; onResolveError?(action: string): void; onValidateError?(action: string, durationMs: number): void; onValidateOk?(action: string, durationMs: number): void; onMiddleware?(action: string, chainLength: number): void; onExecuteOk?(action: string, response: ToolResponse): void; onExecuteError?(action: string, err: unknown): void; /** Wraps every response before returning (used by traced path for span finalization). */ wrapResponse?(response: ToolResponse): ToolResponse; } export declare function computeResponseSize(response: ToolResponse): number; /** * Merge two PipelineHooks into one that calls both in sequence. * * When both `primary` and `secondary` define the same hook, * the merged hook calls `primary` first, then `secondary`. * * Returns `primary` if `secondary` is undefined (zero allocation). * * Used to layer telemetry emission on top of debug or traced hooks. * * @internal */ export declare function mergeHooks(primary: PipelineHooks, secondary: PipelineHooks | undefined): PipelineHooks; //# sourceMappingURL=PipelineHooks.d.ts.map