From c3e24fe2c6588ed9748bf5e859dffe457c328b8f Mon Sep 17 00:00:00 2001
From: iris
Date: Thu, 19 Nov 2026 18:42:34 +0100
Subject: [PATCH] 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.
---
.../swarm/review-classifier.md | 15 +++---
docs/4-implementation/web-ui/swarm-ui.md | 19 +++++--
.../src/agent/detail/AgentClaudeLogin.tsx | 1 +
.../src/agent/detail/AgentInstructions.tsx | 31 ++++++-----
.../src/agent/detail/AgentPermissions.tsx | 44 ++++++++++-----
.../src/agent/detail/AllowedDomains.tsx | 28 +++++++++-
.../src/agent/detail/LinkedAccounts.tsx | 1 +
.../swarm-ui/src/agent/detail/permissions.ts | 11 ++++
.../src/agent/roster/AgentActions.tsx | 1 +
.../src/agent/terminal/AgentInputForm.tsx | 22 +++++++-
.../swarm-ui/src/pages/ComponentsPage.tsx | 46 ++++++++++++++--
.../swarm-ui/src/pages/LinkBackendEnvForm.tsx | 25 +++++++--
.../pages/notifications/FlowEditorPage.tsx | 1 +
.../src/pages/review-tryout/ReviewTryOut.tsx | 36 ++++++++++---
.../src/pages/schedules/SchedulesPage.tsx | 19 ++++++-
.../swarm-ui/src/pages/swarm/EgressCard.tsx | 25 ++++++++-
.../swarm-ui/src/ui/button/Button.css | 5 ++
.../swarm-ui/src/ui/button/Button.tsx | 12 +++--
.../src/ui/confirm-dialog/ConfirmDialog.tsx | 10 +++-
.../src/ui/confirm-dialog/useConfirm.tsx | 54 +++++++++++++++++++
.../swarm-ui/test/agent-permissions.test.mjs | 11 ++++
21 files changed, 355 insertions(+), 62 deletions(-)
create mode 100644 frontend/packages/swarm-ui/src/ui/confirm-dialog/useConfirm.tsx
diff --git a/docs/4-implementation/swarm/review-classifier.md b/docs/4-implementation/swarm/review-classifier.md
index 1fc51f1e5..9a129a8b4 100644
--- a/docs/4-implementation/swarm/review-classifier.md
+++ b/docs/4-implementation/swarm/review-classifier.md
@@ -350,8 +350,8 @@ collaborator:
allowlist, the account counts only once it's on that list, and read access
is then enough for reviews.
-The try-out's **open a PR** pushes a branch to the repo itself, so it
-needs **write** whatever the branch protection says.
+The try-out's **push a branch for a PR** button pushes a branch to the repo itself,
+so it needs **write** whatever the branch protection says.
The repo also needs a rules file on its default branch (see
[Repo configuration](#repo-configuration)). Without one, a request posts a
@@ -596,11 +596,12 @@ since a run also works on a merged or closed PR. Two routes feed them:
Every error is problem+json with the reason in `detail`.
-When it's ready, **open a PR** (`POST /api/review-classifier/open-pr`, with
-the repo and the classifications) has the service account push a branch that
-adds the classifications to the repo's rules, with you, the swarm UI user, as
-commit author. The page then links you to the forge's compare page for that
-branch, where you log in as usual and open the PR yourself.
+When it's ready, **push a branch for a PR**
+(`POST /api/review-classifier/open-pr`, with the repo and the classifications)
+has the service account push a branch that adds the classifications to the repo's
+rules, with you, the swarm UI user, as commit author. The page then links you to
+the forge's compare page for that branch, where you log in as usual and open the
+PR yourself.
- **The branch** is `review-classifier/-<8 hex digits>`, made from the
default branch's head with one commit, through the forge's contents API.
diff --git a/docs/4-implementation/web-ui/swarm-ui.md b/docs/4-implementation/web-ui/swarm-ui.md
index 070d3d754..ee086ded7 100644
--- a/docs/4-implementation/web-ui/swarm-ui.md
+++ b/docs/4-implementation/web-ui/swarm-ui.md
@@ -28,6 +28,15 @@ scrolls sideways. Nothing makes the page itself scroll sideways at 360px.
A dialog grows to fit its content, up to 64em or nine tenths of the window, whichever is
smaller; short confirm dialogs stay short.
+An action that can't be undone asks first, in a dialog with a red confirm button and
+the focus on **cancel**, so a stray **Enter** doesn't confirm it. These ask:
+destroying an agent, deleting a linked account or a claude login, removing a schedule,
+a flow or a stored API-key environment, **fire now** on a schedule, removing an
+allowed domain (swarm-wide, or for every agent from an agent's popover), moving an
+agent's internet to a looser mode, sending `/clear` as a message, reloading over
+unsaved instructions, and **push a branch for a PR** on the review try-out. A page
+asks from inside a handler with the `useConfirm` hook, with no dialog state of its own.
+
| route | what |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/` | the start page: the swarm's name over a digital-rain backdrop with the slug (`hyperhive / we are the wired`, its shaded gradients pulsing in a wave unless reduced motion is on) at the foot, plus a paperclip offering to set up an agent while no `ruth` exists, or her hive declares her destroyed (it opens the create form with `ruth` filled in); the swarm name in the header links here |
@@ -338,11 +347,11 @@ again. The page saves no classification and no result, and a run posts nothing
to the forge; like every table in the UI, the result table remembers its column
filters in the browser. It shows no token counts, cache counts or cost.
-When a classification answers the way you want, **open a PR** proposes the
-classifications on the page to the repo. The classifier's forge account pushes
-a branch that adds them to the repo's rules file, with you as the commit's
-author, and the page links to the forge's page for opening the PR from that
-branch, where you log in as usual. A classification named like one the file
+When a classification answers the way you want, **push a branch for a PR** (it asks
+first) proposes the classifications on the page to the repo. The classifier's forge
+account pushes a branch that adds them to the repo's rules file, with you as the
+commit's author, and the page links to the forge's page for opening the PR from
+that branch, where you log in as usual. A classification named like one the file
already holds replaces it, and the file's other rules stay. It needs no PR
number. If the forge has no account of yours yet, log in to the forge once
first. If the classifier's account may not push to the repo, the page says so:
diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentClaudeLogin.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentClaudeLogin.tsx
index 5c66781ae..67797cc51 100644
--- a/frontend/packages/swarm-ui/src/agent/detail/AgentClaudeLogin.tsx
+++ b/frontend/packages/swarm-ui/src/agent/detail/AgentClaudeLogin.tsx
@@ -125,6 +125,7 @@ export function AgentClaudeLogin({ agent }: { agent: string }) {
open={confirming}
label={`delete the stored claude login for ${agent}`}
confirmLabel={deleting ? "deleting…" : "delete login"}
+ danger
confirmDisabled={deleting}
onCancel={() => setConfirming(false)}
onConfirm={() => void confirmDelete()}
diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx
index 909e15dc7..9a401f181 100644
--- a/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx
+++ b/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx
@@ -18,6 +18,7 @@ import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { Badge } from "@hive/shared/badge.js";
import { ActionRow } from "../../ui/action-row/ActionRow.js";
import { Button } from "../../ui/button/Button.js";
+import { useConfirm } from "../../ui/confirm-dialog/useConfirm.js";
import { Preformatted } from "../../ui/preformatted/Preformatted.js";
import { Dialog } from "../../ui/dialog/Dialog.js";
import { Panel } from "../../ui/panel/Panel.js";
@@ -113,6 +114,22 @@ function InstructionsForm({
const [busy, setBusy] = useState(false);
const [problem, setProblem] = useState(null);
const [saved, setSaved] = useState(false);
+ const [confirm, confirmDialog] = useConfirm();
+
+ // Loading the agent's file drops what is typed, so unsaved edits ask first.
+ async function askReload() {
+ if (
+ !dirty ||
+ (await confirm({
+ label: "drop unsaved changes",
+ confirmLabel: "drop and reload",
+ danger: true,
+ body:
Drop your unsaved changes and load {agent}'s file?
,
+ }))
+ ) {
+ reload();
+ }
+ }
useEffect(() => {
let cancelled = false;
@@ -294,24 +311,14 @@ function InstructionsForm({
>
undo my changes
-
+ {confirmDialog}
);
}
diff --git a/frontend/packages/swarm-ui/src/pages/ComponentsPage.tsx b/frontend/packages/swarm-ui/src/pages/ComponentsPage.tsx
index c5024a27c..49076d170 100644
--- a/frontend/packages/swarm-ui/src/pages/ComponentsPage.tsx
+++ b/frontend/packages/swarm-ui/src/pages/ComponentsPage.tsx
@@ -50,6 +50,7 @@ import { Preformatted } from "../ui/preformatted/Preformatted.js";
import { SectionHeading } from "../ui/section-heading/SectionHeading.js";
import { Toolbar } from "../ui/toolbar/Toolbar.js";
import { ConfirmDialog } from "../ui/confirm-dialog/ConfirmDialog.js";
+import { useConfirm } from "../ui/confirm-dialog/useConfirm.js";
import { Popover } from "../ui/popover/Popover.js";
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
import { GearIcon } from "@hive/shared/icons.js";
@@ -131,7 +132,7 @@ const SELECT_OPTIONS: SelectOption[] = [
{ value: "beta", label: "beta" },
];
-const BUTTON_VARIANTS: ButtonVariant[] = ["primary", "default"];
+const BUTTON_VARIANTS: ButtonVariant[] = ["primary", "default", "danger"];
const BADGE_TONES: BadgeTone[] = [
"neutral",
"positive",
@@ -396,10 +397,46 @@ function FilterableViewSample() {
);
}
-function ConfirmDialogSample() {
- const [open, setOpen] = useState(false);
+// `useConfirm`: ask in the middle of a handler, without a dialog's state.
+function UseConfirmSample() {
+ const [confirm, dialog] = useConfirm();
+ const [answer, setAnswer] = useState("not asked yet");
+ async function ask() {
+ const yes = await confirm({
+ label: "sample question",
+ confirmLabel: "go ahead",
+ body:
Awaited in the click handler: it resolves true or false.
+ danger makes the confirm button red and starts the focus
+ on cancel, for an action that cannot be taken back.
+
+ setOpen(true)}>open confirm dialog
+
+
+
diff --git a/frontend/packages/swarm-ui/src/pages/LinkBackendEnvForm.tsx b/frontend/packages/swarm-ui/src/pages/LinkBackendEnvForm.tsx
index 16444ea30..f0d0c985a 100644
--- a/frontend/packages/swarm-ui/src/pages/LinkBackendEnvForm.tsx
+++ b/frontend/packages/swarm-ui/src/pages/LinkBackendEnvForm.tsx
@@ -13,6 +13,7 @@ import { TextAreaField } from "../ui/text-area-field/TextAreaField.js";
import { Button } from "../ui/button/Button.js";
import { FormStack } from "../ui/form-stack/FormStack.js";
import { FormResult } from "../ui/submit/FormResult.js";
+import { useConfirm } from "../ui/confirm-dialog/useConfirm.js";
import { useSubmit } from "../ui/submit/useSubmit.js";
// A swarm-controller without the route answers 404 with no problem body.
@@ -31,6 +32,23 @@ export function LinkBackendEnvForm({
const [env, setEnv] = useState("");
// The success line is what the request did, so it is the done value.
const { state, submitting: busy, run } = useSubmit();
+ const [confirm, confirmDialog] = useConfirm();
+
+ async function removeEnv() {
+ const yes = await confirm({
+ label: "remove the API-key environment",
+ confirmLabel: "remove",
+ danger: true,
+ body: (
+
+ Remove the stored API-key environment for {agent}?
+ The stored text cannot be read back, so it cannot be restored; paste
+ it again to set it.
+
+ ),
+ });
+ if (yes) send("DELETE", "removed the API-key environment for");
+ }
function send(method: "PUT" | "DELETE", done: string) {
void run(
@@ -89,11 +107,7 @@ export function LinkBackendEnvForm({
{busy ? "saving…" : "save"}
- send("DELETE", "removed the API-key environment for")}
- >
+ void removeEnv()}>
remove
@@ -106,6 +120,7 @@ export function LinkBackendEnvForm({
)}
failed="failed to update the API-key environment"
/>
+ {confirmDialog}
);
}
diff --git a/frontend/packages/swarm-ui/src/pages/notifications/FlowEditorPage.tsx b/frontend/packages/swarm-ui/src/pages/notifications/FlowEditorPage.tsx
index 78562910f..e38c49d28 100644
--- a/frontend/packages/swarm-ui/src/pages/notifications/FlowEditorPage.tsx
+++ b/frontend/packages/swarm-ui/src/pages/notifications/FlowEditorPage.tsx
@@ -416,6 +416,7 @@ export function FlowEditorPage({
open={confirmDelete}
label="delete this flow"
confirmLabel="delete"
+ danger
onCancel={() => setConfirmDelete(false)}
onConfirm={() => void onDelete()}
>
diff --git a/frontend/packages/swarm-ui/src/pages/review-tryout/ReviewTryOut.tsx b/frontend/packages/swarm-ui/src/pages/review-tryout/ReviewTryOut.tsx
index ebd54eb95..205c8707e 100644
--- a/frontend/packages/swarm-ui/src/pages/review-tryout/ReviewTryOut.tsx
+++ b/frontend/packages/swarm-ui/src/pages/review-tryout/ReviewTryOut.tsx
@@ -13,10 +13,10 @@
// **load the repo's rules** fills the rows from the rules on the repo's default
// branch (`GET /api/review-classifier/rules`), to run as they are or to edit.
//
-// **open a PR** posts the rows to `POST /api/review-classifier/open-pr`, which
-// has the classifier's forge account push a branch adding them to the repo's
-// rules file, with the operator as commit author, and links to the forge's page
-// for opening the PR from that branch.
+// **push a branch for a PR** (asked first) posts the rows to
+// `POST /api/review-classifier/open-pr`, which has the classifier's forge account
+// push a branch adding them to the repo's rules file, with the operator as commit
+// author, and links to the forge's page for opening the PR from that branch.
//
// The inputs stay as typed after a run, so the operator can edit and run
// again. The section keeps nothing you typed and no
@@ -29,6 +29,7 @@ import { ActionRow } from "../../ui/action-row/ActionRow.js";
import { Button } from "../../ui/button/Button.js";
import { FieldGrid } from "../../ui/field-grid/FieldGrid.js";
import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
+import { useConfirm } from "../../ui/confirm-dialog/useConfirm.js";
import { Disclosure } from "../../ui/disclosure/Disclosure.js";
import { ExternalLink } from "../../ui/external-link/ExternalLink.js";
import { Panel } from "../../ui/panel/Panel.js";
@@ -79,6 +80,7 @@ function blankDraft(): ClassificationDraft {
export function ReviewTryOut() {
const [repo, setRepo] = useState("");
+ const [ask, askDialog] = useConfirm();
const [pr, setPr] = useState("");
const [drafts, setDrafts] = useState(() => [
blankDraft(),
@@ -303,6 +305,23 @@ export function ReviewTryOut() {
}
}
+ // Pushing a branch to a forge repo is not undone from here, so it is asked.
+ async function askPushBranch() {
+ const rows = drafts.length;
+ const yes = await ask({
+ label: "push a branch for a PR",
+ confirmLabel: "push the branch",
+ body: (
+
+ Push a new branch to {repo.trim()} with{" "}
+ {rows === 1 ? "this classification" : `these ${rows} classifications`}
+ , as you? It does not open the PR; the link to open it follows.
+
+ ),
+ });
+ if (yes) void openPr();
+ }
+
// Pushes the rows on a new branch of the repo and keeps the link to open
// the PR from it.
async function openPr() {
@@ -354,8 +373,8 @@ export function ReviewTryOut() {
Run a review classification against a real PR and see how the model
answers it. A run posts nothing to the forge and changes no rules, but
it does appear under recent runs: change the classification and run it
- again until it answers the way you want. Then open a PR to add it to
- the repo's rules.
+ again until it answers the way you want. Then push a branch for a PR
+ to add it to the repo's rules.
+ Fire {s.name} now? It sends its message to{" "}
+ {s.agents.join(", ")} at once, and its start moves to this moment
+ {repeats ? ", so it repeats from now on" : ""}. That cannot be undone.
+
+ {verb} {e.domain} for every agent on
+ the swarm?
+
+ ),
+ }))
+ ) {
+ return;
+ }
+ void remove(e);
+ }
// A list already loaded stays under a failed refetch, so a change that
// worked is not hidden by a read that did not.
@@ -94,7 +116,7 @@ function DomainSection({
void remove(e)}
+ onClick={() => void removeEntry(e)}
>
remove
@@ -121,6 +143,7 @@ function DomainSection({
/>
) : null}
+ {confirmDialog}
>
)}
diff --git a/frontend/packages/swarm-ui/src/ui/button/Button.css b/frontend/packages/swarm-ui/src/ui/button/Button.css
index 1114b7bdb..9ce2d7383 100644
--- a/frontend/packages/swarm-ui/src/ui/button/Button.css
+++ b/frontend/packages/swarm-ui/src/ui/button/Button.css
@@ -15,6 +15,11 @@
color: var(--fg);
border: none;
}
+.ui-button-danger {
+ background: color-mix(in srgb, var(--red) 14%, var(--bg-elev));
+ color: var(--red);
+ border: 1px solid var(--red);
+}
.ui-button-default {
background: var(--bg-elev);
color: var(--fg);
diff --git a/frontend/packages/swarm-ui/src/ui/button/Button.tsx b/frontend/packages/swarm-ui/src/ui/button/Button.tsx
index 7b5424dc4..42b0f2cf0 100644
--- a/frontend/packages/swarm-ui/src/ui/button/Button.tsx
+++ b/frontend/packages/swarm-ui/src/ui/button/Button.tsx
@@ -1,14 +1,13 @@
// — the shared clickable-action control (form submit today,
// any future toolbar/dialog action later). `variant` is `'primary'`
// (the one emphasised action on a page, e.g. a form's submit) or
-// `'default'` (everything else) — two is enough for every real caller
-// so far; a third reading gets added the day something needs it, not
-// speculatively.
+// `'default'` (everything else), or `'danger'` (the action that cannot be
+// taken back: destroy, delete, a removal that cuts access).
import type { ComponentChildren } from "preact";
import { Spinner } from "../spinner/Spinner.js";
import "./Button.css";
-export type ButtonVariant = "primary" | "default";
+export type ButtonVariant = "primary" | "default" | "danger";
export function Button({
variant = "default",
@@ -18,6 +17,7 @@ export function Button({
onClick,
describedBy,
ariaLabel,
+ autofocus = false,
children,
}: {
variant?: ButtonVariant;
@@ -33,6 +33,9 @@ export function Button({
/** A name that says what the button acts on, where its visible text repeats
* across a list ("remove", "edit"). It should start with the visible text. */
ariaLabel?: string;
+ /** Takes the focus when the dialog around it opens, in place of its first
+ * control. A destructive confirm puts it on the safe button. */
+ autofocus?: boolean;
children: ComponentChildren;
}) {
return (
@@ -44,6 +47,7 @@ export function Button({
onClick={onClick}
aria-describedby={describedBy}
aria-label={ariaLabel}
+ autofocus={autofocus || undefined}
>
{children}
{busy ? (
diff --git a/frontend/packages/swarm-ui/src/ui/confirm-dialog/ConfirmDialog.tsx b/frontend/packages/swarm-ui/src/ui/confirm-dialog/ConfirmDialog.tsx
index b73badf76..e5c3ae503 100644
--- a/frontend/packages/swarm-ui/src/ui/confirm-dialog/ConfirmDialog.tsx
+++ b/frontend/packages/swarm-ui/src/ui/confirm-dialog/ConfirmDialog.tsx
@@ -24,6 +24,7 @@ export function ConfirmDialog({
confirmLabel = "confirm",
cancelLabel = "cancel",
confirmDisabled = false,
+ danger = false,
children,
}: {
open: boolean;
@@ -33,6 +34,9 @@ export function ConfirmDialog({
confirmLabel?: string;
cancelLabel?: string;
confirmDisabled?: boolean;
+ /** The action cannot be taken back: the confirm button is red and the focus
+ * starts on cancel. */
+ danger?: boolean;
children: ComponentChildren;
}) {
return (
@@ -40,9 +44,11 @@ export function ConfirmDialog({
{children}
- {cancelLabel}
+
+ {cancelLabel}
+
diff --git a/frontend/packages/swarm-ui/src/ui/confirm-dialog/useConfirm.tsx b/frontend/packages/swarm-ui/src/ui/confirm-dialog/useConfirm.tsx
new file mode 100644
index 000000000..1552f38f4
--- /dev/null
+++ b/frontend/packages/swarm-ui/src/ui/confirm-dialog/useConfirm.tsx
@@ -0,0 +1,54 @@
+// useConfirm — ask before an action, in place, without a dialog's state at every
+// call site: `const [confirm, dialog] = useConfirm()`, render `{dialog}` once,
+// and `if (!(await confirm({ ... }))) return;` before the action. Resolves
+// true on the confirm button and false on cancel, Escape or a click outside.
+import type { ComponentChildren } from "preact";
+import { useRef, useState } from "preact/hooks";
+import { ConfirmDialog } from "./ConfirmDialog.js";
+
+export interface ConfirmRequest {
+ /** The dialog's accessible name. */
+ label: string;
+ confirmLabel: string;
+ /** The action cannot be taken back: a red confirm button, focus on cancel. */
+ danger?: boolean;
+ /** What will happen, in a sentence or two. */
+ body: ComponentChildren;
+}
+
+export function useConfirm(): [
+ (request: ConfirmRequest) => Promise,
+ ComponentChildren,
+] {
+ const [request, setRequest] = useState(null);
+ const resolveRef = useRef<((answer: boolean) => void) | null>(null);
+
+ function confirm(next: ConfirmRequest): Promise {
+ // A second request while one is open cancels the first.
+ resolveRef.current?.(false);
+ setRequest(next);
+ return new Promise((resolve) => {
+ resolveRef.current = resolve;
+ });
+ }
+
+ function answer(yes: boolean) {
+ resolveRef.current?.(yes);
+ resolveRef.current = null;
+ setRequest(null);
+ }
+
+ const dialog = (
+ answer(false)}
+ onConfirm={() => answer(true)}
+ >
+ {request?.body}
+
+ );
+ return [confirm, dialog];
+}
diff --git a/frontend/packages/swarm-ui/test/agent-permissions.test.mjs b/frontend/packages/swarm-ui/test/agent-permissions.test.mjs
index f11acbeac..012aeb615 100644
--- a/frontend/packages/swarm-ui/test/agent-permissions.test.mjs
+++ b/frontend/packages/swarm-ui/test/agent-permissions.test.mjs
@@ -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);
+});