/** * Metrics Interceptor * * Wraps a tool handler invocation to capture: * - Wall-clock duration (using performance.now()) * - Input token estimate (from serialized args) * - Output token estimate (from serialized result) * - Error detection ({success: false} shape or thrown exceptions) * * Design rules: * - NEVER throws — all interceptor errors are swallowed silently * - ALWAYS returns the original handler result unchanged * - Does NOT mutate the result (token injection happens separately in callTool) */ import type { MetricsAccumulator } from './metrics.js'; /** Handler function signature that the interceptor wraps */ export type ToolHandlerFn = (args: Record) => Promise; /** * Wrap a tool handler with metrics collection. * * @param toolName - Name of the tool being intercepted * @param handler - The original tool handler function * @param accumulator - The MetricsAccumulator to record into * @returns A new async function with identical signature that records metrics */ export declare function wrapWithMetrics(toolName: string, handler: ToolHandlerFn, accumulator: MetricsAccumulator): ToolHandlerFn; //# sourceMappingURL=interceptor.d.ts.map