import { Domain } from '@things-factory/shell'; import { type ModelPriceValues } from './model-price.js'; export type AiUsageBucketSize = 'hour' | 'day' | 'month'; export interface AiUsageFilter { from: Date; to: Date; bucket: AiUsageBucketSize; agentIds?: string[]; userIds?: string[]; /** Also count what domains below did with this domain's agents - per domain, without their people. */ includeDescendants?: boolean; /** False adds everyone's calls together: no row names a person (ADR-0061 decision 6 amendment 1-7). */ byPerson?: boolean; } export interface AiUsageBucketRow { /** The bucket in the domain's time zone: `2026-10-12 14:00`, `2026-10-12` or `2026-10`. */ bucket: string; agentId?: string; agentName?: string; provider: string; model: string; /** The domain the calls were made in. */ domainId: string; domainName: string; /** Empty on a row of a domain below, and for calls with no person. */ userId?: string; userName?: string; calls: number; inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; failures: number; /** USD at the model's price. Empty when the model has no price - never 0 (ADR-0061 decision 6 amendment 1-4). */ cost?: number; } /** * Usage per bucket × agent × person (design/ai/agent-settings.md §6-2). * * The database groups by the stored UTC hour, which every database can do; the hours are then rolled up into the * domain's days or months here. People of a domain below are never named to the domain above. */ export declare function summarizeAiUsage(given: Domain, filter: AiUsageFilter): Promise; export declare function rollUp(hours: any[], bucket: AiUsageBucketSize, timezone: string | undefined, hereId: string, agentNameOf: Map, prices?: Map, byPerson?: boolean): AiUsageBucketRow[];