Skip to content

Add inline @-mention agent picker to the compose bar - #14

Open
PanAndDuck wants to merge 1 commit into
xintaofei:mainfrom
PanAndDuck:ios/agent-mention-picker
Open

PanAndDuck wants to merge 1 commit into
xintaofei:mainfrom
PanAndDuck:ios/agent-mention-picker

Conversation

@PanAndDuck

Copy link
Copy Markdown

Summary

  • Typing @ in the message composer now pops up a small card listing the server's enabled agents, mirroring the desktop/web client's existing @-mention feature.
  • Picking one inserts [@Name](codeg://agent/<type>) into the draft — the exact format the server already parses into a delegation on send, so no server or send-path changes are needed here.
  • The popup is scrollable rather than truncated, so it stays usable with more than a handful of agents configured.

Implementation

  • ComposeInsertModel: loadAgentsAction/loadAgentsIfNeeded, matchingAgents(for:), trailingMentionToken(in:) (a live, tail-anchored @token scan, since the compose bar's plain TextField exposes no caret position), and draftInsertingAgentMention(_:to:).
  • ComposeBar: a mentionSuggestions popup (same glass styling as the rest of the bar), shown as a VStack sibling above the text field alongside the existing notice/attachment chips.
  • SessionDetailViewModel: wires loadAgentsAction to the existing client.listAgents() call already used by the Agents settings screen — no new API surface.

Test plan

  • Builds and runs on iOS Simulator
  • Builds, installs, and runs on a physical device
  • Typing @ lists the server's agents; selecting one inserts the correct reference text
  • Sending the resulting message against a live server correctly delegates to the mentioned agent

Typing "@" in the message composer now pops up a small card listing the
server's enabled agents (mirroring the desktop/web client's existing
@-mention feature). Picking one inserts [@name](codeg://agent/<type>)
into the draft, which the server already parses into a delegation when
the message is sent — no server or send-path changes needed.

- ComposeInsertModel: loadAgentsAction/loadAgentsIfNeeded, matchingAgents,
  trailingMentionToken (a live, tail-anchored @token scan since the plain
  TextField exposes no caret position), and draftInsertingAgentMention.
- ComposeBar: mentionSuggestions popup (same glass styling as the rest of
  the bar) driven by the above, scrollable rather than truncated so it
  stays usable with more than a handful of agents configured.
- SessionDetailViewModel: wires loadAgentsAction to the existing
  client.listAgents() call (already used by the Agents settings screen).

Verified: builds and runs on Simulator and a physical device; typing "@"
lists agents and selecting one inserts the correct reference text, which
a live server correctly turns into a delegation.
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