@tangle-network/sandbox 0.60.92 → 0.61.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.
Files changed (36) hide show
  1. package/README.md +19 -0
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +3 -3
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/{agent-run-outcome-KxjDXZW-.d.ts → agent-run-outcome-CeLkJvZi.d.ts} +1 -1
  6. package/dist/auth/index.d.ts +1 -1
  7. package/dist/{client-BJ-xYm0s.js → client-BHPnb3B8.js} +6 -39
  8. package/dist/{client-BZnfyj0K.d.ts → client-BV-mz_BF.d.ts} +5 -20
  9. package/dist/collaboration/index.d.ts +1 -1
  10. package/dist/core.d.ts +8 -7
  11. package/dist/core.js +4 -3
  12. package/dist/{errors-Fv8leP33.d.ts → errors-gxmvF7f3.d.ts} +2 -40
  13. package/dist/{index-LO5315tT.d.ts → index-Ce5iKhZA.d.ts} +2 -2
  14. package/dist/index.d.ts +23 -21
  15. package/dist/index.js +6 -5
  16. package/dist/interactive-controller-BSWoA0YE.d.ts +40 -0
  17. package/dist/{interactive-controller-Bize8Sca.js → interactive-controller-fX2Jcd-i.js} +1 -0
  18. package/dist/{lines-BgVaTJBw.d.ts → lines-D7JSxj4C.d.ts} +1 -1
  19. package/dist/lines.d.ts +1 -1
  20. package/dist/{managed-process-BoQAK9cz.d.ts → managed-process-Doreyng1.d.ts} +1 -1
  21. package/dist/{preview-Zqt4hIgH.d.ts → preview-Dm1fetSw.d.ts} +3 -3
  22. package/dist/public-templates-2xo4Olua.d.ts +74 -0
  23. package/dist/public-templates.d.ts +2 -0
  24. package/dist/public-templates.js +161 -0
  25. package/dist/{raw-evidence-archive-BjDIFiOM.js → raw-evidence-archive-tCj9wHJ4.js} +131 -68
  26. package/dist/runtime.d.ts +4 -3
  27. package/dist/runtime.js +1 -1
  28. package/dist/{sandbox-CCVZWs8k.js → sandbox-BQhR6t3-.js} +26 -2
  29. package/dist/{sandbox-00TWLhei.d.ts → sandbox-cRwtd-Y1.d.ts} +17 -3
  30. package/dist/tangle/index.d.ts +1 -1
  31. package/dist/tangle/index.js +1 -1
  32. package/dist/{tangle-DugVLl53.js → tangle-Dcy6dgwL.js} +1 -1
  33. package/dist/{types-DWG-ZlvL.d.ts → types-D-KfVFtn.d.ts} +125 -3
  34. package/package.json +11 -6
  35. /package/dist/{index-BxyTdtyB.d.ts → index-CWUW8pqr.d.ts} +0 -0
  36. /package/dist/{index-ONMNeJwr.d.ts → index-DfA_usrZ.d.ts} +0 -0
@@ -0,0 +1,161 @@
1
+ import { C as readResponseJson, h as SandboxError } from "./errors-DSJBKmGZ.js";
2
+ import { z } from "zod";
3
+ //#region src/public-templates.ts
4
+ const publicationStatus = z.enum([
5
+ "pending",
6
+ "scanning",
7
+ "blocked",
8
+ "ready",
9
+ "failed"
10
+ ]);
11
+ const publishJobSchema = z.object({
12
+ id: z.string().min(1),
13
+ artifactId: z.string().min(1),
14
+ templateId: z.string().nullable(),
15
+ versionId: z.string().nullable(),
16
+ status: publicationStatus,
17
+ createdByCustomerId: z.string(),
18
+ completedAt: z.string().nullable(),
19
+ createdAt: z.string(),
20
+ updatedAt: z.string()
21
+ });
22
+ const artifactSchema = z.object({
23
+ id: z.string().min(1),
24
+ status: publicationStatus,
25
+ sourceSnapshotId: z.string(),
26
+ sourceSandboxId: z.string(),
27
+ derivedSnapshotId: z.string().nullable(),
28
+ errorMessage: z.string().nullable()
29
+ });
30
+ const publishResponseSchema = z.object({
31
+ job: publishJobSchema,
32
+ artifact: artifactSchema
33
+ });
34
+ /** A failed or interrupted publication retains its accepted job for resumption. */
35
+ var PublicTemplatePublishError = class extends SandboxError {
36
+ job;
37
+ artifact;
38
+ constructor(message, code, job, artifact, cause) {
39
+ super(message, code, cause instanceof SandboxError ? cause.status : void 0, { origin: "sandbox-api" });
40
+ this.name = "PublicTemplatePublishError";
41
+ this.job = job;
42
+ this.artifact = artifact;
43
+ this.cause = cause;
44
+ }
45
+ };
46
+ function pause(ms, signal) {
47
+ return new Promise((resolve, reject) => {
48
+ signal.throwIfAborted();
49
+ const onAbort = () => {
50
+ clearTimeout(timer);
51
+ reject(signal.reason);
52
+ };
53
+ const timer = setTimeout(() => {
54
+ signal.removeEventListener("abort", onAbort);
55
+ resolve();
56
+ }, ms);
57
+ signal.addEventListener("abort", onAbort, { once: true });
58
+ });
59
+ }
60
+ /** Public catalog and snapshot publication, shared by SDK, CLI and browser callers. */
61
+ var PublicTemplatesClient = class {
62
+ client;
63
+ constructor(client) {
64
+ this.client = client;
65
+ }
66
+ async list(options) {
67
+ const params = new URLSearchParams();
68
+ if (options?.query) params.set("q", options.query);
69
+ if (options?.tag) params.set("tag", options.tag);
70
+ if (options?.featuredOnly) params.set("featured", "true");
71
+ if (options?.limit !== void 0) params.set("limit", String(options.limit));
72
+ if (options?.offset !== void 0) params.set("offset", String(options.offset));
73
+ const suffix = params.toString();
74
+ return (await readResponseJson(await this.client.fetch(`/v1/public-templates${suffix ? `?${suffix}` : ""}`))).templates ?? [];
75
+ }
76
+ async featured() {
77
+ return (await readResponseJson(await this.client.fetch("/v1/public-templates/featured"))).templates ?? [];
78
+ }
79
+ async get(idOrSlug) {
80
+ return (await readResponseJson(await this.client.fetch(`/v1/public-templates/${encodeURIComponent(idOrSlug)}`))).template;
81
+ }
82
+ async versions(idOrSlug) {
83
+ return (await readResponseJson(await this.client.fetch(`/v1/public-templates/${encodeURIComponent(idOrSlug)}/versions`))).versions ?? [];
84
+ }
85
+ async publish(input, options = {}) {
86
+ return (await this.publishAndWait("/v1/public-templates", input, options)).template;
87
+ }
88
+ async publishVersion(idOrSlug, input, options = {}) {
89
+ return (await this.publishAndWait(`/v1/public-templates/${encodeURIComponent(idOrSlug)}/versions`, input, options, idOrSlug)).version;
90
+ }
91
+ async publishAndWait(path, input, options, idOrSlug) {
92
+ const timeoutMs = options.timeoutMs ?? 30 * 6e4;
93
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647) throw new TypeError("timeoutMs must be a positive safe timer interval");
94
+ if (options.resumeJobId !== void 0 && !options.resumeJobId.trim()) throw new TypeError("resumeJobId must not be empty");
95
+ options.signal?.throwIfAborted();
96
+ const timeout = AbortSignal.timeout(timeoutMs);
97
+ const signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
98
+ let job;
99
+ let artifact;
100
+ const read = async (endpoint, init) => readResponseJson(await this.client.fetch(endpoint, {
101
+ ...init,
102
+ signal
103
+ }));
104
+ const readJob = async (id) => {
105
+ const body = await read(`/v1/public-templates/publish-jobs/${encodeURIComponent(id)}`);
106
+ const next = z.object({ job: publishJobSchema }).parse(body).job;
107
+ if (next.id !== id || job && (next.artifactId !== job.artifactId || next.templateId !== job.templateId || next.versionId !== job.versionId)) throw new Error("Publication job identity changed");
108
+ return next;
109
+ };
110
+ try {
111
+ if (options.resumeJobId) {
112
+ job = await readJob(options.resumeJobId);
113
+ artifact = z.object({ artifact: artifactSchema }).parse(await read(`/v1/public-templates/artifacts/${encodeURIComponent(job.artifactId)}`)).artifact;
114
+ } else {
115
+ const accepted = publishResponseSchema.parse(await read(path, {
116
+ method: "POST",
117
+ body: JSON.stringify(input)
118
+ }));
119
+ job = accepted.job;
120
+ artifact = accepted.artifact;
121
+ }
122
+ if (artifact.id !== job.artifactId || artifact.sourceSnapshotId !== input.snapshotId || artifact.sourceSandboxId !== input.sourceSandboxId) throw new Error("Publication receipt does not match the requested snapshot");
123
+ if (idOrSlug && options.resumeJobId) {
124
+ const { template } = await read(`/v1/public-templates/${encodeURIComponent(idOrSlug)}`);
125
+ if (template.id !== job.templateId) throw new Error("Publication job belongs to a different template");
126
+ }
127
+ let observed;
128
+ while (true) {
129
+ signal.throwIfAborted();
130
+ if (job.status !== observed) {
131
+ observed = job.status;
132
+ options.onProgress?.({ ...job });
133
+ }
134
+ if (job.status === "blocked" || job.status === "failed") {
135
+ artifact = z.object({ artifact: artifactSchema }).parse(await read(`/v1/public-templates/artifacts/${encodeURIComponent(job.artifactId)}`)).artifact;
136
+ throw new PublicTemplatePublishError(artifact.errorMessage ?? `Template publication ${job.id} ${job.status}`, job.status === "blocked" ? "TEMPLATE_PUBLICATION_BLOCKED" : "TEMPLATE_PUBLICATION_FAILED", job, artifact);
137
+ }
138
+ if (job.status === "ready") break;
139
+ await pause(1e3, signal);
140
+ job = await readJob(job.id);
141
+ }
142
+ if (!job.templateId || !job.versionId) throw new Error("Ready publication has no template or version");
143
+ const { template } = await read(`/v1/public-templates/${encodeURIComponent(job.templateId)}`);
144
+ if (!template || template.id !== job.templateId) throw new Error("Ready publication returned a different template");
145
+ let version = template.latestVersion;
146
+ if (version?.id !== job.versionId) version = (await read(`/v1/public-templates/${encodeURIComponent(job.templateId)}/versions`)).versions?.find((entry) => entry.id === job?.versionId) ?? null;
147
+ if (!version || version.templateId !== job.templateId || !version.publicArtifactId || version.publicArtifactId !== job.artifactId) throw new Error("Published version does not match the completed artifact");
148
+ return {
149
+ template,
150
+ version
151
+ };
152
+ } catch (cause) {
153
+ if (cause instanceof PublicTemplatePublishError) throw cause;
154
+ const interrupted = signal.aborted;
155
+ const message = timeout.aborted ? `Timed out waiting for template publication after ${timeoutMs} ms` : cause instanceof Error ? cause.message : "Template publication could not be confirmed";
156
+ throw new PublicTemplatePublishError(job ? `${message}. Publication ${job.id} is ${job.status}; resume it with resumeJobId instead of publishing again.` : message, interrupted ? "TEMPLATE_PUBLICATION_WAIT_INTERRUPTED" : "TEMPLATE_PUBLICATION_UNCONFIRMED", job, artifact, cause);
157
+ }
158
+ }
159
+ };
160
+ //#endregion
161
+ export { PublicTemplatePublishError, PublicTemplatesClient };
@@ -30,6 +30,18 @@ const metadata = z.object({
30
30
  ctimeMs: z.number().finite(),
31
31
  sizeBytes: count
32
32
  });
33
+ const nativeCopyFile = payload.extend({
34
+ store: safePath,
35
+ storePath: safePath,
36
+ format: text,
37
+ method: z.enum([
38
+ "byte-prefix",
39
+ "atomic-file",
40
+ "sqlite-backup"
41
+ ]),
42
+ truncated: z.boolean(),
43
+ sourceBytes: count
44
+ });
33
45
  const nativeSessionCopy = z.object({
34
46
  harness: text,
35
47
  format: text.nullable(),
@@ -50,31 +62,62 @@ const nativeSessionCopy = z.object({
50
62
  "unknown"
51
63
  ])
52
64
  }),
53
- files: z.array(payload.extend({
54
- store: safePath,
65
+ files: z.array(nativeCopyFile),
66
+ superseded: z.array(z.object({
55
67
  storePath: safePath,
56
- format: text,
57
- method: z.enum([
58
- "byte-prefix",
59
- "atomic-file",
60
- "sqlite-backup"
61
- ]),
62
- truncated: z.boolean(),
63
- sourceBytes: count
64
- })),
68
+ sha256: text,
69
+ sizeBytes: count,
70
+ supersededBy: z.object({
71
+ executionId: text,
72
+ attempt: count.min(1)
73
+ })
74
+ })).optional(),
65
75
  complete: z.boolean(),
66
76
  missingReasons: z.array(text)
67
77
  });
78
+ const captureIdentity = {
79
+ proofStatus: z.enum(["verified", "unverified"]),
80
+ containerId: z.string().regex(/^[a-f0-9]{64}$/).optional(),
81
+ sidecarImageDigest: digest,
82
+ sidecarBundleRevision: z.string().regex(/^[a-f0-9]{40}$/),
83
+ sidecarBundleChecksum: digest.optional()
84
+ };
85
+ /** Every native store on the box: each runtime HOME's declared stores and every settled copy. */
86
+ const boxManifestSchema = z.object({
87
+ schema: z.literal("tangle.raw-evidence-archive.box.v1"),
88
+ scope: z.literal("box"),
89
+ status: z.enum(["captured", "partial"]),
90
+ ...captureIdentity,
91
+ roots: z.array(z.object({
92
+ harness: text,
93
+ path: text,
94
+ kind: z.enum(["shared", "isolated"]),
95
+ homes: count
96
+ })),
97
+ homes: z.array(z.object({
98
+ harness: text,
99
+ runtimeHome: text,
100
+ copy: z.literal("snapshot"),
101
+ capturedAt: text,
102
+ live: z.boolean(),
103
+ files: z.array(nativeCopyFile),
104
+ excluded: z.array(z.object({
105
+ storePath: safePath,
106
+ reason: z.literal("credential")
107
+ })),
108
+ complete: z.boolean(),
109
+ missingReasons: z.array(text)
110
+ })),
111
+ nativeSessions: z.array(nativeSessionCopy.extend({ runtimeHome: text.nullable() })),
112
+ coverageComplete: z.boolean(),
113
+ missingReasons: z.array(text)
114
+ });
68
115
  const manifestBase = z.object({
69
116
  status: z.enum(["captured", "partial"]),
70
117
  sessionId: text,
71
118
  backendType: z.string().regex(/^[a-z][a-z0-9_-]{0,127}$/),
72
119
  nativeSessionId: text.nullable(),
73
- proofStatus: z.enum(["verified", "unverified"]),
74
- containerId: z.string().regex(/^[a-f0-9]{64}$/).optional(),
75
- sidecarImageDigest: digest,
76
- sidecarBundleRevision: z.string().regex(/^[a-f0-9]{40}$/),
77
- sidecarBundleChecksum: digest.optional(),
120
+ ...captureIdentity,
78
121
  nativeRoots: z.array(z.object({
79
122
  sourceId: text.optional(),
80
123
  rootScope: scope,
@@ -170,15 +213,15 @@ const manifestSchema = z.union([
170
213
  ]);
171
214
  const MAX_METADATA = 64 * 1024 * 1024;
172
215
  const MAX_RECORD = 16 * 1024 * 1024;
173
- /** Node-only directory export. Flat generated member names cannot traverse or create links. */
174
- async function exportRawEvidenceDirectory(request, sessionId, targetDirectory, options, expected) {
216
+ async function exportRawEvidenceDirectory(request, subject, targetDirectory, options, expected) {
217
+ const sessionId = typeof subject === "string" ? subject : void 0;
175
218
  for (const [name, value] of Object.entries({
176
219
  maxBytes: options.maxBytes,
177
220
  maxFiles: options.maxFiles,
178
221
  maxArchiveBytes: options.maxArchiveBytes ?? options.maxBytes
179
222
  })) if (!Number.isSafeInteger(value) || value <= 0) throw new Error(`${name} must be a positive safe integer`);
180
223
  if (options.maxFiles > 1e6) throw new Error("maxFiles exceeds 1000000");
181
- if (options.parts !== void 0 && (options.parts !== "native" || !options.copy)) throw new Error("parts must be native, together with copy");
224
+ if ("parts" in options && options.parts !== void 0 && (options.parts !== "native" || !options.copy)) throw new Error("parts must be native, together with copy");
182
225
  options.signal?.throwIfAborted();
183
226
  const fs = await import("node:fs/promises");
184
227
  const { dirname, join, resolve } = await import("node:path");
@@ -201,13 +244,18 @@ async function exportRawEvidenceDirectory(request, sessionId, targetDirectory, o
201
244
  throw new Error(`Raw evidence archive request failed (HTTP ${response.status}); no legacy fallback`);
202
245
  }
203
246
  if (response.headers.get("content-type")?.includes("application/json")) {
204
- const body = await readBoundedResponse(response, 64 * 1024, options.signal);
247
+ const body = JSON.parse(await readBoundedResponse(response, 64 * 1024, options.signal));
248
+ if (sessionId === void 0) return z.object({
249
+ status: z.literal("unavailable"),
250
+ scope: z.literal("box"),
251
+ reason: text
252
+ }).parse(body);
205
253
  return z.object({
206
254
  status: z.literal("unavailable"),
207
255
  sessionId: z.literal(sessionId),
208
256
  backendType: text,
209
257
  reason: text
210
- }).parse(JSON.parse(body));
258
+ }).parse(body);
211
259
  }
212
260
  const expectedManifest = response.headers.get("x-evidence-manifest-sha256");
213
261
  if (!expectedManifest || !/^sha256:[a-f0-9]{64}$/.test(expectedManifest)) {
@@ -337,59 +385,74 @@ async function exportRawEvidenceDirectory(request, sessionId, targetDirectory, o
337
385
  for (const outcome of settled) if (outcome.status === "rejected") throw outcome.reason;
338
386
  const manifestRef = members.get("manifest.json");
339
387
  if (!manifestRef || manifestRef.sha256 !== expectedManifest) throw new Error("Evidence manifest digest mismatch");
340
- const manifest = manifestSchema.parse(JSON.parse(await fs.readFile(join(directory, "manifest.json"), "utf8")));
341
- if (manifest.sessionId !== sessionId || manifest.backendType === "unknown") throw new Error("Evidence identity mismatch");
342
- if (manifest.proofStatus === "verified" && (!manifest.containerId || !manifest.sidecarBundleChecksum)) throw new Error("Evidence capture proof is incomplete");
343
- if (expected && (manifest.proofStatus !== "verified" || manifest.containerId !== expected.containerId || manifest.sidecarImageDigest !== expected.imageId || manifest.sidecarBundleRevision !== expected.bundleRevision || manifest.sidecarBundleChecksum !== expected.bundleChecksum)) throw new Error("Evidence does not match current container capture proof");
344
- const captured = manifest.status === "captured";
345
- if (captured ? !manifest.coverageComplete || manifest.missingReasons.length || !Object.values(manifest.completeness).every(Boolean) || !manifest.attempts.length : manifest.coverageComplete || !manifest.missingReasons.length) throw new Error("Evidence coverage status is inconsistent");
346
- if (manifest.inventory.skippedEntries !== manifest.skipped.length) throw new Error("Evidence inventory mismatch");
347
- const ids = new Set(manifest.attempts.flatMap((attempt) => attempt.nativeSessionIds));
348
- const aggregateId = ids.size === 1 && manifest.attempts.every((attempt) => attempt.nativeSessionIds.length === 1) ? [...ids][0] : null;
349
- if (manifest.nativeSessionId !== aggregateId) throw new Error("Evidence native session ID mismatch");
388
+ const parsed = JSON.parse(await fs.readFile(join(directory, "manifest.json"), "utf8"));
350
389
  const verify = (ref) => {
351
390
  const member = members.get(ref.path);
352
391
  if (!member || member.sha256 !== ref.sha256 || member.sizeBytes !== ref.sizeBytes) throw new Error("Evidence payload hash or size mismatch");
353
392
  };
354
- for (const item of manifest.files) if (item.kind === "file") {
355
- if (!item.content || item.sha256 !== item.content.sha256 || item.sizeBytes !== item.content.sizeBytes) throw new Error("Evidence native payload mismatch");
356
- verify(item.content);
357
- } else if (item.content || item.sha256 || item.kind === "symlink" && item.linkTarget === void 0) throw new Error("Evidence native metadata mismatch");
358
- const nativeSessions = manifest.schema === "tangle.raw-evidence-archive.v2" ? manifest.nativeSessions : [];
359
- for (const copy of nativeSessions) {
360
- if (!manifest.attempts.some((attempt) => attempt.executionId === copy.executionId && attempt.ordinal === copy.attempt)) throw new Error("Evidence native session copy is unattributed");
361
- for (const file of copy.files) verify(file);
362
- }
363
- for (const item of manifest.processSources) {
364
- if (item.sha256 !== item.content.sha256 || item.sizeBytes !== item.content.sizeBytes) throw new Error("Evidence process source mismatch");
365
- verify(item.content);
366
- }
367
- const processIo = "parts" in manifest ? void 0 : manifest.processIo;
368
- const processRecords = "parts" in manifest ? [] : [manifest.processIo, manifest.processTerminals];
369
- for (const ref of processRecords) {
370
- verify(ref);
371
- let count = 0;
372
- for await (const row of readRecords(join(directory, ref.path), options.signal)) {
373
- count++;
374
- if (ref === processIo) {
375
- const content = payload.parse(row.content);
376
- verify(content);
377
- if (content.sizeBytes !== row.sizeBytes || content.sha256 !== row.sha256 || row.contentBase64 !== void 0) throw new Error("Evidence process frame mismatch");
393
+ const checkProof = (identity) => {
394
+ if (identity.proofStatus === "verified" && (!identity.containerId || !identity.sidecarBundleChecksum)) throw new Error("Evidence capture proof is incomplete");
395
+ if (expected && (identity.proofStatus !== "verified" || identity.containerId !== expected.containerId || identity.sidecarImageDigest !== expected.imageId || identity.sidecarBundleRevision !== expected.bundleRevision || identity.sidecarBundleChecksum !== expected.bundleChecksum)) throw new Error("Evidence does not match current container capture proof");
396
+ };
397
+ let manifest;
398
+ if (sessionId === void 0) {
399
+ const box = boxManifestSchema.parse(parsed);
400
+ checkProof(box);
401
+ if (box.status === "captured" ? !box.coverageComplete || box.missingReasons.length > 0 || box.homes.some((home) => home.live || !home.complete) : box.coverageComplete || box.missingReasons.length === 0) throw new Error("Evidence coverage status is inconsistent");
402
+ for (const home of box.homes) for (const file of home.files) verify(file);
403
+ for (const copy of box.nativeSessions) for (const file of copy.files) verify(file);
404
+ manifest = box;
405
+ } else {
406
+ const session = manifestSchema.parse(parsed);
407
+ if (session.sessionId !== sessionId || session.backendType === "unknown") throw new Error("Evidence identity mismatch");
408
+ checkProof(session);
409
+ const captured = session.status === "captured";
410
+ if (captured ? !session.coverageComplete || session.missingReasons.length || !Object.values(session.completeness).every(Boolean) || !session.attempts.length : session.coverageComplete || !session.missingReasons.length) throw new Error("Evidence coverage status is inconsistent");
411
+ if (session.inventory.skippedEntries !== session.skipped.length) throw new Error("Evidence inventory mismatch");
412
+ const ids = new Set(session.attempts.flatMap((attempt) => attempt.nativeSessionIds));
413
+ const aggregateId = ids.size === 1 && session.attempts.every((attempt) => attempt.nativeSessionIds.length === 1) ? [...ids][0] : null;
414
+ if (session.nativeSessionId !== aggregateId) throw new Error("Evidence native session ID mismatch");
415
+ for (const item of session.files) if (item.kind === "file") {
416
+ if (!item.content || item.sha256 !== item.content.sha256 || item.sizeBytes !== item.content.sizeBytes) throw new Error("Evidence native payload mismatch");
417
+ verify(item.content);
418
+ } else if (item.content || item.sha256 || item.kind === "symlink" && item.linkTarget === void 0) throw new Error("Evidence native metadata mismatch");
419
+ const nativeSessions = session.schema === "tangle.raw-evidence-archive.v2" ? session.nativeSessions : [];
420
+ for (const copy of nativeSessions) {
421
+ if (!session.attempts.some((attempt) => attempt.executionId === copy.executionId && attempt.ordinal === copy.attempt)) throw new Error("Evidence native session copy is unattributed");
422
+ for (const file of copy.files) verify(file);
423
+ }
424
+ for (const item of session.processSources) {
425
+ if (item.sha256 !== item.content.sha256 || item.sizeBytes !== item.content.sizeBytes) throw new Error("Evidence process source mismatch");
426
+ verify(item.content);
427
+ }
428
+ const processIo = "parts" in session ? void 0 : session.processIo;
429
+ const processRecords = "parts" in session ? [] : [session.processIo, session.processTerminals];
430
+ for (const ref of processRecords) {
431
+ verify(ref);
432
+ let count = 0;
433
+ for await (const row of readRecords(join(directory, ref.path), options.signal)) {
434
+ count++;
435
+ if (ref === processIo) {
436
+ const content = payload.parse(row.content);
437
+ verify(content);
438
+ if (content.sizeBytes !== row.sizeBytes || content.sha256 !== row.sha256 || row.contentBase64 !== void 0) throw new Error("Evidence process frame mismatch");
439
+ }
440
+ if (captured && !session.attempts.some((attempt) => attempt.executionId === row.executionId && attempt.ordinal === row.ordinal && attempt.providerSessionId === row.providerSessionId && attempt.processIds.includes(String(row.processId)))) throw new Error("Evidence process attribution mismatch");
378
441
  }
379
- if (captured && !manifest.attempts.some((attempt) => attempt.executionId === row.executionId && attempt.ordinal === row.ordinal && attempt.providerSessionId === row.providerSessionId && attempt.processIds.includes(String(row.processId)))) throw new Error("Evidence process attribution mismatch");
442
+ if (count !== ref.records) throw new Error("Evidence record count mismatch");
380
443
  }
381
- if (count !== ref.records) throw new Error("Evidence record count mismatch");
382
- }
383
- for (const event of manifest.events) {
384
- verify(event.frames);
385
- let count = 0;
386
- let last = "";
387
- for await (const row of readRecords(join(directory, event.frames.path), options.signal)) {
388
- count++;
389
- if (typeof row.eventId !== "string") throw new Error("Evidence event identity missing");
390
- last = row.eventId;
444
+ for (const event of session.events) {
445
+ verify(event.frames);
446
+ let count = 0;
447
+ let last = "";
448
+ for await (const row of readRecords(join(directory, event.frames.path), options.signal)) {
449
+ count++;
450
+ if (typeof row.eventId !== "string") throw new Error("Evidence event identity missing");
451
+ last = row.eventId;
452
+ }
453
+ if (count !== event.frames.records || event.metadata.sessionId !== sessionId || captured && (count !== event.metadata.eventCount || last !== event.metadata.lastEventId)) throw new Error("Evidence event sequence mismatch");
391
454
  }
392
- if (count !== event.frames.records || event.metadata.sessionId !== sessionId || captured && (count !== event.metadata.eventCount || last !== event.metadata.lastEventId)) throw new Error("Evidence event sequence mismatch");
455
+ manifest = session;
393
456
  }
394
457
  options.signal?.throwIfAborted();
395
458
  try {
@@ -416,7 +479,7 @@ async function exportRawEvidenceDirectory(request, sessionId, targetDirectory, o
416
479
  } catch (error) {
417
480
  await fs.writeFile(join(staging, "failure.json"), JSON.stringify({
418
481
  status: "incomplete",
419
- sessionId,
482
+ ...sessionId === void 0 ? { scope: "box" } : { sessionId },
420
483
  reason: error instanceof Error ? error.message : String(error)
421
484
  }), { mode: 384 });
422
485
  throw new Error(`Evidence export failed; partial bytes retained at ${staging}`, { cause: error });
package/dist/runtime.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { A as CommitTaskSessionOptions, An as ListMessagesOptions, At as FileTreeOptions, Bi as SandboxTerminalCreateOptions, Ct as FileReadBatchOptions, Di as SandboxPortBinding, Dt as FileRenameResult, H as CreateTaskSessionOptions, Hi as SandboxTerminalManager, Ma as TaskSessionCommitResult, Mt as FileUsageOptions, Nt as FileUsageResult, Pa as TaskSessionInfo, Pi as SandboxRuntimeHealth, Pt as FileWriteResult, Qa as WriteFileOptions, T as ChunkedUploadResult, Ui as SandboxTerminalRequestOptions, V as CreateSessionOptions, Vi as SandboxTerminalInfo, Vr as SandboxEvent, aa as SessionExecutionInfo, ea as SendSessionMessageOptions, fa as SessionMessage, ia as SessionEventStreamOptions, ja as TaskSessionChanges, jt as FileTreeResult, la as SessionInfo, na as SentSessionMessage, oa as SessionExecutionStatus, pa as SessionMessageAdmission, qa as UploadProgress, ta as SendSessionMessageRequest, w as ChunkedUploadOptions, wt as FileReadBatchResult, xr as RenameOptions } from "./types-DWG-ZlvL.js";
1
+ import { A as CommitTaskSessionOptions, An as ListMessagesOptions, At as FileTreeOptions, Bi as SandboxTerminalCreateOptions, Ct as FileReadBatchOptions, Di as SandboxPortBinding, Dt as FileRenameResult, H as CreateTaskSessionOptions, Hi as SandboxTerminalManager, Ma as TaskSessionCommitResult, Mt as FileUsageOptions, Nt as FileUsageResult, Pa as TaskSessionInfo, Pi as SandboxRuntimeHealth, Pt as FileWriteResult, Qa as WriteFileOptions, T as ChunkedUploadResult, Ui as SandboxTerminalRequestOptions, V as CreateSessionOptions, Vi as SandboxTerminalInfo, Vr as SandboxEvent, aa as SessionExecutionInfo, ea as SendSessionMessageOptions, fa as SessionMessage, ia as SessionEventStreamOptions, ja as TaskSessionChanges, jt as FileTreeResult, la as SessionInfo, na as SentSessionMessage, oa as SessionExecutionStatus, pa as SessionMessageAdmission, qa as UploadProgress, ta as SendSessionMessageRequest, w as ChunkedUploadOptions, wt as FileReadBatchResult, xr as RenameOptions } from "./types-D-KfVFtn.js";
2
2
  import { n as TerminalStream, p as ScopedToken } from "./terminal-stream-DgD7GlFi.js";
3
3
  import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-B6sySQFu.js";
4
- import { C as ValidationError, S as TimeoutError, _ as SandboxFailureDetail, d as NotFoundError, f as PartialFailureError, g as SandboxErrorJson, h as SandboxError, o as FileWriteConflictError, p as QuotaError, r as CapabilityError, t as AuthError, u as NetworkError, v as ServerError, w as BrowserInteractiveSessionController, y as StateError } from "./errors-Fv8leP33.js";
5
- import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-KxjDXZW-.js";
4
+ import { t as BrowserInteractiveSessionController } from "./interactive-controller-BSWoA0YE.js";
5
+ import { C as ValidationError, S as TimeoutError, _ as SandboxFailureDetail, d as NotFoundError, f as PartialFailureError, g as SandboxErrorJson, h as SandboxError, o as FileWriteConflictError, p as QuotaError, r as CapabilityError, t as AuthError, u as NetworkError, v as ServerError, y as StateError } from "./errors-gxmvF7f3.js";
6
+ import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-CeLkJvZi.js";
6
7
 
7
8
  //#region src/lib/chunked-upload.d.ts
8
9
  /** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, t as BrowserInteractiveSessionController, u as SandboxRuntimeApi, z as projectAgentTerminalRecord } from "./interactive-controller-Bize8Sca.js";
1
+ import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, t as BrowserInteractiveSessionController, u as SandboxRuntimeApi, z as projectAgentTerminalRecord } from "./interactive-controller-fX2Jcd-i.js";
2
2
  import { _ as StateError, b as ValidationError, d as NotFoundError, f as PartialFailureError, g as ServerError, h as SandboxError, o as FileWriteConflictError, p as QuotaError, r as CapabilityError, t as AuthError, u as NetworkError, y as TimeoutError } from "./errors-DSJBKmGZ.js";
3
3
  import { f as combineAbortSignals, n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BJf0P_J4.js";
4
4
  import { s as uploadChunked } from "./chunked-upload-ClCKGr59.js";
@@ -1,5 +1,5 @@
1
1
  import { r as backendTypeSchema } from "./backend-types-D6bYbvMB.js";
2
- import { A as normalizeRuntimeBackendConfig, C as encodePromptForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as withoutRuntimeSecrets, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, M as requestedSecretProfilePublicDigest, S as validateAcceptedDispatchRunRef, T as parseSSEStream, _ as mintTraceId, a as terminalUpgradeHeadersSupported, b as sessionHeaders, d as isRetryableCredentialRefusal, f as normalizeSessionInfo, g as isTraceId, h as TRACE_ID_HEADER, i as TerminalStreamError, j as requestedPublicProfileDigest, k as mergeRuntimeBackendConfig, l as requestScopedToken, m as waitForRetryAfter, n as InteractiveSessionController, p as sessionMessageRequestBody, r as TerminalStream, s as assertScopedTokenActive, u as SandboxRuntimeApi, v as resolveTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as appendSessionIdQuery } from "./interactive-controller-Bize8Sca.js";
2
+ import { A as normalizeRuntimeBackendConfig, C as encodePromptForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as withoutRuntimeSecrets, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, M as requestedSecretProfilePublicDigest, S as validateAcceptedDispatchRunRef, T as parseSSEStream, _ as mintTraceId, a as terminalUpgradeHeadersSupported, b as sessionHeaders, d as isRetryableCredentialRefusal, f as normalizeSessionInfo, g as isTraceId, h as TRACE_ID_HEADER, i as TerminalStreamError, j as requestedPublicProfileDigest, k as mergeRuntimeBackendConfig, l as requestScopedToken, m as waitForRetryAfter, n as InteractiveSessionController, p as sessionMessageRequestBody, r as TerminalStream, s as assertScopedTokenActive, u as SandboxRuntimeApi, v as resolveTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as appendSessionIdQuery } from "./interactive-controller-fX2Jcd-i.js";
3
3
  import { C as readResponseJson, S as parseResponseError, _ as StateError, b as ValidationError, d as NotFoundError, g as ServerError, h as SandboxError, i as EdgeNotReadyError, p as QuotaError, r as CapabilityError, t as AuthError, u as NetworkError, v as StreamInterruptedError, x as parseErrorResponse, y as TimeoutError } from "./errors-DSJBKmGZ.js";
4
4
  import { d as awaitWithAbort, f as combineAbortSignals, g as interactiveSessionStatusResponseSchema, h as interactiveSessionControlValidationResponseSchema, l as createInteractiveControlHolderId, m as interactiveSessionControlReleaseResponseSchema, p as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-BJf0P_J4.js";
5
5
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-qPVvvkgJ.js";
@@ -9375,7 +9375,7 @@ var SandboxInstance = class SandboxInstance {
9375
9375
  }
9376
9376
  /** @internal — invoked before the sandbox is deleted. */
9377
9377
  async _sessionExportRawEvidence(id, destination, options) {
9378
- const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-BjDIFiOM.js");
9378
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-tCj9wHJ4.js");
9379
9379
  await this.ensureRunning();
9380
9380
  await this.refresh();
9381
9381
  return exportRawEvidenceDirectory((signal) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams({
@@ -9389,6 +9389,30 @@ var SandboxInstance = class SandboxInstance {
9389
9389
  signal
9390
9390
  }), id, destination, options, this.#info.captureProof);
9391
9391
  }
9392
+ /**
9393
+ * Export every native session store on this box into a new local
9394
+ * directory: each runtime HOME's Claude Code, Codex, OpenCode and other
9395
+ * harness stores (transcripts and SQLite databases), and every settled
9396
+ * copy. The box-level twin of `box.session(id).exportRawEvidence`, for a
9397
+ * box about to be deleted, including one restored from a snapshot whose
9398
+ * session listing is empty. Only files a harness contract declares as its
9399
+ * session store are read; credentials and config never leave the box.
9400
+ *
9401
+ * The destination must not exist. Payload digests, the manifest digest
9402
+ * and the byte and file bounds are verified before the directory appears.
9403
+ */
9404
+ async exportRawEvidence(destination, options) {
9405
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-tCj9wHJ4.js");
9406
+ await this.ensureRunning();
9407
+ await this.refresh();
9408
+ return exportRawEvidenceDirectory((signal) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
9409
+ maxBytes: String(options.maxBytes),
9410
+ maxFiles: String(options.maxFiles)
9411
+ })}`, {
9412
+ method: "GET",
9413
+ signal
9414
+ }), { scope: "box" }, destination, options, this.#info.captureProof);
9415
+ }
9392
9416
  async _sessionRawEvidence(id) {
9393
9417
  await this.ensureRunning();
9394
9418
  await this.refresh();
@@ -1,9 +1,10 @@
1
1
  import { t as CliAuthReference } from "./cli-auth-bundle-BKsrsbxy.js";
2
- import { $a as WriteManyFile, $t as ForkIdempotency, A as CommitTaskSessionOptions, Ai as SandboxResourceUsage, An as ListMessagesOptions, Ba as TeePublicKeyResponse, C as BranchOptions, Cn as InstalledTool, Cr as ResumeOptions, D as CodeExecutionResult, Di as SandboxPortBinding, E as CodeExecutionOptions, Ea as StartupDiagnostics, Ei as SandboxOperationState, En as IntelligenceReportCompareTo, Er as RolloutOptions, Fi as SandboxShape, Fr as SandboxConnection, Gi as SandboxTraceBundle, H as CreateTaskSessionOptions, Ia as TeeAttestationOptions, Ir as SandboxDeleteAcknowledgement, Ji as SandboxTraceOptions, Lr as SandboxDeleteOptions, M as ConversationTurnOptions, Ma as TaskSessionCommitResult, Mr as SSHCommandDescriptor, N as ConversationTurnResult, Ni as SandboxRuntimeCapabilities, Nr as SSHCredentials, O as CodeLanguage, Oa as StopOptions, On as IntelligenceReportWindow, Or as RolloutStartResult, Ot as FileSystem, Pa as TaskSessionInfo, Pi as SandboxRuntimeHealth, Pt as FileWriteResult, Q as DispatchedSession, Qa as WriteFileOptions, Qt as ForkCounts, Ra as TeeAttestationResponse, Ri as SandboxStatus, Sa as SnapshotProvenance, Si as SandboxInfo, Sn as HttpClient, Sr as RestoreSnapshotOptions, Ti as SandboxOperationKind, Tn as IntelligenceReportBudget, Ua as TurnBackendConfig, V as CreateSessionOptions, Vr as SandboxEvent, Wa as TurnDriveResult, Wi as SandboxTerminals, Wn as NetworkManager, Xa as WaitForRolloutOptions, Xi as SearchMatch, Ya as WaitForOptions, Yn as PreviewLinkManager, Z as DispatchPromptOptions, Za as WorkspaceOperationLookup, Zi as SearchOptions, _a as SnapshotDeleteAcknowledgement, aa as SessionExecutionInfo, ao as SandboxEnvRecoveryView, ar as PromptInputPart, ba as SnapshotInfo, bt as ExecOptions, ca as SessionForkOptions, cn as GpuLease, co as RawEvidenceDirectoryExport, cr as ProvisionEvent, ct as DurablePlanDecisionResult, d as BackendConfig, da as SessionListOptions, ea as SendSessionMessageOptions, en as ForkLookupOptions, eo as WriteManyOptions, fa as SessionMessage, fi as SandboxFleetTraceBundle, fr as PublicProfileConflict, ha as SessionResultOptions, ht as EgressManager, ia as SessionEventStreamOptions, in as GitCommit, io as SandboxEnvRecovery, it as DriverInfo, j as CompletedTurnResult, ja as TaskSessionChanges, kn as JsonValue, la as SessionInfo, lo as RawEvidenceExportOptions, lr as ProvisionResult, mo as InteractionResolutionAcknowledgement, na as SentSessionMessage, nt as DriveTurnOptions, on as GitDiff, or as PromptOptions, ot as DurablePlan, p as BackendManager, pa as SessionMessageAdmission, pn as GpuLeaseManager, po as WorkspaceImagePublishResult$1, qn as PermissionsManager, rn as GitBranch, ro as SandboxCreateReceipt, sn as GitStatus, sr as PromptResult, st as DurablePlanDecisionOptions, ta as SendSessionMessageRequest, tr as ProcessManager, ua as SessionInterruptOptions, vt as EventStreamOptions, wa as SnapshotResult, wi as SandboxOperationInfo, wn as IntelligenceReport, wr as Rollout, xa as SnapshotOptions, xt as ExecResult, zi as SandboxTerminalAttachOptions } from "./types-DWG-ZlvL.js";
2
+ import { $a as WriteManyFile, $t as ForkIdempotency, A as CommitTaskSessionOptions, Ai as SandboxResourceUsage, An as ListMessagesOptions, Ba as TeePublicKeyResponse, C as BranchOptions, Cn as InstalledTool, Cr as ResumeOptions, D as CodeExecutionResult, Di as SandboxPortBinding, E as CodeExecutionOptions, Ea as StartupDiagnostics, Ei as SandboxOperationState, En as IntelligenceReportCompareTo, Er as RolloutOptions, Fi as SandboxShape, Fr as SandboxConnection, Gi as SandboxTraceBundle, H as CreateTaskSessionOptions, Ia as TeeAttestationOptions, Ir as SandboxDeleteAcknowledgement, Ji as SandboxTraceOptions, Lr as SandboxDeleteOptions, M as ConversationTurnOptions, Ma as TaskSessionCommitResult, Mr as SSHCommandDescriptor, N as ConversationTurnResult, Ni as SandboxRuntimeCapabilities, Nr as SSHCredentials, O as CodeLanguage, Oa as StopOptions, On as IntelligenceReportWindow, Or as RolloutStartResult, Ot as FileSystem, Pa as TaskSessionInfo, Pi as SandboxRuntimeHealth, Pt as FileWriteResult, Q as DispatchedSession, Qa as WriteFileOptions, Qt as ForkCounts, Ra as TeeAttestationResponse, Ri as SandboxStatus, Sa as SnapshotProvenance, Si as SandboxInfo, Sn as HttpClient, Sr as RestoreSnapshotOptions, Ti as SandboxOperationKind, Tn as IntelligenceReportBudget, Ua as TurnBackendConfig, V as CreateSessionOptions, Vr as SandboxEvent, Wa as TurnDriveResult, Wi as SandboxTerminals, Wn as NetworkManager, Xa as WaitForRolloutOptions, Xi as SearchMatch, Ya as WaitForOptions, Yn as PreviewLinkManager, Z as DispatchPromptOptions, Za as WorkspaceOperationLookup, Zi as SearchOptions, _a as SnapshotDeleteAcknowledgement, _o as WorkspaceImagePublishResult$1, aa as SessionExecutionInfo, ao as SandboxEnvRecoveryView, ar as PromptInputPart, ba as SnapshotInfo, bt as ExecOptions, ca as SessionForkOptions, cn as GpuLease, cr as ProvisionEvent, ct as DurablePlanDecisionResult, d as BackendConfig, da as SessionListOptions, do as RawEvidenceBoxExportOptions, ea as SendSessionMessageOptions, en as ForkLookupOptions, eo as WriteManyOptions, fa as SessionMessage, fi as SandboxFleetTraceBundle, fo as RawEvidenceDirectoryExport, fr as PublicProfileConflict, ha as SessionResultOptions, ht as EgressManager, ia as SessionEventStreamOptions, in as GitCommit, io as SandboxEnvRecovery, it as DriverInfo, j as CompletedTurnResult, ja as TaskSessionChanges, kn as JsonValue, la as SessionInfo, lr as ProvisionResult, na as SentSessionMessage, nt as DriveTurnOptions, on as GitDiff, or as PromptOptions, ot as DurablePlan, p as BackendManager, pa as SessionMessageAdmission, pn as GpuLeaseManager, po as RawEvidenceExportOptions, qn as PermissionsManager, rn as GitBranch, ro as SandboxCreateReceipt, sn as GitStatus, sr as PromptResult, st as DurablePlanDecisionOptions, ta as SendSessionMessageRequest, tr as ProcessManager, ua as SessionInterruptOptions, uo as RawEvidenceBoxDirectoryExport, vo as InteractionResolutionAcknowledgement, vt as EventStreamOptions, wa as SnapshotResult, wi as SandboxOperationInfo, wn as IntelligenceReport, wr as Rollout, xa as SnapshotOptions, xt as ExecResult, zi as SandboxTerminalAttachOptions } from "./types-D-KfVFtn.js";
3
3
  import { c as TerminalStreamReconnectAuthority, f as MintScopedTokenOptions, n as TerminalStream, o as TerminalStreamHandlers, p as ScopedToken, y as TerminalReadyInfo } from "./terminal-stream-DgD7GlFi.js";
4
4
  import { f as InteractiveAttachOptions, g as InteractiveSessionStatus, h as InteractiveRequestOptions, m as InteractiveControlClaimOptions, p as InteractiveControlClaimAcknowledgement } from "./browser-interactive-control-controller-B6sySQFu.js";
5
- import { E as InteractiveAttachRequest, h as SandboxError } from "./errors-Fv8leP33.js";
6
- import { z as SandboxLines } from "./lines-BgVaTJBw.js";
5
+ import { r as InteractiveAttachRequest } from "./interactive-controller-BSWoA0YE.js";
6
+ import { z as SandboxLines } from "./lines-D7JSxj4C.js";
7
+ import { h as SandboxError } from "./errors-gxmvF7f3.js";
7
8
  import { z } from "zod";
8
9
  import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, AgentInteractiveTerminalSession as AgentInteractiveTerminalSession$1, AgentProfile, AgentProfileFileMount, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, InteractionAcknowledgement, InteractionData, InteractionRequest, InteractionResponseCommand, TerminalOutputEvent, TerminalReplayWindow, agentInteractiveSessionPromptRequestDigest } from "@tangle-network/agent-interface";
9
10
 
@@ -2332,6 +2333,19 @@ declare class SandboxInstance {
2332
2333
  _sessionStatus(id: string): Promise<SessionInfo | null>;
2333
2334
  /** @internal — invoked before the sandbox is deleted. */
2334
2335
  _sessionExportRawEvidence(id: string, destination: string, options: RawEvidenceExportOptions): Promise<RawEvidenceDirectoryExport>;
2336
+ /**
2337
+ * Export every native session store on this box into a new local
2338
+ * directory: each runtime HOME's Claude Code, Codex, OpenCode and other
2339
+ * harness stores (transcripts and SQLite databases), and every settled
2340
+ * copy. The box-level twin of `box.session(id).exportRawEvidence`, for a
2341
+ * box about to be deleted, including one restored from a snapshot whose
2342
+ * session listing is empty. Only files a harness contract declares as its
2343
+ * session store are read; credentials and config never leave the box.
2344
+ *
2345
+ * The destination must not exist. Payload digests, the manifest digest
2346
+ * and the byte and file bounds are verified before the directory appears.
2347
+ */
2348
+ exportRawEvidence(destination: string, options: RawEvidenceBoxExportOptions): Promise<RawEvidenceBoxDirectoryExport>;
2335
2349
  _sessionRawEvidence(id: string): Promise<RawEvidenceExport>;
2336
2350
  /** @internal — invoked by SandboxSession.runs(). */
2337
2351
  _sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
@@ -1,2 +1,2 @@
1
- import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as ITangleJobsAbi, T as SandboxCreateResponseParamTypes, _ as JOB_SANDBOX_DELETE, a as fetchQuote, b as TangleSandboxClientConfig, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as JOB_SANDBOX_CREATE, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_CHAIN_ID, w as SandboxCreateParamTypes, x as AgentSandboxBlueprintAbi, y as TANGLE_JOBS_CONTRACT } from "../index-LO5315tT.js";
1
+ import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as ITangleJobsAbi, T as SandboxCreateResponseParamTypes, _ as JOB_SANDBOX_DELETE, a as fetchQuote, b as TangleSandboxClientConfig, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as JOB_SANDBOX_CREATE, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_CHAIN_ID, w as SandboxCreateParamTypes, x as AgentSandboxBlueprintAbi, y as TANGLE_JOBS_CONTRACT } from "../index-Ce5iKhZA.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JobQuoteDetails, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, QuoteDomain, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, SignedQuote, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,2 +1,2 @@
1
- import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as JOB_SANDBOX_DELETE, f as TANGLE_CHAIN_ID, g as JsonResponseParamTypes, h as ITangleJobsAbi, i as jobQuoteDigest, l as OperatorSessionError, m as AgentSandboxBlueprintAbi, n as fetchQuote, o as validateQuote, p as TANGLE_JOBS_CONTRACT, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as JOB_SANDBOX_CREATE, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-DugVLl53.js";
1
+ import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as JOB_SANDBOX_DELETE, f as TANGLE_CHAIN_ID, g as JsonResponseParamTypes, h as ITangleJobsAbi, i as jobQuoteDigest, l as OperatorSessionError, m as AgentSandboxBlueprintAbi, n as fetchQuote, o as validateQuote, p as TANGLE_JOBS_CONTRACT, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as JOB_SANDBOX_CREATE, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-Dcy6dgwL.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,5 +1,5 @@
1
1
  import { C as readResponseJson } from "./errors-DSJBKmGZ.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-CCVZWs8k.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-BQhR6t3-.js";
3
3
  import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-B6gap92T.js";
4
4
  //#region src/tangle/abi.ts
5
5
  /**