@nimbus-sh/worker 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/esbuild-wasm-bundle.generated.d.ts +1 -1
  2. package/dist/esbuild-wasm-bundle.generated.js +1 -1
  3. package/dist/facets/cirrus-real.js +1 -1
  4. package/dist/facets/manager.d.ts +8 -8
  5. package/dist/facets/manager.d.ts.map +1 -1
  6. package/dist/facets/manager.js +23 -18
  7. package/dist/facets/opencode-staging.d.ts.map +1 -1
  8. package/dist/facets/opencode-staging.js +3 -4
  9. package/dist/facets/real-vite-hmr.js +1 -1
  10. package/dist/facets/vite-dev-server.d.ts +4 -4
  11. package/dist/facets/vite-dev-server.js +5 -5
  12. package/dist/git/network-facet.d.ts.map +1 -1
  13. package/dist/git/network-facet.js +6 -5
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +9 -1
  16. package/dist/loaders/child-process/spawn-facet.js +1 -1
  17. package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
  18. package/dist/loaders/child-process/spawn-pool.js +2 -2
  19. package/dist/loaders/generated-workers.d.ts +2 -2
  20. package/dist/loaders/generated-workers.d.ts.map +1 -1
  21. package/dist/loaders/generated-workers.js +3 -3
  22. package/dist/loaders/npm-resolve-preamble.d.ts +3 -3
  23. package/dist/loaders/npm-resolve-preamble.js +3 -3
  24. package/dist/loaders/pre-bundle-preamble.d.ts +5 -5
  25. package/dist/loaders/pre-bundle-preamble.js +6 -6
  26. package/dist/npm/install-batch-facet.d.ts +1 -1
  27. package/dist/npm/install-batch-facet.js +1 -1
  28. package/dist/npm/installer.d.ts +6 -6
  29. package/dist/npm/installer.d.ts.map +1 -1
  30. package/dist/npm/installer.js +28 -27
  31. package/dist/npm/pre-bundle-facet.d.ts +2 -2
  32. package/dist/npm/pre-bundle-facet.js +5 -5
  33. package/dist/npm/r2-cache.d.ts +1 -1
  34. package/dist/npm/resolve-facet.d.ts +1 -1
  35. package/dist/npm/resolve-facet.js +1 -1
  36. package/dist/npm/resolve-one-facet.d.ts +5 -5
  37. package/dist/npm/resolve-one-facet.js +5 -5
  38. package/dist/router/index.js +2 -2
  39. package/dist/router/remote-api.js +1 -1
  40. package/dist/runtime/bun-repl.d.ts +1 -1
  41. package/dist/runtime/bun-repl.js +3 -3
  42. package/dist/runtime/esbuild-wasm-bytes.js +1 -1
  43. package/dist/runtime/facet-loader-host.d.ts +2 -2
  44. package/dist/runtime/facet-loader-host.js +3 -3
  45. package/dist/runtime/node-repl.js +2 -2
  46. package/dist/runtime/node-shims-artifact.js +1 -1
  47. package/dist/runtime/node-shims.js +2 -1
  48. package/dist/runtime/opencode-artifact.js +1 -1
  49. package/dist/runtime/opentui-wasm-bytes.js +1 -1
  50. package/dist/runtime/python-repl.js +3 -3
  51. package/dist/runtime/ruby-repl.js +2 -2
  52. package/dist/runtime/sqlite-wasm-bytes.js +1 -1
  53. package/dist/session/diag.js +1 -1
  54. package/dist/session/hibernation.d.ts +8 -8
  55. package/dist/session/hibernation.d.ts.map +1 -1
  56. package/dist/session/hibernation.js +15 -15
  57. package/dist/session/init-phases.d.ts +2 -3
  58. package/dist/session/init-phases.d.ts.map +1 -1
  59. package/dist/session/init-phases.js +3 -2
  60. package/dist/session/init.d.ts.map +1 -1
  61. package/dist/session/init.js +5 -4
  62. package/dist/session/keys.d.ts.map +1 -1
  63. package/dist/session/keys.js +4 -3
  64. package/dist/session/nimbus-session.d.ts +4 -15
  65. package/dist/session/nimbus-session.d.ts.map +1 -1
  66. package/dist/session/nimbus-session.js +16 -28
  67. package/dist/session/programmatic.d.ts +0 -2
  68. package/dist/session/programmatic.d.ts.map +1 -1
  69. package/dist/session/programmatic.js +8 -9
  70. package/dist/session/routes.d.ts.map +1 -1
  71. package/dist/session/routes.js +19 -18
  72. package/dist/session/rpc.d.ts +7 -7
  73. package/dist/session/rpc.d.ts.map +1 -1
  74. package/dist/session/rpc.js +20 -19
  75. package/dist/session/start-real-vite.js +1 -1
  76. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  77. package/dist/session/supervisor-rpc.js +7 -9
  78. package/dist/session/ws.d.ts +1 -3
  79. package/dist/session/ws.d.ts.map +1 -1
  80. package/dist/session/ws.js +4 -3
  81. package/package.json +4 -3
  82. package/scripts/bundle-esbuild-wasm.mjs +2 -2
  83. package/scripts/bundle-facet-workers.mjs +5 -7
  84. package/scripts/bundle-sqlite-wasm.mjs +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * pre-bundle-facet.ts — LoaderPool entry for esbuild pre-bundling.
2
+ * pre-bundle-facet.ts — IsolatePool entry for esbuild pre-bundling.
3
3
  *
4
4
  * Why this exists
5
5
  * ───────────────
@@ -14,7 +14,7 @@
14
14
  * the previous isolate.
15
15
  *
16
16
  * The fix is to dispatch each per-specifier `esbuild.build` to a
17
- * LoaderPool isolate. Each facet has its own 128 MB budget and
17
+ * IsolatePool isolate. Each facet has its own 128 MB budget and
18
18
  * stable-slot reuse keeps the warm-up cost amortized across the 8
19
19
  * concurrent specs of a typical install. The install-batch facet uses
20
20
  * the same isolate boundary for tarball extraction.
@@ -181,7 +181,7 @@ export function externalsForSpecifier(specifier) {
181
181
  }
182
182
  // ── Facet function ──────────────────────────────────────────────────────
183
183
  //
184
- // `prebundleOne` runs inside a LoaderPool isolate. cloudflare-parallel
184
+ // `prebundleOne` runs inside a IsolatePool isolate. cloudflare-parallel
185
185
  // serialises it via fn.toString(); the helpers it references at module
186
186
  // scope (ESBUILD_WASM_JS_FN_BODY, resolvePackageEntry) are NOT in the
187
187
  // facet's lexical scope at runtime. Instead they're injected by the
@@ -250,7 +250,7 @@ export const prebundleOne = async function prebundleOne(spec, _env) {
250
250
  // runs that at module-load time (where eval is permitted) and
251
251
  // stashes the result on the module-scope const __NIMBUS_ESBUILD_NS.
252
252
  //
253
- // The WASM module is shipped into the facet via LoaderPool's
253
+ // The WASM module is shipped into the facet via IsolatePool's
254
254
  // `wasmModules` option, registered in the LOADER's modules map as
255
255
  // { wasm: ArrayBuffer }. Workerd compiles it during the worker's
256
256
  // module-load phase (eval permitted there), and the pool's
@@ -285,7 +285,7 @@ export const prebundleOne = async function prebundleOne(spec, _env) {
285
285
  if (!initPromise) {
286
286
  initPromise = (async () => {
287
287
  // Read the WebAssembly.Module the pool registered. The key matches
288
- // the name passed to LoaderPool's `wasmModules` option (see
288
+ // the name passed to IsolatePool's `wasmModules` option (see
289
289
  // src/npm-installer.ts:prebundleUsedModules dispatch site).
290
290
  const wasmRegistry = globalThis.__NIMBUS_WASM;
291
291
  const wasmModule = wasmRegistry && wasmRegistry['esbuild.wasm'];
@@ -220,7 +220,7 @@ export declare function packumentKey(name: string): string;
220
220
  * proving the L2 layer is functional even when local-dev wall-clock
221
221
  * latency is too noisy to demonstrate 5×.
222
222
  *
223
- * Diag counters (src/observability/diag-counters.ts) bump for the
223
+ * Diag counters (@nimbus-sh/platform/diag-counters.js) bump for the
224
224
  * SupervisorRPC layer (RPC-perspective hit/miss). These per-instance
225
225
  * counters bump for the R2CacheClient call surface itself (L2 vs L3
226
226
  * vs miss), independent of who's calling.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * resolve-facet.ts — shared wire types for the per-packument resolver facet.
3
3
  *
4
- * The npm resolver phase runs inside a LoaderPool isolate so the
4
+ * The npm resolver phase runs inside a IsolatePool isolate so the
5
5
  * supervisor DO heap stays flat while large packuments are decoded. The
6
6
  * per-packument task body lives in resolve-one-facet.ts; this module holds
7
7
  * the types exchanged between supervisor and facet over RPC.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * resolve-facet.ts — shared wire types for the per-packument resolver facet.
3
3
  *
4
- * The npm resolver phase runs inside a LoaderPool isolate so the
4
+ * The npm resolver phase runs inside a IsolatePool isolate so the
5
5
  * supervisor DO heap stays flat while large packuments are decoded. The
6
6
  * per-packument task body lives in resolve-one-facet.ts; this module holds
7
7
  * the types exchanged between supervisor and facet over RPC.
@@ -7,10 +7,10 @@
7
7
  * independent fanout tasks. This file is the per-task body: one packument
8
8
  * fetch, one version pick, and edge extraction.
9
9
  *
10
- * Each task runs inside a Worker Loader isolate (FanoutPool routes
10
+ * Each task runs inside a Worker Loader isolate (Fanout routes
11
11
  * automatically: <5 = in-DO, ≥5 = peer-DO). The isolate is short-lived;
12
12
  * task body has its own ~128 MiB envelope. Parallelism = layer width
13
- * (capped at 32 by FanoutPool's MAX_PEER_FANOUT).
13
+ * (capped at 32 by Fanout's MAX_PEER_FANOUT).
14
14
  *
15
15
  * Stability invariants (cloudflare-parallel serialises via fn.toString)
16
16
  * ───────────────────────────────────────────────────────────────────
@@ -180,13 +180,13 @@ export interface ResolveOneResult {
180
180
  }
181
181
  /**
182
182
  * Per-package fanout task body. Serialised via fn.toString() and
183
- * dispatched by FanoutPool.submitMany — see installer.ts
183
+ * dispatched by Fanout.submitMany — see installer.ts
184
184
  * resolveTreeViaFanout.
185
185
  *
186
- * Function signature MUST be `(spec, env)` so FanoutPool's
186
+ * Function signature MUST be `(spec, env)` so Fanout's
187
187
  * submitMany invocation `fn(item, env)` lines up.
188
188
  *
189
- * `env` is the loader-isolate env supplied by FanoutPool.
189
+ * `env` is the loader-isolate env supplied by Fanout.
190
190
  * `env.SUPERVISOR` is the supervisor-rpc binding (putRegistryEntries,
191
191
  * getPackument).
192
192
  */
@@ -7,10 +7,10 @@
7
7
  * independent fanout tasks. This file is the per-task body: one packument
8
8
  * fetch, one version pick, and edge extraction.
9
9
  *
10
- * Each task runs inside a Worker Loader isolate (FanoutPool routes
10
+ * Each task runs inside a Worker Loader isolate (Fanout routes
11
11
  * automatically: <5 = in-DO, ≥5 = peer-DO). The isolate is short-lived;
12
12
  * task body has its own ~128 MiB envelope. Parallelism = layer width
13
- * (capped at 32 by FanoutPool's MAX_PEER_FANOUT).
13
+ * (capped at 32 by Fanout's MAX_PEER_FANOUT).
14
14
  *
15
15
  * Stability invariants (cloudflare-parallel serialises via fn.toString)
16
16
  * ───────────────────────────────────────────────────────────────────
@@ -61,13 +61,13 @@
61
61
  */
62
62
  /**
63
63
  * Per-package fanout task body. Serialised via fn.toString() and
64
- * dispatched by FanoutPool.submitMany — see installer.ts
64
+ * dispatched by Fanout.submitMany — see installer.ts
65
65
  * resolveTreeViaFanout.
66
66
  *
67
- * Function signature MUST be `(spec, env)` so FanoutPool's
67
+ * Function signature MUST be `(spec, env)` so Fanout's
68
68
  * submitMany invocation `fn(item, env)` lines up.
69
69
  *
70
- * `env` is the loader-isolate env supplied by FanoutPool.
70
+ * `env` is the loader-isolate env supplied by Fanout.
71
71
  * `env.SUPERVISOR` is the supervisor-rpc binding (putRegistryEntries,
72
72
  * getPackument).
73
73
  */
@@ -35,7 +35,7 @@ import { generateSessionId, isValidSessionId, } from '../_shared/session-id.js';
35
35
  import { buildPreviewHost, isPreviewHostSafeSid, parsePreviewHost, readPreviewHostSuffix, } from '../_shared/preview-host.js';
36
36
  import { parseSessionRoute, forwardToSession, renderInvalidSessionHtml, SESSION_ROUTE_PREFIX, LEGACY_PUBLIC_DO_SEGMENT, } from '../_shared/session-router.js';
37
37
  import { issueNimbusToken, verifyNimbusToken, verifyRequestToken, requireScopes, requireSessionPin, authErrorResponse, setNimbusTokenCookie, NIMBUS_TOKEN_QUERY, NimbusAuthError, NimbusBootstrapConsumedError, NimbusTokenClaimsError, DEFAULT_TOKEN_TTL_MS, ATTACH_BOOTSTRAP_TTL_MS, } from '../auth/index.js';
38
- import { setCtxExports } from '@nimbus-sh/fabric/ctx-exports.js';
38
+ import { adoptCtxExports } from '@nimbus-sh/fabric/composition.js';
39
39
  import { handleNimbusRemoteApi, } from './remote-api.js';
40
40
  import { parseAgentOAuthStateParam } from '../session/agent.js';
41
41
  /**
@@ -82,7 +82,7 @@ export function createNimbusHandler(options = {}) {
82
82
  async function route(request, env, ctx) {
83
83
  // Capture ctx.exports on first call (loopback bindings for facets).
84
84
  if (ctx?.exports)
85
- setCtxExports(ctx.exports);
85
+ adoptCtxExports(ctx.exports);
86
86
  const url = new URL(request.url);
87
87
  const previewSuffix = readPreviewHostSuffix(env);
88
88
  // ── <port>--<sid>.<suffix> — port preview ───────────────────────
@@ -1,7 +1,7 @@
1
1
  import { LEGACY_PUBLIC_DO_SEGMENT, } from '../_shared/session-router.js';
2
2
  import { z } from 'zod/v4';
3
3
  import { requireScopes, requireSessionPin, verifyRequestToken, NimbusAuthError, isNimbusIdComponent, } from '../auth/index.js';
4
- import { useRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
4
+ import { useRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
5
5
  const DEFAULT_REMOTE_BASE_PATH = '/api/nimbus/v1';
6
6
  const RemoteRpcBodySchema = z.object({
7
7
  profile: z.string().optional(),
@@ -7,7 +7,7 @@
7
7
  * functions / imports persist.
8
8
  *
9
9
  * Design:
10
- * - One child-facet per REPL session (LoaderPool with
10
+ * - One child-facet per REPL session (IsolatePool with
11
11
  * concurrency=1, omitSupervisor=true).
12
12
  * - Facet-side: globalThis.__nimbus_bun_ctx caches a vm.createContext()
13
13
  * dict; each push() runs vm.runInContext(line, ctx) and returns
@@ -7,7 +7,7 @@
7
7
  * functions / imports persist.
8
8
  *
9
9
  * Design:
10
- * - One child-facet per REPL session (LoaderPool with
10
+ * - One child-facet per REPL session (IsolatePool with
11
11
  * concurrency=1, omitSupervisor=true).
12
12
  * - Facet-side: globalThis.__nimbus_bun_ctx caches a vm.createContext()
13
13
  * dict; each push() runs vm.runInContext(line, ctx) and returns
@@ -125,8 +125,8 @@ class BunReplAdapter {
125
125
  // Preamble: install the Bun shim global at facet startup so the
126
126
  // REPL context has Bun.* available like real Bun does.
127
127
  const preamble = BUN_SHIM_PREAMBLE;
128
- const { LoaderPool } = await import('@nimbus-sh/fabric/loader-pool.js');
129
- this.pool = new LoaderPool(env, ctx, {
128
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
129
+ this.pool = new IsolatePool(env, ctx, {
130
130
  tag: 'bun-repl',
131
131
  concurrency: 1,
132
132
  omitSupervisor: true,
@@ -43,7 +43,7 @@
43
43
  */
44
44
  import { ESBUILD_VERSION } from '@nimbus-sh/core/constants.js';
45
45
  import { ESBUILD_WASM_SHA256 } from '../esbuild-wasm-bundle.generated.js';
46
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
46
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
47
47
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
48
48
  /**
49
49
  * Path inside env.ASSETS where the esbuild-wasm binary lives.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The workerd {@link FacetHost}: a facet is a dynamic worker.
3
3
  *
4
- * The whole adapter is the option renames below, because `LoaderPool`
4
+ * The whole adapter is the option renames below, because `IsolatePool`
5
5
  * already IS the port's shape — `submit` and `dispose`, with the same meanings.
6
6
  * The one thing it spells differently is the supervisor capability, which it
7
7
  * takes as a pid plus a separate flag saying whether to bind one at all; the
@@ -13,7 +13,7 @@ import type { FacetHost } from '@nimbus-sh/core/runtime/facet-host.js';
13
13
  import type { FacetManager } from '../facets/manager.js';
14
14
  export declare function loaderFacetHost(env: unknown, ctx: DurableObjectState): FacetHost;
15
15
  /**
16
- * The two objects a LoaderPool needs from a FacetManager, via the manager's
16
+ * The two objects a IsolatePool needs from a FacetManager, via the manager's
17
17
  * own `loaderHost()` accessor. The runtime guard stays: harnesses build
18
18
  * FacetManagers on mock contexts, and one built on something other than a
19
19
  * DurableObjectState should fail with a sentence instead of at the first RPC.
@@ -1,5 +1,5 @@
1
1
  import { manifestVfs } from '@nimbus-sh/core/runtime/vfs-manifest.js';
2
- import { LoaderPool } from '@nimbus-sh/fabric/loader-pool.js';
2
+ import { IsolatePool } from '@nimbus-sh/fabric/isolate-pool.js';
3
3
  export function loaderFacetHost(env, ctx) {
4
4
  return {
5
5
  // workerd suspends a guest through JSPI, which is what lets a syscall reach
@@ -14,7 +14,7 @@ export function loaderFacetHost(env, ctx) {
14
14
  return manifestVfs(vfs, root, options);
15
15
  },
16
16
  open(spec) {
17
- return new LoaderPool(env, ctx, {
17
+ return new IsolatePool(env, ctx, {
18
18
  tag: spec.tag,
19
19
  concurrency: spec.concurrency,
20
20
  preamble: spec.preamble,
@@ -27,7 +27,7 @@ export function loaderFacetHost(env, ctx) {
27
27
  };
28
28
  }
29
29
  /**
30
- * The two objects a LoaderPool needs from a FacetManager, via the manager's
30
+ * The two objects a IsolatePool needs from a FacetManager, via the manager's
31
31
  * own `loaderHost()` accessor. The runtime guard stays: harnesses build
32
32
  * FacetManagers on mock contexts, and one built on something other than a
33
33
  * DurableObjectState should fail with a sentence instead of at the first RPC.
@@ -113,8 +113,8 @@ class NodeReplAdapter {
113
113
  const { facetMgr } = this.deps;
114
114
  const env = facetMgr.env;
115
115
  const ctx = facetMgr.ctx;
116
- const { LoaderPool } = await import('@nimbus-sh/fabric/loader-pool.js');
117
- this.pool = new LoaderPool(env, ctx, {
116
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
117
+ this.pool = new IsolatePool(env, ctx, {
118
118
  tag: 'node-repl',
119
119
  concurrency: 1,
120
120
  omitSupervisor: true,
@@ -16,7 +16,7 @@
16
16
  * facet with no node-compat layer.
17
17
  */
18
18
  import { NODE_SHIMS_BUILD_ID, NODE_SHIMS_ENTRY, NODE_SHIMS_SHA256, } from '../node-shims-artifact.generated.js';
19
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
19
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
20
20
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
21
21
  const L2_KEY = `https://nimbus-cache.invalid${NODE_SHIMS_ENTRY}?build=${NODE_SHIMS_BUILD_ID}`;
22
22
  const ASSET_URL = `https://nimbus-internal.invalid${NODE_SHIMS_ENTRY}`;
@@ -41,7 +41,8 @@ import { generateUndiciShimCode } from '@nimbus-sh/core/runtime/undici-shim.js';
41
41
  import { getExportsResolverJS } from '@nimbus-sh/core/_shared/exports-resolver.js';
42
42
  import { getTypescriptSpecifiersJS } from '@nimbus-sh/core/_shared/typescript-specifiers.js';
43
43
  import { NIMBUS_AI_CREDENTIAL_HEADERS, NIMBUS_AI_TOKEN_ENV } from '@nimbus-sh/core/_shared/ai-egress.js';
44
- import { FACET_PROVIDED_PACKAGES, FS_READ_BATCH_PATH_LIMIT, FS_READ_BATCH_REQUEST_BYTES, MAX_RPC_SAFE_PAYLOAD_BYTES, NIMBUS_AI_GATEWAY_PORT, NODE_VERSION, NODE_VERSIONS, } from '@nimbus-sh/core/constants.js';
44
+ import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
45
+ import { FACET_PROVIDED_PACKAGES, FS_READ_BATCH_PATH_LIMIT, FS_READ_BATCH_REQUEST_BYTES, NIMBUS_AI_GATEWAY_PORT, NODE_VERSION, NODE_VERSIONS, } from '@nimbus-sh/core/constants.js';
45
46
  const STREAMS_CODE = generateStreamsCode();
46
47
  const SQLITE_SHIM_CODE = generateSqliteShimCode();
47
48
  const UNDICI_SHIM_CODE = generateUndiciShimCode();
@@ -20,7 +20,7 @@
20
20
  * (see OPENCODE_TREE_SITTER_WASMS and FacetManager.treeSitterModuleEntries).
21
21
  */
22
22
  import { OPENCODE_ARTIFACT_BUILD_ID, OPENCODE_ARTIFACT_DIGESTS, OPENCODE_ARTIFACT_PRESENT, OPENCODE_ARTIFACT_VERSION, } from '../opencode-artifact.generated.js';
23
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
23
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
24
24
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
25
25
  /** Base asset path of the staged opencode bundle directory. */
26
26
  const OPENCODE_ASSET_BASE = `/_assets/opencode/${OPENCODE_ARTIFACT_VERSION}`;
@@ -16,7 +16,7 @@
16
16
  * the backend.
17
17
  */
18
18
  import { OPENTUI_WASM_BUILD_ID, OPENTUI_WASM_ENTRY, OPENTUI_WASM_SHA256, } from '../opentui-wasm-artifact.generated.js';
19
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
19
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
20
20
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
21
21
  /**
22
22
  * Synthetic L2 cache key for the OpenTUI wasm asset. Build-id-pinned so a
@@ -207,7 +207,7 @@ class PythonReplAdapter {
207
207
  snapshot.files[stdlibPath.replace(/^\/+/, '')] = btoa(bin);
208
208
  this.fsSnapshot = snapshot;
209
209
  this.pythonHome = `/${installRoot.replace(/^\/+/, '')}`;
210
- const { LoaderPool } = await import('@nimbus-sh/fabric/loader-pool.js');
210
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
211
211
  const host = getFacetManagerLoaderHost(facetMgr);
212
212
  // A prompt where `open(path, "w")` silently does nothing is worse than one
213
213
  // that refuses to start, so the pid decides which pool this is. Written as
@@ -225,11 +225,11 @@ class PythonReplAdapter {
225
225
  };
226
226
  const pid = this.deps.pid;
227
227
  this.pool = (typeof pid === 'number' && pid > 0
228
- ? new LoaderPool(host.env, host.ctx, { ...base, supervisorPid: pid })
228
+ ? new IsolatePool(host.env, host.ctx, { ...base, supervisorPid: pid })
229
229
  // The install-time warm-up has no invoking process. It boots the
230
230
  // interpreter and never touches a file, so it asks for no supervisor
231
231
  // rather than binding one it cannot authenticate to.
232
- : new LoaderPool(host.env, host.ctx, { ...base, omitSupervisor: true }));
232
+ : new IsolatePool(host.env, host.ctx, { ...base, omitSupervisor: true }));
233
233
  }
234
234
  async submit(userCode) {
235
235
  const result = await this.pool.submit(pythonReplStepFacetFn, {
@@ -156,10 +156,10 @@ class RubyReplAdapter {
156
156
  // drifted (it lacked the language-prelude const __rubyRun requires, so
157
157
  // every REPL eval died on boot) — compose it in exactly one place.
158
158
  const preamble = buildRubyPreamble();
159
- const { LoaderPool } = await import('@nimbus-sh/fabric/loader-pool.js');
159
+ const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
160
160
  const env = facetMgr.env;
161
161
  const ctx = facetMgr.ctx;
162
- this.pool = new LoaderPool(env, ctx, {
162
+ this.pool = new IsolatePool(env, ctx, {
163
163
  tag: 'ruby-repl',
164
164
  concurrency: 1,
165
165
  omitSupervisor: true,
@@ -17,7 +17,7 @@
17
17
  */
18
18
  import { SQLJS_VERSION } from '@nimbus-sh/core/constants.js';
19
19
  import { SQLITE_WASM_SHA256 } from '../sqlite-wasm-bundle.generated.js';
20
- import { disposeRpcResource } from '@nimbus-sh/core/_shared/rpc-dispose.js';
20
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
21
21
  import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
22
22
  /**
23
23
  * Path inside env.ASSETS where the sql.js wasm binary lives. Versioned so
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * Per DEFECT-D1: ctx is taken as a separate explicit arg.
18
18
  */
19
- import { rehydrateFromStorage, snapshotForStorage, getFailures, } from '@nimbus-sh/core/observability/oom-discriminator.js';
19
+ import { rehydrateFromStorage, snapshotForStorage, getFailures, } from '@nimbus-sh/platform/oom-discriminator.js';
20
20
  import { W5_RING_STORAGE_KEY } from './keys.js';
21
21
  export function readNodeMem() {
22
22
  try {
@@ -22,10 +22,10 @@
22
22
  * reason dispatcher with this session's handlers registered.
23
23
  * - flushOnClose(host) — synchronous flush on ws close.
24
24
  *
25
- * The alarm multiplexer itself (reason map, scheduleAlarm, the per-instance
26
- * chain) and maybeBumpIsolateGen are fabric machinery —
27
- * `@nimbus-sh/fabric/alarms.js`; this module registers the session's reasons
28
- * ('w9-flush' | 'log-janitor' | 'resident-launch') on top of it.
25
+ * The timer multiplexer itself (reason map, schedule, the per-instance
26
+ * chain) is fabric machinery — `@nimbus-sh/fabric/timers.js`; this module
27
+ * registers the session's reasons ('w9-flush' | 'log-janitor' |
28
+ * 'resident-launch') on top of it.
29
29
  *
30
30
  * **`ctx` taken as a separate arg from `host`** because the parent
31
31
  * `CloudflareDurableObject` class declares `ctx` as `protected`, which
@@ -40,7 +40,7 @@
40
40
  */
41
41
  import type { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
42
42
  import { type WsHibernationConfigResult } from '@nimbus-sh/fabric/ws-hibernation-config.js';
43
- import { type AlarmHost, type IsolateGenHost } from '@nimbus-sh/fabric/alarms.js';
43
+ import { type TimerHost } from '@nimbus-sh/fabric/timers.js';
44
44
  export type { WsHibernationConfigResult };
45
45
  /**
46
46
  * Minimal host shape. `_w9*` fields drop `private` on the class so
@@ -49,7 +49,7 @@ export type { WsHibernationConfigResult };
49
49
  *
50
50
  * `ctx` is NOT in this interface — passed as a separate arg.
51
51
  */
52
- export interface HibHost extends AlarmHost, IsolateGenHost {
52
+ export interface HibHost extends TimerHost {
53
53
  processes: SessionProcessSupervisor;
54
54
  _w9SchemaInit: boolean;
55
55
  _w9PersistWired: boolean;
@@ -114,7 +114,7 @@ export type AlarmReason = 'w9-flush' | 'log-janitor' | 'resident-launch';
114
114
  /**
115
115
  * W9: ensure the alarm is set for the next flush window. Cheap to
116
116
  * call repeatedly — we only schedule the in-isolate flush timer if
117
- * it isn't already set. The persistent alarm goes through scheduleAlarm
117
+ * it isn't already set. The persistent alarm goes through timers.schedule
118
118
  * so it coordinates with W1's log-janitor sweep.
119
119
  */
120
120
  export declare function scheduleHibFlush(host: HibHost, ctx: any): void;
@@ -130,7 +130,7 @@ export declare function scheduleHibFlush(host: HibHost, ctx: any): void;
130
130
  * caller (typically `(pid) => !host.processes.get(pid)`). Decoupled
131
131
  * so HibHost doesn't need to import ProcessTable.
132
132
  */
133
- export declare function dispatchAlarm(host: HibHost, ctx: any, janitorOrphanCheck?: (pid: number) => boolean, pumpResidentLaunches?: () => Promise<void>): Promise<void>;
133
+ export declare function dispatchAlarm(host: HibHost, ctx: any, janitorOrphanCheck?: (pid: number) => boolean, pumpResidentLaunches?: () => Promise<void>, alarmInfo?: AlarmInvocationInfo): Promise<void>;
134
134
  /**
135
135
  * W9: synchronous flush of the process-log ring on session close.
136
136
  * Wraps `processes.flushLogs()` in a try/catch so a flush failure
@@ -1 +1 @@
1
- {"version":3,"file":"hibernation.d.ts","sourceRoot":"","sources":["../../src/session/hibernation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACtG,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACpH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAGrC,YAAY,EAAE,yBAAyB,EAAE,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,OAAQ,SAAQ,SAAS,EAAE,cAAc;IACxD,SAAS,EAAE,wBAAwB,CAAC;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;IACnB,4EAA4E;IAC5E,eAAe,EAAE,OAAO,CAAC;IACzB,uEAAuE;IACvE,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,GAAG,GAAG,yBAAyB,CAY9E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CA6GnE;AAED;;;;;;;;;;GAUG;AACH;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAc9D;AAED,2CAA2C;AAC3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;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,GAAG,GAAG,yBAAyB,CAY9E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CA6GnE;AAED;;;;;;;;;;GAUG;AACH;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAc9D;AAED,2CAA2C;AAC3C,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAqB7D;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAqB9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,GAAG,EACR,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,EAC7C,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC1C,SAAS,CAAC,EAAE,mBAAmB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAuCf;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAMhD"}
@@ -22,10 +22,10 @@
22
22
  * reason dispatcher with this session's handlers registered.
23
23
  * - flushOnClose(host) — synchronous flush on ws close.
24
24
  *
25
- * The alarm multiplexer itself (reason map, scheduleAlarm, the per-instance
26
- * chain) and maybeBumpIsolateGen are fabric machinery —
27
- * `@nimbus-sh/fabric/alarms.js`; this module registers the session's reasons
28
- * ('w9-flush' | 'log-janitor' | 'resident-launch') on top of it.
25
+ * The timer multiplexer itself (reason map, schedule, the per-instance
26
+ * chain) is fabric machinery — `@nimbus-sh/fabric/timers.js`; this module
27
+ * registers the session's reasons ('w9-flush' | 'log-janitor' |
28
+ * 'resident-launch') on top of it.
29
29
  *
30
30
  * **`ctx` taken as a separate arg from `host`** because the parent
31
31
  * `CloudflareDurableObject` class declares `ctx` as `protected`, which
@@ -39,7 +39,7 @@
39
39
  * wireProcessLogPersist again.
40
40
  */
41
41
  import { configureWsHibernation } from '@nimbus-sh/fabric/ws-hibernation-config.js';
42
- import { dispatchAlarm as dispatchAlarmReasons, scheduleAlarm, } from '@nimbus-sh/fabric/alarms.js';
42
+ import { timers } from '@nimbus-sh/fabric/timers.js';
43
43
  import { SESSION_DESTROYED_KEY, W9_FLUSH_DEBOUNCE_MS } from './keys.js';
44
44
  /**
45
45
  * Run at DO ctor time. Returns the result for the class to assign to
@@ -216,11 +216,11 @@ export function ensureLogJanitor(host, ctx) {
216
216
  if (host._w1SessionDestroyed)
217
217
  return;
218
218
  // Optimistic flag (dedupes same-tick appends), CONFIRMED by the schedule
219
- // outcome: scheduleAlarm swallows storage errors, and a failure with the
219
+ // outcome: timers.schedule swallows storage errors, and a failure with the
220
220
  // flag left set would mean no alarm AND nothing ever re-arming until the
221
221
  // instance recycles.
222
222
  host._w1JanitorArmed = true;
223
- void scheduleAlarm(host, ctx, 'log-janitor', Date.now() + 60_000).then((ok) => {
223
+ void timers(host, ctx).schedule('log-janitor', Date.now() + 60_000).then((ok) => {
224
224
  if (!ok)
225
225
  host._w1JanitorArmed = false;
226
226
  });
@@ -249,7 +249,7 @@ export function ensureHibSchema(host, ctx) {
249
249
  /**
250
250
  * W9: ensure the alarm is set for the next flush window. Cheap to
251
251
  * call repeatedly — we only schedule the in-isolate flush timer if
252
- * it isn't already set. The persistent alarm goes through scheduleAlarm
252
+ * it isn't already set. The persistent alarm goes through timers.schedule
253
253
  * so it coordinates with W1's log-janitor sweep.
254
254
  */
255
255
  export function scheduleHibFlush(host, ctx) {
@@ -271,10 +271,10 @@ export function scheduleHibFlush(host, ctx) {
271
271
  }, W9_FLUSH_DEBOUNCE_MS);
272
272
  // Persistent alarm: fires post-hibernation if the in-isolate timer
273
273
  // didn't get a chance to run (DO evicted under memory pressure
274
- // before the 250ms debounce expired). Coordinated via scheduleAlarm
274
+ // before the 250ms debounce expired). Coordinated via timers.schedule
275
275
  // so W1's log-janitor doesn't clobber it (or vice-versa).
276
- // Fire-and-forget — scheduleAlarm is fail-soft.
277
- void scheduleAlarm(host, ctx, 'w9-flush', Date.now() + W9_FLUSH_DEBOUNCE_MS * 4);
276
+ // Fire-and-forget — timers.schedule is fail-soft.
277
+ void timers(host, ctx).schedule('w9-flush', Date.now() + W9_FLUSH_DEBOUNCE_MS * 4);
278
278
  }
279
279
  /**
280
280
  * W1: this session's alarm() handler body — the fabric's multi-reason
@@ -288,8 +288,8 @@ export function scheduleHibFlush(host, ctx) {
288
288
  * caller (typically `(pid) => !host.processes.get(pid)`). Decoupled
289
289
  * so HibHost doesn't need to import ProcessTable.
290
290
  */
291
- export function dispatchAlarm(host, ctx, janitorOrphanCheck, pumpResidentLaunches) {
292
- return dispatchAlarmReasons(host, ctx, {
291
+ export function dispatchAlarm(host, ctx, janitorOrphanCheck, pumpResidentLaunches, alarmInfo) {
292
+ return timers(host, ctx).dispatch({
293
293
  'w9-flush': () => {
294
294
  host.processes.flushLogs();
295
295
  },
@@ -322,14 +322,14 @@ export function dispatchAlarm(host, ctx, janitorOrphanCheck, pumpResidentLaunche
322
322
  // Legacy path: pre-W1 deploys had no map. dispatchAlarm was called
323
323
  // with no map and unconditionally ran the log flush. Preserve
324
324
  // that on a missing map (one-time post-deploy, then the map is
325
- // populated by the next scheduleHibFlush / scheduleAlarm call).
325
+ // populated by the next scheduleHibFlush / timers.schedule call).
326
326
  try {
327
327
  host.processes.flushLogs();
328
328
  }
329
329
  catch (e) {
330
330
  console.warn('[nimbus/W9] legacy flush threw:', e?.message);
331
331
  }
332
- });
332
+ }, alarmInfo);
333
333
  }
334
334
  /**
335
335
  * W9: synchronous flush of the process-log ring on session close.
@@ -32,7 +32,7 @@
32
32
  * preserved — old probes still see it. New phase entries are
33
33
  * additional ring entries, not replacements.
34
34
  */
35
- import { type SessionState } from '@nimbus-sh/core/observability/oom-discriminator.js';
35
+ import { type SessionState } from '@nimbus-sh/platform/oom-discriminator.js';
36
36
  /**
37
37
  * Set the current phase + record a transition. Fail-soft on the
38
38
  * observability call; the phase update on `self` is direct and
@@ -40,7 +40,7 @@ import { type SessionState } from '@nimbus-sh/core/observability/oom-discriminat
40
40
  */
41
41
  export declare function setPhase(self: {
42
42
  _b4Phase: SessionState | null;
43
- _isolateGen?: number;
43
+ ctx?: unknown;
44
44
  }, toState: SessionState, trigger: string): void;
45
45
  /**
46
46
  * [B'.5] Identify the original phase-based warm-rejoin case. The /ws
@@ -93,7 +93,6 @@ export declare function joinExistingSession(self: {
93
93
  write(s: string): void;
94
94
  };
95
95
  _b4Phase: SessionState | null;
96
- _isolateGen?: number;
97
96
  _b4WarmJoinCount: number;
98
97
  }, ws: WebSocket, appendScrollback: (ctx: any, data: string, atMs: number) => void, loadScrollback: (ctx: any) => string): void;
99
98
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"init-phases.d.ts","sourceRoot":"","sources":["../../src/session/init-phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAE5G;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE;IAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAC7D,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAC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AC;CAC1B,EACD,EAAE,EAAE,SAAS,EACb,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GACnC,IAAI,CAsCN"}
@@ -32,7 +32,8 @@
32
32
  * preserved — old probes still see it. New phase entries are
33
33
  * additional ring entries, not replacements.
34
34
  */
35
- import { recordRecoveryEvent } from '@nimbus-sh/core/observability/oom-discriminator.js';
35
+ import { recordRecoveryEvent } from '@nimbus-sh/platform/oom-discriminator.js';
36
+ import { generation } from '@nimbus-sh/fabric/generation.js';
36
37
  /**
37
38
  * Set the current phase + record a transition. Fail-soft on the
38
39
  * observability call; the phase update on `self` is direct and
@@ -47,7 +48,7 @@ export function setPhase(self, toState, trigger) {
47
48
  fromState,
48
49
  toState,
49
50
  trigger,
50
- isolateGen: self._isolateGen ?? 0,
51
+ isolateGen: generation(self.ctx),
51
52
  dataLoss: false,
52
53
  snapshotKeysRehydrated: 0,
53
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/session/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AA8EH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;GAQG;AACH,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC;AAa3E,wBAAsB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAosF9E"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/session/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AA+EH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;GAQG;AACH,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC;AAa3E,wBAAsB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAosF9E"}
@@ -68,10 +68,11 @@ import { listInstalledRuntimes, rehydrateInstalledRuntimes, registerRunnerFactor
68
68
  // one-time Worker Startup Time paid on every fresh-isolate cold run.
69
69
  import { hasSeededProject, SEED_PROJECT_DIR } from '@nimbus-sh/core/vfs/seed-project.js';
70
70
  import { notifyTerminalEvent } from '../runtime/process-logs-api.js';
71
+ import { generation } from '@nimbus-sh/fabric/generation.js';
71
72
  import { stripAnsi } from '@nimbus-sh/core/runtime/process-logs.js';
72
73
  import { DEFAULT_MOUNT_POINTS, NODE_VERSION, } from '@nimbus-sh/core/constants.js';
73
74
  import { ensureSessionStateSchema, loadShellState, stampHydratedAt, countSessionStateKeys, loadKernelMounts, persistKernelMounts, appendScrollback, loadScrollback, } from './state-store.js';
74
- import { recordRecoveryEvent } from '@nimbus-sh/core/observability/oom-discriminator.js';
75
+ import { recordRecoveryEvent } from '@nimbus-sh/platform/oom-discriminator.js';
75
76
  import { sessionAiEnv } from './ai.js';
76
77
  import { routeSessionLoopback } from './loopback.js';
77
78
  import { setPhase } from './init-phases.js';
@@ -166,7 +167,7 @@ export async function initSession(self, ws) {
166
167
  + 'running was lost with the old one — re-run it if it had not finished.\x1b[0m\r\n');
167
168
  }
168
169
  // A reset that killed a resident launch left its journal row behind
169
- // (fabric's ResidentLaunchJournal.recoverInterrupted). The alarm the dying
170
+ // (fabric's FencedWork.recoverInterrupted). The alarm the dying
170
171
  // instance was using for launch turns is NOT a trigger recovery can rely
171
172
  // on — measured live, a launch killed early in its first chunks rolls the
172
173
  // alarm-map put back with the rest of the dying turn, so the replacement
@@ -481,7 +482,7 @@ export async function initSession(self, ws) {
481
482
  registerRunnerFactory('cpython-runner', (manifest, installRoot, binName, binKind) => async function pythonReplOrOneShot(ctx) {
482
483
  const argv = ctx.args || [];
483
484
  // No args at all → REPL session. Hand off to runPythonRepl
484
- // which builds its own LoaderPool (separate from the
485
+ // which builds its own IsolatePool (separate from the
485
486
  // one-shot dispatch's pool) and drives a ReplSession.
486
487
  if (argv.length === 0 && self.terminal) {
487
488
  const { runPythonRepl } = await import('../runtime/python-repl.js');
@@ -2705,7 +2706,7 @@ export async function initSession(self, ws) {
2705
2706
  fromState: fromState,
2706
2707
  toState: 'hydrated',
2707
2708
  trigger: 'init-session',
2708
- isolateGen: self._isolateGen,
2709
+ isolateGen: generation(self.ctx),
2709
2710
  dataLoss: false,
2710
2711
  snapshotKeysRehydrated: snapshotKeys,
2711
2712
  });
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/session/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH;2EAC2E;AAC3E,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;yDAEyD;AACzD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD;0DAC0D;AAC1D,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;uBAEuB;AACvB,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;;4EAG4E;AAC5E,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+BAA+B,CAAC"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/session/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH;2EAC2E;AAC3E,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;yDAEyD;AACzD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD;0DAC0D;AAC1D,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;uBAEuB;AACvB,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;;4EAG4E;AAC5E,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+BAA+B,CAAC"}