[0.33.0] - 2026-04-27
Added
planUsageFromArchive(plan, { pricing, db, now })(#91) — computesPlanUsagefor a plan via oneSUM(...) GROUP BY (source, model)query against the archive'sturnstable instead of a full ledger scan. Returns the same shape ascomputePlanUsageso callers can swap paths cleanly. ReusescostForTurn's source-aware reasoning override, so Codexoutput_tokensis not double-billed againstusage.reasoning.PlanUsage.fidelityannotates per-cycle token-coverage confidence (#108).computePlanUsagenow walks every contributing turn throughsummarizeFidelityand emits a{ confidence: 'high' | 'low', summary }block alongside the existing spend/projection fields.confidence === 'high'only when every turn in the cycle isfullorusage-onlywith both per-turn input and output token coverage; otherwiselow. Records with nofidelityfield at all (older ledger writers) are treated as best-effort high, matching the codebase's existing backward-compat policy. Spend totals continue to includepartial/aggregate-only/cost-onlycontributions — under-counting is worse than annotating low-confidence — so the cycle'sspentUsdis the lower bound the consumer renders against the new flag. ThePlanUsageFidelitytype is exported for downstream consumers.