swarm-ui: show and toggle an agent's unrestricted internet flag, add it to the create dialog
This commit is contained in:
parent
24beb167d8
commit
10508895c4
1 changed files with 136 additions and 2 deletions
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue