Add assistant message copy action and harden related test/storage fallbacks#1211
Add assistant message copy action and harden related test/storage fallbacks#1211shivamhwp wants to merge 4 commits intopingdotgg:mainfrom
Conversation
- make `MessageCopyButton` configurable with disabled state, titles, style props, and copy/error callbacks - show assistant copy action in timeline metadata, disable it while streaming, and add toast feedback - extract and test copy-visibility logic for streaming/empty assistant messages
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can customize the tone of the review comments and chat replies.Configure the |
- guard theme hook against missing window/document/localStorage and add server snapshot - add in-memory fallback storage for persisted terminal state when localStorage is unavailable - simplify brittle platform/global test setup to match new runtime-safe behavior
- Reference `globalThis.localStorage` in `beforeEach` - Keep storage cleanup logic consistent across test environments
What Changed
Added a copy action for assistant messages in the chat timeline. The control lives in the assistant footer, copies only the assistant response text, stays visible but disabled while the message is still streaming, and becomes clickable once the response is complete.
The shared message copy button was also extended so it can be rendered as a compact muted button for this footer treatment. Tests were updated to cover the assistant copy visibility and streaming-disabled behavior.
Why
The app already supported copying code blocks and user messages, but not full assistant responses.
This approach keeps the behavior predictable by sourcing the copied content directly from the assistant message text already stored in the timeline, so it does not include work-log entries, command metadata, timestamps, or diff UI. Keeping the button disabled during streaming also avoids partial-copy behavior and makes the interaction state explicit.
UI Changes
This adds a small muted copy button next to the assistant message timestamp in the footer. It is disabled while the assistant is streaming and enabled after the response completes.
Before


After
Fixes #1164
Checklist
Note
Add copy action to assistant messages and harden storage/SSR fallbacks
MessageCopyButtonto assistant message rows inMessagesTimeline.tsx: visible and enabled for completed messages, visible but disabled while streaming, hidden when the response is empty; success/error toasts are shown on copy.resolveAssistantMessageCopyStateinMessagesTimeline.logic.tsto centralize copy visibility, disabled state, and text resolution for assistant messages.MessageCopyButtonwithdisabled,label,size,variant,onCopy, andonErrorprops.useTheme.tsandterminalStateStore.tsagainst SSR and non-browser environments by gatingwindow/document/localStorageaccess and falling back to in-memory storage or stable defaults.Macroscope summarized 928a793.