@nimbus-sh/worker 0.2.3 → 0.4.0

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 (146) hide show
  1. package/dist/_shared/session-router.d.ts +8 -0
  2. package/dist/_shared/session-router.d.ts.map +1 -1
  3. package/dist/_shared/session-router.js +8 -0
  4. package/dist/esbuild-wasm-bundle.generated.d.ts +1 -1
  5. package/dist/esbuild-wasm-bundle.generated.js +1 -1
  6. package/dist/facets/cirrus-real.js +1 -1
  7. package/dist/facets/manager.d.ts +43 -129
  8. package/dist/facets/manager.d.ts.map +1 -1
  9. package/dist/facets/manager.js +107 -318
  10. package/dist/facets/opencode-staging.d.ts +1 -1
  11. package/dist/facets/opencode-staging.d.ts.map +1 -1
  12. package/dist/facets/opencode-staging.js +3 -0
  13. package/dist/facets/real-vite-hmr.js +1 -1
  14. package/dist/facets/vite-dev-server.d.ts +4 -4
  15. package/dist/facets/vite-dev-server.js +5 -5
  16. package/dist/git/commands.d.ts +8 -0
  17. package/dist/git/commands.d.ts.map +1 -1
  18. package/dist/git/commands.js +41 -9
  19. package/dist/git/network-facet.d.ts +1 -1
  20. package/dist/git/network-facet.d.ts.map +1 -1
  21. package/dist/git/network-facet.js +39 -15
  22. package/dist/git-bundle.generated.d.ts +2 -2
  23. package/dist/git-bundle.generated.d.ts.map +1 -1
  24. package/dist/git-bundle.generated.js +3 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +9 -1
  27. package/dist/loaders/child-process/spawn-facet.js +1 -1
  28. package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
  29. package/dist/loaders/child-process/spawn-pool.js +2 -2
  30. package/dist/loaders/generated-workers.d.ts +2 -2
  31. package/dist/loaders/generated-workers.d.ts.map +1 -1
  32. package/dist/loaders/generated-workers.js +3 -3
  33. package/dist/loaders/npm-resolve-preamble.d.ts +3 -3
  34. package/dist/loaders/npm-resolve-preamble.js +3 -3
  35. package/dist/loaders/pre-bundle-preamble.d.ts +5 -5
  36. package/dist/loaders/pre-bundle-preamble.js +6 -6
  37. package/dist/loaders/process-host.d.ts +6 -107
  38. package/dist/loaders/process-host.d.ts.map +1 -1
  39. package/dist/loaders/process-host.js +6 -405
  40. package/dist/npm/install-batch-facet.d.ts +1 -1
  41. package/dist/npm/install-batch-facet.js +1 -1
  42. package/dist/npm/installer.d.ts +6 -6
  43. package/dist/npm/installer.d.ts.map +1 -1
  44. package/dist/npm/installer.js +28 -27
  45. package/dist/npm/pre-bundle-facet.d.ts +2 -2
  46. package/dist/npm/pre-bundle-facet.js +5 -5
  47. package/dist/npm/r2-cache.d.ts +1 -1
  48. package/dist/npm/resolve-facet.d.ts +1 -1
  49. package/dist/npm/resolve-facet.js +1 -1
  50. package/dist/npm/resolve-one-facet.d.ts +5 -5
  51. package/dist/npm/resolve-one-facet.js +5 -5
  52. package/dist/router/index.js +2 -2
  53. package/dist/router/remote-api.js +9 -1
  54. package/dist/runtime/bun-repl.d.ts +1 -1
  55. package/dist/runtime/bun-repl.js +3 -3
  56. package/dist/runtime/esbuild-wasm-bytes.js +1 -1
  57. package/dist/runtime/facet-loader-host.d.ts +5 -8
  58. package/dist/runtime/facet-loader-host.d.ts.map +1 -1
  59. package/dist/runtime/facet-loader-host.js +7 -11
  60. package/dist/runtime/node-repl.js +2 -2
  61. package/dist/runtime/node-shims-artifact.js +1 -1
  62. package/dist/runtime/node-shims.js +2 -1
  63. package/dist/runtime/opencode-artifact.js +1 -1
  64. package/dist/runtime/opentui-wasm-bytes.js +1 -1
  65. package/dist/runtime/python-repl.js +3 -3
  66. package/dist/runtime/ruby-repl.js +2 -2
  67. package/dist/runtime/ruby-resident.js +1 -1
  68. package/dist/runtime/sqlite-wasm-bytes.js +1 -1
  69. package/dist/session/diag.js +1 -1
  70. package/dist/session/hibernation.d.ts +20 -53
  71. package/dist/session/hibernation.d.ts.map +1 -1
  72. package/dist/session/hibernation.js +57 -194
  73. package/dist/session/init-phases.d.ts +2 -3
  74. package/dist/session/init-phases.d.ts.map +1 -1
  75. package/dist/session/init-phases.js +3 -2
  76. package/dist/session/init.d.ts.map +1 -1
  77. package/dist/session/init.js +8 -4
  78. package/dist/session/keys.d.ts +14 -37
  79. package/dist/session/keys.d.ts.map +1 -1
  80. package/dist/session/keys.js +18 -37
  81. package/dist/session/nimbus-session.d.ts +10 -15
  82. package/dist/session/nimbus-session.d.ts.map +1 -1
  83. package/dist/session/nimbus-session.js +28 -31
  84. package/dist/session/port-capability.d.ts +43 -0
  85. package/dist/session/port-capability.d.ts.map +1 -0
  86. package/dist/session/port-capability.js +49 -0
  87. package/dist/session/programmatic.d.ts +39 -5
  88. package/dist/session/programmatic.d.ts.map +1 -1
  89. package/dist/session/programmatic.js +150 -19
  90. package/dist/session/routes.d.ts +2 -0
  91. package/dist/session/routes.d.ts.map +1 -1
  92. package/dist/session/routes.js +96 -20
  93. package/dist/session/rpc.d.ts +36 -9
  94. package/dist/session/rpc.d.ts.map +1 -1
  95. package/dist/session/rpc.js +84 -24
  96. package/dist/session/start-real-vite.d.ts.map +1 -1
  97. package/dist/session/start-real-vite.js +3 -1
  98. package/dist/session/state-store.d.ts +3 -2
  99. package/dist/session/state-store.d.ts.map +1 -1
  100. package/dist/session/state-store.js +3 -2
  101. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  102. package/dist/session/supervisor-rpc.js +7 -4
  103. package/dist/session/ws.d.ts +1 -3
  104. package/dist/session/ws.d.ts.map +1 -1
  105. package/dist/session/ws.js +4 -3
  106. package/dist/wrangler/nimbus-wrangler.js +1 -1
  107. package/package.json +4 -2
  108. package/scripts/bundle-esbuild-wasm.mjs +2 -2
  109. package/scripts/bundle-facet-workers.mjs +5 -7
  110. package/scripts/bundle-sqlite-wasm.mjs +1 -1
  111. package/dist/facets/inner-do-registry.d.ts +0 -41
  112. package/dist/facets/inner-do-registry.d.ts.map +0 -1
  113. package/dist/facets/inner-do-registry.js +0 -51
  114. package/dist/facets/launch-pacer.d.ts +0 -111
  115. package/dist/facets/launch-pacer.d.ts.map +0 -1
  116. package/dist/facets/launch-pacer.js +0 -130
  117. package/dist/loaders/fanout-pool.d.ts +0 -207
  118. package/dist/loaders/fanout-pool.d.ts.map +0 -1
  119. package/dist/loaders/fanout-pool.js +0 -363
  120. package/dist/loaders/loader-pool.d.ts +0 -294
  121. package/dist/loaders/loader-pool.d.ts.map +0 -1
  122. package/dist/loaders/loader-pool.js +0 -642
  123. package/dist/loaders/process-fabric.d.ts +0 -509
  124. package/dist/loaders/process-fabric.d.ts.map +0 -1
  125. package/dist/loaders/process-fabric.js +0 -360
  126. package/dist/loaders/vendor/errors.d.ts +0 -24
  127. package/dist/loaders/vendor/errors.d.ts.map +0 -1
  128. package/dist/loaders/vendor/errors.js +0 -46
  129. package/dist/loaders/vendor/serialize.d.ts +0 -3
  130. package/dist/loaders/vendor/serialize.d.ts.map +0 -1
  131. package/dist/loaders/vendor/serialize.js +0 -25
  132. package/dist/loaders/vendor/types.d.ts +0 -69
  133. package/dist/loaders/vendor/types.d.ts.map +0 -1
  134. package/dist/loaders/vendor/types.js +0 -4
  135. package/dist/loaders/workerd-facet-host.d.ts +0 -141
  136. package/dist/loaders/workerd-facet-host.d.ts.map +0 -1
  137. package/dist/loaders/workerd-facet-host.js +0 -284
  138. package/dist/session/bindings.d.ts +0 -209
  139. package/dist/session/bindings.d.ts.map +0 -1
  140. package/dist/session/bindings.js +0 -680
  141. package/dist/session/ctx-exports.d.ts +0 -16
  142. package/dist/session/ctx-exports.d.ts.map +0 -1
  143. package/dist/session/ctx-exports.js +0 -22
  144. package/dist/session/ws-hibernation-config.d.ts +0 -64
  145. package/dist/session/ws-hibernation-config.d.ts.map +0 -1
  146. package/dist/session/ws-hibernation-config.js +0 -89
@@ -27,21 +27,22 @@ import { packumentUrl } from './r2-cache.js';
27
27
  import { npmAddedLine, npmHttpCacheLine, npmHttpFetchLine, npmTitleLine, } from './npm-log.js';
28
28
  import { applySwaps, findRejects, lookupSwap, lookupReject, shouldSkipPackage, shouldWarnSkipTransitive, isOptionalNativeBinding, formatSwapNotice, RegistryRejectError, emitRegistryEvent, } from '../facets/wasm-swap-registry.js';
29
29
  import { resolvePackageEntry } from '@nimbus-sh/core/_shared/exports-resolver.js';
30
- import { encodeWriteBatchStream } from '@nimbus-sh/core/_shared/w7-frame.js';
31
- import { NimbusLoaderPool } from '../loaders/loader-pool.js';
32
- import { NimbusFanoutPool, IN_DO_THRESHOLD } from '../loaders/fanout-pool.js';
30
+ import { encodeWriteBatchStream } from '@nimbus-sh/platform/w7-frame.js';
31
+ import { IsolatePool } from '@nimbus-sh/fabric/isolate-pool.js';
32
+ import { Fanout, IN_DO_THRESHOLD } from '@nimbus-sh/fabric/fanout.js';
33
33
  import { TAR_STREAM_PREAMBLE, W7_FRAME_PREAMBLE } from '../loaders/generated-workers.js';
34
34
  import { installPackagesInFacet, } from './install-batch-facet.js';
35
- import { setInstallPhase, recordInstallFacetCounters, recordPreBundleSummary, recordR2RaceCounters, recordCacheStatEvents, readDiagCounters, } from '@nimbus-sh/core/observability/diag-counters.js';
36
- import { estimateSupervisorHeap } from '@nimbus-sh/core/observability/heap-estimate.js';
37
- import { describeError } from '@nimbus-sh/core/observability/oom-classify.js';
35
+ import { setInstallPhase, recordInstallFacetCounters, recordPreBundleSummary, recordR2RaceCounters, readDiagCounters, } from '@nimbus-sh/platform/diag-counters.js';
36
+ import { recordCacheStatEvents } from '@nimbus-sh/core/_shared/cache-stats.js';
37
+ import { estimateSupervisorHeap } from '@nimbus-sh/platform/heap-estimate.js';
38
+ import { describeError } from '@nimbus-sh/platform/oom-classify.js';
38
39
  import { resolveOnePackumentInFacet, } from './resolve-one-facet.js';
39
40
  import { NPM_RESOLVE_PREAMBLE } from '../loaders/npm-resolve-preamble.js';
40
41
  import { prebundleOne, buildSliceForSpecifierWithCap, externalsForSpecifier, } from './pre-bundle-facet.js';
41
42
  import { PRE_BUNDLE_PREAMBLE } from '../loaders/pre-bundle-preamble.js';
42
43
  import { fetchEsbuildWasmBytes } from '../runtime/esbuild-wasm-bytes.js';
43
- import { CHUNK_SIZE, PRE_BUNDLE_CONCURRENCY, PRE_BUNDLE_SLICE_CAP_BYTES, SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES, } from '@nimbus-sh/core/constants.js';
44
- import { acquireSupervisorAllocation } from '@nimbus-sh/core/observability/heavy-alloc-coord.js';
44
+ import { CHUNK_SIZE, PRE_BUNDLE_CONCURRENCY, PRE_BUNDLE_SLICE_CAP_BYTES, SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES, } from '@nimbus-sh/platform/limits.js';
45
+ import { acquireSupervisorAllocation } from '@nimbus-sh/platform/heavy-alloc-coord.js';
45
46
  import { countPackageFiles, BARREL_PKG_FILE_THRESHOLD, packageNameFromSpecifier } from '@nimbus-sh/core/runtime/barrel-detect.js';
46
47
  import { scanNamedImports, namedImportSignature, buildSyntheticEntry, buildScopedSliceForSynthetic, syntheticEntryPath, } from '../runtime/barrel-synthesizer.js';
47
48
  import { enc } from '@nimbus-sh/core/_shared/bytes.js';
@@ -146,7 +147,7 @@ export class NpmInstaller {
146
147
  phases['lock-check'] = Date.now() - phaseStart;
147
148
  // ── Phase 1: Resolve ──────────────────────────────────────────
148
149
  // Frontier-coordinator path. Each BFS layer dispatches to
149
- // NimbusFanoutPool.submitMany — width <5 in-DO (in-DO fanout),
150
+ // Fanout.submitMany — width <5 in-DO (in-DO fanout),
150
151
  // width ≥5 peer-DO (peer-DO fanout). Per-package task body is
151
152
  // self-contained (resolveOnePackumentInFacet), supervisor builds
152
153
  // layer N+1 from layer N's edges. Missing env.LOADER throws at
@@ -222,7 +223,7 @@ export class NpmInstaller {
222
223
  setInstallPhase('fetch');
223
224
  // Fetch + extract + write new packages.
224
225
  //
225
- // Single fetch path: one NimbusLoaderPool isolate (the batch facet)
226
+ // Single fetch path: one IsolatePool isolate (the batch facet)
226
227
  // runs the entire install. The facet streams tarballs through gunzip+tar
227
228
  // and coalesces package-owned paths into shared writeBatchStream waves;
228
229
  // every owner awaits each wave it contributed to.
@@ -419,7 +420,7 @@ export class NpmInstaller {
419
420
  /**
420
421
  * F-2 frontier-coordinator path. Replaces the single-resolve-facet
421
422
  * dispatch with a per-package fanout: each BFS layer becomes ONE
422
- * `NimbusFanoutPool.submitMany` call, layer N+1 builds from the
423
+ * `Fanout.submitMany` call, layer N+1 builds from the
423
424
  * resolved metadata of layer N.
424
425
  *
425
426
  * Topology auto-routes per layer:
@@ -486,7 +487,7 @@ export class NpmInstaller {
486
487
  const RESOLVE_PEER_CAP = 8;
487
488
  // F-2 fanout pool. One construction reused across every layer; the
488
489
  // pool is stateless across submitMany calls.
489
- const fanoutPool = new NimbusFanoutPool(this.env, this.ctx, {
490
+ const fanoutPool = new Fanout(this.env, this.ctx, {
490
491
  tag: 'npm-resolve-fanout',
491
492
  // 5 minutes per layer is generous; typical layers complete in
492
493
  // 1-3 s. Per-task this gates each packument fetch + R2 race.
@@ -561,8 +562,8 @@ export class NpmInstaller {
561
562
  };
562
563
  return { key: name, args: taskSpec };
563
564
  });
564
- // Dispatch the layer. NimbusFanoutPool routes:
565
- // <5 → in-DO fanout in-DO (NimbusLoaderPool), concurrency = layer.length (capped at 4)
565
+ // Dispatch the layer. Fanout routes:
566
+ // <5 → in-DO fanout in-DO (IsolatePool), concurrency = layer.length (capped at 4)
566
567
  // ≥5 → peer-DO fanout peer-DO, N peers = min(layer.length, 32)
567
568
  let results;
568
569
  const layerT0 = Date.now();
@@ -769,12 +770,12 @@ export class NpmInstaller {
769
770
  return { resolved, unresolved };
770
771
  }
771
772
  /**
772
- * Batch install via two-tier fan-out (NimbusFanoutPool).
773
+ * Batch install via two-tier fan-out (Fanout).
773
774
  *
774
775
  * Shard count is `min(specs.length, INSTALL_PEER_CAP)`, and the topology
775
776
  * follows from it:
776
777
  * shardCount < IN_DO_THRESHOLD (5) → in-DO fanout in-DO
777
- * 1 NimbusLoaderPool with concurrency = shardCount, capped at
778
+ * 1 IsolatePool with concurrency = shardCount, capped at
778
779
  * 4 by V8 invariant. Each shard is one facet running its own
779
780
  * installPackagesInFacet.
780
781
  * shardCount >= IN_DO_THRESHOLD → peer-DO fanout peer-DO
@@ -786,7 +787,7 @@ export class NpmInstaller {
786
787
  * `shard-${i}` task key deterministically (tests can predict
787
788
  * placement).
788
789
  *
789
- * Pre-fix lineage: this site previously ran ONE NimbusLoaderPool
790
+ * Pre-fix lineage: this site previously ran ONE IsolatePool
790
791
  * with concurrency=1, internal pLimit(3) — the explicit "collapses
791
792
  * what was 4 concurrent dynamic workers (pool.map slots) into 1"
792
793
  * Two-tier topology re-expands the fan-out without re-introducing
@@ -851,7 +852,7 @@ export class NpmInstaller {
851
852
  // Peer shards dispatch in bounded phases and each phase is a barrier, so
852
853
  // the phase profile is what distinguishes shard work from barrier count.
853
854
  const phaseProfile = [];
854
- const fanoutPool = new NimbusFanoutPool(this.env, this.ctx, {
855
+ const fanoutPool = new Fanout(this.env, this.ctx, {
855
856
  tag: 'npm-install-batch',
856
857
  // Whole-batch timeout. With per-shard parallelism of N=8 peer
857
858
  // DOs each running pLimit(3), Mossaic-class 456 packages
@@ -869,7 +870,7 @@ export class NpmInstaller {
869
870
  });
870
871
  const tasks = nonEmptyShards.map((shardSpecs, shardIdx) => ({
871
872
  // Stable-id router key. Same shardIdx → same peer DO across
872
- // runs. Tests can predict placement via NimbusFanoutPool's
873
+ // runs. Tests can predict placement via Fanout's
873
874
  // `peerSiblingId(key, peerCount)` helper.
874
875
  key: `shard-${shardIdx}`,
875
876
  args: { packages: shardSpecs, concurrency: 3 },
@@ -974,7 +975,7 @@ export class NpmInstaller {
974
975
  }
975
976
  catch (e) {
976
977
  // Final catch — preserved from the pre-fix shape so the error
977
- // log line shape stays consistent. NimbusFanoutPool's internal
978
+ // log line shape stays consistent. Fanout's internal
978
979
  // pools dispose themselves at the end of each submitMany call,
979
980
  // so no explicit dispose() is needed here.
980
981
  // The earlier inner-catch already logged + threw; if we reach
@@ -1304,7 +1305,7 @@ export class NpmInstaller {
1304
1305
  * JSX elements get rejected as "alien" — silent render failure.
1305
1306
  */
1306
1307
  async prebundleUsedModules(projDir, installed) {
1307
- // Pre-bundle now runs in NimbusLoaderPool isolates (src/pre-bundle-facet.ts);
1308
+ // Pre-bundle now runs in IsolatePool isolates (src/pre-bundle-facet.ts);
1308
1309
  // each facet ships its own bundled esbuild-wasm via the preamble. The
1309
1310
  // supervisor's EsbuildService is no longer on the bundle path — it
1310
1311
  // still serves the transform path (TS/JSX → JS) which is small and
@@ -1444,7 +1445,7 @@ export class NpmInstaller {
1444
1445
  // C'.1 deterministic estimator. process.memoryUsage() returns 0
1445
1446
  // for every field inside a Durable Object class context (only
1446
1447
  // dynamic-worker isolates under nodejs_compat get the real
1447
- // implementation — see src/observability/diag-counters.ts:4 and
1448
+ // implementation — see @nimbus-sh/platform/diag-counters.js:4 and
1448
1449
  // heap-estimate.ts:6). The previous "supervisor heap 0.0 MiB"
1449
1450
  // line was actively misleading: it printed every time, regardless
1450
1451
  // of what was actually in the heap, and could not be used to
@@ -1515,7 +1516,7 @@ export class NpmInstaller {
1515
1516
  // (where it should live). No supervisor-side caching — see
1516
1517
  // src/esbuild-wasm-bytes.ts for the full architectural rationale.
1517
1518
  //
1518
- // Bytes are shipped into each facet via NimbusLoaderPool's
1519
+ // Bytes are shipped into each facet via IsolatePool's
1519
1520
  // `wasmModules` option which workerd registers in the LOADER
1520
1521
  // `modules` map as `{ wasm: ArrayBuffer }`. Workerd compiles at
1521
1522
  // module-load (startup phase, where wasm code generation is
@@ -1562,12 +1563,12 @@ export class NpmInstaller {
1562
1563
  if (wasmBytes.byteLength > maxRetainedWasmBytes) {
1563
1564
  throw new RangeError(`pre-bundle wasm payload ${wasmBytes.byteLength} exceeds the ${maxRetainedWasmBytes}-byte retained budget`);
1564
1565
  }
1565
- // NimbusLoaderPool keeps the constructor-time module bytes until
1566
+ // IsolatePool keeps the constructor-time module bytes until
1566
1567
  // dispose(), so retain their exact credit rather than treating
1567
1568
  // construction as a handoff that immediately frees the ArrayBuffer.
1568
1569
  setupAllocation.shrinkTo(wasmBytes.byteLength);
1569
1570
  try {
1570
- pool = new NimbusLoaderPool(this.env, this.ctx, {
1571
+ pool = new IsolatePool(this.env, this.ctx, {
1571
1572
  concurrency: PRE_BUNDLE_CONCURRENCY,
1572
1573
  timeoutMs: 60_000,
1573
1574
  retries: 0,
@@ -1994,7 +1995,7 @@ export class NpmInstaller {
1994
1995
  /**
1995
1996
  * P5 (production reliability) — deterministic supervisor-heap estimate in MiB.
1996
1997
  *
1997
- * Routes through observability/heap-estimate.ts which sums KNOWN
1998
+ * Routes through @nimbus-sh/platform/heap-estimate.js which sums KNOWN
1998
1999
  * supervisor heap allocation sources from runtime counters that
1999
2000
  * ARE accurate inside a DO context (DiagCounters singleton +
2000
2001
  * SqliteVFS.getStats()). This replaces a previous use of
@@ -2035,7 +2036,7 @@ export class NpmInstaller {
2035
2036
  // process.memoryUsage() which returns 0 for every field inside a
2036
2037
  // Durable Object class context (only dynamic-worker isolates under
2037
2038
  // nodejs_compat get the real implementation — see
2038
- // src/observability/diag-counters.ts:4). The deterministic
2039
+ // @nimbus-sh/platform/diag-counters.js:4). The deterministic
2039
2040
  // supervisor-heap estimator is the C'.1 replacement; see
2040
2041
  // NpmInstaller._estimateSupervisorHeapMiB.
2041
2042
  function parentOf(path) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * pre-bundle-facet.ts — NimbusLoaderPool entry for esbuild pre-bundling.
2
+ * pre-bundle-facet.ts — IsolatePool entry for esbuild pre-bundling.
3
3
  *
4
4
  * Why this exists
5
5
  * ───────────────
@@ -14,7 +14,7 @@
14
14
  * the previous isolate.
15
15
  *
16
16
  * The fix is to dispatch each per-specifier `esbuild.build` to a
17
- * NimbusLoaderPool isolate. Each facet has its own 128 MB budget and
17
+ * IsolatePool isolate. Each facet has its own 128 MB budget and
18
18
  * stable-slot reuse keeps the warm-up cost amortized across the 8
19
19
  * concurrent specs of a typical install. The install-batch facet uses
20
20
  * the same isolate boundary for tarball extraction.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * pre-bundle-facet.ts — NimbusLoaderPool entry for esbuild pre-bundling.
2
+ * pre-bundle-facet.ts — IsolatePool entry for esbuild pre-bundling.
3
3
  *
4
4
  * Why this exists
5
5
  * ───────────────
@@ -14,7 +14,7 @@
14
14
  * the previous isolate.
15
15
  *
16
16
  * The fix is to dispatch each per-specifier `esbuild.build` to a
17
- * NimbusLoaderPool isolate. Each facet has its own 128 MB budget and
17
+ * IsolatePool isolate. Each facet has its own 128 MB budget and
18
18
  * stable-slot reuse keeps the warm-up cost amortized across the 8
19
19
  * concurrent specs of a typical install. The install-batch facet uses
20
20
  * the same isolate boundary for tarball extraction.
@@ -181,7 +181,7 @@ export function externalsForSpecifier(specifier) {
181
181
  }
182
182
  // ── Facet function ──────────────────────────────────────────────────────
183
183
  //
184
- // `prebundleOne` runs inside a NimbusLoaderPool isolate. cloudflare-parallel
184
+ // `prebundleOne` runs inside a IsolatePool isolate. cloudflare-parallel
185
185
  // serialises it via fn.toString(); the helpers it references at module
186
186
  // scope (ESBUILD_WASM_JS_FN_BODY, resolvePackageEntry) are NOT in the
187
187
  // facet's lexical scope at runtime. Instead they're injected by the
@@ -250,7 +250,7 @@ export const prebundleOne = async function prebundleOne(spec, _env) {
250
250
  // runs that at module-load time (where eval is permitted) and
251
251
  // stashes the result on the module-scope const __NIMBUS_ESBUILD_NS.
252
252
  //
253
- // The WASM module is shipped into the facet via NimbusLoaderPool's
253
+ // The WASM module is shipped into the facet via IsolatePool's
254
254
  // `wasmModules` option, registered in the LOADER's modules map as
255
255
  // { wasm: ArrayBuffer }. Workerd compiles it during the worker's
256
256
  // module-load phase (eval permitted there), and the pool's
@@ -285,7 +285,7 @@ export const prebundleOne = async function prebundleOne(spec, _env) {
285
285
  if (!initPromise) {
286
286
  initPromise = (async () => {
287
287
  // Read the WebAssembly.Module the pool registered. The key matches
288
- // the name passed to NimbusLoaderPool's `wasmModules` option (see
288
+ // the name passed to IsolatePool's `wasmModules` option (see
289
289
  // src/npm-installer.ts:prebundleUsedModules dispatch site).
290
290
  const wasmRegistry = globalThis.__NIMBUS_WASM;
291
291
  const wasmModule = wasmRegistry && wasmRegistry['esbuild.wasm'];
@@ -220,7 +220,7 @@ export declare function packumentKey(name: string): string;
220
220
  * proving the L2 layer is functional even when local-dev wall-clock
221
221
  * latency is too noisy to demonstrate 5×.
222
222
  *
223
- * Diag counters (src/observability/diag-counters.ts) bump for the
223
+ * Diag counters (@nimbus-sh/platform/diag-counters.js) bump for the
224
224
  * SupervisorRPC layer (RPC-perspective hit/miss). These per-instance
225
225
  * counters bump for the R2CacheClient call surface itself (L2 vs L3
226
226
  * vs miss), independent of who's calling.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * resolve-facet.ts — shared wire types for the per-packument resolver facet.
3
3
  *
4
- * The npm resolver phase runs inside a NimbusLoaderPool isolate so the
4
+ * The npm resolver phase runs inside a IsolatePool isolate so the
5
5
  * supervisor DO heap stays flat while large packuments are decoded. The
6
6
  * per-packument task body lives in resolve-one-facet.ts; this module holds
7
7
  * the types exchanged between supervisor and facet over RPC.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * resolve-facet.ts — shared wire types for the per-packument resolver facet.
3
3
  *
4
- * The npm resolver phase runs inside a NimbusLoaderPool isolate so the
4
+ * The npm resolver phase runs inside a IsolatePool isolate so the
5
5
  * supervisor DO heap stays flat while large packuments are decoded. The
6
6
  * per-packument task body lives in resolve-one-facet.ts; this module holds
7
7
  * the types exchanged between supervisor and facet over RPC.
@@ -7,10 +7,10 @@
7
7
  * independent fanout tasks. This file is the per-task body: one packument
8
8
  * fetch, one version pick, and edge extraction.
9
9
  *
10
- * Each task runs inside a Worker Loader isolate (NimbusFanoutPool routes
10
+ * Each task runs inside a Worker Loader isolate (Fanout routes
11
11
  * automatically: <5 = in-DO, ≥5 = peer-DO). The isolate is short-lived;
12
12
  * task body has its own ~128 MiB envelope. Parallelism = layer width
13
- * (capped at 32 by NimbusFanoutPool's MAX_PEER_FANOUT).
13
+ * (capped at 32 by Fanout's MAX_PEER_FANOUT).
14
14
  *
15
15
  * Stability invariants (cloudflare-parallel serialises via fn.toString)
16
16
  * ───────────────────────────────────────────────────────────────────
@@ -180,13 +180,13 @@ export interface ResolveOneResult {
180
180
  }
181
181
  /**
182
182
  * Per-package fanout task body. Serialised via fn.toString() and
183
- * dispatched by NimbusFanoutPool.submitMany — see installer.ts
183
+ * dispatched by Fanout.submitMany — see installer.ts
184
184
  * resolveTreeViaFanout.
185
185
  *
186
- * Function signature MUST be `(spec, env)` so NimbusFanoutPool's
186
+ * Function signature MUST be `(spec, env)` so Fanout's
187
187
  * submitMany invocation `fn(item, env)` lines up.
188
188
  *
189
- * `env` is the loader-isolate env supplied by NimbusFanoutPool.
189
+ * `env` is the loader-isolate env supplied by Fanout.
190
190
  * `env.SUPERVISOR` is the supervisor-rpc binding (putRegistryEntries,
191
191
  * getPackument).
192
192
  */
@@ -7,10 +7,10 @@
7
7
  * independent fanout tasks. This file is the per-task body: one packument
8
8
  * fetch, one version pick, and edge extraction.
9
9
  *
10
- * Each task runs inside a Worker Loader isolate (NimbusFanoutPool routes
10
+ * Each task runs inside a Worker Loader isolate (Fanout routes
11
11
  * automatically: <5 = in-DO, ≥5 = peer-DO). The isolate is short-lived;
12
12
  * task body has its own ~128 MiB envelope. Parallelism = layer width
13
- * (capped at 32 by NimbusFanoutPool's MAX_PEER_FANOUT).
13
+ * (capped at 32 by Fanout's MAX_PEER_FANOUT).
14
14
  *
15
15
  * Stability invariants (cloudflare-parallel serialises via fn.toString)
16
16
  * ───────────────────────────────────────────────────────────────────
@@ -61,13 +61,13 @@
61
61
  */
62
62
  /**
63
63
  * Per-package fanout task body. Serialised via fn.toString() and
64
- * dispatched by NimbusFanoutPool.submitMany — see installer.ts
64
+ * dispatched by Fanout.submitMany — see installer.ts
65
65
  * resolveTreeViaFanout.
66
66
  *
67
- * Function signature MUST be `(spec, env)` so NimbusFanoutPool's
67
+ * Function signature MUST be `(spec, env)` so Fanout's
68
68
  * submitMany invocation `fn(item, env)` lines up.
69
69
  *
70
- * `env` is the loader-isolate env supplied by NimbusFanoutPool.
70
+ * `env` is the loader-isolate env supplied by Fanout.
71
71
  * `env.SUPERVISOR` is the supervisor-rpc binding (putRegistryEntries,
72
72
  * getPackument).
73
73
  */
@@ -35,7 +35,7 @@ import { generateSessionId, isValidSessionId, } from '../_shared/session-id.js';
35
35
  import { buildPreviewHost, isPreviewHostSafeSid, parsePreviewHost, readPreviewHostSuffix, } from '../_shared/preview-host.js';
36
36
  import { parseSessionRoute, forwardToSession, renderInvalidSessionHtml, SESSION_ROUTE_PREFIX, LEGACY_PUBLIC_DO_SEGMENT, } from '../_shared/session-router.js';
37
37
  import { issueNimbusToken, verifyNimbusToken, verifyRequestToken, requireScopes, requireSessionPin, authErrorResponse, setNimbusTokenCookie, NIMBUS_TOKEN_QUERY, NimbusAuthError, NimbusBootstrapConsumedError, NimbusTokenClaimsError, DEFAULT_TOKEN_TTL_MS, ATTACH_BOOTSTRAP_TTL_MS, } from '../auth/index.js';
38
- import { setCtxExports } from '../session/ctx-exports.js';
38
+ import { adoptCtxExports } from '@nimbus-sh/fabric/composition.js';
39
39
  import { handleNimbusRemoteApi, } from './remote-api.js';
40
40
  import { parseAgentOAuthStateParam } from '../session/agent.js';
41
41
  /**
@@ -82,7 +82,7 @@ export function createNimbusHandler(options = {}) {
82
82
  async function route(request, env, ctx) {
83
83
  // Capture ctx.exports on first call (loopback bindings for facets).
84
84
  if (ctx?.exports)
85
- setCtxExports(ctx.exports);
85
+ adoptCtxExports(ctx.exports);
86
86
  const url = new URL(request.url);
87
87
  const previewSuffix = readPreviewHostSuffix(env);
88
88
  // ── <port>--<sid>.<suffix> — port preview ───────────────────────
@@ -1,7 +1,7 @@
1
1
  import { LEGACY_PUBLIC_DO_SEGMENT, } from '../_shared/session-router.js';
2
2
  import { z } from 'zod/v4';
3
3
  import { requireScopes, requireSessionPin, verifyRequestToken, NimbusAuthError, isNimbusIdComponent, } from '../auth/index.js';
4
- import { useRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
4
+ import { useRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
5
5
  const DEFAULT_REMOTE_BASE_PATH = '/api/nimbus/v1';
6
6
  const RemoteRpcBodySchema = z.object({
7
7
  profile: z.string().optional(),
@@ -242,6 +242,14 @@ function requireAnyScope(ctx, scopes) {
242
242
  }
243
243
  function execOptions(ctx, value) {
244
244
  const options = objectArg(value);
245
+ // The remote boundary authenticates a SESSION, not a user inside it, so a
246
+ // token holder does not get to name the uid its command runs as. Refused
247
+ // rather than dropped: silently running as somebody other than the caller
248
+ // asked for is worse than an error. A colocated embedder holds the DO stub
249
+ // and is trusted with `cred` the same way it is trusted with kernel writes.
250
+ if (options.cred !== undefined) {
251
+ throw apiError('cred is not accepted over the remote API', 'E_ARG_SHAPE', 400);
252
+ }
245
253
  return {
246
254
  ...options,
247
255
  cwd: typeof options.cwd === 'string' ? options.cwd : ctx.root,
@@ -7,7 +7,7 @@
7
7
  * functions / imports persist.
8
8
  *
9
9
  * Design:
10
- * - One child-facet per REPL session (NimbusLoaderPool with
10
+ * - One child-facet per REPL session (IsolatePool with
11
11
  * concurrency=1, omitSupervisor=true).
12
12
  * - Facet-side: globalThis.__nimbus_bun_ctx caches a vm.createContext()
13
13
  * dict; each push() runs vm.runInContext(line, ctx) and returns
@@ -7,7 +7,7 @@
7
7
  * functions / imports persist.
8
8
  *
9
9
  * Design:
10
- * - One child-facet per REPL session (NimbusLoaderPool with
10
+ * - One child-facet per REPL session (IsolatePool with
11
11
  * concurrency=1, omitSupervisor=true).
12
12
  * - Facet-side: globalThis.__nimbus_bun_ctx caches a vm.createContext()
13
13
  * dict; each push() runs vm.runInContext(line, ctx) and returns
@@ -125,8 +125,8 @@ class BunReplAdapter {
125
125
  // Preamble: install the Bun shim global at facet startup so the
126
126
  // REPL context has Bun.* available like real Bun does.
127
127
  const preamble = BUN_SHIM_PREAMBLE;
128
- const { NimbusLoaderPool } = await import('../loaders/loader-pool.js');
129
- this.pool = new NimbusLoaderPool(env, ctx, {
128
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
129
+ this.pool = new IsolatePool(env, ctx, {
130
130
  tag: 'bun-repl',
131
131
  concurrency: 1,
132
132
  omitSupervisor: true,
@@ -43,7 +43,7 @@
43
43
  */
44
44
  import { ESBUILD_VERSION } from '@nimbus-sh/core/constants.js';
45
45
  import { ESBUILD_WASM_SHA256 } from '../esbuild-wasm-bundle.generated.js';
46
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
46
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
47
47
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
48
48
  /**
49
49
  * Path inside env.ASSETS where the esbuild-wasm binary lives.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The workerd {@link FacetHost}: a facet is a dynamic worker.
3
3
  *
4
- * The whole adapter is the option renames below, because `NimbusLoaderPool`
4
+ * The whole adapter is the option renames below, because `IsolatePool`
5
5
  * already IS the port's shape — `submit` and `dispose`, with the same meanings.
6
6
  * The one thing it spells differently is the supervisor capability, which it
7
7
  * takes as a pid plus a separate flag saying whether to bind one at all; the
@@ -13,13 +13,10 @@ import type { FacetHost } from '@nimbus-sh/core/runtime/facet-host.js';
13
13
  import type { FacetManager } from '../facets/manager.js';
14
14
  export declare function loaderFacetHost(env: unknown, ctx: DurableObjectState): FacetHost;
15
15
  /**
16
- * The two objects a NimbusLoaderPool needs from a FacetManager.
17
- *
18
- * FacetManager does not expose its `env` and `ctx` in its type, but a loader
19
- * pool is constructed from exactly those, so every runtime that spawns facets
20
- * needs the same reach-through. Reflect.get rather than a cast: the shape is
21
- * checked here once, and a FacetManager built on something other than a
22
- * DurableObjectState fails with a sentence instead of at the first RPC.
16
+ * The two objects a IsolatePool needs from a FacetManager, via the manager's
17
+ * own `loaderHost()` accessor. The runtime guard stays: harnesses build
18
+ * FacetManagers on mock contexts, and one built on something other than a
19
+ * DurableObjectState should fail with a sentence instead of at the first RPC.
23
20
  */
24
21
  export declare function getFacetManagerLoaderHost(facetMgr: FacetManager): {
25
22
  env: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"facet-loader-host.d.ts","sourceRoot":"","sources":["../../src/runtime/facet-loader-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAIV,SAAS,EAEV,MAAM,uCAAuC,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,GAAG,SAAS,CA6BhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,GACrB;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,kBAAkB,CAAA;CAAE,CAO3C;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAGrE"}
1
+ {"version":3,"file":"facet-loader-host.d.ts","sourceRoot":"","sources":["../../src/runtime/facet-loader-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAIV,SAAS,EAEV,MAAM,uCAAuC,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,GAAG,SAAS,CA6BhF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,GACrB;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,kBAAkB,CAAA;CAAE,CAM3C;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAGrE"}
@@ -1,5 +1,5 @@
1
1
  import { manifestVfs } from '@nimbus-sh/core/runtime/vfs-manifest.js';
2
- import { NimbusLoaderPool } from '../loaders/loader-pool.js';
2
+ import { IsolatePool } from '@nimbus-sh/fabric/isolate-pool.js';
3
3
  export function loaderFacetHost(env, ctx) {
4
4
  return {
5
5
  // workerd suspends a guest through JSPI, which is what lets a syscall reach
@@ -14,7 +14,7 @@ export function loaderFacetHost(env, ctx) {
14
14
  return manifestVfs(vfs, root, options);
15
15
  },
16
16
  open(spec) {
17
- return new NimbusLoaderPool(env, ctx, {
17
+ return new IsolatePool(env, ctx, {
18
18
  tag: spec.tag,
19
19
  concurrency: spec.concurrency,
20
20
  preamble: spec.preamble,
@@ -27,17 +27,13 @@ export function loaderFacetHost(env, ctx) {
27
27
  };
28
28
  }
29
29
  /**
30
- * The two objects a NimbusLoaderPool needs from a FacetManager.
31
- *
32
- * FacetManager does not expose its `env` and `ctx` in its type, but a loader
33
- * pool is constructed from exactly those, so every runtime that spawns facets
34
- * needs the same reach-through. Reflect.get rather than a cast: the shape is
35
- * checked here once, and a FacetManager built on something other than a
36
- * DurableObjectState fails with a sentence instead of at the first RPC.
30
+ * The two objects a IsolatePool needs from a FacetManager, via the manager's
31
+ * own `loaderHost()` accessor. The runtime guard stays: harnesses build
32
+ * FacetManagers on mock contexts, and one built on something other than a
33
+ * DurableObjectState should fail with a sentence instead of at the first RPC.
37
34
  */
38
35
  export function getFacetManagerLoaderHost(facetMgr) {
39
- const env = Reflect.get(facetMgr, 'env');
40
- const ctx = Reflect.get(facetMgr, 'ctx');
36
+ const { env, ctx } = facetMgr.loaderHost();
41
37
  if (!isDurableObjectState(ctx)) {
42
38
  throw new Error('a loader-backed runtime requires a FacetManager with DurableObjectState context');
43
39
  }
@@ -113,8 +113,8 @@ class NodeReplAdapter {
113
113
  const { facetMgr } = this.deps;
114
114
  const env = facetMgr.env;
115
115
  const ctx = facetMgr.ctx;
116
- const { NimbusLoaderPool } = await import('../loaders/loader-pool.js');
117
- this.pool = new NimbusLoaderPool(env, ctx, {
116
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
117
+ this.pool = new IsolatePool(env, ctx, {
118
118
  tag: 'node-repl',
119
119
  concurrency: 1,
120
120
  omitSupervisor: true,
@@ -16,7 +16,7 @@
16
16
  * facet with no node-compat layer.
17
17
  */
18
18
  import { NODE_SHIMS_BUILD_ID, NODE_SHIMS_ENTRY, NODE_SHIMS_SHA256, } from '../node-shims-artifact.generated.js';
19
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
19
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
20
20
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
21
21
  const L2_KEY = `https://nimbus-cache.invalid${NODE_SHIMS_ENTRY}?build=${NODE_SHIMS_BUILD_ID}`;
22
22
  const ASSET_URL = `https://nimbus-internal.invalid${NODE_SHIMS_ENTRY}`;
@@ -41,7 +41,8 @@ import { generateUndiciShimCode } from '@nimbus-sh/core/runtime/undici-shim.js';
41
41
  import { getExportsResolverJS } from '@nimbus-sh/core/_shared/exports-resolver.js';
42
42
  import { getTypescriptSpecifiersJS } from '@nimbus-sh/core/_shared/typescript-specifiers.js';
43
43
  import { NIMBUS_AI_CREDENTIAL_HEADERS, NIMBUS_AI_TOKEN_ENV } from '@nimbus-sh/core/_shared/ai-egress.js';
44
- import { FACET_PROVIDED_PACKAGES, FS_READ_BATCH_PATH_LIMIT, FS_READ_BATCH_REQUEST_BYTES, MAX_RPC_SAFE_PAYLOAD_BYTES, NIMBUS_AI_GATEWAY_PORT, NODE_VERSION, NODE_VERSIONS, } from '@nimbus-sh/core/constants.js';
44
+ import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
45
+ import { FACET_PROVIDED_PACKAGES, FS_READ_BATCH_PATH_LIMIT, FS_READ_BATCH_REQUEST_BYTES, NIMBUS_AI_GATEWAY_PORT, NODE_VERSION, NODE_VERSIONS, } from '@nimbus-sh/core/constants.js';
45
46
  const STREAMS_CODE = generateStreamsCode();
46
47
  const SQLITE_SHIM_CODE = generateSqliteShimCode();
47
48
  const UNDICI_SHIM_CODE = generateUndiciShimCode();
@@ -20,7 +20,7 @@
20
20
  * (see OPENCODE_TREE_SITTER_WASMS and FacetManager.treeSitterModuleEntries).
21
21
  */
22
22
  import { OPENCODE_ARTIFACT_BUILD_ID, OPENCODE_ARTIFACT_DIGESTS, OPENCODE_ARTIFACT_PRESENT, OPENCODE_ARTIFACT_VERSION, } from '../opencode-artifact.generated.js';
23
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
23
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
24
24
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
25
25
  /** Base asset path of the staged opencode bundle directory. */
26
26
  const OPENCODE_ASSET_BASE = `/_assets/opencode/${OPENCODE_ARTIFACT_VERSION}`;
@@ -16,7 +16,7 @@
16
16
  * the backend.
17
17
  */
18
18
  import { OPENTUI_WASM_BUILD_ID, OPENTUI_WASM_ENTRY, OPENTUI_WASM_SHA256, } from '../opentui-wasm-artifact.generated.js';
19
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
19
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
20
20
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
21
21
  /**
22
22
  * Synthetic L2 cache key for the OpenTUI wasm asset. Build-id-pinned so a
@@ -207,7 +207,7 @@ class PythonReplAdapter {
207
207
  snapshot.files[stdlibPath.replace(/^\/+/, '')] = btoa(bin);
208
208
  this.fsSnapshot = snapshot;
209
209
  this.pythonHome = `/${installRoot.replace(/^\/+/, '')}`;
210
- const { NimbusLoaderPool } = await import('../loaders/loader-pool.js');
210
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
211
211
  const host = getFacetManagerLoaderHost(facetMgr);
212
212
  // A prompt where `open(path, "w")` silently does nothing is worse than one
213
213
  // that refuses to start, so the pid decides which pool this is. Written as
@@ -225,11 +225,11 @@ class PythonReplAdapter {
225
225
  };
226
226
  const pid = this.deps.pid;
227
227
  this.pool = (typeof pid === 'number' && pid > 0
228
- ? new NimbusLoaderPool(host.env, host.ctx, { ...base, supervisorPid: pid })
228
+ ? new IsolatePool(host.env, host.ctx, { ...base, supervisorPid: pid })
229
229
  // The install-time warm-up has no invoking process. It boots the
230
230
  // interpreter and never touches a file, so it asks for no supervisor
231
231
  // rather than binding one it cannot authenticate to.
232
- : new NimbusLoaderPool(host.env, host.ctx, { ...base, omitSupervisor: true }));
232
+ : new IsolatePool(host.env, host.ctx, { ...base, omitSupervisor: true }));
233
233
  }
234
234
  async submit(userCode) {
235
235
  const result = await this.pool.submit(pythonReplStepFacetFn, {
@@ -156,10 +156,10 @@ class RubyReplAdapter {
156
156
  // drifted (it lacked the language-prelude const __rubyRun requires, so
157
157
  // every REPL eval died on boot) — compose it in exactly one place.
158
158
  const preamble = buildRubyPreamble();
159
- const { NimbusLoaderPool } = await import('../loaders/loader-pool.js');
159
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
160
160
  const env = facetMgr.env;
161
161
  const ctx = facetMgr.ctx;
162
- this.pool = new NimbusLoaderPool(env, ctx, {
162
+ this.pool = new IsolatePool(env, ctx, {
163
163
  tag: 'ruby-repl',
164
164
  concurrency: 1,
165
165
  omitSupervisor: true,
@@ -48,7 +48,7 @@ export function rubyResidentStart(facetMgr) {
48
48
  }
49
49
  const boot = parsed.data;
50
50
  if (boot.state === 'listening' && typeof boot.port === 'number' && boot.port > 0) {
51
- facetMgr.registerPort(spawned.pid, Number(boot.port));
51
+ await facetMgr.registerPort(spawned.pid, Number(boot.port));
52
52
  const routeablePorts = await facetMgr.waitForRouteablePorts(spawned.pid);
53
53
  const routeablePort = routeablePorts.includes(Number(boot.port)) ? Number(boot.port) : routeablePorts[0];
54
54
  if (!routeablePort) {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  import { SQLJS_VERSION } from '@nimbus-sh/core/constants.js';
19
19
  import { SQLITE_WASM_SHA256 } from '../sqlite-wasm-bundle.generated.js';
20
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
20
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
21
21
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
22
22
  /**
23
23
  * Path inside env.ASSETS where the sql.js wasm binary lives. Versioned so
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * Per DEFECT-D1: ctx is taken as a separate explicit arg.
18
18
  */
19
- import { rehydrateFromStorage, snapshotForStorage, getFailures, } from '@nimbus-sh/core/observability/oom-discriminator.js';
19
+ import { rehydrateFromStorage, snapshotForStorage, getFailures, } from '@nimbus-sh/platform/oom-discriminator.js';
20
20
  import { W5_RING_STORAGE_KEY } from './keys.js';
21
21
  export function readNodeMem() {
22
22
  try {