@tangle-network/sandbox-cli 0.21.64 → 0.21.66
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 +32 -4
- package/SKILL.md +37 -5
- package/dist/graph-native-CS_TmaCK.mjs +1 -0
- package/dist/graph-viewer/Analytics-bWsqhurt.js +1001 -0
- package/dist/graph-viewer/{AnswerStrip-DhwqOyxI.js → AnswerStrip-COxV7gLW.js} +2 -2
- package/dist/graph-viewer/Checks-CQGmKcQ0.js +164 -0
- package/dist/graph-viewer/Conversations-DgCshBAf.js +627 -0
- package/dist/graph-viewer/{Files-DtZhf0ii.js → Files-CvIOGrAs.js} +81 -90
- package/dist/graph-viewer/LiveRun-DHmsr6F7.js +311 -0
- package/dist/graph-viewer/{Outputs-QET3nPPp.js → Outputs-rwBg_x36.js} +4 -4
- package/dist/graph-viewer/Overview-C150tkVa.js +194 -0
- package/dist/graph-viewer/{RunOverview-DJQDAMIx.js → RunOverview-CSqsunqf.js} +2 -2
- package/dist/graph-viewer/RunPage-F_prVwiV.js +286 -0
- package/dist/graph-viewer/Timeline-BFDywlmz.js +335 -0
- package/dist/graph-viewer/Today-BdDuqZGF.js +623 -0
- package/dist/graph-viewer/Topology-SAfGtd5u.js +238 -0
- package/dist/graph-viewer/Traces-BYqXaS_s.js +254 -0
- package/dist/graph-viewer/{WallPages-4d9QUZDq.js → WallPages-MM70VZrC.js} +48 -30
- package/dist/graph-viewer/agent-runtime.js +55 -55
- package/dist/graph-viewer/{data-BJmP7F1M.js → data-DTGmre1W.js} +31 -27
- package/dist/graph-viewer/harness-sessions.js +1 -1
- package/dist/graph-viewer/index.js +1357 -1392
- package/dist/graph-viewer/{lazy-pages-DM0cZM10.js → lazy-pages-BYuq_L_n.js} +9 -5
- package/dist/graph-viewer/{outputs-model-CGdvjkQh.js → outputs-model-CHTx8rMz.js} +2 -2
- package/dist/graph-viewer/{viewer/plain-words-CgvxtEOa.js → plain-words-BrMHl0On.js} +9 -4
- package/dist/graph-viewer/receipt.js +2 -2
- package/dist/graph-viewer/record-CsP_3NJS.js +612 -0
- package/dist/graph-viewer/record-part-CuT9Xw37.js +334 -0
- package/dist/graph-viewer/record.js +2 -336
- package/dist/graph-viewer/report-viewer.js +65 -65
- package/dist/graph-viewer/report.js +1 -1
- package/dist/graph-viewer/research-publication.js +1 -1
- package/dist/graph-viewer/{run-files-C1NgzM0l.js → run-files-BckQDdTD.js} +1 -1
- package/dist/graph-viewer/{run-receipt-Bvi4-KVM.js → run-receipt-Bt2iXJUy.js} +1 -0
- package/dist/graph-viewer/schemas/agent-workspace.play.v1.json +3 -0
- package/dist/graph-viewer/schemas/agent-workspace.plays.v1.json +2 -0
- package/dist/graph-viewer/schemas/agent-workspace.run.v1.json +1 -0
- package/dist/graph-viewer/styles.css +4559 -2385
- package/dist/graph-viewer/trace-spans.js +1 -1
- package/dist/graph-viewer/ui-xa5w5bEN.js +889 -0
- package/dist/graph-viewer/viewer/{AgentGraphCanvas-CMdOlSlh-4EervjeC.js → AgentGraphCanvas-B74GN1o6-BZEumF7-.js} +2610 -2707
- package/dist/graph-viewer/viewer/Analytics-E3XS570U.js +1002 -0
- package/dist/graph-viewer/viewer/{AnswerStrip-CGUyXuYH.js → AnswerStrip-B7xMU57A.js} +2 -2
- package/dist/graph-viewer/viewer/Checks-CJ5XSHbv.js +165 -0
- package/dist/graph-viewer/viewer/Conversations-AX8G7Qyl.js +904 -0
- package/dist/graph-viewer/viewer/Files-DxL1576V.js +630 -0
- package/dist/graph-viewer/viewer/LiveRun-B-BckyEj.js +820 -0
- package/dist/graph-viewer/viewer/{Outputs-CumGyjQo.js → Outputs-BoIpgfMv.js} +24 -23
- package/dist/graph-viewer/viewer/Overview-Dzg5XJgy.js +436 -0
- package/dist/graph-viewer/viewer/RunPage-NtevWXBs.js +285 -0
- package/dist/graph-viewer/viewer/{Scores-ZS16yk0n.js → Scores-Dgv4WePL.js} +3 -3
- package/dist/graph-viewer/viewer/Timeline-CzY3LVDu.js +335 -0
- package/dist/graph-viewer/viewer/Today-Bi9IIwuh.js +623 -0
- package/dist/graph-viewer/viewer/Topology-CzjqSFXH.js +239 -0
- package/dist/graph-viewer/viewer/Traces-CMX0H1VU.js +254 -0
- package/dist/graph-viewer/viewer/{WallPages-CzWpyIfp.js → WallPages-Clj4bORg.js} +50 -32
- package/dist/graph-viewer/viewer/addon-webgl-BSCscllv.js +4027 -0
- package/dist/graph-viewer/viewer/agent-record-BrP-ENHg.css +2 -0
- package/dist/graph-viewer/viewer/{bot-D6Nrej7Z.js → bot-BaQU59LG.js} +1 -1
- package/dist/graph-viewer/viewer/{chevron-right-D_5IKLxu.js → chevron-right-Xn05jYLT.js} +1 -1
- package/dist/graph-viewer/viewer/{createLucideIcon-yH0cxLMy.js → createLucideIcon-BSphcoOJ.js} +1 -1
- package/dist/graph-viewer/viewer/dashboard-D3JhmRhe-DSl0zhkw.js +371 -0
- package/dist/graph-viewer/viewer/{data-CkWfWr7i.js → data-CVHeKhrh.js} +144 -139
- package/dist/graph-viewer/viewer/dist-4_KJz8ZM.js +349 -0
- package/dist/graph-viewer/viewer/dist-Dy-wrdTt.js +1615 -0
- package/dist/graph-viewer/viewer/es2015-utW4DTOJ.js +3506 -0
- package/dist/graph-viewer/viewer/{final-output-kwY11u9X.js → final-output-BYT-g-9j.js} +1 -1
- package/dist/graph-viewer/viewer/flow-waterfall-model-DvrgPLGS-BdThSFH-.js +2696 -0
- package/dist/graph-viewer/viewer/git-branch-BzTbIcYL.js +28 -0
- package/dist/graph-viewer/viewer/{highlights-Btsi5OXl.js → highlights-DWeSCtiR.js} +4 -4
- package/dist/graph-viewer/viewer/jsx-runtime-DPT6sCLq.js +319 -0
- package/dist/graph-viewer/viewer/lazy-pages-ChiMJ8r_.js +803 -0
- package/dist/graph-viewer/viewer/{markdown-CX_sVrXB.js → markdown-lADwhD7y.js} +2324 -2608
- package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-RSb7EbGB.js +476 -0
- package/dist/graph-viewer/viewer/{page-header-Brq611fd.js → page-header-QbUg8F8i.js} +12 -11
- package/dist/graph-viewer/{plain-words-CgvxtEOa.js → viewer/plain-words-BrMHl0On.js} +9 -4
- package/dist/graph-viewer/viewer/primitives-znfPK9NP-B6UO7uDr.js +346 -0
- package/dist/graph-viewer/viewer/react-DQ7E2Epi.js +4254 -0
- package/dist/graph-viewer/viewer/{react-dom-t1L4_-il.js → react-dom-BEusmvQH.js} +1 -1
- package/dist/graph-viewer/viewer/record-DZnT6SWN-H-ul3U3a.js +3523 -0
- package/dist/graph-viewer/viewer/record-W39D5MO-.js +1 -0
- package/dist/graph-viewer/viewer/record-part-CbweyYoV.js +335 -0
- package/dist/graph-viewer/viewer/{segmented-control-BaJmvTNd.js → segmented-control-Di1mbQlP.js} +27 -26
- package/dist/graph-viewer/viewer/{shiki-Qnby7Sh6.js → shiki-BfNNlmfZ.js} +15 -15
- package/dist/graph-viewer/viewer/status-meta-S0kV_RDp.js +273 -0
- package/dist/graph-viewer/viewer/{stream-tokenizer-CWtnjmRd.js → stream-tokenizer-B5wWaM3U.js} +12 -12
- package/dist/graph-viewer/viewer/{themes-1i1fzpRk.js → themes-DuRxHiga.js} +1 -1
- package/dist/graph-viewer/viewer/ui-Co03nZUX.js +889 -0
- package/dist/graph-viewer/viewer/utils-BuObIC0n.js +1815 -0
- package/dist/graph-viewer/viewer/workbench-E6_5q_oL.js +28351 -0
- package/dist/graph-viewer/viewer/workflows--mZpHYqo.js +3298 -0
- package/dist/graph-viewer/viewer/workspace-cKs9sGEO.js +2468 -0
- package/dist/graph-viewer/{workspace-model-Ewf17pTW.js → workspace-model-BkPl_J8E.js} +1 -1
- package/dist/graph-viewer/workspace-viewer.js +7452 -7489
- package/dist/graph-viewer/workspace.js +1 -1
- package/dist/index.mjs +27 -22
- package/package.json +14 -13
- package/dist/graph-viewer/Analytics-DFWW8Phh.js +0 -938
- package/dist/graph-viewer/Checks-qgqV4xgV.js +0 -155
- package/dist/graph-viewer/Conversations-CGB45kpj.js +0 -545
- package/dist/graph-viewer/LiveRun-C21wUKAY.js +0 -210
- package/dist/graph-viewer/Overview-BjeLsA2I.js +0 -506
- package/dist/graph-viewer/RunPage-CkkcBEUe.js +0 -258
- package/dist/graph-viewer/Timeline-C2Xolk0t.js +0 -293
- package/dist/graph-viewer/Today-BVVDtSVN.js +0 -660
- package/dist/graph-viewer/Topology-DO5XX8e4.js +0 -545
- package/dist/graph-viewer/Traces-BhMxjNgw.js +0 -259
- package/dist/graph-viewer/part-events-BrLrg_EV.js +0 -276
- package/dist/graph-viewer/record-part-CZal_IMH.js +0 -1408
- package/dist/graph-viewer/ui-D8QZRsC3.js +0 -938
- package/dist/graph-viewer/viewer/Analytics-DD__nbLm.js +0 -939
- package/dist/graph-viewer/viewer/Checks-Ds5M7eAW.js +0 -156
- package/dist/graph-viewer/viewer/Conversations-C1n0EBBd.js +0 -819
- package/dist/graph-viewer/viewer/Files-Cjr7NMU_.js +0 -448
- package/dist/graph-viewer/viewer/LiveRun-uPTkPSjo.js +0 -6772
- package/dist/graph-viewer/viewer/Overview-4Umk14_2.js +0 -507
- package/dist/graph-viewer/viewer/RunPage-DZlBW7Va.js +0 -257
- package/dist/graph-viewer/viewer/Timeline-BnK6-yBR.js +0 -294
- package/dist/graph-viewer/viewer/Today-a_-oNigi.js +0 -660
- package/dist/graph-viewer/viewer/Topology-CQPCLQT6.js +0 -546
- package/dist/graph-viewer/viewer/Traces-C0IGk0L4.js +0 -259
- package/dist/graph-viewer/viewer/WorkflowGraph-DZ3xejKE-jRXKeSrg.js +0 -1559
- package/dist/graph-viewer/viewer/agent-record-Dw772ROs.css +0 -2
- package/dist/graph-viewer/viewer/agent-timeline-Cs9Qbpvo.js +0 -1798
- package/dist/graph-viewer/viewer/dist-C1-7EfoW.js +0 -488
- package/dist/graph-viewer/viewer/file-text-m7a3piQF.js +0 -47
- package/dist/graph-viewer/viewer/jsx-runtime-DQWyJOhv.js +0 -2136
- package/dist/graph-viewer/viewer/lazy-pages-BowaGsg-.js +0 -20
- package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-fagiBQam.js +0 -723
- package/dist/graph-viewer/viewer/popover-CvOAjlnk.js +0 -5329
- package/dist/graph-viewer/viewer/react-CY3IbSNO.js +0 -4262
- package/dist/graph-viewer/viewer/record-part-D3_Anfpe.js +0 -1329
- package/dist/graph-viewer/viewer/terminal-83J_I4Ne.js +0 -52
- package/dist/graph-viewer/viewer/ui-C9b1rIUH.js +0 -938
- package/dist/graph-viewer/viewer/workspace-CekmOBs3.js +0 -25100
- package/dist/graph-viewer/viewer/x-DOc2URqZ.js +0 -56
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ See [Limitations](#limitations) for open gaps.
|
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
18
|
-
One-liner (
|
|
18
|
+
One-liner (installs the CLI and a private runtime selected from its [`engines` metadata](./package.json)):
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
curl -fsSL https://sandbox.tangle.tools/install.sh | sh
|
|
@@ -52,7 +52,7 @@ pnpm --filter @tangle-network/sandbox-cli build
|
|
|
52
52
|
node products/sandbox/cli/bin/tangle.js --help
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
##
|
|
55
|
+
## Graph factories
|
|
56
56
|
|
|
57
57
|
Save a graph in a repository's `.tangle/graphs/<name>.yaml` or in
|
|
58
58
|
`~/.tangle/graphs/<name>.yaml`. Repository graphs take precedence. The packaged
|
|
@@ -63,6 +63,9 @@ critic and a declared completion check.
|
|
|
63
63
|
tangle graph new "Write and independently judge a haiku" --name haiku-review
|
|
64
64
|
tangle graph run haiku-review --dry-run
|
|
65
65
|
tangle graph run haiku-review
|
|
66
|
+
tangle --json graph run haiku-review --cloud
|
|
67
|
+
tangle --json graph inspect <run-id>
|
|
68
|
+
tangle graph run haiku-review --resume <run-id>
|
|
66
69
|
```
|
|
67
70
|
|
|
68
71
|
Graphs use the selected harness's native subscription login. Set `seat` in
|
|
@@ -75,9 +78,34 @@ exact `tangle hub connect <provider>` command. Ctrl-C cancels login, connection
|
|
|
75
78
|
polling and pending Hub requests.
|
|
76
79
|
|
|
77
80
|
Progress goes to stderr; `--json` returns the result or the shared error contract
|
|
78
|
-
on stdout.
|
|
81
|
+
on stdout. Local run journals live under `~/.tangle/runs/<run-id>`, and local graph history
|
|
79
82
|
lives in `~/.tangle/graph-registry`. Unknown token and cost totals remain `null`.
|
|
80
83
|
|
|
84
|
+
`--cloud` saves the same source through Hub Workflows and returns its run ID
|
|
85
|
+
immediately. The Workflow API owns execution, retained evidence and recovery;
|
|
86
|
+
closing the CLI leaves the cloud run running. `inspect` reads that same run and
|
|
87
|
+
prints the shared workflow viewer URL outside JSON mode.
|
|
88
|
+
|
|
89
|
+
`--resume` restores saved inputs and rejects changed source, parameters, seat
|
|
90
|
+
settings or placement. A completed winner returns its retained result without
|
|
91
|
+
new native effects. A healthy cloud run attaches by reading its current state;
|
|
92
|
+
only the server decides whether interrupted work can recover. Failed or
|
|
93
|
+
cancelled terminal runs refuse continuation.
|
|
94
|
+
|
|
95
|
+
For a cited analysis of retained graph evidence, install the maintained Braid companion
|
|
96
|
+
with `npm install --global @tangle-network/braid`, then use an existing canonical
|
|
97
|
+
AgentProfile reference:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
tangle graph analyze <run-id> --profile ./profiles/reviewer.json --dry-run
|
|
101
|
+
tangle graph analyze <run-id> --profile ./profiles/reviewer.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Here `--profile` selects the analysis agent, distinct from a Tangle account
|
|
105
|
+
profile. Analysis uses the CLI-owned subscription-only Bridge. Braid owns its
|
|
106
|
+
saved analysis and encrypted state; the result includes its state path. Missing
|
|
107
|
+
native capture or usage remains explicitly unavailable.
|
|
108
|
+
|
|
81
109
|
## Supervisor accounting
|
|
82
110
|
|
|
83
111
|
`tangle supervise` reports measured tokens and cost for successful and failed runs.
|
|
@@ -105,7 +133,7 @@ Credential lookup precedence:
|
|
|
105
133
|
1. `--api-key` flag
|
|
106
134
|
2. `TANGLE_API_KEY_FILE` managed credential file
|
|
107
135
|
3. `TANGLE_API_KEY` environment variable
|
|
108
|
-
4. `~/.tangle/credentials` (populated by `tangle auth login`)
|
|
136
|
+
4. `~/.tangle/credentials.json` (populated by `tangle auth login`)
|
|
109
137
|
|
|
110
138
|
The sidecar publishes refreshed delegated credentials through `TANGLE_API_KEY_FILE`.
|
|
111
139
|
The CLI reads this file for each request, including requests from an existing client.
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tangle-cli
|
|
3
|
-
description: Use Tangle Sandbox CLI for lifecycle, prompts, files, fleets, Hub tools, and integrations.
|
|
3
|
+
description: Use Tangle Sandbox CLI for graph factories, sandbox lifecycle, prompts, files, fleets, Hub tools, and integrations.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Tangle CLI
|
|
@@ -61,6 +61,34 @@ tangle auth profiles use work
|
|
|
61
61
|
|
|
62
62
|
For hub env auth, set **exactly one** of `TANGLE_API_KEY` or `TANGLE_HUB_CAPABILITY_TOKEN`.
|
|
63
63
|
|
|
64
|
+
## Graph factories
|
|
65
|
+
|
|
66
|
+
Use the existing `graph` commands to build and run AgentGraphs. Keep one source
|
|
67
|
+
file for local and cloud execution; `graph --help` owns command usage.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
tangle graph new "Implement and independently review the change" --name reviewed-change
|
|
71
|
+
tangle graph run reviewed-change --dry-run
|
|
72
|
+
tangle graph run reviewed-change
|
|
73
|
+
tangle --json graph run reviewed-change --cloud
|
|
74
|
+
tangle --json graph inspect <run-id>
|
|
75
|
+
tangle graph run reviewed-change --resume <run-id>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Cloud dispatch returns immediately and the Workflow API owns the same run after
|
|
79
|
+
CLI disconnect. Resume preserves recorded source and execution settings. A
|
|
80
|
+
completed winner replays retained output; running cloud work attaches by read,
|
|
81
|
+
while the server decides recovery eligibility. Failed or cancelled terminal
|
|
82
|
+
work refuses continuation. Read retained evidence before starting fresh work.
|
|
83
|
+
|
|
84
|
+
`graph analyze <run-id> --profile <name|path>` sends the retained source to the
|
|
85
|
+
maintained Braid companion. Install it through `npm install --global
|
|
86
|
+
@tangle-network/braid`. This `--profile` selects a canonical analysis AgentProfile,
|
|
87
|
+
not Tangle account credentials. Use `--dry-run` to inspect the bound analysis
|
|
88
|
+
configuration without dispatch. The CLI supplies its subscription-only Bridge;
|
|
89
|
+
Braid owns the saved analysis. Missing source, native capture or measured usage
|
|
90
|
+
stays unavailable.
|
|
91
|
+
|
|
64
92
|
## Sandbox Lifecycle
|
|
65
93
|
|
|
66
94
|
```bash
|
|
@@ -229,17 +257,22 @@ tangle hub github-app mint-installation-token --repo-url https://github.com/owne
|
|
|
229
257
|
|
|
230
258
|
## Secrets
|
|
231
259
|
|
|
232
|
-
Secrets are scoped to your account (or team).
|
|
260
|
+
Secrets are scoped to your account (or team). Values never round-trip: `create`, `list`, `delete` only. At create time a bare `--secret NAME` is box delivery; proxy custody is `--proxy-secret`.
|
|
233
261
|
|
|
234
262
|
```bash
|
|
235
263
|
tangle secret create DATABASE_URL "postgres://..."
|
|
236
264
|
tangle secret create API_KEY # prompts interactively
|
|
237
265
|
tangle secret list
|
|
238
|
-
tangle secret show DATABASE_URL --reveal
|
|
239
|
-
tangle secret update DATABASE_URL "new-value"
|
|
240
266
|
tangle secret delete DATABASE_URL
|
|
241
267
|
```
|
|
242
268
|
|
|
269
|
+
Canonical proxy custody at create time — the value never enters the box:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
tangle sandbox create --proxy-secret '{"envName":"PROVIDER_KEY","secretRef":{"kind":"secret-ref","key":"PROVIDER_KEY"},"presentation":{"type":"bearer"},"hosts":["api.example.org"]}'
|
|
273
|
+
tangle sandbox create --proxy-secret @bindings.json # repeatable; array or single binding
|
|
274
|
+
```
|
|
275
|
+
|
|
243
276
|
## Snapshots
|
|
244
277
|
|
|
245
278
|
```bash
|
|
@@ -403,7 +436,6 @@ tangle preview rm <id> <preview-id>
|
|
|
403
436
|
|
|
404
437
|
## Common Mistakes
|
|
405
438
|
|
|
406
|
-
- **Forgetting `--reveal` on `secret show`:** values are hidden by default for safety.
|
|
407
439
|
- **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.
|
|
408
440
|
- **Calling hub tools without `--approve` on first use:** use `--approve` or set policy to `allow` first.
|
|
409
441
|
- **Missing `--json` when piping output:** many commands need explicit `--json` for machine-readable output.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{constants as e}from"node:fs";import{isAbsolute as t,join as n,relative as r}from"node:path";import{open as i,opendir as a,realpath as o}from"node:fs/promises";import{z as s}from"zod";import*as c from"@tangle-network/agent-runtime/kernel";import{CODEX_HOME_RULE as l,codexRefForFile as u,readSessionInput as d,storeGlob as f,withinPath as p}from"@tangle-network/harness-sessions";const m=s.object({harness:s.literal(`codex`),root:s.string().refine(t),basis:s.literal(`host-jail`),nativeSessionId:s.string().min(1),runId:s.string().min(1),requestDigest:s.string().regex(/^sha256:[a-f0-9]{64}$/)}),h=s.object({externalId:s.string(),internalId:s.string(),backend:s.literal(`codex`),cwd:s.string(),metadata:s.object({effective_native_store:m,agent_profile_binding:s.object({effectiveProfileDigest:s.string()})})});async function g(e,t){let i=[],s=l.sessionDirs.map(t=>n(e,t)),d=f(l.rollout),m=0;for(;s.length;){t.throwIfAborted();let l=s.shift();if(l===void 0)break;let f;try{f=await o(l)}catch(e){if(e.code===`ENOENT`)continue;throw e}if(!p(f,e))throw Error(`Native inventory escaped its attested store`);let h=await a(f);for await(let a of h){if(t.throwIfAborted(),++m>c.HARNESS_TRANSCRIPT_READ_LIMITS.maxFiles)throw Error(`Native inventory exceeds the capture bound`);let o=n(h.path,a.name);a.isDirectory()?s.push(o):a.isFile()&&d.test(a.name)&&i.push({path:r(e,o),nativeSessionId:u(o).nativeSessionId})}}return i}function _(t){return async r=>{if(r.harness!==`codex`)return{status:`unavailable`,reason:`unknown-harness`,skipped:[{path:r.harness,reason:`Native transcript capture is not configured for this harness`}]};let a=await fetch(`${t.bridgeUrl}/v1/sessions?session_id=${encodeURIComponent(r.sessionId)}&backend=${r.harness}`,{headers:{authorization:`Bearer ${t.bridgeBearer}`},signal:r.signal});if(!a.ok)throw Error(`Bridge session lookup failed (HTTP ${a.status})`);let l=s.object({data:s.tuple([h])}).parse(await a.json()).data[0],u=l.metadata.effective_native_store,f=await o(u.root);if(l.externalId!==r.sessionId||l.internalId!==u.nativeSessionId||l.cwd!==t.cwd||r.cwd!==t.cwd||l.metadata.agent_profile_binding.effectiveProfileDigest!==r.profileDigest||f!==u.root||!p(f,n(t.cwd,`.agent-home`))||!r.runs.some(e=>e.runId===u.runId&&e.requestDigest===u.requestDigest))throw Error(`Bridge native binding does not match this execution`);return c.captureBoundHarnessTranscript({harness:r.harness,binding:{kind:`bridge`,sessionId:r.sessionId,nativeSessionId:u.nativeSessionId,profileDigest:r.profileDigest,runs:r.runs,...r.node===void 0?{}:{node:r.node}},nativeSessionId:u.nativeSessionId,files:await g(f,r.signal),signal:r.signal,parse:(e,t)=>d(r.harness,{text:e},{nativeSessionId:t.nativeSessionId,label:t.path},{corruption:`strict`}),read:async(t,r)=>{let a=await o(n(f,t.path));if(!p(a,f))throw Error(`Native session escaped its attested store`);let s=await i(a,e.O_RDONLY|e.O_NOFOLLOW);try{let e=await s.stat();if(!e.isFile()||e.size>c.HARNESS_TRANSCRIPT_READ_LIMITS.maxFileBytes)throw Error(`Native session is not a bounded regular file`);r?.throwIfAborted();let t=await s.readFile();return r?.throwIfAborted(),t}finally{await s.close()}}})}}const v=async(e,t)=>{if(e.harness!==`codex`||e.binding?.kind!==`bridge`)throw Error(`Native transcript reader is not configured for this capture`);return(await c.readBoundHarnessSessions({nativeSessionId:e.binding.nativeSessionId,files:e.files.map(e=>({path:e.path,nativeSessionId:u(e.path).nativeSessionId,byteLength:e.bytes})),read:async t=>{let n=e.files.find(e=>e.path===t.path);if(!n)throw Error(`Retained native file is absent`);return Buffer.from(n.content,`utf8`)},parse:(e,t)=>d(`codex`,{text:e},{nativeSessionId:t.nativeSessionId,label:t.path},{corruption:`strict`}),signal:t})).sessions};export{_ as graphNativeCapture,v as readGraphSessions};
|