mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-07-10 01:29:41 +00:00
VS Code GitHub Copilot Chat users with no OTel agent-traces.db and no ~/.copilot/session-state/ saw $0.00 cost: codeburn never read VS Code's core chat persistence, the only on-disk source carrying their token counts. Add a fourth Copilot source that reads the VS Code chat delta-journals at workspaceStorage/<hash>/chatSessions/*.jsonl and globalStorage/emptyWindowChatSessions/*.jsonl. The files are a kind:0 snapshot / kind:1 path-set / kind:2 array-append journal; we replay it (prototype-pollution-safe: __proto__/prototype/constructor segments are rejected and containers use Object.create(null)) and read each request's result.metadata.promptTokens / outputTokens (falling back to completionTokens) and resolvedModel for pricing. Dedup so users with multiple sources are not double-counted: prefer OTel (skip chatSessions discovery when an OTel source is present), and skip a workspace's legacy GitHub.copilot-chat/transcripts when that workspace has chatSessions. New env overrides CODEBURN_COPILOT_GLOBAL_STORAGE_DIR and the existing CODEBURN_COPILOT_WS_STORAGE_DIR keep discovery testable. Tests cover the reporter's real request shape (promptTokens 32543 / outputTokens 60 -> non-zero cost), empty sessions, emptyWindow discovery, append-then-edit replay, requestId dedup, prototype-pollution paths, the transcript skip, and the OTel-prefer skip. |
||
|---|---|---|
| .. | ||
| design | ||
| providers | ||
| architecture.md | ||