@nimbus-sh/worker 0.1.2 → 0.1.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.
Files changed (160) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +6 -0
  3. package/README.md +2 -2
  4. package/dist/_shared/cache-stats.d.ts +1 -1
  5. package/dist/_shared/cache-stats.js +1 -1
  6. package/dist/_shared/exports-resolver.d.ts +0 -2
  7. package/dist/_shared/exports-resolver.d.ts.map +1 -1
  8. package/dist/_shared/exports-resolver.js +0 -2
  9. package/dist/_shared/session-router.d.ts +0 -1
  10. package/dist/_shared/session-router.d.ts.map +1 -1
  11. package/dist/_shared/session-router.js +0 -1
  12. package/dist/constants.d.ts.map +1 -1
  13. package/dist/constants.js +0 -1
  14. package/dist/facets/cirrus-real.d.ts +1 -1
  15. package/dist/facets/cirrus-real.js +1 -1
  16. package/dist/facets/manager.d.ts +0 -1
  17. package/dist/facets/manager.d.ts.map +1 -1
  18. package/dist/facets/manager.js +3 -15
  19. package/dist/facets/process.d.ts +2 -2
  20. package/dist/facets/process.js +2 -2
  21. package/dist/facets/vite-dev-server.d.ts +3 -3
  22. package/dist/facets/vite-dev-server.d.ts.map +1 -1
  23. package/dist/facets/vite-dev-server.js +6 -8
  24. package/dist/facets/wasm-swap-registry.d.ts +15 -21
  25. package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
  26. package/dist/facets/wasm-swap-registry.js +41 -54
  27. package/dist/facets/ws-terminal.d.ts +4 -5
  28. package/dist/facets/ws-terminal.d.ts.map +1 -1
  29. package/dist/facets/ws-terminal.js +7 -8
  30. package/dist/git/commands.d.ts.map +1 -1
  31. package/dist/git/commands.js +0 -1
  32. package/dist/git/network-facet.d.ts.map +1 -1
  33. package/dist/git/network-facet.js +0 -2
  34. package/dist/git-bundle.generated.d.ts +2 -3
  35. package/dist/git-bundle.generated.d.ts.map +1 -1
  36. package/dist/git-bundle.generated.js +3 -4
  37. package/dist/index.js +2 -2
  38. package/dist/loaders/child-process/spawn-facet.d.ts +7 -52
  39. package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -1
  40. package/dist/loaders/child-process/spawn-facet.js +7 -49
  41. package/dist/loaders/child-process/spawn-pool.d.ts +5 -44
  42. package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
  43. package/dist/loaders/child-process/spawn-pool.js +5 -44
  44. package/dist/loaders/fanout-pool.d.ts +18 -65
  45. package/dist/loaders/fanout-pool.d.ts.map +1 -1
  46. package/dist/loaders/fanout-pool.js +25 -87
  47. package/dist/loaders/generated-workers.d.ts +1 -2
  48. package/dist/loaders/generated-workers.d.ts.map +1 -1
  49. package/dist/loaders/generated-workers.js +5 -6
  50. package/dist/loaders/loader-pool.d.ts +1 -2
  51. package/dist/loaders/loader-pool.d.ts.map +1 -1
  52. package/dist/loaders/loader-pool.js +1 -1
  53. package/dist/loaders/npm-resolve-preamble.d.ts +4 -5
  54. package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
  55. package/dist/loaders/npm-resolve-preamble.js +14 -21
  56. package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -1
  57. package/dist/loaders/pre-bundle-preamble.js +0 -1
  58. package/dist/npm/cache.js +1 -1
  59. package/dist/npm/install-batch-facet.d.ts.map +1 -1
  60. package/dist/npm/install-batch-facet.js +7 -12
  61. package/dist/npm/installer.d.ts +5 -7
  62. package/dist/npm/installer.d.ts.map +1 -1
  63. package/dist/npm/installer.js +20 -101
  64. package/dist/npm/r2-cache.d.ts +17 -29
  65. package/dist/npm/r2-cache.d.ts.map +1 -1
  66. package/dist/npm/r2-cache.js +16 -27
  67. package/dist/npm/resolve-facet.d.ts +11 -17
  68. package/dist/npm/resolve-facet.d.ts.map +1 -1
  69. package/dist/npm/resolve-facet.js +14 -28
  70. package/dist/npm/resolve-one-facet.d.ts +10 -13
  71. package/dist/npm/resolve-one-facet.d.ts.map +1 -1
  72. package/dist/npm/resolve-one-facet.js +8 -10
  73. package/dist/npm/resolver.d.ts +0 -2
  74. package/dist/npm/resolver.d.ts.map +1 -1
  75. package/dist/npm/resolver.js +0 -12
  76. package/dist/observability/oom-discriminator.d.ts +0 -2
  77. package/dist/observability/oom-discriminator.d.ts.map +1 -1
  78. package/dist/observability/oom-discriminator.js +0 -2
  79. package/dist/replica/routing.js +1 -1
  80. package/dist/router/index.d.ts +1 -1
  81. package/dist/router/index.js +1 -1
  82. package/dist/runtime/barrel-synthesizer.js +1 -1
  83. package/dist/runtime/clang-runner.d.ts +5 -6
  84. package/dist/runtime/clang-runner.d.ts.map +1 -1
  85. package/dist/runtime/clang-runner.js +5 -6
  86. package/dist/runtime/esbuild-service.d.ts.map +1 -1
  87. package/dist/runtime/esbuild-service.js +0 -3
  88. package/dist/runtime/framework-detect.d.ts +0 -1
  89. package/dist/runtime/framework-detect.d.ts.map +1 -1
  90. package/dist/runtime/framework-detect.js +0 -1
  91. package/dist/runtime/node-runner.d.ts +1 -1
  92. package/dist/runtime/node-runner.js +1 -1
  93. package/dist/runtime/node-shims.d.ts.map +1 -1
  94. package/dist/runtime/node-shims.js +0 -22
  95. package/dist/runtime/package-manager.d.ts +2 -7
  96. package/dist/runtime/package-manager.d.ts.map +1 -1
  97. package/dist/runtime/package-manager.js +2 -7
  98. package/dist/runtime/process-logs-api.js +1 -1
  99. package/dist/runtime/process-logs.d.ts +0 -1
  100. package/dist/runtime/process-logs.d.ts.map +1 -1
  101. package/dist/runtime/process-table.d.ts +2 -2
  102. package/dist/runtime/process-table.d.ts.map +1 -1
  103. package/dist/runtime/process-table.js +1 -1
  104. package/dist/runtime/python-repl.d.ts +0 -1
  105. package/dist/runtime/python-repl.d.ts.map +1 -1
  106. package/dist/runtime/python-repl.js +0 -1
  107. package/dist/runtime/python-runner.d.ts +1 -2
  108. package/dist/runtime/python-runner.d.ts.map +1 -1
  109. package/dist/runtime/python-runner.js +1 -3
  110. package/dist/runtime/repl-session.d.ts +0 -1
  111. package/dist/runtime/repl-session.d.ts.map +1 -1
  112. package/dist/runtime/repl-session.js +1 -2
  113. package/dist/runtime/require-resolver.d.ts.map +1 -1
  114. package/dist/runtime/require-resolver.js +1 -4
  115. package/dist/runtime/ruby-runner.d.ts +0 -1
  116. package/dist/runtime/ruby-runner.d.ts.map +1 -1
  117. package/dist/runtime/ruby-runner.js +0 -1
  118. package/dist/runtime/runtime-catalog.d.ts +2 -4
  119. package/dist/runtime/runtime-catalog.d.ts.map +1 -1
  120. package/dist/runtime/runtime-catalog.js +2 -4
  121. package/dist/runtime/runtime-registry.d.ts +1 -1
  122. package/dist/runtime/runtime-registry.js +1 -1
  123. package/dist/runtime/streams.d.ts.map +1 -1
  124. package/dist/runtime/streams.js +0 -1
  125. package/dist/runtime/wasi-instance.d.ts +35 -45
  126. package/dist/runtime/wasi-instance.d.ts.map +1 -1
  127. package/dist/runtime/wasi-instance.js +87 -103
  128. package/dist/runtime/wasm-runner.d.ts +9 -15
  129. package/dist/runtime/wasm-runner.d.ts.map +1 -1
  130. package/dist/runtime/wasm-runner.js +23 -29
  131. package/dist/session/bindings.d.ts +2 -7
  132. package/dist/session/bindings.d.ts.map +1 -1
  133. package/dist/session/bindings.js +3 -8
  134. package/dist/session/helpers.d.ts +2 -9
  135. package/dist/session/helpers.d.ts.map +1 -1
  136. package/dist/session/helpers.js +2 -10
  137. package/dist/session/init.d.ts +3 -6
  138. package/dist/session/init.d.ts.map +1 -1
  139. package/dist/session/init.js +25 -30
  140. package/dist/session/nimbus-session.d.ts +1 -1
  141. package/dist/session/nimbus-session.js +5 -5
  142. package/dist/session/routes.d.ts.map +1 -1
  143. package/dist/session/routes.js +9 -16
  144. package/dist/session/rpc.d.ts +2 -2
  145. package/dist/session/rpc.js +6 -6
  146. package/dist/session/supervisor-rpc.d.ts +1 -2
  147. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  148. package/dist/session/supervisor-rpc.js +1 -5
  149. package/dist/shell/features.d.ts +5 -5
  150. package/dist/shell/features.js +6 -6
  151. package/dist/shell/unix-commands.js +15 -15
  152. package/dist/vfs/dev-provider.d.ts +1 -1
  153. package/dist/vfs/dev-provider.js +1 -1
  154. package/dist/vfs/sqlite-vfs.d.ts +3 -3
  155. package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
  156. package/dist/vfs/sqlite-vfs.js +10 -11
  157. package/package.json +12 -2
  158. package/public/s/index.html +44 -75
  159. package/scripts/bundle-facet-workers.mjs +1 -1
  160. package/scripts/bundle-git.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-runner.d.ts","sourceRoot":"","sources":["../../src/runtime/wasm-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAqD9E,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,eAAO,MAAM,gBAAgB,QA+BwC,CAAC;AAEtE;;;;;;;;;GASG;AACH,UAAU,OAAO;IACf,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5D,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,IAAI,E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OAAO,CAAC;IACb,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,kBAAkB,CAAC;IACxB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,WAAW,EAAE,mBAAmB,CAAC;CAClC,IAEG,WAAW,OAAO,EAClB,OAAO,MAAM,EACb,MAAM,cAAc,KACnB,OAAO,CAAC,gBAAgB,CAAC,CAgd7B"}
@@ -1,21 +1,15 @@
1
1
  /**
2
2
  * wasm-runner.ts — native-WASM runner via the LOADER-modules transport.
3
3
  *
4
- * Re-introduced after the multi-runtime wave's revert. The previous
5
- * version relied on direct `WebAssembly.instantiate(bytes)` at request
6
- * time — workerd's CSP blocks that path inside both the supervisor
7
- * and facet isolates (verified in the multi-runtime feasibility
8
- * memo). The new version routes through the LOADER's modules map:
4
+ * Direct `WebAssembly.instantiate(bytes)` is blocked by workerd CSP at
5
+ * request time in both the supervisor and facet isolates. This runner routes
6
+ * through the LOADER modules map:
9
7
  * bytes ride INSIDE the worker code blob, workerd compiles them
10
8
  * during the inner worker's MODULE-LOAD phase (the one phase where
11
9
  * wasm code generation IS allowed), and the resulting
12
10
  * WebAssembly.Module is exposed to the user fn via the
13
11
  * NimbusLoaderPool's `globalThis.__NIMBUS_WASM[<name>]` table.
14
12
  *
15
- * The validation that this works on the deployed Cloudflare fleet
16
- * lives at /workspace/.seal-internal/2026-05-10-wasm-csp/findings.md
17
- * (`add(3,4) === 7` returned in 11ms warm, 113ms cold).
18
- *
19
13
  * Shell command shape
20
14
  * ───────────────────
21
15
  *
@@ -45,16 +39,16 @@
45
39
  * - WASI imports are NOT provided. Modules expecting wasi_snapshot
46
40
  * won't instantiate (fail at the in-facet instantiate step).
47
41
  *
48
- * Anti-requirements
49
- * ─────────────────
50
- * - NO setTimeout / NO retry / NO defensive-catch in the dispatch
51
- * path. The pool's resilience options handle retries.
42
+ * Dispatch constraints
43
+ * ────────────────────
44
+ * - No sleeps, caller-side retries, or catch-and-continue around loader
45
+ * failures. The pool's resilience options own retry behavior.
52
46
  * - The try/catch around vfs.readFile is a legitimate I/O boundary;
53
47
  * the diagnostic propagates as exitCode 1 + stderr line.
54
48
  * - NO direct WebAssembly.instantiate(bytes) at request time —
55
- * that's the architectural mistake from the prior wave.
49
+ * workerd CSP rejects that path.
56
50
  */
57
- import { WASI_INSTANCE_PREAMBLE_SRC, WASI_WAVE1_FNS } from './wasi-instance.js';
51
+ import { WASI_INSTANCE_PREAMBLE_SRC, WASI_IMPLEMENTED_FNS } from './wasi-instance.js';
58
52
  export const WASM_RUNNER_VERSION = '0.3.0';
59
53
  export const WASM_RUNNER_HELP = 'Usage: wasm-runner [options] <file.wasm> [exportName] [int args...]\n' +
60
54
  ' wasm-runner --version\n' +
@@ -64,7 +58,7 @@ export const WASM_RUNNER_HELP = 'Usage: wasm-runner [options] <file.wasm> [expor
64
58
  'module\'s imports:\n' +
65
59
  '\n' +
66
60
  ' WASI mode (imports wasi_snapshot_preview1): invokes _start with a\n' +
67
- ' Wave-1 WASI shim. stdout/stderr stream to the Process tab.\n' +
61
+ ' core WASI WASI shim. stdout/stderr stream to the Process tab.\n' +
68
62
  ' exportName argument is optional; defaults to _start.\n' +
69
63
  ' Direct mode (no WASI imports): calls the named export with integer\n' +
70
64
  ' args and prints the return value.\n' +
@@ -80,10 +74,10 @@ export const WASM_RUNNER_HELP = 'Usage: wasm-runner [options] <file.wasm> [expor
80
74
  ' multi-arg-shapes need a wrapper module.\n' +
81
75
  ' - Only integer return values are surfaced.\n' +
82
76
  '\n' +
83
- 'Limitations (WASI mode, Wave-1):\n' +
84
- ' - 16 fns implemented: ' + WASI_WAVE1_FNS.join(', ') + '.\n' +
77
+ 'Limitations (WASI mode, core WASI):\n' +
78
+ ' - implemented imports: ' + WASI_IMPLEMENTED_FNS.join(', ') + '.\n' +
85
79
  ' - path_*, fd_readdir, fd_filestat_*, fd_pread, fd_pwrite, poll_oneoff,\n' +
86
- ' sock_* return ENOSYS (Wave-2 will add SqliteFS-backed paths).\n' +
80
+ ' sock_* return ENOSYS (filesystem WASI will add SqliteFS-backed paths).\n' +
87
81
  ' - fd 0 (stdin) returns EOF immediately.\n' +
88
82
  ' - Transport: bytes ship via the LOADER modules map, NOT\n' +
89
83
  ' WebAssembly.instantiate(bytes) at request time (CSP-blocked).';
@@ -155,8 +149,8 @@ function b64ToBytes(b64) {
155
149
  * filesystem into the facet isolate.
156
150
  *
157
151
  * Bounded by:
158
- * - 32 MiB total bytes (hard cap — bigger sessions need a per-call
159
- * RPC dispatch architecture; defer to Wave-3).
152
+ * - 32 MiB total bytes. Bigger sessions need a streaming or incremental
153
+ * filesystem transport instead of a single snapshot.
160
154
  * - 5000 file count.
161
155
  *
162
156
  * Returns null + a diagnostic if bounds are exceeded so the caller
@@ -271,7 +265,7 @@ function flushVfsDiff(vfs, diff) {
271
265
  }
272
266
  catch { }
273
267
  }
274
- // Stream-B B1+B3: count timesChanged / symlinks for diagnostics. The
268
+ // WASI socket and polling support B1+B3: count timesChanged / symlinks for diagnostics. The
275
269
  // current SqliteVFS doesn't expose utime() or symlink() on its public
276
270
  // surface, so we don't persist these across calls — they live only
277
271
  // within the call (mtimes are read back correctly via stat→filestat_get
@@ -411,7 +405,7 @@ export function makeWasmRunner(deps) {
411
405
  if (args.mode === 'wasi') {
412
406
  const mk = __wasiMakeImports;
413
407
  const runStart = __wasiRunStart;
414
- // Stream-B P3 / prod-verify-fix: bare lexical reference, matching
408
+ // WASI socket and polling support P3 / production compatibility fix: bare lexical reference, matching
415
409
  // the runStart pattern above. The earlier `(globalThis as any)
416
410
  // .__wasiRunStartAsync` lookup returned undefined at runtime
417
411
  // because top-level `function` declarations in the preamble's
@@ -419,12 +413,12 @@ export function makeWasmRunner(deps) {
419
413
  // was that sock_*/poll_oneoff (wrapped in WebAssembly.Suspending)
420
414
  // were invoked from a sync `_start` call stack → V8 trapped with
421
415
  // "trying to suspend without WebAssembly.promising". The 11
422
- // sync-only Stream-B probes worked because they never hit a
416
+ // sync-only WASI socket and polling support probes worked because they never hit a
423
417
  // Suspending import; the 7 async probes failed because they did.
424
418
  // The preamble is statically prepended to this same module body
425
419
  // (loader-pool.ts:523-530), so the symbol is guaranteed in
426
420
  // scope. typeof guard handles the impossible case of a preamble
427
- // pre-dating Stream-B (defensive only).
421
+ // pre-dating WASI socket and polling support (defensive only).
428
422
  const runStartAsync = typeof __wasiRunStartAsync === 'function'
429
423
  ? __wasiRunStartAsync
430
424
  : null;
@@ -490,11 +484,11 @@ export function makeWasmRunner(deps) {
490
484
  error: 'wasm module did not export a `memory` — WASI requires one.',
491
485
  };
492
486
  }
493
- // Stream-B P3: use async runStart when available so any
487
+ // WASI socket and polling support P3: use async runStart when available so any
494
488
  // suspending socket imports can complete via JSPI. The async
495
489
  // wrapper falls back to sync invocation internally when
496
490
  // WebAssembly.promising isn't available, so this is safe for
497
- // non-suspending programs too. Legacy preambles (pre-Stream-B)
491
+ // non-suspending programs too. Legacy preambles (pre-WASI socket and polling support)
498
492
  // that ship without __wasiRunStartAsync still work via the
499
493
  // sync runStart path.
500
494
  const r = runStartAsync
@@ -572,7 +566,7 @@ export function makeWasmRunner(deps) {
572
566
  // runtime-registry's RuntimeRunOpts carries env on the way in; we
573
567
  // forward to the WASI shim. Direct mode doesn't use env.
574
568
  const wasiEnv = isWasi ? (opts.env || {}) : {};
575
- // ── Wave-2: snapshot user's session VFS for WASI mode ──
569
+ // ── filesystem WASI: snapshot user's session VFS for WASI mode ──
576
570
  //
577
571
  // The user's cwd at invocation time is our session-root preopen
578
572
  // anchor. WASI programs see this as fd 3 mapped to '/'. We
@@ -623,7 +617,7 @@ export function makeWasmRunner(deps) {
623
617
  catch (e) {
624
618
  outcome = { ok: false, error: `dispatch failed: ${e?.message || e}` };
625
619
  }
626
- // ── Wave-2: flush mutated FS state back into SqliteFS ──
620
+ // ── filesystem WASI: flush mutated FS state back into SqliteFS ──
627
621
  if (outcome.mode === 'wasi' && outcome.ok && outcome.fsDiff) {
628
622
  try {
629
623
  flushVfsDiff(deps.vfs, outcome.fsDiff);
@@ -13,17 +13,12 @@
13
13
  * The shims have NO interaction with NimbusSession internals except
14
14
  * through that RPC stub. Co-located here for grep-ability.
15
15
  *
16
- * Originally lines 4934-5341 of pre-Phase-1 src/nimbus-session.ts (before
17
- * any refactor commits); lines 4513-4957 in the post-S1 source.
18
- * Per audit/sections/SESSION-REFACTOR-PLAN.md §B.3.9 + S2.
19
- *
20
16
  * Exports re-shipped from nimbus-session.ts so existing import paths work:
21
17
  * NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker,
22
18
  * NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub.
23
19
  *
24
- * **Bundle-graph note** (per plan §B.4 + §VI.9): these classes MUST remain
25
- * reachable from `src/index.ts`'s entry graph for wrangler to bundle them.
26
- * The re-export hub in nimbus-session.ts preserves that linkage.
20
+ * Bundle-graph note: these classes must remain reachable from `src/index.ts`
21
+ * for Wrangler to bundle the WorkerEntrypoint exports.
27
22
  */
28
23
  import { WorkerEntrypoint } from 'cloudflare:workers';
29
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/session/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAiBtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAgB,SAAQ,gBAAgB;IACnD;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAmDjD;AA0HD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAMhG;AAiBD,kEAAkE;AAClE,qBAAa,eAAgB,SAAQ,gBAAgB;IACnD,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC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AYrB;AAED;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IAChD;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAgCjD"}
@@ -13,17 +13,12 @@
13
13
  * The shims have NO interaction with NimbusSession internals except
14
14
  * through that RPC stub. Co-located here for grep-ability.
15
15
  *
16
- * Originally lines 4934-5341 of pre-Phase-1 src/nimbus-session.ts (before
17
- * any refactor commits); lines 4513-4957 in the post-S1 source.
18
- * Per audit/sections/SESSION-REFACTOR-PLAN.md §B.3.9 + S2.
19
- *
20
16
  * Exports re-shipped from nimbus-session.ts so existing import paths work:
21
17
  * NimbusAssetsRPC, NimbusLoaderRPC, NimbusLoadedWorker,
22
18
  * NimbusLoadedEntrypoint, NimbusDurableObjectNamespace, NimbusDOStub.
23
19
  *
24
- * **Bundle-graph note** (per plan §B.4 + §VI.9): these classes MUST remain
25
- * reachable from `src/index.ts`'s entry graph for wrangler to bundle them.
26
- * The re-export hub in nimbus-session.ts preserves that linkage.
20
+ * Bundle-graph note: these classes must remain reachable from `src/index.ts`
21
+ * for Wrangler to bundle the WorkerEntrypoint exports.
27
22
  */
28
23
  import { WorkerEntrypoint } from 'cloudflare:workers';
29
24
  // ── Inner-Worker loopback bindings ────────────────────────────────────
@@ -183,7 +178,7 @@ function mimeTypeForPath(path) {
183
178
  * request re-load the worker in its own context via env.LOADER.get(id)
184
179
  * — workerd caches by id so repeated loads are essentially free.
185
180
  *
186
- * H7 (heap-correctness wave). The pre-fix comment said "GC isn't
181
+ * H7 (memory accounting cleanup). The pre-fix comment said "GC isn't
187
182
  * needed" because "inner stubs that reference them die with the DO."
188
183
  * That was true for STUBS but FALSE for these CODE entries: nothing
189
184
  * deletes them. `wrangler dev`'s rebuild-on-save loop calls load()
@@ -1,14 +1,8 @@
1
1
  /**
2
2
  * session/helpers.ts — pure helpers used by the supervisor.
3
3
  *
4
- * All functions here are pure (no class state, no
5
- * `cloudflare:workers` import), so they can be unit-tested with bun
6
- * test without a workerd harness. The cleanup-and-readme reorg moved
7
- * them here from src/nimbus-session.ts (originally lines 96-523).
8
- *
9
- * audit/sections/SESSION-REFACTOR-PLAN.md §B.3.2 + S1.
10
- *
11
- * Re-exported by nimbus-session.ts so existing imports keep working.
4
+ * All functions here are pure: no class state and no `cloudflare:workers`
5
+ * import. NimbusSession re-exports the public helpers that callers need.
12
6
  */
13
7
  import type { SqliteVFS } from '../vfs/sqlite-vfs.js';
14
8
  /**
@@ -105,7 +99,6 @@ export declare function detectUnsupportedWranglerConfig(vfs: SqliteVFS, root: st
105
99
  /**
106
100
  * W8: classify a child_process spawn target by execution kind. Used by
107
101
  * the FacetProcessManager to decide between inline pure-builtin vs
108
- * facet-direct dispatch. See audit/sections/W8-plan.md §8.5 BLOCKER-2.
109
102
  *
110
103
  * pure-builtin — sync, no facet recursion. echo, cat, true, false,
111
104
  * ls, cd, env, sleep, mkdir, rm, … (all the unix
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/session/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;CAC9B,GAAG,MAAM,CAiHT;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,UAehC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAI5F,CAAC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AAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAiBxC"}
@@ -1,14 +1,8 @@
1
1
  /**
2
2
  * session/helpers.ts — pure helpers used by the supervisor.
3
3
  *
4
- * All functions here are pure (no class state, no
5
- * `cloudflare:workers` import), so they can be unit-tested with bun
6
- * test without a workerd harness. The cleanup-and-readme reorg moved
7
- * them here from src/nimbus-session.ts (originally lines 96-523).
8
- *
9
- * audit/sections/SESSION-REFACTOR-PLAN.md §B.3.2 + S1.
10
- *
11
- * Re-exported by nimbus-session.ts so existing imports keep working.
4
+ * All functions here are pure: no class state and no `cloudflare:workers`
5
+ * import. NimbusSession re-exports the public helpers that callers need.
12
6
  */
13
7
  /**
14
8
  * Render a polished "no dev server" placeholder HTML page for the /preview/
@@ -352,7 +346,6 @@ export function detectUnsupportedWranglerConfig(vfs, root) {
352
346
  /**
353
347
  * W8: classify a child_process spawn target by execution kind. Used by
354
348
  * the FacetProcessManager to decide between inline pure-builtin vs
355
- * facet-direct dispatch. See audit/sections/W8-plan.md §8.5 BLOCKER-2.
356
349
  *
357
350
  * pure-builtin — sync, no facet recursion. echo, cat, true, false,
358
351
  * ls, cd, env, sleep, mkdir, rm, … (all the unix
@@ -369,7 +362,6 @@ export const _CP_FACET_DIRECT = new Set([
369
362
  'vite', 'tsc', 'esbuild', 'rollup', 'webpack',
370
363
  // W11: framework CLIs — bare-name dispatch must reach a Node isolate
371
364
  // for npm-run-dev / direct-shell invocations to work. See
372
- // audit/sections/W11-plan.md §5 + reviewer comment 2.
373
365
  'astro', 'nuxt', 'nuxi', 'remix', 'svelte-kit', 'next',
374
366
  ]);
375
367
  export const _CP_PURE_BUILTIN = new Set([
@@ -16,11 +16,9 @@
16
16
  * 3. setPhase('online') if (cold)
17
17
  * 4. self._b4Phase = 'hydrated'
18
18
  *
19
- * Extracted from src/nimbus-session.ts during the SESSION-REFACTOR
20
- * (audit/sections/SESSION-REFACTOR-PLAN.md §B.3.8 + S6) so the DO
21
- * class itself stays small. Imports `self: InitHost` (a narrow view
22
- * of SessionInternal + readonly ctx/env) which gives the compiler
23
- * enough type info without the surface area of the full DO class.
19
+ * `self` is typed as InitHost, a narrow view of SessionInternal plus readonly
20
+ * ctx/env, so this module can use the session internals it owns without
21
+ * depending on the full Durable Object class surface.
24
22
  *
25
23
  * Imports and class delegators on NimbusSession preserve back-compat:
26
24
  * - acceptShellWebSocket → self.initSession(ws) (S7 will extract).
@@ -30,7 +28,6 @@ import type { SessionInternal } from './internal.js';
30
28
  /**
31
29
  * `initSession` reads `this.ctx` and `this.env` extensively (~14 sites).
32
30
  * Both are `protected` on the parent `CloudflareDurableObject` class
33
- * (DEFECT-D1, see audit/sessions/session-refactor-build-progress.md).
34
31
  * The pragmatic shape for THIS module: extend SessionInternal with
35
32
  * `ctx`/`env` as `any` and have the class delegator cast `this as
36
33
  * unknown as InitHost`. Other sibling modules (-rpc, -ws, -hib,
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/session/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA8DH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;GASG;AACH,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC;AAG3E,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,CAk8G/D"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/session/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA8DH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;GAQG;AACH,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC;AAG3E,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,CA+7G/D"}
@@ -16,11 +16,9 @@
16
16
  * 3. setPhase('online') if (cold)
17
17
  * 4. self._b4Phase = 'hydrated'
18
18
  *
19
- * Extracted from src/nimbus-session.ts during the SESSION-REFACTOR
20
- * (audit/sections/SESSION-REFACTOR-PLAN.md §B.3.8 + S6) so the DO
21
- * class itself stays small. Imports `self: InitHost` (a narrow view
22
- * of SessionInternal + readonly ctx/env) which gives the compiler
23
- * enough type info without the surface area of the full DO class.
19
+ * `self` is typed as InitHost, a narrow view of SessionInternal plus readonly
20
+ * ctx/env, so this module can use the session internals it owns without
21
+ * depending on the full Durable Object class surface.
24
22
  *
25
23
  * Imports and class delegators on NimbusSession preserve back-compat:
26
24
  * - acceptShellWebSocket → self.initSession(ws) (S7 will extract).
@@ -152,7 +150,7 @@ export function initSession(self, ws) {
152
150
  persistKernelMounts(self.ctx, mountPoints);
153
151
  }
154
152
  catch { /* fail-soft */ }
155
- // BUG-SWEEP-R3-1 (2026-05-11): mount a virtual /dev provider.
153
+ // shell compatibility (2026-05-11): mount a virtual /dev provider.
156
154
  // Pre-fix `cmd > /dev/null` and `cmd 2>/dev/null` errored with
157
155
  // `ENOENT: '/dev': no such file or directory`. This provider
158
156
  // synthesizes /dev/null, /dev/zero, /dev/random, /dev/urandom,
@@ -192,7 +190,7 @@ export function initSession(self, ws) {
192
190
  const kernel = self.kernel;
193
191
  const sqliteFs = self.sqliteFs;
194
192
  const facetMgr = self.facetManager;
195
- // ── monaco-wave-a (2026-05-13): editor-pane fs bridge ──
193
+ // ── editor/monaco (2026-05-13): editor-pane fs bridge ──
196
194
  //
197
195
  // The terminal hosts the WS that the editor pane reuses for
198
196
  // fs-read / fs-write / fs-list messages. We install the handler
@@ -325,14 +323,14 @@ export function initSession(self, ws) {
325
323
  });
326
324
  }
327
325
  });
328
- // ── True-OS Wave-3 v1.1: ./<wasm-binary> shell-side dispatch ──
326
+ // ── runtime package manager v1.1: ./<wasm-binary> shell-side dispatch ──
329
327
  // When the user invokes `./hello` (or any `./X` / `/abs/X`)
330
328
  // shell-form path and the file:
331
329
  // (a) exists in SqliteFS at that relative-to-cwd path, AND
332
330
  // (b) starts with the wasm magic bytes `\0asm\1\0\0\0`
333
331
  // we route the invocation to the wasm-runner command with the
334
332
  // user's args. This is how `clang t.c -o hello && ./hello`
335
- // closes the True-OS demo: the linker emits a wasm executable,
333
+ // closes the runtime substrate demo: the linker emits a wasm executable,
336
334
  // and the shell knows to run it via the WASI shim.
337
335
  //
338
336
  // Implementation: monkey-patch registry.resolve. If the standard
@@ -434,7 +432,7 @@ export function initSession(self, ws) {
434
432
  // ctx + env are passed for clone/fetch/pull which run in a facet to avoid
435
433
  // exhausting the supervisor DO's CPU budget on large repos.
436
434
  registerGitCommands(registry, sqliteFs, self.ctx, self.env);
437
- // ── True-OS Wave-3: `nimbus install` package manager + runner registry.
435
+ // ── runtime package manager: `nimbus install` package manager + runner registry.
438
436
  //
439
437
  // 1. Register the clang-runner factory FIRST so the rehydration step
440
438
  // below can re-bind `clang` / `wasm-ld` from an already-installed
@@ -490,7 +488,6 @@ export function initSession(self, ws) {
490
488
  // bootstrap runs at child-facet module-init time, per-call
491
489
  // __rubyRun drives rb-eval-string-protect with a wrapper that
492
490
  // catches SystemExit. See src/runtime/ruby-runner.ts +
493
- // /workspace/.seal-internal/2026-05-11-ruby-v1/audit.md.
494
491
  //
495
492
  // REPL Stream A: wrap the one-shot factory so `ruby` with NO args
496
493
  // drops into an interactive REPL. The wrap is purely additive —
@@ -553,7 +550,7 @@ export function initSession(self, ws) {
553
550
  // Parses args, reads script from VFS, delegates to FacetManager.
554
551
  // The facet creates a dynamic worker where new Function() is allowed
555
552
  // during module startup.
556
- // ── node command (multi-runtime wave: refactored to use runtime-registry) ──
553
+ // ── node command (runtime registry refactor: refactored to use runtime-registry) ──
557
554
  //
558
555
  // Behaviour preserved exactly:
559
556
  // - primitive #1 nodeFlagSpan (--version/-v/-h scan only flags
@@ -606,7 +603,7 @@ export function initSession(self, ws) {
606
603
  return await oneShotNode(ctx);
607
604
  });
608
605
  }
609
- // ── bun command (multi-runtime wave: refactored to use runtime-registry) ──
606
+ // ── bun command (runtime registry refactor: refactored to use runtime-registry) ──
610
607
  //
611
608
  // Behaviour preserved exactly:
612
609
  // - --version / --help
@@ -721,12 +718,11 @@ export function initSession(self, ws) {
721
718
  }
722
719
  // ── wasm-runner: native WebAssembly runtime via LOADER-modules transport ──
723
720
  //
724
- // Re-introduced after the multi-runtime wave's revert. Bytes
721
+ // Re-introduced after the runtime registry refactor's revert. Bytes
725
722
  // ride INSIDE the worker code blob (LOADER's modules map, the
726
723
  // one phase where wasm code generation IS allowed); request-time
727
724
  // WebAssembly.instantiate(bytes) is CSP-blocked and avoided.
728
725
  //
729
- // Validated transport: /workspace/.seal-internal/2026-05-10-
730
726
  // wasm-csp/findings.md — add(3,4)===7 in 11ms warm against the
731
727
  // deployed Cloudflare fleet.
732
728
  //
@@ -738,7 +734,7 @@ export function initSession(self, ws) {
738
734
  version: WASM_RUNNER_VERSION,
739
735
  helpText: WASM_RUNNER_HELP,
740
736
  run: makeWasmRunner({
741
- // Wave-2: extended VFS surface for WASI file-IO. The wasm-runner
737
+ // filesystem WASI: extended VFS surface for WASI file-IO. The wasm-runner
742
738
  // snapshots a session subtree into the facet, flushes the diff
743
739
  // back via this surface after _start returns.
744
740
  vfs: {
@@ -1153,7 +1149,7 @@ export function initSession(self, ws) {
1153
1149
  if (self.viteDevServer?.isRunning)
1154
1150
  self.viteDevServer.stop();
1155
1151
  const previewBasePath = self.viteBasePath;
1156
- // Primitives wave (P5/P8): same long-running treatment as the
1152
+ // process metadata support: same long-running treatment as the
1157
1153
  // dev path, just on the dist/ directory.
1158
1154
  const previewPort = viteConfig.port || 4173; // vite preview default
1159
1155
  const previewProcEntry = self.processTable.spawn('vite preview (' + distRoot + ')', [], distRoot);
@@ -1529,7 +1525,7 @@ export function initSession(self, ws) {
1529
1525
  basePath: previewBasePath,
1530
1526
  env: self.env,
1531
1527
  ctx: self.ctx,
1532
- // Primitives wave (P8): wire dev-server diagnostics into the
1528
+ // process diagnostics support: wire dev-server diagnostics into the
1533
1529
  // supervisor's per-PID log store so the Process tab is no
1534
1530
  // longer silent after the banner.
1535
1531
  pid: viteProcEntry.pid,
@@ -1708,7 +1704,7 @@ export function initSession(self, ws) {
1708
1704
  return 1;
1709
1705
  }
1710
1706
  const cfg = self.nimbusWrangler.stats;
1711
- // Primitives wave (P5): banner advertises the canonical
1707
+ // runtime primitive support (P5): banner advertises the canonical
1712
1708
  // `/__nimbus/worker/` route. The legacy `/worker/` URL is still
1713
1709
  // accepted for one release (Sunset 2027-01-01) but new sessions
1714
1710
  // are pointed at the namespaced form.
@@ -1778,7 +1774,7 @@ export function initSession(self, ws) {
1778
1774
  // never sets explicitly), persisted overlays whatever the user
1779
1775
  // did set (NIMBUS_TEST=cool, etc.).
1780
1776
  //
1781
- // Primitive #7 (primitives-extension wave): PORT/HOST and
1777
+ // Primitive #7 (runtime primitive support): PORT/HOST and
1782
1778
  // NIMBUS_SESSION_ID are part of the standard contract.
1783
1779
  //
1784
1780
  // PORT=3000 — the same default Markflow's `${PORT:-3000}` shell
@@ -2204,23 +2200,23 @@ export function initSession(self, ws) {
2204
2200
  // `<&0` etc before lifo-sh's parser chokes on them. Stdout and
2205
2201
  // stderr share the terminal sink so these are no-ops anyway. ──
2206
2202
  FdRedirectNormalizer.install(self.shell);
2207
- // ── Brace expansion (BUG-SWEEP-R3-3) — `ls *.{js,ts}` etc.
2203
+ // ── Brace expansion (shell compatibility) — `ls *.{js,ts}` etc.
2208
2204
  // Runs BEFORE subshell / dollar / fd-redirect so token expansion
2209
2205
  // happens before downstream parsing. lifo-sh's executeLine chain
2210
2206
  // invokes wrappers most-recently-installed-first; since we install
2211
2207
  // BraceExpander AFTER FdRedirectNormalizer, it wraps FdRedirect
2212
2208
  // and runs first. Same pattern for the others below.
2213
2209
  BraceExpander.install(self.shell);
2214
- // ── $$ / $0 expansion (BUG-SWEEP-R3-4) — lifo-sh doesn't expand
2210
+ // ── $$ / $0 expansion (shell compatibility) — lifo-sh doesn't expand
2215
2211
  // these special vars. We rewrite before lifo-sh's parser sees
2216
2212
  // the line.
2217
2213
  DollarVarShim.install(self.shell);
2218
- // ── Subshell `(...)` (BUG-SWEEP-R3-2) — lifo-sh's parser rejects.
2214
+ // ── Subshell `(...)` (shell compatibility) — lifo-sh's parser rejects.
2219
2215
  // Strip outer parens for bare subshells and run inner commands
2220
2216
  // with cwd/env save-restore. Chained / piped cases fall through
2221
2217
  // to orig (still errors but with clearer surface).
2222
2218
  SubshellNormalizer.install(self.shell);
2223
- // ── Backtick `\`cmd\`` (BUG-SWEEP-R4-4) — rewrite to $(cmd) so
2219
+ // ── Backtick `\`cmd\`` (shell compatibility) — rewrite to $(cmd) so
2224
2220
  // lifo-sh's existing $(...) machinery handles it. Quote-aware.
2225
2221
  BacktickNormalizer.install(self.shell);
2226
2222
  // ── BUG-SWEEP-4: echo -n / -e flag override ─────────────────────
@@ -2296,7 +2292,7 @@ export function initSession(self, ws) {
2296
2292
  t.write(suppressNewline ? out : out + '\n');
2297
2293
  return 0;
2298
2294
  });
2299
- // BUG-SWEEP-R4-1 (2026-05-11): `unset VAR` doesn't actually
2295
+ // shell compatibility (2026-05-11): `unset VAR` doesn't actually
2300
2296
  // unset on prod. lifo-sh's executeSimpleCommand passes a
2301
2297
  // COPY of shell.env (env: {...this.config.env}); our
2302
2298
  // registered mkUnset only mutates the copy. Override the
@@ -2313,7 +2309,7 @@ export function initSession(self, ws) {
2313
2309
  }
2314
2310
  return 0;
2315
2311
  });
2316
- // BUG-SWEEP-R4-1b: `export VAR=val` similarly needs to mutate
2312
+ // shell compatibilityb: `export VAR=val` similarly needs to mutate
2317
2313
  // shell.env (not just ctx.env). lifo-sh has its own builtinExport
2318
2314
  // (node_modules/@lifo-sh/core/dist/index-Djm2onjx.js:builtinExport)
2319
2315
  // that DOES mutate this.env correctly. Verify by re-checking
@@ -2419,7 +2415,7 @@ export function initSession(self, ws) {
2419
2415
  }
2420
2416
  return exitCode;
2421
2417
  };
2422
- // ── Primitive #2 (primitives-extension wave): generic .bin handler ──
2418
+ // ── Primitive #2 (runtime primitive support): generic .bin handler ──
2423
2419
  //
2424
2420
  // Direct terminal invocation of `<bincmd> [args]` (e.g. `tsc --version`,
2425
2421
  // `prettier --check .`, `eslint .`) used to fall through to "command
@@ -2761,7 +2757,7 @@ export function initSession(self, ws) {
2761
2757
  ctx.stdout.write(`> ${script}\n\n`);
2762
2758
  // ── Next.js loud-block (was W11 per-framework substrate) ──────
2763
2759
  //
2764
- // Primitives wave (P12): the previous wave shipped this as a
2760
+ // runtime primitive support (P12): the previous wave shipped this as a
2765
2761
  // 45-line standalone module at src/frameworks/next.ts that
2766
2762
  // exported nothing but the strings used here. Per the
2767
2763
  // "no per-framework substrate" rule, the message is inlined
@@ -3392,7 +3388,7 @@ export function initSession(self, ws) {
3392
3388
  ctx.stderr.write('kill: invalid pid\n');
3393
3389
  return 1;
3394
3390
  }
3395
- // Primitives wave (P11): if the target is the vite shim PID
3391
+ // runtime primitive support (P11): if the target is the vite shim PID
3396
3392
  // (registered by P5's long-running spawn), tear down the
3397
3393
  // in-process viteDevServer / cirrusReal too — facetManager.kill
3398
3394
  // only handles real Worker-Loader facets, and would leave the
@@ -3526,7 +3522,6 @@ export function initSession(self, ws) {
3526
3522
  //
3527
3523
  // C'.2 recovery_event ring entry — every initSession call records
3528
3524
  // either a cold→hydrated (first connect) or drained→hydrated
3529
- // (silent re-init) transition. The probe at audit/probes/
3530
3525
  // interactive-liveness/error-recovery/ asserts both states show
3531
3526
  // dataLoss=false. Track B' guarantees this for in-isolate transitions;
3532
3527
  // a true cold-isolate boot reads no SQL row and shows
@@ -52,7 +52,7 @@ export declare class NimbusSession extends CloudflareDurableObject {
52
52
  esbuildService: EsbuildService | null;
53
53
  viteDevServer: ViteDevServer | null;
54
54
  /**
55
- * Primitives wave (P5): PID + port the default-Cirrus vite shim is
55
+ * runtime primitive support (P5): PID + port the default-Cirrus vite shim is
56
56
  * registered under. Cleared on `vite stop`. See
57
57
  * `runtime/long-running-handle.ts` and the vite handler in
58
58
  * `session/init.ts`.
@@ -131,7 +131,7 @@ export class NimbusSession extends CloudflareDurableObject {
131
131
  esbuildService = null;
132
132
  viteDevServer = null;
133
133
  /**
134
- * Primitives wave (P5): PID + port the default-Cirrus vite shim is
134
+ * runtime primitive support (P5): PID + port the default-Cirrus vite shim is
135
135
  * registered under. Cleared on `vite stop`. See
136
136
  * `runtime/long-running-handle.ts` and the vite handler in
137
137
  * `session/init.ts`.
@@ -432,7 +432,7 @@ export class NimbusSession extends CloudflareDurableObject {
432
432
  async _rpcRegisterPort(pid, port) { return _rpc._rpcRegisterPort(this, pid, port); }
433
433
  async _rpcUnregisterPort(port) { return _rpc._rpcUnregisterPort(this, port); }
434
434
  async _rpcTransform(code, loader) { return _rpc._rpcTransform(this, code, loader); }
435
- // two-tier-fanout: peer-DO execute leg of NimbusFanoutPool's POC B topology.
435
+ // two-tier-fanout: peer-DO execute leg of NimbusFanoutPool's peer-DO fanout topology.
436
436
  async _rpcFanoutExecute(fnSource, args, poolOpts) {
437
437
  return _rpc._rpcFanoutExecute(this, fnSource, args, poolOpts);
438
438
  }
@@ -444,7 +444,7 @@ export class NimbusSession extends CloudflareDurableObject {
444
444
  async _rpcCpDrainOutput(childPid) { return _rpc._rpcCpDrainOutput(this, childPid); }
445
445
  async _rpcCpKill(childPid, signal) { return _rpc._rpcCpKill(this, childPid, signal); }
446
446
  async _rpcCpWait(childPid, waitMs) { return _rpc._rpcCpWait(this, childPid, waitMs); }
447
- // arch-gaps gap #1: per-spawn fresh-isolate dispatch.
447
+ // child-process isolation gap #1: per-spawn fresh-isolate dispatch.
448
448
  async _rpcCpDispatchInline(req, kind) { return _rpc._rpcCpDispatchInline(this, req, kind); }
449
449
  // Programmatic sandbox SDK RPC
450
450
  async _rpcReady(options) { return _programmatic.ensureProgrammaticReady(this, options); }
@@ -746,8 +746,8 @@ export class NimbusSession extends CloudflareDurableObject {
746
746
  }
747
747
  },
748
748
  };
749
- // arch-gaps gap #1: per-spawn fresh-isolate envelope. The pool wraps
750
- // NimbusFanoutPool — auto-routes <5 → POC C in-DO, ≥5 → POC B
749
+ // child-process isolation gap #1: per-spawn fresh-isolate envelope. The pool wraps
750
+ // NimbusFanoutPool — auto-routes <5 → in-DO fanout in-DO, ≥5 → peer-DO fanout
751
751
  // peer-DO. Hard-fails at construction if env.LOADER missing (no
752
752
  // fallback). The pool is constructed lazily on the same path that
753
753
  // builds FacetProcessManager so unit tests that don't supply
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/session/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA+BH,KAAK,UAAU,GAAG,GAAG,CAAC;AAEtB,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAi/BvF"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/session/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA+BH,KAAK,UAAU,GAAG,GAAG,CAAC;AAEtB,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0+BvF"}