//#region src/utils/tool-latency.d.ts /** * Bounded, TTL-aware registry for tool-call latency measurement. * * When a completion response contains tool-use blocks (OpenAI `tool_calls`, * Anthropic `type=tool_use` content blocks), we record a timestamp keyed * by `(sessionId, toolUseId, agentId)`. When the next completion in the * same conversation includes the corresponding tool result, the extractor * consumes the timestamp and reports `latencyMs` as the wall-clock delta. * * Without this, auto-extracted tool call events always reported * `latencyMs=0` because the extractor had no way to know when the * tool_use was emitted. * * Bounded: `MAX_ENTRIES` cap prevents unbounded growth if a caller never * sends a matching tool result. LRU-dropped on overflow. TTL expires * stale entries on any access. */ interface ToolLatencyKeyParts { sessionId?: string | null; toolUseId?: string | null; agentId?: string | null; } declare function recordToolUse(parts: ToolLatencyKeyParts): void; declare function consumeToolUseLatencyMs(parts: ToolLatencyKeyParts): number; /** * Record a timestamp for each tool_use in a completion response's * ``toolCalls`` array. Mirrors the shape emitted by the OpenAI and * Anthropic extractors: ``{ id | call_id, ... }``. * * Paired with :func:`consumeToolUseLatencyMs` — the next completion in * the conversation picks up these timestamps and emits tool-call events * with real latency. No-op if the response has no tool calls. */ declare function recordToolUsesFromResponse(toolCalls: ReadonlyArray | { id?: string; call_id?: string; }> | null | undefined, opts: { sessionId?: string | null; agentId?: string | null; }): void; declare function _resetForTests(): void; //#endregion export { ToolLatencyKeyParts, _resetForTests, consumeToolUseLatencyMs, recordToolUse, recordToolUsesFromResponse }; //# sourceMappingURL=tool-latency.d.ts.map