Skip to content

feat(mentions): Slack-style inline @-mentions in chat + agent composers, avatar circle fix#74

Merged
th3-br41n merged 1 commit into
mainfrom
inline-mentions
Jul 3, 2026
Merged

feat(mentions): Slack-style inline @-mentions in chat + agent composers, avatar circle fix#74
th3-br41n merged 1 commit into
mainfrom
inline-mentions

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

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

  • MentionComposerPlugin gains an insertNode commit mode: committing a typeahead row replaces the @token with a real inline MentionNode chip + trailing space. The tokenText (comments) and excise modes remain; onSelect is now optional.
  • CompactEditorHandle.setText (discrete update) — lets the Agent seed intent-driven drafts.
  • The Lexical-free renderEditorState now renders mention nodes as inline chips (same classes as MentionNode.decorate()) instead of the ⟦mention⟧ fallback.
  • extractNoteReferences carries the mention chip's denormalised label (clamped to 256).
  • New composer-context helpers, 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

  • Composer registers MentionNode + insertNode — no rail chip on mention; send lifts inline mentions into wire attachments; transcript hides mention-duplicated Person chips.
  • Avatar fix: image avatars now fill the circular host (they were 28px rounded squares centred in a 34px ring — the "square inside a circle"); glyph avatars stay centred; members-panel avatars sized to their 26px row.

Agent

  • The <textarea> composer is migrated to the same CompactEditor + MentionComposerPlugin surface (hand-rolled-control baseline tightened). User turns persist richBody and render rich; mention-derived attachments ground the turn without rendering as chips.

Verification

  • Real-shell dogfood spec 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.
  • Full suite: 1424 files / 14179 tests green (includes new plugin commit-mode tests, preview mention test, walker label tests, lift/hide helper tests).
  • 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-soft extractNoteReferences, and the lifted label is length-clamped.

🤖 Generated with Claude Code

…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>
@th3-br41n th3-br41n merged commit 647b7d1 into main Jul 3, 2026
3 checks passed
@th3-br41n th3-br41n deleted the inline-mentions branch July 3, 2026 07:44
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