desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs
Comment 1, line 1
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:1
//! VS Code built-in GitHub Copilot Chat usage adapter with its own source directory.Comment 2, line 2
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:2
//! Read native workspaceStorage/<hash>/chatSessions/<sessionId>.jsonl logs,Comment 3, line 3
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:3
//! chatSessionOperationLog storageSchema version 3, checked against localComment 4, line 4
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:4
//! VS Code 1.140.0 records on 2026-10-01.Comment 5, line 5
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:5
//!Comment 6, line 6
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:6
//! Source references: microsoft/vscode and local records checked 2026-10-01.Comment 7, line 7
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:7
//! - chatSessionStore.ts persists workspaceStorageHome/<workspaceId>/chatSessions;Comment 8, line 8
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:8
//! windows without a workspace use no-workspace/chatSessions.Comment 9, line 9
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:9
//! - objectMutationLog.ts entries: kind 0 initial object, kind 1 Set(k,v),Comment 10, line 10
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:10
//! kind 2 Push(k,v[],i), and kind 3 Delete; i is the length after truncation.Comment 11, line 11
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:11
//! After more than 1024 entries upstream can replace the log with a new initial object.Comment 12, line 12
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:12
//! - chatModel.ts toJSON and chatSessionOperationLog.ts define request fields:Comment 13, line 13
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:13
//! promptTokens covers the most recent model call's input, as IChatUsage describes.Comment 14, line 14
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:14
//! completionTokens accumulates output across calls in the whole user turn.Comment 15, line 15
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:15
//! chatModel._setUsage accumulates output; supplied modelTotals takes precedence.Comment 16, line 16
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:16
//! copilotCredits is a turn-level credit quantity converted from nano AIU, not tokens.Comment 17, line 17
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:17
//! elapsedMs/outputBuffer/modelTotals/sessionCopilotCredits are also stored;Comment 18, line 18
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:18
//! agent-host modelTotals reports whole-turn input/cache/output by model.Comment 19, line 19
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:19
//! - Copilot agentIntent.ts forwards API usage.prompt_tokens/completion_tokens/Comment 20, line 20
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:20
//! prompt_tokens_details.cached_tokens.Comment 21, line 21
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:21
//! Their persisted fields must retain their individual reporting scopes.Comment 22, line 22
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:22
//!Comment 23, line 23
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:23
//! Statistics follow the request/message/cumulative rules in data-contract:Comment 24, line 24
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:24
//! - A user turn contributes usage_observation; identified toolCallRounds contributeComment 25, line 25
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:25
//! observed model_call records, without inventing per-call token breakdowns.Comment 26, line 26
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:26
//! Rounds can carry model, reasoning, and timestamps, not a complete call usage set.Comment 27, line 27
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:27
//! - Default input is a known lower bound from the last call; output spans the whole turn.Comment 28, line 28
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:28
//! Prefer supplied whole-turn modelTotals; do not combine unlike scopes into total tokens.Comment 29, line 29
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:29
//! - Keep credits outside token statistics; account quotas are displayed via quota_history.Comment 30, line 36
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:36
/// Stateless VS Code Copilot Chat adapter.Comment 31, line 51
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:51
/// Candidate workspaceStorage roots for stable and Insiders installations.Comment 32, line 79
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:79
// On Linux/other platforms prefer XDG_CONFIG_HOME, then ~/.config.Comment 33, line 94
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:94
/// Enumerate chatSessions roots under one workspaceStorage root:Comment 34, line 95
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:95
/// one per workspace hash plus no-workspace/chatSessions.Comment 35, line 115
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:115
// Deduplicate Windows case aliases with the same rule as run_adapter_scan roots.Comment 36, line 136
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:136
/// Use the same vscode-copilot-chat Agent name as the otel service.name mappingComment 37, line 137
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:137
/// so native records and telemetry remain grouped under the same Agent.Comment 38, line 171
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:171
// Manual roots can identify chatSessions, workspaceStorage, or a parent directory.Comment 39, line 172
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:172
// Direct JSONL files select that root; otherwise search two levels for chatSessions.Comment 40, line 208
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:208
// An explicit file selects only itself; directory selection/discovery can include sibling files.Comment 41, line 393
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:393
/// Workspace/no-workspace copies from one installation share a namespace to avoid duplicate usage.Comment 42, line 417
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:417
/// Platform-specific test data checks workspaceStorage/<hash>/chatSessions/*.jsonlComment 43, line 418
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:418
/// and no-workspace/chatSessions/*.jsonl discovery.Comment 44, line 419
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:419
/// Exclude JSONL outside chatSessions.Comment 45, line 448
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:448
// Place test data under isolated APPDATA/Code/User/workspaceStorage.Comment 46, line 507
desktop/src-tauri/crates/core/src/adapters/copilot_chat/mod.rs:507
/// Manual roots: chatSessions directory, workspaceStorage directory, or one JSONL file.