@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
@@ -23,6 +23,7 @@
23
23
  * keeps the owner's reservation; only `releasePortReservation` ends it.
24
24
  */
25
25
  import { z } from 'zod/v4';
26
+ import { PUBLIC_BEARER_HEADER, renderSessionStatusPage } from '../_shared/session-router.js';
26
27
  import { PORT_CAPABILITY_KEY_PREFIX } from './keys.js';
27
28
  /** The shape `createPortCapability` mints: 12 random bytes, hex. */
28
29
  const PortCapabilitySchema = z.string().regex(/^[a-f0-9]{24}$/);
@@ -304,3 +305,112 @@ export async function clearPortCapability(self, port) {
304
305
  await txn.delete(portRecordKey(port));
305
306
  });
306
307
  }
308
+ export function normalizeForwardedHttpPath(path) {
309
+ const text = path || '/';
310
+ return '/' + text.replace(/^\/+/, '');
311
+ }
312
+ /** True if `innerPath` targets the cirrus-real HMR socket, under any mount base. */
313
+ export function isCirrusHmrPath(innerPath) {
314
+ const p = innerPath.split('?')[0];
315
+ return p === '/__nimbus_hmr' || p.endsWith('/__nimbus_hmr');
316
+ }
317
+ /** The "durable application is (re)starting" 503 page — self-refreshing. */
318
+ function renderPortStartingHtml(port) {
319
+ return renderSessionStatusPage({
320
+ title: 'Starting',
321
+ heading: 'Starting…',
322
+ body: `The application on port <code>${port}</code> is restarting.<br>This page refreshes itself.`,
323
+ metaRefreshSeconds: 3,
324
+ });
325
+ }
326
+ /**
327
+ * Re-adopt a preview capability the embedder already holds, after a restore
328
+ * re-registered the port under a freshly minted one.
329
+ */
330
+ export async function readoptCapability(self, port, capability) {
331
+ if (!capability)
332
+ return;
333
+ if (self.portRegistry.restoreCapability(port, capability)) {
334
+ await persistPortCapability(self, port, capability);
335
+ }
336
+ }
337
+ /**
338
+ * Route a request to whatever is listening on a session port.
339
+ *
340
+ * The one implementation behind every port-addressed surface: `/port/<n>/`,
341
+ * `/preview/?port=N`, the `<port>--<sid>` preview hostname (which the router
342
+ * forwards as `/port/<n>/`), and the embedder's capability route. They
343
+ * differ only in how the port and the inner path are spelled, so they must
344
+ * not differ in what answers.
345
+ *
346
+ * `mountBase` is the public URL prefix the served app is mounted at for THIS
347
+ * request — '' for a root-mounted `<port>--<sid>` host, '/s/<sid>/preview' for
348
+ * the preview path. The in-process Cirrus dev server rewrites base-relative
349
+ * URLs (module URLs, <base href>, BASE_URL, router basename), so it is handed
350
+ * the base directly: the generic port proxy strips the Nimbus base header at
351
+ * the untrusted-code boundary and cannot carry it, and a plain user server on
352
+ * any other port is mounted at root and needs no rewriting.
353
+ */
354
+ export async function routeToSessionPort(self, port, request, innerPath, mountBase, capability) {
355
+ await self.restorePersistedDevServer?.(port);
356
+ // The durable seam: a request on a port nothing is serving may be a
357
+ // durable application a reset left dead — the alarm pump would re-drive
358
+ // it eventually, but a URL in someone's hands cannot wait for eventually.
359
+ // 'absent' falls through to the honest 502 unchanged; 'started' continues
360
+ // to normal routing with the port freshly bound; 'failed' is mid-launch
361
+ // or a lost boot, so the page re-asks on its own timer.
362
+ if (self.ensureDurableAppOnPort !== undefined) {
363
+ const durable = await self.ensureDurableAppOnPort(port);
364
+ if (durable === 'failed') {
365
+ return new Response(renderPortStartingHtml(port), {
366
+ status: 503,
367
+ headers: {
368
+ 'Content-Type': 'text/html; charset=utf-8',
369
+ 'Cache-Control': 'no-store',
370
+ 'Retry-After': '3',
371
+ },
372
+ });
373
+ }
374
+ }
375
+ if (capability !== undefined) {
376
+ // A rebuilt supervisor holds a capability nobody was handed; the durable
377
+ // one is the value in circulation, so it wins before the check.
378
+ await restorePortCapability(self, port);
379
+ if (!self.portRegistry.hasCapability(port, capability)) {
380
+ // 404, not 403: a wrong capability must not confirm that the port is
381
+ // listening at all.
382
+ return new Response('Not found', { status: 404 });
383
+ }
384
+ // The public bearer form arrived without a session attach: the
385
+ // capability is real, but it authorises this route only for a port the
386
+ // owner deliberately exposed — the stored visibility is the gate.
387
+ if (request.headers.get(PUBLIC_BEARER_HEADER) !== null) {
388
+ const reservation = await readPortReservation(self.ctx, port);
389
+ if (reservation === null || reservation.visibility !== 'public') {
390
+ return new Response('Not found', { status: 404 });
391
+ }
392
+ }
393
+ }
394
+ if (port === self._viteShimPort) {
395
+ // The preview HMR WebSocket can't cross the port-registry RPC, so it is
396
+ // accepted in-DO for both dev servers — the same handling `/preview/` uses.
397
+ if (self.cirrusReal?.isRunning && self.acceptCirrusHmrWs && isCirrusHmrPath(innerPath)) {
398
+ return self.acceptCirrusHmrWs(request);
399
+ }
400
+ // The Cirrus dev server rewrites base-relative URLs per request and the
401
+ // generic proxy strips the base header, so hand it the request directly.
402
+ if (self.viteDevServer?.isRunning) {
403
+ return self.viteDevServer.handleRequest(request, innerPath, mountBase);
404
+ }
405
+ }
406
+ const proxied = capability === undefined
407
+ ? await self.portRegistry.routeRequest(port, request, innerPath)
408
+ : await self.portRegistry.routeCapabilityRequest(port, capability, request, innerPath);
409
+ if (proxied)
410
+ return proxied;
411
+ return new Response(`No process listening on port ${port}`, { status: 502 });
412
+ }
413
+ /** Route a capability-authenticated embedder request to a guest HTTP server. */
414
+ export function routeCapabilityPort(self, port, capability, request, innerPath) {
415
+ return routeToSessionPort(self, port, request, normalizeForwardedHttpPath(innerPath), '', capability);
416
+ }
@@ -9,12 +9,13 @@ import { type MinShellRegistry } from '@nimbus-sh/core/runtime/installed-runtime
9
9
  import type { ProcessLogReadOptions } from '@nimbus-sh/core/runtime/process-logs.js';
10
10
  import { type TerminalLike } from '../runtime/process-logs-api.js';
11
11
  import { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
12
+ import type { ComposedFacetManager } from '../facets/compose.js';
12
13
  import { PortRegistry } from '@nimbus-sh/core/runtime/port-registry.js';
13
14
  import type { RuntimeCatalogEnv } from '../runtime/runtime-catalog.js';
14
15
  import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
15
16
  import { type VfsCred } from '@nimbus-sh/core/runtime/os-contracts.js';
16
17
  import { type PortVisibility } from './port-capability.js';
17
- import type { ResidentAppSummary, ResidentIdentity, ResidentRestartPolicy } from '../facets/manager.js';
18
+ import type { LongRunningWorkerSpawnOptions, ResidentAppSummary, ResidentIdentity, ResidentRestartPolicy, SpawnedWorker } from '../facets/manager.js';
18
19
  export interface ProgrammaticShell {
19
20
  env?: Record<string, string>;
20
21
  getEnv(): Record<string, string>;
@@ -26,8 +27,9 @@ export interface ProgrammaticShell {
26
27
  interface ProgrammaticShellExecuteOptions {
27
28
  cwd?: string;
28
29
  env?: Record<string, string>;
29
- onStdout?: (data: string) => void;
30
- onStderr?: (data: string) => void;
30
+ /** Bytes, as the shell's own ExecuteOptions: a process's stdio is bytes. */
31
+ onStdout?: (data: Uint8Array) => void;
32
+ onStderr?: (data: Uint8Array) => void;
31
33
  signal?: AbortSignal;
32
34
  stdin?: string;
33
35
  isolateShellState?: boolean;
@@ -66,6 +68,7 @@ interface ProgrammaticFacetManager {
66
68
  removeDurableApp(owner: string): Promise<boolean>;
67
69
  residentIdentity(pid: number): Promise<ResidentIdentity | null>;
68
70
  listResidentApps(): Promise<ResidentAppSummary[]>;
71
+ spawnWorker(workerCode: string, command: string, cwd: string, opts?: LongRunningWorkerSpawnOptions): Promise<SpawnedWorker>;
69
72
  }
70
73
  interface ProgrammaticViteServer {
71
74
  isRunning: boolean;
@@ -84,6 +87,7 @@ export interface ProgrammaticHost {
84
87
  sqliteFs: SqliteVFS | null;
85
88
  processes: SessionProcessSupervisor;
86
89
  portRegistry: PortRegistry;
90
+ facetManagerComposed: ComposedFacetManager | null;
87
91
  facetManager: ProgrammaticFacetManager | null;
88
92
  viteDevServer: ProgrammaticViteServer | null;
89
93
  cirrusReal: ProgrammaticCirrusServer | null;
@@ -102,6 +106,10 @@ export interface ProgrammaticHost {
102
106
  kernel?: unknown;
103
107
  facetProcessManager?: unknown;
104
108
  esbuildService?: unknown;
109
+ /** The session's esbuild facet pool; torn down with the installer and dev server. */
110
+ bundlePool?: {
111
+ dispose(): void;
112
+ } | null;
105
113
  nimbusWrangler?: unknown;
106
114
  npmInstaller?: unknown;
107
115
  fetchProxyEntrypoint?: unknown;
@@ -119,7 +127,7 @@ export interface ProgrammaticHost {
119
127
  _w9SchemaInit?: boolean;
120
128
  _w9WireProcessLogPersist?(): void;
121
129
  ensureSqliteFs(): void;
122
- ensureFacetManager(): void;
130
+ ensureFacetManager(): ComposedFacetManager;
123
131
  initSession(ws: WebSocket): Promise<void>;
124
132
  }
125
133
  export interface ProgrammaticReadyOptions {
@@ -381,6 +389,7 @@ export declare function rpcEnsureDurableApp(self: ProgrammaticHost, input: {
381
389
  owner: string;
382
390
  preferredPort?: number;
383
391
  visibility?: 'scoped' | 'public';
392
+ name?: string;
384
393
  }): Promise<{
385
394
  port: number;
386
395
  capability: string | null;
@@ -408,9 +417,26 @@ export declare function rpcRemoveDurableApp(self: ProgrammaticHost, owner: strin
408
417
  * so the guest's `Authorization` is preserved through this path and no other.
409
418
  */
410
419
  export declare function rpcRouteCapabilityPort(self: ProgrammaticHost, port: number, capability: string, request: Request, pathname: string): Promise<Response>;
420
+ /**
421
+ * `spawnWorker` for a colocated embedder holding the DO stub: boot the
422
+ * embedder's own Worker-class program — its main module, inline modules and
423
+ * content-addressed text/wasm modules — as one of this session's resident
424
+ * processes, and answer with the pid, the runner's boot payload and the
425
+ * process's facet (`fetch`/`connect`, bound to the resident handle; no
426
+ * release — `killProcess(pid)` ends it). Deliberately absent from the remote
427
+ * HTTP dispatcher: the facet is a live handle, and a remote token holder is
428
+ * not the embedder.
429
+ */
430
+ export declare function rpcSpawnWorker(self: ProgrammaticHost, workerCode: string, command: string, cwd: string, opts?: LongRunningWorkerSpawnOptions): Promise<SpawnedWorker>;
431
+ /**
432
+ * `files.delete`. Absent a `cred` this acts as CRED_KERNEL — what it has
433
+ * always done, and the embedder's trusted surface: only a caller holding the
434
+ * DO binding reaches it. A `cred` binds the removal to that identity instead,
435
+ * the same view `SqliteVFS.as(cred)` gives in-process.
436
+ */
411
437
  export declare function rpcDeleteFile(self: ProgrammaticHost, path: string, options?: {
412
438
  recursive?: boolean;
413
- }): Promise<void>;
439
+ }, cred?: VfsCred): Promise<void>;
414
440
  export declare function rpcDestroy(self: ProgrammaticHost, options?: ProgrammaticDestroyOptions): Promise<ProgrammaticDestroyResult>;
415
441
  export {};
416
442
  //# sourceMappingURL=programmatic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"programmatic.d.ts","sourceRoot":"","sources":["../../src/session/programmatic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,KAAK,EAAY,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACjG,OAAO,EAAE,YAAY,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B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAenB;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,6BAAkC,GACvC,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,EACrC,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,yBAAyB,CAAC,CA8EpC"}
@@ -11,17 +11,17 @@ import { PID_GEN_STRIDE } from '@nimbus-sh/core/runtime/process-table.js';
11
11
  import { notifyTerminalEvent } from '../runtime/process-logs-api.js';
12
12
  import { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
13
13
  import { PortRegistry, createPortCapability } from '@nimbus-sh/core/runtime/port-registry.js';
14
- import { CRED_KERNEL } from '@nimbus-sh/core/runtime/os-contracts.js';
14
+ import { CRED_KERNEL, requireVfsCred } from '@nimbus-sh/core/runtime/os-contracts.js';
15
15
  import { endProcessInput, resizeProcess, signalProcess, writeProcessInput, } from '@nimbus-sh/core/runtime/process-input-routing.js';
16
16
  import { z } from 'zod/v4';
17
17
  import { SESSION_DESTROYED_KEY, SHELL_STATE_KEY_PREFIX, VITE_CONFIG_KEY } from './keys.js';
18
- import { clearPortCapability, isValidAppName, persistPortCapability, PortRecordSchema, portRecordKey, readPortReservation, readPortReservationByName, readPortReservationByOwner, reservePort, restorePortCapability, rotatePortCapability, } from './port-capability.js';
19
- import { PORT_CAPABILITY_KEY_PREFIX } from './keys.js';
18
+ import { clearPortCapability, isValidAppName, persistPortCapability, portRecordKey, readPortReservation, readPortReservationByName, readPortReservationByOwner, reservePort, restorePortCapability, rotatePortCapability, } from './port-capability.js';
20
19
  import { bindPublicPortCapability, unbindPublicPortCapability } from '../router/public-directory.js';
21
20
  import { buildPreviewHost, buildPublicPreviewHost, isPreviewHostSafeSid, readPreviewHostSuffix, } from '../_shared/preview-host.js';
22
21
  import { RESTART_POLICY_ENV } from '../facets/manager.js';
23
22
  import { GENERATION_KEY, assumeGeneration, generation } from '@nimbus-sh/fabric/generation.js';
24
23
  import { HeadlessTerminal, Shell } from '@nimbus-sh/core/substrate/lifo/index.js';
24
+ import { textSink } from '@nimbus-sh/core/_shared/bytes.js';
25
25
  const ShellIdSchema = z.string().min(1).max(160).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/);
26
26
  const ShellStateSchema = z.object({
27
27
  cwd: z.string().startsWith('/'),
@@ -218,14 +218,13 @@ function startShellJob(self, command, options, job, scoped) {
218
218
  catch { /* already settled */ }
219
219
  });
220
220
  const emit = (stream, sink) => (data) => {
221
- const text = String(data);
222
221
  if (job.background) {
223
222
  try {
224
- self.processes.appendOutput(pid, stream, text);
223
+ self.processes.appendOutputBytes(pid, stream, data);
225
224
  }
226
225
  catch { /* ring gone */ }
227
226
  }
228
- sink?.(text);
227
+ sink?.(data);
229
228
  };
230
229
  const run = shell.execute(line, {
231
230
  // A named shell already holds its own cwd and env; passing them again
@@ -261,7 +260,20 @@ function startShellJob(self, command, options, job, scoped) {
261
260
  }
262
261
  catch { } } };
263
262
  }
263
+ /**
264
+ * The shell, process table and VFS all key on absolute POSIX paths. A
265
+ * relative `cwd` arriving here means a caller skipped its own boundary
266
+ * normalization (the SDK resolves it); handed to the shell it degrades to
267
+ * silently wrong cwd semantics and ENOENT writes. Name the field and fail.
268
+ */
269
+ function assertAbsoluteExecCwd(options) {
270
+ const cwd = options.cwd;
271
+ if (cwd !== undefined && (typeof cwd !== 'string' || !cwd.startsWith('/'))) {
272
+ throw new Error(`cwd must be an absolute POSIX path starting with '/', got ${JSON.stringify(cwd)}`);
273
+ }
274
+ }
264
275
  export async function rpcExec(self, command, options = {}) {
276
+ assertAbsoluteExecCwd(options);
265
277
  await ensureProgrammaticReady(self, options);
266
278
  return withShellState(self, options, false, (scoped) => execOnShell(self, command, options, scoped));
267
279
  }
@@ -273,8 +285,8 @@ async function execOnShell(self, command, options, scoped) {
273
285
  let timedOut = false;
274
286
  const job = startShellJob(self, command, options, {
275
287
  background: false,
276
- onStdout: (d) => stdout.push(d),
277
- onStderr: (d) => stderr.push(d),
288
+ onStdout: textSink((d) => stdout.push(d)),
289
+ onStderr: textSink((d) => stderr.push(d)),
278
290
  }, scoped);
279
291
  let result;
280
292
  try {
@@ -353,6 +365,7 @@ function collectJobOutput(self, pid) {
353
365
  * process surface (`listProcesses`, `processLogs`, `killProcess`).
354
366
  */
355
367
  export async function rpcStartProcess(self, command, options = {}) {
368
+ assertAbsoluteExecCwd(options);
356
369
  await ensureProgrammaticReady(self, options);
357
370
  if (options.restart !== undefined && options.restart !== 'never' && options.restart !== 'on-failure') {
358
371
  throw new Error(`startProcess: restart must be 'never' or 'on-failure', got ${String(options.restart)}`);
@@ -408,7 +421,15 @@ async function startOnShell(self, command, options, scoped) {
408
421
  * the handoff, the facet is the live process, and it reports its own exit.
409
422
  */
410
423
  function finishBackgroundJob(self, pid, command, exitCode) {
411
- if (exitCode === 0 && self.facetManager?.hasResidentProcess(pid))
424
+ // The shell line returned, but the pid may still be serving: a resident
425
+ // facet the node runner handed off under this pid, or an in-process dev
426
+ // server a builtin (`vite`) adopted this pid for and registered a port
427
+ // under. Either way the process is alive — marking it exited would put a
428
+ // dead pid on a live port, and the app verbs identify a server by the pid
429
+ // serving its port.
430
+ const stillServing = self.facetManager?.hasResidentProcess(pid) === true
431
+ || self.portRegistry.getAll().some((live) => live.pid === pid);
432
+ if (exitCode === 0 && stillServing)
412
433
  return;
413
434
  self.processes.exit(pid, exitCode);
414
435
  if (!self.processes.getExit(pid))
@@ -528,12 +549,9 @@ export async function rpcProcessLogs(self, pid, options = {}) {
528
549
  }
529
550
  export async function rpcListPorts(self) {
530
551
  await ensureProgrammaticReady(self);
531
- const entries = self.portRegistry.getAll();
532
- // Persisted at the moment the embedder is told the value, not at
533
- // registration: a capability nobody has been handed does not need to
534
- // survive anything.
535
- await Promise.all(entries.map((entry) => persistPortCapability(self, entry.port, entry.capability)));
536
- return entries.map(serializePort);
552
+ // The composed manager's copy is the one implementation — persistence
553
+ // at tell-time included.
554
+ return self.ensureFacetManager().apps.listPorts();
537
555
  }
538
556
  /**
539
557
  * Browser-facing URL for an application, built inside the session: the
@@ -612,8 +630,9 @@ export async function rpcExposeApp(self, target, options = {}) {
612
630
  throw new Error(`${describeTarget(target)} has not bound a port yet — expose it once it is listening`);
613
631
  }
614
632
  if (resolved.owner === null) {
615
- throw new Error(`${describeTarget(target)} has no launch record to bind an identity to — `
616
- + 'only journalled residents carry one; use ports.expose for a bare port');
633
+ // Every running process has an identity, so this is only a port nothing
634
+ // serves and no reservation names.
635
+ throw new Error(`nothing is serving ${describeTarget(target)} — start the server, then expose it`);
617
636
  }
618
637
  const exposed = await applyExposure(self, resolved.port, resolved.owner, options);
619
638
  const live = self.portRegistry.get(resolved.port);
@@ -791,7 +810,23 @@ export async function rpcRemoveApp(self, target) {
791
810
  if (resolved.owner === null) {
792
811
  throw new Error(`${describeTarget(target)} names no application — nothing to remove`);
793
812
  }
794
- return rpcRemoveDurableApp(self, resolved.owner);
813
+ const owner = resolved.owner;
814
+ // The manager's removal kills what the journal knows. A server nothing
815
+ // journalled — the dev servers above all — is found the way every verb
816
+ // finds it, by the identity of the pid serving a port, and ended through
817
+ // the session's own kill, which is the one that also stops an in-process
818
+ // dev server rather than only marking its pid dead.
819
+ const fm = self.facetManager;
820
+ let killed = 0;
821
+ for (const live of self.portRegistry.getAll()) {
822
+ const identity = await fm.residentIdentity(live.pid);
823
+ if (identity === null || identity.ephemeral || identity.owner !== owner)
824
+ continue;
825
+ if ((await rpcKillProcess(self, live.pid)).ok)
826
+ killed += 1;
827
+ }
828
+ const durable = await rpcRemoveDurableApp(self, owner);
829
+ return { ...durable, removed: durable.removed || killed > 0 };
795
830
  }
796
831
  function describeTarget(target) {
797
832
  if (typeof target === 'number')
@@ -873,7 +908,7 @@ async function resolveAppTarget(self, target) {
873
908
  if ('pid' in target) {
874
909
  const asPid = await byPid(Number(target.pid));
875
910
  if (asPid === null) {
876
- throw new Error(`pid ${target.pid} has no launch record — only journalled residents carry one`);
911
+ throw new Error(`pid ${target.pid} is not running and has no launch record`);
877
912
  }
878
913
  return asPid;
879
914
  }
@@ -898,32 +933,10 @@ async function resolveAppTarget(self, target) {
898
933
  */
899
934
  export async function rpcEnsureDurableApp(self, input) {
900
935
  await ensureProgrammaticReady(self);
901
- const owner = input.owner;
902
- if (typeof owner !== 'string' || owner.length === 0) {
903
- throw new Error('ensureDurableApp: owner must be a non-empty string');
904
- }
905
- const occupied = new Set(self.portRegistry.getAll().map((entry) => entry.port));
906
- const port = await reservePort(self.ctx, {
907
- owner,
908
- preferredPort: input.preferredPort,
909
- occupiedPorts: occupied,
910
- // Minted here, not at boot: the URL is built from this capability, and
911
- // re-drive re-adopts it out of the same row.
912
- capability: createPortCapability(),
913
- ...(input.visibility !== undefined ? { visibility: input.visibility } : {}),
914
- });
915
- const record = await readPortReservation(self.ctx, port);
916
- if (record?.visibility === 'public' && record.capability !== null) {
917
- // The URL is built on this capability before the app has ever run:
918
- // publish it to the directory now, loudly refusing a deployment whose
919
- // binding is missing rather than minting an unroutable URL.
920
- await bindPublicPortCapability(self, record.capability, port);
921
- }
922
- return {
923
- port,
924
- capability: record?.capability ?? null,
925
- visibility: record?.visibility ?? 'scoped',
926
- };
936
+ // The composed manager owns the durable-app verbs — one implementation,
937
+ // capability minted there so a URL handed out before boot is the one the
938
+ // eventual binding re-adopts.
939
+ return self.ensureFacetManager().apps.ensureDurableApp(input);
927
940
  }
928
941
  export async function rpcUnexposePort(self, port) {
929
942
  await ensureProgrammaticReady(self);
@@ -946,26 +959,8 @@ export async function rpcUnexposePort(self, port) {
946
959
  */
947
960
  export async function rpcRemoveDurableApp(self, owner) {
948
961
  await ensureProgrammaticReady(self);
949
- if (typeof owner !== 'string' || owner.length === 0) {
950
- throw new Error('removeDurableApp: owner must be a non-empty string');
951
- }
952
- // Which durable address is being released — the reservation's row names it
953
- // before the manager retires it.
954
- const rows = await self.ctx.storage.list({ prefix: PORT_CAPABILITY_KEY_PREFIX });
955
- let port = null;
956
- for (const [key, record] of rows) {
957
- const parsed = PortRecordSchema.safeParse(record);
958
- if (!parsed.success || parsed.data.owner !== owner)
959
- continue;
960
- const n = Number(key.slice(PORT_CAPABILITY_KEY_PREFIX.length));
961
- if (Number.isInteger(n) && n > 0) {
962
- port = n;
963
- break;
964
- }
965
- }
966
- self.ensureFacetManager();
967
- const removed = await self.facetManager.removeDurableApp(owner);
968
- return { owner, removed, port };
962
+ // The composed manager owns the durable-app verbs — validation included.
963
+ return self.ensureFacetManager().apps.removeDurableApp(owner);
969
964
  }
970
965
  /**
971
966
  * Route an embedder request that carries a port capability. The embedder has
@@ -983,10 +978,34 @@ export async function rpcRouteCapabilityPort(self, port, capability, request, pa
983
978
  const routed = await self.portRegistry.routeCapabilityRequest(Number(port), String(capability), request, pathname);
984
979
  return routed ?? new Response('Not found', { status: 404 });
985
980
  }
986
- export async function rpcDeleteFile(self, path, options = {}) {
981
+ /**
982
+ * `spawnWorker` for a colocated embedder holding the DO stub: boot the
983
+ * embedder's own Worker-class program — its main module, inline modules and
984
+ * content-addressed text/wasm modules — as one of this session's resident
985
+ * processes, and answer with the pid, the runner's boot payload and the
986
+ * process's facet (`fetch`/`connect`, bound to the resident handle; no
987
+ * release — `killProcess(pid)` ends it). Deliberately absent from the remote
988
+ * HTTP dispatcher: the facet is a live handle, and a remote token holder is
989
+ * not the embedder.
990
+ */
991
+ export async function rpcSpawnWorker(self, workerCode, command, cwd, opts = {}) {
992
+ await ensureProgrammaticReady(self);
993
+ if (typeof workerCode !== 'string' || workerCode.length === 0) {
994
+ throw new Error('spawnWorker: workerCode must be a non-empty string');
995
+ }
996
+ self.ensureFacetManager();
997
+ return self.facetManager.spawnWorker(workerCode, String(command), String(cwd), opts);
998
+ }
999
+ /**
1000
+ * `files.delete`. Absent a `cred` this acts as CRED_KERNEL — what it has
1001
+ * always done, and the embedder's trusted surface: only a caller holding the
1002
+ * DO binding reaches it. A `cred` binds the removal to that identity instead,
1003
+ * the same view `SqliteVFS.as(cred)` gives in-process.
1004
+ */
1005
+ export async function rpcDeleteFile(self, path, options = {}, cred) {
987
1006
  await ensureProgrammaticReady(self);
988
1007
  const p = String(path).replace(/^\/+/, '');
989
- const vfs = self.sqliteFs.as(CRED_KERNEL);
1008
+ const vfs = self.sqliteFs.as(cred === undefined ? CRED_KERNEL : requireVfsCred(cred, 'files.delete'));
990
1009
  if (!vfs.exists(p))
991
1010
  return;
992
1011
  if (vfs.isDirectory(p)) {
@@ -1212,10 +1231,17 @@ function resetInMemorySessionState(self) {
1212
1231
  self.shell = null;
1213
1232
  self.shellProcessPid = null;
1214
1233
  self.terminal = null;
1215
- self.facetManager = null;
1234
+ self.facetManagerComposed = null;
1216
1235
  self.facetProcessManager = null;
1217
1236
  self.esbuildService = null;
1218
1237
  self.viteDevServer = null;
1238
+ // The installer's pre-bundler and the dev server's on-demand path share
1239
+ // this pool; it goes when both of them go.
1240
+ try {
1241
+ self.bundlePool?.dispose();
1242
+ }
1243
+ catch { }
1244
+ self.bundlePool = null;
1219
1245
  self.cirrusReal = null;
1220
1246
  self._cirrusHmrWsClients = null;
1221
1247
  self.nimbusWrangler = null;
@@ -25,24 +25,22 @@
25
25
  */
26
26
  type RoutesHost = any;
27
27
  /**
28
- * Route a request to whatever is listening on a session port.
29
- *
30
- * The one implementation behind every port-addressed surface: `/port/<n>/`,
31
- * `/preview/?port=N`, and the `<port>--<sid>` preview hostname, which the
32
- * router forwards as `/port/<n>/`. They differ only in how the port and the
33
- * inner path are spelled, so they must not differ in what answers.
34
- *
35
- * `mountBase` is the public URL prefix the served app is mounted at for THIS
36
- * request — '' for a root-mounted `<port>--<sid>` host, '/s/<sid>/preview' for
37
- * the preview path. The in-process Cirrus dev server rewrites base-relative
38
- * URLs (module URLs, <base href>, BASE_URL, router basename), so it is handed
39
- * the base directly: the generic port proxy strips the Nimbus base header at
40
- * the untrusted-code boundary and cannot carry it, and a plain user server on
41
- * any other port is mounted at root and needs no rewriting.
28
+ * Restore the dev server a previous isolate left behind.
29
+ *
30
+ * Hibernation takes the ViteDevServer and the whole port registry with it;
31
+ * only the `vite-config` blob survives in DO storage. Restoring it is the
32
+ * first thing every route that can reach that server does, so a woken session
33
+ * serves on all of them rather than on whichever one happened to carry the
34
+ * restore.
35
+ *
36
+ * `onlyPort` scopes the restore to a config that would listen there: a
37
+ * request for a port nothing ever persisted stays an honest 502, and a port
38
+ * something else already holds is left alone.
39
+ *
40
+ * Idempotent, and silent on failure — a session with no dev server to restore
41
+ * is the normal case, not an error.
42
42
  */
43
- export declare function routeToSessionPort(self: RoutesHost, port: number, request: Request, innerPath: string, mountBase: string, capability?: string): Promise<Response>;
44
- /** Route a capability-authenticated embedder request to a guest HTTP server. */
45
- export declare function routeCapabilityPort(self: RoutesHost, port: number, capability: string, request: Request, innerPath: string): Promise<Response>;
43
+ export declare function restorePersistedDevServer(self: RoutesHost, onlyPort?: number): Promise<void>;
46
44
  /**
47
45
  * The name-addressed door: `/app/<name>/…` — what the scoped `<name>--<sid>`
48
46
  * host is forwarded as, and reachable in path form as `/s/<sid>/app/<name>/`.
@@ -52,6 +50,21 @@ export declare function routeCapabilityPort(self: RoutesHost, port: number, capa
52
50
  * nothing holds is a 404, never a guess.
53
51
  */
54
52
  export declare function routeToSessionApp(self: RoutesHost, name: string, request: Request, innerPath: string, capability?: string): Promise<Response>;
53
+ /**
54
+ * Accept a Vite HMR WebSocket for the running cirrus-real facet and wire it
55
+ * into the facet's HMR bridge.
56
+ *
57
+ * Handled in the DO, never through the port-registry proxy: that proxy moves a
58
+ * Request/Response over RPC and drops the `webSocket` handshake, so a HMR
59
+ * upgrade routed through it hangs. This is the ONE place a preview HMR socket
60
+ * is accepted — shared by the `/preview/` path and the `<port>--<sid>` host's
61
+ * `/port/N` route, so HMR works the same on both.
62
+ *
63
+ * ctx.acceptWebSocket (hibernatable) is required because HMR messages arrive
64
+ * from a DIFFERENT request context (the facet's long-poll RPC), and workerd
65
+ * forbids cross-request I/O on a `server.accept()`'d socket.
66
+ */
67
+ export declare function acceptCirrusHmrWs(self: RoutesHost, request: Request): Response;
55
68
  export declare function handleFetch(self: RoutesHost, request: Request): Promise<Response>;
56
69
  export {};
57
70
  //# sourceMappingURL=routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/session/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAyDH,KAAK,UAAU,GAAG,GAAG,CAAC;AA2HtB;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC,CAyDnB;AA2BD,gFAAgF;AAChF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAEnB;AAeD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB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