import type { AiUsageEvent, AiUsageFinish } from '../../usage/types.js'; export declare const AI_USAGE_RETENTION_MS: number; export declare function insertAiUsageEvent(event: AiUsageEvent): void; export declare function finishAiUsageEvent(id: string, finish: AiUsageFinish & { estimatedCostMicrousd?: number; }): void; export declare function markStaleAiUsageEventsUnknown(cutoffMs: number, now?: number): number; export declare function pruneAiUsageEvents(cutoffMs: number): number; export declare function getAiUsageEvent(id: string): Record | undefined; export type AiUsageQuery = { from: number; to: number; category?: string; provider?: string; model?: string; agentId?: string; conversationId?: string; }; export type AiUsageTotals = { calls: number; succeededCalls: number; failedCalls: number; unknownCostCalls: number; inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; totalTokens: number; knownCostUsd: string; costCompleteness: 'complete' | 'partial' | 'unknown'; }; export type ConversationAiUsageTotals = Pick; /** Aggregate all retained AI usage records for the requested conversations. */ export declare function summarizeAiUsageByConversations(conversationIds: readonly string[]): Map; export declare function summarizeAiUsage(query: AiUsageQuery): { totals: AiUsageTotals; byCategory: Array<{ key: string; totals: AiUsageTotals; }>; byModel: Array<{ key: string; provider: string; model: string; totals: AiUsageTotals; }>; }; export declare function listAiUsageEvents(query: AiUsageQuery & { limit?: number; before?: { startedAt: number; id: string; }; }): { items: { id: string; traceId: string; otelTraceId: string; otelSpanId: string; parentEventId: string; conversationId: string; runId: string; agentId: string; category: string; operation: string; trigger: string; reasonKey: string; provider: string; model: string; status: string; startedAt: number; finishedAt: number; durationMs: number; inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; reasoningTokens: number; totalTokens: number; estimatedCostUsd: string; costSource: string; pricingSnapshot: Record; errorSummary: string; }[]; nextCursor: string; }; export declare function getAiUsageEventView(id: string): { id: string; traceId: string; otelTraceId: string; otelSpanId: string; parentEventId: string; conversationId: string; runId: string; agentId: string; category: string; operation: string; trigger: string; reasonKey: string; provider: string; model: string; status: string; startedAt: number; finishedAt: number; durationMs: number; inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; reasoningTokens: number; totalTokens: number; estimatedCostUsd: string; costSource: string; pricingSnapshot: Record; errorSummary: string; }; export declare function listAiUsageTrace(traceId: string): { id: string; traceId: string; otelTraceId: string; otelSpanId: string; parentEventId: string; conversationId: string; runId: string; agentId: string; category: string; operation: string; trigger: string; reasonKey: string; provider: string; model: string; status: string; startedAt: number; finishedAt: number; durationMs: number; inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; reasoningTokens: number; totalTokens: number; estimatedCostUsd: string; costSource: string; pricingSnapshot: Record; errorSummary: string; }[];