Repository navigation
Load inline screenshots from Claude Code sessions - #271
mostafaseyedan wants to merge 3 commits into
Conversation
The Coding Moments gallery counts image-bearing Claude requests but can
never display them: every session shows "These sessions referenced
images, but the raw screenshots could not be loaded".
extractSessionImages dispatches on the .jsonl extension and assumes the
VS Code chat-session shape (kind/k/v envelopes, requests[].variableData
.variables). Claude Code also writes .jsonl, so its sessions take that
branch, match nothing and return an empty array. Claude stores images
inline on the user turn instead, as
message.content[].source = { type: 'base64', media_type, data }.
Add extractClaudeImagesFromJsonl and fall back to it when the VS Code
shape yields nothing. Matching is exact rather than heuristic: the
Claude parser already uses the entry uuid as the request id, so the
originating line can be located directly. The existing four-image cap
per request is preserved.
Verified against a real log set: 247 of 247 image-bearing requests now
resolve, where none did before.
|
Added a second commit: the extractor alone was not sufficient.
Verified through the RPC path rather than the extractor in isolation: Three assertions in |
extractClaudeImagesFromJsonl is a standalone function, so its tests do not belong inside the parseClaudeSessions suite. Moving them also keeps this PR from editing the same lines as microsoft#270.
|
Replacement PR #293 includes the Claude image extraction and source-index fix and extends image counting/loading to VS Code/Insiders/server variants, Copilot CLI/App, Codex, OpenCode JSON/SQLite, and Xcode. It fixes #292 and #266 and adds cross-harness, cache, worker, and browser regression coverage. Aymen (@aymenfurter) and Copilot review have been requested on #293. Keeping this PR open until the replacement is reviewed so it can be closed with the verified replacement reference. |
|
Superseded by #293, which fixes the Claude screenshot/source-index issue and extends the fix to VS Code/Insiders/server variants, Copilot CLI/App, Codex, OpenCode JSON/SQLite, and Xcode. The replacement also addresses all reported Copilot review findings with regression tests; its latest CI checks pass. Closing this overlapping implementation PR in favor of #293, where human review is requested from Aymen (@aymenfurter). #266 and #292 remain linked to the replacement and will close when it merges. |
Wire harness-aware source indexing, image counts, exact turn matching, bounded local decoding, and off-thread extraction through the existing parse worker. Preserve cache reloads and isolate gallery entries by session and request. Fixes microsoft#292 Fixes microsoft#266 Supersedes microsoft#271. Co-authored-by: Copilot <[email protected]>
Problem
The Coding Moments gallery counts image-bearing Claude Code requests, but cannot display a single one. Every Claude session lands on the empty state:
extractSessionImagesinsrc/core/parser-vscode-files.tsdispatches on the.jsonlextension and hands off toextractImagesFromJsonl, which assumes the VS Code chat-session shape —kind/k/venvelopes andrequests[].variableData.variables. Claude Code also writes.jsonl, so its sessions take that branch, match nothing, and return[].Claude stores images inline on the user turn instead:
{ "uuid": "…", "message": { "role": "user", "content": [ { "type": "text", "text": "what is wrong here?" }, { "type": "image", "source": { "type": "base64", "media_type": "image/png", "data": "…" } } ] } }Note the moments themselves are counted correctly —
parser-claude.tssetsvariableKinds.imageviacountClaudeImages— so the gallery advertises screenshots it can never render.Fix
Add
extractClaudeImagesFromJsonltoparser-claude.tsand fall back to it when the VS Code shape yields nothing.Matching is exact rather than heuristic:
parseClaudeRequestalready uses the entryuuidas the request id (parser-claude.ts), so the originating line is located directly by id rather than by scanning for image-shaped data. The existing four-image cap per request is preserved, as is the quickincludes(requestId)reject before parsing each line.Testing
Three unit tests added alongside the existing parser-claude tests: extraction by request id, the no-images and unknown-id cases, and the four-image cap. Verified they fail against a stubbed-out extractor (2 failed / 22 passed) and pass with it (24 passed).
Also verified end to end against a real log set spanning 17 project directories: 247 of 247 image-bearing requests now resolve, averaging 169 KB for the first image, where previously none did.
npm run typecheckandnpm run lintare clean (0 errors).