feat(chat): add reply-to-selection with quoted context#36
Merged
Conversation
- Users can select text in assistant messages and click "Reply" in floating toolbar - Quoted text prepended to prompts as <quoted_context> XML blocks - Keyboard shortcut: Cmd/Ctrl+Shift+R to reply, Escape to dismiss - New components: SelectionReplyToolbar, QuotedContextInlineChip, UserMessageQuotedContextLabel - Quoted contexts stored transiently in composerDraftStore, cleared on send - Expandable label displays quoted context in message timeline - Quoted text truncated at 5000 chars with ...[truncated] suffix - Code block selections automatically detect language
- Add electron to trustedDependencies in bun.lock and package.json - Consolidate tailwindcss version references in lockfile
- Display checkmark icon when selection is copied to clipboard - Fix toolbar positioning to use fixed positioning correctly - Sanitize code language attributes and escape quoted context body - Extract formatQuotedContextTooltip utility function - Add TOOLBAR_HEIGHT_PX and TOOLBAR_GAP_PX constants - Replace custom ID generation with randomUUID() - Remove unused stripAllQuotedContextBlocks() and related pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements the ability to reply to specific text selections within assistant messages. Users can:
Key Design Decisions:
<quoted_context>XML blocks...[truncated]suffixcreatePortalfor positioning above assistant message contentChanges
apps/web/src/lib/quotedContext.ts(new) — Core types and utilities:QuotedContext, truncation, formatting, parsing leading quoted blocks, deduplicationapps/web/src/components/chat/SelectionReplyToolbar.tsx(new) — Floating toolbar on text selection; detects code block context; handles Cmd/Ctrl+Shift+R and Escapeapps/web/src/components/chat/QuotedContextInlineChip.tsx(new) — Violet inline chip in composer showing preview + remove buttonapps/web/src/components/chat/UserMessageQuotedContextLabel.tsx(new) — Expandable label in message timeline showing quoted context when user message includes itapps/web/src/composerDraftStore.ts— AddedquotedContextsfield,addQuotedContext(),removeQuotedContext(),clearQuotedContexts()actionsapps/web/src/components/chat/MessagesTimeline.tsx— IntegratedAssistantMessageContentWithReplywrapper,SelectionReplyToolbarintegration, timeline label displayapps/web/src/components/ChatView.tsx— Integrated quoted context into composer, send flow, and send state derivationAGENTS.md— Documented the feature architecture and key patternsTesting
...[truncated]suffix and warning logged