From 5de0ff59f48af87a3ec18281d868aebf9a1e3699 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 25 Nov 2026 19:21:13 +0100 Subject: [PATCH] swarm-ui: mount the create-agent form only while its dialog is open, and list the internet setting The dialog rendered its form even when closed, so every visit to the agents page or the start page fetched the hive, permission and archetype lists, a half-filled form was kept, and the hint to reopen the form for a fresh archetype list was wrong. It now mounts per open. The summary lists the unrestricted internet box like every other setting, and create another clears it with the rest. The swarm-ui doc says both. --- docs/4-implementation/web-ui/swarm-ui.md | 11 +++++++---- .../packages/swarm-ui/src/pages/CreateAgentForm.tsx | 2 ++ .../packages/swarm-ui/src/pages/CreateAgentSteps.ts | 6 ++++++ .../packages/swarm-ui/src/pages/SetupAssistant.tsx | 12 +++++++----- .../swarm-ui/src/pages/agents/AgentsPage.tsx | 4 +++- .../swarm-ui/test/create-agent-steps.test.mjs | 3 +++ 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/docs/4-implementation/web-ui/swarm-ui.md b/docs/4-implementation/web-ui/swarm-ui.md index 503d75f69..d05cf0294 100644 --- a/docs/4-implementation/web-ui/swarm-ui.md +++ b/docs/4-implementation/web-ui/swarm-ui.md @@ -1096,8 +1096,10 @@ when the controller is old or unreachable. ### Creating an agent -The **+ agent** button opens a dialog of five steps, which you go through in -order with **next** and can step back through with **back** or the step tabs: +The **+ agent** button opens a dialog whose form mounts each time, so it reads +the hive, permission and archetype lists then, and a closed dialog costs no +requests. The dialog has five steps, which you go through in order with +**next** and can step back through with **back** or the step tabs: 1. **identity**: the name, the hive, and optionally an [archetype](../../2-handbook/swarm/archetypes.md) that fills in the settings of the steps after it. @@ -1115,8 +1117,9 @@ order with **next** and can step back through with **back** or the step tabs: default. Ticking it adds `unrestricted_internet` to the request. 4. **resources and inference**: the optional resource caps and inference settings. -5. **summary**: every setting the request will carry, and what stays at its - default, then **what this creates**. **create** is on this step only. +5. **summary**: every setting the request will carry (including the internet + setting), and what stays at its default, then **what this creates**. + **create** is on this step only. The header, the step tabs and the buttons stay in place and only the step's own fields scroll, so a long step never pushes **next** out of view. After diff --git a/frontend/packages/swarm-ui/src/pages/CreateAgentForm.tsx b/frontend/packages/swarm-ui/src/pages/CreateAgentForm.tsx index b0c3284b0..b3213aa5e 100644 --- a/frontend/packages/swarm-ui/src/pages/CreateAgentForm.tsx +++ b/frontend/packages/swarm-ui/src/pages/CreateAgentForm.tsx @@ -270,6 +270,7 @@ export function CreateAgentForm({ setName(""); setAgentsMd(""); pickArchetype(""); + setInternet(false); }, // The text's own refusal shows beside its box, so go back to it. onError: (problem) => { @@ -535,6 +536,7 @@ export function CreateAgentForm({ caps: capsBody(cpu, memory), inference: draftBody(inference), agentsMd, + internet, }).map((row) => (
{row.label}
diff --git a/frontend/packages/swarm-ui/src/pages/CreateAgentSteps.ts b/frontend/packages/swarm-ui/src/pages/CreateAgentSteps.ts index 799538acd..f814bb73d 100644 --- a/frontend/packages/swarm-ui/src/pages/CreateAgentSteps.ts +++ b/frontend/packages/swarm-ui/src/pages/CreateAgentSteps.ts @@ -112,6 +112,8 @@ export interface SummaryInput { caps: object; inference: object; agentsMd: string; + // The "unrestricted internet" box: a security setting, so it is listed. + internet: boolean; } function settings(values: object): string { @@ -142,6 +144,10 @@ export function summaryRows(s: SummaryInput): SummaryRow[] { ? "none" : s.permissions.join(", "), }, + { + label: "internet", + value: s.internet ? "unrestricted" : "only the allowed domains", + }, { label: "resource caps", value: settings(s.caps) }, { label: "inference", value: settings(s.inference) }, { diff --git a/frontend/packages/swarm-ui/src/pages/SetupAssistant.tsx b/frontend/packages/swarm-ui/src/pages/SetupAssistant.tsx index 2b6e43bbb..39c7381b1 100644 --- a/frontend/packages/swarm-ui/src/pages/SetupAssistant.tsx +++ b/frontend/packages/swarm-ui/src/pages/SetupAssistant.tsx @@ -71,11 +71,13 @@ export function SetupAssistant() { label="create agent" plain > - setOpen(false)} - /> + {open ? ( + setOpen(false)} + /> + ) : null} ); diff --git a/frontend/packages/swarm-ui/src/pages/agents/AgentsPage.tsx b/frontend/packages/swarm-ui/src/pages/agents/AgentsPage.tsx index 7a3a5d265..3c42ec312 100644 --- a/frontend/packages/swarm-ui/src/pages/agents/AgentsPage.tsx +++ b/frontend/packages/swarm-ui/src/pages/agents/AgentsPage.tsx @@ -247,7 +247,9 @@ export function AgentsPage() { label="create agent" plain > - setCreateOpen(false)} /> + {createOpen ? ( + setCreateOpen(false)} /> + ) : null} {broadcasting ? ( { caps: {}, inference: {}, agentsMd: "", + internet: false, ...over, }).map((r) => [r.label, r.value]), ); @@ -85,6 +86,8 @@ test("the summary lists what is sent and what stays at its default", () => { assert.equal(plain.name, "ruth"); assert.equal(plain.archetype, "none: a custom agent"); assert.equal(plain.permissions, "the default set"); + assert.equal(plain.internet, "only the allowed domains"); + assert.equal(rows({ internet: true }).internet, "unrestricted"); assert.equal(plain["resource caps"], "none set"); assert.equal(plain.inference, "none set"); assert.equal(plain.instructions, "none");