feat: session-based token tracking dashboard and Copilot session title integration#158
feat: session-based token tracking dashboard and Copilot session title integration#158rbinar wants to merge 6 commits into
Conversation
Adds a "Context Window" dropdown in the Copilot Chat model configuration panel, letting users switch between 200K and 1M token context windows per model. - Combine reasoningEffort and contextSize into a single configurationSchema so both controls appear in the model picker dropdown (non-public VS Code API, same mechanism used by Copilot for thinking effort). - maxInputTokens raised from 656K to 1,000,000 to support 1M mode. - maxOutputTokens set to 128,000 — a conservative middle ground that keeps the displayed context window reasonable (200K input + 128K output = 328K, 1M input + 128K output = ~1.1M) without sacrificing DeepSeek's actual generation headroom. This does NOT affect API-level max_tokens, which is controlled by a separate VS Code setting. - Sync dropdown choice back to workspace setting (deepseek-copilot.contextSize) after each request so the value persists across sessions. - Both DeepSeek V4 Flash and Pro supported. - English and Chinese i18n for dropdown labels and descriptions. Why: the default 656K input window was too small for long sessions, while always reserving 1M adds latency and cost. Giving users control lets them pick the right trade-off between speed/cost (200K) and capacity (1M).
- Status bar button with hubot icon opening persistent webview panel - Balance display from /user/balance API with refresh - Session token tracker with per-request history - Estimated cost calculation using model pricing - Click-to-expand per-request breakdown table - DeepSeek links (API Keys, Usage, Status) - Extension version in footer
- Sessions survive VS Code restarts via globalState - Auto-reset at day boundary, saves previous day to history - Daily history table in panel (click 'history' to expand) - Mid-session date change detection
- Session tokens grouped by first user message title - 'sessions' toggle in Session Tokens card shows group breakdown - Balance color: rgb(96, 179, 254) blue - Est. cost color: rgb(255, 161, 10) amber
- Status bar butonu ve webview panel eklendi (DeepSeek paneli) - Balance, token kullanımı, maliyet takibi yapıldı - Session (oturum) bazlı gruplama: aynı Copilot sohbetindeki tüm istekler tek grupta toplanıyor - Copilot Chat session başlıkları state.vscdb üzerinden okunuyor (<userRequest> fallback ile) - Günlük geçmiş (daily history) globalState üzerinde kalıcı - Session kartına tıklayınca per-request detay gösterimi - Panelde reset butonu ile veri temizleme - maxInputTokens 655360 → 1000000 artırıldı - contextSize konfigürasyonu package.json'a eklendi
|
Hi @rbinar, thank you for putting this together. There is a lot of thoughtful work here, especially around making usage/cost visible and improving the panel UX. After digging into the session-tracking approach, I don’t think we should continue with this PR in its current direction. The main concern is architectural rather than implementation effort: For this feature to be robust, VS Code needs to expose a stable chat/session identity to Because session grouping would be misleading if it ever attributes usage to the wrong conversation, I’d rather not build on top of private storage heuristics. I’m going to close this PR for now, but I really appreciate the exploration here. If VS Code exposes a stable session id in the provider API later, I’d be happy to revisit this feature on that foundation. I hope this doesn’t come across as dismissing the work. The UX direction is useful; I just don’t want us to ship a feature whose correctness depends on VS Code internals we don’t control. |
rbinar
left a comment
There was a problem hiding this comment.
Reworked this in #163 per the architectural feedback — all VS Code internal storage access (state.vscdb, ChatSessionStore.index, sqlite3, lastMessageDate) is removed.
The panel now aggregates usage purely from the provider's own request stream: daily totals, per-model breakdown, and chronological per-request list. No more session-to-chat mapping heuristics that could misattribute across windows/workspaces.
Conversation-level grouping is intentionally deferred until VS Code exposes a stable session id (tracking microsoft/vscode#305853) — left a clean seam for it.
See #163 for the full diff and reasoning.
What was done?
Status Bar & Webview Panel
Session-Based Token Tracking
chat.ChatSessionStore.indexCopilot Session Title Integration
state.vscdbSQLite database<userRequest>content when Copilot hasn't generated a title yet ("New Chat")Daily History
globalStateOther
maxInputTokensincreased from 655,360 → 1,000,000deepseek-copilot.contextSizeconfiguration propertyWhy?
deepseek-panel.mov