Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ce0df52
feat(mentions): let saved teams mention people outside the channel
LordMelkor Nov 6, 2026
2a11787
fix(mentions): request team names in the background, skipping oversiz…
LordMelkor Nov 6, 2026
96737da
feat(mentions): a saved team inserts one group chip
LordMelkor Nov 6, 2026
125b6d0
fix(mentions): group chips in chat titles, inline code and references
LordMelkor Nov 6, 2026
9294346
fix(mentions): a group stays plain text in Markdown and inline code
LordMelkor Nov 6, 2026
81559c8
fix(mentions): send each person once, keep picked groups plain in cod…
LordMelkor Nov 6, 2026
dc092dd
fix(solo): keep a leading group chip in a new chat's title
LordMelkor Nov 6, 2026
329b7dd
fix(mentions): Solo tags after a group join in order; a group in lite…
LordMelkor Nov 7, 2026
0ea915d
test(mentions): a repeated key doesn't count toward the 32-tag limit
LordMelkor Nov 7, 2026
4b0afb8
Say which teams a Solo chat can mention
LordMelkor Nov 16, 2026
db3a301
feat(communities): sign community mention group commands
LordMelkor Nov 16, 2026
cca583d
feat(communities): a live community mention group directory
LordMelkor Nov 16, 2026
83ef095
feat(mentions): community mention groups in the @ chooser
LordMelkor Nov 16, 2026
af773e2
feat(channels): add a community mention group to a channel
LordMelkor Nov 16, 2026
ccf38d8
fix(mentions): groups skip archived agents and block Space mid-read
LordMelkor Nov 16, 2026
820931c
feat(communities): read the relay's mention group size limit
LordMelkor Nov 16, 2026
43b60f5
docs: community mention groups in the choosers and Add people
LordMelkor Nov 16, 2026
8cca1d0
fix(mentions): a group's unavailable member isn't the viewer's to edit
LordMelkor Nov 16, 2026
9f3d012
fix(communities): match relay group edit authority under admins
LordMelkor Nov 16, 2026
5d2d2c8
fix(communities): match relay group ids, freeze retries, recheck agents
LordMelkor Nov 16, 2026
5e81602
fix(communities): notify nobody without a roster, batch owner lookups
LordMelkor Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions browser-host/relay-authority.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ async function harness(info, identity = generateSecretKey()) {
},
};
}
it.each([
[{}, undefined],
[{ supported_extensions: ["nip-mg"] }, undefined],
[
{
supported_extensions: ["nip-mg"],
mention_groups: { version: 1, membership: "open" },
},
{ membership: "open", defaultManage: "everyone" },
],
[
{
supported_extensions: ["nip-mg"],
mention_groups: { version: 1, membership: "roster", max_members: 20 },
},
{ membership: "roster", defaultManage: "everyone", maxMembers: 20 },
],
])(
"carries a v1 NIP-MG advertisement to the browser transport: %j",
async (advertised, support) => {
const h = await harness(() => Response.json({ self, ...advertised }));
try {
expect((await h.connect()).mentionGroups).toEqual(support);
} finally {
await h.close();
}
},
);
it.each([
[undefined, false],
[null, false],
Expand Down
97 changes: 97 additions & 0 deletions browser-host/relay-broker-api.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,103 @@ test("member change receipts must match the signed command", async () => {
}
});

test("mention group changes sign the relay's exact command kinds and reject malformed changes locally", async () => {
let answer;
const { h, post } = await communityAdmin((call) =>
answer
? Response.json({ error: answer }, { status: 409 })
: Response.json({ accepted: true, event_id: call.body.id, message: "" }),
);
const id = "0659678f-fddb-40df-a285-35f6b41db019";
const person = "a".repeat(64);
const agent = "b".repeat(64);
const created_at = Math.floor(Date.now() / 1000);
const put = {
action: "put",
id,
prev: "0",
name: "On call",
members: [person, agent],
channels: ["general"],
created_at,
};
try {
for (const [change, kind, tags] of [
[
put,
47000,
[
["d", id],
["prev", "0"],
["name", "On call"],
["p", person],
["p", agent],
["channel", "general"],
],
],
[
{ action: "remove", id, prev: "4", created_at },
47001,
[
["d", id],
["prev", "4"],
],
],
[
{ action: "manage", manage: "admins", prev: "0", created_at },
47002,
[
["manage", "admins"],
["prev", "0"],
],
],
]) {
const response = await post("mention-group", change);
expect(response.status).toBe(200);
const sent = h.calls.at(-1);
expect(sent.url).toBe(`${fixtureRelayUrl}/events`);
expect(verifyEvent(sent.body)).toBe(true);
expect(sent.body).toMatchObject({
kind,
tags,
content: "",
pubkey: h.event.pubkey,
created_at,
});
}
// A retry after an unknown outcome is the same event, so the relay's
// receipt answers it instead of applying the change twice.
const first = h.calls[0].body.id;
expect((await post("mention-group", put)).status).toBe(200);
expect(h.calls.at(-1).body.id).toBe(first);
answer = "conflict: mention group version changed";
const conflict = await post("mention-group", put);
expect(conflict.status).toBe(409);
expect((await conflict.json()).error).toBe(answer);
const sent = h.calls.length;
for (const change of [
{ ...put, created_at: created_at + 3600 },
{ ...put, created_at: undefined },
{ ...put, prev: "01" },
{ ...put, name: " On call" },
{ ...put, name: "" },
{ ...put, id: id.toUpperCase() },
{ ...put, members: [person, person] },
{ ...put, members: ["A".repeat(64)] },
{ ...put, channels: ["a/b"] },
{ ...put, action: "rename" },
{ action: "manage", manage: "owners", prev: "0", created_at },
{ kind: 47000, tags: [["d", id]], created_at },
])
expect((await post("mention-group", change)).status).toBe(400);
// Unscoped requests name no community.
expect((await h.post("mention-group", put)).status).toBe(400);
expect(h.calls).toHaveLength(sent);
} finally {
await h.close();
}
});

test("leave requests sign the exact NIP-43 shape for the selected community only", async () => {
const { h, post } = await communityAdmin((call) =>
Response.json({ accepted: true, event_id: call.body.id, message: "" }),
Expand Down
30 changes: 23 additions & 7 deletions browser-host/relay-broker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ import {
claimReason,
inviteRequest,
memberCommand,
mentionGroupCommand,
mentionGroupReason,
mentionGroupSupport,
} from "../src/features/communities/admin-protocol.ts";
import {
leaveRefusal,
Expand Down Expand Up @@ -340,6 +343,8 @@ async function relayAuthority(fetch, relay) {
artifactSupport:
Array.isArray(nip11.supported_extensions) &&
nip11.supported_extensions.includes("nip-ar"),
// NIP-MG: community mention groups and the membership rule they follow.
mentionGroups: mentionGroupSupport(nip11),
// Bridge search accepts `search_sort: "newest"`.
searchSort:
Array.isArray(nip11.supported_extensions) &&
Expand Down Expand Up @@ -1698,6 +1703,7 @@ export function relayBrokerPlugin({
sidebarMuteWrites: true,
channelKit: true,
channelIdentity: (await getAuthority(relay)).channelIdentity,
mentionGroups: (await getAuthority(relay)).mentionGroups,
readState: true,
sidebarPreferenceWrites: true,
sidebarSectionRemoval: true,
Expand Down Expand Up @@ -2467,6 +2473,7 @@ export function relayBrokerPlugin({
"/api/relay/accept-policy",
"/api/relay/invite",
"/api/relay/member",
"/api/relay/mention-group",
"/api/relay/leave",
"/api/relay/gifs",
"/api/relay/profile-search",
Expand Down Expand Up @@ -2778,19 +2785,21 @@ export function relayBrokerPlugin({
const policy = route === "/api/relay/accept-policy";
const invite = route === "/api/relay/invite";
const member = route === "/api/relay/member";
const group = route === "/api/relay/mention-group";
const leave = route === "/api/relay/leave";
const gifs = route === "/api/relay/gifs";
const profileSearch = route === "/api/relay/profile-search";
// Only these routes may surface an exact, allowed relay refusal.
const refusal =
invite || member
const refusal = group
? mentionGroupReason
: invite || member
? adminReason
: claim
? claimReason
: leave
? leaveRefusal
: undefined;
if (invite || member || leave) {
if (invite || member || group || leave) {
// Community-bound only; the relay remains the authority for roles.
if (!scoped)
return json(res, 400, { error: "Select a community first" });
Expand All @@ -2799,7 +2808,11 @@ export function relayBrokerPlugin({
filters = invite
? inviteRequest(filters)
: finalizeEvent(
leave ? leaveRequestTemplate() : memberCommand(filters),
leave
? leaveRequestTemplate()
: group
? mentionGroupCommand(filters)
: memberCommand(filters),
key,
);
} catch (error) {
Expand Down Expand Up @@ -3142,6 +3155,7 @@ export function relayBrokerPlugin({
!policy &&
!invite &&
!member &&
!group &&
!leave &&
!gifs &&
!profileSearch &&
Expand Down Expand Up @@ -3228,7 +3242,7 @@ export function relayBrokerPlugin({
? gifSearchPath
: profileSearch
? "/profiles/search"
: profile || directMessage || member || leave
: profile || directMessage || member || group || leave
? "/events"
: claim
? "/api/invites/claim"
Expand Down Expand Up @@ -3392,7 +3406,7 @@ export function relayBrokerPlugin({
});
}
}
if (profile || member || leave) {
if (profile || member || group || leave) {
const receipt = JSON.parse(text);
if (
receipt.event_id !== filters.id ||
Expand All @@ -3403,7 +3417,9 @@ export function relayBrokerPlugin({
? "Leave request could not be confirmed"
: member
? "Member change could not be confirmed"
: "Profile publication could not be confirmed",
: group
? "Group change could not be confirmed"
: "Profile publication could not be confirmed",
});
}
res.writeHead(200, {
Expand Down
22 changes: 17 additions & 5 deletions docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -1155,17 +1155,29 @@ in both mention choosers under the same community visibility rules. Legacy
channel-kit teams (see [Channels](channels.md)) remain available independently;
a legacy catalog failure does not block current teams. A team is a shortcut, not
a group identity: explicit selection
inserts its saved agent keys as individual mentions in one undoable edit through
`insertMentions`. Names never resolve membership. Typing a team name or Space
inserts one `@team` chip in one undoable edit, which notifies each saved key as an
individual mention (a `group` completion edit). Its row counts people and agents.
Removing a member keeps the chip for the rest; typing into its name, code, opening
it as text or copying it leaves plain `@team`. Names never resolve membership. Typing a team name or Space
alone does not select it. Team names also prevent Space from accidentally selecting
a person with the same name or a prefix. Each query shows at most 20 matching teams,
with up to four cached avatar thumbnails and a remainder count. Empty, oversized
(more than 32 agents), changed or partially unavailable teams stay disabled; there
is no partial expansion. Reopen or change the query to refresh changed team
choices. The resulting draft must fit the existing 32-mention and message-length
limits. Selection never adds members: ordinary channels retain invite-on-send
consent, DMs retain reference-only outsiders, and Solo chats add only the
viewer's available agents.
limits; a person mentioned by several chips counts once. Selection never adds
members: ordinary channels retain invite-on-send consent, DMs retain
reference-only outsiders, and Solo chats add only the viewer's available agents.

Community mention groups (see [Communities](communities.md#community-mention-groups))
appear in both choosers as **Group** rows beside the saved teams and follow the
same rules: one `@group` chip that notifies each current member, people and
agents counted in the row, Space and typed names never select it, and a group
that is empty, too large, changed or still loading its members stays disabled.
When the directory cannot be read the chooser says so and offers **Retry
groups**. In a channel's **Add people**, matching groups are listed with
**Add group**, which adds only the members not yet in the channel and skips
archived agents.

The picker supports Up/Down navigation, Enter selection and Escape dismissal.

Expand Down
15 changes: 13 additions & 2 deletions docs/buzz-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -1497,14 +1497,25 @@ available rather than silently discarding it.
this device.

Saved teams from **Your teams** appear in the inline `@` suggestions and the
mention picker. Select a team to insert its members as individual mentions.
Typing its name alone does not notify it. Empty teams, teams with more than 32
mention picker. Select a team to insert one `@team` mention that notifies each
member; the suggestion shows how many people and agents it holds.
A saved team can hold people as well as agents; a person outside the
conversation is offered the way the `@` picker offers them. In a Solo chat, a
team can be selected only when every member is in the chat or is one of your
available agents. Typing its name alone does not notify it. Empty teams, teams with more than 32
members, and teams with unavailable members cannot be selected; edit the team or
refresh the choices. Adding people to a channel still requires the normal send
confirmation. **Delete team** asks first; it doesn't delete the team's agents.
Closing a team's editor with unsaved edits, by Escape, its Close or another
tab, asks **Discard changes?** first; **Keep editing** keeps them.

A community can also have mention groups, which everyone in the community
shares. They appear in the `@` suggestions as **Group** with how many people
and agents they hold, and selecting one mentions every member. In a channel,
**Add people** lists matching groups; **Add group** adds the members who aren't
in the channel yet. A group can have only as many members as the community
allows; for a larger group, use a channel.

## Optional features and limits

- Plugins can add features. **Settings → Plugins → Manage plugins** controls
Expand Down
27 changes: 27 additions & 0 deletions docs/communities.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,33 @@ empty state there. Try drafting in A, switching to B, then returning to A.
Selected channels, drafts and reading offsets are partitioned by the canonical
community origin and viewer; channel IDs alone are not sufficient keys.

## Community mention groups

A relay that advertises NIP-MG (`nip-mg` in `supported_extensions` with a
version 1 `mention_groups` object) keeps the community's mention groups, like
Slack user groups: each has a name, members and optional default channels, and
everyone in the community sees the same groups. `session.mentionGroups` is the
host capability. Its `directory` is a live snapshot of the relay-signed kind
`39010` groups: it shows groups only after a complete paged read, takes the
newest version of each group from live updates, reads again after every
reconnect, and never empties on a failed read (`unavailable`, then **Retry**).
On a `roster` community a group's members are its current roster members and
owner-admitted agents, and a group waits while that membership is still being
read, so nothing sends to a partial set. If the relay publishes no roster,
groups notify nobody.

`put`, `remove` and `setManage` sign one command (kind `47000` put, `47001`
delete, `47002` "Who can manage groups") with the group's current version as
its precondition: the broker signs it in development, and the native host signs
only those exact shapes and posts them to the relay's `/events`. The relay
alone decides authority from the community's **Who can manage groups**
setting (owners and admins, or everyone; NIP-11 `default_manage` applies until
the first setting is saved). A retry resends the same signed command, so the
relay answers it from its receipt rather than applying it twice. A stale
version, a taken name and a refusal come back as distinct answers. When the
relay advertises `max_members`, the directory exposes it as `maxMembers`, the
most members a group may have; larger groups belong in a channel.

## Import from the previous desktop app

After native startup, Buzz offers the previous desktop app's saved communities
Expand Down
4 changes: 3 additions & 1 deletion docs/plugin-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -3131,7 +3131,9 @@ Providers receive immutable observation/range evidence and `publish(result)`—n
DOM, focus or replacement commands. Results contain stable IDs, labels, optional
detail/decorative previews, an optional `agent` flag (marked and announced only
for the bundled mention and channel providers) and either text, an exact `{ pubkey, name }` mention,
or a `mentions` array of up to 32 such recipients. Batch edit primitives are
a `mentions` array of up to 32 such recipients, or a `group` of `{ name, mentions }`:
one `@name` chip that notifies each of its up to 32 mentions. In a message edit a
group inserts only its name, since edits add no recipients. Batch edit primitives are
copied and frozen before display, and accepted as a single editor transaction.
The host copies edit/query primitives and caps publications at 50 choices. A
publication returns its own withdrawal disposer (or `false` after revocation).
Expand Down
Loading
Loading