@tangle-network/sandbox-cli 0.2.9 → 0.2.11

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.
@@ -0,0 +1,401 @@
1
+ # Tangle Hub Reference
2
+
3
+ ## Response Shapes
4
+
5
+ The CLI `--json` flag prints raw response data. The SDK internally uses envelopes (`{ success: true, data: ... }` / `{ success: false, error: ... }`), but the CLI unwraps the envelope and prints only the `data` or formats the `error`.
6
+
7
+ **Success output:** raw data object directly (no envelope wrapper).
8
+ **Error output:** `{ error: { code, message, status?, details? } }`.
9
+
10
+ ### Status
11
+
12
+ ```bash
13
+ tangle hub status --json
14
+ ```
15
+
16
+ ```json
17
+ {
18
+ "principal": {
19
+ "kind": "user_session",
20
+ "userId": "usr_xxx",
21
+ "apiKeyId": "key_xxx",
22
+ "sandboxId": null
23
+ },
24
+ "connections": {
25
+ "connectedProviderCount": 2,
26
+ "unhealthyProviderCount": 0
27
+ }
28
+ }
29
+ ```
30
+
31
+ `kind` values: `user_session`, `api_key`, `sandbox_runtime`.
32
+
33
+ ### Connections
34
+
35
+ ```bash
36
+ tangle hub connections --json
37
+ ```
38
+
39
+ ```json
40
+ {
41
+ "connections": [
42
+ {
43
+ "id": "conn_abc123",
44
+ "providerId": "github",
45
+ "displayName": "GitHub",
46
+ "accountDisplay": "octocat",
47
+ "scopes": ["repo", "user:email"],
48
+ "status": "active",
49
+ "health": "healthy",
50
+ "createdAt": "2026-01-15T10:00:00Z",
51
+ "updatedAt": "2026-01-15T10:00:00Z",
52
+ "lastUsedAt": "2026-06-10T08:00:00Z"
53
+ }
54
+ ]
55
+ }
56
+ ```
57
+
58
+ Connection `status`: `active`, `revoked`, `unhealthy`, `reconnect_required`.
59
+
60
+ Connection `health`: `unknown`, `healthy`, `unhealthy`, `rate_limited`.
61
+
62
+ ### OAuth Connect
63
+
64
+ ```bash
65
+ tangle hub connect github --json
66
+ ```
67
+
68
+ ```json
69
+ {
70
+ "provider": "github",
71
+ "redirectUrl": "https://github.com/login/oauth/authorize?client_id=...&scope=repo&state=...",
72
+ "expiresAt": "2026-06-10T12:30:00Z",
73
+ "scopes": ["repo", "user:email"],
74
+ "cli": true
75
+ }
76
+ ```
77
+
78
+ The `state` field is redacted from `--json` output (CSRF protection). The CLI prints the raw redirect URL directly.
79
+
80
+ ### Tool Sources
81
+
82
+ ```bash
83
+ tangle hub tools sources --json
84
+ ```
85
+
86
+ ```json
87
+ {
88
+ "sources": [
89
+ {
90
+ "sourceId": "github",
91
+ "providerId": "github",
92
+ "displayName": "GitHub",
93
+ "toolCount": 47,
94
+ "connectionStatus": "connected",
95
+ "health": "healthy",
96
+ "configured": true
97
+ }
98
+ ]
99
+ }
100
+ ```
101
+
102
+ Source `connectionStatus`: `connected`, `missing`, `unknown`.
103
+
104
+ Source `health`: `healthy`, `unhealthy`, `rate_limited`, `unknown`.
105
+
106
+ ### Tool Search
107
+
108
+ ```bash
109
+ tangle hub tools search "github issues" --provider github --json
110
+ ```
111
+
112
+ ```json
113
+ {
114
+ "tools": [
115
+ {
116
+ "path": "github.issues.listIssues",
117
+ "providerId": "github",
118
+ "title": "List GitHub Issues",
119
+ "description": "List issues in a repository",
120
+ "connectionRequired": true,
121
+ "connectionStatus": "connected",
122
+ "requiredConnectionProviderId": "github",
123
+ "policyState": "ask"
124
+ }
125
+ ]
126
+ }
127
+ ```
128
+
129
+ Tool `policyState`: `allow`, `ask`, `deny`, `unknown`.
130
+
131
+ ### Tool Describe
132
+
133
+ ```bash
134
+ tangle hub tools describe github.issues.listIssues --json
135
+ ```
136
+
137
+ ```json
138
+ {
139
+ "tool": {
140
+ "path": "github.issues.listIssues",
141
+ "providerId": "github",
142
+ "title": "List GitHub Issues",
143
+ "description": "List issues in a repository",
144
+ "connectionRequired": true,
145
+ "connectionStatus": "connected",
146
+ "requiredConnectionProviderId": "github",
147
+ "policyState": "ask",
148
+ "inputSchema": {
149
+ "type": "object",
150
+ "required": ["owner", "repo"],
151
+ "properties": {
152
+ "owner": { "type": "string" },
153
+ "repo": { "type": "string" },
154
+ "state": { "type": "string", "enum": ["open", "closed", "all"] },
155
+ "labels": { "type": "array", "items": { "type": "string" } }
156
+ }
157
+ },
158
+ "outputSchema": {
159
+ "type": "array",
160
+ "items": { "$ref": "#/components/schemas/Issue" }
161
+ }
162
+ }
163
+ }
164
+ ```
165
+
166
+ ### Tool Call / Exec
167
+
168
+ ```bash
169
+ tangle hub call github issues listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}'
170
+ tangle hub exec github.issues.listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}'
171
+ ```
172
+
173
+ ```json
174
+ {
175
+ "result": [
176
+ {
177
+ "number": 42,
178
+ "title": "Fix auth middleware",
179
+ "state": "open",
180
+ "createdAt": "2026-06-01T10:00:00Z"
181
+ }
182
+ ]
183
+ }
184
+ ```
185
+
186
+ The `result` shape depends on the tool. Always inspect the `outputSchema` first.
187
+
188
+ ### Approvals
189
+
190
+ ```bash
191
+ tangle hub approvals list --json
192
+ ```
193
+
194
+ ```json
195
+ {
196
+ "approvals": [
197
+ {
198
+ "id": "app_xxx",
199
+ "connectionId": "conn_abc123",
200
+ "providerId": "github",
201
+ "actionPath": "github.issues.create",
202
+ "inputHash": "sha256:...",
203
+ "requesterPrincipal": { "userId": "usr_xxx", "kind": "api_key" },
204
+ "status": "pending",
205
+ "requestedAt": "2026-06-10T08:00:00Z",
206
+ "expiresAt": "2026-06-10T09:00:00Z",
207
+ "resolvedAt": null
208
+ }
209
+ ]
210
+ }
211
+ ```
212
+
213
+ Approval `status`: `pending`, `approved`, `denied`, `expired`, `consumed`.
214
+
215
+ ### Approve / Deny
216
+
217
+ ```bash
218
+ tangle hub approvals approve app_xxx --json
219
+ tangle hub approvals deny app_xxx --json
220
+ ```
221
+
222
+ ```json
223
+ {
224
+ "approval": {
225
+ "id": "app_xxx",
226
+ "status": "approved",
227
+ "connectionId": "conn_abc123",
228
+ "actionPath": "github.issues.create"
229
+ },
230
+ "capabilityToken": {
231
+ "tokenId": "tok_xxx",
232
+ "expiresAt": "2026-06-10T08:30:00Z"
233
+ }
234
+ }
235
+ ```
236
+
237
+ `capabilityToken` is present only on approve. The actual token value is redacted from `--json` output.
238
+
239
+ ### Permissions
240
+
241
+ ```bash
242
+ tangle hub permissions list --connection conn_xxx --json
243
+ ```
244
+
245
+ ```json
246
+ {
247
+ "policies": [
248
+ {
249
+ "id": "pol_xxx",
250
+ "connectionId": "conn_xxx",
251
+ "providerId": "github",
252
+ "actionPath": "github.issues.create",
253
+ "decision": "ask",
254
+ "createdAt": "2026-06-01T00:00:00Z",
255
+ "updatedAt": "2026-06-10T00:00:00Z"
256
+ }
257
+ ]
258
+ }
259
+ ```
260
+
261
+ `decision` values: `allow`, `ask`, `deny`.
262
+
263
+ ### Permission Set
264
+
265
+ ```bash
266
+ tangle hub permissions set --connection conn_xxx --action github.issues.create --decision allow --json
267
+ ```
268
+
269
+ ```json
270
+ {
271
+ "policy": {
272
+ "id": "pol_xxx",
273
+ "connectionId": "conn_xxx",
274
+ "providerId": "github",
275
+ "actionPath": "github.issues.create",
276
+ "decision": "allow",
277
+ "createdAt": "2026-06-01T00:00:00Z",
278
+ "updatedAt": "2026-06-10T00:00:00Z"
279
+ }
280
+ }
281
+ ```
282
+
283
+ ## Error Format
284
+
285
+ ```bash
286
+ # Any failing hub command with --json
287
+ tangle hub tools sources --json # when not authenticated
288
+ ```
289
+
290
+ ```json
291
+ {
292
+ "error": {
293
+ "code": "HUB_UNAUTHENTICATED",
294
+ "message": "Authentication required for Hub endpoints",
295
+ "status": 401
296
+ }
297
+ }
298
+ ```
299
+
300
+ Error fields:
301
+ - `code`: Hub error code string
302
+ - `message`: Human-readable description
303
+ - `status`: HTTP status code (optional)
304
+ - `details`: Additional context (optional)
305
+
306
+ ## Error Codes
307
+
308
+ | Code | When it occurs | Recovery |
309
+ |------|----------------|----------|
310
+ | `HUB_UNAUTHENTICATED` | Missing or invalid API key | Check `TANGLE_API_KEY` |
311
+ | `HUB_FORBIDDEN` | Valid auth but no permission | Check connection or team membership |
312
+ | `HUB_INVALID_INPUT` | JSON schema violation | Check `inputSchema` with `tools describe` |
313
+ | `HUB_PROVIDER_MISSING` | Provider not configured | `tangle hub connect <provider>` |
314
+ | `HUB_CONNECTION_MISSING` | No connection for this provider | `tangle hub connect <provider>` |
315
+ | `HUB_CONNECTION_REVOKED` | Connection was revoked | Reconnect via `tangle hub connect` |
316
+ | `HUB_TOKEN_EXPIRED` | Capability token expired | Re-run with `--approve` or mint new token |
317
+ | `HUB_TOKEN_REPLAYED` | Token already consumed | Re-run with `--approve` |
318
+ | `HUB_TOKEN_REVOKED` | Token explicitly revoked | Re-run with `--approve` |
319
+ | `HUB_TOKEN_ACTION_MISMATCH` | Token for different action | Use `--approve` with correct action |
320
+ | `HUB_POLICY_DENIED` | Permission set to `deny` | Change policy via `permissions set` |
321
+ | `HUB_APPROVAL_REQUIRED` | Policy is `ask` and first use | Use `--approve` or `approvals approve` |
322
+ | `HUB_EXECUTOR_FAILURE` | Hub executor error | Retry; check tool health |
323
+ | `HUB_PROVIDER_FAILURE` | Provider API error | Check provider status |
324
+ | `HUB_NOT_FOUND` | Tool or resource not found | Check path spelling |
325
+ | `HUB_NOT_IMPLEMENTED` | Route not yet implemented | Use a different endpoint |
326
+
327
+ ## Workflow Examples
328
+
329
+ ### Connect → Call → Approve
330
+
331
+ ```bash
332
+ # 1. Connect
333
+ tangle hub connect github
334
+ # (follow browser flow)
335
+
336
+ # 2. Verify
337
+ tangle hub status --json
338
+
339
+ # 3. Discover
340
+ tangle hub tools sources --json
341
+ tangle hub tools search "issues" --provider github --json
342
+ tangle hub tools describe github.issues.listIssues --json
343
+
344
+ # 4. Call with auto-approve
345
+ tangle hub exec github.issues.listIssues '{"owner":"tangle-network","repo":"agent-dev-container"}' --approve
346
+
347
+ # 5. Set permanent policy
348
+ tangle hub permissions set --connection conn_xxx --action github.issues.listIssues --decision allow
349
+ ```
350
+
351
+ ### Batch Approvals
352
+
353
+ ```bash
354
+ # List all pending
355
+ tangle hub approvals list --json | jq '.approvals[] | .id'
356
+
357
+ # Bulk approve
358
+ for id in $(tangle hub approvals list --json | jq -r '.approvals[].id'); do
359
+ tangle hub approvals approve "$id"
360
+ done
361
+ ```
362
+
363
+ ### Policy Audit
364
+
365
+ ```bash
366
+ # Show all policies for one connection
367
+ tangle hub permissions list --connection conn_xxx --json
368
+
369
+ # Set all read actions to allow, write actions to ask
370
+ tangle hub permissions set --connection conn_xxx --action github.issues.listIssues --decision allow
371
+ tangle hub permissions set --connection conn_xxx --action github.issues.create --decision ask
372
+ ```
373
+
374
+ ## GitHub App Primitives
375
+
376
+ ```bash
377
+ # Mint a repo-scoped token (requires GitHub App installation)
378
+ tangle hub github-app mint-installation-token --repo-url https://github.com/owner/repo
379
+
380
+ # Check if repo is installed
381
+ tangle hub github-app is-repo-installed --owner owner --repo repo
382
+
383
+ # List installations
384
+ tangle hub github-app installations
385
+
386
+ # List repos for an installation
387
+ tangle hub github-app repos --installation-id 123456
388
+ ```
389
+
390
+ ## Token Management
391
+
392
+ ```bash
393
+ # List minted capability tokens
394
+ tangle hub tokens list --json
395
+
396
+ # List including expired
397
+ tangle hub tokens list --include-expired --json
398
+
399
+ # Revoke a token
400
+ tangle hub tokens revoke tok_xxx --json
401
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-cli",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "CLI for Tangle Sandbox operations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,8 @@
11
11
  "files": [
12
12
  "dist",
13
13
  "bin",
14
- "SKILL.md"
14
+ "SKILL.md",
15
+ "hub-reference.md"
15
16
  ],
16
17
  "dependencies": {
17
18
  "chalk": "^5.4.1",
@@ -19,8 +20,8 @@
19
20
  "dotenv": "17.2.3",
20
21
  "ora": "^9.4.0",
21
22
  "ws": "^8.20.0",
22
- "@tangle-network/sandbox": "0.4.4",
23
- "@tangle-network/hub-sdk": "0.2.2"
23
+ "@tangle-network/hub-sdk": "0.2.2",
24
+ "@tangle-network/sandbox": "0.6.1"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@types/node": "25.6.0",