@tangle-network/sandbox-cli 0.14.0-develop.20260727215658.53efef5 → 0.14.1

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
@@ -52,6 +52,12 @@ pnpm --filter @tangle-network/sandbox-cli build
52
52
  node products/sandbox/cli/bin/tangle.js --help
53
53
  ```
54
54
 
55
+ ## Supervisor accounting
56
+
57
+ `tangle supervise` reports measured tokens and cost for successful and failed runs.
58
+ A run without a winner can still incur cost.
59
+ Unknown totals display as `Unavailable` and appear as `null` in JSON output.
60
+
55
61
  ## Authentication
56
62
 
57
63
  Three flows are supported:
@@ -63,8 +69,14 @@ Three flows are supported:
63
69
  Credential lookup precedence:
64
70
 
65
71
  1. `--api-key` flag
66
- 2. `TANGLE_API_KEY` environment variable
67
- 3. `~/.tangle/credentials` (populated by `tangle auth login`)
72
+ 2. `TANGLE_API_KEY_FILE` managed credential file
73
+ 3. `TANGLE_API_KEY` environment variable
74
+ 4. `~/.tangle/credentials` (populated by `tangle auth login`)
75
+
76
+ The sidecar publishes refreshed delegated credentials through `TANGLE_API_KEY_FILE`.
77
+ The CLI reads this file for each request, including requests from an existing client.
78
+ A configured file that is missing, unreadable, or malformed fails without falling back to an older key.
79
+ A verified Sandbox request can install a new source credential; an expired source cannot renew itself unattended.
68
80
 
69
81
  Common commands:
70
82
 
@@ -77,6 +89,50 @@ tangle auth profiles
77
89
 
78
90
  `tangle auth login` validates the supplied credential against `/v1/account/me`, which requires a valid token.
79
91
 
92
+ ### The two surfaces
93
+
94
+ Commands address one of two services, and the two accept different credentials.
95
+
96
+ | Surface | Command families | Credential |
97
+ |---|---|---|
98
+ | Sandbox API | `sandbox`, `exec`, `ssh`, `fs`, `process`, `snapshot`, `secret`, `agent`, `fleet`, `batch`, `usage` | the session `tangle auth login` stores, or an `sk-tan-*` key |
99
+ | Platform control plane (`id.tangle.tools`) | `keys`, `workflows`, `hub` | an `sk-tan-*` key only |
100
+
101
+ The platform does not accept the sandbox session: it belongs to a different
102
+ audience. After a browser login the CLI therefore mints a short-lived platform
103
+ key from that session on the first platform command, caches it in the same
104
+ credential store, and replaces it before it expires. Nothing durable is written
105
+ for a surface you never use, and no long-lived key sits on disk.
106
+
107
+ An `sk-tan-*` key is used exactly as supplied on both surfaces, whether it
108
+ arrives through `--api-key`, `TANGLE_API_KEY`, or `tangle auth login --api-key`,
109
+ so a spawned sandbox and a CI job keep the credential they were given and no
110
+ mint replaces it. `TANGLE_HUB_CAPABILITY_TOKEN` serves the `hub` commands only.
111
+
112
+ ### What the minted credential may do
113
+
114
+ The minted key lives for minutes, so the platform refuses key creation and
115
+ revocation through it: a credential that short must not add or destroy authority
116
+ that outlasts it.
117
+
118
+ - `tangle keys list` works after `tangle auth login`.
119
+ - `tangle keys create` and `tangle keys revoke` need a key you minted yourself:
120
+ set `TANGLE_API_KEY`, run `tangle auth login --api-key sk-tan-…`, or mint the
121
+ key in the web console.
122
+
123
+ Everything else on the control plane — `tangle workflows`, `tangle hub` — works
124
+ from the login alone.
125
+
126
+ `tangle auth status` reports both surfaces. It exits non-zero when either one
127
+ REFUSES the stored credential — a behaviour change for a script that gated on
128
+ the old sandbox-only check, and the point of it: the platform rejecting the
129
+ credential used to be reported as success. An unreachable platform is a
130
+ different answer and exits zero, because an outage says nothing about the
131
+ credential; read `platform.reachable` in `--json` to gate platform work.
132
+ `--base-url` names the sandbox host for BOTH halves: the session is checked
133
+ there, and the platform credential is minted there, so the two lines of the
134
+ answer always describe one deployment.
135
+
80
136
  ## Command Surface
81
137
 
82
138
  Top-level command groups:
package/SKILL.md CHANGED
@@ -12,7 +12,12 @@ All commands support `--help` for inline reference.
12
12
 
13
13
  ## Auth
14
14
 
15
- 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:
16
21
 
17
22
  | Priority | Source | Set via |
18
23
  |----------|--------|--------|
@@ -20,14 +25,18 @@ Generic command auth modes, resolved in order:
20
25
  | 2 | Env var | `TANGLE_API_KEY` |
21
26
  | 3 | Profile store | `tangle auth login` (keychain or file) |
22
27
 
23
- 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.
24
34
 
25
- | Priority | Source | Set via |
26
- |----------|--------|--------|
27
- | 1 | CLI flag | `--api-key <key>` |
28
- | 2 | Hub capability | `TANGLE_HUB_CAPABILITY_TOKEN` |
29
- | 3 | Env var | `TANGLE_API_KEY` |
30
- | 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.
31
40
 
32
41
  **Inside a sandbox:** `tangle` is automatically authenticated.
33
42
  No extra authentication is needed.
@@ -257,19 +266,40 @@ tangle team invitations [team] # List pending/historical invitations
257
266
  ## Workflows
258
267
 
259
268
  Authenticate with the `sk-tan-*` API key (`TANGLE_API_KEY`), same as the other
260
- 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
261
279
 
262
280
  ```bash
263
281
  tangle workflows validate workflow.yml
264
282
  tangle workflows schema # print JSON Schema
265
283
  tangle workflows create workflow.yml
284
+ tangle workflows apply workflow.yml # create or update, matched by the definition's name
266
285
  tangle workflows list
286
+ tangle workflows fleet # run tallies over a trailing window, failing first
267
287
  tangle workflows get <id>
268
288
  tangle workflows update <id> workflow.yml
269
289
  tangle workflows enable <id>
270
290
  tangle workflows disable <id>
271
291
  tangle workflows delete <id>
272
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
+
273
303
  # Runs
274
304
  tangle workflows run <id> # trigger a run
275
305
  tangle workflows run <id> --input pull_request.number=123 # with trigger inputs
@@ -277,6 +307,23 @@ tangle workflows run <id> --wait # wait + print resul
277
307
  tangle workflows runs <id> # run history
278
308
  tangle workflows run-detail <id> <runId> # single-run detail
279
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
280
327
  ```
281
328
 
282
329
  ## Other Commands