@-mention parsing — per-type URL registry, agent mentions, helper queries
registerMentionType(type, generator) gives each mention type its own routing —
the single app-wide setMentionUrlGenerator cannot express per-type routes.
Resolution per mention: an explicit generator argument > the registered type generator
> the app-wide default.
registerMentionType('agent', () => '/admin/settings/agent') registerMentionType('task', (_t, id) => '/tasks/' + encodeURIComponent(id))| Mention | Resolved route |
|---|---|
| @Jane | user → /profile/u1 |
| @Ops Agent | agent → /admin/settings/agent |
| @Fix login | task → /tasks/t-42 |
extractAgentMentions(content) pulls just the type='agent' mentions
— apps route them to their admin agent settings page.
| Display name | Agent id | Route |
|---|---|---|
| @Ops Agent | ops-7 | /admin/settings/agent |
Quick reads over message content: hasMentions, countMentions, getMentionedUserIds (unique user ids in first-appearance order), and getUniqueMentionsByType (deduped by type+id, optional type filter).
hasMentions(SAMPLE) → true countMentions(SAMPLE) → 4 getMentionedUserIds(SAMPLE) → [u1] getUniqueMentionsByType(SAMPLE)→ 3 unique of 4 total getUniqueMentionsByType(SAMPLE, 'agent') → 1