Q75: charts and billing use full-period statistics computed per org

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 12:41:44 -04:00
1 parent daea9797d4
commit 8b4df5e11f
14 files changed
+231 -83

No files matched your search

+3
View File
@@ -1,3 +1,4 @@
import type { UsageStatsRecord } from "./usage-stats";
import type { AuditReplayRunRecord } from "./audit-domain";
import type { IntegrationKeyStatus } from "./commands/integration-keys";
import type { BoardInterventionRecord as BoardInterventionRecordModel } from "./board-domain";
@@ -102,6 +103,8 @@ export interface AppSnapshot {
providerCatalog: ProviderCatalogEntry[];
providerRequests: ProviderRequestRecord[];
providerRateLimits: ProviderRateLimitStateRecord[];
/** Period statistics per org over all records, for charts and billing. */
usageStats: UsageStatsRecord[];
providerRateLimitObservations: ProviderRateLimitObservationRecord[];
// The snapshot is the renderer's working set and rides IPC on every
// refresh. Skill internals (revisions, bindings, per-run runtime
+23
View File
@@ -0,0 +1,23 @@
/** One org's period statistics: the last 7 local days, and the last 30 days of provider calls. */
export interface UsageStatsRecord {
orgId: string;
days: Array<{
dayStart: string;
runs: number;
completedRuns: number;
failedRuns: number;
tokens: number;
callsWithoutUsage: number;
}>;
month: {
requests: number;
failures: number;
inputTokens: number;
cachedInputTokens: number;
outputTokens: number;
reasoningTokens: number;
callsWithoutUsage: number;
};
agentSpend: Array<{ agentId: string; requests: number; tokens: number; costCents: number }>;
providerActivity: Array<{ providerId: string; requests: number; failures: number }>;
}