🤖 feat: queue messages during streaming #569
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows users to send multiple messages while AI is streaming without interrupting the active response.
Demo:
queuedmessagesdemo3.mp4
Closes #522.
A follow-up PR will add 'soft-interruptions', which take effect at the end of the next content block (text-delta, reasoning-end, tool-result, tool-error)
Behavior
While streaming:
Additional messages get queued instead of starting a new stream
Queued message displays below streaming content with muted styling
User can edit queued message before stream completes by pressing up arrow (like regular messages) or the "Edit" button.
On stream completion:
Queued messages auto-send immediately
Queue supports text, images, and combined messages
On stream abort (Ctrl+C):
Queued message restores to chat input for editing
Images are preserved
Known Issues
Implementation
MessageQueue service - Accumulates text, images, and options with special handling for slash commands
AgentSession integration - Stream-end triggers auto-send, stream-abort triggers restore
QueuedMessage component - Displays queued content with edit functionality
IPC handlers - Queue management and message routing
Test coverage - 27 unit tests + 10 integration tests (requires
ANTHROPIC_API_KEY)Testing
Generated with
cmux