Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(cua-cli): one --share desktop|spaces|both|none flag for cua host setup (#6096)

injaneity903d8c5b7d94
diff --git a/docs/content/docs/cua-cli/reference/cli/index.mdx b/docs/content/docs/cua-cli/reference/cli/index.mdx
index b19cb5e194..6aaee0390d 100644
--- a/docs/content/docs/cua-cli/reference/cli/index.mdx
+++ b/docs/content/docs/cua-cli/reference/cli/index.mdx
@@ -102,7 +102,7 @@ Sign in and out, user defaults, the cua daemon, health checks and usage telemetr
### Your pool
-Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --no-desktop --provide-spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them. [Reference](/cua-cli/reference/cli/pool).
+Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --share spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them. [Reference](/cua-cli/reference/cli/pool).
| Command | Description | Subcommands |
| --- | --- | --- |
diff --git a/docs/content/docs/cua-cli/reference/cli/pool.mdx b/docs/content/docs/cua-cli/reference/cli/pool.mdx
index 4a5714ae46..27d049a124 100644
--- a/docs/content/docs/cua-cli/reference/cli/pool.mdx
+++ b/docs/content/docs/cua-cli/reference/cli/pool.mdx
@@ -1,6 +1,6 @@
---
title: "Your pool"
-description: "Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --no-desktop --provide-spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them."
+description: "Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --share spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them."
---
{/*
diff --git a/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx b/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx
index eea97316de..d5ec280972 100644
--- a/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx
+++ b/docs/content/docs/cua-cli/reference/cli/spaces-and-computers.mdx
@@ -15,7 +15,7 @@ description: "Your Spaces and machines, unattended access on this machine, devic
| [`cua spaces`](#cua-spaces) | Spaces: registered ones and your computers on the relay. |
| [`cua spaces ls`](#cua-spaces-ls) | Registered Spaces and your computers on the relay. |
| [`cua spaces add`](#cua-spaces-add) | Register a Space after a capabilities handshake with its cua-spacesd (or, for another URL, an MCP initialize). |
-| [`cua spaces create`](#cua-spaces-create) | Create Spaces: on this computer, on one of your computers that provides Spaces (`cua host setup --no-desktop --provide-spaces` there), or in your own cloud account. |
+| [`cua spaces create`](#cua-spaces-create) | Create Spaces: on this computer, on one of your computers that provides Spaces (`cua host setup --share spaces` there), or in your own cloud account. |
| [`cua spaces prewarm`](#cua-spaces-prewarm) | Keep Spaces of one image ready where the elastic pool puts them, so the next creates of that shape start in a fraction of a second (`--list` shows the prewarms, `--remove ID` ends one). |
| [`cua spaces egress`](#cua-spaces-egress) | Choose which destinations a Space may reach: block some, or block everything except a few. |
| [`cua spaces cancel`](#cua-spaces-cancel) | Cancel a create that is still running (here, in the daemon, or in another terminal): it stops and what it made is removed. |
@@ -147,13 +147,13 @@ cua spaces add 10.0.0.5:3211 --token "$TOKEN" --name studio
cua spaces add local:my-sandbox
cua spaces add http://127.0.0.1:8765/mcp --service tools
-# A computer that provides Spaces over Tailscale, without the relay (`cua host setup --direct ... --provide-spaces` on it prints this)
+# A computer that provides Spaces over Tailscale, without the relay (`cua host setup --direct ... --share both` on it prints this)
cua spaces add 100.101.102.103:3211 --host --name "Mac mini (spare)" --token "$TOKEN"
```
### `cua spaces create`
-Create Spaces: on this computer, on one of your computers that provides Spaces (`cua host setup --no-desktop --provide-spaces` there), or in your own cloud account.
+Create Spaces: on this computer, on one of your computers that provides Spaces (`cua host setup --share spaces` there), or in your own cloud account.
```text output
cua spaces create [OPTIONS] [IMAGE]
@@ -579,7 +579,7 @@ cua host [OPTIONS] <COMMAND>
### `cua host setup`
-Set this computer up for unattended access: install cua-spacesd as a service that joins the cua.ai relay as your account (default) or serves on a direct ip:port. By default (the `desktop` profile) it shares this computer's desktop and, on a computer set up for the first time through the relay, provides Spaces to your devices (a host in your pool: `cua run` jobs and `--on auto` Spaces can run here, within its limits); `--no-provide-spaces` leaves that off, and `cua host config --provide-spaces off` turns it off later. A computer set up before keeps what it provides. `--profile spare` or `--no-desktop` provides Spaces only, so its own desktop stays private. Running it again with the same options changes nothing (a stopped service starts again).
+Set this computer up for unattended access: install cua-spacesd as a service that joins the cua.ai relay as your account (default) or serves on a direct ip:port. By default it shares this computer's desktop and, on a computer set up for the first time through the relay, provides Spaces to your devices (a host in your pool: `cua run` jobs and `--on auto` Spaces can run here, within its limits). `--share` picks what it shares: `desktop`, `spaces` (its own desktop stays private), `both` or `none`; `cua host config` changes it later. A computer set up before keeps what it provides. Running it again with the same options changes nothing (a stopped service starts again).
```text output
cua host setup [OPTIONS]
@@ -592,13 +592,9 @@ cua host setup [OPTIONS]
| <span id="cua-host-setup--allow"></span>`--allow` | string | | Also allow this account (id or email). Repeatable. |
| <span id="cua-host-setup--driver-bin"></span>`--driver-bin` | path | | cua-spacesd binary (default $CUA_SPACESD_BIN, a bundled one, or the release download). |
| <span id="cua-host-setup--runner"></span>`--runner` | string | `auto` | auto \| systemd \| launchd \| app-helper \| windows-task \| process. On a Mac with the Cua Spaces app, auto is app-helper: the service runs as the app's own login item ("Cua Spaces"). |
-| <span id="cua-host-setup--profile"></span>`--profile` | `desktop` \| `spare` | | What this computer is for: `desktop` (share this desktop, and provide Spaces on a new relay setup; the default) or `spare` (do not share the desktop; provide Spaces). |
+| <span id="cua-host-setup--share"></span>`--share` | `desktop` \| `spaces` \| `both` \| `none` | | What this computer shares: its own desktop (screen, input, shell, files), the Spaces it creates for your enrolled devices (Lume macOS VMs, Docker Linux containers), both, or neither (refused). Default: the desktop, plus Spaces on a new relay setup; a computer set up before keeps what it provides. |
| <span id="cua-host-setup--max-spaces"></span>`--max-spaces` | integer | | Provided Spaces at once (default 4; 0: no limit). |
| <span id="cua-host-setup--remote"></span>`--remote` | boolean | `false` | When sign-in is needed, use a device code to approve it in a browser on another computer. The account session is not saved. |
-| <span id="cua-host-setup--desktop"></span>`--desktop` | boolean | | Share this computer's own desktop as a Space. |
-| <span id="cua-host-setup--no-desktop"></span>`--no-desktop` | boolean | `false` | Do not share this computer's own desktop (screen, input, shell, files): relayed callers reach only the Spaces it provides. |
-| <span id="cua-host-setup--provide-spaces"></span>`--provide-spaces` | boolean | | Create Spaces for your enrolled devices on this computer's runtimes (Lume macOS VMs, Docker Linux containers). The default for a new relay setup; a computer set up before keeps its setting unless this (or `--no-provide-spaces`) is given. On its own it keeps the default `desktop` profile, so this computer's desktop is shared too; add `--no-desktop` (or use `--profile spare`) to provide Spaces only. |
-| <span id="cua-host-setup--no-provide-spaces"></span>`--no-provide-spaces` | boolean | `false` | Do not create Spaces for other devices (only share this desktop). |
| <span id="cua-host-setup--dedicated"></span>`--dedicated` | boolean | `false` | This computer exists only for Cua work (a cloud instance made for it; `cua cloud add aws` sets its hosts up this way): jobs may run in its own Space (`kind = "machine"`), with its GPU and drivers as they are. Never on a computer you also use: there jobs run in macOS VMs or containers. |
**Examples**
@@ -608,11 +604,10 @@ cua host setup [OPTIONS]
cua host setup
# Share this desktop only
-cua host setup --no-provide-spaces
+cua host setup --share desktop
# A spare computer: do not share its desktop, run Spaces for your devices
-cua host setup --profile spare --name "Mac mini (spare)"
-cua host setup --no-desktop --provide-spaces
+cua host setup --share spaces --name "Mac mini (spare)"
# Add this computer with a one-time code from the Cua Spaces app (Add a computer) or `cua host pair`: no sign-in needed here
cua host setup --pair K7QM-4XPB-2RHD
diff --git a/docs/content/docs/cua-cli/reference/index.mdx b/docs/content/docs/cua-cli/reference/index.mdx
index 09dd393a46..e631b08cd7 100644
--- a/docs/content/docs/cua-cli/reference/index.mdx
+++ b/docs/content/docs/cua-cli/reference/index.mdx
@@ -22,7 +22,7 @@ description: "Every cua command and every cua MCP tool, generated from the CLI d
| [Computer actions](/cua-cli/reference/cli/computer-actions) | One-shot computer actions (screenshot, click, type, windows) against a selected target, and their recorded trajectories. |
| [Agents, MCP and skills](/cua-cli/reference/cli/agents) | Agents in a Space, connecting your AI agents, the stdio MCP server, and recorded skills. |
| [Account and setup](/cua-cli/reference/cli/account-and-setup) | Sign in and out, user defaults, the cua daemon, health checks and usage telemetry. |
-| [Your pool](/cua-cli/reference/cli/pool) | Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --no-desktop --provide-spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them. |
+| [Your pool](/cua-cli/reference/cli/pool) | Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --share spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them. |
| [Benchmarks](/cua-cli/reference/cli/bench) | Spaces performance benchmarks: list them, run one in Spaces of its own (result.json and samples.csv in the bench-result v1 format), and check a run against a committed baseline. |
## MCP tools
diff --git a/docs/content/docs/cua-sdk/guides/agent-frameworks.mdx b/docs/content/docs/cua-sdk/guides/agent-frameworks.mdx
index 81d5eb54bd..74caa9ca9d 100644
--- a/docs/content/docs/cua-sdk/guides/agent-frameworks.mdx
+++ b/docs/content/docs/cua-sdk/guides/agent-frameworks.mdx
@@ -48,7 +48,7 @@ interactive.
Cursor's self-hosted Team Pool worker can run in a Linux Space on your Mac or
on a machine you set up with
-[`cua host setup --provide-spaces`](/spaces/guides/add-a-computer#use-a-spare-mac-to-host-spaces)
+[`cua host setup --share both`](/spaces/guides/add-a-computer#use-a-spare-mac-to-host-spaces)
(add `--on "<machine>"` and use the id `create` prints). It needs Cursor
Enterprise with [Self-Hosted Machines](https://cursor.com/docs/cloud-agent/self-hosted)
allowed and a service-account API key. Create the Space, install the Cursor
diff --git a/docs/content/docs/cua-sdk/guides/durable-agent-guarantees.mdx b/docs/content/docs/cua-sdk/guides/durable-agent-guarantees.mdx
index 8bac0e9786..c54c125958 100644
--- a/docs/content/docs/cua-sdk/guides/durable-agent-guarantees.mdx
+++ b/docs/content/docs/cua-sdk/guides/durable-agent-guarantees.mdx
@@ -88,7 +88,7 @@ cua-spacesd that runs commands on the same machine with the daemon's exec
ledger and epoch fence on disk. `CRASH_SEED_BASE` makes a run reproducible.
`redrive` needs the lab coordinator (`crates/cua-spaces-cluster/tests/lab_coordinator_live.rs`)
and a container engine, so it runs on a machine you control, not in CI. The lab
-node provides Spaces like a `cua host setup --direct --provide-spaces` machine
+node provides Spaces like a `cua host setup --direct --share both` machine
when `CUA_LAB_DIRECT_IP` is set (use the container bridge address, for example
`172.17.0.1`): a real host service answers `HostSpacesService` over gRPC and
forwards a port per Space, so `durable_create` places a durable Space with a
@@ -187,7 +187,7 @@ with the workspace, a machine checkpoint with the Space's memory.
mode rebuilds the workspace from the log; checkpoint mode needs a
`CheckpointStore` reachable from every driver, otherwise the session ends
`failed` (permanent) with that reason. Only hosts that provide Spaces
- directly (`cua host setup --direct --provide-spaces`) can hold a durable
+ directly (`cua host setup --direct --share both`) can hold a durable
Space; the lease path was measured against such a host on Linux with Docker
(runc), not on macOS or microVM hosts.
- A session holds its durable Space's lease from each drive until the session
diff --git a/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx b/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx
index fc7560a3ff..62b4324c9c 100644
--- a/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx
+++ b/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx
@@ -10,7 +10,7 @@ description: "cua.env.v1 HostSpacesService: Spaces a host creates for its owner'
Version: 0.9.0
*/}
-Spaces a machine set up with `cua host setup --provide-spaces` creates for its owner's enrolled devices: settings, capacity, create and delete. The host's cua-spacesd forwards each call to its cua daemon. What a host reports for placement is on [Host capacity](/cua-sdk/reference/protocol/env-host-capacity).
+Spaces a machine set up with `cua host setup --share both` creates for its owner's enrolled devices: settings, capacity, create and delete. The host's cua-spacesd forwards each call to its cua daemon. What a host reports for placement is on [Host capacity](/cua-sdk/reference/protocol/env-host-capacity).
Source: `libs/cua/proto/cua/env/v1/host.proto`.
@@ -19,7 +19,7 @@ Source: `libs/cua/proto/cua/env/v1/host.proto`.
`cua.env.v1.HostSpacesService`
Spaces a host provides: a machine set up with `cua host setup
---provide-spaces` creates Spaces (macOS VMs with Lume on a Mac, Linux
+--share both` creates Spaces (macOS VMs with Lume on a Mac, Linux
containers with Docker, whatever else runs locally) for the owner's
enrolled devices and the accounts it is shared with, through the relay.
@@ -34,7 +34,7 @@ host's hash-chained audit log (`~/.cua/host/spaces-audit.jsonl`).
With `share_desktop` off, a relayed caller reaches only this service and
`GetCapabilities` / `Health`, never the host's desktop or files.
-A host set up with `cua host setup --direct <ip:port> --provide-spaces`
+A host set up with `cua host setup --direct <ip:port> --share both`
also serves it on its direct listener, to the holder of its env token,
by default only from loopback, Tailscale and private LAN addresses. A
Space created with `direct` is reached on a TCP port the host forwards
diff --git a/docs/content/docs/spaces/guides/add-a-computer.mdx b/docs/content/docs/spaces/guides/add-a-computer.mdx
index 84bc7b6aea..edcee7cc37 100644
--- a/docs/content/docs/spaces/guides/add-a-computer.mdx
+++ b/docs/content/docs/spaces/guides/add-a-computer.mdx
@@ -91,9 +91,7 @@ and rotates the token.
| `--name NAME` | Display name (default: host name). |
| `--allow ACCOUNT` | Also allow this account (id or email). Repeatable. |
| `--runner KIND` | `auto`, `systemd`, `launchd`, `windows-task` or `process`. On Linux, `auto` uses systemd when it is running, otherwise `process`. |
-| `--profile spare` | A spare computer: do not share its desktop, create Spaces for your devices (`--no-desktop --provide-spaces`). See [Use a spare Mac to host Spaces](#use-a-spare-mac-to-host-spaces). |
-| `--no-desktop` / `--provide-spaces` | Each of the two settings on its own. `cua host config` changes them later. |
-| `--no-provide-spaces` | Share this desktop only. A computer set up for the first time provides Spaces to your devices by default; a computer set up before keeps its setting. |
+| `--share desktop\|spaces\|both\|none` | What this computer shares: `desktop` (this desktop only), `spaces` (create Spaces for your devices and keep its own desktop private; see [Use a spare Mac to host Spaces](#use-a-spare-mac-to-host-spaces)), `both`, or `none` (refused: there is nothing to share). Without it the desktop is shared, and a computer set up for the first time also provides Spaces; a computer set up before keeps its setting. `cua host config` changes it later. |
## What each system needs
@@ -213,10 +211,10 @@ steps above.
On the spare Mac:
```bash test="cli-shape" id="cua-host-setup-spare"
-cua host setup --profile spare --name "Mac mini (spare)"
+cua host setup --share spaces --name "Mac mini (spare)"
```
-`--profile spare` is shorthand for `--no-desktop --provide-spaces`. Setup joins
+`--share spaces` shares no desktop and provides Spaces. Setup joins
the relay the way the steps above do. It signs you in for that one command and
keeps no account session, only the computer's own token.
@@ -231,13 +229,13 @@ For how this computer, its device record and its Spaces fit together, see
The computer has two settings, and each works on its own:
-| Setting | What it does | `desktop` profile (default) | `spare` profile |
+| Setting | What it does | Default | `--share spaces` |
|---|---|---|---|
| Let other machines control this desktop (`--desktop`) | The computer itself is a Space: its screen, input, shell and files. | on | off |
| Let other machines create Spaces here (`--provide-spaces`) | Your enrolled devices can create, list and delete Spaces on it. | on for a new setup | on |
A computer set up before this default keeps what it had: setting it up again
-never turns **Provide Spaces** on unless you pass `--provide-spaces`. With
+never turns **Provide Spaces** on unless you pass `--share spaces` or `--share both`. With
**Provide Spaces** on, your devices (and teammates you share the computer with
as editors) can run Spaces and `cua run` jobs on it, at most 4 at once and two
macOS VMs on a Mac. Nothing runs until a Space is created. When Provide Spaces
@@ -278,7 +276,7 @@ Cua Spaces app and hosting, and `--no-onboarding` skips the automatic
with a device code:
```bash test="cli-shape" id="cua-host-setup-spare-ssh"
-cua host setup --remote --profile spare --name "Mac mini (spare)"
+cua host setup --remote --share spaces --name "Mac mini (spare)"
```
If the mini has no saved account session, this prints a URL and a short code
@@ -389,7 +387,7 @@ cua agent allow-computer ada relay:space-0123456789abcdef
Every computer signed in to your account that provides Spaces is part of one
pool. There is nothing else to set up: sign in on each computer (the app, or
-`cua auth login` and `cua host setup --profile spare`), then ask for `auto`:
+`cua auth login` and `cua host setup --share spaces`), then ask for `auto`:
```bash test="cli-shape" id="cua-spaces-create-auto"
cua spaces create linux --on auto
@@ -489,14 +487,14 @@ calls, so you and the teammates you `--allow` need no token: see
[Use your tailnet](/spaces/guides/your-tailnet).
```bash test="cli-shape" id="cua-host-setup-tailnet-spare"
-cua host setup --tailnet --profile spare --name "Mac mini (spare)"
+cua host setup --tailnet --share spaces --name "Mac mini (spare)"
```
Or, with the Mac's env token as the credential, set it up on its Tailscale
address:
```bash test="cli-shape" id="cua-host-setup-direct-spare"
-cua host setup --direct 100.101.102.103:3211 --profile spare --name "Mac mini (spare)"
+cua host setup --direct 100.101.102.103:3211 --share spaces --name "Mac mini (spare)"
```
Use the Mac's own address from `tailscale ip -4`. With `--direct 0.0.0.0:3211` it
@@ -544,7 +542,7 @@ restarts, the Mac opens the same port again.
| Error | Meaning | Fix |
|---|---|---|
| `ambiguous_host` | Several of your computers fit the name. | Pick one of the listed IDs: `on="host:<id>"`. |
-| `not_found` | No computer fits the name. | Check `cua spaces ls`, or set the computer up with `--provide-spaces`. |
+| `not_found` | No computer fits the name. | Check `cua spaces ls`, or set the computer up with `--share spaces` or `--share both`. |
| `host_capability_missing` | The computer is offline, does not provide Spaces, or cannot run that OS. | Run `cua host config --provide-spaces on` on it, or pick another computer. |
| `limit_exceeded` | Two macOS VMs already run, or the computer is at its Space limit. | Delete one with `cua spaces delete`, or raise `--max-spaces`. |
| `permission_denied` | The computer is shared with you to watch only. | Ask its owner to share it as an editor. |
diff --git a/docs/content/docs/spaces/guides/bring-your-own-compute.mdx b/docs/content/docs/spaces/guides/bring-your-own-compute.mdx
index 6c4ff6d1a4..787a24ecff 100644
--- a/docs/content/docs/spaces/guides/bring-your-own-compute.mdx
+++ b/docs/content/docs/spaces/guides/bring-your-own-compute.mdx
@@ -49,7 +49,7 @@ desktop and files stay private.
On the mini, in Terminal:
```bash test="cli-shape" id="byoc-mac-mini"
-cua host setup --profile spare --name "Mac mini"
+cua host setup --share spaces --name "Mac mini"
```
If you only reach the mini over ssh, install without a screen and sign in with
@@ -61,7 +61,7 @@ curl -fsSL https://cua.ai/install.sh | sh -s -- -y --select spaces,host --no-onb
```
```bash test="cli-shape" id="byoc-mac-mini-remote"
-cua host setup --remote --profile spare --name "Mac mini"
+cua host setup --remote --share spaces --name "Mac mini"
```
<Callout type="warn">
@@ -123,7 +123,7 @@ The server now appears in **Machines**. Setup installs it as a background
service, so it comes back after a restart.
If the server only runs Spaces and you don't want to share its own desktop,
-add `--profile spare` to the setup command.
+add `--share spaces` to the setup command.
Already on the Cua Spaces app? You can skip the code. Open **Machines**, press
**Add a machine**, and run the install command it shows on the server. See
diff --git a/docs/content/docs/spaces/guides/your-tailnet.mdx b/docs/content/docs/spaces/guides/your-tailnet.mdx
index 30da515156..a166b28e1a 100644
--- a/docs/content/docs/spaces/guides/your-tailnet.mdx
+++ b/docs/content/docs/spaces/guides/your-tailnet.mdx
@@ -26,7 +26,7 @@ up`, or `tailscale up --login-server https://headscale.example.com` for
Headscale):
```bash test="cli-shape" id="cua-host-setup-tailnet"
-cua host setup --tailnet --profile spare --allow [email protected]
+cua host setup --tailnet --share spaces --allow [email protected]
```
`--tailnet` serves on the machine's tailnet address (`tailscale ip -4`) on
diff --git a/docs/content/docs/spaces/reference/spaces.mdx b/docs/content/docs/spaces/reference/spaces.mdx
index 79558d2f0b..718f39a009 100644
--- a/docs/content/docs/spaces/reference/spaces.mdx
+++ b/docs/content/docs/spaces/reference/spaces.mdx
@@ -119,7 +119,7 @@ JSON: an array of Spaces (`id`, `name`, `provider`, `spacesd_version`, `features
Create a Space: a new sandbox on this computer, on one of your computers, or in the cloud.
-Creates a new sandbox where `on` says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries `cloud` and `cloud_place`, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:&lt;name&gt;. Cua Cloud (on="cloud") has ended and fails with an error that says so. `kind` (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and `runtime` (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on="auto" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on="host:&lt;computer&gt;" creates the Space on a computer set up with `cua host setup --provide-spaces` (for example "spin up 2 macOS Spaces on my spare Mac mini" is on="host:spare mac mini", image="macos", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on="host:&lt;id&gt;"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:&lt;computer&gt; with `host` set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on="direct:&lt;addr&gt;" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on="auto") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with `durable`, and delete_space deletes it for good.
+Creates a new sandbox where `on` says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries `cloud` and `cloud_place`, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:&lt;name&gt;. Cua Cloud (on="cloud") has ended and fails with an error that says so. `kind` (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and `runtime` (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on="auto" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on="host:&lt;computer&gt;" creates the Space on a computer set up with `cua host setup --share both` (for example "spin up 2 macOS Spaces on my spare Mac mini" is on="host:spare mac mini", image="macos", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on="host:&lt;id&gt;"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:&lt;computer&gt; with `host` set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on="direct:&lt;addr&gt;" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on="auto") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with `durable`, and delete_space deletes it for good.
| | |
| --- | --- |
@@ -143,7 +143,7 @@ Creates a new sandbox where `on` says (local: this computer, free; aws, azure, g
| `kind` | `"auto" \| "container" \| "vm" \| "microvm"` | `auto` | What kind of computer. Default `auto` (from the image). `auto`: From the image: macOS and Windows images are VMs, an image with a container rootfs is a container, a disk-only image is a VM. `container`: A container (gVisor, or runc locally). `vm`: A virtual machine (QEMU or Lume locally, KubeVirt in the cloud). `microvm`: A microVM: the image's container rootfs booted with its own kernel (Firecracker on Linux with KVM; on a Mac, Virtualization.framework or Apple's Containerization). |
| `labels` | `map of string` | none | Labels kept with the Space and shown by `list_spaces` (`labels`): up to 64 pairs; keys and values are not empty; keys up to 63 bytes, values up to 256. Not with `durable` or `reuse`. |
| `name` | `string` | none | Name. Default: a generated `space-<hex>`. |
-| `on` | `string` | none | Where it runs: `local` (this computer, free), `auto` (the least-loaded of the user's computers that can take it: this one and the ones signed in to the user's account that provide Spaces, Modal only when connected and no computer has room), `aws`, `gcp` or `modal` (your own cloud account, billed there), or `host:<computer>`: one of the user's own computers that provides Spaces (`cua host setup --provide-spaces` on it), named by id or by words from its name ("host:spare mac mini" matches "Mac mini (spare)" or `dillons-mac-mini`). Default: the user's default location (`cua config set default.on`, `CUA_DEFAULT_ON`), else `local`; never `auto` unless asked. Not `direct:<addr>`: that is one already-running Space at a fixed address, attached with `add_space`, not a host this can create on. An existing computer is added with `add_space`, not created. |
+| `on` | `string` | none | Where it runs: `local` (this computer, free), `auto` (the least-loaded of the user's computers that can take it: this one and the ones signed in to the user's account that provide Spaces, Modal only when connected and no computer has room), `aws`, `gcp` or `modal` (your own cloud account, billed there), or `host:<computer>`: one of the user's own computers that provides Spaces (`cua host setup --share both` on it), named by id or by words from its name ("host:spare mac mini" matches "Mac mini (spare)" or `dillons-mac-mini`). Default: the user's default location (`cua config set default.on`, `CUA_DEFAULT_ON`), else `local`; never `auto` unless asked. Not `direct:<addr>`: that is one already-running Space at a fixed address, attached with `add_space`, not a host this can create on. An existing computer is added with `add_space`, not created. |
| `region` | `string` | none | With `on` a linked cloud: the region (Hetzner location) its host must be in. Default: any the cloud offers. |
| `reuse` | `boolean` | `false` | Return a reachable registered Space in the same location that has the requested services instead of creating one (get-or-create). Default false. |
| `runtime` | `string` | `auto` | Which engine. Default `auto`: the safest one for the location and kind. Local: `gvisor` or `runc` (containers), `qemu` or `lume` (VMs). Cloud: `gvisor` (containers), `kubevirt` (VMs). Anything else fails with `invalid_placement`, listing the valid values. |
diff --git a/libs/cua/crates/cua-cli/src/host.rs b/libs/cua/crates/cua-cli/src/host.rs
index af1a277176..3cfa2f7fa4 100644
--- a/libs/cua/crates/cua-cli/src/host.rs
+++ b/libs/cua/crates/cua-cli/src/host.rs
@@ -14,29 +14,52 @@ use std::io::Write;
use std::path::{Path, PathBuf};
use std::sync::Arc;
+/// What `cua host setup --share` shares, the app's sharing switch.
+#[derive(clap::ValueEnum, Clone, Copy, Debug, PartialEq, Eq)]
+pub enum HostShare {
+ /// Share this computer's own desktop only.
+ Desktop,
+ /// Provide Spaces for your devices; keep this desktop private.
+ Spaces,
+ /// Share this desktop and provide Spaces.
+ Both,
+ /// Share nothing (setup refuses: there is nothing to set up).
+ None,
+}
+
+impl HostShare {
+ /// `(share_desktop, provide_spaces)` the value asks for.
+ pub fn settings(self) -> (bool, bool) {
+ match self {
+ Self::Desktop => (true, false),
+ Self::Spaces => (false, true),
+ Self::Both => (true, true),
+ Self::None => (false, false),
+ }
+ }
+}
+
#[derive(Subcommand, Debug)]
pub enum HostCmd {
/// Set this computer up for unattended access: install cua-spacesd as
/// a service that joins the cua.ai relay as your account (default) or
- /// serves on a direct ip:port. By default (the `desktop` profile) it
+ /// serves on a direct ip:port. By default it
/// shares this computer's desktop and, on a computer set up for the
/// first time through the relay, provides Spaces to your devices (a
/// host in your pool: `cua run` jobs and `--on auto` Spaces can run
- /// here, within its limits); `--no-provide-spaces` leaves that off, and
- /// `cua host config --provide-spaces off` turns it off later. A
- /// computer set up before keeps what it provides. `--profile spare` or
- /// `--no-desktop` provides Spaces only, so its own desktop stays
- /// private. Running it again with the same options changes nothing (a
- /// stopped service starts again).
+ /// here, within its limits). `--share` picks what it shares: `desktop`,
+ /// `spaces` (its own desktop stays private), `both` or `none`;
+ /// `cua host config` changes it later. A computer set up before keeps
+ /// what it provides. Running it again with the same options changes
+ /// nothing (a stopped service starts again).
#[command(after_help = "Examples:
# Join the cua.ai relay as your account (shares this desktop and
# provides Spaces to your devices)
cua host setup
# Share this desktop only
- cua host setup --no-provide-spaces
+ cua host setup --share desktop
# A spare computer: do not share its desktop, run Spaces for your devices
- cua host setup --profile spare --name \"Mac mini (spare)\"
- cua host setup --no-desktop --provide-spaces
+ cua host setup --share spaces --name \"Mac mini (spare)\"
# Add this computer with a one-time code from the Cua Spaces app
# (Add a computer) or `cua host pair`: no sign-in needed here
cua host setup --pair K7QM-4XPB-2RHD
@@ -75,29 +98,32 @@ pub enum HostCmd {
/// service runs as the app's own login item ("Cua Spaces").
#[arg(long, default_value = "auto")]
runner: String,
- /// What this computer is for: `desktop` (share this desktop, and
- /// provide Spaces on a new relay setup; the default) or `spare` (do
- /// not share the desktop; provide Spaces).
- #[arg(long, value_parser = ["desktop", "spare"])]
+ /// What this computer shares: its own desktop (screen, input,
+ /// shell, files), the Spaces it creates for your enrolled devices
+ /// (Lume macOS VMs, Docker Linux containers), both, or neither
+ /// (refused). Default: the desktop, plus Spaces on a new relay
+ /// setup; a computer set up before keeps what it provides.
+ #[arg(
+ long,
+ value_enum,
+ value_name = "WHAT",
+ conflicts_with_all = ["profile", "desktop", "no_desktop", "provide_spaces", "no_provide_spaces"]
+ )]
+ share: Option<HostShare>,
+ /// Hidden alias: `--share spaces` is `--profile spare`.
+ #[arg(long, hide = true, value_parser = ["desktop", "spare"])]
profile: Option<String>,
- /// Share this computer's own desktop as a Space.
- #[arg(long, overrides_with = "no_desktop")]
+ /// Hidden alias of the desktop half of `--share`.
+ #[arg(long, hide = true, overrides_with = "no_desktop")]
desktop: bool,
- /// Do not share this computer's own desktop (screen, input, shell,
- /// files): relayed callers reach only the Spaces it provides.
- #[arg(long)]
+ /// Hidden alias of `--share spaces` with `--provide-spaces`.
+ #[arg(long, hide = true)]
no_desktop: bool,
- /// Create Spaces for your enrolled devices on this computer's
- /// runtimes (Lume macOS VMs, Docker Linux containers). The default
- /// for a new relay setup; a computer set up before keeps its
- /// setting unless this (or `--no-provide-spaces`) is given. On its
- /// own it keeps the default `desktop` profile, so this computer's
- /// desktop is shared too; add `--no-desktop` (or use `--profile
- /// spare`) to provide Spaces only.
- #[arg(long, overrides_with = "no_provide_spaces")]
+ /// Hidden alias: with the default profile, `--share both`.
+ #[arg(long, hide = true, overrides_with = "no_provide_spaces")]
provide_spaces: bool,
- /// Do not create Spaces for other devices (only share this desktop).
- #[arg(long)]
+ /// Hidden alias: with the default profile, `--share desktop`.
+ #[arg(long, hide = true)]
no_provide_spaces: bool,
/// Provided Spaces at once (default 4; 0: no limit).
#[arg(long)]
@@ -302,7 +328,7 @@ Examples:
cua spaces add local:my-sandbox
cua spaces add http://127.0.0.1:8765/mcp --service tools
# A computer that provides Spaces over Tailscale, without the relay
- # (`cua host setup --direct ... --provide-spaces` on it prints this)
+ # (`cua host setup --direct ... --share both` on it prints this)
cua spaces add 100.101.102.103:3211 --host --name \"Mac mini (spare)\" --token \"$TOKEN\"")]
Add {
/// The Space's cua-spacesd (`http(s)://host:port`, `host:port`,
@@ -326,7 +352,7 @@ Examples:
host: bool,
},
/// Create Spaces: on this computer, on one of your computers that
- /// provides Spaces (`cua host setup --no-desktop --provide-spaces` there),
+ /// provides Spaces (`cua host setup --share spaces` there),
/// or in your own cloud account.
#[command(after_help = "Examples:
cua spaces create linux
@@ -1954,6 +1980,7 @@ pub async fn run_host_to(
allow,
driver_bin,
runner,
+ share,
profile,
desktop,
no_desktop,
@@ -2015,6 +2042,11 @@ pub async fn run_host_to(
if no_provide_spaces {
opts.provide_spaces = Some(false);
}
+ if let Some(share) = share {
+ let (desktop, spaces) = share.settings();
+ opts.share_desktop = desktop;
+ opts.provide_spaces = Some(spaces);
+ }
opts.max_spaces = max_spaces;
opts.allow_any_address = allow_any_address;
opts.dedicated = dedicated;
@@ -2027,12 +2059,15 @@ pub async fn run_host_to(
&& opts.driver_bin.is_none()
&& opts.allow.is_empty()
&& opts.max_spaces.is_none()
+ // `--share none` is always refused, even by a computer that
+ // `host config` set to share nothing.
+ && share != Some(HostShare::None)
{
// Only what this command line says: a re-run that leaves out
// the profile keeps what the machine shares.
let want = crate::onboard::Want {
relay: url.clone(),
- share_desktop: (profile.is_some() || desktop || no_desktop)
+ share_desktop: (share.is_some() || profile.is_some() || desktop || no_desktop)
.then_some(opts.share_desktop),
// Providing Spaces: what the flags or a spare profile
// say; the desktop profile keeps the machine's own.
@@ -3398,16 +3433,10 @@ mod tests {
} => assert_eq!((profile.as_deref(), max_spaces), (Some("spare"), Some(6))),
other => panic!("{other:?}"),
}
- match parse(&["setup", "--no-desktop", "--provide-spaces"]) {
- HostCmd::Setup {
- profile,
- no_desktop,
- provide_spaces,
- ..
- } => assert_eq!(
- (profile.as_deref(), no_desktop, provide_spaces),
- (None, true, true)
- ),
+ match parse(&["setup", "--share", "spaces"]) {
+ HostCmd::Setup { share, profile, .. } => {
+ assert_eq!((share, profile), (Some(HostShare::Spaces), None))
+ }
other => panic!("{other:?}"),
}
match parse(&["config", "--desktop", "off", "--provide-spaces", "on"]) {
@@ -3453,8 +3482,8 @@ mod tests {
"setup",
"--direct",
"0.0.0.0:3211",
- "--profile",
- "spare",
+ "--share",
+ "spaces",
"--allow-any-address",
]) {
HostCmd::Setup {
@@ -4308,7 +4337,7 @@ mod tests {
args.extend(["--direct", "127.0.0.1:3211"]);
}
if stage == "preflight" {
- args.extend(["--no-desktop", "--no-provide-spaces"]);
+ args.extend(["--share", "none"]);
}
if stage == "download" {
args[2] = missing.to_str().unwrap();
@@ -4757,4 +4786,344 @@ mod tests {
// Already attached: left alone.
assert!(!attach_relay_account(&cua, || unreachable!()));
}
+
+ fn try_parse(args: &[&str]) -> Result<HostCmd, clap::Error> {
+ #[derive(clap::Parser)]
+ struct W {
+ #[command(subcommand)]
+ c: HostCmd,
+ }
+ <W as clap::Parser>::try_parse_from(std::iter::once("host").chain(args.iter().copied()))
+ .map(|w| w.c)
+ }
+
+ /// What a setup left on the machine: config and policy settings, and
+ /// whether the service runs without the desktop services.
+ type Seen = ((bool, bool), (bool, bool), bool);
+
+ fn seen(home: &Path, manager: &FakeServiceManager) -> Seen {
+ let host = Host::new(home);
+ let c = host.config().unwrap().unwrap();
+ let p = host.policy().unwrap().unwrap();
+ let spec = manager.spec.lock().unwrap().clone().unwrap();
+ (
+ (c.share_desktop, c.provide_spaces),
+ (p.share_desktop, p.provide_spaces),
+ spec.args.iter().any(|a| a == "--no-desktop"),
+ )
+ }
+
+ async fn setup_run(
+ home: &Path,
+ manager: &Arc<FakeServiceManager>,
+ args: &[&str],
+ json: bool,
+ ) -> Result<String, CuaError> {
+ let mut out = Vec::new();
+ run_host(
+ parse(args),
+ home,
+ &StaticToken("acct".into()),
+ None,
+ Some(manager.clone()),
+ json,
+ &mut out,
+ )
+ .await?;
+ Ok(String::from_utf8(out).unwrap())
+ }
+
+ fn fixture_driver(dir: &Path) -> PathBuf {
+ let driver = dir.join("drv");
+ std::fs::write(&driver, b"x").unwrap();
+ driver
+ }
+
+ /// Each `--share` value and each old flag spelling of it set up the
+ /// same host: config, driver policy and service arguments.
+ #[tokio::test]
+ async fn share_values_and_their_old_aliases_set_up_the_same_host() {
+ let relay = FakeRelay::start().await;
+ relay.add_account("acct", "user-1", Some("[email protected]"));
+ let rows: [(&[&[&str]], Seen); 3] = [
+ (
+ &[
+ &["--share", "desktop"],
+ &["--no-provide-spaces"],
+ &["--desktop", "--no-provide-spaces"],
+ ],
+ ((true, false), (true, false), false),
+ ),
+ (
+ &[
+ &["--share", "spaces"],
+ &["--profile", "spare"],
+ &["--no-desktop", "--provide-spaces"],
+ ],
+ ((false, true), (false, true), true),
+ ),
+ (
+ &[
+ &["--share", "both"],
+ &["--provide-spaces"],
+ &["--desktop", "--provide-spaces"],
+ &["--profile", "desktop", "--provide-spaces"],
+ ],
+ ((true, true), (true, true), false),
+ ),
+ ];
+ for (spellings, want) in rows {
+ for extra in spellings {
+ let dir = tempfile::tempdir().unwrap();
+ let home = dir.path().join(".cua");
+ let driver = fixture_driver(dir.path());
+ let manager = Arc::new(FakeServiceManager::default());
+ let mut args = vec![
+ "setup",
+ "--relay",
+ &relay.url,
+ "--driver-bin",
+ driver.to_str().unwrap(),
+ ];
+ args.extend_from_slice(extra);
+ setup_run(&home, &manager, &args, true).await.unwrap();
+ assert_eq!(seen(&home, &manager), want, "relay {extra:?}");
+ }
+ }
+ // Direct mode needs no account.
+ let direct = |extra: &'static [&'static str]| async move {
+ let dir = tempfile::tempdir().unwrap();
+ let home = dir.path().join(".cua");
+ let driver = fixture_driver(dir.path());
+ let manager = Arc::new(FakeServiceManager::default());
+ let mut args = vec![
+ "setup",
+ "--direct",
+ "127.0.0.1:3211",
+ "--driver-bin",
+ driver.to_str().unwrap(),
+ ];
+ args.extend_from_slice(extra);
+ setup_run(&home, &manager, &args, true).await.unwrap();
+ seen(&home, &manager)
+ };
+ let share = direct(&["--share", "spaces"]).await;
+ assert_eq!(share, ((false, true), (false, true), true));
+ assert_eq!(share, direct(&["--profile", "spare"]).await);
+ }
+
+ /// `none` (and its old spelling) is refused before anything happens.
+ #[tokio::test]
+ async fn share_none_and_its_old_alias_refuse_before_registering() {
+ let relay = FakeRelay::start().await;
+ relay.add_account("acct", "user-1", None);
+ for extra in [
+ &["--share", "none"][..],
+ &["--no-desktop", "--no-provide-spaces"][..],
+ ] {
+ let dir = tempfile::tempdir().unwrap();
+ let home = dir.path().join(".cua");
+ let driver = fixture_driver(dir.path());
+ let manager = Arc::new(FakeServiceManager::default());
+ let mut args = vec![
+ "setup",
+ "--relay",
+ &relay.url,
+ "--driver-bin",
+ driver.to_str().unwrap(),
+ ];
+ args.extend_from_slice(extra);
+ let e = setup_run(&home, &manager, &args, true).await.unwrap_err();
+ assert!(matches!(e, CuaError::InvalidArgument(_)), "{e:?}");
+ assert_eq!(crate::exit_code(&e), 2);
+ let text = e.to_string();
+ assert!(text.contains("host setup failed at preflight:"), "{text}");
+ assert!(
+ text.contains("use --share desktop, spaces or both"),
+ "{text}"
+ );
+ assert!(!home.join("host").join("config.json").exists());
+ assert!(manager.calls.lock().unwrap().is_empty());
+ }
+ assert_eq!(relay.register_calls(), 0);
+ }
+
+ #[test]
+ fn share_conflicts_with_the_old_flags_and_rejects_other_values() {
+ for old in [
+ &["--profile", "spare"][..],
+ &["--desktop"][..],
+ &["--no-desktop"][..],
+ &["--provide-spaces"][..],
+ &["--no-provide-spaces"][..],
+ ] {
+ let mut args = vec!["setup", "--share", "both"];
+ args.extend_from_slice(old);
+ let e = try_parse(&args).unwrap_err();
+ assert_eq!(
+ e.kind(),
+ clap::error::ErrorKind::ArgumentConflict,
+ "{old:?}"
+ );
+ }
+ let e = try_parse(&["setup", "--share", "some"]).unwrap_err();
+ assert_eq!(e.kind(), clap::error::ErrorKind::InvalidValue);
+ assert!(
+ e.to_string()
+ .contains("[possible values: desktop, spaces, both, none]")
+ );
+ match try_parse(&["setup", "--pair", "K7QM-4XPB-2RHD", "--share", "spaces"]).unwrap() {
+ HostCmd::Setup { pair, share, .. } => assert_eq!(
+ (pair.as_deref(), share),
+ (Some("K7QM-4XPB-2RHD"), Some(HostShare::Spaces))
+ ),
+ other => panic!("{other:?}"),
+ }
+ // Help shows only --share.
+ let help = <HostCmd as clap::Subcommand>::augment_subcommands(clap::Command::new("host"))
+ .find_subcommand_mut("setup")
+ .unwrap()
+ .render_long_help()
+ .to_string();
+ assert!(help.contains("--share"), "{help}");
+ for old in [
+ "--profile",
+ "--no-desktop",
+ "--provide-spaces",
+ "--no-provide-spaces",
+ ] {
+ assert!(!help.contains(old), "{old} is hidden: {help}");
+ }
+ }
+
+ /// A computer configured to share nothing (`host config`) still refuses
+ /// `--share none`; the unchanged shortcut must not answer for it.
+ #[tokio::test]
+ #[allow(clippy::await_holding_lock)]
+ async fn share_none_is_refused_even_by_a_host_configured_to_share_nothing() {
+ let _env = crate::util::test_env::isolated();
+ let relay = FakeRelay::start().await;
+ relay.add_account("acct", "user-1", None);
+ let dir = tempfile::tempdir().unwrap();
+ let home = dir.path().join(".cua");
+ let driver = fixture_driver(dir.path());
+ // SAFETY: test_env::isolated holds the environment lock.
+ unsafe { std::env::set_var("CUA_SPACESD_BIN", &driver) };
+ let manager = Arc::new(FakeServiceManager::default());
+ setup_run(&home, &manager, &["setup", "--relay", &relay.url], true)
+ .await
+ .unwrap();
+ Host::new(&home)
+ .with_service_manager(manager.clone())
+ .configure(cua_host::HostSettingsChange {
+ share_desktop: Some(false),
+ provide_spaces: Some(false),
+ ..Default::default()
+ })
+ .await
+ .unwrap();
+ let e = setup_run(
+ &home,
+ &manager,
+ &["setup", "--relay", &relay.url, "--share", "none"],
+ true,
+ )
+ .await
+ .unwrap_err();
+ assert_eq!(crate::exit_code(&e), 2, "{e}");
+ assert!(
+ e.to_string()
+ .contains("use --share desktop, spaces or both"),
+ "{e}"
+ );
+ }
+
+ /// Setup again with `--share` applies both settings, and changes
+ /// nothing when they already match.
+ #[tokio::test]
+ #[allow(clippy::await_holding_lock)]
+ async fn setup_again_with_share_applies_only_a_change() {
+ let _env = crate::util::test_env::isolated();
+ let relay = FakeRelay::start().await;
+ relay.add_account("acct", "user-1", None);
+ let dir = tempfile::tempdir().unwrap();
+ let home = dir.path().join(".cua");
+ let driver = fixture_driver(dir.path());
+ // SAFETY: test_env::isolated holds the environment lock.
+ unsafe { std::env::set_var("CUA_SPACESD_BIN", &driver) };
+ let manager = Arc::new(FakeServiceManager::default());
+ let run = |share: &'static str| {
+ let (home, manager, url) = (home.clone(), manager.clone(), relay.url.clone());
+ async move {
+ setup_run(
+ &home,
+ &manager,
+ &["setup", "--relay", &url, "--share", share],
+ true,
+ )
+ .await
+ .unwrap()
+ }
+ };
+ let both = ((true, true), (true, true), false);
+ run("both").await;
+ assert_eq!(seen(&home, &manager), both);
+ assert_eq!(relay.register_calls(), 1);
+ let out = run("both").await;
+ assert!(out.contains("\"changed\":false"), "{out}");
+ assert_eq!((seen(&home, &manager), relay.register_calls()), (both, 1));
+ run("spaces").await;
+ assert_eq!(seen(&home, &manager), ((false, true), (false, true), true));
+ assert_eq!(relay.register_calls(), 2);
+ run("both").await;
+ assert_eq!(seen(&home, &manager), both);
+ assert_eq!(relay.register_calls(), 3);
+ run("desktop").await;
+ assert_eq!(seen(&home, &manager), ((true, false), (true, false), false));
+ }
+
+ /// The old flags re-run exactly as before `--share`: a flag that does
+ /// not name the desktop is not checked against it.
+ #[tokio::test]
+ #[allow(clippy::await_holding_lock)]
+ async fn old_flags_on_a_rerun_keep_mains_behaviour() {
+ let _env = crate::util::test_env::isolated();
+ let relay = FakeRelay::start().await;
+ relay.add_account("acct", "user-1", None);
+ let dir = tempfile::tempdir().unwrap();
+ let driver = fixture_driver(dir.path());
+ // SAFETY: test_env::isolated holds the environment lock.
+ unsafe { std::env::set_var("CUA_SPACESD_BIN", &driver) };
+ let url = relay.url.clone();
+ let run =
+ |home: PathBuf, manager: Arc<FakeServiceManager>, flags: &'static [&'static str]| {
+ let url = url.clone();
+ async move {
+ let mut args = vec!["setup", "--relay", &url];
+ args.extend_from_slice(flags);
+ setup_run(&home, &manager, &args, true).await.unwrap()
+ }
+ };
+ let spare = ((false, true), (false, true), true);
+ let home = dir.path().join("a");
+ let manager = Arc::new(FakeServiceManager::default());
+ run(home.clone(), manager.clone(), &["--profile", "spare"]).await;
+ assert_eq!(seen(&home, &manager), spare);
+ let calls = relay.register_calls();
+ let out = run(home.clone(), manager.clone(), &["--provide-spaces"]).await;
+ assert!(out.contains("\"changed\":false"), "{out}");
+ assert_eq!(
+ (seen(&home, &manager), relay.register_calls()),
+ (spare, calls)
+ );
+ run(home.clone(), manager.clone(), &["--no-provide-spaces"]).await;
+ assert_eq!(seen(&home, &manager), ((true, false), (true, false), false));
+ assert_eq!(relay.register_calls(), calls + 1);
+
+ let home = dir.path().join("b");
+ let manager = Arc::new(FakeServiceManager::default());
+ run(home.clone(), manager.clone(), &["--no-provide-spaces"]).await;
+ run(home.clone(), manager.clone(), &["--provide-spaces"]).await;
+ assert_eq!(seen(&home, &manager), ((true, true), (true, true), false));
+ }
}
diff --git a/libs/cua/crates/cua-cli/src/lib.rs b/libs/cua/crates/cua-cli/src/lib.rs
index 5a35452fbb..6a1d74132d 100644
--- a/libs/cua/crates/cua-cli/src/lib.rs
+++ b/libs/cua/crates/cua-cli/src/lib.rs
@@ -2755,7 +2755,7 @@ Examples:
cua host setup --direct 0.0.0.0:3211 --name studio-mac
# A spare Mac on your tailnet that runs Spaces, without a relay
# (prints the command that adds it on your laptop)
- cua host setup --direct 100.101.102.103:3211 --profile spare
+ cua host setup --direct 100.101.102.103:3211 --share spaces
";
/// The command `cua` parses with, named for `channel`. Stable's is `cli`
diff --git a/libs/cua/crates/cua-cli/src/onboard.rs b/libs/cua/crates/cua-cli/src/onboard.rs
index 248bb93f22..135a3c2e33 100644
--- a/libs/cua/crates/cua-cli/src/onboard.rs
+++ b/libs/cua/crates/cua-cli/src/onboard.rs
@@ -378,7 +378,7 @@ pub fn machines_table(v: &Value) -> Vec<String> {
}
if machines.is_empty() {
rows.push(crate::util::hint(
- "No hosts yet: `cua host setup --no-desktop --provide-spaces` here, `cua host pair` for another computer.",
+ "No hosts yet: `cua host setup --share spaces` here, `cua host pair` for another computer.",
));
}
rows
diff --git a/libs/cua/crates/cua-cli/src/util.rs b/libs/cua/crates/cua-cli/src/util.rs
index fe9220ea40..f803715567 100644
--- a/libs/cua/crates/cua-cli/src/util.rs
+++ b/libs/cua/crates/cua-cli/src/util.rs
@@ -537,8 +537,9 @@ mod secret_tests {
#[cfg(test)]
pub mod test_env {
static LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
- const VARS: [&str; 4] = [
+ const VARS: [&str; 5] = [
"CUA_HOME",
+ "CUA_SPACESD_BIN",
"CUA_DEFAULT_ON",
"CUA_DEFAULT_KIND",
"CUA_DEFAULT_RUNTIME",
diff --git a/libs/cua/crates/cua-host/src/host.rs b/libs/cua/crates/cua-host/src/host.rs
index 5cb497521c..5e6ecad855 100644
--- a/libs/cua/crates/cua-host/src/host.rs
+++ b/libs/cua/crates/cua-host/src/host.rs
@@ -1348,8 +1348,8 @@ impl Host {
let provide_spaces = self.resolve_provide_spaces(&opts);
if !opts.share_desktop && !provide_spaces {
return Err(Error::InvalidArgument(
- "with neither the desktop nor Spaces there is nothing to share; turn on \
- --desktop or --provide-spaces"
+ "with neither the desktop nor Spaces there is nothing to share; use \
+ --share desktop, spaces or both"
.into(),
));
}
diff --git a/libs/cua/crates/cua-spaces-contract/src/inputs.rs b/libs/cua/crates/cua-spaces-contract/src/inputs.rs
index 3c23243a09..fa5dc281eb 100644
--- a/libs/cua/crates/cua-spaces-contract/src/inputs.rs
+++ b/libs/cua/crates/cua-spaces-contract/src/inputs.rs
@@ -155,7 +155,7 @@ pub struct CreateSpace {
/// only when connected and no computer has room), `aws`, `gcp` or
/// `modal` (your own cloud account, billed there), or `host:<computer>`:
/// one of the user's own computers that
- /// provides Spaces (`cua host setup --provide-spaces` on it), named by
+ /// provides Spaces (`cua host setup --share both` on it), named by
/// id or by words from its name ("host:spare mac mini" matches "Mac
/// mini (spare)" or `dillons-mac-mini`). Default: the user's default
/// location (`cua config set default.on`, `CUA_DEFAULT_ON`), else
diff --git a/libs/cua/crates/cua-spaces-contract/src/lib.rs b/libs/cua/crates/cua-spaces-contract/src/lib.rs
index 99c10f17ca..987bbd7450 100644
--- a/libs/cua/crates/cua-spaces-contract/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-contract/src/lib.rs
@@ -780,7 +780,7 @@ pub fn tools() -> Vec<Tool> {
"ambiguous_host",
"limit_exceeded",
],
- instructions: "Creates a new sandbox where `on` says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries `cloud` and `cloud_place`, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:<name>. Cua Cloud (on=\"cloud\") has ended and fails with an error that says so. `kind` (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and `runtime` (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on=\"auto\" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on=\"host:<computer>\" creates the Space on a computer set up with `cua host setup --provide-spaces` (for example \"spin up 2 macOS Spaces on my spare Mac mini\" is on=\"host:spare mac mini\", image=\"macos\", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on=\"host:<id>\"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:<computer> with `host` set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on=\"direct:<addr>\" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on=\"auto\") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with `durable`, and delete_space deletes it for good.",
+ instructions: "Creates a new sandbox where `on` says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries `cloud` and `cloud_place`, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:<name>. Cua Cloud (on=\"cloud\") has ended and fails with an error that says so. `kind` (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and `runtime` (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on=\"auto\" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on=\"host:<computer>\" creates the Space on a computer set up with `cua host setup --share both` (for example \"spin up 2 macOS Spaces on my spare Mac mini\" is on=\"host:spare mac mini\", image=\"macos\", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on=\"host:<id>\"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:<computer> with `host` set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on=\"direct:<addr>\" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on=\"auto\") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with `durable`, and delete_space deletes it for good.",
providers: &CREATE_PROVIDERS,
metering: Metering::Cloud,
capabilities: &["space.create"],
diff --git a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts
index f376d90fbf..616347cd5a 100644
--- a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts
+++ b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts
@@ -1739,7 +1739,7 @@ export const ThreadViewSchema: GenMessage<ThreadView> = /*@__PURE__*/
/**
* Spaces a host provides: a machine set up with `cua host setup
- * --provide-spaces` creates Spaces (macOS VMs with Lume on a Mac, Linux
+ * --share both` creates Spaces (macOS VMs with Lume on a Mac, Linux
* containers with Docker, whatever else runs locally) for the owner's
* enrolled devices and the accounts it is shared with, through the relay.
*
@@ -1754,7 +1754,7 @@ export const ThreadViewSchema: GenMessage<ThreadView> = /*@__PURE__*/
* With `share_desktop` off, a relayed caller reaches only this service and
* `GetCapabilities` / `Health`, never the host's desktop or files.
*
- * A host set up with `cua host setup --direct <ip:port> --provide-spaces`
+ * A host set up with `cua host setup --direct <ip:port> --share both`
* also serves it on its direct listener, to the holder of its env token,
* by default only from loopback, Tailscale and private LAN addresses. A
* Space created with `direct` is reached on a TCP port the host forwards
diff --git a/libs/cua/proto/cua/env/v1/host.proto b/libs/cua/proto/cua/env/v1/host.proto
index cf34866e5e..4a31c90726 100644
--- a/libs/cua/proto/cua/env/v1/host.proto
+++ b/libs/cua/proto/cua/env/v1/host.proto
@@ -9,7 +9,7 @@ import "cua/env/v1/system.proto";
import "cua/env/v1/warm.proto";
// Spaces a host provides: a machine set up with `cua host setup
-// --provide-spaces` creates Spaces (macOS VMs with Lume on a Mac, Linux
+// --share both` creates Spaces (macOS VMs with Lume on a Mac, Linux
// containers with Docker, whatever else runs locally) for the owner's
// enrolled devices and the accounts it is shared with, through the relay.
//
@@ -24,7 +24,7 @@ import "cua/env/v1/warm.proto";
// With `share_desktop` off, a relayed caller reaches only this service and
// `GetCapabilities` / `Health`, never the host's desktop or files.
//
-// A host set up with `cua host setup --direct <ip:port> --provide-spaces`
+// A host set up with `cua host setup --direct <ip:port> --share both`
// also serves it on its direct listener, to the holder of its env token,
// by default only from loopback, Tailscale and private LAN addresses. A
// Space created with `direct` is reached on a TCP port the host forwards
diff --git a/libs/cua/skills/cua-spaces/SKILL.md b/libs/cua/skills/cua-spaces/SKILL.md
index 9d5a1f3751..3f8b399873 100644
--- a/libs/cua/skills/cua-spaces/SKILL.md
+++ b/libs/cua/skills/cua-spaces/SKILL.md
@@ -64,7 +64,7 @@ user's Tailscale, or the LAN):
3. Sign in on the mini: `cua auth login --remote` prints a device code and a
URL. Show both to the user and have them approve it (on another signed-in
device or at the URL).
-4. `cua host setup --profile spare --name "<name>"` hosts Spaces only (no
+4. `cua host setup --share spaces --name "<name>"` hosts Spaces only (no
desktop sharing), through the cua.ai relay.
5. Tell the user: the mini needs an active GUI login session (cua-spacesd
runs as a LaunchAgent in the Aqua session, so it won't start at the
diff --git a/libs/cua/spaces-contract/manifest.json b/libs/cua/spaces-contract/manifest.json
index 79fd8ec7c1..fd76026bdc 100644
--- a/libs/cua/spaces-contract/manifest.json
+++ b/libs/cua/spaces-contract/manifest.json
@@ -424,7 +424,7 @@
"name": "create_space",
"category": "lifecycle",
"description": "Create a Space: a new sandbox on this computer, on one of your computers, or in the cloud.",
- "instructions": "Creates a new sandbox where `on` says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries `cloud` and `cloud_place`, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:<name>. Cua Cloud (on=\"cloud\") has ended and fails with an error that says so. `kind` (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and `runtime` (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on=\"auto\" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on=\"host:<computer>\" creates the Space on a computer set up with `cua host setup --provide-spaces` (for example \"spin up 2 macOS Spaces on my spare Mac mini\" is on=\"host:spare mac mini\", image=\"macos\", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on=\"host:<id>\"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:<computer> with `host` set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on=\"direct:<addr>\" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on=\"auto\") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with `durable`, and delete_space deletes it for good.",
+ "instructions": "Creates a new sandbox where `on` says (local: this computer, free; aws, azure, gcp, hetzner or modal: the user's own cloud account, connected with cloud_connect, billed there; default: the user's default location, else local; with no location and none configured, when a linked cloud has a budget set with cloud_budget, this computer first and the linked clouds when it is full, never past the budget, unless placement.overflow is off; a Space that landed in the user's cloud carries `cloud` and `cloud_place`, the pool host and its price, so say so), waits until it is ready (its spacesd when the image runs one, else its declared services), and registers it as local:<name>. Cua Cloud (on=\"cloud\") has ended and fails with an error that says so. `kind` (auto, container, vm, microvm: the container image with its own kernel, never picked by auto) and `runtime` (auto, or an engine the location offers for the kind) are chosen automatically by default: the canonical Linux image runs as a gVisor container, macOS images as Lume VMs, Windows and disk-only images as VMs (QEMU locally, KubeVirt in the cloud). An impossible combination fails with invalid_placement and lists the valid values. Any image works; without cua-spacesd the capability set is empty. reuse=true returns a reachable registered Space in the same location with the requested services instead of creating one. On the user's own computers: on=\"auto\" creates it on the least-loaded one that can take it (this computer or one signed in to the user's account that provides Spaces; the host refuses when full and the next is asked); on=\"host:<computer>\" creates the Space on a computer set up with `cua host setup --share both` (for example \"spin up 2 macOS Spaces on my spare Mac mini\" is on=\"host:spare mac mini\", image=\"macos\", count=2). The computer is matched by id, exact name, or the words of its name; when several fit equally the call fails with ambiguous_host listing them (ask the user which, then pass on=\"host:<id>\"). The host runs it with its own runtimes (Lume for macOS VMs on a Mac, Docker for Linux), the Space joins the relay and is returned as relay:<computer> with `host` set. A Mac runs at most two macOS VMs (Apple's macOS license, enforced by Apple Virtualization); a host at a limit fails with limit_exceeded. Only the computer's owner and the accounts it is shared with as editors can create there, from an enrolled device. on=\"direct:<addr>\" is not accepted here: a direct address is one already-running Space, attached with add_space, not a host this call can create on. durable=true (with on=\"auto\") keeps the Space on the user's computers: when its computer goes away it is created again on another one with the same name (its disk starts fresh), list_spaces shows it with `durable`, and delete_space deletes it for good.",
"platforms": [
"macos",
"windows",
@@ -531,7 +531,7 @@
"type": "string"
},
"on": {
- "description": "Where it runs: `local` (this computer, free), `auto` (the\nleast-loaded of the user's computers that can take it: this one and\nthe ones signed in to the user's account that provide Spaces, Modal\nonly when connected and no computer has room), `aws`, `gcp` or\n`modal` (your own cloud account, billed there), or `host:<computer>`:\none of the user's own computers that\nprovides Spaces (`cua host setup --provide-spaces` on it), named by\nid or by words from its name (\"host:spare mac mini\" matches \"Mac\nmini (spare)\" or `dillons-mac-mini`). Default: the user's default\nlocation (`cua config set default.on`, `CUA_DEFAULT_ON`), else\n`local`; never `auto` unless asked. Not `direct:<addr>`: that is one already-running Space at a\nfixed address, attached with `add_space`, not a host this can create\non. An existing computer is added with `add_space`, not created.",
+ "description": "Where it runs: `local` (this computer, free), `auto` (the\nleast-loaded of the user's computers that can take it: this one and\nthe ones signed in to the user's account that provide Spaces, Modal\nonly when connected and no computer has room), `aws`, `gcp` or\n`modal` (your own cloud account, billed there), or `host:<computer>`:\none of the user's own computers that\nprovides Spaces (`cua host setup --share both` on it), named by\nid or by words from its name (\"host:spare mac mini\" matches \"Mac\nmini (spare)\" or `dillons-mac-mini`). Default: the user's default\nlocation (`cua config set default.on`, `CUA_DEFAULT_ON`), else\n`local`; never `auto` unless asked. Not `direct:<addr>`: that is one already-running Space at a\nfixed address, attached with `add_space`, not a host this can create\non. An existing computer is added with `add_space`, not created.",
"type": "string"
},
"region": {
diff --git a/scripts/docs-generators/cli-specs/cua.json b/scripts/docs-generators/cli-specs/cua.json
index c503eee100..236c883a7f 100644
--- a/scripts/docs-generators/cli-specs/cua.json
+++ b/scripts/docs-generators/cli-specs/cua.json
@@ -12949,8 +12949,8 @@
"subcommand_optional": false,
"subcommands": [
{
- "abstract": "Set this computer up for unattended access: install cua-spacesd as a service that joins the cua.ai relay as your account (default) or serves on a direct ip:port. By default (the `desktop` profile) it shares this computer's desktop and, on a computer set up for the first time through the relay, provides Spaces to your devices (a host in your pool: `cua run` jobs and `--on auto` Spaces can run here, within its limits); `--no-provide-spaces` leaves that off, and `cua host config --provide-spaces off` turns it off later. A computer set up before keeps what it provides. `--profile spare` or `--no-desktop` provides Spaces only, so its own desktop stays private. Running it again with the same options changes nothing (a stopped service starts again)",
- "after_help": "Examples:\n # Join the cua.ai relay as your account (shares this desktop and\n # provides Spaces to your devices)\n cua host setup\n # Share this desktop only\n cua host setup --no-provide-spaces\n # A spare computer: do not share its desktop, run Spaces for your devices\n cua host setup --profile spare --name \"Mac mini (spare)\"\n cua host setup --no-desktop --provide-spaces\n # Add this computer with a one-time code from the Cua Spaces app\n # (Add a computer) or `cua host pair`: no sign-in needed here\n cua host setup --pair K7QM-4XPB-2RHD\n # Keep this computer off the end-to-end encrypted mesh (relay HTTPS only):\n # run setup with CUA_MESH=off in the environment\n # Self-hosting teams: cua help advanced",
+ "abstract": "Set this computer up for unattended access: install cua-spacesd as a service that joins the cua.ai relay as your account (default) or serves on a direct ip:port. By default it shares this computer's desktop and, on a computer set up for the first time through the relay, provides Spaces to your devices (a host in your pool: `cua run` jobs and `--on auto` Spaces can run here, within its limits). `--share` picks what it shares: `desktop`, `spaces` (its own desktop stays private), `both` or `none`; `cua host config` changes it later. A computer set up before keeps what it provides. Running it again with the same options changes nothing (a stopped service starts again)",
+ "after_help": "Examples:\n # Join the cua.ai relay as your account (shares this desktop and\n # provides Spaces to your devices)\n cua host setup\n # Share this desktop only\n cua host setup --share desktop\n # A spare computer: do not share its desktop, run Spaces for your devices\n cua host setup --share spaces --name \"Mac mini (spare)\"\n # Add this computer with a one-time code from the Cua Spaces app\n # (Add a computer) or `cua host pair`: no sign-in needed here\n cua host setup --pair K7QM-4XPB-2RHD\n # Keep this computer off the end-to-end encrypted mesh (relay HTTPS only):\n # run setup with CUA_MESH=off in the environment\n # Self-hosting teams: cua help advanced",
"aliases": [],
"arguments": [],
"flags": [
@@ -12969,8 +12969,8 @@
"aliases": [],
"default_value": false,
"env": null,
- "help": "Share this computer's own desktop as a Space",
- "hidden": false,
+ "help": "Hidden alias of the desktop half of `--share`",
+ "hidden": true,
"name": "desktop",
"repeatable": false,
"short_name": null,
@@ -12980,8 +12980,8 @@
"aliases": [],
"default_value": false,
"env": null,
- "help": "Do not share this computer's own desktop (screen, input, shell, files): relayed callers reach only the Spaces it provides",
- "hidden": false,
+ "help": "Hidden alias of `--share spaces` with `--provide-spaces`",
+ "hidden": true,
"name": "no-desktop",
"repeatable": false,
"short_name": null,
@@ -12991,8 +12991,8 @@
"aliases": [],
"default_value": false,
"env": null,
- "help": "Create Spaces for your enrolled devices on this computer's runtimes (Lume macOS VMs, Docker Linux containers). The default for a new relay setup; a computer set up before keeps its setting unless this (or `--no-provide-spaces`) is given. On its own it keeps the default `desktop` profile, so this computer's desktop is shared too; add `--no-desktop` (or use `--profile spare`) to provide Spaces only",
- "hidden": false,
+ "help": "Hidden alias: with the default profile, `--share both`",
+ "hidden": true,
"name": "provide-spaces",
"repeatable": false,
"short_name": null,
@@ -13002,8 +13002,8 @@
"aliases": [],
"default_value": false,
"env": null,
- "help": "Do not create Spaces for other devices (only share this desktop)",
- "hidden": false,
+ "help": "Hidden alias: with the default profile, `--share desktop`",
+ "hidden": true,
"name": "no-provide-spaces",
"repeatable": false,
"short_name": null,
@@ -13163,10 +13163,31 @@
"aliases": [],
"default_value": null,
"env": null,
- "help": "What this computer is for: `desktop` (share this desktop, and provide Spaces on a new relay setup; the default) or `spare` (do not share the desktop; provide Spaces)",
+ "help": "What this computer shares: its own desktop (screen, input, shell, files), the Spaces it creates for your enrolled devices (Lume macOS VMs, Docker Linux containers), both, or neither (refused). Default: the desktop, plus Spaces on a new relay setup; a computer set up before keeps what it provides",
"hidden": false,
"is_optional": true,
"multiple_values": false,
+ "name": "share",
+ "possible_values": [
+ "desktop",
+ "spaces",
+ "both",
+ "none"
+ ],
+ "repeatable": false,
+ "short_name": null,
+ "takes_value": true,
+ "type": "desktop | spaces | both | none",
+ "value_name": "WHAT"
+ },
+ {
+ "aliases": [],
+ "default_value": null,
+ "env": null,
+ "help": "Hidden alias: `--share spaces` is `--profile spare`",
+ "hidden": true,
+ "is_optional": true,
+ "multiple_values": false,
"name": "profile",
"possible_values": [
"desktop",
@@ -13716,7 +13737,7 @@
},
{
"abstract": "Register a Space after a capabilities handshake with its cua-spacesd (or, for another URL, an MCP initialize). Re-adding an address updates it. The token is stored apart from the registry, 0600",
- "after_help": "Examples:\n cua spaces add 10.0.0.5:3211 --token \"$TOKEN\" --name studio\n cua spaces add local:my-sandbox\n cua spaces add http://127.0.0.1:8765/mcp --service tools\n # A computer that provides Spaces over Tailscale, without the relay\n # (`cua host setup --direct ... --provide-spaces` on it prints this)\n cua spaces add 100.101.102.103:3211 --host --name \"Mac mini (spare)\" --token \"$TOKEN\"",
+ "after_help": "Examples:\n cua spaces add 10.0.0.5:3211 --token \"$TOKEN\" --name studio\n cua spaces add local:my-sandbox\n cua spaces add http://127.0.0.1:8765/mcp --service tools\n # A computer that provides Spaces over Tailscale, without the relay\n # (`cua host setup --direct ... --share both` on it prints this)\n cua spaces add 100.101.102.103:3211 --host --name \"Mac mini (spare)\" --token \"$TOKEN\"",
"aliases": [],
"arguments": [
{
@@ -13801,7 +13822,7 @@
"usage": "cua spaces add [OPTIONS] <URL>"
},
{
- "abstract": "Create Spaces: on this computer, on one of your computers that provides Spaces (`cua host setup --no-desktop --provide-spaces` there), or in your own cloud account",
+ "abstract": "Create Spaces: on this computer, on one of your computers that provides Spaces (`cua host setup --share spaces` there), or in your own cloud account",
"after_help": "Examples:\n cua spaces create linux\n # On the least-loaded of your machines\n cua spaces create linux --on auto\n # Two macOS VMs on your spare Mac mini (matched by name)\n cua spaces create macos:26 --on \"spare mac mini\" --count 2\n cua spaces create --on host:0123abcd4567ef89 linux --json\n # Kept on your machines: created again on another one if its machine goes away\n cua spaces create linux --on auto --durable --name research\n # In your AWS account, on a pool host of exactly this type and region\n cua spaces create linux --on aws --instance-type c7g.xlarge --region us-west-2\n # Labels are kept with the Space; `cua spaces ls --label team=research` filters\n cua spaces create linux --label team=research --label run=7",
"aliases": [],
"arguments": [
diff --git a/scripts/docs-generators/cua-cli.ts b/scripts/docs-generators/cua-cli.ts
index 362be35e14..8605839488 100644
--- a/scripts/docs-generators/cua-cli.ts
+++ b/scripts/docs-generators/cua-cli.ts
@@ -140,7 +140,7 @@ export const CLI_GROUPS: CliGroup[] = [
slug: 'pool',
title: 'Your pool',
summary:
- 'Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --no-desktop --provide-spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them',
+ 'Run Python functions on your pool, each member in a Space (`cua run`, `cua jobs`). Computers join with `cua host setup --share spaces` (or `--pair CODE` from `cua host pair`) and `cua cloud add aws`; `cua computers` lists them',
commands: ['computers', 'run', 'jobs', 'compat'],
},
{
diff --git a/scripts/docs-generators/proto.ts b/scripts/docs-generators/proto.ts
index cead4de3d5..d0f07ce408 100644
--- a/scripts/docs-generators/proto.ts
+++ b/scripts/docs-generators/proto.ts
@@ -178,7 +178,7 @@ export const PAGES: PageSpec[] = [
description:
'cua.env.v1 HostSpacesService: Spaces a host creates for its owner\'s devices through the relay.',
intro:
- 'Spaces a machine set up with `cua host setup --provide-spaces` creates for its owner\'s enrolled devices: settings, capacity, create and delete. The host\'s cua-spacesd forwards each call to its cua daemon. What a host reports for placement is on [Host capacity](/cua-sdk/reference/protocol/env-host-capacity).',
+ 'Spaces a machine set up with `cua host setup --share both` creates for its owner\'s enrolled devices: settings, capacity, create and delete. The host\'s cua-spacesd forwards each call to its cua daemon. What a host reports for placement is on [Host capacity](/cua-sdk/reference/protocol/env-host-capacity).',
files: ['cua/env/v1/host.proto'],
},
{