Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: ask before actions that cannot be undone, with a danger button and a useConfirm hook

Button gains a danger variant and an autofocus prop; ConfirmDialog gains danger (red confirm, focus on cancel). Destroy, delete linked account, delete claude login, remove schedule and delete flow use it. New useConfirm hook asks from inside a handler (await confirm({...})) without a dialog's state at the call site. It now guards: removing a swarm-wide egress domain, removing a domain for every agent from an agent's popover, removing a stored API-key environment, firing a schedule now, moving an agent's internet to a looser mode, the /clear message, and reload over unsaved instructions (replacing window.confirm). The review try-out's button is now called push a branch for a PR, since it pushes a branch and does not open one, and asks first. loosensInternet is a tested helper.
This commit is contained in:
iris 2026-11-19 18:42:34 +01:00 • committed by mara
commit c3e24fe2c6

View file

@ -8,6 +8,7 @@ import {
internetBody,
internetMode,
internetSummary,
loosensInternet,
MAX_REPOS,
maxReposBody,
parseMaxRepos,
@ -109,3 +110,13 @@ test("the limit's body carries the stored list, so the PUT does not reset it", (
});
assert.deepEqual(maxReposBody(undefined, 0), { max_repos: 0 });
});
test("only a change that lets more traffic through is asked first", () => {
assert.equal(loosensInternet("restricted", "log"), true);
assert.equal(loosensInternet("restricted", "unrestricted"), true);
assert.equal(loosensInternet("log", "unrestricted"), true);
assert.equal(loosensInternet("unrestricted", "restricted"), false);
assert.equal(loosensInternet("unrestricted", "log"), false);
assert.equal(loosensInternet("log", "restricted"), false);
assert.equal(loosensInternet("log", "log"), false);
});