@tangle-network/sandbox 0.60.10 → 0.60.12-develop.20261003121634.9b53e11

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 (35) hide show
  1. package/README.md +35 -0
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +2 -2
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/{agent-run-outcome-xuBxUyRc.d.ts → agent-run-outcome-CG7bb9lr.d.ts} +1 -1
  6. package/dist/auth/index.d.ts +2 -2
  7. package/dist/{browser-interactive-control-controller-C-3MDol8.d.ts → browser-interactive-control-controller-DRCfxOQz.d.ts} +1 -1
  8. package/dist/{client-DwSJkoBR.d.ts → client-BCX8_Mu-.d.ts} +5 -5
  9. package/dist/{client-D7a7RnRi.js → client-Cd8xKjQZ.js} +3 -3
  10. package/dist/collaboration/index.d.ts +1 -1
  11. package/dist/core.d.ts +6 -6
  12. package/dist/core.js +2 -2
  13. package/dist/{index-B77WhChz.d.ts → index-BgFIcLar.d.ts} +2 -2
  14. package/dist/index.d.ts +22 -16
  15. package/dist/index.js +3 -3
  16. package/dist/interactive-control.d.ts +1 -1
  17. package/dist/{interactive-controller-iYddZt8b.d.ts → interactive-controller-ykaThYp6.d.ts} +2 -2
  18. package/dist/{lines-CBlVXTb_.d.ts → lines-BbvLx7pi.d.ts} +1 -1
  19. package/dist/lines.d.ts +1 -1
  20. package/dist/{preview-DhhnuQFm.d.ts → preview-Ddy1fJyc.d.ts} +3 -3
  21. package/dist/raw-evidence-archive-FxWK99KW.js +454 -0
  22. package/dist/runtime.d.ts +6 -6
  23. package/dist/{sandbox-BxxNbLpt.d.ts → sandbox-BCygk0lS.d.ts} +186 -46
  24. package/dist/{sandbox-o39VWaxn.js → sandbox-D3SjjeDp.js} +56 -13
  25. package/dist/tangle/index.d.ts +1 -1
  26. package/dist/tangle/index.js +1 -1
  27. package/dist/{tangle-As8hIs0S.js → tangle-fMCqH1ig.js} +1 -1
  28. package/dist/{types-7TNwywMg.d.ts → types-BlA8Cly0.d.ts} +244 -226
  29. package/package.json +4 -2
  30. /package/dist/{cli-auth-bundle-Dchr0WkF.d.ts → cli-auth-bundle-BMcIiB-I.d.ts} +0 -0
  31. /package/dist/{errors-CybOpzWU.d.ts → errors-DS32ViPj.d.ts} +0 -0
  32. /package/dist/{index-C0SSGYYc.d.ts → index-BXcL8P-U.d.ts} +0 -0
  33. /package/dist/{index-BCftzX-m.d.ts → index-BoQeoNOD.d.ts} +0 -0
  34. /package/dist/{local-cli-auth-BgIIaUo2.js → local-cli-auth-BH9A-PW_.js} +0 -0
  35. /package/dist/{terminal-stream-BUMu8Oae.d.ts → terminal-stream-B6bUr0hj.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
- import { t as CliAuthReference } from "./cli-auth-bundle-Dchr0WkF.js";
2
- import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-BUMu8Oae.js";
3
- import { f as InteractiveAttachOptions, g as InteractiveSessionStatus, h as InteractiveRequestOptions, m as InteractiveControlClaimOptions, p as InteractiveControlClaimAcknowledgement } from "./browser-interactive-control-controller-C-3MDol8.js";
4
- import { r as InteractiveAttachRequest } from "./interactive-controller-iYddZt8b.js";
5
- import { I as SandboxLines } from "./lines-CBlVXTb_.js";
6
- import { $i as SnapshotDeleteAcknowledgement, A as CommitTaskSessionOptions, Aa as WriteFileOptions, Ai as SandboxTraceOptions, Bi as SessionEventStreamOptions, C as BranchOptions, Cn as ListMessagesOptions, Cr as SandboxDeleteAcknowledgement, D as CodeExecutionResult, Da as WaitForOptions, Di as SandboxTraceBundle, Dr as SandboxEvent, E as CodeExecutionOptions, Ei as SandboxTerminals, Et as FileSystem, Gi as SessionInfo, H as CreateTaskSessionOptions, Hn as ProcessManager, Ii as SendSessionMessageOptions, In as PreviewLinkManager, Ji as SessionMessage, Jn as PromptResult, Ki as SessionInterruptOptions, Kn as PromptInputPart, Li as SendSessionMessageRequest, M as ConversationTurnOptions, Ma as WriteManyOptions, Mi as SearchMatch, Mt as FileWriteResult, N as ConversationTurnResult, Ni as SearchOptions, O as CodeLanguage, Oa as WaitForRolloutOptions, Pn as PermissionsManager, Q as DispatchedSession, Qr as SandboxFleetTraceBundle, Qt as ForkLookupOptions, Ri as SentSessionMessage, Sa as TurnDriveResult, Sn as JsonValue, Sr as SandboxCreateReceipt, V as CreateSessionOptions, Vi as SessionExecutionInfo, Wi as SessionForkOptions, Xn as ProvisionResult, Xt as ForkCounts, Yi as SessionMessageAdmission, Yn as ProvisionEvent, Z as DispatchPromptOptions, Zi as SessionResultOptions, Zt as ForkIdempotency, _a as TeeAttestationResponse, _i as SandboxShape, _n as IntelligenceReport, _r as SSHCommandDescriptor, an as GitStatus, bi as SandboxStatus, br as SandboxConnection, ci as SandboxInfo, cr as RestoreSnapshotOptions, d as BackendConfig, da as TaskSessionCommitResult, dn as GpuLeaseManager, fr as RolloutOptions, gi as SandboxRuntimeHealth, gn as InstalledTool, gt as EventStreamOptions, ha as TeeAttestationOptions, hi as SandboxRuntimeCapabilities, ia as SnapshotResult, in as GitDiff, it as DriverInfo, j as CompletedTurnResult, ja as WriteManyFile, jn as NetworkManager, ka as WorkspaceOperationLookup, lr as ResumeOptions, mr as RolloutStartResult, na as SnapshotInfo, nn as GitCommit, nt as DriveTurnOptions, oa as StartupDiagnostics, on as GpuLease, ot as DurablePlan, p as BackendManager, pa as TaskSessionInfo, pi as SandboxResourceUsage, pt as EgressManager, qi as SessionListOptions, qn as PromptOptions, ra as SnapshotOptions, st as DurablePlanDecisionResult, tn as GitBranch, ua as TaskSessionChanges, ui as SandboxPortBinding, ur as Rollout, vn as IntelligenceReportBudget, vr as SSHCredentials, vt as ExecOptions, wr as SandboxDeleteOptions, xi as SandboxTerminalAttachOptions, xn as IntelligenceReportWindow, ya as TeePublicKeyResponse, yn as IntelligenceReportCompareTo, yt as ExecResult } from "./types-7TNwywMg.js";
1
+ import { t as CliAuthReference } from "./cli-auth-bundle-BMcIiB-I.js";
2
+ import { $i as SnapshotDeleteAcknowledgement, A as CommitTaskSessionOptions, Aa as WriteFileOptions, Ai as SandboxTraceOptions, Bi as SessionEventStreamOptions, C as BranchOptions, Cn as ListMessagesOptions, Cr as SandboxDeleteAcknowledgement, D as CodeExecutionResult, Da as WaitForOptions, Di as SandboxTraceBundle, Dr as SandboxEvent, E as CodeExecutionOptions, Ei as SandboxTerminals, Et as FileSystem, Gi as SessionInfo, H as CreateTaskSessionOptions, Hn as ProcessManager, Ii as SendSessionMessageOptions, In as PreviewLinkManager, Ji as SessionMessage, Jn as PromptResult, Ki as SessionInterruptOptions, Kn as PromptInputPart, Li as SendSessionMessageRequest, M as ConversationTurnOptions, Ma as WriteManyOptions, Mi as SearchMatch, Mt as FileWriteResult, N as ConversationTurnResult, Ni as SearchOptions, O as CodeLanguage, Oa as WaitForRolloutOptions, Pn as PermissionsManager, Q as DispatchedSession, Qr as SandboxFleetTraceBundle, Qt as ForkLookupOptions, Ri as SentSessionMessage, Sa as TurnDriveResult, Sn as JsonValue, Sr as SandboxCreateReceipt, V as CreateSessionOptions, Vi as SessionExecutionInfo, Wi as SessionForkOptions, Xn as ProvisionResult, Xt as ForkCounts, Yi as SessionMessageAdmission, Yn as ProvisionEvent, Z as DispatchPromptOptions, Zi as SessionResultOptions, Zt as ForkIdempotency, _a as TeeAttestationResponse, _i as SandboxShape, _n as IntelligenceReport, _r as SSHCommandDescriptor, an as GitStatus, bi as SandboxStatus, br as SandboxConnection, ci as SandboxInfo, cr as RestoreSnapshotOptions, d as BackendConfig, da as TaskSessionCommitResult, dn as GpuLeaseManager, fr as RolloutOptions, gi as SandboxRuntimeHealth, gn as InstalledTool, gt as EventStreamOptions, ha as TeeAttestationOptions, hi as SandboxRuntimeCapabilities, ia as SnapshotResult, in as GitDiff, it as DriverInfo, j as CompletedTurnResult, ja as WriteManyFile, jn as NetworkManager, ka as WorkspaceOperationLookup, lr as ResumeOptions, mr as RolloutStartResult, na as SnapshotInfo, nn as GitCommit, nt as DriveTurnOptions, oa as StartupDiagnostics, on as GpuLease, ot as DurablePlan, p as BackendManager, pa as TaskSessionInfo, pi as SandboxResourceUsage, pt as EgressManager, qi as SessionListOptions, qn as PromptOptions, ra as SnapshotOptions, st as DurablePlanDecisionResult, tn as GitBranch, ua as TaskSessionChanges, ui as SandboxPortBinding, ur as Rollout, vn as IntelligenceReportBudget, vr as SSHCredentials, vt as ExecOptions, wr as SandboxDeleteOptions, xi as SandboxTerminalAttachOptions, xn as IntelligenceReportWindow, ya as TeePublicKeyResponse, yn as IntelligenceReportCompareTo, yt as ExecResult } from "./types-BlA8Cly0.js";
3
+ import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-B6bUr0hj.js";
4
+ import { f as InteractiveAttachOptions, g as InteractiveSessionStatus, h as InteractiveRequestOptions, m as InteractiveControlClaimOptions, p as InteractiveControlClaimAcknowledgement } from "./browser-interactive-control-controller-DRCfxOQz.js";
5
+ import { r as InteractiveAttachRequest } from "./interactive-controller-ykaThYp6.js";
6
+ import { I as SandboxLines } from "./lines-BbvLx7pi.js";
7
7
  import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, AgentInteractiveTerminalSession as AgentInteractiveTerminalSession$1, AgentProfile, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, InteractionAcknowledgement, InteractionData, InteractionRequest, InteractionResponseCommand, TerminalOutputEvent, TerminalReplayWindow, agentInteractiveSessionPromptRequestDigest } from "@tangle-network/agent-interface";
8
8
  import { z } from "zod";
9
9
 
@@ -118,22 +118,6 @@ declare function buildControlPlaneMcpConfig(options: BuildControlPlaneMcpConfigO
118
118
  config: SandboxMcpConfig;
119
119
  };
120
120
  //#endregion
121
- //#region src/direct-read-route.d.ts
122
- type DirectReadFallbackReason = "expired" | "refused" | "unreachable" | "timeout" | "malformed" | "cooldown";
123
- /** What the route has done, for the caller and for the probe. */
124
- interface DirectReadStats {
125
- /** Reads offered to this route. */
126
- attempts: number;
127
- /** Direct reads that proved the state had not moved; no API call followed. */
128
- unchanged: number;
129
- /** Direct reads that saw a change and sent the caller to the API. */
130
- changed: number;
131
- /** Reads that went to the API because the direct route could NOT serve. */
132
- fallbacks: number;
133
- /** Why the last fallback happened; null until one does. */
134
- lastReason: DirectReadFallbackReason | null;
135
- }
136
- //#endregion
137
121
  //#region ../../../packages/runtime-contracts/dist/interaction-response.d.ts
138
122
  /** Canonical result returned after a response is recorded by Sidecar. */
139
123
  declare const interactionResolutionAcknowledgementSchema: z.ZodObject<{
@@ -172,6 +156,180 @@ declare const interactionResolutionAcknowledgementSchema: z.ZodObject<{
172
156
  }, z.core.$strict>;
173
157
  type InteractionResolutionAcknowledgement = z.infer<typeof interactionResolutionAcknowledgementSchema>;
174
158
  //#endregion
159
+ //#region ../../../packages/runtime-contracts/dist/workspace-image-types.d.ts
160
+ /** A port declared by the published OCI image. */
161
+ interface WorkspaceImageExposedPort {
162
+ port: number;
163
+ protocol: "tcp" | "udp" | "sctp";
164
+ }
165
+ /** Successful workspace image publication returned by the Sandbox API. */
166
+ interface WorkspaceImagePublishResult$1 {
167
+ /** Immutable registry reference. */
168
+ image: string;
169
+ /** Operation-stable tag used during publication. */
170
+ taggedImage: string;
171
+ digest: string;
172
+ imageId: string;
173
+ sizeBytes: number;
174
+ contextBytes: number;
175
+ contextEntries: number;
176
+ buildDurationMs: number;
177
+ pushDurationMs: number;
178
+ /** Network ports from the final image configuration, not source inspection. */
179
+ exposedPorts: WorkspaceImageExposedPort[];
180
+ }
181
+ //#endregion
182
+ //#region ../../../packages/runtime-contracts/dist/raw-evidence-export.d.ts
183
+ /** Wire contract for bounded, session-owned native evidence archives. */
184
+ interface RawEvidencePayloadFile {
185
+ /** Safe relative path below the exported directory; never an absolute native path. */
186
+ path: string;
187
+ sizeBytes: number;
188
+ sha256: `sha256:${string}`;
189
+ }
190
+ interface RawEvidenceRecordsFile extends RawEvidencePayloadFile {
191
+ format: "ndjson";
192
+ /** Number of complete records, in original order. */
193
+ records: number;
194
+ }
195
+ interface RawEvidenceNativeMetadata {
196
+ sourceId?: string;
197
+ rootScope: "session-home" | "workspace-session";
198
+ path: string;
199
+ kind: "file" | "directory" | "symlink";
200
+ mode: number;
201
+ uid: number;
202
+ gid: number;
203
+ mtimeMs: number;
204
+ ctimeMs: number;
205
+ sizeBytes: number;
206
+ }
207
+ type RawEvidenceNativeFile = RawEvidenceNativeMetadata & {
208
+ sha256?: string;
209
+ linkTarget?: string; /** Replaces contentBase64 for regular files. Symlinks remain metadata only. */
210
+ content?: RawEvidencePayloadFile;
211
+ };
212
+ interface RawEvidenceArchiveAttempt {
213
+ executionId: string;
214
+ ordinal: number;
215
+ providerSessionId: string;
216
+ nativeSessionIds: string[];
217
+ processIds: string[];
218
+ outcome: "succeeded" | "failed" | "cancelled" | "unknown";
219
+ missingReasons: string[];
220
+ }
221
+ interface RawEvidenceArchiveEventMetadata {
222
+ executionId: string;
223
+ sessionId: string;
224
+ status: "active" | "completed" | "failed" | "cancelled";
225
+ startedAt: number;
226
+ completedAt?: number;
227
+ eventCount: number;
228
+ lastEventId: string;
229
+ }
230
+ /** Payload references replace only inline content and aggregate record arrays. */
231
+ interface RawEvidenceArchiveManifest {
232
+ schema: "tangle.raw-evidence-archive.v1";
233
+ status: "captured" | "partial";
234
+ sessionId: string;
235
+ backendType: string;
236
+ nativeSessionId: string | null;
237
+ proofStatus: "verified" | "unverified";
238
+ containerId?: string;
239
+ sidecarImageDigest: string;
240
+ sidecarBundleRevision: string;
241
+ sidecarBundleChecksum?: string;
242
+ nativeRoots: Array<{
243
+ sourceId?: string;
244
+ rootScope: "session-home" | "workspace-session";
245
+ path: string;
246
+ }>;
247
+ files: RawEvidenceNativeFile[];
248
+ excluded: Array<RawEvidenceNativeMetadata & {
249
+ reason: "credential";
250
+ }>;
251
+ skipped: Array<{
252
+ sourceId?: string;
253
+ rootScope: "session-home" | "workspace-session";
254
+ path: string;
255
+ reason: string;
256
+ }>;
257
+ inventory: Record<string, number>;
258
+ /** NDJSON rows preserve legacy processIo fields, replacing contentBase64 with content: RawEvidencePayloadFile. */
259
+ processIo: RawEvidenceRecordsFile;
260
+ /** NDJSON rows have exactly the fields of legacy processTerminals entries. */
261
+ processTerminals: RawEvidenceRecordsFile;
262
+ processSources: Array<{
263
+ sourceId: string;
264
+ sizeBytes: number;
265
+ sha256: string; /** Exact source spool bytes; replaces contentBase64. */
266
+ content: RawEvidencePayloadFile;
267
+ }>;
268
+ events: Array<{
269
+ metadata: RawEvidenceArchiveEventMetadata; /** Canonical reconstructed BufferedEvent rows, in original event order. */
270
+ frames: RawEvidenceRecordsFile;
271
+ }>;
272
+ attempts: RawEvidenceArchiveAttempt[];
273
+ evidenceSources: Array<{
274
+ executionId: string;
275
+ sourceId: string;
276
+ backendType: string;
277
+ runtimeHome: string;
278
+ credentialPaths: string[];
279
+ }>;
280
+ completeness: {
281
+ nativeStore: boolean;
282
+ processIo: boolean;
283
+ events: boolean;
284
+ };
285
+ coverageComplete: boolean;
286
+ missingReasons: string[];
287
+ }
288
+ interface RawEvidenceUnavailable {
289
+ status: "unavailable";
290
+ sessionId: string;
291
+ backendType: string;
292
+ reason: string;
293
+ }
294
+ interface RawEvidenceExportOptions {
295
+ /** Bound all uncompressed archive member bytes, including metadata and records. */
296
+ maxBytes: number;
297
+ /** Bound all archive file entries, including empty files. */
298
+ maxFiles: number;
299
+ /** Compressed transport bound; defaults to maxBytes plus bounded tar overhead. */
300
+ maxArchiveBytes?: number;
301
+ signal?: AbortSignal;
302
+ }
303
+ type RawEvidenceDirectoryExport = RawEvidenceUnavailable | {
304
+ status: "captured" | "partial";
305
+ directory: string;
306
+ manifestPath: string;
307
+ manifestSha256: `sha256:${string}`;
308
+ transfer: {
309
+ sizeBytes: number;
310
+ sha256: string;
311
+ }; /** Bounded metadata only. No inline payload or aggregate frame contents. */
312
+ manifest: RawEvidenceArchiveManifest;
313
+ coverageComplete: boolean;
314
+ missingReasons: string[];
315
+ };
316
+ //#endregion
317
+ //#region src/direct-read-route.d.ts
318
+ type DirectReadFallbackReason = "expired" | "refused" | "unreachable" | "timeout" | "malformed" | "cooldown";
319
+ /** What the route has done, for the caller and for the probe. */
320
+ interface DirectReadStats {
321
+ /** Reads offered to this route. */
322
+ attempts: number;
323
+ /** Direct reads that proved the state had not moved; no API call followed. */
324
+ unchanged: number;
325
+ /** Direct reads that saw a change and sent the caller to the API. */
326
+ changed: number;
327
+ /** Reads that went to the API because the direct route could NOT serve. */
328
+ fallbacks: number;
329
+ /** Why the last fallback happened; null until one does. */
330
+ lastReason: DirectReadFallbackReason | null;
331
+ }
332
+ //#endregion
175
333
  //#region src/interaction-response.d.ts
176
334
  declare const REFUSED_INTERACTION_STATUS: z.ZodEnum<{
177
335
  already_resolved_different: "already_resolved_different";
@@ -459,6 +617,7 @@ interface SandboxSessionHost extends InteractiveSessionHost {
459
617
  _sessionEvents(id: string, opts?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
460
618
  _sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
461
619
  _sessionRawEvidence(id: string): Promise<RawEvidenceExport>;
620
+ _sessionExportRawEvidence(id: string, destination: string, options: RawEvidenceExportOptions): Promise<RawEvidenceDirectoryExport>;
462
621
  _sessionAdmission(id: string, turnId: string, options?: {
463
622
  signal?: AbortSignal;
464
623
  }): Promise<SessionMessageAdmission | null>;
@@ -530,6 +689,8 @@ declare class SandboxSession {
530
689
  */
531
690
  runs(): Promise<SessionExecutionInfo[]>;
532
691
  /** Capture the complete attributed native store and process stream before deletion. */
692
+ /** Export verified native evidence into a new local directory with bounded memory. */
693
+ exportRawEvidence(destination: string, options: RawEvidenceExportOptions): Promise<RawEvidenceDirectoryExport>;
533
694
  rawEvidence(): Promise<RawEvidenceExport>;
534
695
  /** Read the exact execution admitted for a turn, including server-owned plan follow-ups.
535
696
  * This never admits work or verifies the input of a proposed retry.
@@ -665,29 +826,6 @@ declare function exportTraceBundle(bundle: TraceExportBundle, sink: TraceExportS
665
826
  declare function toOtelJson(bundle: TraceExportBundle, serviceName?: string): JsonObject;
666
827
  declare function otelTraceIdForTangleTrace(traceId: string): string;
667
828
  //#endregion
668
- //#region ../../../packages/runtime-contracts/dist/workspace-image-types.d.ts
669
- /** A port declared by the published OCI image. */
670
- interface WorkspaceImageExposedPort {
671
- port: number;
672
- protocol: "tcp" | "udp" | "sctp";
673
- }
674
- /** Successful workspace image publication returned by the Sandbox API. */
675
- interface WorkspaceImagePublishResult$1 {
676
- /** Immutable registry reference. */
677
- image: string;
678
- /** Operation-stable tag used during publication. */
679
- taggedImage: string;
680
- digest: string;
681
- imageId: string;
682
- sizeBytes: number;
683
- contextBytes: number;
684
- contextEntries: number;
685
- buildDurationMs: number;
686
- pushDurationMs: number;
687
- /** Network ports from the final image configuration, not source inspection. */
688
- exposedPorts: WorkspaceImageExposedPort[];
689
- }
690
- //#endregion
691
829
  //#region src/workspace-images.d.ts
692
830
  interface WorkspaceImagePublishInput {
693
831
  /** Workspace-relative build context. */
@@ -1416,6 +1554,7 @@ declare class SandboxInstance {
1416
1554
  private fsUploadData;
1417
1555
  private fsDownload;
1418
1556
  private fsUploadDir;
1557
+ private fsDownloadArchive;
1419
1558
  private fsDownloadDir;
1420
1559
  private fsList;
1421
1560
  private fsStat;
@@ -2124,6 +2263,7 @@ declare class SandboxInstance {
2124
2263
  /** @internal — invoked by SandboxSession.status(). */
2125
2264
  _sessionStatus(id: string): Promise<SessionInfo | null>;
2126
2265
  /** @internal — invoked before the sandbox is deleted. */
2266
+ _sessionExportRawEvidence(id: string, destination: string, options: RawEvidenceExportOptions): Promise<RawEvidenceDirectoryExport>;
2127
2267
  _sessionRawEvidence(id: string): Promise<RawEvidenceExport>;
2128
2268
  /** @internal — invoked by SandboxSession.runs(). */
2129
2269
  _sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
@@ -2191,4 +2331,4 @@ declare class SandboxInstance {
2191
2331
  }): Promise<DurablePlanDecisionResult>;
2192
2332
  }
2193
2333
  //#endregion
2194
- export { InteractiveStopCommand as A, SandboxInteractionConflict as B, InteractiveSessionHandleOptions as C, InteractiveSessionRef as D, InteractiveSessionInfo as E, InteractiveTerminalFrameLog as F, CONTROL_PLANE_MCP_SERVER_NAME as G, SandboxInteractionResult as H, InteractiveTerminalMetadata as I, SandboxMcpEndpoint as J, SANDBOX_MCP_SERVER_NAME as K, createInteractiveTerminalCapture as L, RespondToPermissionOptions as M, agentInteractiveSessionPromptRequestDigest as N, InteractiveSessionStartOptions as O, InteractiveTerminalCapture as P, createInteractiveTerminalSession as R, InteractiveSessionHandle as S, InteractiveSessionIncarnationId as T, BuildControlPlaneMcpConfigOptions as U, SandboxInteractionResolution as V, BuildSandboxMcpConfigOptions as W, buildControlPlaneMcpConfig as X, SandboxMcpServerEntry as Y, buildSandboxMcpConfig as Z, SandboxSession as _, WorkspaceImagePublishRequestOptions as a, InteractivePromptCommand as b, TraceExportFormat as c, buildTraceExportPayload as d, exportTraceBundle as f, RawEvidenceExport as g, SandboxTaskSession as h, WorkspaceImagePublishInput as i, InterruptResult as j, InteractiveSessionStartResult as k, TraceExportResult as l, toOtelJson as m, HttpClient as n, WorkspaceImagePublishResult as o, otelTraceIdForTangleTrace as p, SandboxMcpConfig as q, SandboxInstance as r, WorkspaceImages as s, ForkAcknowledgement as t, TraceExportSink as u, AgentInteractiveTerminalSession$1 as v, InteractiveSessionHost as w, InteractiveSessionControlClaim as x, InteractiveControlClaimRequest as y, SandboxInteractionCommandResult as z };
2334
+ export { SandboxMcpConfig as $, InteractiveStopCommand as A, SandboxInteractionConflict as B, InteractiveSessionHandleOptions as C, InteractiveSessionRef as D, InteractiveSessionInfo as E, InteractiveTerminalFrameLog as F, RawEvidenceExportOptions as G, SandboxInteractionResult as H, InteractiveTerminalMetadata as I, RawEvidenceRecordsFile as J, RawEvidenceNativeFile as K, createInteractiveTerminalCapture as L, RespondToPermissionOptions as M, agentInteractiveSessionPromptRequestDigest as N, InteractiveSessionStartOptions as O, InteractiveTerminalCapture as P, SANDBOX_MCP_SERVER_NAME as Q, createInteractiveTerminalSession as R, InteractiveSessionHandle as S, InteractiveSessionIncarnationId as T, RawEvidenceArchiveManifest as U, SandboxInteractionResolution as V, RawEvidenceDirectoryExport as W, BuildSandboxMcpConfigOptions as X, BuildControlPlaneMcpConfigOptions as Y, CONTROL_PLANE_MCP_SERVER_NAME as Z, SandboxSession as _, WorkspaceImagePublishRequestOptions as a, InteractivePromptCommand as b, TraceExportFormat as c, buildTraceExportPayload as d, SandboxMcpEndpoint as et, exportTraceBundle as f, RawEvidenceExport as g, SandboxTaskSession as h, WorkspaceImagePublishInput as i, InterruptResult as j, InteractiveSessionStartResult as k, TraceExportResult as l, toOtelJson as m, HttpClient as n, buildControlPlaneMcpConfig as nt, WorkspaceImagePublishResult as o, otelTraceIdForTangleTrace as p, RawEvidencePayloadFile as q, SandboxInstance as r, buildSandboxMcpConfig as rt, WorkspaceImages as s, ForkAcknowledgement as t, SandboxMcpServerEntry as tt, TraceExportSink as u, AgentInteractiveTerminalSession$1 as v, InteractiveSessionHost as w, InteractiveSessionControlClaim as x, InteractiveControlClaimRequest as y, SandboxInteractionCommandResult as z };
@@ -936,14 +936,14 @@ var ManagedProcessClient = class {
936
936
  this.request = request;
937
937
  this.environmentId = environmentId;
938
938
  }
939
- async call(method, id, spec, options) {
939
+ async call(method, id, body, options, action) {
940
940
  if (typeof id !== "string" || !id.length || id.length > 256) throw new ValidationError("Invalid managed process id");
941
941
  const headers = new Headers({ "Content-Type": "application/json" });
942
942
  if (options?.sessionId) headers.set("X-Session-Id", options.sessionId);
943
- const response = await this.request(method === "POST" ? "/process/jobs" : `/process/jobs/${encodeURIComponent(id)}`, {
943
+ const response = await this.request(action === "resume" ? `/process/jobs/${encodeURIComponent(id)}/resume` : method === "POST" ? "/process/jobs" : `/process/jobs/${encodeURIComponent(id)}`, {
944
944
  method,
945
945
  headers,
946
- ...spec ? { body: JSON.stringify(spec) } : {}
946
+ ...body ? { body: JSON.stringify(body) } : {}
947
947
  });
948
948
  const text = await response.text();
949
949
  let value;
@@ -954,7 +954,7 @@ var ManagedProcessClient = class {
954
954
  throw new ValidationError("Managed process response is not JSON");
955
955
  }
956
956
  const envelope = value;
957
- if (method !== "POST" && response.status === 404 && envelope?.error?.code === "MANAGED_PROCESS_NOT_FOUND") return null;
957
+ if ((method !== "POST" || action === "resume") && response.status === 404 && envelope?.error?.code === "MANAGED_PROCESS_NOT_FOUND") return null;
958
958
  if (!response.ok) throw parseErrorResponse(response.status, text, void 0, response.headers);
959
959
  const record = envelope?.data;
960
960
  if (envelope?.success !== true || record?.schema !== 1 || record.spec?.id !== id || record.environmentId !== this.environmentId || ![
@@ -977,6 +977,14 @@ var ManagedProcessClient = class {
977
977
  get(id, options) {
978
978
  return this.call("GET", id, void 0, options);
979
979
  }
980
+ resume(id, options) {
981
+ const { expectedAttempt, expectedDigest } = options;
982
+ if (!Number.isSafeInteger(expectedAttempt) || expectedAttempt < 0 || typeof expectedDigest !== "string" || !/^[a-f0-9]{64}$/.test(expectedDigest)) throw new ValidationError("Invalid managed process resume precondition");
983
+ return this.call("POST", id, {
984
+ expectedAttempt,
985
+ expectedDigest
986
+ }, options, "resume");
987
+ }
980
988
  cancel(id, options) {
981
989
  return this.call("DELETE", id, void 0, options);
982
990
  }
@@ -2882,6 +2890,10 @@ var SandboxSession = class SandboxSession {
2882
2890
  return this.box._sessionRuns(this.id);
2883
2891
  }
2884
2892
  /** Capture the complete attributed native store and process stream before deletion. */
2893
+ /** Export verified native evidence into a new local directory with bounded memory. */
2894
+ exportRawEvidence(destination, options) {
2895
+ return this.box._sessionExportRawEvidence(this.id, destination, options);
2896
+ }
2885
2897
  async rawEvidence() {
2886
2898
  return this.box._sessionRawEvidence(this.id);
2887
2899
  }
@@ -5437,7 +5449,8 @@ var SandboxInstance = class SandboxInstance {
5437
5449
  uploadData: (remotePath, data, options) => this.fsUploadData(remotePath, data, options),
5438
5450
  download: (remotePath, localPath, options) => this.fsDownload(remotePath, localPath, options),
5439
5451
  uploadDir: (localDir, remoteDir) => this.fsUploadDir(localDir, remoteDir),
5440
- downloadDir: (remoteDir, localDir) => this.fsDownloadDir(remoteDir, localDir),
5452
+ downloadArchive: (remoteDir, localPath, options) => this.fsDownloadArchive(remoteDir, localPath, options),
5453
+ downloadDir: (remoteDir, localDir, options) => this.fsDownloadDir(remoteDir, localDir, options),
5441
5454
  list: (path, options) => this.fsList(path, options),
5442
5455
  stat: (path) => this.fsStat(path),
5443
5456
  delete: (path, options) => this.fsDelete(path, options),
@@ -5516,22 +5529,40 @@ var SandboxInstance = class SandboxInstance {
5516
5529
  await fs.unlink(tempTarPath).catch(() => {});
5517
5530
  }
5518
5531
  }
5519
- async fsDownloadDir(remoteDir, localDir) {
5520
- await this.ensureRunning();
5532
+ async fsDownloadArchive(remoteDir, localPath, options) {
5533
+ return downloadFile(async (signal) => {
5534
+ await this.ensureRunning();
5535
+ const response = await this.runtimeFetch(runtimeFilesystemPath("/fs/download-dir", remoteDir), {
5536
+ method: "GET",
5537
+ signal
5538
+ });
5539
+ if (!response.ok) throw await parseResponseError(response);
5540
+ return response;
5541
+ }, localPath, options);
5542
+ }
5543
+ async fsDownloadDir(remoteDir, localDir, options) {
5521
5544
  const fs = await import("node:fs/promises");
5522
5545
  const path = await import("node:path");
5523
- const { execSync } = await import("node:child_process");
5524
- const response = await this.runtimeFetch(runtimeFilesystemPath("/fs/download-dir", remoteDir), { method: "GET" });
5525
- if (!response.ok) throw await parseResponseError(response);
5546
+ const { execFile } = await import("node:child_process");
5547
+ const { promisify } = await import("node:util");
5526
5548
  const tempDir = await fs.mkdtemp(path.join((await import("node:os")).tmpdir(), "download-"));
5527
5549
  const tempTarPath = path.join(tempDir, "archive.tar.gz");
5528
5550
  try {
5529
- const buffer = await response.arrayBuffer();
5530
- await fs.writeFile(tempTarPath, Buffer.from(buffer));
5551
+ await this.fsDownloadArchive(remoteDir, tempTarPath, options);
5552
+ options?.signal?.throwIfAborted();
5531
5553
  await fs.mkdir(localDir, { recursive: true });
5532
5554
  try {
5533
- execSync(`tar -xzf "${tempTarPath}" -C "${localDir}"`, { stdio: "pipe" });
5555
+ await promisify(execFile)("tar", [
5556
+ "-xzf",
5557
+ tempTarPath,
5558
+ "-C",
5559
+ localDir
5560
+ ], {
5561
+ encoding: "buffer",
5562
+ signal: options?.signal
5563
+ });
5534
5564
  } catch (error) {
5565
+ options?.signal?.throwIfAborted();
5535
5566
  const stderr = error.stderr?.toString().trim();
5536
5567
  throw new Error(`downloadDir: host tar failed to extract the archive${stderr ? ` — ${stderr}` : ""}`);
5537
5568
  }
@@ -7907,6 +7938,18 @@ var SandboxInstance = class SandboxInstance {
7907
7938
  return normalizeSessionInfo(await readResponseJson(response));
7908
7939
  }
7909
7940
  /** @internal — invoked before the sandbox is deleted. */
7941
+ async _sessionExportRawEvidence(id, destination, options) {
7942
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-FxWK99KW.js");
7943
+ await this.ensureRunning();
7944
+ await this.refresh();
7945
+ return exportRawEvidenceDirectory((signal) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams({
7946
+ maxBytes: String(options.maxBytes),
7947
+ maxFiles: String(options.maxFiles)
7948
+ })}`, {
7949
+ method: "GET",
7950
+ signal
7951
+ }), id, destination, options, this.info.captureProof);
7952
+ }
7910
7953
  async _sessionRawEvidence(id) {
7911
7954
  await this.ensureRunning();
7912
7955
  await this.refresh();
@@ -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-B77WhChz.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-BgFIcLar.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-As8hIs0S.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-fMCqH1ig.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 { y as readResponseJson } from "./errors-D1JIX7Jm.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-o39VWaxn.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-D3SjjeDp.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-ChcSLv53.js";
4
4
  //#region src/tangle/abi.ts
5
5
  /**