agent-device 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-device",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
4
4
  "description": "Unified control plane for physical and virtual devices via an agent-driven CLI.",
5
5
  "license": "MIT",
6
6
  "author": "Callstack",
@@ -62,15 +62,17 @@ agent-device install com.example.app ./build/MyApp.app --platform ios --device "
62
62
  ```
63
63
 
64
64
  ```bash
65
- agent-device install-from-source https://example.com/builds/app.aab --platform android
66
- agent-device install-from-source https://api.github.com/repos/acme/app/actions/artifacts/123/zip --platform ios --header "authorization: Bearer TOKEN"
65
+ ARTIFACT_URL="<trusted-artifact-url>"
66
+ agent-device install-from-source "$ARTIFACT_URL" --platform android
67
+ GITHUB_ARTIFACT_URL="<trusted-github-actions-artifact-api-url>"
68
+ agent-device install-from-source "$GITHUB_ARTIFACT_URL" --platform ios --header "authorization: Bearer TOKEN"
67
69
  ```
68
70
 
69
71
  ## Install guidance
70
72
 
71
73
  - Use `install <app> <path>` when the app may already be installed and you do not need a fresh-state reset.
72
74
  - Use `reinstall <app> <path>` when you explicitly need uninstall plus install as one deterministic step.
73
- - Use `install-from-source <url>` when an existing artifact URL is already reachable by the daemon.
75
+ - Use `install-from-source <url>` only when an existing artifact URL is trusted, operator-approved, and reachable by the daemon.
74
76
  - Local `.apk`, `.aab`, `.app`, and `.ipa` paths go through `install` or `reinstall`; existing reachable URLs go through `install-from-source`.
75
77
  - Do not download, re-zip, publish temporary GitHub releases, or move CI artifacts elsewhere just to make an install command work.
76
78
  - Keep install and open as separate phases. Do not turn them into one default command flow.
@@ -7,47 +7,87 @@ Open this file for remote daemon HTTP flows that let an agent running in a Linux
7
7
  ## Main commands to reach for first
8
8
 
9
9
  - `agent-device connect --remote-config <path>`
10
+ - `agent-device install-from-source <url> --remote-config <path> --platform android`
11
+ - `agent-device open <package> --remote-config <path> --relaunch`
12
+ - `agent-device snapshot --remote-config <path> -i`
13
+ - `agent-device disconnect --remote-config <path>`
10
14
  - `agent-device connection status`
11
- - `agent-device disconnect`
12
15
  - `AGENT_DEVICE_DAEMON_AUTH_TOKEN=...`
13
16
 
14
17
  ## Most common mistake to avoid
15
18
 
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, and session context, then resolves lease and Metro details only when a later command actually needs them.
19
+ Do not mix an arbitrary `--session` plus ad-hoc daemon, tenant, run, or lease flags. That can bypass saved Metro runtime hints. Use one of these patterns instead:
17
20
 
18
- ## Preferred remote flow
21
+ - Interactive flow: run `connect --remote-config <path>` once, then normal commands, then `disconnect`.
22
+ - Script flow: pass the same `--remote-config <path>` to every command, including `disconnect`.
19
23
 
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.
24
+ ## Choose one flow
25
+
26
+ ### Interactive flow
27
+
28
+ Use this when the agent will run several commands in one session.
21
29
 
22
30
  ```bash
23
31
  export AGENT_DEVICE_DAEMON_AUTH_TOKEN="YOUR_TOKEN"
24
32
  export AGENT_DEVICE_PROXY_TOKEN="$AGENT_DEVICE_DAEMON_AUTH_TOKEN"
25
33
 
26
- agent-device connect \
27
- --remote-config ./remote-config.json
34
+ agent-device connect --remote-config ./remote-config.json
28
35
 
29
- agent-device install com.example.app ./app.apk
30
- agent-device install-from-source https://example.com/builds/app.apk --platform android
36
+ ARTIFACT_URL="<trusted-artifact-url>"
37
+ agent-device install-from-source "$ARTIFACT_URL" --platform android
31
38
  agent-device open com.example.app --relaunch
32
39
  agent-device snapshot -i
33
40
  agent-device fill @e3 "test@example.com"
34
41
  agent-device disconnect
35
42
  ```
36
43
 
37
- `connect` resolves the remote profile, generates a local session name when the profile omits one, stores local non-secret connection state, and defers tenant lease allocation plus Metro preparation until a later command needs them. When a command such as `open`, `install`, `apps`, or `snapshot` needs a lease, the client allocates or refreshes it from the connected scope. When a command needs Metro runtime hints, the client prepares Metro locally at that point and starts the local Metro companion when the bridge needs it, including `batch` runs whose steps open an app. `disconnect` closes the session when possible, stops the Metro companion owned by that connection, releases the lease when one was allocated, and removes local connection state.
44
+ After `connect`, normal commands use the active remote connection. End with `disconnect` to release the lease and stop the owned Metro companion.
45
+
46
+ ### Self-contained script flow
47
+
48
+ Use this when each command must be explicit and repeatable. Pass the same `--remote-config` to each step.
49
+
50
+ ```bash
51
+ ARTIFACT_URL="<trusted-artifact-url>"
52
+
53
+ agent-device install-from-source "$ARTIFACT_URL" \
54
+ --remote-config ./remote-config.json \
55
+ --platform android
56
+
57
+ agent-device open com.example.app \
58
+ --remote-config ./remote-config.json \
59
+ --relaunch
60
+
61
+ agent-device snapshot \
62
+ --remote-config ./remote-config.json \
63
+ -i
64
+
65
+ agent-device disconnect \
66
+ --remote-config ./remote-config.json
67
+ ```
68
+
69
+ The first command that needs a lease or Metro runtime prepares and persists it. Later commands with the same `--remote-config` reuse that state. End with `disconnect --remote-config <path>` to release the lease and stop the owned Metro companion.
70
+
71
+ ## Behavior summary
38
72
 
39
- After `connect`, normal `agent-device` commands use the active remote connection. Do not repeat `--remote-config` on every command.
73
+ - `connect` stores local non-secret connection state and defers tenant lease allocation plus Metro preparation until a later command needs them.
74
+ - Commands such as `install-from-source`, `open`, `snapshot`, and `apps` allocate or refresh the lease when needed.
75
+ - `open` prepares Metro runtime hints when the remote profile has Metro fields and no compatible runtime is already saved.
76
+ - `batch` also prepares Metro when any step opens an app and that step does not provide its own runtime.
77
+ - `disconnect` closes the session when possible, stops the Metro companion owned by the connection, releases the lease when one was allocated, and removes local connection state.
40
78
 
41
79
  Remote install examples:
42
80
 
43
81
  ```bash
44
82
  agent-device install com.example.app ./app.apk
45
- agent-device install-from-source https://example.com/builds/app.aab --platform android
46
- agent-device install-from-source https://api.github.com/repos/acme/app/actions/artifacts/123/zip --platform ios --header "authorization: Bearer TOKEN"
83
+ ARTIFACT_URL="<trusted-artifact-url>"
84
+ agent-device install-from-source "$ARTIFACT_URL" --platform android
85
+ GITHUB_ARTIFACT_URL="<trusted-github-actions-artifact-api-url>"
86
+ agent-device install-from-source "$GITHUB_ARTIFACT_URL" --platform ios --header "authorization: Bearer TOKEN"
47
87
  ```
48
88
 
49
89
  - Use `install` or `reinstall` for local paths; remote daemons upload local artifacts automatically.
50
- - Use `install-from-source` for artifact URLs the remote daemon can reach.
90
+ - Use `install-from-source` only for trusted, operator-approved artifact URLs the remote daemon can reach. Do not fetch arbitrary user-supplied URLs.
51
91
  - For local-path versus URL artifact rules, follow [bootstrap-install.md](bootstrap-install.md).
52
92
 
53
93
  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.