Skip to content

Commit ed42271

Browse files
klopez4212codex
andcommitted
Merge latest main for navigation validation
Co-authored-by: Codex <[email protected]> Signed-off-by: klopez4212 <[email protected]>
2 parents 6472818 + 4751132 commit ed42271

37 files changed

Lines changed: 2453 additions & 170 deletions

‎docs/plugin-architecture.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ exact registration identity and mounted lifetime revoke callbacks on removal.
270270
The channel template extension point (`ctx.channelTemplates`) was removed with the
271271
v1 Agents system. The host sidebar owns personal groups and the existing + creation
272272
buttons. Channel templates are now device-local (`buzz.channel-templates.v1`,
273-
`features/channel-templates/local.ts`): a name, Agents team ids and a starting
274-
Canvas, managed under Settings → Channel templates. Picking one in Create resolves
275-
its teams to their members that are the owner's agents in this community and sends
276-
them with the Canvas as ordinary channel setup, which the session applies and
277-
retries as before.
273+
`features/channel-templates/local.ts`): a name, agent pubkeys, Agents team ids
274+
and a starting Canvas, managed under Settings → Channel templates. Picking one in
275+
Create resolves its agents and its teams' members to those that are the owner's
276+
agents in this community and sends them with the Canvas as ordinary channel setup,
277+
which the session applies and retries as before.
278278

279279
Hosted communities (`block.hosted-communities`) is a Block-specific bundled plugin
280280
under Settings → Communities. It manages Block-hosted relays through a Builderlab

‎docs/workflows.md‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,42 @@ records carry reusable verification evidence; unsigned local intent, copied
173173
caller proof symbols and ordinary senders cannot establish it. No signature
174174
verification runs while folding retained history.
175175

176+
The owner tag identifies the identity that scheduled the workflow, not the author
177+
of every rendered word. Templates can include trigger-controlled values; those
178+
values do not acquire the owner's prompt authority.
179+
180+
Claude Code and Codex also use this proof to authorize delegated workflow mentions.
181+
The receiving agent's ready community session must supply the explicit relay
182+
authority. The workflow owner must be that agent's owner, or an agent whose
183+
admitted kind-0 profile cryptographically proves the same owner through NIP-OA.
184+
The profile comes from the receiving agent's community profile directory;
185+
display metadata and saved inventories do not prove sibling ownership. Missing,
186+
invalid or failed profile reads deny the mention; a later mention can retry.
187+
Both runtimes recheck delivery cancellation after authorization, before creating
188+
sessions or starting processes, so removing an agent during a profile read cannot
189+
restart it when the read completes.
190+
The event must contain a canonical `buzz:workflow-mention` for the receiving
191+
agent; all such tags
192+
must have exactly two fields, a lowercase-hex pubkey, and no duplicate targets.
193+
The relay emits these tags only for targets present in the owner-authored template
194+
and the rendered output. Legacy `p` tags route mentions but do not authorize them.
195+
Workflows created and maintained under an owned agent's own key remain owned by
196+
that agent and can wake agents with the same proven human owner. This does not
197+
grant an agent permission to edit a workflow owned by a different signing identity.
198+
176199
Cached-only startup intentionally shows the actual signer until a live connection
177200
establishes explicit relay authority. Saved operator-contact `relayAuthor` is not
178201
promoted to `self`, and no new trusted storage is introduced. Signer-based search
179-
and Inbox sender filters, permissions, mention policy and relay-reported participant
202+
and Inbox sender filters and relay-reported participant
180203
summaries are unchanged by workflow presentation. Channel/thread rows retain the
181204
effective-author attribution and owner edit/delete behavior added separately in
182205
#661; when that author differs from the signer, the row carries a separate signing
183206
key so the disclosure still identifies the actual relay. Thread and media views
184207
request workflow-owner profiles through the existing background profile directory.
185-
The workflow proof check controls only the automation label, not main's effective
186-
message-author policy. With explicit authority, an unadmitted copy has no workflow
187-
label but can still receive main's effective-author attribution; production reads
208+
The workflow proof controls the automation label and the delegated-mention gate
209+
above; it does not control main's effective message-author policy. With explicit
210+
authority, an unadmitted copy has neither a workflow label nor delegated prompt
211+
authority, but can still receive main's effective-author attribution; production reads
188212
must retain their admission-owned event objects. Without explicit authority,
189213
cached-only startup keeps the signer fallback described above.
190214
Participant summaries have no per-message owner evidence

‎scripts/generate-dev-icon.swift‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ newImage.lockFocus()
3535
// Draw the original icon
3636
iconImage.draw(in: NSRect(origin: .zero, size: size))
3737

38-
// Configure badge
39-
let singleLineHeight = size.height * 0.22
40-
let padding = size.width * 0.03
41-
let maxBadgeWidth = size.width * 0.9
38+
// The bundled macOS artwork is inset 100px on its 1024px canvas.
39+
// Size and place the badge within that tile, preserving the transparent margin.
40+
let artworkBounds = NSRect(origin: .zero, size: size).insetBy(
41+
dx: size.width * 100 / 1024, dy: size.height * 100 / 1024)
42+
let singleLineHeight = artworkBounds.height * 0.22
43+
let padding = artworkBounds.width * 0.03
44+
let maxBadgeWidth = artworkBounds.width * 0.9
4245

4346
// Text attributes - calculate font size to fit
4447
let maxFontSize = singleLineHeight * 0.65
@@ -102,8 +105,8 @@ let maxLineWidth = lines.map { ($0 as NSString).size(withAttributes: attributes)
102105
let badgeHeight = textHeight + padding * 2
103106
let cornerRadius = badgeHeight * 0.2
104107
let badgeWidth = maxLineWidth + padding * 4
105-
let badgeX = (size.width - badgeWidth) / 2
106-
let badgeY = size.height - badgeHeight - padding - size.height * 0.05
108+
let badgeX = artworkBounds.midX - badgeWidth / 2
109+
let badgeY = artworkBounds.maxY - badgeHeight - padding - artworkBounds.height * 0.05
107110

108111
// Draw badge background (light blue semi-transparent)
109112
let badgePath = NSBezierPath(roundedRect: NSRect(x: badgeX, y: badgeY, width: badgeWidth, height: badgeHeight),

‎src-tauri/icons/icon.icns‎

35 KB
Binary file not shown.

‎src/bundled/agent-activity/ActivityPanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { activityRecords } from "../../features/agents/activity-records";
1515
import { activityTranscript } from "../../features/agents/activity-transcript";
1616
import { Tabs } from "../../shared/design-system/ui/Tabs";
17-
import { ActivityTranscript } from "./ActivityTranscript";
17+
import { ActivityTranscript } from "../../features/agents/ActivityTranscript";
1818
import { Accordion } from "../../shared/design-system/ui/Accordion";
1919
import { Select } from "../../shared/design-system/ui/Select";
2020
import { Button } from "../../shared/design-system/ui/Button";

‎src/bundled/channels/ChannelTemplateSettings.test.tsx‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ afterEach(() => {
1414

1515
const snapshot = {
1616
status: "ready",
17-
agents: [],
17+
agents: [{ pubkey: "a".repeat(64), name: "Ada" }],
1818
running: [],
1919
teams: [
2020
{ id: "t1", name: "Core", instructions: "", members: [] },
@@ -26,21 +26,27 @@ const agents = {
2626
subscribe: () => () => {},
2727
} as unknown as Agents;
2828

29-
it("makes, edits and deletes a template of teams and a Canvas", async () => {
29+
it("makes, edits and deletes a template of agents, teams and a Canvas", async () => {
3030
const user = userEvent.setup();
3131
render(<ChannelTemplateSettings agents={agents} active={() => true} />);
3232
await user.click(screen.getByRole("button", { name: "New template" }));
3333
await user.type(screen.getByRole("textbox", { name: "Name" }), "Launch");
34+
await user.click(screen.getByRole("checkbox", { name: "Ada" }));
3435
await user.click(screen.getByRole("checkbox", { name: "Docs" }));
3536
await user.type(
3637
screen.getByRole("textbox", { name: /Starting Canvas/ }),
3738
"# Goal",
3839
);
3940
await user.click(screen.getByRole("button", { name: "Save template" }));
4041
expect(channelTemplates.snapshot()).toMatchObject([
41-
{ name: "Launch", teams: ["t2"], canvas: "# Goal" },
42+
{
43+
name: "Launch",
44+
teams: ["t2"],
45+
agents: ["a".repeat(64)],
46+
canvas: "# Goal",
47+
},
4248
]);
43-
expect(screen.getByText("Docs · Canvas")).toBeVisible();
49+
expect(screen.getByText("Ada, Docs · Canvas")).toBeVisible();
4450

4551
await user.click(screen.getByRole("button", { name: "Edit Launch" }));
4652
await user.click(screen.getByRole("checkbox", { name: "Core" }));

‎src/bundled/channels/ChannelTemplateSettings.tsx‎

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from "react";
2-
import { useTeams } from "../../features/agents/react";
3-
import type { Agents, Team } from "../../features/agents/service";
2+
import { useAgentsSnapshot, useTeams } from "../../features/agents/react";
3+
import type { Agent, Agents, Team } from "../../features/agents/service";
44
import {
55
channelTemplates,
66
useChannelTemplates,
@@ -19,7 +19,7 @@ import { SettingsGroup } from "../../shared/design-system/ui/SettingsGroup";
1919
import { Textarea } from "../../shared/design-system/ui/Textarea";
2020
import styles from "./ChannelTemplates.module.css";
2121

22-
/** Templates a new channel can start from: its teams and its Canvas. */
22+
/** Templates a new channel can start from: its agents, teams and Canvas. */
2323
export function ChannelTemplateSettings({
2424
agents,
2525
active,
@@ -29,6 +29,7 @@ export function ChannelTemplateSettings({
2929
}) {
3030
const templates = useChannelTemplates();
3131
const teams = useTeams(agents);
32+
const choices = useAgentsSnapshot(agents)?.agents ?? noAgents;
3233
// A template's id while it is edited, or "new" for one being made.
3334
const [editing, setEditing] = useState<string>();
3435
const template = templates.find((item) => item.id === editing);
@@ -45,7 +46,7 @@ export function ChannelTemplateSettings({
4546
<PreferenceRow
4647
key={item.id}
4748
title={item.name}
48-
subtitle={summary(item, teams)}
49+
subtitle={summary(item, choices, teams)}
4950
trailing={
5051
<Button
5152
aria-label={`Edit ${item.name}`}
@@ -69,13 +70,14 @@ export function ChannelTemplateSettings({
6970
<EmptyState
7071
icon={<CopyIcon />}
7172
title="No channel templates yet"
72-
description="Start new channels with your teams and a Canvas already in place."
73+
description="Start new channels with your agents, teams and a Canvas already in place."
7374
action={<Button onClick={newTemplate}>New template</Button>}
7475
/>
7576
)}
7677
{(editing === "new" || template) && (
7778
<TemplateDialog
7879
key={editing}
80+
agents={choices}
7981
teams={teams}
8082
{...(template ? { template } : {})}
8183
onClose={() => setEditing(undefined)}
@@ -85,10 +87,21 @@ export function ChannelTemplateSettings({
8587
);
8688
}
8789

88-
function summary(template: ChannelTemplate, teams: readonly Team[]) {
89-
const names = template.teams.flatMap(
90-
(id) => teams.find((team) => team.id === id)?.name ?? [],
91-
);
90+
const noAgents: readonly never[] = Object.freeze([]);
91+
92+
function summary(
93+
template: ChannelTemplate,
94+
agents: readonly Agent[],
95+
teams: readonly Team[],
96+
) {
97+
const names = [
98+
...template.agents.flatMap(
99+
(pubkey) => agents.find((agent) => agent.pubkey === pubkey)?.name ?? [],
100+
),
101+
...template.teams.flatMap(
102+
(id) => teams.find((team) => team.id === id)?.name ?? [],
103+
),
104+
];
92105
return (
93106
[names.join(", "), template.canvas.trim() ? "Canvas" : ""]
94107
.filter(Boolean)
@@ -97,15 +110,20 @@ function summary(template: ChannelTemplate, teams: readonly Team[]) {
97110
}
98111

99112
function TemplateDialog({
113+
agents,
100114
teams,
101115
template,
102116
onClose,
103117
}: {
118+
agents: readonly Agent[];
104119
teams: readonly Team[];
105120
template?: ChannelTemplate;
106121
onClose(): void;
107122
}) {
108123
const [name, setName] = useState(template?.name ?? "");
124+
const [chosenAgents, setChosenAgents] = useState<readonly string[]>(
125+
template?.agents ?? [],
126+
);
109127
const [chosen, setChosen] = useState<readonly string[]>(
110128
template?.teams ?? [],
111129
);
@@ -159,6 +177,7 @@ function TemplateDialog({
159177
...(template ? { id: template.id } : {}),
160178
name,
161179
teams: chosen,
180+
agents: chosenAgents,
162181
canvas,
163182
}),
164183
);
@@ -171,6 +190,27 @@ function TemplateDialog({
171190
onChange={(event) => setName(event.target.value)}
172191
/>
173192
</Field>
193+
<fieldset className={styles.teams}>
194+
<legend className="text-label-sm">Agents</legend>
195+
{agents.length ? (
196+
agents.map((agent) => (
197+
<Checkbox
198+
key={agent.pubkey}
199+
label={agent.name}
200+
checked={chosenAgents.includes(agent.pubkey)}
201+
onCheckedChange={(checked) =>
202+
setChosenAgents((last) =>
203+
checked
204+
? [...last, agent.pubkey]
205+
: last.filter((pubkey) => pubkey !== agent.pubkey),
206+
)
207+
}
208+
/>
209+
))
210+
) : (
211+
<p className="m-0 text-body-sm text-secondary">No agents yet.</p>
212+
)}
213+
</fieldset>
174214
<fieldset className={styles.teams}>
175215
<legend className="text-label-sm">Teams</legend>
176216
{teams.length ? (

‎src/bundled/channels/CreateChannelDialog.test.tsx‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,9 +843,13 @@ it("does not offer to discard frozen recovery when it arrives during confirmatio
843843
expect(props.onCreate).not.toHaveBeenCalled();
844844
});
845845

846-
it("starts a channel from a template with its teams' agents here and its Canvas", async () => {
846+
it("starts a channel from a template with its agents and teams' agents here and its Canvas", async () => {
847847
const user = userEvent.setup();
848-
const [ada, bo, elsewhere] = ["a", "b", "c"].map((c) => c.repeat(64));
848+
const [ada, bo, elsewhere] = ["a", "b", "c"].map((c) => c.repeat(64)) as [
849+
string,
850+
string,
851+
string,
852+
];
849853
const snapshot = {
850854
status: "ready",
851855
running: [],
@@ -866,6 +870,7 @@ it("starts a channel from a template with its teams' agents here and its Canvas"
866870
channelTemplates.save({
867871
name: "Launch",
868872
teams: ["t1", "t2", "gone"],
873+
agents: [elsewhere, bo],
869874
canvas: "# Goal",
870875
});
871876
const onCreate = vi.fn(async () => {});
@@ -881,15 +886,15 @@ it("starts a channel from a template with its teams' agents here and its Canvas"
881886
await user.type(screen.getByRole("textbox", { name: "Name" }), "launch");
882887
await user.click(screen.getByRole("combobox", { name: "Template" }));
883888
await user.click(await screen.findByRole("option", { name: "Launch" }));
884-
expect(screen.getByText("Adds Ada, Bo · Starts the Canvas")).toBeVisible();
889+
expect(screen.getByText("Adds Bo, Ada · Starts the Canvas")).toBeVisible();
885890
await user.click(screen.getByRole("button", { name: "Create channel" }));
886891
const [template] = channelTemplates.snapshot();
887892
await waitFor(() =>
888893
expect(onCreate).toHaveBeenCalledWith({
889894
name: "launch",
890895
visibility: "open",
891896
setup: {
892-
agents: [ada, bo],
897+
agents: [bo, ada],
893898
canvas: "# Goal",
894899
groupId: "",
895900
templateId: template?.id,
@@ -914,7 +919,12 @@ it("offers no template choice without saved templates", () => {
914919

915920
it("creates a plain channel from a template that adds nothing here", async () => {
916921
const user = userEvent.setup();
917-
channelTemplates.save({ name: "Empty", teams: ["gone"], canvas: " " });
922+
channelTemplates.save({
923+
name: "Empty",
924+
teams: ["gone"],
925+
agents: [],
926+
canvas: " ",
927+
});
918928
const onCreate = vi.fn(async () => {});
919929
render(
920930
<CreateChannelDialog

‎src/bundled/channels/CreateChannelDialog.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Props = {
4343
pending?: CreateChannelInput | undefined;
4444
finalFocus?: RefObject<HTMLElement | null> | undefined;
4545
session: RelaySession;
46-
/** Supplies the teams a template adds. */
46+
/** Supplies the agents and teams a template adds. */
4747
agents?: Agents | undefined;
4848
groups: Groups | undefined;
4949
destinations?: readonly (Pick<Group, "id" | "name"> & { icon?: string })[];
@@ -108,7 +108,7 @@ function OpenCreateChannelDialog({
108108
// A template deleted meanwhile, here or in another window, is no choice.
109109
const template = templates.find((item) => item.id === chosenTemplate);
110110
const templateId = template?.id ?? "";
111-
// The team members that are the owner's agents in this community.
111+
// The template's agents and team members that are the owner's agents here.
112112
const agentNames = new Map(
113113
(agentsSnapshot?.agents ?? []).map((agent) => [agent.pubkey, agent.name]),
114114
);

‎src/bundled/channels/useChannelTabState.test.tsx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,21 @@ test("new ordinary and routed threads follow the device choice; existing tabs an
468468
act(() => mounted.result.current.moveTab("thread:alpha:two", "side", 0));
469469
expect(threadPlacementPreference()).toBe("main");
470470
});
471+
472+
test("the returned state keeps its identity across unrelated re-renders", () => {
473+
const session = {} as RelaySession;
474+
const mounted = renderHook(
475+
({ channel }) => useChannelTabState(session, channel),
476+
{ initialProps: { channel: "alpha" } },
477+
);
478+
const initial = mounted.result.current;
479+
mounted.rerender({ channel: "alpha" });
480+
expect(mounted.result.current).toBe(initial);
481+
act(() => mounted.result.current.select("beta-tab"));
482+
const selected = mounted.result.current;
483+
expect(selected).not.toBe(initial);
484+
expect(selected.selected).toBe("beta-tab");
485+
expect(selected.select).toBe(initial.select);
486+
mounted.rerender({ channel: "beta" });
487+
expect(mounted.result.current).not.toBe(selected);
488+
});

0 commit comments

Comments
 (0)