@molecule/api-code-sandbox-flyio 1.0.7 → 1.0.9

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 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAUV,eAAe,EAEhB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAgC,MAAM,UAAU,CAAA;AAsBrE,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAEhG,OAAO,KAAK,EAEV,WAAW,EAUZ,MAAM,YAAY,CAAA;AAuyDnB;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,YAAY,EACrB,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,GACzB,eAAe,CAEjB"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAUV,eAAe,EAEhB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAgC,MAAM,UAAU,CAAA;AAsBrE,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAEhG,OAAO,KAAK,EAEV,WAAW,EAUZ,MAAM,YAAY,CAAA;AAmzDnB;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,YAAY,EACrB,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,GACzB,eAAe,CAEjB"}
package/dist/provider.js CHANGED
@@ -209,10 +209,16 @@ class FlyioSandboxProvider {
209
209
  * Builds the Fly Proxy service exposing a sandbox's preview port, or `undefined`
210
210
  * when public exposure is disabled.
211
211
  *
212
- * `autostop: 'suspend'` is the scale-to-zero behaviour this bond exists for:
213
- * Fly Proxy suspends the Machine when it goes idle and resumes it from its
214
- * memory snapshot on the next request, so an idle sandbox bills only for its
215
- * rootfs and volume.
212
+ * `autostart: true` wakes an idle (stopped or suspended) Machine on the next
213
+ * preview request. `autostop` defaults to `'off'` — NOT `'suspend'` — on
214
+ * purpose: Fly's autostop timer counts the PROXY service's idle time, and a
215
+ * sandbox spends its first minutes being provisioned over the exec API with no
216
+ * proxy traffic, so `'suspend'` cold-starts the Machine mid-scaffold (execs are
217
+ * not proxy traffic) and the scaffold's own temp state is lost. Idle-sleep is
218
+ * instead driven by the consumer's own per-tier hibernation loop, which calls
219
+ * `sleep()`/`hibernate()` — the same provider-agnostic mechanism the Docker
220
+ * bond relies on. An operator who wants Fly-native scale-to-zero can still opt
221
+ * in with `config.autostop: 'suspend'`.
216
222
  * @returns The service definition, or `undefined`.
217
223
  */
218
224
  previewService() {
@@ -226,7 +232,7 @@ class FlyioSandboxProvider {
226
232
  { port: 443, handlers: ['tls', 'http'] },
227
233
  ],
228
234
  autostart: true,
229
- autostop: this.config.autostop ?? 'suspend',
235
+ autostop: this.config.autostop ?? 'off',
230
236
  min_machines_running: 0,
231
237
  };
232
238
  }
@@ -1490,7 +1496,13 @@ class FlyioSandboxProvider {
1490
1496
  for await (const chunk of archive)
1491
1497
  parts.push(Buffer.from(chunk));
1492
1498
  const base64 = gzipSync(Buffer.concat(parts)).toString('base64');
1493
- const tmp = `/tmp/mol-import-${machineId}.tgz`;
1499
+ // The temp tar lives on the WORKSPACE VOLUME, not /tmp. The chunked
1500
+ // write and the extract are separate exec calls, and a Machine with
1501
+ // autostop=suspend can cold-start between them — which recreates the
1502
+ // rootfs from the image (wiping /tmp) while the ext4 volume at
1503
+ // /workspace persists. A /tmp temp file vanished mid-import; the volume
1504
+ // one survives.
1505
+ const tmp = `${WORKSPACE_PATH}/.mol-import-${machineId}.tgz`;
1494
1506
  const quotedTmp = shellQuote(tmp);
1495
1507
  const quotedPath = shellQuote(path);
1496
1508
  const failIfError = (result, step) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-code-sandbox-flyio",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Fly.io Machines (Firecracker microVM) code sandbox provider",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",