@tangle-network/sandbox-cli 0.11.1-develop.20260724192810.689e2b6 → 0.11.3

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/README.md CHANGED
@@ -30,7 +30,9 @@ npx @tangle-network/sandbox-cli sandbox list
30
30
  npx tangle-sandbox --help
31
31
  ```
32
32
 
33
- Never run bare `npx tangle` (or `npx tangle-cli`) — those npm names belong to unrelated third-party packages and would execute someone else's code. The official names are `@tangle-network/sandbox-cli` and its forwarding alias `tangle-sandbox`.
33
+ Never run bare `npx tangle` (or `npx tangle-cli`).
34
+ Those npm names belong to unrelated third-party packages and would execute someone else's code.
35
+ The official names are `@tangle-network/sandbox-cli` and its forwarding alias `tangle-sandbox`.
34
36
 
35
37
  Install globally to expose the short `tangle` binary on PATH:
36
38
 
@@ -56,14 +58,13 @@ Three flows are supported:
56
58
 
57
59
  - **Browser login** (default): `tangle auth login` opens a browser to complete OAuth with `github`, `google`, or `microsoft` identity providers.
58
60
  - **Device code**: `tangle auth login --no-browser` for headless environments.
59
- - **API key**: `tangle auth login --api-key sk-tan-...` (or set `TANGLE_API_KEY`; `SANDBOX_API_KEY` accepted as deprecated alias).
61
+ - **API key**: `tangle auth login --api-key sk-tan-...` (or set `TANGLE_API_KEY`).
60
62
 
61
63
  Credential lookup precedence:
62
64
 
63
65
  1. `--api-key` flag
64
- 2. `TANGLE_API_KEY` environment variable (preferred)
65
- 3. `SANDBOX_API_KEY` environment variable (deprecated alias, accepted for backwards compatibility)
66
- 4. `~/.tangle/credentials` (populated by `tangle auth login`)
66
+ 2. `TANGLE_API_KEY` environment variable
67
+ 3. `~/.tangle/credentials` (populated by `tangle auth login`)
67
68
 
68
69
  Common commands:
69
70
 
@@ -76,6 +77,50 @@ tangle auth profiles
76
77
 
77
78
  `tangle auth login` validates the supplied credential against `/v1/account/me`, which requires a valid token.
78
79
 
80
+ ### The two surfaces
81
+
82
+ Commands address one of two services, and the two accept different credentials.
83
+
84
+ | Surface | Command families | Credential |
85
+ |---|---|---|
86
+ | Sandbox API | `sandbox`, `exec`, `ssh`, `fs`, `process`, `snapshot`, `secret`, `agent`, `fleet`, `batch`, `usage` | the session `tangle auth login` stores, or an `sk-tan-*` key |
87
+ | Platform control plane (`id.tangle.tools`) | `keys`, `workflows`, `hub` | an `sk-tan-*` key only |
88
+
89
+ The platform does not accept the sandbox session: it belongs to a different
90
+ audience. After a browser login the CLI therefore mints a short-lived platform
91
+ key from that session on the first platform command, caches it in the same
92
+ credential store, and replaces it before it expires. Nothing durable is written
93
+ for a surface you never use, and no long-lived key sits on disk.
94
+
95
+ An `sk-tan-*` key is used exactly as supplied on both surfaces, whether it
96
+ arrives through `--api-key`, `TANGLE_API_KEY`, or `tangle auth login --api-key`,
97
+ so a spawned sandbox and a CI job keep the credential they were given and no
98
+ mint replaces it. `TANGLE_HUB_CAPABILITY_TOKEN` serves the `hub` commands only.
99
+
100
+ ### What the minted credential may do
101
+
102
+ The minted key lives for minutes, so the platform refuses key creation and
103
+ revocation through it: a credential that short must not add or destroy authority
104
+ that outlasts it.
105
+
106
+ - `tangle keys list` works after `tangle auth login`.
107
+ - `tangle keys create` and `tangle keys revoke` need a key you minted yourself:
108
+ set `TANGLE_API_KEY`, run `tangle auth login --api-key sk-tan-…`, or mint the
109
+ key in the web console.
110
+
111
+ Everything else on the control plane — `tangle workflows`, `tangle hub` — works
112
+ from the login alone.
113
+
114
+ `tangle auth status` reports both surfaces. It exits non-zero when either one
115
+ REFUSES the stored credential — a behaviour change for a script that gated on
116
+ the old sandbox-only check, and the point of it: the platform rejecting the
117
+ credential used to be reported as success. An unreachable platform is a
118
+ different answer and exits zero, because an outage says nothing about the
119
+ credential; read `platform.reachable` in `--json` to gate platform work.
120
+ `--base-url` names the sandbox host for BOTH halves: the session is checked
121
+ there, and the platform credential is minted there, so the two lines of the
122
+ answer always describe one deployment.
123
+
79
124
  ## Command Surface
80
125
 
81
126
  Top-level command groups:
@@ -91,6 +136,7 @@ Top-level command groups:
91
136
  - `usage`
92
137
  - `permissions`
93
138
  - `backend`
139
+ - `batch`
94
140
  - `process`
95
141
  - `fs`
96
142
 
@@ -101,7 +147,7 @@ Examples:
101
147
  tangle auth login --api-key sk_...
102
148
 
103
149
  # sandbox lifecycle
104
- tangle sandbox create --name my-box --image node:20 --ssh
150
+ tangle sandbox create --name my-box --environment node:20 --ssh
105
151
  tangle sandbox list
106
152
  tangle sandbox get sbx_123
107
153
  tangle sandbox stop sbx_123
@@ -112,14 +158,14 @@ tangle sandbox delete sbx_123
112
158
  tangle exec sbx_123 "npm test"
113
159
  tangle ssh sbx_123
114
160
  tangle agent prompt sbx_123 "Summarize this repo"
115
- tangle agent task sbx_123 "Fix the failing tests"
161
+ tangle agent prompt sbx_123 "Fix the failing tests"
116
162
  tangle fleet create --count 4 --coordinator
117
163
 
118
164
  # grant hub connections to the agent (see hub-reference.md for the 3 modes).
119
165
  # the connection is an id or a provider name (resolved via `tangle hub connections`).
120
- tangle agent task sbx_123 "triage issues" \
166
+ tangle agent prompt sbx_123 "triage issues" \
121
167
  --connection github:github.issues.search,github.issues.create
122
- tangle agent task sbx_123 "file the report" --connection github:* --allow-writes
168
+ tangle agent prompt sbx_123 "file the report" --connection github:* --allow-writes
123
169
 
124
170
  # temporary GPU for an eval; omitted provider picks the cheapest configured cloud
125
171
  tangle sandbox gpu run sbx_123 \
@@ -138,7 +184,7 @@ tangle fs ls sbx_123 /workspace
138
184
  ```
139
185
 
140
186
  Hub commands (`tangle hub …`) and `tangle agent --connection` auto-mint a
141
- short-lived platform Hub key from your `tangle auth login` session no separate
187
+ short-lived platform Hub key from your `tangle auth login` session, with no separate
142
188
  key needed. See [`hub-reference.md`](./hub-reference.md) for the `--connection`
143
189
  grant modes, `--allow-writes`, and `permissions revert-writes`.
144
190
 
@@ -188,14 +234,40 @@ tangle sandbox create --name gpu-eval \
188
234
  The final detach output includes billed seconds and customer cost.
189
235
  Use `tangle usage` to inspect account-level GPU seconds and GPU spend.
190
236
 
237
+ ## Batch Runs
238
+
239
+ Run each task against one explicitly named backend:
240
+
241
+ ```bash
242
+ tangle batch run --tasks tasks.json --backend primary=opencode
243
+ ```
244
+
245
+ `tasks.json` is an array of `{ "id": "...", "message": "..." }` objects or an object with a `tasks` array.
246
+ At least one `--backend <id=type>` is required with `--tasks` or `--task`.
247
+
248
+ Repeat `--backend <id=type>` to run every task against multiple backends:
249
+
250
+ ```bash
251
+ tangle batch run --tasks tasks.json \
252
+ --backend writer=opencode \
253
+ --backend reviewer=claude-code \
254
+ --stream
255
+ ```
256
+
257
+ Backend IDs must be unique and use 1 to 128 letters, numbers, dots, underscores, or hyphens.
258
+ Use `--model provider/model` only when one backend is selected.
259
+ Each result is identified by both `taskId` and `backendId`.
260
+ JSON output reports `totalTasks`, `totalBackends`, `totalExecutions`, `totalSuccess`, `totalFailure`, `totalRetries`, and `successRate`.
261
+
262
+ Use `--request <file.json>` when each backend needs its own model, profile, server, or lifecycle configuration.
263
+ The file uses the same complete request shape as the TypeScript SDK and cannot be combined with inline task or backend flags.
264
+
191
265
  ## Provisioning Coverage
192
266
 
193
- `tangle sandbox create` exposes the full SDK provisioning surface, including image/environment, resources (CPU, memory, disk), temporary GPU leases, lifetime and idle timeout, driver and backend selection (`opencode`, `claude-code`, `codex`, `cursor`, `amp`, and other registry backends), SSH and web terminal, env and secret injection, metadata, initial permissions, git clone, tool pre-install, BYOS3 storage, snapshot restore, and outbound network controls. Run `tangle sandbox create --help` for the canonical flag list.
267
+ `tangle sandbox create` supports environments or container images, resources, temporary GPU leases, lifecycle limits, driver and backend selection, SSH and web terminal, environment variables, secrets, metadata, git clone, BYOS3 storage, and snapshot restore.
268
+ Use the `tools`, `permissions`, `network`, and `expose` commands after creation.
269
+ Run `tangle sandbox create --help` for the current flag list.
194
270
 
195
271
  ## Limitations
196
272
 
197
273
  - `snapshot restore` creates a new sandbox from a snapshot; the command signature suggests in-place restore.
198
-
199
- ## Design Follow-Up
200
-
201
- For the architecture review, parity checklist, and auth flow spec, see [CHECKLIST.md](./CHECKLIST.md).
package/SKILL.md CHANGED
@@ -1,34 +1,45 @@
1
1
  ---
2
2
  name: tangle-cli
3
- description: Use when interacting with Tangle sandboxes, executing hub tools, managing agent tasks, operating on sandbox filesystems, building workflows, connecting to external providers, or setting up integrations and automations from a terminal. Triggers include tangle, tangle sandbox, tangle hub, tangle agent, tangle exec, tangle fs, tangle snapshot, tangle secret, tangle workflows, tangle hub connect, github, slack, google, microsoft, external connections, provider integrations, hub tools, or any tangle command.
3
+ description: Use Tangle Sandbox CLI for lifecycle, prompts, files, fleets, Hub tools, and integrations.
4
4
  ---
5
5
 
6
6
  # Tangle CLI
7
7
 
8
8
  ## Overview
9
9
 
10
- `tangle` is the CLI for Tangle Sandbox operations create sandboxes, run agents, execute hub tools, manage files, secrets, snapshots, git, and more. All commands support `--help` for inline reference.
10
+ `tangle` is the CLI for Tangle Sandbox operations: create sandboxes, run agents, execute hub tools, and manage files, secrets, snapshots, and git.
11
+ All commands support `--help` for inline reference.
11
12
 
12
13
  ## Auth
13
14
 
14
- Generic command auth modes, resolved in order:
15
+ Commands address one of two services. Sandbox commands (`sandbox`, `exec`,
16
+ `ssh`, `fs`, `snapshot`, `secret`, `agent`, …) address the sandbox API. Platform
17
+ commands (`keys`, `workflows`, `hub`) address the control plane at
18
+ `id.tangle.tools`, which accepts only an `sk-tan-*` key.
19
+
20
+ Sandbox command auth modes, resolved in order:
15
21
 
16
22
  | Priority | Source | Set via |
17
23
  |----------|--------|--------|
18
24
  | 1 | CLI flag | `--api-key <key>` |
19
- | 2 | Env var | `TANGLE_API_KEY` or `SANDBOX_API_KEY` |
25
+ | 2 | Env var | `TANGLE_API_KEY` |
20
26
  | 3 | Profile store | `tangle auth login` (keychain or file) |
21
27
 
22
- Hub commands resolve auth in this order:
28
+ Platform commands resolve auth in the same order, with one step added: the
29
+ session that `tangle auth login` stores is not a platform credential, so the CLI
30
+ mints a short-lived platform key from it on first use and refreshes it as
31
+ needed. Hub commands also accept `TANGLE_HUB_CAPABILITY_TOKEN`, ranked directly
32
+ below `--api-key`; other platform commands do not, because that token
33
+ authenticates `/v1/hub/exec` alone.
23
34
 
24
- | Priority | Source | Set via |
25
- |----------|--------|--------|
26
- | 1 | CLI flag | `--api-key <key>` |
27
- | 2 | Hub capability | `TANGLE_HUB_CAPABILITY_TOKEN` |
28
- | 3 | Env var | `TANGLE_API_KEY` or `SANDBOX_API_KEY` |
29
- | 4 | Profile store | `tangle auth login` (keychain or file) |
35
+ The minted key lives for minutes, so the platform refuses key creation and
36
+ revocation through it. `tangle keys list` works from a browser login; `tangle
37
+ keys create` and `tangle keys revoke` need a key you minted yourself
38
+ (`TANGLE_API_KEY`, `tangle auth login --api-key`, or the web console). A stored
39
+ `sk-tan-*` is presented as-is and never minted over.
30
40
 
31
- **Inside a sandbox:** `tangle` is automatically authenticated. No extra auth needed — commands work out of the box.
41
+ **Inside a sandbox:** `tangle` is automatically authenticated.
42
+ No extra authentication is needed.
32
43
 
33
44
  ```bash
34
45
  # Browser login (preferred)
@@ -48,7 +59,7 @@ tangle auth login --profile work
48
59
  tangle auth profiles use work
49
60
  ```
50
61
 
51
- For hub env auth, set **exactly one** of `TANGLE_API_KEY`/`SANDBOX_API_KEY` or `TANGLE_HUB_CAPABILITY_TOKEN`.
62
+ For hub env auth, set **exactly one** of `TANGLE_API_KEY` or `TANGLE_HUB_CAPABILITY_TOKEN`.
52
63
 
53
64
  ## Sandbox Lifecycle
54
65
 
@@ -105,7 +116,7 @@ tangle fleet create --count 4 \
105
116
  --gpu-idle-timeout 120
106
117
  ```
107
118
 
108
- ## Hub — Full Workflow
119
+ ## Full Hub Workflow
109
120
 
110
121
  Hub lets agents use connected provider tools (GitHub, etc.) through Tangle without seeing provider OAuth tokens.
111
122
 
@@ -141,7 +152,7 @@ tangle hub tools describe github.issues.search --json
141
152
 
142
153
  ### Tool Execution
143
154
 
144
- Two equivalent commands `call` and `exec`:
155
+ Two equivalent commands are available: `call` and `exec`.
145
156
 
146
157
  ```bash
147
158
  # Basic call: <path tokens...> <json-input>
@@ -154,7 +165,8 @@ tangle hub call github issues createIssue '{"owner":"foo","repo":"bar","title":"
154
165
 
155
166
  ### Policy & Approvals
156
167
 
157
- Tools default to `ask` policy — they pause and require approval on first use.
168
+ Tools default to the `ask` policy.
169
+ They pause and require approval on first use.
158
170
 
159
171
  ```bash
160
172
  # List pending approvals
@@ -210,20 +222,14 @@ tangle secret update DATABASE_URL "new-value"
210
222
  tangle secret delete DATABASE_URL
211
223
  ```
212
224
 
213
- ## Snapshots & Checkpoints
225
+ ## Snapshots
214
226
 
215
227
  ```bash
216
- # Snapshots (point-in-time for cloning/restoring)
217
228
  tangle snapshot create <sandbox-id>
218
229
  tangle snapshot list <sandbox-id>
219
230
  tangle snapshot restore <sandbox-id> <snapshot-id> # creates new sandbox
220
231
  tangle snapshot revert <sandbox-id> <snapshot-id> # reverts in-place
221
232
  tangle snapshot delete <sandbox-id> <snapshot-id>
222
-
223
- # Checkpoints (lightweight, local)
224
- tangle checkpoint create <id>
225
- tangle checkpoint list|ls <id>
226
- tangle checkpoint delete|rm <id> <checkpoint-id>
227
233
  ```
228
234
 
229
235
  ## Templates
@@ -260,19 +266,40 @@ tangle team invitations [team] # List pending/historical invitations
260
266
  ## Workflows
261
267
 
262
268
  Authenticate with the `sk-tan-*` API key (`TANGLE_API_KEY`), same as the other
263
- platform commands not a hub capability token.
269
+ platform commands, not a hub capability token. These commands address the
270
+ platform control plane, not the sandbox API. The host resolves from
271
+ `--base-url`, then `TANGLE_HUB_URL` (which a spawned sandbox injects to name
272
+ its own hub, so it wins over an ambient value), then `TANGLE_PLATFORM_URL`,
273
+ then `https://id.tangle.tools`. On `workflows`,
274
+ `--base-url` names the PLATFORM host — unlike `tangle keys`, where `--base-url`
275
+ is the sandbox API and `--platform-url` is the platform.
276
+
277
+ Authoring a workflow (graph topology, guards, joins, KV state, decisions):
278
+ https://sandbox.tangle.tools/docs/workflows
264
279
 
265
280
  ```bash
266
281
  tangle workflows validate workflow.yml
267
282
  tangle workflows schema # print JSON Schema
268
283
  tangle workflows create workflow.yml
284
+ tangle workflows apply workflow.yml # create or update, matched by the definition's name
269
285
  tangle workflows list
286
+ tangle workflows fleet # run tallies over a trailing window, failing first
270
287
  tangle workflows get <id>
271
288
  tangle workflows update <id> workflow.yml
272
289
  tangle workflows enable <id>
273
290
  tangle workflows disable <id>
274
291
  tangle workflows delete <id>
275
292
 
293
+ # Templates
294
+ tangle workflows templates # starter gallery
295
+ tangle workflows init <template-id> # instantiate, print YAML
296
+ tangle workflows init <template-id> --param repo=o/r --file workflow.yml
297
+
298
+ # Revisions
299
+ tangle workflows revisions <id> # definition history
300
+ tangle workflows revision <id> <rev> # one revision's YAML
301
+ tangle workflows rollback <id> <rev> # restore a rev as the new head
302
+
276
303
  # Runs
277
304
  tangle workflows run <id> # trigger a run
278
305
  tangle workflows run <id> --input pull_request.number=123 # with trigger inputs
@@ -280,6 +307,23 @@ tangle workflows run <id> --wait # wait + print resul
280
307
  tangle workflows runs <id> # run history
281
308
  tangle workflows run-detail <id> <runId> # single-run detail
282
309
  tangle workflows events <id> <runId> # tail live progress
310
+ tangle workflows cancel <id> <runId> # cancel a queued/running run
311
+ tangle workflows retry <id> <runId> # re-run a failed run with the same trigger context
312
+
313
+ # Cross-run KV state
314
+ tangle workflows kv list <id>
315
+ tangle workflows kv get <id> <key>
316
+ tangle workflows kv set <id> <key> '{"cursor":123}'
317
+ tangle workflows kv set <id> <key> '{"cursor":123}' --cas 4 # compare-and-swap
318
+ tangle workflows kv delete <id> <key>
319
+
320
+ # Run artifacts
321
+ tangle workflows artifacts <id> <runId>
322
+ tangle workflows artifact-download <id> <runId> <artifactId> --out report.json
323
+
324
+ # Human decisions
325
+ tangle workflows decisions <id> # pending approvals
326
+ tangle workflows decision-resolve <id> <runId> --choice deploy
283
327
  ```
284
328
 
285
329
  ## Other Commands
@@ -308,6 +352,7 @@ tangle tools install <id> python 3.12
308
352
 
309
353
  # Batch tasks across sandboxes
310
354
  tangle batch run --tasks tasks.json
355
+ tangle batch run --tasks tasks.json --backend writer=opencode --backend reviewer=claude-code --stream
311
356
 
312
357
  # Intelligence reports
313
358
  tangle intelligence sandbox <id>
@@ -337,22 +382,23 @@ tangle permissions add <sandboxId> --userId <userId> --role editor
337
382
 
338
383
  | Goal | Commands |
339
384
  |------|----------|
340
- | Spin up sandbox, run agent | `tangle sandbox create --name X` → `tangle agent task <id> "..."` |
385
+ | Spin up sandbox, run agent | `tangle sandbox create --name X` → `tangle agent prompt <id> "..."` |
341
386
  | Connect GitHub, read issues | `tangle hub connect github` → `tangle hub tools search "issues" --provider github` → `tangle hub call github issues search '{"q":"repo:X/Y is:issue"}'` |
342
387
  | Push code from sandbox to GitHub | `tangle hub connect github` → `tangle git add <id> files` → `tangle git commit <id> -m "msg"` → `tangle git push <id>` |
343
388
  | Save and restore state | `tangle snapshot create <id>` → ...work... → `tangle snapshot revert <id> <snap-id>` |
344
389
  | Set secret for agent use | `tangle secret create GITHUB_TOKEN "..."` → agent reads via `process.env.GITHUB_TOKEN` |
345
390
  | Set hub permissions | `tangle hub permissions set --connection conn_xxx --action github.issues.createIssue --decision allow` |
346
- | Batch parallel agent tasks | `tangle batch run --tasks tasks.json` (array of `{sandboxId, message}`) |
391
+ | Batch parallel agent prompts | `tangle batch run --tasks tasks.json --backend primary=opencode` (array of `{id, message}`) |
392
+ | Compare backends on the same tasks | `tangle batch run --tasks tasks.json --backend writer=opencode --backend reviewer=claude-code --stream` |
347
393
 
348
394
  ## Common Mistakes
349
395
 
350
- - **Forgetting `--reveal` on `secret show`** values are hidden by default for safety.
351
- - **Using API-key env and `TANGLE_HUB_CAPABILITY_TOKEN` together for hub** set exactly one env auth source, or use `--api-key` to override both.
352
- - **Calling hub tools without `--approve` on first use** use `--approve` or set policy to `allow` first.
353
- - **Missing `--json` flag when piping output** many commands need explicit `--json` for machine-readable output.
354
- - **`tangle hub exec` vs `tangle exec`** `hub exec` runs hub tools; `exec` runs shell commands in a sandbox.
355
- - **`hub resume` doesn't replay** after `hub resume --accept`, rerun original `hub exec` with `--approve`.
396
+ - **Forgetting `--reveal` on `secret show`:** values are hidden by default for safety.
397
+ - **Using API-key env and `TANGLE_HUB_CAPABILITY_TOKEN` together for hub:** set exactly one env auth source, or use `--api-key` to override both.
398
+ - **Calling hub tools without `--approve` on first use:** use `--approve` or set policy to `allow` first.
399
+ - **Missing `--json` when piping output:** many commands need explicit `--json` for machine-readable output.
400
+ - **`tangle hub exec` vs `tangle exec`:** `hub exec` runs hub tools; `exec` runs shell commands in a sandbox.
401
+ - **`hub resume` does not replay:** after `hub resume --accept`, rerun the original `hub exec` with `--approve`.
356
402
 
357
403
  ## Token Safety
358
404