@nimbus-sh/fabric 0.8.0 → 0.9.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.
package/dist/fanout.d.ts CHANGED
@@ -1,17 +1,21 @@
1
1
  /**
2
2
  * Two-tier fan-out primitive for work that must execute in Worker Loader
3
- * facets without tripping workerd's per-DO dynamic-worker ceiling.
3
+ * isolates within the Durable Object's Dynamic Worker budget.
4
4
  *
5
- * A single Durable Object method can drive at most four concurrent
6
- * Worker Loader fetches before extra dispatches serialize or fail. Small
7
- * batches therefore run in the coordinator DO through IsolatePool.
8
- * Wider batches are sharded across sibling NimbusSession DOs, each of
9
- * which owns its own four-loader budget.
5
+ * A Durable Object may have `DO_DYNAMIC_WORKER_LIMIT` distinct Dynamic
6
+ * Workers with in-flight requests, shared across every concurrent request to
7
+ * it (budgets.ts). A batch the coordinator's remaining headroom can hold —
8
+ * the limit less the workers it already has in flight (resident processes,
9
+ * the esbuild facet, a git network op) and other fan-outs' claims — runs in
10
+ * the coordinator through IsolatePool, one Dynamic Worker per task. Only a
11
+ * batch wider than that headroom is sharded across sibling NimbusSession
12
+ * DOs, each of which spends its own budget.
10
13
  *
11
- * Routing is deterministic: each task has a stable key, and the key maps
12
- * to a sibling DO shard. There is no silent fallback to width-1 execution;
13
- * missing LOADER or NIMBUS_SESSION bindings fail loudly so install and
14
- * runtime operations do not appear successful after partial dispatch.
14
+ * Routing is deterministic for a given headroom: each task has a stable key,
15
+ * and the key maps to a sibling DO shard. There is no silent fallback to
16
+ * width-1 execution; missing LOADER or NIMBUS_SESSION bindings fail loudly so
17
+ * install and runtime operations do not appear successful after partial
18
+ * dispatch.
15
19
  */
16
20
  import { type FacetTaskFn } from './isolate-pool.js';
17
21
  import type { WorkerLoader } from './vendor/types.js';
@@ -22,14 +26,16 @@ export interface FanoutEnv {
22
26
  LOADER?: WorkerLoader;
23
27
  NIMBUS_SESSION?: unknown;
24
28
  }
25
- /**
26
- * Threshold at which routing switches from coordinator-local loaders to
27
- * sibling Durable Objects.
28
- *
29
- * Set to **5** so the in-DO path stays below the V8 4-loaders-per-method
30
- * cap by construction. width < 5 stays local; width >= 5 uses sibling DOs.
31
- */
32
- export declare const IN_DO_THRESHOLD = 5;
29
+ /** Where one `submitMany` ran. */
30
+ export type FanoutTopology = 'in-do' | 'peer-do';
31
+ /** The routing decision for one `submitMany`, as its caller may log it. */
32
+ export interface FanoutRoute {
33
+ topology: FanoutTopology;
34
+ /** Tasks in the batch — the Dynamic Workers an in-DO run spends. */
35
+ tasks: number;
36
+ /** The coordinator's Dynamic Worker headroom when the batch was routed. */
37
+ headroom: number;
38
+ }
33
39
  /**
34
40
  * Hard cap on concurrent peer DOs per single submitMany call. Throughput stays
35
41
  * flat through this width while keeping per-request scheduler pressure bounded.
@@ -134,12 +140,14 @@ export interface FanoutOptions {
134
140
  * Not called on the in-DO path, which has no phases.
135
141
  */
136
142
  onDispatchPhase?: (width: number, elapsedMs: number) => void;
143
+ /** Called once per non-empty submitMany with the route it took. */
144
+ onRoute?: (route: FanoutRoute) => void;
137
145
  /**
138
146
  * Cap on peer DOs this pool will spread one submitMany across. Defaults to
139
147
  * MAX_PEER_FANOUT. Tasks beyond the cap bucket into the peers that exist and
140
148
  * run through their in-peer pool, so lowering it trades peers for barriers
141
- * without lowering total concurrency: each peer runs its bucket at
142
- * concurrency 4, so N peers still resolve 4N tasks at once.
149
+ * without lowering total concurrency: each peer runs its bucket as wide as
150
+ * its own Dynamic Worker headroom allows.
143
151
  *
144
152
  * A caller sets this when its per-task work is small enough that a peer per
145
153
  * task buys nothing but round-trips — one task per peer costs ⌈tasks/
@@ -149,7 +157,7 @@ export interface FanoutOptions {
149
157
  }
150
158
  /**
151
159
  * Two-tier fan-out pool. Constructed by the supervisor DO; routes
152
- * each `submitMany` call automatically based on width.
160
+ * each `submitMany` call on the coordinator's live Dynamic Worker headroom.
153
161
  *
154
162
  * Lifetime: cheap to construct (no async init). Multiple submitMany
155
163
  * calls share NO state — each is dispatched fresh. The class
@@ -167,16 +175,16 @@ export declare class Fanout {
167
175
  * Dispatch `tasks` across the appropriate topology and return
168
176
  * results in input order.
169
177
  *
170
- * Routing:
171
- * tasks.length < 5 -> coordinator-local IsolatePool
172
- * tasks.length >= 5 -> sibling NimbusSession DOs
178
+ * Routing, against the coordinator's Dynamic Worker headroom at call time:
179
+ * tasks.length <= headroom -> coordinator-local IsolatePool, one Dynamic
180
+ * Worker per task, the width claimed on the
181
+ * ledger until the batch settles
182
+ * tasks.length > headroom -> sibling NimbusSession DOs
173
183
  *
174
- * Backpressure: if `tasks.length > MAX_PEER_FANOUT (32)`, tasks
175
- * are sharded modulo `MAX_PEER_FANOUT` and each shard's bucket
176
- * runs serially inside its assigned peer DO via the in-peer
177
- * IsolatePool's concurrency (capped at 4 there too). A
178
- * single submitMany call returns when ALL tasks complete (or any
179
- * throws).
184
+ * Peer shards: tasks hash onto min(tasks, maxPeers ?? MAX_PEER_FANOUT)
185
+ * peers and each peer runs its bucket through its own IsolatePool, as
186
+ * wide as that peer's headroom allows. A single submitMany call returns
187
+ * when ALL tasks complete (or any throws).
180
188
  *
181
189
  * `fn` is the user function executed per task. It runs INSIDE a
182
190
  * Worker Loader isolate (in the in-DO path) or inside a peer DO's
@@ -185,8 +193,8 @@ export declare class Fanout {
185
193
  * the vendored serializeFunction (same as IsolatePool#prepare).
186
194
  */
187
195
  submitMany<A, R>(tasks: FanoutTask<A>[], fn: FacetTaskFn<A, R>): Promise<R[]>;
188
- /** Report which topology a task count uses without dispatching. */
189
- topologyFor(taskCount: number): 'in-do' | 'peer-do' | 'empty';
196
+ /** The topology a task count would take against the headroom right now. */
197
+ topologyFor(taskCount: number): FanoutTopology | 'empty';
190
198
  /**
191
199
  * Compute the deterministic peer-DO id for a task key and peer count.
192
200
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fanout.d.ts","sourceRoot":"","sources":["../src/fanout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;A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KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,mEAAmE;IACnE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAWD;;;;;;;;GAQG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;gBAE5B,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa;IAoBzE;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,CAAC,CAAC,EAAE,CAAC,EACnB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,EACtB,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,EAAE,CAAC;IAcf,2EAA2E;IAC3E,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO;IAKxD;;;;;;OAMG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;YAOvC,aAAa;YA8Bb,eAAe;CA2J9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUrE"}
package/dist/fanout.js CHANGED
@@ -1,33 +1,30 @@
1
1
  /**
2
2
  * Two-tier fan-out primitive for work that must execute in Worker Loader
3
- * facets without tripping workerd's per-DO dynamic-worker ceiling.
3
+ * isolates within the Durable Object's Dynamic Worker budget.
4
4
  *
5
- * A single Durable Object method can drive at most four concurrent
6
- * Worker Loader fetches before extra dispatches serialize or fail. Small
7
- * batches therefore run in the coordinator DO through IsolatePool.
8
- * Wider batches are sharded across sibling NimbusSession DOs, each of
9
- * which owns its own four-loader budget.
5
+ * A Durable Object may have `DO_DYNAMIC_WORKER_LIMIT` distinct Dynamic
6
+ * Workers with in-flight requests, shared across every concurrent request to
7
+ * it (budgets.ts). A batch the coordinator's remaining headroom can hold —
8
+ * the limit less the workers it already has in flight (resident processes,
9
+ * the esbuild facet, a git network op) and other fan-outs' claims — runs in
10
+ * the coordinator through IsolatePool, one Dynamic Worker per task. Only a
11
+ * batch wider than that headroom is sharded across sibling NimbusSession
12
+ * DOs, each of which spends its own budget.
10
13
  *
11
- * Routing is deterministic: each task has a stable key, and the key maps
12
- * to a sibling DO shard. There is no silent fallback to width-1 execution;
13
- * missing LOADER or NIMBUS_SESSION bindings fail loudly so install and
14
- * runtime operations do not appear successful after partial dispatch.
14
+ * Routing is deterministic for a given headroom: each task has a stable key,
15
+ * and the key maps to a sibling DO shard. There is no silent fallback to
16
+ * width-1 execution; missing LOADER or NIMBUS_SESSION bindings fail loudly so
17
+ * install and runtime operations do not appear successful after partial
18
+ * dispatch.
15
19
  */
16
20
  import { serializeFunction } from './vendor/serialize.js';
17
21
  import { BindingError } from './vendor/errors.js';
18
22
  import { IsolatePool } from './isolate-pool.js';
23
+ import { claimDynamicWorkers, dynamicWorkerHeadroom } from './budgets.js';
19
24
  import { hostRoute } from './composition.js';
20
25
  import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
21
26
  import { classifyDoCall, describeError, isRetryableDoCall } from '@nimbus-sh/platform/oom-classify.js';
22
27
  import { hostNamespaceBinding, hostOpDispatch, } from './host-dispatch.js';
23
- /**
24
- * Threshold at which routing switches from coordinator-local loaders to
25
- * sibling Durable Objects.
26
- *
27
- * Set to **5** so the in-DO path stays below the V8 4-loaders-per-method
28
- * cap by construction. width < 5 stays local; width >= 5 uses sibling DOs.
29
- */
30
- export const IN_DO_THRESHOLD = 5;
31
28
  /**
32
29
  * Hard cap on concurrent peer DOs per single submitMany call. Throughput stays
33
30
  * flat through this width while keeping per-request scheduler pressure bounded.
@@ -78,7 +75,7 @@ function isPeerResult(value) {
78
75
  }
79
76
  /**
80
77
  * Two-tier fan-out pool. Constructed by the supervisor DO; routes
81
- * each `submitMany` call automatically based on width.
78
+ * each `submitMany` call on the coordinator's live Dynamic Worker headroom.
82
79
  *
83
80
  * Lifetime: cheap to construct (no async init). Multiple submitMany
84
81
  * calls share NO state — each is dispatched fresh. The class
@@ -112,16 +109,16 @@ export class Fanout {
112
109
  * Dispatch `tasks` across the appropriate topology and return
113
110
  * results in input order.
114
111
  *
115
- * Routing:
116
- * tasks.length < 5 -> coordinator-local IsolatePool
117
- * tasks.length >= 5 -> sibling NimbusSession DOs
112
+ * Routing, against the coordinator's Dynamic Worker headroom at call time:
113
+ * tasks.length <= headroom -> coordinator-local IsolatePool, one Dynamic
114
+ * Worker per task, the width claimed on the
115
+ * ledger until the batch settles
116
+ * tasks.length > headroom -> sibling NimbusSession DOs
118
117
  *
119
- * Backpressure: if `tasks.length > MAX_PEER_FANOUT (32)`, tasks
120
- * are sharded modulo `MAX_PEER_FANOUT` and each shard's bucket
121
- * runs serially inside its assigned peer DO via the in-peer
122
- * IsolatePool's concurrency (capped at 4 there too). A
123
- * single submitMany call returns when ALL tasks complete (or any
124
- * throws).
118
+ * Peer shards: tasks hash onto min(tasks, maxPeers ?? MAX_PEER_FANOUT)
119
+ * peers and each peer runs its bucket through its own IsolatePool, as
120
+ * wide as that peer's headroom allows. A single submitMany call returns
121
+ * when ALL tasks complete (or any throws).
125
122
  *
126
123
  * `fn` is the user function executed per task. It runs INSIDE a
127
124
  * Worker Loader isolate (in the in-DO path) or inside a peer DO's
@@ -132,16 +129,23 @@ export class Fanout {
132
129
  async submitMany(tasks, fn) {
133
130
  if (tasks.length === 0)
134
131
  return [];
135
- if (tasks.length < IN_DO_THRESHOLD) {
136
- return this._dispatchInDo(tasks, fn);
132
+ const headroom = dynamicWorkerHeadroom(this.ctx);
133
+ const claim = claimDynamicWorkers(this.ctx, tasks.length);
134
+ this.opts.onRoute?.({ topology: claim ? 'in-do' : 'peer-do', tasks: tasks.length, headroom });
135
+ if (!claim)
136
+ return this._dispatchPeerDo(tasks, fn);
137
+ try {
138
+ return await this._dispatchInDo(tasks, fn);
139
+ }
140
+ finally {
141
+ claim.release();
137
142
  }
138
- return this._dispatchPeerDo(tasks, fn);
139
143
  }
140
- /** Report which topology a task count uses without dispatching. */
144
+ /** The topology a task count would take against the headroom right now. */
141
145
  topologyFor(taskCount) {
142
146
  if (taskCount === 0)
143
147
  return 'empty';
144
- return taskCount < IN_DO_THRESHOLD ? 'in-do' : 'peer-do';
148
+ return taskCount <= dynamicWorkerHeadroom(this.ctx) ? 'in-do' : 'peer-do';
145
149
  }
146
150
  /**
147
151
  * Compute the deterministic peer-DO id for a task key and peer count.
@@ -156,13 +160,10 @@ export class Fanout {
156
160
  }
157
161
  // ── Private: in-DO dispatch (in-DO fanout) ──────────────────────────────
158
162
  async _dispatchInDo(tasks, fn) {
159
- // Use the existing IsolatePool. Concurrency = task count
160
- // (capped at 4 by constructor — tasks.length is already < 5
161
- // here, so the cap won't bite). Each task = one pool.submit;
162
- // pool.map runs them with stable-slot reuse.
163
- const concurrency = Math.min(tasks.length, IN_DO_THRESHOLD - 1);
163
+ // One slot — one Dynamic Worker — per task; submitMany has claimed
164
+ // that width on the ledger.
164
165
  const pool = new IsolatePool(this.env, this.ctx, {
165
- concurrency,
166
+ concurrency: tasks.length,
166
167
  timeoutMs: this.opts.timeoutMs,
167
168
  tag: this.opts.tag,
168
169
  preamble: this.opts.preamble,
@@ -172,9 +173,6 @@ export class Fanout {
172
173
  supervisorPid: this.opts.supervisorPid,
173
174
  });
174
175
  try {
175
- // pool.map runs the function over `items` with concurrency-bounded
176
- // slot reuse. Each slot is one warm loader isolate; we get exactly
177
- // `concurrency` loader isolates total — well under the 4-cap.
178
176
  const items = tasks.map((t) => t.args);
179
177
  const results = await pool.map(fn, items);
180
178
  // pool.map returns Array<R | null> (null on per-item failure with
@@ -200,10 +198,9 @@ export class Fanout {
200
198
  // loader isolates (keyed on fnHash) reuse across calls with
201
199
  // identical fns.
202
200
  const fnSource = serializeFunction(fn);
203
- // Cap peer count at MAX_PEER_FANOUT. Tasks beyond N=32 are
204
- // bucketed into existing shards — each shard's peer DO then
205
- // runs its bucket through its in-DO IsolatePool.map
206
- // (concurrency capped at 4 there).
201
+ // Cap peer count at maxPeers (default MAX_PEER_FANOUT). Tasks beyond
202
+ // it bucket into existing shards; each peer runs its bucket through
203
+ // its own IsolatePool, as wide as its own headroom allows.
207
204
  const peerCount = Math.min(tasks.length, this.opts.maxPeers ?? MAX_PEER_FANOUT);
208
205
  // Group tasks by deterministic shard. Same key → same shard, so
209
206
  // tests can predict which peer handles which task.
@@ -242,10 +239,9 @@ export class Fanout {
242
239
  const peerStub = ns.get(id);
243
240
  try {
244
241
  const dispatch = hostOpDispatch(peerStub, `Fanout peer ${siblingName}`);
245
- // Each peer DO RPC call uses ONE LOADER worker on its side.
246
- // Supervisor → peer DO is a stub.fetch / RPC method call,
247
- // NOT an env.LOADER.get(); that's the cap-sidestep that
248
- // makes peer-DO fanout work.
242
+ // A peer DO call is a Durable Object RPC, not a Dynamic Worker:
243
+ // it spends none of this coordinator's budget, and the peer
244
+ // spends its own.
249
245
  const rpcResp = await dispatch({
250
246
  op: 'fanoutExecute',
251
247
  args: [
@@ -0,0 +1,29 @@
1
+ /**
2
+ * host-wasm.ts — what the fabric knows about a WebAssembly.Module a host
3
+ * hands a dynamic worker already compiled.
4
+ *
5
+ * workerd accepts a compiled module in a Worker Loader module map and lets
6
+ * the dynamic worker share its compiled code (src/workerd/api/
7
+ * worker-loader.c++, extractWasmModuleContent), so a host that bundles a
8
+ * fixed wasm (esbuild's, say) hands that module over instead of fetching a
9
+ * second copy of the bytes and having the guest compile them again. Two
10
+ * things the fabric needs about a member are unreadable from JS for a
11
+ * Module:
12
+ * - its size: the module's wire bytes still count toward the 64 MiB
13
+ * dynamic-worker code limit (worker-loader.c++ sums every member), and
14
+ * assertModuleMapWithinCodeLimit must count them;
15
+ * - its identity: a pool folds its wasm into the loader cache key, and a
16
+ * Module has no bytes to fingerprint.
17
+ * The host that owns the module states both once, here.
18
+ */
19
+ export interface HostWasmIdentity {
20
+ /** A stable name for the module's content, e.g. `esbuild@0.24.2`. */
21
+ readonly id: string;
22
+ /** The module's wire bytes: what it costs the dynamic-worker code budget. */
23
+ readonly bytes: number;
24
+ }
25
+ /** Record what `module` is, and return it. */
26
+ export declare function describeHostWasm(module: WebAssembly.Module, identity: HostWasmIdentity): WebAssembly.Module;
27
+ /** What a host said `module` is, or undefined for a module nobody described. */
28
+ export declare function hostWasmIdentity(module: WebAssembly.Module): HostWasmIdentity | undefined;
29
+ //# sourceMappingURL=host-wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-wasm.d.ts","sourceRoot":"","sources":["../src/host-wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAID,8CAA8C;AAC9C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAM3G;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEzF"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * host-wasm.ts — what the fabric knows about a WebAssembly.Module a host
3
+ * hands a dynamic worker already compiled.
4
+ *
5
+ * workerd accepts a compiled module in a Worker Loader module map and lets
6
+ * the dynamic worker share its compiled code (src/workerd/api/
7
+ * worker-loader.c++, extractWasmModuleContent), so a host that bundles a
8
+ * fixed wasm (esbuild's, say) hands that module over instead of fetching a
9
+ * second copy of the bytes and having the guest compile them again. Two
10
+ * things the fabric needs about a member are unreadable from JS for a
11
+ * Module:
12
+ * - its size: the module's wire bytes still count toward the 64 MiB
13
+ * dynamic-worker code limit (worker-loader.c++ sums every member), and
14
+ * assertModuleMapWithinCodeLimit must count them;
15
+ * - its identity: a pool folds its wasm into the loader cache key, and a
16
+ * Module has no bytes to fingerprint.
17
+ * The host that owns the module states both once, here.
18
+ */
19
+ const described = new WeakMap();
20
+ /** Record what `module` is, and return it. */
21
+ export function describeHostWasm(module, identity) {
22
+ if (!Number.isSafeInteger(identity.bytes) || identity.bytes <= 0) {
23
+ throw new RangeError(`describeHostWasm: '${identity.id}' needs its wire size in bytes, got ${identity.bytes}`);
24
+ }
25
+ described.set(module, identity);
26
+ return module;
27
+ }
28
+ /** What a host said `module` is, or undefined for a module nobody described. */
29
+ export function hostWasmIdentity(module) {
30
+ return described.get(module);
31
+ }
@@ -105,7 +105,7 @@ export declare class ImageStore {
105
105
  * Writing the sources here, once, is what lets the session stop holding
106
106
  * them: after this returns, the only thing it keeps is a path.
107
107
  */
108
- materialize(pid: number, images: AsyncIterable<readonly [string, string]> | Iterable<readonly [string, string]>, pacer: TurnBudget): Promise<Record<string, string>>;
108
+ materialize(pid: number, images: AsyncIterable<readonly [string, string | readonly string[]]> | Iterable<readonly [string, string | readonly string[]]>, pacer: TurnBudget): Promise<Record<string, string>>;
109
109
  /**
110
110
  * Drop every image no running process boots from.
111
111
  *
@@ -1 +1 @@
1
- {"version":3,"file":"image-store.d.ts","sourceRoot":"","sources":["../src/image-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM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,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,EAC9H,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAuDlC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,KAAK;CAgBd"}
@@ -111,7 +111,7 @@ export class ImageStore {
111
111
  fs.mkdirp(FACET_IMAGE_DIR);
112
112
  let count = 0;
113
113
  for await (const [moduleName, source] of images) {
114
- const bytes = new TextEncoder().encode(source);
114
+ const bytes = typeof source === 'string' ? new TextEncoder().encode(source) : encodeParts(source);
115
115
  const path = facetImagePath(await facetImageDigest(bytes));
116
116
  paths[moduleName] = path;
117
117
  rooted.push(path);
@@ -190,3 +190,35 @@ export class ImageStore {
190
190
  }
191
191
  }
192
192
  }
193
+ /**
194
+ * UTF-8 bytes of an image given as ordered parts, encoded into one buffer a
195
+ * part at a time: joining the parts first would hold the whole image twice as
196
+ * text.
197
+ */
198
+ function encodeParts(parts) {
199
+ let length = 0;
200
+ for (const part of parts) {
201
+ for (let i = 0; i < part.length; i++) {
202
+ const code = part.charCodeAt(i);
203
+ if (code < 0x80)
204
+ length += 1;
205
+ else if (code < 0x800)
206
+ length += 2;
207
+ else if (code >= 0xd800 && code <= 0xdbff && (part.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
208
+ length += 4;
209
+ i++;
210
+ }
211
+ else
212
+ length += 3;
213
+ }
214
+ }
215
+ const bytes = new Uint8Array(length);
216
+ const encoder = new TextEncoder();
217
+ let offset = 0;
218
+ for (const part of parts) {
219
+ const encoded = encoder.encode(part);
220
+ bytes.set(encoded, offset);
221
+ offset += encoded.byteLength;
222
+ }
223
+ return bytes;
224
+ }
@@ -7,9 +7,9 @@
7
7
  * running 67 npm tarball extractions (cold-start dominates). We pin
8
8
  * each job to `slot = cursor % concurrency` and use stable loader
9
9
  * IDs `nfp:${fnHash}:slot-${i}:g${generation}`, so a pool of
10
- * concurrency=4 keeps at most 4 warm isolates rather than N fresh ones.
10
+ * concurrency=N keeps at most N warm isolates rather than one per job.
11
11
  * 2. **Nimbus defaults**: compatibilityDate = CF_COMPAT_DATE (matches
12
- * the supervisor worker), compatibilityFlags = ['nodejs_compat'],
12
+ * the supervisor worker), compatibilityFlags = GUEST_COMPAT_FLAGS,
13
13
  * globalOutbound = undefined (inherit parent network so the facet can
14
14
  * reach https://registry.npmjs.org without a proxy binding).
15
15
  * 3. **Supervisor autoinjection**. The pool grabs the embedder's
@@ -44,7 +44,11 @@ export interface IsolatePoolEnv {
44
44
  }
45
45
  /** Options handed to IsolatePool's constructor. */
46
46
  export interface IsolatePoolOptions {
47
- /** Maximum concurrent in-flight facets. Default 4. */
47
+ /**
48
+ * Maximum concurrent in-flight facets, each a distinct Dynamic Worker
49
+ * spent from the hosting DO's `DO_DYNAMIC_WORKER_LIMIT`. Default 1; a
50
+ * caller that wants more sizes it against that budget (Fanout does).
51
+ */
48
52
  concurrency?: number;
49
53
  /** Per-task timeout in ms. Default 60_000. */
50
54
  timeoutMs?: number;
@@ -139,15 +143,19 @@ export interface IsolatePoolOptions {
139
143
  /**
140
144
  * WebAssembly modules to ship into the facet via the LOADER's
141
145
  * `modules` map. Map keys are module specifier paths (e.g.
142
- * `'esbuild.wasm'`); values are the raw bytes.
146
+ * `'esbuild.wasm'`); values are the raw bytes, or a module the host
147
+ * already holds compiled.
143
148
  *
144
- * Workerd registers each entry as `{ wasm: ArrayBuffer }` in the
145
- * worker's modules map. The pool prepends a static
149
+ * Workerd registers each entry as `{ wasm }` in the worker's modules
150
+ * map. The pool prepends a static
146
151
  * `import __NIMBUS_WASM_<id> from './<key>';` to the generated
147
- * worker.js so workerd compiles each at module-load (startup phase,
148
- * where wasm code generation is permitted). The compiled Modules
149
- * are exposed via `globalThis.__NIMBUS_WASM[<key>]` for the user
150
- * function to read at request time.
152
+ * worker.js; bytes are compiled at the facet's module-load (startup
153
+ * phase, where wasm code generation is permitted), and a compiled
154
+ * module is shared with the facet as is, its compiled code included
155
+ * (workerd src/workerd/api/worker-loader.c++,
156
+ * extractWasmModuleContent). The Modules are exposed via
157
+ * `globalThis.__NIMBUS_WASM[<key>]` for the user function to read at
158
+ * request time.
151
159
  *
152
160
  * Why this works when other paths don't:
153
161
  * - request-time `WebAssembly.compile()` — disallowed by workerd
@@ -156,15 +164,15 @@ export interface IsolatePoolOptions {
156
164
  * structured-clone refuses ("Unable to deserialize cloned data").
157
165
  * - inlining bytes in the preamble — 16 MiB string per dispatch
158
166
  * OOMs the supervisor at module-source allocation time.
159
- * - LOADER modules-map (this) — bytes ride INSIDE the worker code
160
- * blob; workerd compiles wasm during its own startup pipeline,
161
- * never crossing structured-clone, never executing JS eval.
167
+ * - LOADER modules-map (this) — the module rides INSIDE the worker
168
+ * code blob, never crossing structured-clone, never executing JS
169
+ * eval.
162
170
  *
163
- * The bytes ARE part of the loader-cache key (workerd hashes the
164
- * whole WorkerCode), so changing the wasm bytes invalidates warm
165
- * slots — desirable when the bundled wasm version changes.
171
+ * A compiled module must be described (host-wasm.ts describeHostWasm):
172
+ * its identity keys warm slots, as the bytes' fingerprint does, and its
173
+ * size counts toward the dynamic-worker code limit.
166
174
  */
167
- wasmModules?: Record<string, ArrayBuffer>;
175
+ wasmModules?: Record<string, ArrayBuffer | WebAssembly.Module>;
168
176
  }
169
177
  /** Per-call override (merged with pool defaults). */
170
178
  export interface IsolateCallOptions {
@@ -233,7 +241,7 @@ export declare function assembleLoaderWorkerModuleSource(options: LoaderWorkerMo
233
241
  * Typical use:
234
242
  *
235
243
  * const pool = new IsolatePool(env, ctx, {
236
- * concurrency: 4,
244
+ * concurrency: 2,
237
245
  * tag: 'npm-install',
238
246
  * });
239
247
  * const results = await pool.map(
@@ -273,11 +281,11 @@ export declare class IsolatePool {
273
281
  * across pool dispatches (cache-key stability).
274
282
  */
275
283
  private readonly wasmModules;
276
- /** Hash of (name + byte length + first/last bytes) of every wasm
277
- * module, folded into the loader cache key so changes invalidate
278
- * warm slots. Hashing the FULL bytes would be O(20+ MiB) per dispatch
279
- * and is unnecessary — wasm bytes are pinned at deploy time, the
280
- * length+endpoints are a strong-enough fingerprint. */
284
+ /** Hash of every constructor-time wasm module, folded into the loader
285
+ * cache key so changes invalidate warm slots: a compiled module by the
286
+ * identity its host described, bytes by name + length + first/last
287
+ * byte. Hashing the FULL bytes would be O(20+ MiB) per dispatch and is
288
+ * unnecessary — they are pinned at deploy time. */
281
289
  private readonly wasmHash;
282
290
  /**
283
291
  * Short prefix of the owning DO's id, baked into the loader.get()
@@ -1 +1 @@
1
- {"version":3,"file":"isolate-pool.d.ts","sourceRoot":"","sources":["../src/isolate-pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAcxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI;IAC9B,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnD,CAAC,MAAM,CAAC,CAAC;AAEV,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,mDAAmD;AACnD,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,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