feat(mentions): Slack-style inline @-mentions in chat + agent composers, avatar circle fix#74
Merged
Merged
Conversation
…rs, avatar circle fix User-reported (dogfood session 377): mentioning a person dropped a chip above the composer and sent as a boxed attachment under the message instead of rendering inline in the text; user avatars drew as a square inside a circle. - MentionComposerPlugin gains an `insertNode` commit mode: the @token becomes a real inline MentionNode chip + trailing space (tokenText/excise modes kept for comments); `onSelect` is now optional. - CompactEditor handle gains `setText` (discrete) for intent-seeded drafts. - The Lexical-free `renderEditorState` renders `mention` nodes as inline chips (same classes as MentionNode.decorate) instead of the ⟦mention⟧ fallback. - `extractNoteReferences` now carries the mention chip's denormalised `label` (clamped); new sdk composer-context helpers `inlineMentionRefs`, `withMentionAttachments` (lift inline mentions into Person/Entity wire attachments so the mention-notifier + agent grounding keep working) and `visibleAttachments` (hide the chip whose mention already shows inline; legacy messages keep their chip). - Chat: composer registers MentionNode + insertNode mode (no rail chip on mention); send lifts inline mentions into attachments; transcript hides mention-duplicated Person chips. Avatar: image avatars now fill the circular host (were 28px rounded squares inside a 34px ring); members-panel avatars sized to their 26px row. - Agent: the textarea composer is migrated to the same CompactEditor + MentionComposerPlugin surface (control-faces baseline tightened); user turns persist a `richBody` and render it rich; mention-derived attachments ground the turn without rendering as chips. Verified in the real shell (dogfood 377-inline-mentions: inline chip in both composers, no rail chip, sent message renders the mention inline with zero attachment boxes). Full suite green (14179 tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
User-reported (dogfood): in Chat, mentioning a person dropped a chip above the composer and the sent message carried a boxed attachment chip instead of the mention rendering inline in the text; user avatars rendered as a square inside a circle. Expected Slack behavior, identical in Chat and Agent.
Editor / SDK
MentionComposerPlugingains aninsertNodecommit mode: committing a typeahead row replaces the@tokenwith a real inlineMentionNodechip + trailing space. ThetokenText(comments) and excise modes remain;onSelectis now optional.CompactEditorHandle.setText(discrete update) — lets the Agent seed intent-driven drafts.renderEditorStatenow rendersmentionnodes as inline chips (same classes asMentionNode.decorate()) instead of the⟦mention⟧fallback.extractNoteReferencescarries the mention chip's denormalisedlabel(clamped to 256).composer-contexthelpers, shared by both apps:inlineMentionRefs(richBody)— the mention chips in a serialized rich body;withMentionAttachments(richBody, atts)— lifts inline mentions into durable Person/Entity attachments (the mention-notifier and agent grounding keep working — the mention still travels on the wire, it just doesn't render as a chip);visibleAttachments(msg)— hides a chip whose mention already shows inline; legacy messages keep their chip; media always shows.Chat
MentionNode+insertNode— no rail chip on mention; send lifts inline mentions into wire attachments; transcript hides mention-duplicated Person chips.Agent
<textarea>composer is migrated to the sameCompactEditor+MentionComposerPluginsurface (hand-rolled-control baseline tightened). User turns persistrichBodyand render rich; mention-derived attachments ground the turn without rendering as chips.Verification
377-inline-mentions(harness repo): all PASS — inline chip in both composers, zero rail chips, sent message renders the mention inline with zero attachment boxes.bun run verify+ lint (css-token, control-faces, reactivity ratchets) clean.Security
No new capability surface, IPC method, or dependency. The mention walker runs over peer-writable
richBody— it reuses the existing depth-capped, fail-softextractNoteReferences, and the lifted label is length-clamped.🤖 Generated with Claude Code