Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/commands/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const {
resolveKiroBasePath,
resolveHermesPath,
resolveCopilotOtelPaths,
resolveVsCodeCopilotChatSessionPaths,
normalizeCopilotDbPath,
uniqueCopilotDbPaths,
coalesceCopilotDbStatesByIdentity,
Expand Down Expand Up @@ -73,6 +74,7 @@ const {
copilotOtelCursorHasLegacyCliUsage,
pruneCopilotUsageClaims,
parseCopilotIncremental,
parseVsCodeCopilotChatIncremental,
parseCopilotSessionStoreIncremental,
parseCopilotAppDbIncremental,
resolveKimiWireFiles,
Expand Down Expand Up @@ -2823,6 +2825,49 @@ async function cmdSync(argv, context = {}) {
}
}

// ── VS Code Copilot Chat persisted workspace sessions ──
// The Chat extension can be routed through a custom endpoint without
// emitting ~/.copilot OTEL or session-store rows. Its exact token counts
// are persisted in workspaceStorage/*/chatSessions/*.jsonl (or legacy
// .json snapshots), so parse that source after the legacy Copilot readers.
const vscodeCopilotChatPaths = copilotSourceAllowed
? resolveVsCodeCopilotChatSessionPaths(process.env)
: [];
const hasTrackedVsCodeCopilotChatFiles =
cursors?.copilotVsCode?.files &&
Object.keys(cursors.copilotVsCode.files).length > 0;
if (
copilotSourceAllowed &&
(vscodeCopilotChatPaths.length > 0 || hasTrackedVsCodeCopilotChatFiles)
) {
if (progress?.enabled) {
progress.start(`Parsing VS Code Copilot ${renderBar(0)} | buckets 0`);
}
try {
const vscodeCopilotResult = await parseVsCodeCopilotChatIncremental({
sessionPaths: vscodeCopilotChatPaths,
cursors,
queuePath,
env: process.env,
onProgress: (p) => {
if (!progress?.enabled) return;
const pct = p.total > 0 ? p.index / p.total : 1;
progress.update(
`Parsing VS Code Copilot ${renderBar(pct)} ${formatNumber(p.index)}/${formatNumber(p.total)} files | buckets ${formatNumber(p.bucketsQueued)}`,
);
},
});
copilotResult = mergeParseResult(copilotResult, vscodeCopilotResult);
if (vscodeCopilotResult.fileErrors > 0 && !opts.auto) {
process.stderr.write(
`VS Code Copilot sync: skipped ${vscodeCopilotResult.fileErrors} unreadable session file(s)\n`,
);
}
} catch (err) {
warnProviderParseFailure("VS Code Copilot", err, opts);
}
}

if (copilotSourceAllowed) {
if (Array.isArray(cursors?.copilot?.recentUsageEvents)) {
cursors.copilot.recentUsageEvents = pruneCopilotUsageClaims(
Expand Down
Loading