@moinulmoin/eden-runtime-cloudflare 0.7.2 → 0.7.4

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.
@@ -24341,6 +24341,9 @@ var EVE_HOST_CARRY_LIMITS = {
24341
24341
  maxBytes: 1024 * 1024 * 1024
24342
24342
  };
24343
24343
  var EVE_HOST_SNAPSHOT_MAX_ATTEMPTS = 3;
24344
+ function isMissingContainerSnapshot(error61) {
24345
+ return error61 instanceof Error && /Snapshot ".*" was not found/u.test(error61.message);
24346
+ }
24344
24347
  var EdenWorldDurableObject = class {
24345
24348
  core;
24346
24349
  constructor(ctx, env) {
@@ -24451,6 +24454,8 @@ var EveHostDurableContainer = class extends DurableObject {
24451
24454
  carryOutQueue = Promise.resolve();
24452
24455
  /** True only while the last start was fresh from `images.eve`, not a snapshot. */
24453
24456
  pendingCarryRestore = false;
24457
+ /** True while the current container start came from a stored snapshot. */
24458
+ startedFromSnapshot = false;
24454
24459
  /** Shared single-flight carry restore for the current container generation. */
24455
24460
  carryRestorePromise;
24456
24461
  envVars;
@@ -24534,8 +24539,16 @@ var EveHostDurableContainer = class extends DurableObject {
24534
24539
  this.monitorAttached = false;
24535
24540
  this.recordContainerStopped();
24536
24541
  },
24537
- () => {
24542
+ (error61) => {
24538
24543
  this.monitorAttached = false;
24544
+ if (this.startedFromSnapshot && isMissingContainerSnapshot(error61)) {
24545
+ this.startedFromSnapshot = false;
24546
+ console.error(
24547
+ "The Eve workspace snapshot no longer exists; starting from the image."
24548
+ );
24549
+ void this.ctx.storage.delete(EVE_HOST_CONTAINER_SNAPSHOT_KEY);
24550
+ return;
24551
+ }
24539
24552
  this.recordContainerStopped();
24540
24553
  }
24541
24554
  );
@@ -24604,6 +24617,7 @@ var EveHostDurableContainer = class extends DurableObject {
24604
24617
  entrypoint: EVE_HOST_ENTRYPOINT
24605
24618
  });
24606
24619
  this.pendingCarryRestore = snapshotId === void 0;
24620
+ this.startedFromSnapshot = snapshotId !== void 0;
24607
24621
  await this.ctx.storage.put(EVE_HOST_CONTAINER_STARTED_IMAGE_KEY, expectedImage);
24608
24622
  await this.registerLoopbackIntercept(runtime);
24609
24623
  this.attachMonitor(runtime);
@@ -24679,7 +24693,10 @@ var EveHostDurableContainer = class extends DurableObject {
24679
24693
  [
24680
24694
  "sh",
24681
24695
  "-c",
24682
- `cd ${EVE_HOST_SANDBOX_CARRY_SOURCE} && [ -d sessions ] && tar -czf - sessions || true`
24696
+ // No sessions directory exits 0 with no bytes (nothing to carry); a
24697
+ // tar failure must surface as a non-zero exit so the previous carry
24698
+ // is kept instead of being replaced by a partial archive.
24699
+ `if [ -d ${EVE_HOST_SANDBOX_CARRY_SOURCE}/sessions ]; then cd ${EVE_HOST_SANDBOX_CARRY_SOURCE} && tar -czf - sessions; fi`
24683
24700
  ],
24684
24701
  { stdout: "pipe", stderr: "pipe" }
24685
24702
  );
@@ -66,6 +66,8 @@ export declare class EveHostDurableContainer extends DurableObject<EveHostContai
66
66
  private carryOutQueue;
67
67
  /** True only while the last start was fresh from `images.eve`, not a snapshot. */
68
68
  private pendingCarryRestore;
69
+ /** True while the current container start came from a stored snapshot. */
70
+ private startedFromSnapshot;
69
71
  /** Shared single-flight carry restore for the current container generation. */
70
72
  private carryRestorePromise;
71
73
  private readonly envVars;
@@ -47,6 +47,12 @@ export const EVE_HOST_CARRY_LIMITS = {
47
47
  /** Snapshot attempts the alarm retries before destroying anyway so a stuck
48
48
  * snapshot path never keeps billing alive forever. */
49
49
  const EVE_HOST_SNAPSHOT_MAX_ATTEMPTS = 3;
50
+ /** Cloudflare rejects a start from a deleted snapshot through `monitor()`
51
+ * with `Snapshot "<id>" was not found.` (observed live 2026-10-22). */
52
+ function isMissingContainerSnapshot(error) {
53
+ return error instanceof Error &&
54
+ /Snapshot ".*" was not found/u.test(error.message);
55
+ }
50
56
  /** The deployment's single SQLite-backed Workflow World. */
51
57
  export class EdenWorldDurableObject {
52
58
  core;
@@ -192,6 +198,8 @@ export class EveHostDurableContainer extends DurableObject {
192
198
  carryOutQueue = Promise.resolve();
193
199
  /** True only while the last start was fresh from `images.eve`, not a snapshot. */
194
200
  pendingCarryRestore = false;
201
+ /** True while the current container start came from a stored snapshot. */
202
+ startedFromSnapshot = false;
195
203
  /** Shared single-flight carry restore for the current container generation. */
196
204
  carryRestorePromise;
197
205
  envVars;
@@ -274,8 +282,18 @@ export class EveHostDurableContainer extends DurableObject {
274
282
  runtime.monitor().then(() => {
275
283
  this.monitorAttached = false;
276
284
  this.recordContainerStopped();
277
- }, () => {
285
+ }, (error) => {
278
286
  this.monitorAttached = false;
287
+ if (this.startedFromSnapshot && isMissingContainerSnapshot(error)) {
288
+ // Cloudflare deletes a snapshot 30 days after it was created or
289
+ // last restored, and a start from it never runs. Forget it and keep
290
+ // the in-flight readiness attempt: its next start uses the image and
291
+ // restores the carried conversation files instead.
292
+ this.startedFromSnapshot = false;
293
+ console.error("The Eve workspace snapshot no longer exists; starting from the image.");
294
+ void this.ctx.storage.delete(EVE_HOST_CONTAINER_SNAPSHOT_KEY);
295
+ return;
296
+ }
279
297
  this.recordContainerStopped();
280
298
  });
281
299
  }
@@ -343,6 +361,7 @@ export class EveHostDurableContainer extends DurableObject {
343
361
  // pending. A start from the configured image (an update) has no sandbox
344
362
  // sessions yet; a same-image snapshot wake already contains them.
345
363
  this.pendingCarryRestore = snapshotId === undefined;
364
+ this.startedFromSnapshot = snapshotId !== undefined;
346
365
  // Both start sources run `expectedImage` (a snapshot is only restored
347
366
  // from that image).
348
367
  await this.ctx.storage.put(EVE_HOST_CONTAINER_STARTED_IMAGE_KEY, expectedImage);
@@ -421,7 +440,10 @@ export class EveHostDurableContainer extends DurableObject {
421
440
  const exec = await runtime.exec([
422
441
  "sh",
423
442
  "-c",
424
- `cd ${EVE_HOST_SANDBOX_CARRY_SOURCE} && [ -d sessions ] && tar -czf - sessions || true`,
443
+ // No sessions directory exits 0 with no bytes (nothing to carry); a
444
+ // tar failure must surface as a non-zero exit so the previous carry
445
+ // is kept instead of being replaced by a partial archive.
446
+ `if [ -d ${EVE_HOST_SANDBOX_CARRY_SOURCE}/sessions ]; then cd ${EVE_HOST_SANDBOX_CARRY_SOURCE} && tar -czf - sessions; fi`,
425
447
  ], { stdout: "pipe", stderr: "pipe" });
426
448
  const buffered = [];
427
449
  let bufferedBytes = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moinulmoin/eden-runtime-cloudflare",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Cloudflare Worker/Container host runtime for Eden's Eve deployments.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "NOTICE"
21
21
  ],
22
22
  "devDependencies": {
23
- "@moinulmoin/eden-world-cloudflare": "0.7.2",
23
+ "@moinulmoin/eden-world-cloudflare": "0.7.4",
24
24
  "@cloudflare/workers-types": "5.20261006.1"
25
25
  },
26
26
  "repository": {