@nimbus-sh/worker 0.6.0 → 0.7.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 (133) hide show
  1. package/README.md +2 -2
  2. package/dist/cirrus-npm-cjs.generated.d.ts +1 -1
  3. package/dist/cirrus-npm-cjs.generated.js +1 -1
  4. package/dist/facets/cirrus-real.d.ts.map +1 -1
  5. package/dist/facets/cirrus-real.js +6 -5
  6. package/dist/facets/compose.d.ts +148 -0
  7. package/dist/facets/compose.d.ts.map +1 -0
  8. package/dist/facets/compose.js +146 -0
  9. package/dist/facets/durable-images.d.ts +9 -5
  10. package/dist/facets/durable-images.d.ts.map +1 -1
  11. package/dist/facets/durable-images.js +17 -7
  12. package/dist/facets/esbuild-bundle-pool.d.ts +49 -0
  13. package/dist/facets/esbuild-bundle-pool.d.ts.map +1 -0
  14. package/dist/facets/esbuild-bundle-pool.js +122 -0
  15. package/dist/facets/exec-telemetry.d.ts +8 -0
  16. package/dist/facets/exec-telemetry.d.ts.map +1 -1
  17. package/dist/facets/manager.d.ts +240 -109
  18. package/dist/facets/manager.d.ts.map +1 -1
  19. package/dist/facets/manager.js +661 -337
  20. package/dist/facets/process.d.ts +20 -16
  21. package/dist/facets/process.d.ts.map +1 -1
  22. package/dist/facets/process.js +59 -28
  23. package/dist/facets/real-vite-fs-shim.js +2 -2
  24. package/dist/facets/vite-dev-server.d.ts +25 -47
  25. package/dist/facets/vite-dev-server.d.ts.map +1 -1
  26. package/dist/facets/vite-dev-server.js +185 -219
  27. package/dist/facets/wasm-image-digest.d.ts +25 -0
  28. package/dist/facets/wasm-image-digest.d.ts.map +1 -0
  29. package/dist/facets/wasm-image-digest.js +25 -0
  30. package/dist/facets/wasm-swap-registry.d.ts +51 -92
  31. package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
  32. package/dist/facets/wasm-swap-registry.js +68 -227
  33. package/dist/git/network-facet.d.ts.map +1 -1
  34. package/dist/git/network-facet.js +6 -5
  35. package/dist/loaders/child-process/spawn-pool.d.ts +3 -2
  36. package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
  37. package/dist/loaders/child-process/spawn-pool.js +3 -2
  38. package/dist/loaders/generated-workers.d.ts +2 -2
  39. package/dist/loaders/generated-workers.d.ts.map +1 -1
  40. package/dist/loaders/generated-workers.js +3 -3
  41. package/dist/loaders/npm-resolve-preamble.d.ts +3 -6
  42. package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
  43. package/dist/loaders/npm-resolve-preamble.js +34 -108
  44. package/dist/node-shims-artifact.generated.js +3 -3
  45. package/dist/npm/install-batch-facet.d.ts +3 -2
  46. package/dist/npm/install-batch-facet.d.ts.map +1 -1
  47. package/dist/npm/install-batch-facet.js +45 -15
  48. package/dist/npm/installer.d.ts +22 -17
  49. package/dist/npm/installer.d.ts.map +1 -1
  50. package/dist/npm/installer.js +209 -193
  51. package/dist/npm/pre-bundle-facet.d.ts +1 -1
  52. package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
  53. package/dist/npm/pre-bundle-facet.js +1 -1
  54. package/dist/npm/resolve-facet.d.ts +6 -0
  55. package/dist/npm/resolve-facet.d.ts.map +1 -1
  56. package/dist/npm/resolve-one-facet.d.ts +21 -20
  57. package/dist/npm/resolve-one-facet.d.ts.map +1 -1
  58. package/dist/npm/resolve-one-facet.js +85 -84
  59. package/dist/npm/semver.d.ts +59 -0
  60. package/dist/npm/semver.d.ts.map +1 -0
  61. package/dist/npm/semver.js +226 -0
  62. package/dist/router/remote-api.js +31 -1
  63. package/dist/runtime/html-entrypoint.d.ts +7 -0
  64. package/dist/runtime/html-entrypoint.d.ts.map +1 -1
  65. package/dist/runtime/html-entrypoint.js +18 -2
  66. package/dist/runtime/node-runner.d.ts +3 -0
  67. package/dist/runtime/node-runner.d.ts.map +1 -1
  68. package/dist/runtime/node-runner.js +7 -0
  69. package/dist/runtime/node-shims.d.ts.map +1 -1
  70. package/dist/runtime/node-shims.js +305 -29
  71. package/dist/runtime/opencode-facet-runner.js +2 -2
  72. package/dist/session/helpers.d.ts +38 -0
  73. package/dist/session/helpers.d.ts.map +1 -1
  74. package/dist/session/helpers.js +76 -0
  75. package/dist/session/init-phases.d.ts +1 -1
  76. package/dist/session/init-phases.d.ts.map +1 -1
  77. package/dist/session/init-phases.js +2 -12
  78. package/dist/session/init.d.ts +15 -1
  79. package/dist/session/init.d.ts.map +1 -1
  80. package/dist/session/init.js +82 -603
  81. package/dist/session/nimbus-session.d.ts +56 -22
  82. package/dist/session/nimbus-session.d.ts.map +1 -1
  83. package/dist/session/nimbus-session.js +130 -101
  84. package/dist/session/npm-install-port.d.ts +16 -0
  85. package/dist/session/npm-install-port.d.ts.map +1 -0
  86. package/dist/session/npm-install-port.js +37 -0
  87. package/dist/session/port-capability.d.ts +44 -0
  88. package/dist/session/port-capability.d.ts.map +1 -1
  89. package/dist/session/port-capability.js +110 -0
  90. package/dist/session/programmatic.d.ts +31 -5
  91. package/dist/session/programmatic.d.ts.map +1 -1
  92. package/dist/session/programmatic.js +94 -68
  93. package/dist/session/routes.d.ts +30 -17
  94. package/dist/session/routes.d.ts.map +1 -1
  95. package/dist/session/routes.js +42 -131
  96. package/dist/session/rpc.d.ts +15 -15
  97. package/dist/session/rpc.d.ts.map +1 -1
  98. package/dist/session/rpc.js +97 -47
  99. package/dist/session/serving-port.d.ts +27 -0
  100. package/dist/session/serving-port.d.ts.map +1 -0
  101. package/dist/session/serving-port.js +27 -0
  102. package/dist/session/start-real-vite.d.ts +12 -0
  103. package/dist/session/start-real-vite.d.ts.map +1 -1
  104. package/dist/session/start-real-vite.js +4 -4
  105. package/dist/session/supervisor-op.d.ts +2 -2
  106. package/dist/session/supervisor-op.d.ts.map +1 -1
  107. package/dist/session/supervisor-op.js +13 -7
  108. package/dist/session/supervisor-rpc.d.ts +7 -7
  109. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  110. package/dist/session/supervisor-rpc.js +4 -0
  111. package/dist/session/vite-command.d.ts +18 -0
  112. package/dist/session/vite-command.d.ts.map +1 -0
  113. package/dist/session/vite-command.js +609 -0
  114. package/dist/session/ws.d.ts +61 -0
  115. package/dist/session/ws.d.ts.map +1 -1
  116. package/dist/session/ws.js +122 -12
  117. package/dist/shell/npm-bin-entrypoints.d.ts +0 -35
  118. package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
  119. package/dist/shell/npm-bin-entrypoints.js +12 -85
  120. package/package.json +24 -4
  121. package/public/_assets/runtime/{node-shims-9e1380d9ee430fcc.js → node-shims-8f8c64edd2a1f0f5.js} +305 -29
  122. package/public/index.html +1 -1
  123. package/scripts/bundle-facet-workers.mjs +1 -1
  124. package/scripts/bundle-npm-cjs.mjs +2 -2
  125. package/dist/facets/on-demand-bundle-gate.d.ts +0 -65
  126. package/dist/facets/on-demand-bundle-gate.d.ts.map +0 -1
  127. package/dist/facets/on-demand-bundle-gate.js +0 -125
  128. package/dist/npm/install-args.d.ts +0 -21
  129. package/dist/npm/install-args.d.ts.map +0 -1
  130. package/dist/npm/install-args.js +0 -70
  131. package/dist/npm/npm-log.d.ts +0 -31
  132. package/dist/npm/npm-log.d.ts.map +0 -1
  133. package/dist/npm/npm-log.js +0 -51
@@ -8,17 +8,15 @@
8
8
  import { staticStdinReader } from '@nimbus-sh/core/shell/stdin-adapter.js';
9
9
  import { DurableObject as CloudflareDurableObject } from 'cloudflare:workers';
10
10
  import { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
11
- import { FacetManager } from '../facets/manager.js';
12
- import { resolveDurableWorkerImage } from '../facets/durable-images.js';
13
- import { FacetProcessManager } from '../facets/process.js';
11
+ import { composeFacetManager } from '../facets/compose.js';
12
+ import { FacetProcessManager, textBytes } from '../facets/process.js';
14
13
  import { ChildProcessSpawnPool } from '../loaders/child-process/spawn-pool.js';
15
14
  import { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
16
15
  import { PID_GEN_STRIDE } from '@nimbus-sh/core/runtime/process-table.js';
17
16
  import { CRED_KERNEL, CRED_SESSION_USER, } from '@nimbus-sh/core/runtime/os-contracts.js';
18
17
  import { PortRegistry } from '@nimbus-sh/core/runtime/port-registry.js';
18
+ import { EsbuildBundlePool } from '../facets/esbuild-bundle-pool.js';
19
19
  import { EsbuildService } from '@nimbus-sh/core/runtime/esbuild-service.js';
20
- import { ESBUILD_TRANSFORM_WORKER_ID, esbuildTransformWorkerCode, } from '../facets/esbuild-transform.js';
21
- import { fetchEsbuildWasmBytes } from '../runtime/esbuild-wasm-bytes.js';
22
20
  import { registerAllocObserver } from '@nimbus-sh/platform/heavy-alloc-coord.js';
23
21
  // S10: oom-discriminator helpers (recordFailure, getFailures,
24
22
  // getLastRpcFrame, getLastFacetId, snapshotForStorage, rehydrateFromStorage)
@@ -35,7 +33,7 @@ import { registerAllocObserver } from '@nimbus-sh/platform/heavy-alloc-coord.js'
35
33
  import { adoptCtxExports } from '@nimbus-sh/fabric/composition.js';
36
34
  import { NIMBUS_VERSION, DEFAULT_MOUNT_POINTS, CF_COMPAT_DATE } from '@nimbus-sh/core/constants.js';
37
35
  import { seedBaseFilesystem } from '@nimbus-sh/core/workspace';
38
- import { seedProject } from '@nimbus-sh/core/vfs/seed-project.js';
36
+ import { seedProject, SEED_PROJECT_NAME } from '@nimbus-sh/core/vfs/seed-project.js';
39
37
  import { BASE_PATH_HEADER } from '../_shared/session-router.js';
40
38
  import { ATTACH_BOOTSTRAP_JTI_KEY_PREFIX, SESSION_DESTROYED_KEY } from './keys.js';
41
39
  import { appendScrollback } from './state-store.js';
@@ -57,12 +55,12 @@ import { wsMessage as _wsDoMessage, wsClose as _wsDoClose, wsError as _wsDoError
57
55
  // S8: Supervisor RPC + W8 cp* + legacy VFS impls extracted.
58
56
  import * as _rpc from './rpc.js';
59
57
  import { buildSessionSupervisorOps } from './supervisor-op.js';
60
- import { processHostFor } from '../loaders/process-host.js';
61
58
  // The supervisor terminates a facet's outbound sockets so inbound frames
62
59
  // arrive as supervisor replies (VFS coherence witness 3).
63
60
  import { WebSocketRelay } from './ws-relay.js';
64
61
  // S9: HTTP fetch routing extracted (combined S9a + S9b).
65
62
  import * as _routes from './routes.js';
63
+ import * as _portCapability from './port-capability.js';
66
64
  // Programmatic SDK RPC surface.
67
65
  import * as _programmatic from './programmatic.js';
68
66
  // S10: heap probe + W5 OOM-ring persistence extracted.
@@ -170,7 +168,7 @@ Cloud-native development environment on Cloudflare Workers.
170
168
  | --- | --- |
171
169
  | Run JavaScript | \`node hello.js\` |
172
170
  | Install npm packages | \`npm install <pkg>\` |
173
- | Start the starter app | \`cd app && npm install && npm run dev\` |
171
+ | Start the starter app | \`cd ${SEED_PROJECT_NAME} && npm install && npm run dev\` |
174
172
  | Run a Cloudflare Worker locally | \`nimbus-wrangler dev\` |
175
173
 
176
174
  ## AI Models
@@ -249,7 +247,11 @@ export class NimbusSession extends CloudflareDurableObject {
249
247
  shell = null;
250
248
  shellProcessPid = null;
251
249
  terminal = null;
252
- facetManager = null;
250
+ /** The composed manager is the one field; `.manager` is derived. */
251
+ facetManagerComposed = null;
252
+ get facetManager() {
253
+ return this.facetManagerComposed?.manager ?? null;
254
+ }
253
255
  /** W8: child_process broker. Lazy — only constructed when first cp* RPC arrives. */
254
256
  facetProcessManager = null;
255
257
  /**
@@ -259,6 +261,12 @@ export class NimbusSession extends CloudflareDurableObject {
259
261
  */
260
262
  webSocketRelay = null;
261
263
  esbuildService = null;
264
+ /**
265
+ * The session's single esbuild facet pool, shared by the npm installer's
266
+ * pre-bundler and the dev server's on-demand /@modules/ path. Lazy; see
267
+ * ensureBundlePool. Disposed with the installer and dev server.
268
+ */
269
+ bundlePool = null;
262
270
  viteDevServer = null;
263
271
  /**
264
272
  * runtime primitive support (P5): PID + port the default-Cirrus vite shim is
@@ -656,23 +664,23 @@ export class NimbusSession extends CloudflareDurableObject {
656
664
  supervisorOp(envelope) {
657
665
  return this.supervisorOps().dispatch(envelope);
658
666
  }
659
- async _rpcReadFile(path, pid) { return _rpc._rpcReadFile(this, path, pid); }
660
- async _rpcReadFileBytes(path, pid) { return _rpc._rpcReadFileBytes(this, path, pid); }
667
+ async _rpcReadFile(path, pid, cred) { return _rpc._rpcReadFile(this, path, pid, cred); }
668
+ async _rpcReadFileBytes(path, pid, cred) { return _rpc._rpcReadFileBytes(this, path, pid, cred); }
661
669
  async _rpcInnerDoFetch(req) { return _rpc._rpcInnerDoFetch(this, req); }
662
- async _rpcWriteFile(path, content, pid) { return _rpc._rpcWriteFile(this, path, content, pid); }
670
+ async _rpcWriteFile(path, content, pid, cred) { return _rpc._rpcWriteFile(this, path, content, pid, cred); }
663
671
  async _rpcWriteProtectedRootFile(rootPath, path, content) {
664
672
  return _rpc._rpcWriteProtectedRootFile(this, rootPath, path, content);
665
673
  }
666
- async _rpcStat(path, pid) { return _rpc._rpcStat(this, path, pid); }
667
- async _rpcLstat(path, pid) { return _rpc._rpcLstat(this, path, pid); }
674
+ async _rpcStat(path, pid, cred) { return _rpc._rpcStat(this, path, pid, cred); }
675
+ async _rpcLstat(path, pid, cred) { return _rpc._rpcLstat(this, path, pid, cred); }
668
676
  async _rpcHasLegacySymlinkUnder(path, pid) {
669
677
  return _rpc._rpcHasLegacySymlinkUnder(this, path, pid);
670
678
  }
671
679
  async _rpcUtimes(path, atimeMs, mtimeMs, pid) {
672
680
  return _rpc._rpcUtimes(this, path, atimeMs, mtimeMs, pid);
673
681
  }
674
- async _rpcChmod(path, mode, pid) {
675
- return _rpc._rpcChmod(this, path, mode, pid);
682
+ async _rpcChmod(path, mode, pid, cred) {
683
+ return _rpc._rpcChmod(this, path, mode, pid, cred);
676
684
  }
677
685
  async _rpcAccess(path, mode, pid) {
678
686
  return _rpc._rpcAccess(this, path, mode, pid);
@@ -683,11 +691,11 @@ export class NimbusSession extends CloudflareDurableObject {
683
691
  async _rpcSetUmask(mask, pid) {
684
692
  return _rpc._rpcSetUmask(this, mask, pid);
685
693
  }
686
- async _rpcReaddir(path, pid) { return _rpc._rpcReaddir(this, path, pid); }
687
- async _rpcExists(path, pid) { return _rpc._rpcExists(this, path, pid); }
688
- async _rpcMkdir(path, pid) { return _rpc._rpcMkdir(this, path, pid); }
694
+ async _rpcReaddir(path, pid, cred) { return _rpc._rpcReaddir(this, path, pid, cred); }
695
+ async _rpcExists(path, pid, cred) { return _rpc._rpcExists(this, path, pid, cred); }
696
+ async _rpcMkdir(path, pid, cred) { return _rpc._rpcMkdir(this, path, pid, cred); }
689
697
  async _rpcRmdir(path, pid) { return _rpc._rpcRmdir(this, path, pid); }
690
- async _rpcRename(from, to, pid) { return _rpc._rpcRename(this, from, to, pid); }
698
+ async _rpcRename(from, to, pid, cred) { return _rpc._rpcRename(this, from, to, pid, cred); }
691
699
  async _rpcReadlink(path, pid) { return _rpc._rpcReadlink(this, path, pid); }
692
700
  async _rpcSymlink(target, path, pid) { return _rpc._rpcSymlink(this, target, path, pid); }
693
701
  async _rpcFsRevision(path, pid) { return _rpc._rpcFsRevision(this, path, pid); }
@@ -717,8 +725,8 @@ export class NimbusSession extends CloudflareDurableObject {
717
725
  return _rpc._rpcFsWrite(this, handleId, offset, bytes, pid);
718
726
  }
719
727
  async _rpcFsClose(handleId, pid) { return _rpc._rpcFsClose(this, handleId, pid); }
720
- async _rpcFsReadRange(path, offset, length, pid) {
721
- return _rpc._rpcFsReadRange(this, path, offset, length, pid);
728
+ async _rpcFsReadRange(path, offset, length, pid, cred) {
729
+ return _rpc._rpcFsReadRange(this, path, offset, length, pid, cred);
722
730
  }
723
731
  async _rpcFsReadRangeUncached(path, offset, length, pid) {
724
732
  return _rpc._rpcFsReadRangeUncached(this, path, offset, length, pid);
@@ -838,7 +846,15 @@ export class NimbusSession extends CloudflareDurableObject {
838
846
  async _rpcUnexposePort(port) { return _programmatic.rpcUnexposePort(this, port); }
839
847
  /** Capability-authenticated port route, for an embedder holding the token. */
840
848
  async _rpcRouteCapabilityPort(port, capability, request, innerPath) {
841
- return _routes.routeCapabilityPort(this, port, capability, request, innerPath);
849
+ return _portCapability.routeCapabilityPort(this, port, capability, request, innerPath);
850
+ }
851
+ /** The port route's dev-server restore, delegated — lives in routes.ts where the other session routes do. */
852
+ restorePersistedDevServer(onlyPort) {
853
+ return _routes.restorePersistedDevServer(this, onlyPort);
854
+ }
855
+ /** The port route's in-DO HMR accept, delegated — same reason. */
856
+ acceptCirrusHmrWs(request) {
857
+ return _routes.acceptCirrusHmrWs(this, request);
842
858
  }
843
859
  /**
844
860
  * The port route's recovery seam: a durable application journalled but
@@ -855,7 +871,11 @@ export class NimbusSession extends CloudflareDurableObject {
855
871
  this.ensureFacetManager();
856
872
  return this.facetManager.ensureDurableAppOnPort(port);
857
873
  }
858
- async _rpcDeleteFile(path, options) { return _programmatic.rpcDeleteFile(this, path, options); }
874
+ async _rpcDeleteFile(path, options, cred) { return _programmatic.rpcDeleteFile(this, path, options, cred); }
875
+ /** Colocated embedders only (DO stub); not on the remote dispatcher. See `rpcSpawnWorker`. */
876
+ async _rpcSpawnWorker(workerCode, command, cwd, opts) {
877
+ return _programmatic.rpcSpawnWorker(this, workerCode, command, cwd, opts);
878
+ }
859
879
  async _rpcDestroy(options) { return _programmatic.rpcDestroy(this, options); }
860
880
  // Legacy VFS (direct method calls)
861
881
  vfsReadFile(path) { return _rpc.vfsReadFile(this, path); }
@@ -944,6 +964,7 @@ export class NimbusSession extends CloudflareDurableObject {
944
964
  console.warn('[nimbus/W5] ring rehydrate failed:', e?.message);
945
965
  });
946
966
  }
967
+ return this.sqliteFs;
947
968
  }
948
969
  // ── W5 Lever 5: ring buffer persistence on DO storage ─────────────────
949
970
  // Storage key W5_RING_STORAGE_KEY lives in ./nimbus-session-keys.ts (S5).
@@ -967,72 +988,72 @@ export class NimbusSession extends CloudflareDurableObject {
967
988
  _w5PersistRing() {
968
989
  return _diag.persistRing(this, this.ctx);
969
990
  }
991
+ /** The session's esbuild facet pool provider; constructing it does no work. */
992
+ ensureBundlePool() {
993
+ if (!this.bundlePool)
994
+ this.bundlePool = new EsbuildBundlePool(this.env, this.ctx);
995
+ return this.bundlePool;
996
+ }
997
+ /**
998
+ * The session's FacetManager, composed through the one factory every host
999
+ * uses (`facets/compose.ts`). What is wired here is only what is the
1000
+ * session's: the terminal a spawn is announced on, the scrollback a notice
1001
+ * survives in, the alarm that grants a launch its next turn, and the exit
1002
+ * report that keeps the process table honest. The isolated esbuild
1003
+ * transform and the durable image-store fallback are the factory's.
1004
+ */
970
1005
  ensureFacetManager() {
971
- if (!this.facetManager) {
972
- this.facetManager = new FacetManager(this.ctx, this.env, this.processes, this.portRegistry, processHostFor, {
973
- onExternalExit: (pid, code, reason) => this._reportExternalExit(pid, code, reason),
974
- requestLaunchTurn: (notBefore) => { void this._scheduleLaunchTurn(notBefore); },
975
- notify: (line) => this._notifySession(line),
976
- transformLargeEsm: async (code, options) => {
977
- const loader = Reflect.get(this.env, 'LOADER');
978
- if (!loader || typeof loader.get !== 'function') {
979
- throw new Error('Nimbus: env.LOADER unavailable for isolated esbuild transform');
980
- }
981
- const assets = Reflect.get(this.env, 'ASSETS');
982
- if (!assets || typeof assets.fetch !== 'function') {
983
- throw new Error('Nimbus: env.ASSETS unavailable for isolated esbuild transform');
984
- }
985
- const worker = await loader.get(ESBUILD_TRANSFORM_WORKER_ID, async () => esbuildTransformWorkerCode(await fetchEsbuildWasmBytes({ ASSETS: assets })));
986
- const transformClass = worker.getDurableObjectClass('EsbuildTransformFacet');
987
- const facet = this.ctx.facets.get(`esbuild-transform-${ESBUILD_TRANSFORM_WORKER_ID}`, async () => ({ class: transformClass }));
988
- return facet.transform(code, options);
989
- },
990
- onSpawn: (pid, command, longRunning) => {
991
- const attachedTty = this.processes.get(pid)?.attachedTty === true;
992
- if (longRunning) {
993
- try {
994
- this.processes.openInput(pid);
1006
+ if (!this.facetManagerComposed) {
1007
+ // The manager is composed over the filesystem, so the filesystem comes
1008
+ // first. Cheap and idempotent; every caller already stood it up or is
1009
+ // about to.
1010
+ this.ensureSqliteFs();
1011
+ this.facetManagerComposed = composeFacetManager({
1012
+ ctx: this.ctx,
1013
+ env: this.env,
1014
+ processes: this.processes,
1015
+ portRegistry: this.portRegistry,
1016
+ vfs: this.sqliteFs,
1017
+ ...(this.esbuildService ? { esbuild: this.esbuildService } : {}),
1018
+ hooks: {
1019
+ onExternalExit: (pid, code, reason) => this._reportExternalExit(pid, code, reason),
1020
+ requestLaunchTurn: (notBefore) => { void this._scheduleLaunchTurn(notBefore); },
1021
+ notify: (line) => this._notifySession(line),
1022
+ onSpawn: (pid, command, longRunning) => {
1023
+ const attachedTty = this.processes.get(pid)?.attachedTty === true;
1024
+ if (longRunning) {
1025
+ try {
1026
+ this.processes.openInput(pid);
1027
+ }
1028
+ catch { }
995
1029
  }
996
- catch { }
997
- }
998
- // Only surface long-running / user-visible spawns to keep
999
- // the terminal uncluttered. Short `node <file>` evals also
1000
- // get a line because users want the pid for `logs`/`kill`.
1001
- if (!this.terminal)
1002
- return;
1003
- const label = longRunning ? 'started (long-running)' : 'started';
1004
- this.terminal.write(`\x1b[2m[facet ${label}: pid=${pid} cmd="${command}"]\x1b[0m\r\n`);
1005
- // Structured event so the tabs UI can auto-open a log tab
1006
- // for long-running processes (vite, wrangler dev, etc.).
1007
- notifyTerminalEvent(this.terminal, {
1008
- type: 'spawn', pid, command, longRunning, attachedTty,
1009
- });
1010
- },
1011
- // The fallback resolver a self-owned durable spawn re-drives
1012
- // through: read the image blobs the spawn persisted under
1013
- // `.nimbus/images/<sha256>` and restore the launch's env and
1014
- // modules from them. An embedder-owned launch answers its own
1015
- // bookkeeping through resolveWorkerLaunch instead — this hook is
1016
- // only the fallback for applications nobody else is keeping, and
1017
- // because it cannot re-mint a live globalOutbound binding the
1018
- // spawn path refuses such a launch under it.
1019
- resolveWorkerLaunchFallback: async (recipe) => {
1020
- this.ensureSqliteFs();
1021
- return resolveDurableWorkerImage(this.sqliteFs, recipe);
1030
+ // Only surface long-running / user-visible spawns to keep
1031
+ // the terminal uncluttered. Short `node <file>` evals also
1032
+ // get a line because users want the pid for `logs`/`kill`.
1033
+ if (!this.terminal)
1034
+ return;
1035
+ const label = longRunning ? 'started (long-running)' : 'started';
1036
+ this.terminal.write(`\x1b[2m[facet ${label}: pid=${pid} cmd="${command}"]\x1b[0m\r\n`);
1037
+ // Structured event so the tabs UI can auto-open a log tab
1038
+ // for long-running processes (vite, wrangler dev, etc.).
1039
+ notifyTerminalEvent(this.terminal, {
1040
+ type: 'spawn', pid, command, longRunning, attachedTty,
1041
+ });
1042
+ },
1022
1043
  },
1023
1044
  });
1024
1045
  }
1025
- if (this.facetManager && this.sqliteFs) {
1026
- this.facetManager.setVfs(this.sqliteFs);
1027
- // W3.5 Fix B: share the session's lazy esbuildService with the
1028
- // FacetManager so the bundle's ESM→CJS pre-pass doesn't pay
1029
- // wasm-init twice. If the session hasn't constructed one yet,
1030
- // FacetManager will lazy-create its own on first exec — same
1031
- // wasm bytes, same ~10ms init cost, just paid once per surface.
1032
- if (this.esbuildService) {
1033
- this.facetManager.setEsbuildService(this.esbuildService);
1034
- }
1046
+ const composed = this.facetManagerComposed;
1047
+ // W3.5 Fix B: share the session's lazy esbuildService with the
1048
+ // FacetManager so the bundle's ESM→CJS pre-pass doesn't pay
1049
+ // wasm-init twice. The session may construct it after the manager
1050
+ // exists, so the share is re-offered on every call; FacetManager
1051
+ // otherwise lazy-creates its own on first exec — same wasm bytes,
1052
+ // same ~10ms init cost, just paid once per surface.
1053
+ if (this.esbuildService) {
1054
+ composed.manager.setEsbuildService(this.esbuildService);
1035
1055
  }
1056
+ return composed;
1036
1057
  }
1037
1058
  /**
1038
1059
  * The supervisor-owned WebSocket relay. Lazy, because most sessions never
@@ -1074,29 +1095,29 @@ export class NimbusSession extends CloudflareDurableObject {
1074
1095
  try {
1075
1096
  const parsed = CpFacetDirectPayloadSchema.safeParse(JSON.parse(codeJson));
1076
1097
  if (!parsed.success) {
1077
- hooks.onStderr('child_process: facet dispatch requires a broker-assigned process pid\n');
1098
+ hooks.onStderr(textBytes('child_process: facet dispatch requires a broker-assigned process pid\n'));
1078
1099
  return 1;
1079
1100
  }
1080
1101
  payload = parsed.data;
1081
1102
  }
1082
1103
  catch {
1083
- hooks.onStderr('child_process: invalid facet dispatch payload\n');
1104
+ hooks.onStderr(textBytes('child_process: invalid facet dispatch payload\n'));
1084
1105
  return 1;
1085
1106
  }
1086
1107
  const registry = this._cpRegistry;
1087
1108
  if (!registry) {
1088
- hooks.onStderr('child_process: command registry unavailable\n');
1109
+ hooks.onStderr(textBytes('child_process: command registry unavailable\n'));
1089
1110
  return 127;
1090
1111
  }
1091
1112
  const commandName = normalizeCpCommandName(payload.command);
1092
1113
  const cmd = await registry.resolve(commandName);
1093
1114
  if (!cmd) {
1094
- hooks.onStderr(`${payload.command}: command not found\n`);
1115
+ hooks.onStderr(textBytes(`${payload.command}: command not found\n`));
1095
1116
  return 127;
1096
1117
  }
1097
1118
  // Synthesize a CommandContext for the internal shell substrate.
1098
- const stdoutStream = { write: (d) => hooks.onStdout(String(d)) };
1099
- const stderrStream = { write: (d) => hooks.onStderr(String(d)) };
1119
+ const stdoutStream = { write: (d) => hooks.onStdout(textBytes(String(d))) };
1120
+ const stderrStream = { write: (d) => hooks.onStderr(textBytes(String(d))) };
1100
1121
  const ac = new AbortController();
1101
1122
  const cred = this.processes.cred(payload.processPid);
1102
1123
  const ctx = {
@@ -1132,7 +1153,7 @@ export class NimbusSession extends CloudflareDurableObject {
1132
1153
  return typeof code === 'number' ? code : 0;
1133
1154
  }
1134
1155
  catch (e) {
1135
- hooks.onStderr(`${payload.command}: ${e?.message || String(e)}\n`);
1156
+ hooks.onStderr(textBytes(`${payload.command}: ${e?.message || String(e)}\n`));
1136
1157
  return 1;
1137
1158
  }
1138
1159
  },
@@ -1169,13 +1190,13 @@ export class NimbusSession extends CloudflareDurableObject {
1169
1190
  runPureBuiltin: async (pid, name, args, env, cwd, stdin, hooks) => {
1170
1191
  const registry = this._cpRegistry;
1171
1192
  if (!registry) {
1172
- hooks.onStderr('cp: registry unavailable\n');
1193
+ hooks.onStderr(textBytes('cp: registry unavailable\n'));
1173
1194
  return 127;
1174
1195
  }
1175
1196
  const commandName = normalizeCpCommandName(name);
1176
1197
  const cmd = await registry.resolve(commandName);
1177
1198
  if (!cmd) {
1178
- hooks.onStderr(`${name}: command not found\n`);
1199
+ hooks.onStderr(textBytes(`${name}: command not found\n`));
1179
1200
  return 127;
1180
1201
  }
1181
1202
  const cred = this.processes.cred(pid);
@@ -1185,8 +1206,8 @@ export class NimbusSession extends CloudflareDurableObject {
1185
1206
  cred,
1186
1207
  args, env, cwd,
1187
1208
  vfs: this.sqliteFs.as(cred),
1188
- stdout: { write: (d) => hooks.onStdout(String(d)) },
1189
- stderr: { write: (d) => hooks.onStderr(String(d)) },
1209
+ stdout: { write: (d) => hooks.onStdout(textBytes(String(d))) },
1210
+ stderr: { write: (d) => hooks.onStderr(textBytes(String(d))) },
1190
1211
  signal: ac.signal,
1191
1212
  stdin: staticStdinReader(stdin),
1192
1213
  setUmask: (mask) => { this.processes.setUmask(pid, mask); },
@@ -1209,7 +1230,7 @@ export class NimbusSession extends CloudflareDurableObject {
1209
1230
  return typeof code === 'number' ? code : 0;
1210
1231
  }
1211
1232
  catch (e) {
1212
- hooks.onStderr(`${name}: ${e?.message || String(e)}\n`);
1233
+ hooks.onStderr(textBytes(`${name}: ${e?.message || String(e)}\n`));
1213
1234
  return 1;
1214
1235
  }
1215
1236
  },
@@ -1234,7 +1255,7 @@ export class NimbusSession extends CloudflareDurableObject {
1234
1255
  shellExecutor: {
1235
1256
  execute: async (pid, commandLine, env, cwd, stdin, hooks) => {
1236
1257
  if (!this.shell) {
1237
- hooks.onStderr('sh: shell unavailable\n');
1258
+ hooks.onStderr(textBytes('sh: shell unavailable\n'));
1238
1259
  return 127;
1239
1260
  }
1240
1261
  const cred = this.processes.cred(pid);
@@ -1255,8 +1276,8 @@ export class NimbusSession extends CloudflareDurableObject {
1255
1276
  const result = await this.shell.execute(String(commandLine), {
1256
1277
  cwd: cwd || '/home/user',
1257
1278
  env: { ...this.shell.env, ...(env || {}) },
1258
- onStdout: (d) => hooks.onStdout(String(d)),
1259
- onStderr: (d) => hooks.onStderr(String(d)),
1279
+ onStdout: hooks.onStdout,
1280
+ onStderr: hooks.onStderr,
1260
1281
  stdin,
1261
1282
  isolateShellState: true,
1262
1283
  commandContext: { pid, cred, setUmask },
@@ -1417,11 +1438,13 @@ export class NimbusSession extends CloudflareDurableObject {
1417
1438
  }
1418
1439
  this.npmInstaller = new NpmInstaller(this.sqliteFs, this.ctx.storage.sql, {
1419
1440
  esbuild: this.esbuildService,
1441
+ bundlePool: this.ensureBundlePool(),
1420
1442
  ctx: this.ctx,
1421
1443
  env: this.env,
1422
1444
  onProgress,
1423
1445
  fetchFn,
1424
1446
  });
1447
+ return this.npmInstaller;
1425
1448
  }
1426
1449
  /**
1427
1450
  * Read an environment flag with default-on semantics. Mirrors the
@@ -1446,7 +1469,7 @@ export class NimbusSession extends CloudflareDurableObject {
1446
1469
  // command registrations + boot wiring). The class retains `initSession`
1447
1470
  // as a delegator per plan §IX.4 R1. Visibility relaxed (was `private`)
1448
1471
  // so the SessionInternal interface declares it.
1449
- initSession(ws) {
1472
+ initSession(ws, options) {
1450
1473
  // A destroyed session id being legitimately re-initialized (shell WS
1451
1474
  // attach, or SDK ready via ensureProgrammaticReady which routes here)
1452
1475
  // lifts the tombstone so the recreated session's log-janitor can arm
@@ -1455,8 +1478,14 @@ export class NimbusSession extends CloudflareDurableObject {
1455
1478
  // Cast pattern (per plan §IX recommendation 1, used here only because
1456
1479
  // initSession reads this.ctx + this.env extensively; siblings that need
1457
1480
  // ctx/env take them as separate explicit args per DEFECT-D1).
1458
- return _w11InitSession(this, ws);
1481
+ return _w11InitSession(this, ws, options);
1459
1482
  }
1483
+ /**
1484
+ * The rebuild in flight for a shell socket that woke this instance from
1485
+ * hibernation, so every frame that arrives while it runs awaits the one
1486
+ * build instead of starting its own. See session/ws.ts bindShellSocket.
1487
+ */
1488
+ _wakeRebuild = null;
1460
1489
  // ── Filesystem seeding ────────────────────────────────────────────────
1461
1490
  ensureGlobalPrefixDirs(prefix) {
1462
1491
  const fs = this.sqliteFs.as(CRED_SESSION_USER);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The worker's half of `npm install`: core's `npm` command parses the
3
+ * invocation, owns the pre-checks and the summary text, and hands the
4
+ * install itself to this port. What the port owns is everything the
5
+ * command must not know: the NpmInstaller, the global prefix's directory
6
+ * shape, and the materialisation of bin shims into <prefix>/bin.
7
+ *
8
+ * `projectDir` is always the shell's cwd; `globalPrefix` (absolute VFS
9
+ * path, e.g. `/usr/local`) is present only for `npm install -g` and says
10
+ * where `<prefix>/lib/node_modules` and `<prefix>/bin` land. `pid` is the
11
+ * running command's pid — it authorizes the batch-facet writes.
12
+ */
13
+ import type { NpmInstallPort } from '@nimbus-sh/core/substrate/lifo/commands/system/npm.js';
14
+ import type { SessionInternal } from './internal.js';
15
+ export declare function createNpmInstallPort(self: SessionInternal): NpmInstallPort;
16
+ //# sourceMappingURL=npm-install-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-install-port.d.ts","sourceRoot":"","sources":["../../src/session/npm-install-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AAI5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CAyC1E"}
@@ -0,0 +1,37 @@
1
+ import { CRED_KERNEL } from '@nimbus-sh/core/runtime/os-contracts.js';
2
+ import { materializeNpmBinShims } from '../npm/bin-links.js';
3
+ export function createNpmInstallPort(self) {
4
+ return {
5
+ async install(spec) {
6
+ const globalPrefix = spec.global ? spec.globalPrefix : undefined;
7
+ const globalBinDir = globalPrefix ? `${globalPrefix}/bin` : undefined;
8
+ const sqliteFs = self.ensureSqliteFs();
9
+ const installer = await self.ensureNpmInstaller();
10
+ if (globalPrefix)
11
+ self.ensureGlobalPrefixDirs(globalPrefix);
12
+ const installCwd = globalPrefix ? `${globalPrefix}/lib` : spec.projectDir;
13
+ const result = await installer.install(installCwd, {
14
+ packages: spec.packages.length > 0 ? [...spec.packages] : undefined,
15
+ production: spec.production,
16
+ pid: spec.pid,
17
+ npmLog: spec.npmLog ?? undefined,
18
+ onProgress: spec.onProgress,
19
+ });
20
+ let linkedBins = 0;
21
+ if (globalPrefix && globalBinDir) {
22
+ // Materialise on-PATH bin shims even for partial installs — the
23
+ // bin linker already skips entries whose target never landed, so
24
+ // a partial tree safely exposes exactly the bins that installed.
25
+ const vfs = sqliteFs.as(CRED_KERNEL);
26
+ linkedBins = materializeNpmBinShims(vfs, `${installCwd}/node_modules`, globalBinDir);
27
+ }
28
+ return {
29
+ installed: result.installed,
30
+ failed: result.failed,
31
+ totalFiles: result.totalFiles,
32
+ fromCacheHits: result.cachedHits,
33
+ linkedBins,
34
+ };
35
+ },
36
+ };
37
+ }
@@ -172,5 +172,49 @@ export declare function rotatePortCapability(self: PortCapabilityHost, port: num
172
172
  * port cannot reach the next one. An owner's reservation survives it.
173
173
  */
174
174
  export declare function clearPortCapability(self: PortCapabilityHost, port: number): Promise<void>;
175
+ /** The host surface `routeToSessionPort` actually reads — the narrowest shape that serves every port-addressed route. */
176
+ export interface SessionPortHost {
177
+ ctx: DurableObjectState;
178
+ portRegistry: PortRegistry;
179
+ ensureDurableAppOnPort?: (port: number) => Promise<'absent' | 'started' | 'failed'>;
180
+ _viteShimPort?: number | null;
181
+ viteDevServer?: {
182
+ isRunning: boolean;
183
+ handleRequest(request: Request, innerPath: string, mountBase: string): Promise<Response>;
184
+ } | null;
185
+ cirrusReal?: {
186
+ isRunning: boolean;
187
+ } | null;
188
+ restorePersistedDevServer?: (onlyPort?: number) => Promise<void>;
189
+ acceptCirrusHmrWs?: (request: Request) => Response;
190
+ }
191
+ export declare function normalizeForwardedHttpPath(path: string): string;
192
+ /** True if `innerPath` targets the cirrus-real HMR socket, under any mount base. */
193
+ export declare function isCirrusHmrPath(innerPath: string): boolean;
194
+ /**
195
+ * Re-adopt a preview capability the embedder already holds, after a restore
196
+ * re-registered the port under a freshly minted one.
197
+ */
198
+ export declare function readoptCapability(self: PortCapabilityHost, port: number, capability: string | null): Promise<void>;
199
+ /**
200
+ * Route a request to whatever is listening on a session port.
201
+ *
202
+ * The one implementation behind every port-addressed surface: `/port/<n>/`,
203
+ * `/preview/?port=N`, the `<port>--<sid>` preview hostname (which the router
204
+ * forwards as `/port/<n>/`), and the embedder's capability route. They
205
+ * differ only in how the port and the inner path are spelled, so they must
206
+ * not differ in what answers.
207
+ *
208
+ * `mountBase` is the public URL prefix the served app is mounted at for THIS
209
+ * request — '' for a root-mounted `<port>--<sid>` host, '/s/<sid>/preview' for
210
+ * the preview path. The in-process Cirrus dev server rewrites base-relative
211
+ * URLs (module URLs, <base href>, BASE_URL, router basename), so it is handed
212
+ * the base directly: the generic port proxy strips the Nimbus base header at
213
+ * the untrusted-code boundary and cannot carry it, and a plain user server on
214
+ * any other port is mounted at root and needs no rewriting.
215
+ */
216
+ export declare function routeToSessionPort(self: SessionPortHost, port: number, request: Request, innerPath: string, mountBase: string, capability?: string): Promise<Response>;
217
+ /** Route a capability-authenticated embedder request to a guest HTTP server. */
218
+ export declare function routeCapabilityPort(self: SessionPortHost, port: number, capability: string, request: Request, innerPath: string): Promise<Response>;
175
219
  export {};
176
220
  //# sourceMappingURL=port-capability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"port-capability.d.ts","sourceRoot":"","sources":["../../src/session/port-capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAG7E,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE;QACH,OAAO,EAA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