Skip to content

Commit 9387491

Browse files
authored
refactor(nodes)!: retire arming leases for durable capability enablement (#114892)
* refactor(nodes): retire phone control leases * fix(doctor): clean retired phone control state * docs(nodes): document durable capability enablement * docs(changelog): defer node enablement note * fix(doctor): harden retired phone control cleanup * fix(doctor): fail closed on unreadable lease state * fix(doctor): validate retired lease journals * fix(doctor): preserve deny-shadowed consent * docs: refresh node authorization map * fix(doctor): keep retirement helpers private
1 parent 77e1f21 commit 9387491

44 files changed

Lines changed: 987 additions & 2560 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎config/max-lines-baseline.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ extensions/openai/realtime-voice-provider.ts
200200
extensions/openrouter/index.test.ts
201201
extensions/openshell/src/backend.ts
202202
extensions/openshell/src/openshell-core.test.ts
203-
extensions/phone-control/index.test.ts
204203
extensions/policy/src/cli.test.ts
205204
extensions/policy/src/doctor/register.base.test-utils.ts
206205
extensions/policy/src/doctor/register.gateway-data-and-approvals.test-utils.ts

‎docs/docs_map.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5005,7 +5005,7 @@ Do not edit it by hand; run `pnpm docs:map:gen`.
50055005
- H2: Windows and Linux (experimental, via cua-driver)
50065006
- H3: Troubleshooting
50075007
- H2: The computer.act node command
5008-
- H2: Enable and arm
5008+
- H2: Authorization
50095009
- H2: Safety
50105010
- H2: Relationship to other desktop-control paths
50115011

‎docs/gateway/config-channels.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ Include your own number in `allowFrom` to enable self-chat mode (ignores native
933933
<Accordion title="Command details">
934934

935935
- This block configures command surfaces. For the current built-in + bundled command catalog, see [Slash Commands](/tools/slash-commands).
936-
- This page is a **config-key reference**, not the full command catalog. Channel/plugin-owned commands such as QQ Bot `/bot-ping` `/bot-help` `/bot-logs`, LINE `/card`, device-pair `/pair`, memory `/dreaming`, phone-control `/phone`, and Talk `/voice` are documented in their channel/plugin pages plus [Slash Commands](/tools/slash-commands).
936+
- This page is a **config-key reference**, not the full command catalog. Channel/plugin-owned commands such as QQ Bot `/bot-ping` `/bot-help` `/bot-logs`, LINE `/card`, device-pair `/pair`, memory `/dreaming`, and Talk `/voice` are documented in their channel/plugin pages plus [Slash Commands](/tools/slash-commands).
937937
- Text commands must be **standalone** messages with leading `/`.
938938
- `native: "auto"` turns on native commands for Discord/Telegram, leaves Slack off.
939939
- `nativeSkills: "auto"` turns on native skill commands for Discord/Telegram, leaves Slack off.

‎docs/gateway/configuration-reference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ See [Plugins](/tools/plugin).
692692
- `allowRealIpFallback`: when `true`, the gateway accepts `X-Real-IP` if `X-Forwarded-For` is missing. Default `false` for fail-closed behavior.
693693
- `gateway.nodes.pairing.autoApproveCidrs`: optional CIDR/IP allowlist for auto-approving first-time node device pairing with no requested scopes. It is disabled when unset. This does not auto-approve operator/browser/Control UI/WebChat pairing, and it does not auto-approve role, scope, metadata, or public-key upgrades.
694694
- `gateway.nodes.pairing.sshVerify`: SSH-verified auto-approval for first-time node device pairing (default: enabled). The gateway SSHes back to the pairing host (BatchMode, strict host keys) and approves only on an exact `openclaw node identity` device-key match. Same eligibility floor as `autoApproveCidrs`; probes are limited to private/CGNAT source addresses unless `cidrs` overrides them. Set `false` to disable, or `{ user, identity, timeoutMs, cidrs }` to tune. See [Node pairing](/gateway/pairing#ssh-verified-device-auto-approval-default).
695-
- `gateway.nodes.commands.allow` / `gateway.nodes.commands.deny`: global allow/deny shaping for declared node commands after pairing and platform allowlist evaluation. Use `commands.allow` to opt into dangerous node commands such as `camera.snap`, `camera.clip`, `screen.record`, `health.summary`, `sms.search`, and `sms.send`; `commands.deny` removes a command even if a platform default or explicit allow would otherwise include it. iOS Health permission, Android SMS permission, and Gateway command authorization are independent. After a node changes its declared command list, reject and re-approve that device pairing so the gateway stores the updated command snapshot.
695+
- `gateway.nodes.commands.allow` / `gateway.nodes.commands.deny`: global allow/deny shaping for declared node commands after pairing and platform allowlist evaluation. `commands.allow` is the one-time persistent enable for classified commands such as `camera.snap`, `camera.clip`, `screen.record`, `health.summary`, `sms.search`, and `sms.send`; `commands.deny` removes a command even if a platform default or explicit allow would otherwise include it. Computer and mobile UI control instead rely on default-off node-local enablement plus pairing. iOS Health permission, Android SMS permission, and Gateway command authorization are independent. After a node changes its declared command list, reject and re-approve that device pairing so the gateway stores the updated command snapshot.
696696
- `gateway.tools.deny`: extra tool names blocked for HTTP `POST /tools/invoke` (extends default deny list).
697697
- `gateway.tools.allow`: remove tool names from the default HTTP deny list for
698698
owner/admin callers. This does not upgrade identity-bearing `operator.write`

‎docs/gateway/operator-scopes.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ command list:
120120
| ordinary node commands | `operator.pairing` + `operator.write` |
121121
| `system.run`, `system.run.prepare`, `system.which`, `browser.proxy`, `fs.listDir`, or `system.execApprovals.get/set` | `operator.pairing` + `operator.admin` |
122122

123-
Approving a node declaration does not enable commands that have a separate
124-
runtime allowlist gate. For example, approving a node that declares
125-
`computer.act` requires pairing plus write scope, but only records the surface.
126-
An administrator or owner must still arm `computer.act`. While it remains
127-
armed, invoking it through `node.invoke` requires write scope, but not admin
128-
scope for each action.
123+
Approving a node declaration records its command surface. For `computer.act`,
124+
the node advertises that surface only after Computer Control is enabled locally;
125+
once the pairing update is approved, invoking it through `node.invoke` requires
126+
write scope but not admin scope for each action. Commands classified as
127+
dangerous or privacy-heavy still require a persistent
128+
`gateway.nodes.commands.allow` entry in addition to pairing.
129129

130130
Node pairing establishes identity and trust; it does not replace a node's own
131131
`system.run` exec approval policy.

‎docs/nodes/computer-use.md‎

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
summary: "Capability-based desktop control through the computer tool and computer.act node command"
33
read_when:
44
- Letting the gateway agent see and control a paired desktop
5-
- Arming, permissions, or safety for computer use
5+
- Enablement, permissions, or safety for computer use
66
- Extending the computer.act node command or its fulfillers
77
title: "Computer use"
88
---
99

10-
Computer use lets the gateway agent see and control a capable paired desktop. Eligibility is capability-based: the connected node must advertise both `computer.act` and `screen.snapshot`, whose result must include a `displayFrameId`. The tool captures a screenshot as its reference frame, then drives the pointer and keyboard through the dangerous `computer.act` command. The action set follows the core Anthropic computer-use actions; optional `computer_20251124` zoom is not exposed. A vision-capable model drives it through the built-in `computer` agent tool.
10+
Computer use lets the gateway agent see and control a capable paired desktop. Eligibility is capability-based: the connected node must advertise both `computer.act` and `screen.snapshot`, whose result must include a `displayFrameId`. The tool captures a screenshot as its reference frame, then drives the pointer and keyboard through `computer.act`. The action set follows the core Anthropic computer-use actions; optional `computer_20251124` zoom is not exposed. A vision-capable model drives it through the built-in `computer` agent tool.
1111

12-
The agent emits one uniform command, `computer.act`; it cannot tell how a node fulfills it. The bundled macOS app handles the command in-process with embedded Peekaboo services plus narrow CoreGraphics primitives (correct TCC permissions, no extra process). Windows and Linux can use the optional, experimental `cua-computer` plugin with a separately installed `cua-driver` binary. Both fulfillers use the same pairing and arming policy.
12+
The agent emits one uniform command, `computer.act`; it cannot tell how a node fulfills it. The bundled macOS app handles the command in-process with embedded Peekaboo services plus narrow CoreGraphics primitives (correct TCC permissions, no extra process). Windows and Linux can use the optional, experimental `cua-computer` plugin with a separately installed `cua-driver` binary. Both fulfillers use the same durable local enablement and pairing policy.
1313

1414
## Requirements
1515

1616
- A paired, connected node advertising both `computer.act` and `screen.snapshot`, with `screen.snapshot` returning `displayFrameId`.
1717
- **macOS fulfiller:** app setting **Allow Computer Control** enabled (default: off).
1818
- **macOS fulfiller:** **Accessibility** permission granted to OpenClaw (for pointer/keyboard injection) and **Screen Recording** permission (for `screen.snapshot`).
1919
- **Windows/Linux fulfiller:** bundled `cua-computer` plugin enabled and a compatible `cua-driver` 0.10.x executable installed.
20-
- The `computer.act` command armed on the gateway (it is dangerous and disarmed by default).
20+
- The pairing update that includes `computer.act` approved on the gateway.
2121
- A vision-capable agent model.
2222
- Tool policy that exposes `computer`. The default `coding` profile does not. Add `computer` to `tools.alsoAllow`; sandboxed agents also need it in `tools.sandbox.tools.alsoAllow`.
2323

@@ -73,12 +73,12 @@ The `cua-computer` fulfiller surfaces typed error codes in the tool result and n
7373

7474
`computer.act` is the single node command the tool routes input through (`node.invoke` with `command: "computer.act"`). It is:
7575

76-
- **Dangerous by default**: listed in the built-in dangerous node commands and excluded from the runtime allowlist until explicitly armed. macOS, Windows, and Linux desktop nodes may still declare it at pairing so the surface is approved once.
76+
- **Locally enabled**: the node advertises it only while Computer Control is enabled. The gateway can approve that advertised surface once at pairing.
7777
- **Capability-based**: the tool requires a connected node to advertise both `computer.act` and `screen.snapshot`. The bundled macOS app and the opt-in experimental `cua-computer` plugin fulfill the same command pair.
7878

7979
Reads reuse `screen.snapshot`; there is no second capture path. See [Camera and screen nodes](/nodes/camera) for the shared capture command.
8080

81-
## Enable and arm
81+
## Authorization
8282

8383
1. Enable the platform fulfiller: on macOS, enable **Settings → Allow Computer Control**, then grant **Accessibility** and **Screen Recording** under **Settings → Permissions**; on Windows/Linux, follow the experimental `cua-computer` setup above.
8484
2. Approve the pairing update on the gateway (a new command forces re-pairing).
@@ -94,29 +94,13 @@ Reads reuse `screen.snapshot`; there is no second capture path. See [Camera and
9494
}
9595
```
9696

97-
4. Arm `computer.act` for a bounded window. The `phone-control` plugin exposes a `computer` group:
97+
Once the node-local control is enabled and the pairing update is approved, `computer.act` is durably available while the node continues to advertise it. There is no lease, expiry, or arm/disarm command. Disabling Computer Control locally removes the advertised command and the node rechecks the toggle at invocation time.
9898

99-
```text
100-
/phone arm computer 30m
101-
/phone status
102-
/phone disarm
103-
```
104-
105-
Arming requires `operator.admin` (or the owner) and auto-expires. The legacy `/phone arm all` group intentionally excludes desktop control; use the explicit `computer` group. Arming only toggles what the gateway may invoke; the node app still enforces its platform-specific settings and OS permissions, including **Allow Computer Control**, Accessibility, and Screen Recording on macOS.
106-
107-
For persistent authorization, add `computer.act` to `gateway.nodes.commands.allow` **and remove it from** `gateway.nodes.commands.deny`; the deny list wins. Persistent authorization does not auto-expire. Entries already present before `/phone arm` remain after `/phone disarm`; do not convert a temporary grant to persistent while it is armed.
108-
109-
Authorization is deliberately split between enabling and use. Arming or
110-
persistently configuring `computer.act` requires administrative authority.
111-
Once armed, an authenticated operator with `operator.write` can invoke
112-
`computer.act` through `node.invoke` until the grant expires or is disarmed;
113-
there is no per-action admin check. Approving a node that declares
114-
`computer.act` only records the surface so it can be armed later and does not
115-
enable invocation by itself.
99+
`gateway.nodes.commands.deny` remains an explicit global revocation and always wins. `computer.act` does not need a `gateway.nodes.commands.allow` entry. An authenticated operator with `operator.write` can invoke an enabled, paired command through `node.invoke`; there is no per-action admin check.
116100

117101
## Safety
118102

119-
- Before authorization, every layer (tool policy, gateway command policy, node-app setting, and platform permissions) must agree. For the current macOS fulfiller, that includes **Allow Computer Control**, Accessibility, and Screen Recording. Once armed, actions execute without a per-action confirmation until expiry or `/phone disarm`.
103+
- Every layer (tool policy, gateway command policy, pairing, node-app setting, and platform permissions) must agree. For the current macOS fulfiller, that includes **Allow Computer Control**, Accessibility, and Screen Recording. Actions execute while those durable controls remain enabled; there is no per-action confirmation.
120104
- The macOS fulfiller posts text one grapheme at a time, so cancellation, disconnect, pause, disable, or endpoint replacement stops it before the next grapheme. The experimental cua-driver fulfiller cannot cancel a `type_text` call mid-typing.
121105
- Screenshots are model-only and never auto-sent to chat (issue [#44759](https://github.com/openclaw/openclaw/issues/44759)).
122106
- Treat screen content as untrusted; it can carry prompt injection.

0 commit comments

Comments
 (0)