Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: show and toggle an agent's unrestricted internet flag, add it to the create dialog

This commit is contained in:
atlas 2026-10-27 13:38:58 +01:00 • committed by mara
commit 10508895c4

View file

@ -5,6 +5,8 @@ import { test } from "node:test";
import {
editorSelection,
grantSummary,
internetBody,
internetSummary,
} from "../src/agent/detail/permissions.ts";
const all = ["messaging", "meta", "inbox", "execution", "manage_root_agent"];
@ -33,3 +35,26 @@ test("the summary tells unset, empty and a list apart", () => {
assert.equal(grantSummary([]), "none");
assert.equal(grantSummary(["meta", "inbox"]), "2 granted");
});
test("an absent internet flag reads as unrestricted, marked legacy", () => {
assert.equal(internetSummary(undefined), "unrestricted (legacy)");
assert.equal(internetSummary(true), "unrestricted");
assert.equal(internetSummary(false), "restricted");
});
test("the internet toggle sends the stored list with the flag", () => {
assert.deepEqual(internetBody(["meta", "inbox"], false), {
permissions: ["meta", "inbox"],
unrestricted_internet: false,
});
assert.deepEqual(internetBody([], true), {
permissions: [],
unrestricted_internet: true,
});
});
test("with no stored list the toggle leaves the list unset", () => {
assert.deepEqual(internetBody(undefined, false), {
unrestricted_internet: false,
});
});