import type { IRequestLogger, LlmCallEntry, LlmUsage, RagQueryEntry, RequestSummary, ToolCallEntry } from '@mcp-abap-adt/llm-agent'; interface Bucket { llm: LlmCallEntry[]; rag: number; tool: number; } /** Shared aggregation (DRY with DefaultRequestLogger.getSummary). */ export declare function aggregate(b: Bucket): RequestSummary; /** Sum a summary's components into a flat usage triple for response.usage. */ export declare function summaryToUsage(s: RequestSummary): LlmUsage; /** * One logger per SessionGraph, shared by the coordinator AND its workers. Two * accounting axes (spec C.2): * - session-cumulative (survives across requests, for /v1/usage), * - per-traceId delta (for response.usage; keyed so concurrent requests never * stomp each other). * * NESTED-SAFE: a worker's SmartAgent.process() runs startRequest(traceId) / * endRequest(traceId) under the SAME traceId as the coordinator. Therefore: * - startRequest is depth-counted and creates the bucket ONLY if absent * (never clears an existing one — a worker start must not wipe coordinator * tokens already logged under that traceId), * - endRequest is depth-counted and NEVER deletes the bucket (a worker end * must not drop the delta before the server emits response.usage), * - dropRequest is the explicit free, called by the top-level owner (the * server) AFTER it has read getSummary(traceId). */ export declare class SessionRequestLogger implements IRequestLogger { private readonly cumulative; private readonly deltas; private readonly depth; startRequest(requestId?: string): void; endRequest(requestId?: string): void; /** Explicit free of a request delta. Called once by the top-level owner. */ dropRequest(requestId?: string): void; logLlmCall(entry: LlmCallEntry): void; logRagQuery(entry: RagQueryEntry & { requestId?: string; }): void; logToolCall(entry: ToolCallEntry & { requestId?: string; }): void; getSummary(requestId?: string): RequestSummary; reset(): void; /** Get-or-create the delta bucket for a requestId (used by log* when a call * arrives before startRequest, e.g. a deeply nested worker). */ private deltaFor; } export {}; //# sourceMappingURL=session-request-logger.d.ts.map