You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/agent-device/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,5 +69,5 @@ Use this skill as a router with mandatory defaults. Read this file first. For no
69
69
- Need logs, network, alerts, permissions, or failure triage: [references/debugging.md](references/debugging.md)
70
70
- Need screenshots, diff, recording, replay maintenance, or perf data: [references/verification.md](references/verification.md)
71
71
- Need desktop surfaces, menu bar behavior, or macOS-specific interaction rules: [references/macos-desktop.md](references/macos-desktop.md)
72
-
- Need remote HTTP transport, `--remote-config` launches, or tenant leases on a remote macOS host: [references/remote-tenancy.md](references/remote-tenancy.md)
72
+
- Need remote HTTP transport, `connect --remote-config`, or tenant leases on a remote macOS host: [references/remote-tenancy.md](references/remote-tenancy.md)
73
73
This includes remote React Native runs where `agent-device` now prepares Metro locally and manages the local Metro companion tunnel automatically.
Copy file name to clipboardExpand all lines: skills/agent-device/references/remote-tenancy.md
+60-58Lines changed: 60 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,95 +2,97 @@
2
2
3
3
## When to open this file
4
4
5
-
Open this file for remote daemon HTTP flows, including `--remote-config` launches, that let an agent running in a Linux sandbox talk to another `agent-device` instance on a remote macOS host in order to control devices that are not available locally. This file covers daemon URL setup, authentication, lease allocation, and tenant-scoped command admission.
5
+
Open this file for remote daemon HTTP flowsthat let an agent running in a Linux sandbox talk to another `agent-device` instance on a remote macOS host in order to control devices that are not available locally. This file covers daemon URL setup, authentication, `connect`, tenant lease scope, and remote Metro companion lifecycle.
6
6
7
7
## Main commands to reach for first
8
8
9
-
-`agent-device open <app> --remote-config <path> --relaunch`
Do not run a tenant-isolated command without matching `tenant`, `run`, and `lease` scope. Admission checks require all three to line up.
16
+
Do not run remote tenant work by repeating `--remote-config` on every command. `--remote-config` is a `connect` input. After connecting, use normal `agent-device` commands; the active connection supplies daemon URL, tenant, run, lease, and prepared Metro runtime context.
17
17
18
-
## Preferred remote launch path
18
+
## Preferred remote flow
19
19
20
20
Use this when the agent needs the simplest remote control flow: a Linux sandbox agent talks over HTTP to `agent-device` on a remote macOS host and launches the target app through a checked-in `--remote-config` profile.
21
21
22
22
```bash
23
-
agent-device open com.example.myapp --remote-config ./agent-device.remote.json --relaunch
- This is the preferred remote launch path for sandbox or cloud agents.
27
-
-`agent-device` prepares local Metro and auto-starts the local Metro companion tunnel when the remote bridge needs a path back to the developer machine.
28
-
-`close --remote-config ...` cleans up the managed companion process for that project/profile, but leaves the developer’s Metro server running.
29
-
- For Android React Native relaunch flows, install or reinstall the APK first, then relaunch by installed package name.
30
-
- Do not use `open <apk|aab> --relaunch`; remote runtime hints are applied through the installed app sandbox.
36
+
`connect` resolves the remote profile, verifies daemon reachability through the normal client path, allocates or refreshes the tenant lease, prepares local Metro when the profile has Metro fields, starts the local Metro companion when the bridge needs it, and writes local non-secret connection state for later commands. `disconnect` closes the session when possible, stops the Metro companion owned by that connection, releases the lease, and removes local connection state.
31
37
32
-
## Lease flow example
38
+
Use `agent-device connection status --session adc-android` to inspect the active connection without reading JSON state manually. Status output must not include auth tokens.
Low-level lease operations exist for host-side automation, but do not point them at arbitrary hosts. The remote daemon executes device-control commands, so only use a trusted daemon base URL and an auth token managed by the same operator boundary.
- Keep secrets in env/config managed by the operator boundary. Do not persist auth tokens in connection state.
61
+
- Omit Metro fields for non-React Native flows.
62
+
- Put `tenant`, `runId`, `session`, `sessionIsolation`, `platform`, and `leaseBackend` in the remote profile when possible so agents can run `agent-device connect --remote-config ./remote-config.json` without extra scope flags.
63
+
- Explicit command-line flags override connected defaults. Use them intentionally when switching session, platform, target, tenant, run, or lease scope.
64
+
- For React Native Metro runs with `metroProxyBaseUrl`, `agent-device >= 0.11.12` can manage the local companion tunnel, but Metro itself still needs to be running locally.
65
+
- Use a lease backend that matches the bridge target platform, for example `android-instance`, `ios-instance`, or an explicit `--lease-backend` override.
54
66
55
67
## Transport prerequisites
56
68
57
-
- Start the daemon in HTTP mode with `AGENT_DEVICE_DAEMON_SERVER_MODE=http|dual`.
58
-
- Point the client at the remote host with `AGENT_DEVICE_DAEMON_BASE_URL=http(s)://host:port[/base-path]`.
69
+
- Start the daemon in HTTP mode with `AGENT_DEVICE_DAEMON_SERVER_MODE=http|dual` on the host.
70
+
- Point the profile or env at the remote host with`daemonBaseUrl` or`AGENT_DEVICE_DAEMON_BASE_URL=http(s)://host:port[/base-path]`.
59
71
- For non-loopback remote hosts, set `AGENT_DEVICE_DAEMON_AUTH_TOKEN` or `--daemon-auth-token`. The client rejects non-loopback remote daemon URLs without auth.
60
72
- Direct JSON-RPC callers can authenticate with request params, `Authorization: Bearer <token>`, or `x-agent-device-token`.
61
73
- Prefer an auth hook such as `AGENT_DEVICE_HTTP_AUTH_HOOK` when the host needs caller validation or tenant injection.
62
74
63
-
## Lease lifecycle
64
-
65
-
Use JSON-RPC methods on `POST /rpc`:
66
-
67
-
-`agent_device.lease.allocate`
68
-
-`agent_device.lease.heartbeat`
69
-
-`agent_device.lease.release`
70
-
71
-
Keep the lease alive for the duration of the run and release it when the tenant-scoped work is complete.
72
-
73
-
Host-level lease knobs:
74
-
75
-
-`AGENT_DEVICE_MAX_SIMULATOR_LEASES`
76
-
-`AGENT_DEVICE_LEASE_TTL_MS`
77
-
-`AGENT_DEVICE_LEASE_MIN_TTL_MS`
78
-
-`AGENT_DEVICE_LEASE_MAX_TTL_MS`
79
-
80
-
## Command admission contract
75
+
## Manual lease debug fallback
81
76
82
-
For tenant-isolated command execution, pass all four CLI flags together:
77
+
The main agent flow should use `connect`. Use manual JSON-RPC only for host-side automation or daemon-side auth/scope debugging, and only against trusted daemon hosts.
The CLI sends `AGENT_DEVICE_DAEMON_AUTH_TOKEN` in both the JSON-RPC request token field and HTTP auth headers so existing daemon auth paths continue to work.
95
+
Related daemon methods are `agent_device.lease.allocate`, `agent_device.lease.heartbeat`, `agent_device.lease.release`, and `agent_device.command`.
0 commit comments