Python
Sandbox settings v6: allowed-sites tick list, three-row OpenShell setup
Rohit C Prasad4f512b77bd20
diff --git a/coworker/agent.py b/coworker/agent.pyindex d7e0b88f..2c3d0190 100644--- a/coworker/agent.py+++ b/coworker/agent.py@@ -348,7 +348,7 @@ def build_engine(agent=agent.name,credentials=config.sandbox_credentials,network_profile=config.sandbox_network_profile,- extra_hosts=config.sandbox_network_extra_hosts,+ extra_hosts=config.sandbox_network_hosts,toolchains=config.sandbox_toolchains,)if ws is not Nonediff --git a/coworker/config.py b/coworker/config.pyindex 8e6f391d..ab79143d 100644--- a/coworker/config.py+++ b/coworker/config.py@@ -125,10 +125,11 @@ class Config:# coworker/sandbox/credentials.py; an entry here edits or adds by name.sandbox_credentials: list[dict[str, Any]] = field(default_factory=list)# Which hosts a sandbox may reach: a profile name from coworker/sandbox/network_profiles.py- # ("standard" when unset, "open" on Windows). Machine-level, like the provider.+ # ("allowlist" when unset, "open" on Windows). Machine-level, like the provider.sandbox_network_profile: Optional[str] = None- # The machine's own additions to that list, "host:port" (a bare host means 443).- sandbox_network_extra_hosts: list[str] = field(default_factory=list)+ # The sites an `allowlist` sandbox may reach, "host:port" (a bare host means 443).+ # Empty until the user ticks some in Settings ▸ Sandbox.+ sandbox_network_hosts: list[str] = field(default_factory=list)# Developer tool folders under the home folder a sandbox may read (design doc, Windows# 3d.4): `[[sandbox_toolchains]]` tables with name, path, enabled, editing or adding to# the shipped list in coworker/sandbox/toolchains.py by name. Machine-level.@@ -145,7 +146,7 @@ _FIELDS = {"sandbox_provider","sandbox_credentials","sandbox_network_profile",- "sandbox_network_extra_hosts",+ "sandbox_network_hosts","sandbox_toolchains","compaction_cap_tokens","compaction_summary_max_tokens",@@ -173,7 +174,7 @@ _GLOBAL_ONLY_FIELDS = {"sandbox_provider","sandbox_credentials","sandbox_network_profile",- "sandbox_network_extra_hosts",+ "sandbox_network_hosts","sandbox_toolchains","allowed_commands","auto_allow",diff --git a/coworker/sandbox/network_profiles.py b/coworker/sandbox/network_profiles.pyindex 7bad984c..88778dd0 100644--- a/coworker/sandbox/network_profiles.py+++ b/coworker/sandbox/network_profiles.py@@ -1,13 +1,12 @@-"""Where an agent's commands may connect, in OUR words. Every provider renders these lists-into its own mechanism: OpenShell into `network_policies`, Seatbelt into the allow-list-proxy, Windows into the account it runs as. HTTPS (port 443) only.--`open` is the profile with no list at all: files stay isolated, the network is the-machine's own (ruling of 2026-09-25). It is the default on Windows for now.--`strict` (code hosts and registries, no search) was folded into `standard` (UX-053 v5): the-name is still accepted and means `standard`. A machine may add its own hosts to the list-(`sandbox_network_extra_hosts`, see `clean_host`).+"""Where an agent's commands may connect, in OUR words. Every provider renders these into+its own mechanism: OpenShell into `network_policies`, Seatbelt and Windows into the+allow-list proxy.++Two profiles (UX-053 v6): `allowlist`, where only the sites the machine ticked are+reachable (`sandbox_network_hosts`, "host:port"; empty until the user ticks some), and+`open`, with no list at all: files stay isolated, the network is the machine's own+(ruling of 2026-09-25). `open` is the default on Windows for now. `SITES` is the catalogue+the page offers in groups; ticking one puts it on the machine's list."""from __future__ import annotations@@ -18,20 +17,19 @@ CODE_HOSTS = ["github.com", "api.github.com", "codeload.github.com", "objects.giPACKAGE_REGISTRIES = ["pypi.org", "files.pythonhosted.org", "registry.npmjs.org", "crates.io", "static.crates.io", "index.crates.io", "proxy.golang.org", "sum.golang.org"]SEARCH_APIS = ["api.search.brave.com", "api.tavily.com", "html.duckduckgo.com", "duckduckgo.com"]-# name of the group -> hosts, per profile-PROFILES: dict[str, dict[str, list[str]]] = {- # git, the package registries and the search APIs: enough to clone, install, push and search.- "standard": {"code-hosts": CODE_HOSTS, "package-registries": PACKAGE_REGISTRIES, "search-apis": SEARCH_APIS},- # any host: no proxy, no list. Files are still confined.- "open": {},-}+# The page's catalogue, by group. None is allowed until ticked.+SITES: dict[str, list[str]] = {"code-hosts": CODE_HOSTS, "package-registries": PACKAGE_REGISTRIES, "search-apis": SEARCH_APIS}++# name of the group -> hosts, per profile. Neither profile carries hosts of its own: the+# allow list is the machine's, and `open` has none.+PROFILES: dict[str, dict[str, list[str]]] = {"allowlist": {}, "open": {}}+ALLOWLIST = "allowlist"OPEN = "open"-DEFAULT_PROFILE = "standard"-ALIASES = {"strict": "standard"}+DEFAULT_PROFILE = ALLOWLISTdef default_profile(platform: str = sys.platform) -> str:- """The profile a machine uses until it chooses one: `open` on Windows, `standard` elsewhere."""+ """The profile a machine uses until it chooses one: `open` on Windows, `allowlist` elsewhere."""return OPEN if platform == "win32" else DEFAULT_PROFILE@@ -40,8 +38,6 @@ def is_open(profile: str) -> bool:def check(profile: str) -> str:- """The profile's name, with an old name mapped to its current one."""- profile = ALIASES.get(profile, profile)if profile not in PROFILES:raise ValueError(f"unknown network profile {profile!r} (known: {', '.join(sorted(PROFILES))})")return profilediff --git a/coworker/sandbox/settings.py b/coworker/sandbox/settings.pyindex 78321584..66353e0d 100644--- a/coworker/sandbox/settings.py+++ b/coworker/sandbox/settings.py@@ -79,10 +79,9 @@ def snapshot(cfg: Optional[app_config.Config] = None) -> dict[str, Any]:"providers": providers,"windows_setup": _windows_setup_info(),"network_profile": _profile_for_display(cfg.sandbox_network_profile),- "network_profiles": [- {"name": name, "hosts": network_profiles.hosts(name)} for name in network_profiles.PROFILES- ],- "network_extra_hosts": network_profiles.clean_hosts(cfg.sandbox_network_extra_hosts),+ "network_profiles": [{"name": name} for name in network_profiles.PROFILES],+ "network_sites": [{"group": group, "hosts": [f"{h}:443" for h in hosts]} for group, hosts in network_profiles.SITES.items()],+ "network_hosts": network_profiles.clean_hosts(cfg.sandbox_network_hosts),"credentials": _for_display(credentials.listed(cfg.sandbox_credentials)),"credential_presets": _presets(cfg.sandbox_credentials),"toolchains": toolchains.for_display(cfg.sandbox_toolchains),@@ -91,7 +90,7 @@ def snapshot(cfg: Optional[app_config.Config] = None) -> dict[str, Any]:def _profile_for_display(configured: Optional[str]) -> str:- """The machine's profile by its current name (an old `strict` shows as `standard`)."""+ """The machine's profile, or the default rule's when it has none."""try:return network_profiles.check((configured or "").strip().lower() or network_profiles.default_profile())except ValueError:@@ -219,10 +218,10 @@ def update(body: dict[str, Any]) -> dict[str, Any]:except ValueError as exc:return {"ok": False, "error": str(exc)}app_config.set_global_value("sandbox_network_profile", profile)- if "network_extra_hosts" in body:- items = body.get("network_extra_hosts")+ if "network_hosts" in body:+ items = body.get("network_hosts")if not isinstance(items, list):- return {"ok": False, "error": "network_extra_hosts must be a list"}+ return {"ok": False, "error": "network_hosts must be a list"}added: list[str] = []for item in items:try:@@ -231,7 +230,7 @@ def update(body: dict[str, Any]) -> dict[str, Any]:return {"ok": False, "error": str(exc)}if host not in added:added.append(host)- app_config.set_global_list("sandbox_network_extra_hosts", added)+ app_config.set_global_list("sandbox_network_hosts", added)if "credentials" in body:rows = body.get("credentials")if not isinstance(rows, list):diff --git a/coworker/sandbox/setup_cmd.py b/coworker/sandbox/setup_cmd.pyindex e6e12a84..e9849cd8 100644--- a/coworker/sandbox/setup_cmd.py+++ b/coworker/sandbox/setup_cmd.py@@ -64,8 +64,8 @@ ROWS = {"disk": f"enough free disk space for the base image (about {IMAGE_FREE_GB} GB)","image": IMAGE_ROW,}-# Steps the app may fix on its own without an administrator. `openshell` joins them at-# run time when `admin_prefix()` finds a way to run as one; see `steps()`.+# Steps the app may fix on its own. Installing OpenShell is never one of them: the user+# installs it (UX-053 v6).FIXABLE = {"bind_mounts", "config", "image", "linger"}@@ -128,15 +128,6 @@ def admin_prefix() -> Optional[list[str]]:return None-def install_handover_command() -> str:- """The ONE command a user runs in a terminal when the app cannot run the administrator- steps itself: linger first (the installer needs the user's systemd manager, which does- not run without it on WSL), then the installer. On a Mac, the installer alone."""- if sys.platform.startswith("linux"):- return f"sudo loginctl enable-linger {getpass.getuser()} && {installer_command()}"- return installer_command()--def landlock_available() -> Optional[bool]:"""Whether this kernel has Landlock: True/False on Linux, None elsewhere (a Mac'ssandboxes run in Docker Desktop's own Linux VM, which cannot be asked from here).@@ -175,17 +166,14 @@ def steps() -> list[Step]:exe = shutil.which("openshell")version = (_run([exe, "--version"], 15).stdout.split() or [""])[-1] if exe else ""openshell_ok = version == PINNED_VERSION- # The app installs it when it can run as an administrator without a password (or- # needs none, on a Mac); otherwise the row carries the one command to run.- can_install = sys.platform == "darwin" or (sys.platform.startswith("linux") and admin_prefix() is not None)+ # The user installs OpenShell (UX-053 v6): the app points at NVIDIA's guide and checks+ # again; it never runs their installer. `setup` in a terminal still offers to.out.append(Step("openshell",ROWS["openshell"],openshell_ok,"" if openshell_ok or not version else f"found {version}, not the tested release",- fixable=not openshell_ok and can_install,- command="" if openshell_ok or can_install else install_handover_command(),docs="" if openshell_ok else GUIDE_URL,))@@ -273,49 +261,6 @@ def enable_linger() -> Optional[str]:return f"sudo loginctl enable-linger {user}"-def _stream(argv: list[str], on_line: Optional[Callable[[str], None]], cancel: Optional[threading.Event]) -> tuple[Optional[int], str]:- """Run `argv` with stdin closed, feeding each output line to `on_line`. Returns the- exit code (None when cancelled) and the last line seen."""- last = ""- try:- proc = subprocess.Popen(argv, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)- except OSError as exc:- return 127, f"could not run {argv[0]}: {exc}"- assert proc.stdout is not None- for line in proc.stdout:- if cancel is not None and cancel.is_set():- proc.kill()- proc.wait()- return None, last- line = line.strip()- if line:- last = line[:160]- if on_line is not None:- on_line(last)- return proc.wait(), last---def install_openshell(on_line: Optional[Callable[[str], None]] = None, cancel: Optional[threading.Event] = None) -> Optional[str]:- """Install the pinned OpenShell from the app (Settings ▸ Set up sandbox). On a Mac the- installer runs as the user. On Linux it runs as an administrator through- `admin_prefix()`, with linger enabled FIRST in the same run (the installer needs the- user's systemd manager, which does not run without linger on WSL and on a headless- box). Returns an error text, or None when it succeeded."""- if sys.platform == "darwin":- argv = ["sh", "-c", installer_command()]- else:- prefix = admin_prefix()- if prefix is None:- return "this machine has no way to run an administrator step without a password; run: " + install_handover_command()- argv = prefix + ["sh", "-c", f"loginctl enable-linger {getpass.getuser()} && {installer_command()}"]- code, last = _stream(argv, on_line, cancel)- if code is None:- return "installation cancelled"- if code != 0:- return f"the installer exited with {code}: {last}"- return None--def apply_config() -> None:app_config.set_global_value("sandbox_provider", "openshell")diff --git a/coworker/sandbox/setup_job.py b/coworker/sandbox/setup_job.pyindex f8738b2b..0d6a5716 100644--- a/coworker/sandbox/setup_job.py+++ b/coworker/sandbox/setup_job.py@@ -1,12 +1,9 @@"""The guided setup behind Settings ▸ Sandbox ▸ "Set up sandbox" (OPE-207).One job per machine, on a worker thread. It walks `setup_cmd.steps()` top to bottom and-fixes each step it may: the OpenShell install (through `sudo` without a password or the-system's password prompt, see `setup_cmd.admin_prefix`; as the user on a Mac), bind-mounts, linger, the config line, the image download. The two slow ones (install,-download) stream progress and can be cancelled. A step the app cannot do on this machine-is handed over as ONE command to run in a terminal, and the job stops there until the-user says "check again". The job never holds a password and never lowers protection: a+fixes each step it may: bind mounts, linger, the config line, the image download (which+streams progress and can be cancelled). It never installs Docker or OpenShell: a step the+app cannot do stops the job with what the user should do, until they say "check again". The job never holds a password and never lowers protection: afailure leaves the machine "not ready, here is what to do", and sessions stay refused."""@@ -139,8 +136,6 @@ class SetupJob:self.progress = {"layers_total": 0, "layers_done": 0, "last_line": line, "elapsed_s": int(time.time() - self.started_at), **more}def _fix(self, step: setup_cmd.Step) -> Optional[str]:- if step.key == "openshell":- return setup_cmd.install_openshell(self._progress, self._cancel)if step.key == "bind_mounts":return setup_cmd.apply_bind_mounts()if step.key == "config":diff --git a/coworker/sandbox/workspace.py b/coworker/sandbox/workspace.pyindex 5cef561e..6d5b0087 100644--- a/coworker/sandbox/workspace.py+++ b/coworker/sandbox/workspace.py@@ -223,7 +223,7 @@ def open_workspace("""The session's workspace for the configured provider. `credentials`: the machine's`sandbox_credentials` setting; the enabled entries are copied into the sandbox(design doc, section 11b). Ignored in `direct` mode, where nothing is hidden anyway. `direct` unless told otherwise.- `extra_hosts`: the machine's `sandbox_network_extra_hosts`, joined to the network list.+ `extra_hosts`: the machine's `sandbox_network_hosts`, the sites an allow list lets through.`toolchains`: the machine's `sandbox_toolchains` setting; the switched-on folders thatexist are readable inside (Seatbelt, Windows full mode).`roots`: the session's RootDir list (primary first); without it the workspace folder isdiff --git a/docs/config.example.toml b/docs/config.example.tomlindex 672b871c..77a92a6a 100644--- a/docs/config.example.toml+++ b/docs/config.example.toml@@ -36,12 +36,11 @@ port = 8765# the default), "openshell" (one NVIDIA OpenShell container per agent) or "seatbelt"# (the sandbox built into macOS). See docs/openshell.md and docs/macos-sandbox.md.# sandbox_provider = "openshell"-# Network inside a sandbox: "standard" (code hosts, package registries and the search-# APIs) or "open" (any host; the files are still confined). The default is "standard", or-# "open" on Windows. "strict" is an older name for "standard".-# sandbox_network_profile = "standard"-# Hosts of your own added to "standard" (host:port; a bare host means 443).-# sandbox_network_extra_hosts = ["registry.acme.dev:443"]+# Network inside a sandbox: "allowlist" (only the sites listed below) or "open" (any+# site; the files are still confined). The default is "allowlist", or "open" on Windows.+# sandbox_network_profile = "allowlist"+# The sites an allow list lets through (host:port; a bare host means 443). None by default.+# sandbox_network_hosts = ["github.com:443", "pypi.org:443"]# Config and keys exposed to agents, copied into the sandbox for the session and deleted# with it. Only the entries named here are listed in Settings ▸ Sandbox; the shipped ones# (ssh, gh, aws, aws-credentials, kube, npm, docker, gcloud, terraform) are added by name.diff --git a/docs/macos-sandbox.md b/docs/macos-sandbox.mdindex 06b39c82..ecdc9d04 100644--- a/docs/macos-sandbox.md+++ b/docs/macos-sandbox.md@@ -31,8 +31,8 @@ Settings ▸ Sandbox ▸ "macOS sandbox", or in `config.toml`:```tomlsandbox_provider = "seatbelt" # or "direct": commands run in the OpenWorker process-sandbox_network_profile = "standard" # or "open" (any host; files still confined)-sandbox_network_extra_hosts = ["registry.acme.dev:443"] # optional, your own additions+sandbox_network_profile = "allowlist" # or "open" (any site; files still confined)+sandbox_network_hosts = ["github.com:443", "pypi.org:443"] # the sites you ticked; none by default```The setting is per machine; a project's own config cannot change it.@@ -63,13 +63,13 @@ follow the proxy variables; a program that ignores them has no network at all.Two choices, shared with the other sandboxes:-- **Package registries and search** (`standard`, the default): GitHub, GitLab, the package- registries — PyPI, npm, crates.io, the Go proxy — and the search APIs (Brave, Tavily,- DuckDuckGo). **Customize…** adds hosts of your own; the shipped ones stay.-- **Allow everything** (`open`): any host, no proxy. The files are still the wall.+- **Only the sites you allow** (`allowlist`, the default): nothing until you tick sites+ under **Choose sites…**. The list offers code hosting (GitHub, GitLab), the package+ registries (PyPI, npm, crates.io, the Go proxy) and the search APIs (Brave, Tavily,+ DuckDuckGo), each with a tick box, and you can add any site of your own.+- **Allow everything** (`open`): any site, no proxy. The files are still the wall.-`strict`, the list without the search APIs, was folded into `standard`; a machine set to it-now uses `standard`. A credential entry (below) adds the hosts its tool needs.+A credential entry (below) also lets through the sites its tool needs.## Sharing a credential on purpose@@ -132,7 +132,7 @@ itself, outside every sandbox, with their own tokens.(macOS does not nest them). `openworker machine sandbox status` says why.- **A tool cannot be found inside the sandbox** — it lives somewhere under your home folderthat is not on the toolchain list.-- **A host is refused** — it is not on the list; add it with **Customize…**, or add the+- **A site is refused** — it is not ticked; tick or add it under **Choose sites…**, or add thecredential entry whose hosts include it.- **`git push` says permission denied inside the sandbox** — no credential is shared.Switch the `ssh` (or `gh`) entry on in Settings ▸ Sandbox.diff --git a/docs/openshell.md b/docs/openshell.mdindex 8fd1311c..2323deea 100644--- a/docs/openshell.md+++ b/docs/openshell.md@@ -78,31 +78,23 @@ OpenShell, and downloads the base image sandboxes are built from.The base image is about 5 GB and is downloaded once. Until it is on the machine, Settings ▸Sandbox shows OpenShell as **needs download** and a session is refused with the same-message, rather than hanging on the download. `setup` and the **Set up** button on the-OpenShell row download it with Docker's own progress; the command is also `docker pull` of the image+message, rather than hanging on the download. `setup` and the app's setup download it with Docker's own progress; the command is also `docker pull` of the imagenamed in the refusal.-Settings ▸ Sandbox does the same from the app: one switch, **Run agents in a sandbox**,-and under it the provider, a readiness checklist (the rows `status` prints, each with a-Guide link and, where the app cannot do it, the one command to run), and a **Set up-sandbox** button that walks the list and does each step itself. The two steps that need-an administrator on Linux (the OpenShell install and linger) go through `sudo` when your-user may use it without a password, or through the system's own password prompt on a-Linux desktop; the app never sees or stores the password. On a Mac, Homebrew installs-OpenShell as you, so nothing needs an administrator. Where there is no prompt to use-(WSL), both steps are folded into ONE command shown with Copy, and **Check again**-continues once you have run it. The install and the image download show their progress-and can be cancelled. The network allow list and the shared credentials appear only while-the switch is on: they apply behind a wall and nowhere else. On Windows the switch is off-and disabled; run OpenWorker on a Linux machine (a WSL Ubuntu counts) added under-Settings ▸ Machines.+In the app, Settings ▸ Sandbox shows OpenShell with a **Set up** button until it is ready.+The setup has three rows: **Docker Desktop is running** and **OpenShell is installed**,+which you fix yourself (each says what to do, with a link; the app installs neither), and+**Set up OpenShell for OpenWorker**, which the app does: it allows bind mounts, downloads+the base image with its progress, and sets the machine to use OpenShell. Each row gets a+tick as it finishes. The network choice and the shared credentials appear once a sandbox+type is chosen. OpenShell is not available on Windows yet.The setting is per machine, in Settings ▸ Sandbox or in `config.toml`:```tomlsandbox_provider = "openshell" # or "direct": commands run in the OpenWorker process-sandbox_network_profile = "standard" # or "open" (any host; files still confined)-sandbox_network_extra_hosts = ["registry.acme.dev:443"] # optional, your own additions+sandbox_network_profile = "allowlist" # or "open" (any site; files still confined)+sandbox_network_hosts = ["github.com:443", "pypi.org:443"] # the sites you ticked; none by default```A project's own config cannot change it. When a machine is set to OpenShell and OpenShell@@ -129,13 +121,13 @@ the agent is told.Two choices, shared with the other sandboxes:-- **Package registries and search** (`standard`, the default): GitHub, GitLab, the package- registries — PyPI, npm, crates.io, the Go proxy — and the search APIs (Brave, Tavily,- DuckDuckGo). **Customize…** adds hosts of your own; the shipped ones stay.-- **Allow everything** (`open`): any host, no allow list. The files are still the wall.+- **Only the sites you allow** (`allowlist`, the default): nothing until you tick sites+ under **Choose sites…**. The list offers code hosting (GitHub, GitLab), the package+ registries (PyPI, npm, crates.io, the Go proxy) and the search APIs (Brave, Tavily,+ DuckDuckGo), each with a tick box, and you can add any site of your own.+- **Allow everything** (`open`): any site, no allow list. The files are still the wall.-`strict`, the list without the search APIs, was folded into `standard`; a machine set to it-now uses `standard`. A credential entry (below) adds the hosts its tool needs.+A credential entry (below) also lets through the sites its tool needs.OpenShell enforces the list in the container.@@ -198,7 +190,7 @@ enabled = true- **"The sandbox base image is not downloaded yet"** — the one-time 5 GB download hasnot happened. Run `openworker machine sandbox setup` and accept the download, or run the`docker pull` command from the message; then start the session again.-- **A host is refused** — it is not on the list; add it with **Customize…**, or add the+- **A site is refused** — it is not ticked; tick or add it under **Choose sites…**, or add thecredential entry whose hosts include it.- **`git push` says permission denied inside the sandbox** — no credential is shared.Switch the `ssh` (or `gh`) entry on in Settings ▸ Sandbox.diff --git a/docs/windows-sandbox.md b/docs/windows-sandbox.mdindex 96396e3b..7c1de12c 100644--- a/docs/windows-sandbox.md+++ b/docs/windows-sandbox.md@@ -67,8 +67,8 @@ and keys exposed to agents, and the tools shown to agents with read-only access.```tomlsandbox_provider = "windows" # or "direct": commands run in the OpenWorker process-sandbox_network_profile = "open" # the Windows default; or "standard"-sandbox_network_extra_hosts = ["registry.acme.dev:443"] # optional, for "standard"+sandbox_network_profile = "open" # the Windows default; or "allowlist"+sandbox_network_hosts = ["github.com:443"] # for "allowlist": the sites you ticked```The setting is per machine; a project's own config cannot change it.@@ -111,7 +111,7 @@ One elevated PowerShell script, one prompt. It:│┌────────────────────────┴────────────────────────┐│ │- Allow everything (default) Package registries and search+ Allow everything (default) Only the sites you allow│ │▼ ▼runs as OWSandboxOpenNet runs as OWSandboxClosedNet@@ -133,13 +133,12 @@ One elevated PowerShell script, one prompt. It:- **Allow everything** (`open`) — any host. Nothing to configure. The files are still thewall. This is the default on Windows, and the page shows it in amber.-- **Package registries and search** (`standard`) — GitHub, GitLab, the package registries- (PyPI, npm, crates.io, the Go proxy) and the search APIs, through the proxy.- **Customize…** adds hosts of your own. A program that ignores the proxy variables has no- network at all, because the account's direct traffic is blocked in the kernel.+- **Only the sites you allow** (`allowlist`) — the sites you tick under **Choose sites…**+ (code hosting, package registries, search APIs, or any site you add), through the proxy;+ nothing until you tick some. A program that ignores the proxy variables has no network+ at all, because the account's direct traffic is blocked in the kernel.-`strict`, the list without the search APIs, was folded into `standard`. A credential entry-(below) adds the hosts its tool needs.+A credential entry (below) also lets through the sites its tool needs.Choosing a mode never touches the firewall. The rules are written once at setup; OpenWorkerpicks the account. In the closed mode a sandbox can still **listen** on a local port (a dev@@ -237,4 +236,4 @@ expire on their own limit what that is worth.| Install | one administrator prompt | nothing | OpenShell and Docker || Files | session folders; profile invisible except the tool list; outside-profile folders readable | session folders; home invisible except the tool list | session folders; nothing else || Network | open (default), or the allow list through the proxy | the allow list through the proxy, or open | the allow list in the policy, or open |-| Default | open | standard | standard |+| Default | open | only the sites you allow | only the sites you allow |diff --git a/packaging/build_dmg.sh b/packaging/build_dmg.shindex 724ce3e8..76f5dad4 100755--- a/packaging/build_dmg.sh+++ b/packaging/build_dmg.sh@@ -12,7 +12,7 @@# - A Python venv at .venv (repo root) with this package installed editable, plus the# build-only deps:# python3 -m venv .venv-# .venv/bin/pip install -e '.[bedrock]' pyinstaller tzdata typer+# .venv/bin/pip install -e '.[bedrock,openshell]' pyinstaller tzdata typer# `typer` is needed only at BUILD time: PyInstaller walks the `mcp` package and# `mcp.cli` calls sys.exit() at import if typer is absent, which aborts the freeze.# (aisuite installs like any other dependency — git-pinned in pyproject.toml.)@@ -36,7 +36,7 @@# the spec strips coworker.connectors.experimental. Self-builders can opt in with:# COWORKER_EXPERIMENTAL=1 ./build_dmg.sh# VENV PREREQS (a fresh worktree's venv, discovered the hard way 2026-08-21):-# .venv/bin/pip install -e ".[dev,messaging,browser,bedrock]" pyinstaller typer+# .venv/bin/pip install -e ".[dev,messaging,browser,bedrock,openshell]" pyinstaller typer# (`typer` because PyInstaller's submodule collection imports mcp.cli, which# sys.exit(1)s without it.)set -euo pipefail@@ -73,6 +73,13 @@ if [ -n "${APPLE_CERTIFICATE:-}" ] && [ -n "${APPLE_SIGNING_IDENTITY:-}" ]; thensecurity list-keychains -d user -s "$KC" login.keychain-dbfi+# OpenShell sandboxes talk to the gateway over gRPC; a sidecar without grpcio can never use+# them (a DMG shipped that way on 2026-09-28).+if ! "$PLATFORM/.venv/bin/python" -c "import grpc" 2>/dev/null; then+ echo "ERROR: grpcio is missing from .venv; install the openshell extra (see VENV PREREQS above)" >&2+ exit 1+fi+echo "==> [1/5] PyInstaller: bundling openworker-server ($TRIPLE)""$PLATFORM/.venv/bin/pyinstaller" --noconfirm --clean \--distpath "$HERE/dist" --workpath "$HERE/build" "$HERE/openworker-server.spec"diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.tsindex 04053efe..cc276b7f 100644--- a/surfaces/gui/src/api.ts+++ b/surfaces/gui/src/api.ts@@ -2125,9 +2125,10 @@ export interface SandboxSettings {// place except for the base image (about 5 GB, pulled once); the radio stays enabled.providers: { name: string; usable: boolean; why: string; state?: "ready" | "needs_download" | "unavailable" }[];windows_setup: WindowsSetupInfo | null;- network_profile: string; // an old "strict" comes back as "standard"- network_profiles: { name: string; hosts: string[] }[];- network_extra_hosts: string[]; // the machine's own additions, "host:port"+ network_profile: string; // "allowlist" | "open"+ network_profiles: { name: string }[];+ network_sites: { group: string; hosts: string[] }[]; // the catalogue the sites dialog offers, "host:port"+ network_hosts: string[]; // the sites the machine ticked, "host:port"; empty until it ticks somecredentials: SandboxCredentialEntry[]; // only the entries the user added (UX-053 v5)credential_presets: SandboxCredentialEntry[]; // the "A CLI's login" picker: shipped, not yet addedtoolchains: SandboxToolchainEntry[];@@ -2140,7 +2141,7 @@ export async function getSandboxSettings(machineId?: string | null): Promise<San}export async function setSandboxSettings(- patch: Partial<Pick<SandboxSettings, "provider" | "network_profile" | "network_extra_hosts" | "credentials" | "toolchains">>,+ patch: Partial<Pick<SandboxSettings, "provider" | "network_profile" | "network_hosts" | "credentials" | "toolchains">>,machineId?: string | null,): Promise<{ ok: boolean; error?: string; rebuilt_sessions?: string[] } & Partial<SandboxSettings>> {// `rebuilt_sessions`: after a provider change, the sessions whose engine the serverdiff --git a/surfaces/gui/src/components/SandboxSection.tsx b/surfaces/gui/src/components/SandboxSection.tsxindex ed5c0654..0b7c0d83 100644--- a/surfaces/gui/src/components/SandboxSection.tsx+++ b/surfaces/gui/src/components/SandboxSection.tsx@@ -1,10 +1,11 @@// Settings ▸ Sandbox (UX-051 A, UX-053 v5, OPE-207): one switch first; on reveals the// sandbox type; a type that is the machine's choice reveals its options: the network-// (package registries and search, with the machine's own hosts; or everything), the config+// (only the sites the user ticks, none until they do; or everything), the config// and keys copied into sandboxes, and the tool folders agents may read. A type that is not// set up yet looks disabled and carries one "Set up" button: the Windows sandbox's opens its-// one-time elevated setup, OpenShell's opens the guided setup job (fixes what the app may-// fix, never as root; hands the rest over as commands; downloads the image with progress).+// one-time elevated setup, OpenShell's opens its setup: two checks the user fixes (Docker+// running, OpenShell installed) and one step the app does (the folder setting and the+// base image download, with progress).// Everything here is machine-level (the machine's config.toml through /v1/settings/sandbox);// nothing is per project. A provider change rebuilds live sessions under the new rule// (onProviderChanged carries their ids).@@ -167,7 +168,7 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machiconst [menu, setMenu] = useState(false); // the "Add…" menu of the files panelconst [picking, setPicking] = useState(false); // the "A CLI's login" pickerconst [editing, setEditing] = useState<string | null>(null); // credential name being edited, "" = new- const [hostsOpen, setHostsOpen] = useState(false);+ const [sitesOpen, setSitesOpen] = useState(false);const [addingTool, setAddingTool] = useState(false);const [toolTitle, setToolTitle] = useState("");const [toolPath, setToolPath] = useState("~/");@@ -331,7 +332,8 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machiconst setUpOn = setup?.set_up_at ? new Date(setup.set_up_at) : null;const setUpOnText = setUpOn && !Number.isNaN(setUpOn.getTime()) ? setUpOn.toLocaleDateString(undefined, { day: "numeric", month: "short", year: "numeric" }) : "";- const extraHosts = cfg.network_extra_hosts ?? [];+ const ticked = cfg.network_hosts ?? [];+ const bare = (h: string) => h.replace(/:443$/, "");const presets = cfg.credential_presets ?? [];const showTools = cfg.platform !== "linux" && chosen !== "openshell" && Boolean(cfg.toolchains);const toolsOn = (cfg.toolchains || []).filter((x) => x.enabled);@@ -466,7 +468,7 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machi<><div className={FIELD_LABEL + " mb-2"}>{t("settingsx.sandbox.network")}</div><div className={CARD + " mb-5 divide-y divide-line"} role="radiogroup" aria-label={t("settingsx.sandbox.network")}>- {(["standard", "open"] as const).map((name) => (+ {(["allowlist", "open"] as const).map((name) => (<label key={name} className="flex items-start gap-3 px-4 py-2.5 cursor-pointer"><inputtype="radio"@@ -478,23 +480,24 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machi/><span className="flex-1 min-w-0"><span className={"block text-ui " + (name === "open" ? "text-warnInk" : "text-ink")}>{t(`settingsx.sandbox.profile_${name}`)}</span>- <span className="block text-meta text-muted">- {t(`settingsx.sandbox.profile_${name}_desc`)}- {name === "standard" ? (- <>- <button- type="button"- className="ml-1.5 text-accent hover:underline"- onClick={(e) => {- e.preventDefault();- setHostsOpen(true);- }}- data-testid="sandbox-network-customize"- >- {t("settingsx.sandbox.customize")}- </button>- {extraHosts.length ? <span className="text-faint"> · {t("settingsx.sandbox.hosts_added", { count: extraHosts.length })}</span> : null}- </>+ <span className="block text-meta text-muted" data-testid={`sandbox-network-${name}-desc`}>+ {name === "open"+ ? t("settingsx.sandbox.profile_open_desc")+ : ticked.length+ ? t("settingsx.sandbox.sites_sum", { list: listText(t, ticked.map(bare), 3) })+ : t("settingsx.sandbox.sites_none")}+ {name === "allowlist" ? (+ <button+ type="button"+ className="ml-1.5 text-accent hover:underline"+ onClick={(e) => {+ e.preventDefault();+ setSitesOpen(true);+ }}+ data-testid="sandbox-network-sites"+ >+ {t("settingsx.sandbox.choose_sites")}+ </button>) : null}</span></span>@@ -625,15 +628,15 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machi</>) : null}- {/* Customize: the machine's own hosts */}- {hostsOpen ? (- <HostsDialog+ {/* Choose sites: the allow list, every site a tick box */}+ {sitesOpen ? (+ <SitesDialogt={t}- hosts={extraHosts}- builtin={cfg.network_profiles.find((n) => n.name === "standard")?.hosts ?? []}- onCancel={() => setHostsOpen(false)}+ ticked={ticked}+ catalogue={cfg.network_sites ?? []}+ onCancel={() => setSitesOpen(false)}onSave={async (next) => {- if (await save({ network_extra_hosts: next })) setHostsOpen(false);+ if (await save({ network_hosts: next })) setSitesOpen(false);}}error={error}/>@@ -720,6 +723,7 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machi{openshellDialog ? (<OpenShellDialogt={t}+ platform={cfg.platform}readiness={readiness}job={job}ready={Boolean(cfg.providers.find((p) => p.name === "openshell")?.usable) && chosen === "openshell"}@@ -847,26 +851,34 @@ export function SandboxSection({ machine, onProviderChanged }: { machine?: Machi);}-// "Customize…": the hosts this machine adds to "Package registries and search", which the-// user adds and removes, above the shipped ones, which are read-only.-function HostsDialog({+// "Choose sites…" (UX-053 v6): every site the allow list can hold, as a tick box in its+// group, none ticked until the user ticks some. Sites the user adds join the list and can+// be removed. Saving writes the ticked ones, "host:port".+function SitesDialog({t,- hosts,- builtin,+ ticked,+ catalogue,onCancel,onSave,error,}: {t: T;- hosts: string[];- builtin: string[];+ ticked: string[];+ catalogue: { group: string; hosts: string[] }[];onCancel: () => void;onSave: (hosts: string[]) => void;error: string;}) {- const [list, setList] = useState<string[]>(hosts);+ const known = new Set(catalogue.flatMap((g) => g.hosts));+ const [on, setOn] = useState<Set<string>>(new Set(ticked));+ const [added, setAdded] = useState<string[]>(ticked.filter((h) => !known.has(h)));const [draft, setDraft] = useState("");const [bad, setBad] = useState(false);+ const flip = (hosts: string[], value: boolean) => {+ const next = new Set(on);+ hosts.forEach((h) => (value ? next.add(h) : next.delete(h)));+ setOn(next);+ };const add = () => {const host = cleanHost(draft);if (!host) {@@ -875,32 +887,63 @@ function HostsDialog({}setBad(false);setDraft("");- if (!list.includes(host)) setList([...list, host]);+ if (!known.has(host) && !added.includes(host)) setAdded([...added, host]);+ flip([host], true);};- const rows: string[][] = [];- for (let i = 0; i < builtin.length; i += 4) rows.push(builtin.slice(i, i + 4));+ const groups = [...(added.length ? [{ group: "added", hosts: added }] : []), ...catalogue];+ const result = [...catalogue.flatMap((g) => g.hosts), ...added].filter((h) => on.has(h));+ const bare = (h: string) => h.replace(/:443$/, "");return (- <Modal testid="sandbox-hosts-dialog" wide>- <h3 className="text-heading font-semibold mb-1.5">{t("settingsx.sandbox.hosts_title")}</h3>- <p className="text-ui text-muted mb-3.5 leading-relaxed">{t("settingsx.sandbox.hosts_intro")}</p>- <div className="text-label font-medium text-faint mb-1.5">{t("settingsx.sandbox.hosts_yours")}</div>- {list.length ? (- <div className="rounded-lg border border-line divide-y divide-line mb-2">- {list.map((h) => (- <div key={h} className="flex items-center gap-2.5 px-3 py-1.5 text-meta font-mono text-ink" data-testid={`sandbox-host-${h}`}>- {h}- <button className="ml-auto text-meta font-sans text-muted hover:text-ink" onClick={() => setList(list.filter((x) => x !== h))}>- {t("settingsx.sandbox.remove")}- </button>+ <Modal testid="sandbox-sites-dialog" wide>+ <h3 className="text-heading font-semibold mb-1.5">{t("settingsx.sandbox.sites_title")}</h3>+ <p className="text-ui text-muted mb-3.5 leading-relaxed">{t("settingsx.sandbox.sites_intro")}</p>+ <div className="rounded-lg border border-line max-h-[330px] overflow-auto">+ {groups.map((g) => {+ const count = g.hosts.filter((h) => on.has(h)).length;+ const all = count === g.hosts.length;+ return (+ <div key={g.group} data-testid={`sandbox-sites-group-${g.group}`}>+ <label className="sticky top-0 flex items-center gap-2.5 px-3 py-2 bg-chrome border-b border-line text-meta font-semibold text-ink cursor-pointer">+ <input+ type="checkbox"+ checked={all}+ ref={(el) => {+ if (el) el.indeterminate = count > 0 && !all;+ }}+ onChange={() => flip(g.hosts, !all)}+ data-testid={`sandbox-sites-group-${g.group}-box`}+ />+ {t(`settingsx.sandbox.site_group_${g.group}`)}+ <span className="ml-auto font-normal text-faint">{t("settingsx.sandbox.sites_count", { on: count, total: g.hosts.length })}</span>+ </label>+ {g.hosts.map((h) => (+ <label key={h} className="flex items-center gap-2.5 pl-9 pr-3 py-1.5 border-b border-line text-meta font-mono text-ink cursor-pointer" data-testid={`sandbox-site-${h}`}>+ <input type="checkbox" checked={on.has(h)} onChange={() => flip([h], !on.has(h))} />+ {bare(h)}+ {g.group === "added" ? (+ <button+ type="button"+ className="ml-auto font-sans text-muted hover:text-ink"+ onClick={(e) => {+ e.preventDefault();+ setAdded(added.filter((x) => x !== h));+ flip([h], false);+ }}+ >+ {t("settingsx.sandbox.remove")}+ </button>+ ) : null}+ </label>+ ))}</div>- ))}- </div>- ) : null}- <div className="flex gap-2 mb-1">+ );+ })}+ </div>+ <div className="flex gap-2 mt-2.5"><inputclassName={INPUT + " font-mono" + (bad ? " border-danger" : "")}value={draft}- placeholder={t("settingsx.sandbox.hosts_placeholder")}+ placeholder={t("settingsx.sandbox.sites_placeholder")}onChange={(e) => {setDraft(e.target.value);setBad(false);@@ -908,29 +951,23 @@ function HostsDialog({onKeyDown={(e) => {if (e.key === "Enter") add();}}- data-testid="sandbox-host-input"+ data-testid="sandbox-site-input"/>- <button className={BTN_BORDERED} onClick={add} disabled={!draft.trim()} data-testid="sandbox-host-add">+ <button className={BTN_BORDERED} onClick={add} disabled={!draft.trim()} data-testid="sandbox-site-add">{t("settingsx.sandbox.add_button")}</button></div>- {bad ? <div className="text-meta text-danger mb-1">{t("settingsx.sandbox.hosts_bad")}</div> : null}- {error ? <div className="text-meta text-danger mb-1">{error}</div> : null}- <div className="text-label font-medium text-faint mt-3.5 mb-1.5">{t("settingsx.sandbox.hosts_builtin")}</div>- <div className="rounded-lg border border-line divide-y divide-line">- {rows.map((r) => (- <div key={r.join()} className="px-3 py-1.5 text-meta font-mono text-muted">- {r.join(" · ")}- </div>- ))}- </div>+ {bad ? <div className="text-meta text-danger mt-1">{t("settingsx.sandbox.sites_bad")}</div> : null}+ {error ? <div className="text-meta text-danger mt-1">{error}</div> : null}<div className="flex items-center gap-2 mt-4">- <span className="text-meta text-faint max-w-[340px]">{t("settingsx.sandbox.hosts_note")}</span>+ <span className="text-meta text-faint" data-testid="sandbox-sites-total">+ {t("settingsx.sandbox.sites_total", { count: result.length })}+ </span><span className="flex-1" /><button className={BTN_BORDERED} onClick={onCancel}>{t("settingsx.sandbox.cancel")}</button>- <button className={BTN_ACCENT} onClick={() => onSave(list)} data-testid="sandbox-hosts-save">+ <button className={BTN_ACCENT} onClick={() => onSave(result)} data-testid="sandbox-sites-save">{t("settingsx.sandbox.save")}</button></div>@@ -955,10 +992,16 @@ export function cleanHost(text: string): string {return `${host}:${Number(port)}`;}-// OpenShell's setup (OPE-207, UX-053 v5): the steps first, then the job's rows with its-// progress. A command with Copy shows only where the app cannot do the step itself.+type RowState = "ok" | "bad" | "run" | "todo" | "wait";+type Row = SandboxReadinessStep & { state?: SandboxSetupRowState };++// OpenShell's setup (OPE-207, UX-053 v6): three rows that stay put from start to finish.+// Two are checks the user fixes (Docker running, OpenShell installed); the third is what+// the app does (the folder setting, the image download, choosing OpenShell), with the+// download's progress. The server's finer steps are folded into the third row.function OpenShellDialog({t,+ platform,readiness,job,ready,@@ -970,6 +1013,7 @@ function OpenShellDialog({copied,}: {t: T;+ platform: string;readiness: SandboxReadiness | null;job: SandboxSetupState | null;ready: boolean;@@ -980,28 +1024,55 @@ function OpenShellDialog({copy: (text: string) => void;copied: string;}) {- const rows: (SandboxReadinessStep & { state?: SandboxSetupRowState })[] = job && job.status !== "idle" ? job.rows : readiness?.steps ?? [];const running = job?.status === "running";- const done = job?.status === "done" || (ready && !job);- const needsYou = job?.status === "needs_you";- const stopped = job?.status === "failed" || job?.status === "cancelled";+ const rows: Row[] = job && job.status !== "idle" && job.rows.length ? job.rows : readiness?.steps ?? [];+ const byKey = (key: string) => rows.find((r) => r.key === key);+ const good = (r?: Row) => Boolean(r) && (r!.state ? r!.state === "ok" || r!.state === "fixed" : r!.ok);+ const docker = byKey("docker");+ const openshell = byKey("openshell");+ const rest = rows.filter((r) => r.key !== "docker" && r.key !== "openshell");+ const blocked = rest.find((r) => r.state === "needs_you" || r.state === "failed");+ const checksOk = good(docker) && good(openshell);+ const allOk = rows.length > 0 && rows.every((r) => good(r));+ const done = job?.status === "done" || (!job && ready && allOk);+ const mark = (r?: Row): RowState => (!r ? "wait" : good(r) ? "ok" : "bad");+ const third: RowState = done || (rows.length > 0 && rest.every((r) => good(r)) && checksOk) ? "ok" : blocked ? "bad" : running ? "run" : checksOk ? "todo" : "wait";const elapsed = (s: number) => (s >= 60 ? `${Math.floor(s / 60)} min ${s % 60} s` : `${s} s`);- const [title, intro] = done- ? [t("settingsx.sandbox.os_done_title"), t("settingsx.sandbox.os_done_intro")]- : running- ? [t("settingsx.sandbox.os_running_title"), t("settingsx.sandbox.os_running_intro")]- : needsYou- ? [t("settingsx.sandbox.os_needs_you_title"), t("settingsx.sandbox.os_needs_you_intro")]- : stopped- ? [t("settingsx.sandbox.os_stopped_title"), job?.status === "cancelled" ? t("settingsx.sandbox.setup_cancelled") : t("settingsx.sandbox.setup_failed", { error: job?.error })]- : [t("settingsx.sandbox.os_title"), t("settingsx.sandbox.os_intro")];+ const mac = platform === "darwin";+ const progress = running && job?.progress;+ const title = done ? t("settingsx.sandbox.os_done_title") : running ? t("settingsx.sandbox.os_running_title") : t("settingsx.sandbox.os_title");+ const intro = done ? t(mac ? "settingsx.sandbox.os_done_intro_mac" : "settingsx.sandbox.os_done_intro") : t("settingsx.sandbox.os_intro");+ const Mark = ({ state }: { state: RowState }) =>+ state === "ok" ? (+ <span className="w-[18px] h-[18px] rounded-full bg-ok text-white text-[11px] flex items-center justify-center shrink-0 mt-px">✓</span>+ ) : state === "bad" ? (+ <span className="w-[18px] h-[18px] rounded-full border border-warnInk/40 bg-warnSoft text-warnInk text-[11px] font-bold flex items-center justify-center shrink-0 mt-px">!</span>+ ) : state === "run" ? (+ <span className="w-[18px] h-[18px] rounded-full border-2 border-lineStrong border-t-accent animate-spin shrink-0 mt-px" />+ ) : (+ <span className="w-[18px] h-[18px] rounded-full border-[1.5px] border-lineStrong shrink-0 mt-px" />+ );+ const line = (key: string, state: RowState, text: string, detail?: React.ReactNode) => (+ <li className="flex items-start gap-3 px-3.5 py-3" data-testid={`sandbox-setup-row-${key}`} data-state={state}>+ <Mark state={state} />+ <span className="flex-1 min-w-0">+ <span className={"block text-ui " + (state === "wait" ? "text-faint" : "text-ink")}>{text}</span>+ {detail}+ </span>+ </li>+ );+ const link = (href: string, label: string, testid: string) => (+ <a className="text-accent" href={href} target="_blank" rel="noreferrer" data-testid={testid}>+ {label}+ </a>+ );+ const blockedCommand = blocked?.command;return (<Modal testid="sandbox-openshell-dialog"><h3 className="text-heading font-semibold mb-1.5">{title}</h3><p className="text-ui text-muted mb-3.5 leading-relaxed" data-testid={job && job.status !== "idle" ? `sandbox-setup-${job.status}` : undefined}>{intro}</p>- {!running && !done && !job ? <div className="text-label font-medium text-faint mb-1.5">{t("settingsx.sandbox.os_steps")}</div> : null}{!readiness && !job ? (<div className="rounded-lg border border-line bg-paper px-3 py-2.5 text-ui text-muted flex items-center gap-2.5"><span className="w-4 h-4 rounded-full border-2 border-lineStrong border-t-accent animate-spin shrink-0" />@@ -1009,58 +1080,61 @@ function OpenShellDialog({</div>) : (<ul className="rounded-lg border border-line divide-y divide-line" data-testid="sandbox-readiness">- {rows.map((r) => {- const state: SandboxSetupRowState = r.state ?? (r.ok ? "ok" : "pending");- const good = state === "ok" || state === "fixed";- const showCommand = !good && r.command && (!r.fixable || state === "needs_you" || state === "failed");- return (- <li key={r.key} className="px-3 py-2.5" data-testid={`sandbox-readiness-row-${r.key}`} data-state={state}>- <div className="flex items-start gap-2">- <span className={"shrink-0 w-4 " + (good ? "text-ok" : state === "fixing" ? "text-accent" : state === "pending" ? "text-faint" : "text-warnInk")} aria-hidden>- {good ? "✓" : state === "fixing" ? "⟳" : state === "pending" ? "○" : "!"}- </span>- <span className="flex-1 min-w-0 text-ui text-ink">{r.what}</span>- <span className="text-meta text-muted shrink-0">{t(`settingsx.sandbox.step_${!job && state === "pending" ? "todo" : state}`)}</span>- </div>- {r.key === "openshell" && running && state === "fixing" && job?.progress ? (- <div className="mt-1 ml-6 text-meta text-muted font-mono break-all" data-testid="sandbox-install-progress">- {t("settingsx.sandbox.install_progress", { elapsed: elapsed(job.progress.elapsed_s) })}- {job.progress.last_line ? ` · ${job.progress.last_line}` : ""}- </div>- ) : null}- {r.key === "image" && running && state === "fixing" && job?.progress ? (- <div className="mt-1.5 ml-6" data-testid="sandbox-download-progress">- <div className="h-1.5 rounded bg-line overflow-hidden">- <div className="h-full bg-accent transition-all" style={{ width: job.progress.layers_total ? `${Math.round((100 * job.progress.layers_done) / job.progress.layers_total)}%` : "5%" }} />- </div>- <div className="text-meta text-muted mt-1">- {job.progress.layers_total- ? t("settingsx.sandbox.download_progress", { done: job.progress.layers_done, total: job.progress.layers_total, elapsed: elapsed(job.progress.elapsed_s) })- : t("settingsx.sandbox.download_progress_unknown", { elapsed: elapsed(job.progress.elapsed_s) })}- </div>- </div>- ) : null}- {!good && r.hint ? <div className="mt-1 ml-6 text-meta text-muted">{r.hint}</div> : null}- {showCommand ? (- <div className="mt-1.5 ml-6 flex items-start gap-2 rounded-lg border border-line bg-paper px-2.5 py-1.5" data-testid={`sandbox-readiness-command-${r.key}`}>- <code className="text-meta font-mono text-ink break-all flex-1 min-w-0">{r.command}</code>- <button className="text-meta text-accent shrink-0" onClick={() => copy(r.command)}>- {copied === r.command ? t("settingsx.sandbox.copied") : t("settingsx.sandbox.copy")}+ {line(+ "docker",+ mark(docker),+ t(mac ? "settingsx.sandbox.os_row_docker_mac" : "settingsx.sandbox.os_row_docker"),+ docker && !good(docker) ? (+ <span className="block text-meta text-muted mt-0.5">+ {t(mac ? "settingsx.sandbox.os_docker_fix_mac" : "settingsx.sandbox.os_docker_fix")}{" "}+ {docker.docs ? link(docker.docs, t(mac ? "settingsx.sandbox.get_docker_mac" : "settingsx.sandbox.get_docker"), "sandbox-setup-docs-docker") : null}+ </span>+ ) : null,+ )}+ {line(+ "openshell",+ mark(openshell),+ t("settingsx.sandbox.os_row_openshell"),+ openshell && !good(openshell) ? (+ <span className="block text-meta text-muted mt-0.5">+ {openshell.hint ? openshell.hint + ". " : ""}+ {t("settingsx.sandbox.os_openshell_fix")}{" "}+ {openshell.docs ? link(openshell.docs, t("settingsx.sandbox.os_openshell_guide"), "sandbox-setup-docs-openshell") : null}+ </span>+ ) : null,+ )}+ {line(+ "setup",+ third,+ t("settingsx.sandbox.os_row_setup"),+ third === "bad" && blocked ? (+ <span className="block mt-0.5">+ <span className="block text-meta text-muted">{blocked.hint || blocked.what}</span>+ {blockedCommand ? (+ <span className="mt-1.5 flex items-start gap-2 rounded-lg border border-line bg-paper px-2.5 py-1.5" data-testid="sandbox-setup-command">+ <code className="text-meta font-mono text-ink break-all flex-1 min-w-0">{blockedCommand}</code>+ <button className="text-meta text-accent shrink-0" onClick={() => copy(blockedCommand)}>+ {copied === blockedCommand ? t("settingsx.sandbox.copied") : t("settingsx.sandbox.copy")}</button>- </div>- ) : null}- {!good && r.docs ? (- <a className="mt-1 ml-6 inline-block text-meta text-accent" href={r.docs} target="_blank" rel="noreferrer" data-testid={`sandbox-readiness-docs-${r.key}`}>- {r.key === "docker" ? t("settingsx.sandbox.get_docker") : t("settingsx.sandbox.guide")}- </a>+ </span>) : null}- </li>- );- })}+ </span>+ ) : progress && progress.layers_total ? (+ <span className="block mt-0.5" data-testid="sandbox-download-progress">+ <span className="block text-meta text-muted">+ {t("settingsx.sandbox.download_progress", { done: progress.layers_done, total: progress.layers_total, elapsed: elapsed(progress.elapsed_s) })}+ </span>+ <span className="block h-1.5 rounded bg-line overflow-hidden mt-2">+ <span className="block h-full bg-accent transition-all" style={{ width: `${Math.round((100 * progress.layers_done) / progress.layers_total)}%` }} />+ </span>+ </span>+ ) : third === "ok" ? null : (+ <span className="block text-meta text-muted mt-0.5">{t("settingsx.sandbox.os_row_setup_desc")}</span>+ ),+ )}</ul>)}<div className="flex items-center gap-2 mt-4">- <span className="text-meta text-faint max-w-[340px] leading-relaxed">{done ? "" : running ? t("settingsx.sandbox.os_close_note") : t("settingsx.sandbox.setup_never_root")}</span><span className="flex-1" />{done ? (<button className={BTN_ACCENT} onClick={onClose} data-testid="sandbox-openshell-done">@@ -1069,25 +1143,26 @@ function OpenShellDialog({) : running ? (<><button className={BTN_BORDERED} onClick={onCancel} data-testid="sandbox-setup-cancel">- {t("settingsx.sandbox.setup_cancel")}+ {t("settingsx.sandbox.os_cancel_setup")}</button>- <button className={BTN_ACCENT} onClick={onClose}>- {t("settingsx.sandbox.close")}+ <button className={BTN_BORDERED} onClick={onClose} data-testid="sandbox-openshell-hide">+ {t("settingsx.sandbox.os_hide")}</button></>) : (<><button className={BTN_BORDERED} onClick={onClose} data-testid="sandbox-openshell-close">- {job ? t("settingsx.sandbox.close") : t("settingsx.sandbox.cancel")}+ {t("settingsx.sandbox.cancel")}</button>- {job ? (- <button className={BTN_BORDERED} onClick={onCheck} data-testid="sandbox-setup-check">+ {checksOk && third !== "bad" ? (+ <button className={BTN_ACCENT} onClick={onStart} data-testid="sandbox-setup-start">+ {t("settingsx.sandbox.set_up")}+ </button>+ ) : (+ <button className={BTN_BORDERED} onClick={onCheck} disabled={!readiness && !job} data-testid="sandbox-setup-check">{t("settingsx.sandbox.setup_again")}</button>- ) : null}- <button className={BTN_ACCENT} onClick={onStart} disabled={!rows.length} data-testid="sandbox-setup-start">- {job ? t("settingsx.sandbox.try_again") : t("settingsx.sandbox.set_up")}- </button>+ )}</>)}</div>diff --git a/surfaces/gui/src/components/SettingsView.sandbox.test.tsx b/surfaces/gui/src/components/SettingsView.sandbox.test.tsxindex cbadd7ba..a0759ee6 100644--- a/surfaces/gui/src/components/SettingsView.sandbox.test.tsx+++ b/surfaces/gui/src/components/SettingsView.sandbox.test.tsx@@ -1,9 +1,9 @@-// Settings ▸ Sandbox (UX-051 A, UX-053 v5, OPE-207): one switch first; on reveals the type;+// Settings ▸ Sandbox (UX-051 A, UX-053 v5 and v6, OPE-207): one switch first; on reveals the type;// a chosen type reveals its options. The page shows what the machine reports and writes back-// the changes: provider, network profile and the machine's own hosts, the credential list,+// the changes: provider, network profile and the machine's ticked sites, the credential list,// the toolchain list. A type that is not set up looks disabled with one "Set up" button: on// Windows it opens the setup dialog, which calls the Windows setup route; for OpenShell it-// opens the dialog with the readiness checklist and the guided setup job.+// opens three rows: Docker running, OpenShell installed, and the app's own setup job.import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";@@ -18,12 +18,14 @@ const base = {{ name: "openshell", usable: false, why: "OpenShell is not installed" },],windows_setup: null as any,- network_profile: "standard",- network_profiles: [- { name: "standard", hosts: ["github.com", "pypi.org", "api.tavily.com"] },- { name: "open", hosts: [] },+ network_profile: "allowlist",+ network_profiles: [{ name: "allowlist" }, { name: "open" }],+ network_sites: [+ { group: "code-hosts", hosts: ["github.com:443", "gitlab.com:443"] },+ { group: "package-registries", hosts: ["pypi.org:443", "registry.npmjs.org:443"] },+ { group: "search-apis", hosts: ["api.tavily.com:443"] },],- network_extra_hosts: [] as string[],+ network_hosts: [] as string[],credentials: [{ name: "ssh", path: "~/.ssh", hosts: ["github.com:22"], label: "credential", enabled: true, kind: "folder", shipped: true },{ name: "aws", path: "~/.aws/config", hosts: ["*.amazonaws.com:443"], label: "configuration", enabled: true, kind: "file", shipped: true },@@ -53,6 +55,7 @@ const readiness = {{ key: "image", what: "the sandbox base image is downloaded (about 5 GB, one time)", ok: false, hint: "", fixable: true, command: "docker pull img", docs: "" },],};+let readinessNow: any = readiness;let setupState: any = { status: "idle", rows: [], progress: null, error: "", elapsed_s: 0 };// Like the backend: a provider change names the sessions it dropped for a rebuild.@@ -70,7 +73,7 @@ vi.mock("../api", async (importOriginal) => {setSandboxSettings: (patch: any) => setSandboxSettings(patch),runSandboxSetup: () => runSandboxSetup(),runSandboxRemove: () => runSandboxRemove(),- getSandboxReadiness: vi.fn(async () => readiness),+ getSandboxReadiness: vi.fn(async () => readinessNow),getSandboxSetup: vi.fn(async () => setupState),startSandboxSetup: () => startSandboxSetup(),cancelSandboxSetup: vi.fn(async () => setupState),@@ -103,6 +106,7 @@ describe("Settings ▸ Sandbox", () => {startSandboxSetup.mockClear();onSandboxProviderChanged.mockClear();setupState = { status: "idle", rows: [], progress: null, error: "", elapsed_s: 0 };+ readinessNow = readiness;});afterEach(cleanup);@@ -120,14 +124,14 @@ describe("Settings ▸ Sandbox", () => {expect((screen.getByTestId("sandbox-provider-openshell") as HTMLInputElement).disabled).toBe(true);expect(screen.getByTestId("sandbox-setup-openshell").textContent).toBe("Set up");expect(screen.queryByTestId("sandbox-provider-openshell-why")).toBeNull(); // the button says it all- expect(screen.queryByTestId("sandbox-network-standard")).toBeNull(); // no type is chosen yet+ expect(screen.queryByTestId("sandbox-network-allowlist")).toBeNull(); // no type is chosen yetexpect(setSandboxSettings).not.toHaveBeenCalled();fireEvent.click(screen.getByTestId("sandbox-provider-seatbelt"));await waitFor(() => expect(setSandboxSettings).toHaveBeenCalledWith({ provider: "seatbelt" }));await waitFor(() => expect(onSandboxProviderChanged).toHaveBeenCalledWith(["s-open"])); // live sessions rebuilt under the new rule});- it("OpenShell's Set up opens its dialog: the steps first, the handover command with Copy, then the job", async () => {+ it("OpenShell's Set up: three rows; a failed check says what to do; the app never installs it", async () => {snapshot = {...base,platform: "linux",@@ -142,26 +146,37 @@ describe("Settings ▸ Sandbox", () => {expect(screen.getByText("One Linux container per agent. Needs Docker.")).toBeTruthy();fireEvent.click(screen.getByTestId("sandbox-setup-openshell"));const dialog = await screen.findByTestId("sandbox-openshell-dialog");- await within(dialog).findByTestId("sandbox-readiness-row-openshell");+ await within(dialog).findByTestId("sandbox-setup-row-openshell");expect(within(dialog).getByText("Set up OpenShell")).toBeTruthy();- expect(screen.getByTestId("sandbox-readiness-row-docker").getAttribute("data-state")).toBe("ok");- expect(screen.getByTestId("sandbox-readiness-row-openshell").getAttribute("data-state")).toBe("pending");- expect(within(screen.getByTestId("sandbox-readiness-row-image")).getByText("to do")).toBeTruthy();- // Only the handed-over row shows its command with Copy; the image row is the app's to- // do, and a note (the gateway row) gets neither.- expect(within(dialog).getByText("curl -LsSf https://example/install.sh | sh")).toBeTruthy();- expect(within(dialog).getAllByText("Copy").length).toBe(1);- expect(screen.queryByTestId("sandbox-readiness-command-gateway")).toBeNull();- expect((screen.getByTestId("sandbox-readiness-docs-openshell") as HTMLAnchorElement).href).toBe("https://example/guide");- expect(screen.queryByTestId("sandbox-readiness")).toBeTruthy();- fireEvent.click(screen.getByTestId("sandbox-setup-start"));- await waitFor(() => expect(startSandboxSetup).toHaveBeenCalled());+ expect(dialog.querySelectorAll("li").length).toBe(3); // the server's finer steps fold into the third row+ expect(screen.getByTestId("sandbox-setup-row-docker").getAttribute("data-state")).toBe("ok");+ expect(screen.getByTestId("sandbox-setup-row-openshell").getAttribute("data-state")).toBe("bad");+ expect(within(screen.getByTestId("sandbox-setup-row-openshell")).getByText(/Install OpenShell 0\.0\.116, then check again/)).toBeTruthy();+ expect((screen.getByTestId("sandbox-setup-docs-openshell") as HTMLAnchorElement).href).toBe("https://example/guide");+ expect(screen.getByTestId("sandbox-setup-row-setup").getAttribute("data-state")).toBe("wait");+ expect(within(dialog).queryByText(/curl/)).toBeNull(); // no installer command+ expect(within(dialog).queryByText("to do")).toBeNull();+ expect(screen.queryByTestId("sandbox-setup-start")).toBeNull(); // a check failed: Check again, not Set up+ fireEvent.click(screen.getByTestId("sandbox-setup-check"));fireEvent.click(screen.getByTestId("sandbox-openshell-close"));expect(screen.queryByTestId("sandbox-openshell-dialog")).toBeNull();});- it("OpenShell: a running job shows progress in the dialog; needs_you offers Check again and Try again", async () => {- snapshot = { ...base, platform: "linux", providers: [{ name: "direct", usable: true, why: "", state: "ready" }, { name: "openshell", usable: false, why: "", state: "needs_download" }] };+ it("OpenShell: both checks pass, Set up runs; the rows stay and the third shows the download", async () => {+ snapshot = { ...base, platform: "darwin", providers: [{ name: "direct", usable: true, why: "" }, { name: "seatbelt", usable: true, why: "" }, { name: "openshell", usable: false, why: "", state: "needs_download" }] };+ readinessNow = { ...readiness, steps: [{ ...readiness.steps[0], ok: true }, { ...readiness.steps[1], ok: true }, { ...readiness.steps[2], ok: true }, readiness.steps[3]] };+ render(<SettingsView initialTab="sandbox" />);+ await screen.findByTestId("sandbox-section");+ fireEvent.click(masterSwitch());+ fireEvent.click(screen.getByTestId("sandbox-setup-openshell"));+ await screen.findByTestId("sandbox-setup-row-setup");+ expect(screen.getByText("Docker Desktop is running")).toBeTruthy();+ expect(screen.getByTestId("sandbox-setup-row-setup").getAttribute("data-state")).toBe("todo");+ expect(screen.getByText("Downloads the base image, about 5 GB, once.")).toBeTruthy();+ fireEvent.click(screen.getByTestId("sandbox-setup-start"));+ await waitFor(() => expect(startSandboxSetup).toHaveBeenCalled());+ cleanup();+setupState = {status: "running",rows: [@@ -181,34 +196,22 @@ describe("Settings ▸ Sandbox", () => {fireEvent.click(screen.getByTestId("sandbox-setup-openshell"));await screen.findByTestId("sandbox-download-progress");expect(screen.getByText("Setting up OpenShell")).toBeTruthy();+ expect(screen.getByTestId("sandbox-setup-row-docker").getAttribute("data-state")).toBe("ok");+ expect(screen.getByTestId("sandbox-setup-row-setup").getAttribute("data-state")).toBe("run");expect(screen.getByText("Downloading the base image: 3 of 8 layers, 1 min 15 s elapsed")).toBeTruthy();- expect(screen.getByTestId("sandbox-setup-cancel")).toBeTruthy();- expect(screen.getByTestId("sandbox-readiness-row-image").getAttribute("data-state")).toBe("fixing");+ expect(screen.getByTestId("sandbox-setup-cancel").textContent).toBe("Cancel setup");+ expect(screen.getByTestId("sandbox-openshell-hide").textContent).toBe("Hide");cleanup();- setupState = {- status: "needs_you",- rows: [- { ...readiness.steps[0], state: "ok" },- { ...readiness.steps[1], state: "needs_you" },- { ...readiness.steps[2], state: "pending" },- { ...readiness.steps[3], state: "pending" },- ],- progress: null,- error: "",- elapsed_s: 3,- };+ setupState = { ...setupState, status: "done", progress: null, rows: setupState.rows.map((r: any) => ({ ...r, ok: true, state: r.state === "fixing" ? "fixed" : r.state })) };render(<SettingsView initialTab="sandbox" />);await screen.findByTestId("sandbox-section");fireEvent.click(masterSwitch());await waitFor(() => expect(screen.getByTestId("sandbox-setup-openshell")).toBeTruthy());fireEvent.click(screen.getByTestId("sandbox-setup-openshell"));- await screen.findByTestId("sandbox-setup-needs_you");- expect(screen.getByText("One step needs you")).toBeTruthy();- expect(screen.getByTestId("sandbox-readiness-row-openshell").getAttribute("data-state")).toBe("needs_you");- expect(screen.getByTestId("sandbox-setup-check").textContent).toBe("Check again");- fireEvent.click(screen.getByTestId("sandbox-setup-start"));- await waitFor(() => expect(startSandboxSetup).toHaveBeenCalled());+ await screen.findByText("OpenShell is ready");+ expect(screen.getByTestId("sandbox-setup-row-setup").getAttribute("data-state")).toBe("ok");+ expect(screen.getByTestId("sandbox-openshell-done")).toBeTruthy();});it("OpenShell chosen with the base image missing: selected, with the hint and the Set up button", async () => {@@ -231,13 +234,14 @@ describe("Settings ▸ Sandbox", () => {expect(screen.getByTestId("sandbox-card-files")).toBeTruthy();});- it("a chosen type shows two network choices, Customize, and two closed panels; off writes direct", async () => {+ it("a chosen type shows two network choices and two closed panels; off writes direct", async () => {snapshot = chosenSeatbelt();render(<SettingsView initialTab="sandbox" />);await screen.findByTestId("sandbox-section");expect(document.querySelectorAll('input[name="sandbox-network"]').length).toBe(2);- expect((screen.getByTestId("sandbox-network-standard") as HTMLInputElement).checked).toBe(true);- expect(screen.getByText("Package registries and search")).toBeTruthy();+ expect((screen.getByTestId("sandbox-network-allowlist") as HTMLInputElement).checked).toBe(true);+ expect(screen.getByText("Only the sites you allow")).toBeTruthy();+ expect(screen.getByTestId("sandbox-network-allowlist-desc").textContent).toBe("None yet.Choose sites…");expect(screen.getByText("Allow everything").className).toContain("text-warnInk");fireEvent.click(screen.getByTestId("sandbox-network-open"));await waitFor(() => expect(setSandboxSettings).toHaveBeenCalledWith({ network_profile: "open" }));@@ -250,25 +254,34 @@ describe("Settings ▸ Sandbox", () => {await waitFor(() => expect(setSandboxSettings).toHaveBeenLastCalledWith({ provider: "direct" }));});- it("Customize: add a host, refuse a bad one, remove one, save the machine's list", async () => {- snapshot = { ...chosenSeatbelt(), network_extra_hosts: ["sentry.io:443"] };+ it("Allowed sites: nothing ticked; tick a group and a site, add one, refuse a bad one, save the ticked", async () => {+ snapshot = { ...chosenSeatbelt(), network_hosts: ["sentry.io:443"] };render(<SettingsView initialTab="sandbox" />);await screen.findByTestId("sandbox-section");- expect(screen.getByText(/1 added/)).toBeTruthy();- fireEvent.click(screen.getByTestId("sandbox-network-customize"));- const dialog = screen.getByTestId("sandbox-hosts-dialog");- expect(within(dialog).getByText(/github\.com · pypi\.org · api\.tavily\.com/)).toBeTruthy(); // the shipped list, read-only- const input = screen.getByTestId("sandbox-host-input");- fireEvent.change(input, { target: { value: "not a host" } });- fireEvent.click(screen.getByTestId("sandbox-host-add"));- expect(within(dialog).getByText(/That is not a host name/)).toBeTruthy();+ expect(screen.getByTestId("sandbox-network-allowlist-desc").textContent).toBe("sentry.io.Choose sites…");+ fireEvent.click(screen.getByTestId("sandbox-network-sites"));+ const dialog = screen.getByTestId("sandbox-sites-dialog");+ expect(within(dialog).getByText("Allowed sites")).toBeTruthy();+ expect(within(dialog).getByText("Agents can reach only the sites you tick. Applies to new sessions.")).toBeTruthy();+ expect(within(screen.getByTestId("sandbox-sites-group-added")).getByText("sentry.io")).toBeTruthy(); // a site the user added earlier+ const box = (host: string) => within(screen.getByTestId(`sandbox-site-${host}`)).getByRole("checkbox") as HTMLInputElement;+ expect(box("github.com:443").checked).toBe(false); // nothing from the catalogue is ticked+ fireEvent.click(screen.getByTestId("sandbox-sites-group-code-hosts-box"));+ expect(box("github.com:443").checked && box("gitlab.com:443").checked).toBe(true);+ fireEvent.click(box("pypi.org:443"));+ expect((screen.getByTestId("sandbox-sites-group-package-registries-box") as HTMLInputElement).indeterminate).toBe(true);+ const input = screen.getByTestId("sandbox-site-input");+ fireEvent.change(input, { target: { value: "not a site" } });+ fireEvent.click(screen.getByTestId("sandbox-site-add"));+ expect(within(dialog).getByText(/That is not a site name/)).toBeTruthy();fireEvent.change(input, { target: { value: "Registry.Acme.dev" } });fireEvent.keyDown(input, { key: "Enter" });- expect(screen.getByTestId("sandbox-host-registry.acme.dev:443")).toBeTruthy();- fireEvent.click(within(screen.getByTestId("sandbox-host-sentry.io:443")).getByText("Remove"));- fireEvent.click(screen.getByTestId("sandbox-hosts-save"));- await waitFor(() => expect(setSandboxSettings).toHaveBeenLastCalledWith({ network_extra_hosts: ["registry.acme.dev:443"] }));- await waitFor(() => expect(screen.queryByTestId("sandbox-hosts-dialog")).toBeNull());+ expect(box("registry.acme.dev:443").checked).toBe(true);+ fireEvent.click(within(screen.getByTestId("sandbox-site-sentry.io:443")).getByText("Remove"));+ expect(screen.getByTestId("sandbox-sites-total").textContent).toBe("4 allowed");+ fireEvent.click(screen.getByTestId("sandbox-sites-save"));+ await waitFor(() => expect(setSandboxSettings).toHaveBeenLastCalledWith({ network_hosts: ["github.com:443", "gitlab.com:443", "pypi.org:443", "registry.acme.dev:443"] }));+ await waitFor(() => expect(screen.queryByTestId("sandbox-sites-dialog")).toBeNull());});it("the files panel lists only added entries: switch, tags, remove; Add… offers a CLI's login or a file", async () => {diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.jsonindex 14bbcaa0..faa2e9ec 100644--- a/surfaces/gui/src/locales/en.json+++ b/surfaces/gui/src/locales/en.json@@ -2287,8 +2287,6 @@"remove_setup": "Remove setup…","refused": "Sessions on this machine are refused until this is fixed: {{why}}","network": "Network",- "profile_standard": "Package registries and search",- "profile_standard_desc": "GitHub, GitLab, PyPI, npm, crates, Go and the search APIs.","profile_open": "Allow everything","profile_open_desc": "Any site. Your files stay private.","files_foot": "Copies are deleted when the session ends.",@@ -2362,13 +2360,7 @@"saved_in": "Saved in {{path}}","readiness_loading": "Checking this machine…","setup_again": "Check again",- "setup_cancel": "Cancel","setup_running": "Setting up…",- "setup_failed": "Setup stopped: {{error}}",- "setup_cancelled": "Setup cancelled.",- "setup_never_root": "The app does each step itself where it can. A step that needs an administrator goes through the system's own password prompt; where there is none (WSL), it is shown as one command for you to run. The app never sees or stores your password, and never turns the sandbox off on its own.",- "guide": "Guide",- "install_progress": "Installing OpenShell… {{elapsed}} elapsed","step_pending": "waiting","step_fixing": "working…","step_fixed": "done",@@ -2376,7 +2368,6 @@"step_needs_you": "needs you","step_failed": "failed","download_progress": "Downloading the base image: {{done}} of {{total}} layers, {{elapsed}} elapsed",- "download_progress_unknown": "Downloading the base image… {{elapsed}} elapsed","copy": "Copy","copied": "Copied","notify_title": "Sandbox ready",@@ -2396,7 +2387,6 @@"cli_intro": "A copy goes into each sandbox for the session, and the agent is told what it can do with it.","cli_not_listed": "Not listed? Add it as a file or folder.","cli_title": "Add a CLI's login",- "customize": "Customize…","does_aws-credentials": "Your access keys.","does_docker": "Push and pull images with the logins in this file.","does_gcloud": "Your Google Cloud accounts and projects.",@@ -2411,29 +2401,15 @@"files_sum": "{{list}}. Copies are deleted when the session ends.","files_sum_none": "Nothing is copied into sandboxes.","get_docker": "Get Docker",- "hosts_added": "{{count}} added",- "hosts_bad": "That is not a host name. For example: api.example.com:443",- "hosts_builtin": "Always allowed with this choice",- "hosts_intro": "Everything else is blocked. Changes apply to new sessions.",- "hosts_note": "Hosts a CLI's login needs come with it and are not listed here.",- "hosts_placeholder": "host:port, for example api.example.com:443",- "hosts_title": "Hosts agents may reach",- "hosts_yours": "Added by you","list_and": "{{list}} and {{last}}","list_more": "{{list}} and {{count}} more","not_found": "not found","not_on_mac": "not on this Mac","not_on_pc": "not on this PC",- "os_close_note": "You can close this dialog. Setup continues, and this page shows when it is ready.",- "os_done_intro": "New sessions on this machine run their commands in an OpenShell container. The network choice and the files you add apply inside it.",+ "os_done_intro": "New sessions on this machine run their commands in an OpenShell container.","os_done_title": "OpenShell is ready","os_intro": "Each agent will run in its own Linux container that holds only the session's folders.",- "os_needs_you_intro": "Run the command below in a terminal on this machine, then check again.",- "os_needs_you_title": "One step needs you",- "os_running_intro": "Each step runs on this machine.","os_running_title": "Setting up OpenShell",- "os_steps": "What setup does",- "os_stopped_title": "Setup stopped","os_title": "Set up OpenShell","provider_openshell_desc_mac": "One Linux container per agent. Needs Docker Desktop.","save": "Save",@@ -2447,7 +2423,34 @@"tools_foot": "Agents can run these but not change them. The rest of your home folder stays private.","tools_panel": "Tools shown to Agent with read-only access","tools_sum": "{{list}}. Agents can run them, not change them.",- "tools_sum_none": "None. Agents see no tools from your home folder."+ "tools_sum_none": "None. Agents see no tools from your home folder.",+ "choose_sites": "Choose sites…",+ "get_docker_mac": "Get Docker Desktop",+ "os_cancel_setup": "Cancel setup",+ "os_docker_fix": "Start Docker, then check again. Not installed?",+ "os_docker_fix_mac": "Start Docker Desktop, then check again. Not installed?",+ "os_done_intro_mac": "New sessions on this Mac run their commands in an OpenShell container.",+ "os_hide": "Hide",+ "os_openshell_fix": "Install OpenShell 0.0.116, then check again.",+ "os_openshell_guide": "How to install OpenShell",+ "os_row_docker": "Docker is running",+ "os_row_docker_mac": "Docker Desktop is running",+ "os_row_openshell": "OpenShell is installed",+ "os_row_setup": "Set up OpenShell for OpenWorker",+ "os_row_setup_desc": "Downloads the base image, about 5 GB, once.",+ "profile_allowlist": "Only the sites you allow",+ "site_group_added": "Added by you",+ "site_group_code-hosts": "Code hosting",+ "site_group_package-registries": "Package registries",+ "site_group_search-apis": "Search",+ "sites_bad": "That is not a site name. For example: api.example.com",+ "sites_count": "{{on}} of {{total}}",+ "sites_intro": "Agents can reach only the sites you tick. Applies to new sessions.",+ "sites_none": "None yet.",+ "sites_placeholder": "A site, for example api.example.com",+ "sites_sum": "{{list}}.",+ "sites_title": "Allowed sites",+ "sites_total": "{{count}} allowed"}},"misc": {diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.jsonindex d20db0f9..1a8d5c1b 100644--- a/surfaces/gui/src/locales/zh.json+++ b/surfaces/gui/src/locales/zh.json@@ -2247,8 +2247,6 @@"remove_setup": "移除设置…","refused": "在修复此问题前,这台机器上的会话将被拒绝:{{why}}","network": "网络",- "profile_standard": "软件包仓库和搜索",- "profile_standard_desc": "GitHub、GitLab、PyPI、npm、crates、Go 和搜索 API。","profile_open": "允许所有网站","profile_open_desc": "任何网站。你的文件仍然私密。","files_foot": "副本会在会话结束时删除。",@@ -2322,13 +2320,7 @@"saved_in": "保存在 {{path}}","readiness_loading": "正在检查这台机器…","setup_again": "重新检查",- "setup_cancel": "取消","setup_running": "正在设置…",- "setup_failed": "设置已停止:{{error}}",- "setup_cancelled": "设置已取消。",- "setup_never_root": "应用会尽量自行完成每一步。需要管理员权限的步骤通过系统自带的密码提示完成;没有该提示的环境(WSL)会显示一条命令由你运行。应用绝不会看到或保存你的密码,也绝不会自行关闭沙箱。",- "guide": "指南",- "install_progress": "正在安装 OpenShell… 已用 {{elapsed}}","step_pending": "等待中","step_fixing": "处理中…","step_fixed": "已完成",@@ -2336,7 +2328,6 @@"step_needs_you": "需要你","step_failed": "失败","download_progress": "正在下载基础镜像:{{total}} 层中已完成 {{done}} 层,已用时 {{elapsed}}",- "download_progress_unknown": "正在下载基础镜像… 已用时 {{elapsed}}","copy": "复制","copied": "已复制","notify_title": "沙箱已就绪",@@ -2356,7 +2347,6 @@"cli_intro": "每个沙箱在会话期间获得一份副本,并告知同事可以用它做什么。","cli_not_listed": "没有列出?请作为文件或文件夹添加。","cli_title": "添加 CLI 的登录",- "customize": "自定义…","does_aws-credentials": "你的访问密钥。","does_docker": "使用此文件中的登录推送和拉取镜像。","does_gcloud": "你的 Google Cloud 账号和项目。",@@ -2371,29 +2361,15 @@"files_sum": "{{list}}。副本会在会话结束时删除。","files_sum_none": "不会向沙箱复制任何内容。","get_docker": "获取 Docker",- "hosts_added": "已添加 {{count}} 个",- "hosts_bad": "这不是有效的主机名。例如:api.example.com:443",- "hosts_builtin": "此选项始终允许",- "hosts_intro": "其他主机一律拦截。更改对新会话生效。",- "hosts_note": "CLI 登录所需的主机会随之一起允许,不在此列出。",- "hosts_placeholder": "主机:端口,例如 api.example.com:443",- "hosts_title": "同事可以访问的主机",- "hosts_yours": "你添加的","list_and": "{{list}}和{{last}}","list_more": "{{list}}等另外 {{count}} 项","not_found": "未找到","not_on_mac": "这台 Mac 上没有","not_on_pc": "这台 PC 上没有",- "os_close_note": "你可以关闭此对话框。设置会继续进行,完成后此页面会显示。",- "os_done_intro": "这台机器上的新会话会在 OpenShell 容器中运行命令。网络选项和你添加的文件在容器内生效。",+ "os_done_intro": "这台机器上的新会话会在 OpenShell 容器中运行命令。","os_done_title": "OpenShell 已就绪","os_intro": "每个同事将在自己的 Linux 容器中运行,容器中只有该会话的文件夹。",- "os_needs_you_intro": "请在这台机器的终端中运行下面的命令,然后重新检查。",- "os_needs_you_title": "有一步需要你操作",- "os_running_intro": "每一步都在这台机器上运行。","os_running_title": "正在设置 OpenShell",- "os_steps": "设置会做什么",- "os_stopped_title": "设置已停止","os_title": "设置 OpenShell","provider_openshell_desc_mac": "每个同事一个 Linux 容器。需要 Docker Desktop。","save": "保存",@@ -2407,7 +2383,34 @@"tools_foot": "同事可以运行这些工具,但不能修改。主目录的其他内容保持私密。","tools_panel": "以只读方式提供给同事的工具","tools_sum": "{{list}}。同事可以运行它们,但不能修改。",- "tools_sum_none": "无。同事看不到你主目录中的任何工具。"+ "tools_sum_none": "无。同事看不到你主目录中的任何工具。",+ "choose_sites": "选择网站…",+ "get_docker_mac": "获取 Docker Desktop",+ "os_cancel_setup": "取消设置",+ "os_docker_fix": "请启动 Docker,然后重新检查。尚未安装?",+ "os_docker_fix_mac": "请启动 Docker Desktop,然后重新检查。尚未安装?",+ "os_done_intro_mac": "这台 Mac 上的新会话会在 OpenShell 容器中运行命令。",+ "os_hide": "隐藏",+ "os_openshell_fix": "请安装 OpenShell 0.0.116,然后重新检查。",+ "os_openshell_guide": "如何安装 OpenShell",+ "os_row_docker": "Docker 正在运行",+ "os_row_docker_mac": "Docker Desktop 正在运行",+ "os_row_openshell": "OpenShell 已安装",+ "os_row_setup": "为 OpenWorker 设置 OpenShell",+ "os_row_setup_desc": "下载基础镜像,约 5 GB,只需一次。",+ "profile_allowlist": "仅允许你选择的网站",+ "site_group_added": "你添加的",+ "site_group_code-hosts": "代码托管",+ "site_group_package-registries": "软件包仓库",+ "site_group_search-apis": "搜索",+ "sites_bad": "这不是有效的网站名。例如:api.example.com",+ "sites_count": "{{on}} / {{total}}",+ "sites_intro": "同事只能访问你勾选的网站。对新会话生效。",+ "sites_none": "尚未选择。",+ "sites_placeholder": "网站,例如 api.example.com",+ "sites_sum": "{{list}}。",+ "sites_title": "允许的网站",+ "sites_total": "已允许 {{count}} 个"}},"misc": {diff --git a/tests/test_sandbox_credentials.py b/tests/test_sandbox_credentials.pyindex 8e393dea..768a2136 100644--- a/tests/test_sandbox_credentials.py+++ b/tests/test_sandbox_credentials.py@@ -148,9 +148,9 @@ def test_no_grants_means_no_lines_for_the_agent(tmp_path):# -- the network ------------------------------------------------------------------------def test_proxy_allows_the_grants_hosts_including_ssh_and_wildcards():- proxy = netproxy.AllowListProxy("strict", extra_hosts=["github.com:22", "*.amazonaws.com:443", "k8s.example.com:6443"])+ proxy = netproxy.AllowListProxy("allowlist", extra_hosts=["github.com:22", "*.amazonaws.com:443", "k8s.example.com:6443"])try:- assert proxy.allows("github.com", 22) and proxy.allows("github.com", 443)+ assert proxy.allows("github.com", 22) and not proxy.allows("github.com", 443) # only what is listedassert proxy.allows("s3.us-east-1.amazonaws.com", 443) and not proxy.allows("amazonaws.com", 443)assert proxy.allows("k8s.example.com", 6443) and not proxy.allows("k8s.example.com", 443)assert not proxy.allows("gitlab.com", 22) and not proxy.allows("example.com", 443)diff --git a/tests/test_sandbox_openshell.py b/tests/test_sandbox_openshell.pyindex 11c0cea1..78228d6a 100644--- a/tests/test_sandbox_openshell.py+++ b/tests/test_sandbox_openshell.py@@ -44,13 +44,11 @@ def test_policy_is_plain_yaml_without_shared_objects():def test_network_profiles():- standard = policy.render(ROOTS, profile="standard")["network_policies"]- hosts = lambda p: {e["host"] for entry in p.values() for e in entry["endpoints"]} # noqa: E731- assert {"github.com", "pypi.org", "registry.npmjs.org", "api.tavily.com"} <= hosts(standard)- assert policy.render(ROOTS, profile="strict")["network_policies"] == standard # the old name- assert all(entry["binaries"] for entry in standard.values()) # OpenShell requires the field- added = policy.render(ROOTS, profile="standard", extra_hosts=["registry.acme.dev:443"])["network_policies"]- assert {"host": "registry.acme.dev", "port": 443} in added["credentials"]["endpoints"]+ # An allow list holds only the machine's ticked sites: none, nothing gets out.+ assert policy.render(ROOTS, profile="allowlist")["network_policies"] == {}+ ticked = policy.render(ROOTS, profile="allowlist", extra_hosts=["github.com:443", "registry.acme.dev:443"])["network_policies"]+ assert {"host": "registry.acme.dev", "port": 443} in ticked["credentials"]["endpoints"]+ assert all(entry["binaries"] for entry in ticked.values()) # OpenShell requires the fieldopened = policy.render(ROOTS, profile="open")["network_policies"]assert [e["host"] for e in opened["open"]["endpoints"]] == ["*"] # any host; unproved against a gatewaywith pytest.raises(ValueError):@@ -170,7 +168,7 @@ def test_registry_counts_caps_and_forgets(tmp_path, monkeypatch):from coworker.sandbox.registry import SandboxLimitReached, SandboxRegistryreg = SandboxRegistry(tmp_path / "registry.db")- reg.record("ow-a", provider="openshell", session_id="s1", agent="lead", roots=ROOTS, profile="strict", enforcement="full")+ reg.record("ow-a", provider="openshell", session_id="s1", agent="lead", roots=ROOTS, profile="allowlist", enforcement="full")reg.record("ow-b", provider="openshell", session_id="s1", agent="worker")assert reg.count() == 2 and reg.find("s1", "worker")["name"] == "ow-b"assert reg.list()[0]["roots"] == ROOTS and reg.list()[0]["machine_id"] == "local"@@ -208,7 +206,7 @@ def test_a_workspace_reserves_its_name_before_creating_the_sandbox(tmp_path):seen: dict = {}class Provider:- roots, profile = [{"path": str(tmp_path), "writable": True}], "strict"+ roots, profile = [{"path": str(tmp_path), "writable": True}], "allowlist"def describe(self):return {"provider": "openshell", "enforcement": "full", "sandbox": "ow-reserved"}@@ -300,7 +298,7 @@ def test_a_session_in_a_real_sandbox(folder):try:assert ws.describe()["enforcement"] == "full" and ws.describe()["runner"]["os"] == "Linux"row = ws.registry.find("s-test", "swe-lead")- assert row["name"] == ws.provider.sandbox_name and row["enforcement"] == "full" and row["profile"] == "strict"+ assert row["name"] == ws.provider.sandbox_name and row["enforcement"] == "full" and row["profile"] == "allowlist"ex = ws.executorassert ex.run("cat hello.txt && cd /tmp && export KEEP=yes")["exit_code"] == 0assert ex.run("echo $KEEP $PWD")["output"].split() == ["yes", "/tmp"] # one persistent shelldiff --git a/tests/test_sandbox_seatbelt.py b/tests/test_sandbox_seatbelt.pyindex 0eab6582..a72c1c83 100644--- a/tests/test_sandbox_seatbelt.py+++ b/tests/test_sandbox_seatbelt.py@@ -101,7 +101,7 @@ def _ask(proxy: netproxy.AllowListProxy, request: bytes) -> bytes:def test_proxy_refuses_hosts_that_are_not_listed_and_says_why():- proxy = netproxy.AllowListProxy("strict")+ proxy = netproxy.AllowListProxy("allowlist", extra_hosts=["github.com:443"])try:answer = _ask(proxy, b"CONNECT example.com:443 HTTP/1.1\r\nHost: example.com:443\r\n\r\n")assert answer.startswith(b"HTTP/1.1 403 ")@@ -136,7 +136,7 @@ def test_proxy_tunnels_a_listed_host(monkeypatch):return real_connect(address, *args, **kwargs)monkeypatch.setattr(netproxy.socket, "create_connection", fake_connect)- proxy = netproxy.AllowListProxy("strict")+ proxy = netproxy.AllowListProxy("allowlist", extra_hosts=["github.com:443"])try:with real_connect(("127.0.0.1", proxy.port), timeout=5) as s:s.sendall(b"CONNECT github.com:443 HTTP/1.1\r\nHost: github.com:443\r\n\r\n")@@ -150,11 +150,12 @@ def test_proxy_tunnels_a_listed_host(monkeypatch):upstream.close()-def test_every_profile_has_hosts_and_an_unknown_one_is_refused():- assert {"github.com", "pypi.org", "api.tavily.com"} <= set(network_profiles.hosts("standard"))- assert network_profiles.check("strict") == "standard" # folded in (UX-053 v5), the name still works- with pytest.raises(ValueError):- netproxy.AllowListProxy("wide-open")+def test_the_catalogue_offers_sites_and_an_unknown_profile_is_refused():+ assert network_profiles.hosts("allowlist") == [] # nothing until the machine ticks sites+ assert {"github.com", "pypi.org", "api.tavily.com"} <= {h for hosts in network_profiles.SITES.values() for h in hosts}+ for gone in ("strict", "standard", "wide-open"):+ with pytest.raises(ValueError):+ netproxy.AllowListProxy(gone)def test_a_machines_own_hosts_are_cleaned_and_join_the_list():@@ -166,7 +167,7 @@ def test_a_machines_own_hosts_are_cleaned_and_join_the_list():with pytest.raises(ValueError):clean(bad)assert network_profiles.clean_hosts(["a.dev", "A.dev:443", "nope"]) == ["a.dev:443"]- proxy = netproxy.AllowListProxy("standard", extra_hosts=["registry.acme.dev:443"])+ proxy = netproxy.AllowListProxy("allowlist", extra_hosts=["registry.acme.dev:443"])try:assert proxy.allows("registry.acme.dev", 443) and not proxy.allows("other.acme.dev", 443)finally:@@ -176,7 +177,7 @@ def test_a_machines_own_hosts_are_cleaned_and_join_the_list():def test_the_open_profile_has_no_list_and_is_the_default_on_windows_only(tmp_path):assert network_profiles.hosts("open") == [] and network_profiles.is_open("open")assert network_profiles.default_profile("win32") == "open"- assert network_profiles.default_profile("darwin") == "standard" and network_profiles.default_profile("linux") == "standard"+ assert network_profiles.default_profile("darwin") == "allowlist" and network_profiles.default_profile("linux") == "allowlist"# Seatbelt: the files stay confined, the network clause openstext = seatbelt_profile.render([{"path": str(tmp_path), "writable": True}], runtime_dir=str(tmp_path), open_network=True, home=str(tmp_path))assert "(allow network*)" in text and "localhost:" not in text and "(deny default)" in textdiff --git a/tests/test_sandbox_settings.py b/tests/test_sandbox_settings.pyindex 293ed22e..438a2d4b 100644--- a/tests/test_sandbox_settings.py+++ b/tests/test_sandbox_settings.py@@ -27,8 +27,10 @@ def test_snapshot_reports_the_default_rule_and_the_shipped_entries(config_file):assert next(p for p in snap["providers"] if p["name"] == "direct")["usable"]from coworker.sandbox import network_profiles- assert snap["network_profile"] == network_profiles.default_profile() # standard; `open` on Windows- assert [n["name"] for n in snap["network_profiles"]] == ["standard", "open"] and snap["network_extra_hosts"] == []+ assert snap["network_profile"] == network_profiles.default_profile() # allowlist; `open` on Windows+ assert [n["name"] for n in snap["network_profiles"]] == ["allowlist", "open"] and snap["network_hosts"] == [] # nothing ticked+ assert [g["group"] for g in snap["network_sites"]] == ["code-hosts", "package-registries", "search-apis"]+ assert "github.com:443" in snap["network_sites"][0]["hosts"]assert snap["credentials"] == [] # nothing is listed until added (UX-053 v5)from coworker.sandbox import credentials@@ -64,7 +66,7 @@ def test_toolchain_switches_and_additions_are_written_slim(config_file):def test_update_writes_only_what_differs_from_the_shipped_entries(config_file):out = settings.update({- "network_profile": "standard",+ "network_profile": "open","credentials": [{"name": "ssh", "enabled": True},{"name": "gh", "enabled": False},@@ -75,7 +77,7 @@ def test_update_writes_only_what_differs_from_the_shipped_entries(config_file):)assert out["ok"], outtext = config_file.read_text()- assert 'sandbox_network_profile = "standard"' in text+ assert 'sandbox_network_profile = "open"' in textassert text.count("[[sandbox_credentials]]") == 4 # gh is listed, switched off, by name onlyassert 'path = "~/.aws-work"' in text and 'hosts = ["registry.npmjs.org:443"]' not in text # npm's own hostssnap = settings.snapshot()@@ -88,20 +90,18 @@ def test_update_writes_only_what_differs_from_the_shipped_entries(config_file):assert [e["name"] for e in settings.snapshot()["credentials"]] == ["gh"] # removing is leaving it out-def test_network_choice_and_the_machines_own_hosts(config_file):- out = settings.update({"network_profile": "strict", "network_extra_hosts": ["Registry.Acme.dev", "sentry.io:443", "sentry.io"]})+def test_network_choice_and_the_machines_ticked_sites(config_file):+ out = settings.update({"network_profile": "allowlist", "network_hosts": ["GitHub.com", "registry.acme.dev:443", "github.com:443"]})assert out["ok"], out- assert out["network_profile"] == "standard" and out["network_extra_hosts"] == ["registry.acme.dev:443", "sentry.io:443"]+ assert out["network_profile"] == "allowlist" and out["network_hosts"] == ["github.com:443", "registry.acme.dev:443"]text = config_file.read_text()- assert 'sandbox_network_profile = "standard"' in text- assert 'sandbox_network_extra_hosts = ["registry.acme.dev:443", "sentry.io:443"]' in text- assert app_config.load_config().sandbox_network_extra_hosts == ["registry.acme.dev:443", "sentry.io:443"]- assert settings.update({"network_extra_hosts": ["not a host"]})["ok"] is False- assert settings.update({"network_extra_hosts": []})["network_extra_hosts"] == []- assert "sandbox_network_extra_hosts" not in config_file.read_text()- config_file.write_text('sandbox_network_profile = "strict"\n') # a machine set before v5- assert settings.snapshot()["network_profile"] == "standard"-+ assert 'sandbox_network_profile = "allowlist"' in text+ assert 'sandbox_network_hosts = ["github.com:443", "registry.acme.dev:443"]' in text+ assert app_config.load_config().sandbox_network_hosts == ["github.com:443", "registry.acme.dev:443"]+ assert settings.update({"network_hosts": ["not a host"]})["ok"] is False+ assert settings.update({"network_profile": "strict"})["ok"] is False # gone, not an alias+ assert settings.update({"network_hosts": []})["network_hosts"] == []+ assert "sandbox_network_hosts" not in config_file.read_text()def test_update_refuses_bad_input_without_writing(config_file):assert settings.update({"provider": "bwrap"})["ok"] is False@@ -255,5 +255,5 @@ def test_changing_the_provider_rebuilds_live_engines_built_under_the_old_rule(tmassert res["ok"] and res["rebuilt_sessions"] == ["boxed"] and closed[-1] == "Boxed"# A save that does not touch the provider rebuilds nothing.mgr._engines["d"] = Engine(Direct())- res = client.post("/v1/settings/sandbox", json={"network_profile": "strict"}).json()+ res = client.post("/v1/settings/sandbox", json={"network_profile": "open"}).json()assert res["ok"] and "rebuilt_sessions" not in res and "d" in mgr._enginesdiff --git a/tests/test_sandbox_setup_job.py b/tests/test_sandbox_setup_job.pyindex 23f414b0..c5eaceff 100644--- a/tests/test_sandbox_setup_job.py+++ b/tests/test_sandbox_setup_job.py@@ -40,8 +40,8 @@ def test_steps_carry_keys_and_say_which_the_app_may_fix(monkeypatch):monkeypatch.setattr(setup_cmd, "openshell_problem", lambda fresh=False: "OpenShell is not installed")rows = {s.key: s for s in setup_cmd.steps()}assert not rows["docker"].ok and not rows["docker"].fixable and rows["docker"].docs == setup_cmd.DOCKER_INSTALL_URL- # A Mac needs no administrator (Homebrew installs as the user): the app installs it.- assert not rows["openshell"].ok and rows["openshell"].fixable and rows["openshell"].command == ""+ # The user installs it; the row points at the guide.+ assert not rows["openshell"].ok and not rows["openshell"].fixable and rows["openshell"].command == ""assert rows["openshell"].docs == setup_cmd.GUIDE_URL and rows["openshell"].hint == ""assert rows["bind_mounts"].fixable and rows["config"].fixableassert "linger" not in rows and "landlock" not in rows # Linux-only rows@@ -66,32 +66,23 @@ def test_a_hung_check_counts_as_not_ok_instead_of_failing_the_checklist(monkeypaassert setup_cmd._run(["docker", "info"], 1).returncode == 124-def test_on_linux_the_install_is_the_apps_when_it_can_run_as_an_administrator(monkeypatch):+def test_the_app_never_installs_openshell_it_points_at_the_guide(monkeypatch):+ """UX-053 v6: the user installs Docker and OpenShell; the row links to NVIDIA's guide."""monkeypatch.setattr(setup_cmd.shutil, "which", lambda name: None)monkeypatch.setattr(setup_cmd.sys, "platform", "linux")monkeypatch.setattr(setup_cmd.getpass, "getuser", lambda: "sam")monkeypatch.setattr(setup_cmd, "openshell_problem", lambda fresh=False: "OpenShell is not installed")monkeypatch.setattr(setup_cmd, "landlock_available", lambda: True)monkeypatch.setattr(setup_cmd, "_run", lambda argv, timeout=600: type("Done", (), {"returncode": 1, "stdout": ""})()) # no loginctl here- # No way to run as an administrator without a password (WSL): ONE command handed over,- # linger first, because the installer needs the user's systemd manager.- monkeypatch.setattr(setup_cmd, "admin_prefix", lambda: None)+ monkeypatch.setattr(setup_cmd, "admin_prefix", lambda: ["sudo", "-n"]) # even where it couldrows = {s.key: s for s in setup_cmd.steps()}- assert not rows["openshell"].fixable- assert rows["openshell"].command == f"sudo loginctl enable-linger sam && {setup_cmd.installer_command()}"- assert rows["openshell"].command.startswith("sudo loginctl enable-linger sam && curl -LsSf https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh | OPENSHELL_VERSION=v")+ assert not rows["openshell"].fixable and rows["openshell"].command == "" and rows["openshell"].docs == setup_cmd.GUIDE_URLassert rows["linger"].fixable and rows["linger"].command == "sudo loginctl enable-linger sam"- assert rows["grpcio"].ok or rows["grpcio"].command.startswith("pip install")- # With one (sudo without a password, or the desktop's prompt): the app installs it.- monkeypatch.setattr(setup_cmd, "admin_prefix", lambda: ["sudo", "-n"])- rows = {s.key: s for s in setup_cmd.steps()}- assert rows["openshell"].fixable and rows["openshell"].command == ""- # Another version than the pinned one is said, as a note, not a command.+ # Another version than the pinned one is said, as a note.monkeypatch.setattr(setup_cmd.shutil, "which", lambda name: "/usr/bin/openshell" if name == "openshell" else None)monkeypatch.setattr(setup_cmd, "_run", lambda argv, timeout=600: type("Done", (), {"returncode": 0, "stdout": "openshell 0.0.1\n"})())rows = {s.key: s for s in setup_cmd.steps()}- assert rows["openshell"].hint == "found 0.0.1, not the tested release" and rows["openshell"].fixable-+ assert rows["openshell"].hint == "found 0.0.1, not the tested release" and not rows["openshell"].fixabledef test_admin_prefix_prefers_passwordless_sudo_then_the_desktop_prompt_never_wsl(monkeypatch):monkeypatch.setattr(setup_cmd.sys, "platform", "linux")@@ -116,50 +107,6 @@ def test_admin_prefix_prefers_passwordless_sudo_then_the_desktop_prompt_never_wsassert setup_cmd.admin_prefix() is None # a Mac needs none-def test_install_openshell_runs_the_installer_as_the_user_on_a_mac_and_as_an_administrator_on_linux(monkeypatch):- ran: list[list[str]] = []- monkeypatch.setattr(setup_cmd, "_stream", lambda argv, on_line, cancel: ran.append(argv) or (0, "done"))- monkeypatch.setattr(setup_cmd.getpass, "getuser", lambda: "sam")- monkeypatch.setattr(setup_cmd.sys, "platform", "darwin")- assert setup_cmd.install_openshell() is None- assert ran == [["sh", "-c", setup_cmd.installer_command()]]- ran.clear()- monkeypatch.setattr(setup_cmd.sys, "platform", "linux")- monkeypatch.setattr(setup_cmd, "admin_prefix", lambda: ["sudo", "-n"])- assert setup_cmd.install_openshell() is None- assert ran == [["sudo", "-n", "sh", "-c", f"loginctl enable-linger sam && {setup_cmd.installer_command()}"]]- monkeypatch.setattr(setup_cmd, "_stream", lambda argv, on_line, cancel: (1, "checksum mismatch"))- assert setup_cmd.install_openshell() == "the installer exited with 1: checksum mismatch"- monkeypatch.setattr(setup_cmd, "_stream", lambda argv, on_line, cancel: (None, ""))- assert setup_cmd.install_openshell() == "installation cancelled"- monkeypatch.setattr(setup_cmd, "admin_prefix", lambda: None)- assert "sudo loginctl enable-linger sam && curl" in (setup_cmd.install_openshell() or "")---def test_the_job_installs_openshell_with_its_output_as_progress(monkeypatch):- def fake_install(on_line, cancel):- for line in ("downloading v0.0.116 release checksums...", "installing openshell...", "gateway registered"):- on_line(line)- time.sleep(0.02)- return None-- monkeypatch.setattr(setup_cmd, "install_openshell", fake_install)- reads = {"n": 0}-- def steps():- reads["n"] += 1- return [Step("docker", setup_cmd.ROWS["docker"], True), Step("openshell", setup_cmd.ROWS["openshell"], reads["n"] > 1, fixable=True, docs=setup_cmd.GUIDE_URL)]-- job = setup_job.SetupJob(steps)- job.start()- time.sleep(0.03)- mid = job.state()- assert mid["status"] == "running" and mid["progress"]["last_line"].startswith(("downloading", "installing"))- assert {r["key"]: r["state"] for r in mid["rows"]}["openshell"] == "fixing"- state = _wait(job)- assert state["status"] == "done" and {r["key"]: r["state"] for r in state["rows"]}["openshell"] == "fixed"--def test_the_job_fixes_what_it_may_and_stops_at_what_needs_an_administrator(monkeypatch):fixed: list[str] = []monkeypatch.setattr(setup_cmd, "apply_bind_mounts", lambda: fixed.append("bind_mounts") or None)diff --git a/tests/test_sandbox_windows.py b/tests/test_sandbox_windows.pyindex 6ebad1f1..88cc48cc 100644--- a/tests/test_sandbox_windows.py+++ b/tests/test_sandbox_windows.py@@ -29,7 +29,7 @@ def _has_setup() -> bool:-def _open(tmp_path, *, extra_roots=(), network=False, profile="strict"):+def _open(tmp_path, *, extra_roots=(), network=False, profile="allowlist"):from coworker.sandbox.providers.windows import WindowsProviderproject = tmp_path / "project"