Skip to content

Persist screenshot images through history and cache decoded NSImage#1905

Merged
siddseethepalli merged 1 commit into
mainfrom
swarm/task-10
Feb 14, 2026
Merged

Persist screenshot images through history and cache decoded NSImage#1905
siddseethepalli merged 1 commit into
mainfrom
swarm/task-10

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

@siddseethepalli siddseethepalli commented Feb 14, 2026

Summary

Addresses two pieces of review feedback from PR #1863:

  1. Thread imageData through history hydration: Screenshot image data was only forwarded on the live tool_result stream path. After reopening a session, history_response payloads didn't include image bytes, so screenshot previews disappeared. Now renderHistoryContent extracts base64 image data from persisted contentBlocks on tool_result blocks, carries it through mergeToolResults, and includes it in the history_response wire format. The Swift client's populateFromHistory passes imageData to ToolCallData.

  2. Cache decoded screenshot image outside SwiftUI body: Previously, ToolCallChip decoded base64 into Data and NSImage directly inside body, causing repeated heavy work on every SwiftUI re-render. Now ToolCallData has a cachedImage: NSImage? property that's decoded once at init time (or when imageData is assigned on tool result), and the view reuses the cached image.

Files changed

  • assistant/src/daemon/handlers.ts — Extract imageData from contentBlocks in renderHistoryContent, carry through mergeToolResults
  • assistant/src/daemon/ipc-protocol.ts — Add imageData to HistoryResponseToolCall
  • clients/shared/IPC/IPCMessages.swift — Add imageData to HistoryToolCallItem
  • clients/macos/.../ChatMessage.swift — Add cachedImage to ToolCallData, decode once at init
  • clients/macos/.../ChatViewModel.swift — Pass imageData in populateFromHistory, set cachedImage on live tool_result
  • clients/macos/.../ToolCallChip.swift — Use cached NSImage instead of decoding in body

Test plan

  • TypeScript type-check passes
  • Existing history render tests pass (16/16)

Open with Devin

1. Thread imageData through history_response: extract base64 image data
   from persisted contentBlocks in tool_result blocks during history
   reconstruction, so screenshot previews survive session reload.

2. Cache decoded NSImage on ToolCallData to avoid repeated base64
   decoding inside SwiftUI body on every re-render.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread clients/macos/vellum-assistant/Features/Chat/ToolCallChip.swift
@siddseethepalli
Copy link
Copy Markdown
Contributor Author

Addressed in #1908

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant