@opengeni/worker-bundle 0.28.3-canary.0 → 0.28.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  observabilityEventLogger
3
- } from "./chunk-A4XQWVZK.js";
3
+ } from "./chunk-BARTLVBK.js";
4
4
 
5
5
  // src/activity-services.ts
6
6
  import { dbSearchPath, getSettings, resolveNatsControlPlaneAuth } from "@opengeni/config";
@@ -1646,8 +1646,6 @@ async function nextStreamEvent(iterator, context) {
1646
1646
  }
1647
1647
 
1648
1648
  // src/sandbox-archive-storage.ts
1649
- import { uploadWorkspaceArchiveSpool } from "@opengeni/storage";
1650
- import { randomUUID as randomUUID2 } from "crypto";
1651
1649
  import {
1652
1650
  parseWorkspaceArchiveObjectRef,
1653
1651
  workspaceArchiveObjectKey
@@ -1659,74 +1657,47 @@ var WorkspaceArchiveObjectStorageRequiredError = class extends Error {
1659
1657
  this.name = "WorkspaceArchiveObjectStorageRequiredError";
1660
1658
  }
1661
1659
  };
1660
+ function collectWorkspaceArchiveObjectKeys(resumeState) {
1661
+ const sessionState = resumeState?.sessionState && typeof resumeState.sessionState === "object" ? resumeState.sessionState : null;
1662
+ const keys = /* @__PURE__ */ new Set();
1663
+ for (const value of [sessionState?.workspaceArchiveRef, sessionState?.workspaceArchivePrevRef]) {
1664
+ const ref = parseWorkspaceArchiveObjectRef(value);
1665
+ if (ref) keys.add(ref.key);
1666
+ }
1667
+ return keys;
1668
+ }
1662
1669
  async function putTarWorkspaceArchiveObject(input) {
1663
- const descriptor = structuredClone(input.archive.descriptor);
1664
- if (descriptor.version !== 1) {
1670
+ if (input.archive.descriptor.version !== 1) {
1665
1671
  throw new Error("Object-storage workspace archives are portable tar only");
1666
1672
  }
1667
1673
  const key = workspaceArchiveObjectKey({
1668
1674
  accountId: input.accountId,
1669
1675
  workspaceId: input.workspaceId,
1670
1676
  sandboxGroupId: input.sandboxGroupId,
1671
- revision: descriptor.revision,
1672
- uploadId: randomUUID2()
1677
+ revision: input.archive.descriptor.revision
1678
+ });
1679
+ await input.objectStorage.putObject({
1680
+ key,
1681
+ contentType: "application/x-tar",
1682
+ body: input.archive.bytes,
1683
+ sha256: input.archive.descriptor.archiveSha256
1673
1684
  });
1674
- const archive = input.archive;
1675
- if ("spool" in archive) {
1676
- if (archive.spool.byteSize !== descriptor.archiveBytes || archive.spool.sha256 !== descriptor.archiveSha256) {
1677
- throw new Error("Workspace archive spool does not match its verified descriptor");
1678
- }
1679
- }
1680
- const source = "spool" in archive ? archive.spool : {
1681
- path: "",
1682
- byteSize: archive.bytes.byteLength,
1683
- sha256: descriptor.archiveSha256,
1684
- async *open() {
1685
- for (let offset = 0; offset < archive.bytes.length; offset += 1024 * 1024)
1686
- yield archive.bytes.subarray(offset, offset + 1024 * 1024);
1687
- },
1688
- async dispose() {
1689
- }
1690
- };
1691
- try {
1692
- await uploadWorkspaceArchiveSpool(input.objectStorage, key, {
1693
- ...source,
1694
- byteSize: descriptor.archiveBytes,
1695
- sha256: descriptor.archiveSha256,
1696
- open: source.open.bind(source)
1697
- });
1698
- } catch (error) {
1699
- await input.objectStorage.deleteObject(key).catch(() => void 0);
1700
- throw error;
1701
- }
1702
1685
  return {
1703
1686
  schema: "sandbox_archive_object_v1",
1704
1687
  key,
1705
- sha256: descriptor.archiveSha256,
1706
- bytes: descriptor.archiveBytes,
1688
+ sha256: input.archive.descriptor.archiveSha256,
1689
+ bytes: input.archive.descriptor.archiveBytes,
1707
1690
  backend: input.objectStorage.backend
1708
1691
  };
1709
1692
  }
1710
- async function persistWorkspaceArchiveCandidate(input) {
1711
- const objectStorage = input.objectStorage;
1712
- const ref = input.ref ? { ...input.ref } : void 0;
1713
- const result = await input.persist();
1714
- if (objectStorage && ref && result.candidateDisposition === "unused") {
1715
- await deleteUnpublishedWorkspaceArchiveObject(objectStorage, ref);
1716
- }
1717
- return result;
1718
- }
1719
1693
  async function putVersion1TarArchiveOrInline(input) {
1720
1694
  if (input.archive.descriptor.version !== 1) {
1721
- if ("spool" in input.archive) throw new Error("Native snapshots cannot use a portable spool");
1722
1695
  return { workspaceArchive: input.archive.base64 };
1723
1696
  }
1724
1697
  if (input.backend === "opensandbox" && !input.objectStorage) {
1725
1698
  throw new WorkspaceArchiveObjectStorageRequiredError("opensandbox");
1726
1699
  }
1727
1700
  if (!input.objectStorage) {
1728
- if ("spool" in input.archive)
1729
- throw new WorkspaceArchiveObjectStorageRequiredError(input.backend);
1730
1701
  return { workspaceArchive: input.archive.base64 };
1731
1702
  }
1732
1703
  try {
@@ -1735,7 +1706,7 @@ async function putVersion1TarArchiveOrInline(input) {
1735
1706
  accountId: input.accountId,
1736
1707
  workspaceId: input.workspaceId,
1737
1708
  sandboxGroupId: input.sandboxGroupId,
1738
- archive: input.archive
1709
+ archive: { bytes: input.archive.bytes, descriptor: input.archive.descriptor }
1739
1710
  });
1740
1711
  try {
1741
1712
  input.metrics?.onWorkspaceArchiveObject?.({
@@ -1776,6 +1747,11 @@ async function deleteUnpublishedWorkspaceArchiveObject(objectStorage, ref, metri
1776
1747
  console.error("unpublished workspace archive object delete failed", { key: ref.key });
1777
1748
  }
1778
1749
  }
1750
+ async function deleteWorkspaceArchiveObjectKeys(objectStorage, keys) {
1751
+ for (const key of keys) {
1752
+ await objectStorage.deleteObject(key);
1753
+ }
1754
+ }
1779
1755
 
1780
1756
  // src/sandbox-routing.ts
1781
1757
  import { sandboxLifecycleTransitionWaitMs as sandboxLifecycleTransitionWaitMs2 } from "@opengeni/config";
@@ -1830,7 +1806,7 @@ import {
1830
1806
  sandboxArchiveCaptureTimeoutMs,
1831
1807
  sandboxLifecycleTransitionWaitMs
1832
1808
  } from "@opengeni/config";
1833
- import { randomUUID as randomUUID3 } from "crypto";
1809
+ import { randomUUID as randomUUID2 } from "crypto";
1834
1810
  import {
1835
1811
  acquireLease,
1836
1812
  adoptLegacyModalCheckpointArtifact,
@@ -1857,8 +1833,7 @@ import {
1857
1833
  SandboxLeaseTransitionError
1858
1834
  } from "@opengeni/db";
1859
1835
  import {
1860
- captureWorkspaceArchiveForStorage,
1861
- disposeWorkspaceArchive,
1836
+ captureVerifiedWorkspaceArchive,
1862
1837
  describeLegacyNativeSnapshotArchive,
1863
1838
  inlineWorkspaceArchiveForRestore,
1864
1839
  MODAL_EXEC_READINESS_TIMEOUT_MS,
@@ -1879,10 +1854,6 @@ import {
1879
1854
  verifySandboxExecReadiness,
1880
1855
  withoutSandboxProviderIdentity
1881
1856
  } from "@opengeni/runtime";
1882
- import {
1883
- downloadWorkspaceArchiveSpool,
1884
- WorkspaceArchiveStorageError
1885
- } from "@opengeni/storage";
1886
1857
  import { parseWorkspaceArchiveObjectRef as parseWorkspaceArchiveObjectRef2 } from "@opengeni/contracts";
1887
1858
  function sandboxLeaseHolderIdForAttempt(attemptId) {
1888
1859
  const normalized = attemptId.trim();
@@ -2138,10 +2109,6 @@ async function materializeSpawnEnvelopeArchive(envelope, objectStorage) {
2138
2109
  "workspace archive object storage is not configured"
2139
2110
  );
2140
2111
  }
2141
- const descriptor = parseWorkspaceArchiveDescriptor(sessionState.workspaceArchiveMeta);
2142
- if (process.platform === "linux" && descriptor?.version === 1 && descriptor.workspace.projection === "sdk_local_archive_v1") {
2143
- return envelope;
2144
- }
2145
2112
  return {
2146
2113
  ...record,
2147
2114
  sessionState: await inlineWorkspaceArchiveForRestore(
@@ -2239,7 +2206,7 @@ async function persistWarmWorkspaceSnapshot(services, ids, session, leaseEpoch,
2239
2206
  const nativeModalPersistence = workspacePersistence === "snapshot_filesystem" || workspacePersistence === "snapshot_directory";
2240
2207
  const checkpointBinding = nativeModalPersistence ? await resolveModalCheckpointBindingBeforeCapture(settings, persistable, signal) : null;
2241
2208
  if (signal?.aborted) return false;
2242
- const captureId = randomUUID3();
2209
+ const captureId = randomUUID2();
2243
2210
  const captureTimeoutMs = sandboxArchiveCaptureTimeoutMs(settings);
2244
2211
  const claimed = await claimWorkspaceArchiveCapture(db, {
2245
2212
  accountId: ids.accountId,
@@ -2272,7 +2239,7 @@ async function persistWarmWorkspaceSnapshot(services, ids, session, leaseEpoch,
2272
2239
  let timeout;
2273
2240
  const capturedAtMs = Date.now();
2274
2241
  const registerCandidate = async (archive) => {
2275
- if (archive.kind === "host_spool" || archive.descriptor.version !== 2 || archive.descriptor.provider !== "modal_snapshot_filesystem" && archive.descriptor.provider !== "modal_snapshot_directory") {
2242
+ if (archive.descriptor.version !== 2 || archive.descriptor.provider !== "modal_snapshot_filesystem" && archive.descriptor.provider !== "modal_snapshot_directory") {
2276
2243
  return null;
2277
2244
  }
2278
2245
  if (!checkpointBinding) {
@@ -2301,64 +2268,80 @@ async function persistWarmWorkspaceSnapshot(services, ids, session, leaseEpoch,
2301
2268
  }).catch(() => void 0);
2302
2269
  };
2303
2270
  const captureAndPublish = (async () => {
2304
- let archive;
2305
2271
  let candidate = null;
2306
- let publicationAttempted = false;
2272
+ let workspaceArchiveRef;
2307
2273
  try {
2308
- archive = await captureWorkspaceArchiveForStorage(
2309
- session,
2310
- capturedAtMs,
2311
- {
2312
- requestId: claimed.claim.providerRequestId,
2313
- strategy: capturePolicy.strategy
2314
- },
2315
- Boolean(services.objectStorage)
2316
- );
2274
+ const archive = await captureVerifiedWorkspaceArchive(session, capturedAtMs, {
2275
+ requestId: claimed.claim.providerRequestId,
2276
+ strategy: capturePolicy.strategy
2277
+ });
2317
2278
  candidate = await registerCandidate(archive);
2318
- const archiveDescriptor = archive.descriptor;
2279
+ const priorLease = await readLease(db, ids.workspaceId, ids.sandboxGroupId);
2280
+ const priorKeys = collectWorkspaceArchiveObjectKeys(
2281
+ priorLease?.resumeState ?? null
2282
+ );
2319
2283
  const published = await putVersion1TarArchiveOrInline({
2320
2284
  backend: lease.backend,
2321
2285
  objectStorage: services.objectStorage,
2322
2286
  accountId: ids.accountId,
2323
2287
  workspaceId: ids.workspaceId,
2324
2288
  sandboxGroupId: ids.sandboxGroupId,
2325
- archive,
2289
+ archive: {
2290
+ bytes: archive.bytes,
2291
+ descriptor: archive.descriptor,
2292
+ base64: archive.base64
2293
+ },
2326
2294
  ...services.sandboxMetrics ? { metrics: services.sandboxMetrics } : {}
2327
2295
  });
2328
- publicationAttempted = true;
2329
- const { wrote } = await persistWorkspaceArchiveCandidate({
2330
- ...services.objectStorage ? { objectStorage: services.objectStorage } : {},
2331
- ...published.workspaceArchiveRef ? { ref: published.workspaceArchiveRef } : {},
2332
- persist: () => persistWarmSnapshot(db, {
2333
- accountId: ids.accountId,
2334
- workspaceId: ids.workspaceId,
2335
- sessionId: ids.sessionId,
2336
- turnId: ids.turnId,
2337
- attemptId: ids.attemptId,
2338
- sandboxGroupId: ids.sandboxGroupId,
2339
- expectedEpoch: leaseEpoch,
2340
- expectedInstanceId: instanceId,
2341
- expectedWorkspaceGeneration: claimed.claim.workspaceGeneration,
2342
- captureId,
2343
- workspaceArchiveMeta: archiveDescriptor,
2344
- ...published,
2345
- checkpointArtifactId: candidate?.id ?? null,
2346
- minIntervalMs: force ? 0 : intervalMs,
2347
- capturedAtMs
2348
- })
2296
+ workspaceArchiveRef = published.workspaceArchiveRef;
2297
+ const { wrote } = await persistWarmSnapshot(db, {
2298
+ accountId: ids.accountId,
2299
+ workspaceId: ids.workspaceId,
2300
+ sessionId: ids.sessionId,
2301
+ turnId: ids.turnId,
2302
+ attemptId: ids.attemptId,
2303
+ sandboxGroupId: ids.sandboxGroupId,
2304
+ expectedEpoch: leaseEpoch,
2305
+ expectedInstanceId: instanceId,
2306
+ expectedWorkspaceGeneration: claimed.claim.workspaceGeneration,
2307
+ captureId,
2308
+ workspaceArchiveMeta: archive.descriptor,
2309
+ ...published,
2310
+ checkpointArtifactId: candidate?.id ?? null,
2311
+ minIntervalMs: force ? 0 : intervalMs,
2312
+ capturedAtMs
2349
2313
  });
2314
+ if (published.workspaceArchiveRef && services.objectStorage) {
2315
+ if (!wrote) {
2316
+ await deleteUnpublishedWorkspaceArchiveObject(
2317
+ services.objectStorage,
2318
+ published.workspaceArchiveRef,
2319
+ services.sandboxMetrics
2320
+ );
2321
+ } else {
2322
+ const afterLease = await readLease(db, ids.workspaceId, ids.sandboxGroupId);
2323
+ const afterKeys = collectWorkspaceArchiveObjectKeys(
2324
+ afterLease?.resumeState ?? null
2325
+ );
2326
+ await deleteWorkspaceArchiveObjectKeys(
2327
+ services.objectStorage,
2328
+ [...priorKeys].filter((key) => !afterKeys.has(key))
2329
+ ).catch(() => void 0);
2330
+ }
2331
+ }
2350
2332
  if (!wrote && candidate) {
2351
2333
  await abandonCandidate(candidate.id, "snapshot_publication_fenced");
2352
2334
  }
2353
2335
  return wrote;
2354
2336
  } catch (error) {
2355
- if (candidate && !publicationAttempted)
2356
- await abandonCandidate(candidate.id, "snapshot_capture_failed");
2337
+ await deleteUnpublishedWorkspaceArchiveObject(
2338
+ services.objectStorage,
2339
+ workspaceArchiveRef,
2340
+ services.sandboxMetrics
2341
+ );
2342
+ if (candidate) await abandonCandidate(candidate.id, "snapshot_capture_failed");
2357
2343
  throw error;
2358
2344
  } finally {
2359
- await disposeWorkspaceArchive(archive).catch(() => {
2360
- console.warn("workspace archive spool cleanup failed");
2361
- });
2362
2345
  await releaseWorkspaceArchiveCapture(db, {
2363
2346
  accountId: ids.accountId,
2364
2347
  workspaceId: ids.workspaceId,
@@ -2698,24 +2681,6 @@ async function resumeBoxForTurn(services, ids, kind, holderId) {
2698
2681
  const established = await establishSandboxSessionFromEnvelope(settings, hydrateEnvelope, {
2699
2682
  sessionId: ids.sessionId,
2700
2683
  recovery: "create-or-restore",
2701
- ...services.objectStorage ? {
2702
- loadHostWorkspaceArchive: async (ref) => {
2703
- try {
2704
- return await downloadWorkspaceArchiveSpool(services.objectStorage, ref.key, {
2705
- bytes: ref.bytes,
2706
- sha256: ref.sha256
2707
- });
2708
- } catch (error) {
2709
- if (error instanceof WorkspaceArchiveStorageError) {
2710
- throw new WorkspaceArchiveIntegrityError(error.code, error.message, {
2711
- retryable: error.retryable,
2712
- cause: error
2713
- });
2714
- }
2715
- throw error;
2716
- }
2717
- }
2718
- } : {},
2719
2684
  backendOverride: ids.backend,
2720
2685
  ...ids.environment ? { environment: ids.environment } : {},
2721
2686
  ...services.sandboxMetrics ? { metrics: services.sandboxMetrics } : {},
@@ -3294,11 +3259,11 @@ function afterPersistableHomeMutation(services, ids, home) {
3294
3259
  function beforeRetainedProcessMutation(services, ids) {
3295
3260
  const fence = ids.workspaceMutationFence;
3296
3261
  if (!fence) return void 0;
3297
- return async ({ op, process: process2 }) => await advanceWorkspaceGenerationForRetainedProcess(services.db, {
3262
+ return async ({ op, process }) => await advanceWorkspaceGenerationForRetainedProcess(services.db, {
3298
3263
  accountId: fence.accountId,
3299
3264
  workspaceId: ids.workspaceId,
3300
3265
  sessionId: ids.sessionId,
3301
- processId: process2.id,
3266
+ processId: process.id,
3302
3267
  operation: op,
3303
3268
  captureWaitMs: sandboxLifecycleTransitionWaitMs2(services.settings),
3304
3269
  ...services.waitSignal ? { waitSignal: services.waitSignal } : {}
@@ -3307,7 +3272,7 @@ function beforeRetainedProcessMutation(services, ids) {
3307
3272
  function afterRetainedProcessMutation(services, ids) {
3308
3273
  const fence = ids.workspaceMutationFence;
3309
3274
  if (!fence) return void 0;
3310
- return async ({ op, process: process2, admission, outcome }) => {
3275
+ return async ({ op, process, admission, outcome }) => {
3311
3276
  if (!admission || typeof admission !== "object" || typeof admission.id !== "string" || typeof admission.workspaceGeneration !== "number") {
3312
3277
  throw new Error("Retained-process mutation settlement lacked its exact admission");
3313
3278
  }
@@ -3315,7 +3280,7 @@ function afterRetainedProcessMutation(services, ids) {
3315
3280
  accountId: fence.accountId,
3316
3281
  workspaceId: ids.workspaceId,
3317
3282
  sessionId: ids.sessionId,
3318
- processId: process2.id,
3283
+ processId: process.id,
3319
3284
  admission,
3320
3285
  operation: op,
3321
3286
  outcome
@@ -3341,7 +3306,7 @@ function captureRetainedProcessOutputForTurn(services, ids) {
3341
3306
  const accountId = ids.workspaceMutationFence?.accountId;
3342
3307
  if (!accountId) return void 0;
3343
3308
  return async ({
3344
- process: process2,
3309
+ process,
3345
3310
  chunkId,
3346
3311
  chunk,
3347
3312
  stream,
@@ -3351,7 +3316,7 @@ function captureRetainedProcessOutputForTurn(services, ids) {
3351
3316
  accountId,
3352
3317
  workspaceId: ids.workspaceId,
3353
3318
  sessionId: ids.sessionId,
3354
- commandId: process2.id,
3319
+ commandId: process.id,
3355
3320
  chunkId,
3356
3321
  chunk,
3357
3322
  stream,
@@ -3364,32 +3329,32 @@ function captureRetainedProcessOutputForTurn(services, ids) {
3364
3329
  function observeRetainedProcessTerminalForTurn(services, ids) {
3365
3330
  const fence = ids.workspaceMutationFence;
3366
3331
  if (!fence) return void 0;
3367
- return async ({ process: process2 }) => {
3332
+ return async ({ process }) => {
3368
3333
  await observeSessionBackgroundCommandCompletion(services.db, {
3369
3334
  accountId: fence.accountId,
3370
3335
  workspaceId: ids.workspaceId,
3371
3336
  sessionId: ids.sessionId,
3372
- commandId: process2.id
3337
+ commandId: process.id
3373
3338
  });
3374
3339
  };
3375
3340
  }
3376
3341
  function settleRetainedProcessForTurn(services, ids) {
3377
3342
  const fence = ids.workspaceMutationFence;
3378
3343
  if (!fence) return void 0;
3379
- return async ({ backend, process: process2, proof }) => {
3344
+ return async ({ backend, process, proof }) => {
3380
3345
  const durable = await getRetainedProcess(services.db, {
3381
3346
  workspaceId: ids.workspaceId,
3382
3347
  sessionId: ids.sessionId,
3383
- processId: process2.id
3348
+ processId: process.id
3384
3349
  });
3385
- if (!durable || durable.providerSessionId !== process2.providerSessionId || durable.providerBackend !== backend.kind || durable.providerInstanceId !== backend.providerInstanceId || durable.leaseEpoch !== backend.leaseEpoch || durable.routeKind !== (backend.sandboxId === null ? "home" : "active") || durable.routeTargetId !== backend.sandboxId || durable.routeEpoch !== backend.activeEpoch) {
3350
+ if (!durable || durable.providerSessionId !== process.providerSessionId || durable.providerBackend !== backend.kind || durable.providerInstanceId !== backend.providerInstanceId || durable.leaseEpoch !== backend.leaseEpoch || durable.routeKind !== (backend.sandboxId === null ? "home" : "active") || durable.routeTargetId !== backend.sandboxId || durable.routeEpoch !== backend.activeEpoch) {
3386
3351
  throw new Error("Retained-process settlement lost its exact durable backend identity");
3387
3352
  }
3388
3353
  const settlement = await settleRetainedProcess(services.db, {
3389
3354
  accountId: fence.accountId,
3390
3355
  workspaceId: ids.workspaceId,
3391
3356
  sessionId: ids.sessionId,
3392
- processId: process2.id,
3357
+ processId: process.id,
3393
3358
  expected: retainedProcessSettlementIdentity(durable),
3394
3359
  outcome: proof.outcome,
3395
3360
  exitCode: proof.exitCode,
@@ -3407,13 +3372,13 @@ function settleRetainedProcessForTurn(services, ids) {
3407
3372
  function adoptRetainedProcessAsBackgroundCommandForTurn(services, ids) {
3408
3373
  const fence = ids.workspaceMutationFence;
3409
3374
  if (!fence) return void 0;
3410
- return async ({ backend, process: process2 }) => {
3375
+ return async ({ backend, process }) => {
3411
3376
  const durable = await getRetainedProcess(services.db, {
3412
3377
  workspaceId: ids.workspaceId,
3413
3378
  sessionId: ids.sessionId,
3414
- processId: process2.id
3379
+ processId: process.id
3415
3380
  });
3416
- if (!durable || durable.providerSessionId !== process2.providerSessionId || durable.providerBackend !== backend.kind || durable.providerInstanceId !== backend.providerInstanceId || durable.leaseEpoch !== backend.leaseEpoch || durable.routeKind !== (backend.sandboxId === null ? "home" : "active") || durable.routeTargetId !== backend.sandboxId || durable.routeEpoch !== backend.activeEpoch) {
3381
+ if (!durable || durable.providerSessionId !== process.providerSessionId || durable.providerBackend !== backend.kind || durable.providerInstanceId !== backend.providerInstanceId || durable.leaseEpoch !== backend.leaseEpoch || durable.routeKind !== (backend.sandboxId === null ? "home" : "active") || durable.routeTargetId !== backend.sandboxId || durable.routeEpoch !== backend.activeEpoch) {
3417
3382
  throw new Error("Background command adoption lost its exact retained-process identity");
3418
3383
  }
3419
3384
  await adoptManagedSessionBackgroundCommand(services.db, {
@@ -3423,7 +3388,7 @@ function adoptRetainedProcessAsBackgroundCommandForTurn(services, ids) {
3423
3388
  turnId: fence.turnId,
3424
3389
  executionGeneration: fence.executionGeneration,
3425
3390
  attemptId: fence.attemptId,
3426
- processId: process2.id,
3391
+ processId: process.id,
3427
3392
  expected: retainedProcessSettlementIdentity(durable),
3428
3393
  command: "execCommand"
3429
3394
  });
@@ -3600,11 +3565,11 @@ function wrapTurnBoxWithRouting(services, ids, established) {
3600
3565
  ...services.onSandboxOperation ? { onOperation: services.onSandboxOperation } : {},
3601
3566
  providerCommandHandle: admittedCommandHandle,
3602
3567
  ...ids.workspaceMutationFence ? {
3603
- providerCommandPersistence: (process2) => retainedProviderCommandPersistence(db, {
3568
+ providerCommandPersistence: (process) => retainedProviderCommandPersistence(db, {
3604
3569
  accountId: ids.workspaceMutationFence.accountId,
3605
3570
  workspaceId: ids.workspaceId,
3606
3571
  sessionId: ids.sessionId,
3607
- processId: process2.id
3572
+ processId: process.id
3608
3573
  })
3609
3574
  } : {},
3610
3575
  ...beforeMutation ? { beforeMutation } : {},
@@ -3797,11 +3762,11 @@ function wrapLazyTurnBoxWithRouting(services, ids, args) {
3797
3762
  ...args.onFirstOperation ? { onFirstOperation: args.onFirstOperation } : {},
3798
3763
  providerCommandHandle: admittedCommandHandle,
3799
3764
  ...ids.workspaceMutationFence ? {
3800
- providerCommandPersistence: (process2) => retainedProviderCommandPersistence(db, {
3765
+ providerCommandPersistence: (process) => retainedProviderCommandPersistence(db, {
3801
3766
  accountId: ids.workspaceMutationFence.accountId,
3802
3767
  workspaceId: ids.workspaceId,
3803
3768
  sessionId: ids.sessionId,
3804
- processId: process2.id
3769
+ processId: process.id
3805
3770
  })
3806
3771
  } : {},
3807
3772
  ...beforeMutation ? { beforeMutation } : {},
@@ -4820,7 +4785,7 @@ import {
4820
4785
  classifyProviderSandboxFailure
4821
4786
  } from "@opengeni/runtime";
4822
4787
  import { CancelledFailure } from "@temporalio/activity";
4823
- import { randomUUID as randomUUID4 } from "crypto";
4788
+ import { randomUUID as randomUUID3 } from "crypto";
4824
4789
  var TurnOperationCancelledError = class extends Error {
4825
4790
  constructor(reason) {
4826
4791
  super("Turn operation was cancelled with its owning turn", {
@@ -5111,7 +5076,7 @@ function createTurnSandboxProvisioner(establish, options = {}) {
5111
5076
  return {
5112
5077
  get() {
5113
5078
  if (!memo) {
5114
- const provisionId = options.provisionIdFactory?.() ?? randomUUID4();
5079
+ const provisionId = options.provisionIdFactory?.() ?? randomUUID3();
5115
5080
  memo = (async () => {
5116
5081
  const startedAt = performance.now();
5117
5082
  throwIfTurnOperationCancelled(options.signal);
@@ -6676,8 +6641,10 @@ export {
6676
6641
  currentActivityContext,
6677
6642
  startActivityHeartbeat,
6678
6643
  nextStreamEvent,
6679
- persistWorkspaceArchiveCandidate,
6644
+ collectWorkspaceArchiveObjectKeys,
6680
6645
  putVersion1TarArchiveOrInline,
6646
+ deleteUnpublishedWorkspaceArchiveObject,
6647
+ deleteWorkspaceArchiveObjectKeys,
6681
6648
  sandboxLeaseHolderIdForAttempt,
6682
6649
  waitForWarmSnapshot,
6683
6650
  maybePersistWarmWorkspaceSnapshot,
@@ -6759,4 +6726,4 @@ export {
6759
6726
  codexUsageLimitFailurePayload,
6760
6727
  CODEX_USAGE_LIMIT_MAX_RESUME_MS
6761
6728
  };
6762
- //# sourceMappingURL=chunk-ZNIKZQMN.js.map
6729
+ //# sourceMappingURL=chunk-NNXLW6V7.js.map