import type { LocalUsageRecord, AgentHarness, UsageAggregation, UsageByProvider, UsageByAgent, UsageByModel } from './types.js'; export interface UsageQuery { /** ISO 8601 起始 (含) */ start?: string; /** ISO 8601 结束 (不含) */ end?: string; /** 仅这些 provider */ providers?: string[]; /** 仅这些 agent harness */ agents?: AgentHarness[]; } /** * Local usage store * - in-memory Map (id → record) for dedup + 快速 query * - jsonl 持久化 (append-only, 每条 record 一行) * - load() 从 jsonl 重建 in-memory state */ export declare class LocalUsageStore { private records; private filePath; private dirty; constructor(opts?: { filePath?: string; }); /** 启动时从文件 load */ load(): Promise; /** 批量 append (dedup by id), 写文件 */ appendBatch(batch: LocalUsageRecord[]): Promise; /** 当前所有 records 数 */ size(): number; /** Query records (基础筛选) */ query(q?: UsageQuery): LocalUsageRecord[]; /** 时间窗口聚合 (总数) */ aggregate(q?: UsageQuery): UsageAggregation; /** 按 provider 聚合 */ aggregateByProvider(q?: UsageQuery): UsageByProvider[]; /** 按 agent harness 聚合 */ aggregateByAgent(q?: UsageQuery): UsageByAgent[]; /** 按 (provider, model) 聚合 */ aggregateByModel(q?: UsageQuery): UsageByModel[]; /** Helper: 聚合 records 列表 */ private aggregateRecords; /** 清空 (测试用 / 用户主动清) */ clear(): Promise; } /** * 时间窗口快捷:今日 / 本周 / 本月 */ export declare function timeWindow(period: 'today' | 'week' | 'month' | 'all'): UsageQuery; //# sourceMappingURL=store.d.ts.map