@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
@@ -45,11 +45,13 @@ export interface ExecStreamResult {
45
45
  }
46
46
  /**
47
47
  * Output chunk in a child's per-fd ring. Sequence numbers let parents
48
- * read incrementally with cpReadOutput(sinceSeq).
48
+ * read incrementally with cpReadOutput(sinceSeq). The data is bytes: a
49
+ * child's stdio is not text, and a string here would lose any byte sequence
50
+ * that is not valid UTF-8.
49
51
  */
50
52
  interface OutputChunk {
51
53
  seq: number;
52
- data: string;
54
+ data: Uint8Array;
53
55
  }
54
56
  /**
55
57
  * Per-child mutable state. Created on spawn, torn down only when the
@@ -65,11 +67,11 @@ interface ChildEntry {
65
67
  facetName: string;
66
68
  startedAt: number;
67
69
  endedAt: number | null;
68
- stdinChunks: string[];
70
+ stdinChunks: Uint8Array[];
69
71
  stdinClosed: boolean;
70
72
  stdinTotalBytes: number;
71
73
  stdinWaiters: Array<(r: {
72
- data: string;
74
+ data: Uint8Array;
73
75
  ended: boolean;
74
76
  }) => void>;
75
77
  outputs: {
@@ -116,26 +118,29 @@ export interface SpawnReq {
116
118
  export interface ReadOutputResult {
117
119
  chunks: {
118
120
  seq: number;
119
- data: string;
121
+ data: Uint8Array;
120
122
  }[];
121
123
  closed: boolean;
122
124
  maxSeq: number;
123
125
  }
124
126
  export interface DrainResult {
125
- stdout: string;
126
- stderr: string;
127
+ stdout: Uint8Array;
128
+ stderr: Uint8Array;
127
129
  stdoutClosed: boolean;
128
130
  stderrClosed: boolean;
129
131
  }
130
132
  /**
131
133
  * Hooks invoked by the inline runner / facet-direct runner to push
132
134
  * output back into the per-child ring. Kept as a small structural type
133
- * so tests can supply mocks.
135
+ * so tests can supply mocks. They carry bytes; a text producer encodes at
136
+ * its own edge (see `textBytes`).
134
137
  */
135
138
  export interface OutputHooks {
136
- onStdout: (data: string) => void;
137
- onStderr: (data: string) => void;
139
+ onStdout: (data: Uint8Array) => void;
140
+ onStderr: (data: Uint8Array) => void;
138
141
  }
142
+ /** A text producer's edge onto the byte hooks. */
143
+ export declare function textBytes(text: string): Uint8Array;
139
144
  /**
140
145
  * Command resolution. The shell registry returns whatever shape it likes;
141
146
  * we adapt to a normalized 3-state result.
@@ -186,10 +191,7 @@ export interface FacetProcessManagerDeps {
186
191
  };
187
192
  /** Optional Worker Loader pool for isolating child-process dispatch. */
188
193
  spawnPool?: {
189
- runOne: (req: any, kind: Exclude<CommandKind, 'unknown'>, hooks: {
190
- onStdout: (d: string) => void;
191
- onStderr: (d: string) => void;
192
- }) => Promise<number>;
194
+ runOne: (req: any, kind: Exclude<CommandKind, 'unknown'>, hooks: OutputHooks) => Promise<number>;
193
195
  };
194
196
  }
195
197
  /** Cap recursion depth to defend against runaway spawn loops. */
@@ -240,7 +242,7 @@ export declare class FacetProcessManager {
240
242
  private _drainStdinForShell;
241
243
  private _shellCommandLineForPlan;
242
244
  private _runShellLine;
243
- stdinWrite(childPid: number, data: string): {
245
+ stdinWrite(childPid: number, data: Uint8Array): {
244
246
  ok: boolean;
245
247
  };
246
248
  stdinEnd(childPid: number): void;
@@ -249,9 +251,11 @@ export declare class FacetProcessManager {
249
251
  * Returns immediately if data is already queued OR if stdin is closed.
250
252
  */
251
253
  cpReadStdin(childPid: number, waitMs: number): Promise<{
252
- data: string;
254
+ data: Uint8Array;
253
255
  ended: boolean;
254
256
  }>;
257
+ /** A broker-side text message onto the child's byte ring. */
258
+ private _appendText;
255
259
  /** Internal: push a chunk to fd 1 or 2, fire log-store + waiters. */
256
260
  private _appendOutput;
257
261
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/facets/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACtG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe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M,GAAG,IAAI,GAAG,IAAI;IAM3E;;;OAGG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAoB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAwBtI,mEAAmE;IACnE,IAAI,CAAC,QAAQ,SAAS,GAAG,MAAM;IAY/B,IAAI,KAAK;;;;;MAQR;IAED,qCAAqC;IACrC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;CAGpD"}
@@ -35,6 +35,23 @@
35
35
  */
36
36
  import { resolveVfsPath } from '@nimbus-sh/core/vfs/path.js';
37
37
  import { parseShellInvocation } from '@nimbus-sh/core/shell/shell-invocation.js';
38
+ import { enc, dec, StreamTextDecoders } from '@nimbus-sh/core/_shared/bytes.js';
39
+ /** A text producer's edge onto the byte hooks. */
40
+ export function textBytes(text) {
41
+ return enc.encode(text);
42
+ }
43
+ function concatBytes(chunks) {
44
+ let total = 0;
45
+ for (const c of chunks)
46
+ total += c.byteLength;
47
+ const joined = new Uint8Array(total);
48
+ let at = 0;
49
+ for (const c of chunks) {
50
+ joined.set(c, at);
51
+ at += c.byteLength;
52
+ }
53
+ return joined;
54
+ }
38
55
  /** Cap recursion depth to defend against runaway spawn loops. */
39
56
  export const CHILD_PROCESS_MAX_DEPTH = 8;
40
57
  /**
@@ -44,6 +61,7 @@ export const CHILD_PROCESS_MAX_DEPTH = 8;
44
61
  * signal (real Node would return false from .write).
45
62
  */
46
63
  const STDIN_QUEUE_MAX_BYTES = 256 * 1024; // 256 KiB
64
+ const EMPTY_BYTES = new Uint8Array(0);
47
65
  const STDIN_ATTACH_WAIT_MS = 500;
48
66
  /**
49
67
  * How long the parent's cpReadOutput long-poll waits for new chunks
@@ -189,7 +207,7 @@ export class FacetProcessManager {
189
207
  void this._dispatch(child, kind, dispatchReq).catch((e) => {
190
208
  // Last-resort: if both runners somehow throw, exit 1 with the error
191
209
  // on stderr.
192
- this._appendOutput(child, 2, `Error: ${e?.message || String(e)}\n`);
210
+ this._appendText(child, 2, `Error: ${e?.message || String(e)}\n`);
193
211
  this._stampExit(child, 1, null);
194
212
  });
195
213
  }, 0);
@@ -198,7 +216,7 @@ export class FacetProcessManager {
198
216
  /** Dispatch by kind. */
199
217
  async _dispatch(child, kind, req) {
200
218
  if (kind === 'unknown') {
201
- this._appendOutput(child, 2, `${req.command}: command not found\n`);
219
+ this._appendText(child, 2, `${req.command}: command not found\n`);
202
220
  this._stampExit(child, 127, null);
203
221
  return;
204
222
  }
@@ -236,7 +254,7 @@ export class FacetProcessManager {
236
254
  this._stampExit(child, code, null);
237
255
  }
238
256
  catch (e) {
239
- this._appendOutput(child, 2, `spawn-pool error: ${e?.message || String(e)}\n`);
257
+ this._appendText(child, 2, `spawn-pool error: ${e?.message || String(e)}\n`);
240
258
  this._stampExit(child, 1, null);
241
259
  }
242
260
  return;
@@ -257,7 +275,7 @@ export class FacetProcessManager {
257
275
  this._stampExit(child, code, null);
258
276
  }
259
277
  catch (e) {
260
- this._appendOutput(child, 2, `Error: ${e?.message || String(e)}\n`);
278
+ this._appendText(child, 2, `Error: ${e?.message || String(e)}\n`);
261
279
  this._stampExit(child, 1, null);
262
280
  }
263
281
  return;
@@ -281,7 +299,7 @@ export class FacetProcessManager {
281
299
  this._stampExit(child, code, null);
282
300
  }
283
301
  catch (e) {
284
- this._appendOutput(child, 2, `facet error: ${e?.message || String(e)}\n`);
302
+ this._appendText(child, 2, `facet error: ${e?.message || String(e)}\n`);
285
303
  this._stampExit(child, 1, null);
286
304
  }
287
305
  }
@@ -302,11 +320,14 @@ export class FacetProcessManager {
302
320
  if (kind === 'unknown') {
303
321
  return { exitCode: 127, stdout: '', stderr: `${req.command}: command not found\n` };
304
322
  }
323
+ // An inline result is text for a caller expecting text: decode here, at
324
+ // its edge, streaming per fd so a split multibyte character survives.
305
325
  let stdoutBuf = '';
306
326
  let stderrBuf = '';
327
+ const decoders = new StreamTextDecoders();
307
328
  const hooks = {
308
- onStdout: (d) => { stdoutBuf += d; },
309
- onStderr: (d) => { stderrBuf += d; },
329
+ onStdout: (d) => { stdoutBuf += decoders.decode(1, d); },
330
+ onStderr: (d) => { stderrBuf += decoders.decode(2, d); },
310
331
  };
311
332
  const childEnv = {
312
333
  ...(req.env || {}),
@@ -404,7 +425,9 @@ export class FacetProcessManager {
404
425
  if (!child.stdinClosed && child.stdinChunks.length > 0) {
405
426
  await this._waitForStdinEvent(child, STDIN_ATTACH_WAIT_MS);
406
427
  }
407
- return child.stdinChunks.join('');
428
+ // A pure builtin takes its stdin as text, so the decode happens here,
429
+ // at the consumer's edge, over the whole queued run at once.
430
+ return dec.decode(concatBytes(child.stdinChunks));
408
431
  }
409
432
  _shellPlanFor(req) {
410
433
  const args = Array.isArray(req.args) ? req.args.map(String) : [];
@@ -420,7 +443,7 @@ export class FacetProcessManager {
420
443
  async _dispatchShell(child, req, hooks) {
421
444
  const plan = this._shellPlanFor(req);
422
445
  if (!plan) {
423
- this._appendOutput(child, 2, `${req.command}: unsupported shell invocation\n`);
446
+ this._appendText(child, 2, `${req.command}: unsupported shell invocation\n`);
424
447
  this._stampExit(child, 127, null);
425
448
  return;
426
449
  }
@@ -435,7 +458,7 @@ export class FacetProcessManager {
435
458
  this._stampExit(child, typeof code === 'number' ? code : 0, null);
436
459
  }
437
460
  catch (e) {
438
- this._appendOutput(child, 2, `shell error: ${e?.message || String(e)}\n`);
461
+ this._appendText(child, 2, `shell error: ${e?.message || String(e)}\n`);
439
462
  this._stampExit(child, 1, null);
440
463
  }
441
464
  }
@@ -446,7 +469,8 @@ export class FacetProcessManager {
446
469
  if (!child.stdinClosed && child.stdinChunks.length > 0) {
447
470
  await this._waitForStdinEvent(child, STDIN_ATTACH_WAIT_MS);
448
471
  }
449
- return child.stdinChunks.join('');
472
+ // A shell line's stdin is text; the queue holds bytes.
473
+ return dec.decode(concatBytes(child.stdinChunks));
450
474
  }
451
475
  _shellCommandLineForPlan(plan, cwd, stdin, hooks, shellName, processPid) {
452
476
  if (plan.kind === 'command')
@@ -457,19 +481,19 @@ export class FacetProcessManager {
457
481
  try {
458
482
  const vfs = this.deps.vfsForProcess(processPid);
459
483
  if (!vfs.exists(scriptPath) || vfs.isDirectory(scriptPath)) {
460
- hooks.onStderr(`${shellName}: ${plan.path}: No such file or directory\n`);
484
+ hooks.onStderr(textBytes(`${shellName}: ${plan.path}: No such file or directory\n`));
461
485
  return null;
462
486
  }
463
487
  return vfs.readFileString(scriptPath);
464
488
  }
465
489
  catch (e) {
466
- hooks.onStderr(`${shellName}: ${plan.path}: ${e?.message || String(e)}\n`);
490
+ hooks.onStderr(textBytes(`${shellName}: ${plan.path}: ${e?.message || String(e)}\n`));
467
491
  return null;
468
492
  }
469
493
  }
470
494
  async _runShellLine(pid, commandLine, env, cwd, stdin, hooks) {
471
495
  if (!this.deps.shellExecutor) {
472
- hooks.onStderr('sh: shell executor unavailable\n');
496
+ hooks.onStderr(textBytes('sh: shell executor unavailable\n'));
473
497
  return 127;
474
498
  }
475
499
  return this.deps.shellExecutor.execute(pid, commandLine, env, cwd || '/home/user', stdin, hooks);
@@ -479,11 +503,14 @@ export class FacetProcessManager {
479
503
  const child = this.children.get(childPid);
480
504
  if (!child || child.stdinClosed || child.exitCode !== null)
481
505
  return { ok: false };
482
- if (child.stdinTotalBytes + data.length > STDIN_QUEUE_MAX_BYTES) {
506
+ // The cap counts BYTES. It used to count the string's UTF-16 code units,
507
+ // which undercounts any multibyte character and overcounts a surrogate
508
+ // pair, so the queue's own limit did not mean what it said.
509
+ if (child.stdinTotalBytes + data.byteLength > STDIN_QUEUE_MAX_BYTES) {
483
510
  return { ok: false };
484
511
  }
485
512
  child.stdinChunks.push(data);
486
- child.stdinTotalBytes += data.length;
513
+ child.stdinTotalBytes += data.byteLength;
487
514
  // Flush any waiters
488
515
  for (const w of child.stdinWaiters.splice(0)) {
489
516
  w({ data, ended: false });
@@ -496,7 +523,7 @@ export class FacetProcessManager {
496
523
  return;
497
524
  child.stdinClosed = true;
498
525
  for (const w of child.stdinWaiters.splice(0)) {
499
- w({ data: '', ended: true });
526
+ w({ data: EMPTY_BYTES, ended: true });
500
527
  }
501
528
  }
502
529
  /**
@@ -506,21 +533,21 @@ export class FacetProcessManager {
506
533
  async cpReadStdin(childPid, waitMs) {
507
534
  const child = this.children.get(childPid);
508
535
  if (!child)
509
- return { data: '', ended: true };
536
+ return { data: EMPTY_BYTES, ended: true };
510
537
  if (child.stdinChunks.length > 0) {
511
538
  const data = child.stdinChunks.shift();
512
- child.stdinTotalBytes -= data.length;
539
+ child.stdinTotalBytes -= data.byteLength;
513
540
  return { data, ended: false };
514
541
  }
515
542
  if (child.stdinClosed)
516
- return { data: '', ended: true };
543
+ return { data: EMPTY_BYTES, ended: true };
517
544
  // Long-poll
518
545
  return new Promise((resolve) => {
519
546
  const timer = setTimeout(() => {
520
547
  const idx = child.stdinWaiters.indexOf(wrapped);
521
548
  if (idx >= 0)
522
549
  child.stdinWaiters.splice(idx, 1);
523
- resolve({ data: '', ended: false });
550
+ resolve({ data: EMPTY_BYTES, ended: false });
524
551
  }, Math.min(waitMs, 5000));
525
552
  const wrapped = (r) => {
526
553
  clearTimeout(timer);
@@ -530,17 +557,21 @@ export class FacetProcessManager {
530
557
  });
531
558
  }
532
559
  // ── output queue ────────────────────────────────────────────────────────
560
+ /** A broker-side text message onto the child's byte ring. */
561
+ _appendText(child, fd, text) {
562
+ this._appendOutput(child, fd, textBytes(text));
563
+ }
533
564
  /** Internal: push a chunk to fd 1 or 2, fire log-store + waiters. */
534
565
  _appendOutput(child, fd, data) {
535
- if (!data)
566
+ if (data.byteLength === 0)
536
567
  return;
537
568
  child.outputSeq[fd]++;
538
569
  const chunk = { seq: child.outputSeq[fd], data };
539
570
  child.outputs[fd].push(chunk);
540
571
  // Tee to the process supervisor's log ring for `logs <pid>` parity
541
- // with facet processes.
572
+ // with facet processes; the ring decodes at its own edge.
542
573
  try {
543
- this.deps.processes.appendOutput(child.pid, fd === 1 ? 'stdout' : 'stderr', data);
574
+ this.deps.processes.appendOutputBytes(child.pid, fd === 1 ? 'stdout' : 'stderr', data);
544
575
  }
545
576
  catch { /* ignore */ }
546
577
  // Resolve waiters whose fd matches and whose sinceSeq is now satisfied.
@@ -610,7 +641,7 @@ export class FacetProcessManager {
610
641
  async drainOutput(childPid) {
611
642
  const child = this.children.get(childPid);
612
643
  if (!child) {
613
- return { stdout: '', stderr: '', stdoutClosed: true, stderrClosed: true };
644
+ return { stdout: EMPTY_BYTES, stderr: EMPTY_BYTES, stdoutClosed: true, stderrClosed: true };
614
645
  }
615
646
  // Wait briefly (up to 50ms) for the dispatch to settle if the child
616
647
  // hasn't exited yet — without this, drain races against the spawn's
@@ -620,8 +651,8 @@ export class FacetProcessManager {
620
651
  await new Promise((r) => setTimeout(r, 5));
621
652
  }
622
653
  return {
623
- stdout: child.outputs[1].map((c) => c.data).join(''),
624
- stderr: child.outputs[2].map((c) => c.data).join(''),
654
+ stdout: concatBytes(child.outputs[1].map((c) => c.data)),
655
+ stderr: concatBytes(child.outputs[2].map((c) => c.data)),
625
656
  stdoutClosed: child.exitCode !== null,
626
657
  stderrClosed: child.exitCode !== null,
627
658
  };
@@ -697,7 +728,7 @@ export class FacetProcessManager {
697
728
  // Wake stdin waiters with ended=true so a child blocked on cpReadStdin
698
729
  // unblocks and exits cleanly.
699
730
  for (const w of child.stdinWaiters.splice(0)) {
700
- w({ data: '', ended: true });
731
+ w({ data: EMPTY_BYTES, ended: true });
701
732
  }
702
733
  }
703
734
  /**
@@ -69,7 +69,7 @@
69
69
  * - Any file > MAX_FILE_BYTES (skipped with a diagnostic).
70
70
  *
71
71
  * Returns a Record<path, content>. Paths are absolute filesystem paths
72
- * as seen by Vite (/home/user/app/src/main.tsx).
72
+ * as seen by Vite (/home/user/example-app/src/main.tsx).
73
73
  */
74
74
  const MAX_FILE_BYTES = 256 * 1024; // 256 KB per file
75
75
  const MAX_TOTAL_USER_BYTES = 16 * 1024 * 1024; // 16 MB cap on USER project
@@ -1260,7 +1260,7 @@ ${Object.entries(cjsPrebuiltBundles).map(([pathPattern, code]) => ` [${JSON.str
1260
1260
  ]);
1261
1261
 
1262
1262
  /**
1263
- * Match an fs path like /home/user/app/node_modules/react/index.js
1263
+ * Match an fs path like /home/user/example-app/node_modules/react/index.js
1264
1264
  * against the pre-built bundle table. The keys in the table are
1265
1265
  * SUFFIXES — e.g. "/node_modules/react/index.js" — so a project
1266
1266
  * at any path resolves correctly.
@@ -23,6 +23,7 @@
23
23
  */
24
24
  import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
25
25
  import type { EsbuildService } from '@nimbus-sh/core/runtime/esbuild-service.js';
26
+ import type { BundlePoolProvider } from './esbuild-bundle-pool.js';
26
27
  export interface ViteDevServerOptions {
27
28
  vfs: SqliteVFS;
28
29
  esbuild: EsbuildService;
@@ -47,17 +48,18 @@ export interface ViteDevServerOptions {
47
48
  * the `// nimbus-no-basename` comment for per-file opt-out.
48
49
  */
49
50
  injectBasename?: boolean;
50
- /**
51
- * Worker bindings env. Required for the on-demand-bundle facet path
52
- * (LOADER + ctx.exports). When provided, /preview/@modules/<spec>
53
- * misses bundle in a IsolatePool isolate instead of the
54
- * supervisor's EsbuildService — same architecture as the
55
- * pre-bundle path. Without this option, the supervisor falls back
56
- * to in-process esbuild (legacy behaviour).
57
- */
51
+ /** Worker bindings env (ASSETS for vendored bundles). */
58
52
  env?: any;
59
- /** Durable Object state — needed alongside `env` for the facet pool. */
53
+ /** Durable Object state. */
60
54
  ctx?: DurableObjectState;
55
+ /**
56
+ * The session's esbuild facet pool, shared with the install-time
57
+ * pre-bundler. When provided, /preview/@modules/<spec> misses bundle in
58
+ * that pool's isolate instead of the supervisor's EsbuildService.
59
+ * Without it, the supervisor falls back to in-process esbuild (legacy
60
+ * behaviour used by callers without a LOADER binding).
61
+ */
62
+ bundlePool?: BundlePoolProvider;
61
63
  /**
62
64
  * process diagnostics support: when set, every diagnostic the dev server
63
65
  * would otherwise drop into Worker logs (console.warn / console.error)
@@ -78,9 +80,9 @@ export interface ViteDevServerOptions {
78
80
  * pre-bundles via the package they belong to).
79
81
  */
80
82
  interface HashImportCtx {
81
- /** VFS path of the importing file (e.g. `home/user/app/src/foo.ts`). */
83
+ /** VFS path of the importing file (e.g. `home/user/example-app/src/foo.ts`). */
82
84
  importerVfsPath: string;
83
- /** Project root (e.g. `home/user/app`). Used to clip the resolved
85
+ /** Project root (e.g. `home/user/example-app`). Used to clip the resolved
84
86
  * target to a /preview-relative URL. */
85
87
  root: string;
86
88
  /** VFS readers — kept narrow so callers don't have to expose the
@@ -128,15 +130,10 @@ export declare class ViteDevServer {
128
130
  private npmCache;
129
131
  /** Inject React Router basename into entry files? Default: true. */
130
132
  private injectBasename;
131
- /** Worker env (LOADER, ctx.exports) for the on-demand-bundle facet path.
132
- * Null = legacy in-supervisor esbuild fallback. */
133
133
  private env;
134
134
  private ctx;
135
- /** Lazily-constructed pool for on-demand bundling. Mirrors the
136
- * pre-bundle pool's wasm-modules-map shape. Created on first
137
- * cold-path /preview/@modules/<spec> request. */
138
- private onDemandPool;
139
- private onDemandPoolPromise;
135
+ /** The session's esbuild facet pool; null = legacy in-supervisor esbuild. */
136
+ private readonly bundlePool;
140
137
  /**
141
138
  * In-flight on-demand-bundle coalescing map. When the browser fires
142
139
  * multiple parallel requests for the same /preview/@modules/<spec>
@@ -154,21 +151,6 @@ export declare class ViteDevServer {
154
151
  * crashes the supervisor for N≥3 on a busy isolate.
155
152
  */
156
153
  private pendingBundles;
157
- /**
158
- * Byte-budget admission gate for the on-demand bundle slow path.
159
- * Replaces the former single-slot semaphore: instead of serializing
160
- * every cold bundle (which made a fresh-React first load multi-second
161
- * because each distinct /@modules/ spec waited for the previous), it
162
- * bounds the TOTAL slice BYTES resident in the supervisor at once.
163
- *
164
- * Many small slices' facet RPC round-trips overlap; a single large
165
- * (~28 MiB) slice still serializes the rest. Peak resident slice bytes
166
- * never exceed ON_DEMAND_SLICE_CAP_BYTES — the same one-slice envelope
167
- * the install-time pre-bundler proved safe on shared DO isolates — so
168
- * this is a latency win with no supervisor-heap regression. Coupled
169
- * with pendingBundles (same-spec coalescing) as before.
170
- */
171
- private onDemandGate;
172
154
  /**
173
155
  * process diagnostics support: the supervisor's per-PID log store. When set
174
156
  * (alongside `pid`), every diagnostic emitted by the dev server is
@@ -180,13 +162,11 @@ export declare class ViteDevServer {
180
162
  private logSink;
181
163
  constructor(opts: ViteDevServerOptions);
182
164
  /**
183
- * Lazily construct the IsolatePool used for on-demand bundling
184
- * of /preview/@modules/<spec> requests that miss both the in-memory
185
- * and pkg_esm_bundles caches. Mirrors the pre-bundle pool's
186
- * configuration: 1 worker, internal pLimit not needed (one bundle
187
- * per request), wasm shipped via wasmModules.
188
- *
189
- * Returns null when env/ctx aren't available (legacy fallback used).
165
+ * The session's shared esbuild pool for on-demand bundling of
166
+ * /preview/@modules/<spec> requests that miss both the in-memory and
167
+ * pkg_esm_bundles caches. Null when no pool was provided (legacy
168
+ * in-supervisor fallback). Acquired BEFORE the slice lease — see
169
+ * EsbuildBundlePool.acquire.
190
170
  */
191
171
  private ensureOnDemandPool;
192
172
  /** Detect TailwindCSS usage in the project */
@@ -271,13 +251,11 @@ export declare class ViteDevServer {
271
251
  * Cold path of serveModule: package resolution → on-demand facet
272
252
  * bundle (synthetic-entry for barrels) → hard-error if bundle fails.
273
253
  * NO CDN fallback (100% edge contract). Extracted so the coalescing
274
- * + gate wrapper in serveModule() reads cleanly. Always runs inside
275
- * the on-demand byte-budget gate — see serveModule's wrapper.
276
- *
277
- * `admit` reserves the built slice's real byte size against the gate's
278
- * budget and releases the build lock for the next spec. It is called
279
- * exactly once, right after the slice is built and before the facet
280
- * submit; bail-out paths that never build a slice simply never call it.
254
+ * wrapper in serveModule() reads cleanly. The slice this body builds is
255
+ * leased from the shared supervisor allocation budget for its worst
256
+ * case before it is built, shrunk to its real size once built, and
257
+ * released only after the facet result has been rewritten, cached and
258
+ * wrapped in the Response — the pre-bundler's per-slice pattern.
281
259
  */
282
260
  private serveModuleCold;
283
261
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"vite-dev-server.d.ts","sourceRoot":"","sources":["../../src/facets/vite-dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAGpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AA2BjF,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,qFAAqF;IACrF,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,wEAAwE;IACxE,GAAG,CAAC,EAAE,kBAAkB,CAAC;IACzB;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE;QAAE,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,E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