@tangle-network/sandbox 0.64.1 → 0.64.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -111,6 +111,7 @@ try {
111
111
  Keep `delete()` in `finally` unless the sandbox must outlive the process.
112
112
  `delete()` answers once the sandbox is dead and billed; its container, volume and network are reclaimed behind the answer, and the acknowledgement reports `removal: "pending"`.
113
113
  The sandbox is already gone for every read at that point.
114
+ Deleted customer snapshot repositories, including their final snapshot, remain until their owner explicitly deletes them. Platform-managed repositories of internal-account boxes retire automatically after the deleted-retention window, subject to preservation holds and active exports/restores. The serving window comes from the storage owner; see [deleted repository retention](../../../docs/sandbox-lifecycle-reliability.md#deleted-snapshot-repository-retirement).
114
115
  Pass `await box.delete({ until: "removed" })` when you need the reclaim itself, for example before reusing the same host capacity in a test; it reports `removal: "complete"`, or `"pending"` if the wait runs out.
115
116
 
116
117
  To remove every sandbox that one job created, tag them with metadata at create time and delete them by prefix:
@@ -1,8 +1,8 @@
1
1
  import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-BjLG7VHY.js";
2
2
  import { D as assertCurrentBackendType } from "../interactive-controller-OAsASPd_.js";
3
3
  import { S as StateError, T as ValidationError, h as NotFoundError } from "../errors-BfbOP_rx.js";
4
- import { t as Sandbox } from "../client-Dy5B2NkM.js";
5
- import { t as SandboxInstance } from "../sandbox-BPLzHOZ1.js";
4
+ import { t as Sandbox } from "../client-CgtR203z.js";
5
+ import { t as SandboxInstance } from "../sandbox-BrZxAq11.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -1,4 +1,4 @@
1
- import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-BYvVrIso.js";
1
+ import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-CFeHsq-5.js";
2
2
  //#region src/auth/tokens.ts
3
3
  const textEncoder = new TextEncoder();
4
4
  const textDecoder = new TextDecoder();
@@ -2,7 +2,7 @@ import { n as BACKEND_TYPE } from "./backend-types-CLvdSX8V.js";
2
2
  import { z } from "zod";
3
3
  import { agentProfileJsonSchema, agentProfileSchema as agentProfileSchema$1 } from "@tangle-network/agent-interface";
4
4
  import "@tangle-network/agent-interface/harness-capabilities";
5
- //#region ../../../packages/cli-agent-registry/dist/native-session-contracts-D0uvPM4B.mjs
5
+ //#region ../../../packages/cli-agent-registry/dist/native-session-contracts-CddywaKf.mjs
6
6
  /** The CLI version infra/nix ships for each registered harness. */
7
7
  const HARNESS_CLI_VERSIONS = {
8
8
  "claude-code": "2.1.306",
@@ -32,6 +32,18 @@ const CODEX_ROLLOUTS = {
32
32
  shared: false,
33
33
  format: "codex.rollout-jsonl"
34
34
  };
35
+ /**
36
+ * Rollouts codex moved out of `sessions/` when a thread was archived: the same
37
+ * transcript, flat under `archived_sessions/`. Without it an archived
38
+ * session is no store's, so no copy, capture or export carries it.
39
+ */
40
+ const CODEX_ARCHIVED_ROLLOUTS = {
41
+ root: ".codex/archived_sessions",
42
+ files: ["rollout-*-{id}.jsonl"],
43
+ write: "jsonl-append",
44
+ shared: false,
45
+ format: "codex.rollout-jsonl"
46
+ };
35
47
  const GEMINI_CHATS = {
36
48
  root: ".gemini/tmp",
37
49
  files: ["*/chats/session-*{id}*.json"],
@@ -308,7 +320,7 @@ var codex_default = {
308
320
  },
309
321
  contract: {
310
322
  version: 1,
311
- stores: [CODEX_ROLLOUTS],
323
+ stores: [CODEX_ROLLOUTS, CODEX_ARCHIVED_ROLLOUTS],
312
324
  identity: {
313
325
  kind: "first-event",
314
326
  event: "thread.started",
@@ -1028,7 +1040,7 @@ const NATIVE_SESSION_CONTRACTS = {
1028
1040
  HARNESSES["kimi-code"].session.defect.reason, HARNESSES["factory-droids"].session.defect.reason, HARNESSES["amp"].session.defect.reason, HARNESSES["prime"].session.defect.reason, HARNESSES["hermes"].session.defect.reason, HARNESSES["forge"].session.defect.reason, HARNESSES["openclaw"].session.defect.reason, HARNESSES["acp"].session.defect.reason;
1029
1041
  HARNESSES["nanoclaw"].session.defect.reason, HARNESSES["cursor"].session.defect.reason;
1030
1042
  //#endregion
1031
- //#region ../../../packages/cli-agent-registry/dist/specs-CqwP574t.mjs
1043
+ //#region ../../../packages/cli-agent-registry/dist/specs-DvgpCrPk.mjs
1032
1044
  z.globalRegistry.add(agentProfileSchema$1, {
1033
1045
  id: "AgentProfile",
1034
1046
  ...agentProfileJsonSchema
@@ -3,7 +3,7 @@ import { A as normalizeRuntimeBackendConfig, C as encodePromptForWire, D as asse
3
3
  import { T as ValidationError, a as AuthError, b as SandboxError, d as GpuProviderNotConfiguredError, g as PartialFailureError, h as NotFoundError, i as readResponseJson, m as NetworkError, n as parseErrorResponse, p as NON_RETRYABLE_CREATE_QUOTA_REASONS, r as parseResponseError, v as QuotaError, w as TimeoutError, x as ServerError } from "./errors-BfbOP_rx.js";
4
4
  import { f as combineAbortSignals } from "./browser-interactive-control-controller-DHx53yre.js";
5
5
  import { n as fetchWithKeepAlive } from "./keep-alive-fetch-BBzJDWyt.js";
6
- import { A as normalizeSandboxCreateReceipt, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as rewrapResponse, M as parseStopPhase, N as normalizeConnection, O as isRetryableProfileFileMaterializeFailure, P as normalizeSandboxShape, T as splitInlineProfileFileMounts, j as normalizeStartupDiagnostics, k as normalizeCaptureProof, n as createSandboxInstanceFromResponse, o as exportTraceBundle } from "./sandbox-BPLzHOZ1.js";
6
+ import { A as normalizeSandboxCreateReceipt, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as rewrapResponse, M as parseStopPhase, N as normalizeConnection, O as isRetryableProfileFileMaterializeFailure, P as normalizeSandboxShape, T as splitInlineProfileFileMounts, j as normalizeStartupDiagnostics, k as normalizeCaptureProof, n as createSandboxInstanceFromResponse, o as exportTraceBundle } from "./sandbox-BrZxAq11.js";
7
7
  import { t as LinesClient } from "./lines-C5ER4aN_.js";
8
8
  import { PublicTemplatesClient } from "./public-templates.js";
9
9
  import { z } from "zod";
@@ -349,7 +349,7 @@ const publicPersistentBatchRunRequestSchema = z.object({
349
349
  /** Public callers control work only. Identity and capacity are server-owned. */
350
350
  const publicBatchRunRequestSchema = z.union([publicTemporaryBatchRunRequestSchema, publicPersistentBatchRunRequestSchema]);
351
351
  //#endregion
352
- //#region ../../../packages/runtime-contracts/dist/batch-stream.js
352
+ //#region ../../../packages/runtime-contracts/dist/batch-stream-support.js
353
353
  /** A transport-independent batch event sequence failure. */
354
354
  var BatchStreamError = class extends Error {
355
355
  kind;
@@ -369,6 +369,87 @@ function invalid(message) {
369
369
  function incomplete(message) {
370
370
  throw new BatchStreamError(message, "incomplete");
371
371
  }
372
+ function setsMatch(left, right) {
373
+ return left.size === right.size && [...left].every((value) => right.has(value));
374
+ }
375
+ //#endregion
376
+ //#region ../../../packages/runtime-contracts/dist/batch-stream-cleanup.js
377
+ /**
378
+ * Validates the cleanup events that follow a batch terminal event: retained
379
+ * compute (persistent, grace period) or per-sidecar release.
380
+ */
381
+ var BatchCleanupTracker = class {
382
+ host;
383
+ cleanup;
384
+ releasingSidecars = /* @__PURE__ */ new Set();
385
+ releasedSidecars = /* @__PURE__ */ new Set();
386
+ pendingSidecars = /* @__PURE__ */ new Set();
387
+ constructor(host) {
388
+ this.host = host;
389
+ }
390
+ requireTerminal(eventType) {
391
+ if (!this.host.terminal()) invalid(`Batch stream emitted ${eventType} before a batch terminal event`);
392
+ }
393
+ addPersistent(data) {
394
+ this.requireTerminal("batch.persistent");
395
+ if (!this.host.completed() || !this.host.request.persistent || this.cleanup) invalid("Batch stream emitted invalid or duplicate batch.persistent cleanup metadata");
396
+ if (data.sidecarCount !== this.host.allocatedSidecarIds.size) invalid("Batch persistent sidecar count does not match allocation");
397
+ this.cleanup = {
398
+ mode: "persistent",
399
+ ...data
400
+ };
401
+ }
402
+ addGrace(data) {
403
+ this.requireTerminal("batch.grace_period");
404
+ if (!this.host.completed() || this.host.request.persistent || this.cleanup || this.host.request.graceMs === 0) invalid("Batch stream emitted invalid or duplicate batch.grace_period cleanup metadata");
405
+ const reported = new Set(data.sidecarIds);
406
+ if (data.sidecarCount !== this.host.allocatedSidecarIds.size || data.sidecarIds.length !== reported.size || !setsMatch(this.host.allocatedSidecarIds, reported) || this.host.request.graceMs !== void 0 && data.graceMs !== this.host.request.graceMs) invalid("Batch grace-period metadata does not match allocation");
407
+ this.cleanup = {
408
+ mode: "grace",
409
+ ...data
410
+ };
411
+ }
412
+ addSidecarReleasing(data) {
413
+ this.requireTerminal("sidecar.releasing");
414
+ const graceMs = "graceMs" in this.host.request ? this.host.request.graceMs : void 0;
415
+ if (this.host.request.persistent && this.host.terminal() === "completed" || this.cleanup?.mode === "persistent" || this.cleanup?.mode === "grace" || this.host.terminal() === "completed" && graceMs !== void 0 && graceMs > 0) invalid("Batch stream emitted sidecar.releasing for retained compute");
416
+ if (this.host.terminal() === "completed" && !this.host.allocatedSidecarIds.has(data.sidecarId)) invalid(`Batch stream released unknown sidecar: ${data.sidecarId}`);
417
+ if (this.releasingSidecars.has(data.sidecarId) || this.releasedSidecars.has(data.sidecarId) || this.pendingSidecars.has(data.sidecarId)) invalid(`Batch stream started sidecar release more than once: ${data.sidecarId}`);
418
+ this.releasingSidecars.add(data.sidecarId);
419
+ }
420
+ addSidecarReleased(data) {
421
+ this.requireTerminal("sidecar.released");
422
+ if (!this.releasingSidecars.delete(data.sidecarId)) invalid(`Batch stream confirmed release before sidecar.releasing: ${data.sidecarId}`);
423
+ this.releasedSidecars.add(data.sidecarId);
424
+ }
425
+ addSidecarReleasePending(data) {
426
+ this.requireTerminal("sidecar.release_pending");
427
+ if (!this.releasingSidecars.delete(data.sidecarId)) invalid(`Batch stream reported pending release before sidecar.releasing: ${data.sidecarId}`);
428
+ if (data.attempt < 1 || data.retryInMs < 1) invalid("Batch stream reported invalid pending release retry metadata");
429
+ this.pendingSidecars.add(data.sidecarId);
430
+ }
431
+ finish() {
432
+ const graceMs = "graceMs" in this.host.request ? this.host.request.graceMs : void 0;
433
+ if (this.host.request.persistent && this.host.terminal() === "completed") {
434
+ if (this.cleanup?.mode !== "persistent") incomplete("Batch stream ended before batch.persistent cleanup metadata");
435
+ return this.cleanup;
436
+ }
437
+ if (this.cleanup?.mode === "grace" && this.host.terminal() === "completed") return this.cleanup;
438
+ if (this.host.terminal() === "completed" && graceMs !== void 0 && graceMs > 0) incomplete("Batch stream ended before batch.grace_period cleanup metadata");
439
+ if (this.releasingSidecars.size > 0) incomplete(`Batch stream ended while releasing ${this.releasingSidecars.size} sidecars`);
440
+ const terminalCleanupSidecars = new Set([...this.releasedSidecars, ...this.pendingSidecars]);
441
+ if (this.host.terminal() === "completed" && !setsMatch(terminalCleanupSidecars, this.host.allocatedSidecarIds)) incomplete(`Batch stream ended after resolving cleanup for ${terminalCleanupSidecars.size} of ${this.host.allocatedSidecarIds.size} sidecars`);
442
+ if (this.host.failed() && [...this.host.allocatedSidecarIds].some((sidecarId) => !terminalCleanupSidecars.has(sidecarId))) incomplete(`Failed batch stream ended after resolving cleanup for ${terminalCleanupSidecars.size} of ${this.host.allocatedSidecarIds.size} sidecars`);
443
+ return {
444
+ mode: "release",
445
+ releasedSidecarIds: [...this.releasedSidecars],
446
+ pendingSidecarIds: [...this.pendingSidecars],
447
+ isComplete: this.pendingSidecars.size === 0
448
+ };
449
+ }
450
+ };
451
+ //#endregion
452
+ //#region ../../../packages/runtime-contracts/dist/batch-stream.js
372
453
  function executionKey(taskId, backendId) {
373
454
  return JSON.stringify([taskId, backendId]);
374
455
  }
@@ -378,9 +459,6 @@ function expectedSuccessRate(success, total) {
378
459
  function ratesMatch(left, right) {
379
460
  return Math.abs(left - right) < 1e-9;
380
461
  }
381
- function setsMatch(left, right) {
382
- return left.size === right.size && [...left].every((value) => right.has(value));
383
- }
384
462
  function backendStatsMatch(left, right) {
385
463
  return left.backendId === right.backendId && left.backendType === right.backendType && left.backendLabel === right.backendLabel && left.backendModel === right.backendModel && left.success === right.success && left.failure === right.failure && left.retries === right.retries && ratesMatch(left.successRate, right.successRate);
386
464
  }
@@ -410,17 +488,14 @@ var BatchStreamState = class {
410
488
  allocatedSidecarsByBackend = /* @__PURE__ */ new Map();
411
489
  allocatedSidecarIds = /* @__PURE__ */ new Set();
412
490
  completedBackends = /* @__PURE__ */ new Map();
413
- releasingSidecars = /* @__PURE__ */ new Set();
414
- releasedSidecars = /* @__PURE__ */ new Set();
415
- pendingSidecars = /* @__PURE__ */ new Set();
416
491
  eventIds = /* @__PURE__ */ new Set();
492
+ cleanupTracker;
417
493
  provisioning;
418
494
  provisioned;
419
495
  started;
420
496
  sidecars;
421
497
  completion;
422
498
  failure;
423
- cleanup;
424
499
  constructor(request) {
425
500
  this.request = request;
426
501
  this.taskIndexes = new Map(request.tasks.map((task, index) => [task.id, index]));
@@ -429,6 +504,13 @@ var BatchStreamState = class {
429
504
  started: false,
430
505
  retries: 0
431
506
  });
507
+ this.cleanupTracker = new BatchCleanupTracker({
508
+ request,
509
+ allocatedSidecarIds: this.allocatedSidecarIds,
510
+ terminal: () => this.terminal,
511
+ completed: () => this.completion !== void 0,
512
+ failed: () => this.failure !== void 0
513
+ });
432
514
  }
433
515
  get terminal() {
434
516
  if (this.completion) return "completed";
@@ -479,25 +561,25 @@ var BatchStreamState = class {
479
561
  this.addBatchFailed(event.data);
480
562
  return;
481
563
  case "batch.persistent":
482
- this.addPersistentCleanup(event.data);
564
+ this.cleanupTracker.addPersistent(event.data);
483
565
  return;
484
566
  case "batch.grace_period":
485
- this.addGraceCleanup(event.data);
567
+ this.cleanupTracker.addGrace(event.data);
486
568
  return;
487
569
  case "sidecar.releasing":
488
- this.addSidecarReleasing(event.data);
570
+ this.cleanupTracker.addSidecarReleasing(event.data);
489
571
  return;
490
572
  case "sidecar.released":
491
- this.addSidecarReleased(event.data);
573
+ this.cleanupTracker.addSidecarReleased(event.data);
492
574
  return;
493
575
  case "sidecar.release_pending":
494
- this.addSidecarReleasePending(event.data);
576
+ this.cleanupTracker.addSidecarReleasePending(event.data);
495
577
  return;
496
578
  }
497
579
  }
498
580
  finish() {
499
581
  if (!this.completion && !this.failure) incomplete("Batch stream ended before batch.completed or batch.failed");
500
- const cleanup = this.finishCleanup();
582
+ const cleanup = this.cleanupTracker.finish();
501
583
  if (this.failure) throw new BatchStreamError(this.failure.error, "failed", this.failure, cleanup);
502
584
  const completion = this.completion;
503
585
  const started = this.started;
@@ -546,9 +628,6 @@ var BatchStreamState = class {
546
628
  this.requireRunning(eventType);
547
629
  if (!this.sidecars) invalid(`Batch stream emitted ${eventType} before sidecars.allocated`);
548
630
  }
549
- requireTerminal(eventType) {
550
- if (!this.terminal) invalid(`Batch stream emitted ${eventType} before a batch terminal event`);
551
- }
552
631
  validateBackend(identity) {
553
632
  const expectedType = this.backendTypes.get(identity.backendId);
554
633
  if (!expectedType) invalid(`Batch stream referenced unknown backend id: ${identity.backendId}`);
@@ -726,63 +805,6 @@ var BatchStreamState = class {
726
805
  if (data.backendIds.length !== this.backendTypes.size || reported.size !== this.backendTypes.size || [...this.backendTypes.keys()].some((id) => !reported.has(id))) invalid("Batch failure metadata does not match the requested backends");
727
806
  this.failure = data;
728
807
  }
729
- addPersistentCleanup(data) {
730
- this.requireTerminal("batch.persistent");
731
- if (!this.completion || !this.request.persistent || this.cleanup) invalid("Batch stream emitted invalid or duplicate batch.persistent cleanup metadata");
732
- if (data.sidecarCount !== this.allocatedSidecarIds.size) invalid("Batch persistent sidecar count does not match allocation");
733
- this.cleanup = {
734
- mode: "persistent",
735
- ...data
736
- };
737
- }
738
- addGraceCleanup(data) {
739
- this.requireTerminal("batch.grace_period");
740
- if (!this.completion || this.request.persistent || this.cleanup || this.request.graceMs === 0) invalid("Batch stream emitted invalid or duplicate batch.grace_period cleanup metadata");
741
- const reported = new Set(data.sidecarIds);
742
- if (data.sidecarCount !== this.allocatedSidecarIds.size || data.sidecarIds.length !== reported.size || !setsMatch(this.allocatedSidecarIds, reported) || this.request.graceMs !== void 0 && data.graceMs !== this.request.graceMs) invalid("Batch grace-period metadata does not match allocation");
743
- this.cleanup = {
744
- mode: "grace",
745
- ...data
746
- };
747
- }
748
- addSidecarReleasing(data) {
749
- this.requireTerminal("sidecar.releasing");
750
- const graceMs = "graceMs" in this.request ? this.request.graceMs : void 0;
751
- if (this.request.persistent && this.terminal === "completed" || this.cleanup?.mode === "persistent" || this.cleanup?.mode === "grace" || this.terminal === "completed" && graceMs !== void 0 && graceMs > 0) invalid("Batch stream emitted sidecar.releasing for retained compute");
752
- if (this.terminal === "completed" && !this.allocatedSidecarIds.has(data.sidecarId)) invalid(`Batch stream released unknown sidecar: ${data.sidecarId}`);
753
- if (this.releasingSidecars.has(data.sidecarId) || this.releasedSidecars.has(data.sidecarId) || this.pendingSidecars.has(data.sidecarId)) invalid(`Batch stream started sidecar release more than once: ${data.sidecarId}`);
754
- this.releasingSidecars.add(data.sidecarId);
755
- }
756
- addSidecarReleased(data) {
757
- this.requireTerminal("sidecar.released");
758
- if (!this.releasingSidecars.delete(data.sidecarId)) invalid(`Batch stream confirmed release before sidecar.releasing: ${data.sidecarId}`);
759
- this.releasedSidecars.add(data.sidecarId);
760
- }
761
- addSidecarReleasePending(data) {
762
- this.requireTerminal("sidecar.release_pending");
763
- if (!this.releasingSidecars.delete(data.sidecarId)) invalid(`Batch stream reported pending release before sidecar.releasing: ${data.sidecarId}`);
764
- if (data.attempt < 1 || data.retryInMs < 1) invalid("Batch stream reported invalid pending release retry metadata");
765
- this.pendingSidecars.add(data.sidecarId);
766
- }
767
- finishCleanup() {
768
- const graceMs = "graceMs" in this.request ? this.request.graceMs : void 0;
769
- if (this.request.persistent && this.terminal === "completed") {
770
- if (this.cleanup?.mode !== "persistent") incomplete("Batch stream ended before batch.persistent cleanup metadata");
771
- return this.cleanup;
772
- }
773
- if (this.cleanup?.mode === "grace" && this.terminal === "completed") return this.cleanup;
774
- if (this.terminal === "completed" && graceMs !== void 0 && graceMs > 0) incomplete("Batch stream ended before batch.grace_period cleanup metadata");
775
- if (this.releasingSidecars.size > 0) incomplete(`Batch stream ended while releasing ${this.releasingSidecars.size} sidecars`);
776
- const terminalCleanupSidecars = new Set([...this.releasedSidecars, ...this.pendingSidecars]);
777
- if (this.terminal === "completed" && !setsMatch(terminalCleanupSidecars, this.allocatedSidecarIds)) incomplete(`Batch stream ended after resolving cleanup for ${terminalCleanupSidecars.size} of ${this.allocatedSidecarIds.size} sidecars`);
778
- if (this.failure && [...this.allocatedSidecarIds].some((sidecarId) => !terminalCleanupSidecars.has(sidecarId))) incomplete(`Failed batch stream ended after resolving cleanup for ${terminalCleanupSidecars.size} of ${this.allocatedSidecarIds.size} sidecars`);
779
- return {
780
- mode: "release",
781
- releasedSidecarIds: [...this.releasedSidecars],
782
- pendingSidecarIds: [...this.pendingSidecars],
783
- isComplete: this.pendingSidecars.size === 0
784
- };
785
- }
786
808
  };
787
809
  //#endregion
788
810
  //#region src/batch.ts
@@ -1200,11 +1222,11 @@ function isLocalSandboxEndpoint(baseUrl) {
1200
1222
  }
1201
1223
  }
1202
1224
  async function resolveLocalCliAuthFiles(backendType) {
1203
- const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-XgKy2zsU.js");
1225
+ const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-D-CQ0-ub.js");
1204
1226
  return discoverLocalCliAuthFiles(backendType);
1205
1227
  }
1206
1228
  async function loadLocalCliAuthExpectation(backendType) {
1207
- const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-XgKy2zsU.js");
1229
+ const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-D-CQ0-ub.js");
1208
1230
  return describe(backendType);
1209
1231
  }
1210
1232
  /**
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { S as StateError, T as ValidationError, _ as ProfileFileMountPathError, a as AuthError, b as SandboxError, g as PartialFailureError, h as NotFoundError, m as NetworkError, s as CapabilityError, u as FileWriteConflictError, v as QuotaError, w as TimeoutError, x as ServerError } from "./errors-BfbOP_rx.js";
2
- import { _ as parseBackendRegistryResponse, a as InstancesClient, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as InstanceRestartingError, m as backendRegistryInteractionKindSchema, p as backendRegistryEntrySchema, r as HostedInstance, t as Sandbox, v as parseBackendRegistryResponseBody } from "./client-Dy5B2NkM.js";
3
- import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-BPLzHOZ1.js";
2
+ import { _ as parseBackendRegistryResponse, a as InstancesClient, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as InstanceRestartingError, m as backendRegistryInteractionKindSchema, p as backendRegistryEntrySchema, r as HostedInstance, t as Sandbox, v as parseBackendRegistryResponseBody } from "./client-CgtR203z.js";
3
+ import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-BrZxAq11.js";
4
4
  import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-C5ER4aN_.js";
5
5
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
6
6
  import { i as parseLineApplicationResult, n as LINE_APPLICATION_REQUEST_MAX_BYTES, r as parseLineApplicationRequest, t as LINE_APPLICATION_REPLY_MAX_CHARS } from "./line-application-DY9ZTdgF.js";
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { i as isolationPrincipalSchema, o as parseBackendType, r as backendTypeSchema, t as ALL_BACKEND_TYPES } from "./backend-types-CLvdSX8V.js";
2
2
  import { A as normalizeRuntimeBackendConfig, B as TERMINAL_WS_ECHO_SUBPROTOCOL, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, b as parseSSEStream, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-OAsASPd_.js";
3
3
  import { C as StreamInterruptedError, S as StateError, T as ValidationError, _ as ProfileFileMountPathError, a as AuthError, b as SandboxError, c as EdgeNotReadyError, d as GpuProviderNotConfiguredError, f as KeyBudgetExhaustedError, g as PartialFailureError, h as NotFoundError, l as EgressProxyRecoveryError, m as NetworkError, o as BranchFanoutExceedsHostError, s as CapabilityError, t as TerminalStreamError, u as FileWriteConflictError, v as QuotaError, w as TimeoutError, x as ServerError, y as ResumeEnvRequiredError } from "./errors-BfbOP_rx.js";
4
- import { _ as parseBackendRegistryResponse, a as InstancesClient, c as IntelligenceClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as InstanceRestartingError, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as RunsClient, o as SandboxFleetClient, p as backendRegistryEntrySchema, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-Dy5B2NkM.js";
4
+ import { _ as parseBackendRegistryResponse, a as InstancesClient, c as IntelligenceClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as InstanceRestartingError, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as RunsClient, o as SandboxFleetClient, p as backendRegistryEntrySchema, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-CgtR203z.js";
5
5
  import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-DHx53yre.js";
6
- import { C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, d as InteractiveSessionHandle, f as agentInteractiveSessionPromptRequestDigest, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as materializeProfileFileMounts, x as ManagedProcessClient, y as getSandboxEventText } from "./sandbox-BPLzHOZ1.js";
6
+ import { C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, d as InteractiveSessionHandle, f as agentInteractiveSessionPromptRequestDigest, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as materializeProfileFileMounts, x as ManagedProcessClient, y as getSandboxEventText } from "./sandbox-BrZxAq11.js";
7
7
  import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-C5ER4aN_.js";
8
8
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
9
9
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-g_HzXa6f.js";
10
10
  import { i as parseLineApplicationResult, n as LINE_APPLICATION_REQUEST_MAX_BYTES, r as parseLineApplicationRequest, t as LINE_APPLICATION_REPLY_MAX_CHARS } from "./line-application-DY9ZTdgF.js";
11
- import { s as TangleSandboxClient } from "./tangle-C4Bp5krB.js";
11
+ import { s as TangleSandboxClient } from "./tangle-GiPBak5X.js";
12
12
  import { z } from "zod";
13
13
  import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
14
14
  //#region src/confidential.ts
@@ -1,4 +1,4 @@
1
- import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-BYvVrIso.js";
1
+ import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-CFeHsq-5.js";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { homedir } from "node:os";
@@ -4,7 +4,7 @@ import { C as StreamInterruptedError, F as profileFileMountOutsideRootsMessage,
4
4
  import { _ as interactiveSessionStatusResponseSchema, d as awaitWithAbort, f as combineAbortSignals, g as interactiveSessionControlValidationResponseSchema, h as interactiveSessionControlReleaseResponseSchema, l as createInteractiveControlHolderId, m as interactiveSessionControlClaimResponseSchema, p as delayUntilAborted } from "./browser-interactive-control-controller-DHx53yre.js";
5
5
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BBzJDWyt.js";
6
6
  import { s as uploadChunked } from "./chunked-upload-DN2twsUu.js";
7
- import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-BYvVrIso.js";
7
+ import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CFeHsq-5.js";
8
8
  import { n as SandboxLines } from "./lines-C5ER4aN_.js";
9
9
  import { z } from "zod";
10
10
  import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, PlanContinuationSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, canonicalCandidateJson, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
@@ -431,7 +431,7 @@ interface SessionGatewayStats {
431
431
  */
432
432
  declare function calculateConnectionQuality(metrics: ConnectionMetrics, isConnected: boolean): ConnectionQuality;
433
433
  //#endregion
434
- //#region ../../../packages/sdk/dist/client-BiqC9Qo9.d.ts
434
+ //#region ../../../packages/sdk/dist/client-h8AqRerh.d.ts
435
435
  //#region src/session-gateway/core-types.d.ts
436
436
  interface SubscriptionDenial {
437
437
  channel: string;
@@ -500,38 +500,16 @@ declare const INITIAL_METRICS: ConnectionMetrics; //#endregion
500
500
  //#region src/session-gateway/core.d.ts
501
501
  declare class SessionGatewayClientCore {
502
502
  #private;
503
- private readonly initialMetrics;
504
503
  private ws;
505
504
  private readonly handlers;
506
- private readonly replayStateStore;
507
- private readonly tokenRefresher;
508
505
  private state;
509
- private connectedAt;
510
- private hasConnectedBefore;
511
- private connectionEstablishedForSocket;
512
- private lastPingAt;
513
- private lastPongAt;
514
- private lastPingSentAt;
515
- private missedPongCount;
516
- private reconnectAttempts;
517
- private messagesReceived;
518
- private messagesSent;
519
- private eventsReceived;
520
- private duplicatesSkipped;
521
- private reconnectTimer;
522
- private pingInterval;
523
- private pongTimeout;
524
- private pendingCallbacks;
506
+ private readonly counters;
525
507
  private readonly connectionWaiters;
526
- private messageIdCounter;
527
- private processedEventIds;
528
- private pingLatencyHistory;
529
- private connectionMetrics;
530
- private lastEventId;
531
- private currentExecutionId;
532
- private currentSessionId;
533
- private isReplaying;
534
- private replayProgress;
508
+ private readonly reconnects;
509
+ private readonly heartbeat;
510
+ private readonly metrics;
511
+ private readonly replayCursor;
512
+ private readonly inbound;
535
513
  constructor(config: SessionGatewayClientConfig$1, initialMetrics?: ConnectionMetrics);
536
514
  /**
537
515
  * Connect to the session gateway.
@@ -590,31 +568,11 @@ declare class SessionGatewayClientCore {
590
568
  */
591
569
  getToken(): string;
592
570
  private setState;
593
- private handleOpen;
594
571
  private handleConnectionEstablished;
595
572
  private handleClose;
596
- private handleError;
597
- private closeBeforeEstablishment;
598
573
  private handleMessage;
599
- private handlePong;
600
- private dispatchMessage;
601
- private deliverMessage;
602
- private trackExecutionContext;
603
574
  private send;
604
575
  private sendWithResponse;
605
- private waitForConnectionEstablished;
606
- private restoreSubscriptions;
607
- private startPingInterval;
608
- private stopPingInterval;
609
- private sendPing;
610
- private clearPongTimeout;
611
- private scheduleReconnect;
612
- private cleanup;
613
- private updateConnectionMetrics;
614
- private updateConnectionQuality;
615
- private trackReconnection;
616
- private loadReplayState;
617
- private saveReplayState;
618
576
  } //#endregion
619
577
  //#region src/session-gateway/client.d.ts
620
578
  /** SDK client with its original immediate, synchronous replay commands. */