@nimbus-sh/platform 0.5.1 → 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.
@@ -66,7 +66,8 @@ export declare const DEFAULT_HOST_DISPATCH_METHOD = "supervisorOp";
66
66
  * Compose once per isolate. A second call with the same values is a no-op;
67
67
  * a second call with different values throws, naming both, so an embedder
68
68
  * whose composition lost to an earlier import learns it at startup rather
69
- * than from a facet that reached the wrong host.
69
+ * than from a facet that reached the wrong host. A host without
70
+ * `enhanced_error_serialization` is refused.
70
71
  */
71
72
  export declare function composeFabric(value: FabricComposition): void;
72
73
  export declare function adoptCtxExports(value: CtxExports): void;
@@ -1 +1 @@
1
- {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAC;AAC7F,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,yBAAyB,GAAG,SAAS,CAAC,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEpF,MAAM,WAAW,iBAAiB;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EA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CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAmC3D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAoB5D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAEvD;AAED,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,qBAAoC,GAAG,yBAAyB,GAAG,IAAI,CAMrI;AAED,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,CAExD;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,SAAS,GAAG,IAAI,CAO5C;AAED,wBAAgB,mBAAmB,IAAI,mBAAmB,CASzD"}
@@ -2,13 +2,45 @@ export const DEFAULT_HOST_NAMESPACE = 'NIMBUS_SESSION';
2
2
  export const DEFAULT_HOST_DISPATCH_METHOD = 'supervisorOp';
3
3
  let composition = null;
4
4
  let ctxExports = null;
5
+ /**
6
+ * A program's filesystem errors reach it across workerd RPC, from the host
7
+ * that answers its supervisor binding, and the program branches on the POSIX
8
+ * `code` each one carries. workerd carries an error's own properties across
9
+ * RPC only when the sending AND the receiving isolate have
10
+ * `enhanced_error_serialization`, on by compatibility date from 2026-04-21:
11
+ * the serializer writes a native error as a host object with its own
12
+ * properties only under the flag (src/workerd/jsg/ser.c++,
13
+ * Serializer::IsHostObject), and the receiver reads that detail back only
14
+ * under it (src/workerd/jsg/util.c++, decodeTunneledException); see
15
+ * https://developers.cloudflare.com/workers/runtime-apis/rpc/error-handling/.
16
+ * Programs load at CF_COMPAT_DATE, past it. The host runs at its embedder's
17
+ * date, and below it every ENOENT would reach every program as a bare message
18
+ * it maps to EIO. So composing refuses such a host, wherever it composes
19
+ * (module scope: the Worker fails at startup; NimbusWorkspace.create: that
20
+ * call throws), and names both fixes: the flag alone keeps
21
+ * every other behavior of the embedder's date. Off workerd (bun, node) there
22
+ * is no RPC hop and no `Cloudflare` global to read.
23
+ */
24
+ function requireEnhancedErrorSerialization() {
25
+ // `typeof` of an undeclared global is 'undefined', not a ReferenceError.
26
+ if (typeof Cloudflare === 'undefined')
27
+ return;
28
+ if (Cloudflare.compatibilityFlags.enhanced_error_serialization === true)
29
+ return;
30
+ throw new Error('fabric: this Worker runs without the enhanced_error_serialization compatibility flag, so the '
31
+ + "code on a program's filesystem error (ENOENT, EEXIST, ...) would not survive the RPC back "
32
+ + 'to it. Add "enhanced_error_serialization" to compatibility_flags in your wrangler config, '
33
+ + 'or set compatibility_date to 2026-04-21 or later.');
34
+ }
5
35
  /**
6
36
  * Compose once per isolate. A second call with the same values is a no-op;
7
37
  * a second call with different values throws, naming both, so an embedder
8
38
  * whose composition lost to an earlier import learns it at startup rather
9
- * than from a facet that reached the wrong host.
39
+ * than from a facet that reached the wrong host. A host without
40
+ * `enhanced_error_serialization` is refused.
10
41
  */
11
42
  export function composeFabric(value) {
43
+ requireEnhancedErrorSerialization();
12
44
  if (!composition) {
13
45
  composition = value;
14
46
  return;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * CRC-32 (IEEE 802.3, the zip/gzip/PNG polynomial), the one implementation
3
+ * every Nimbus caller uses: the W7 write-batch framing and zip archives.
4
+ *
5
+ * `crc32(bytes, previous)` has node:zlib's contract: `previous` is the
6
+ * finished CRC of the bytes before these, so a checksum computed in pieces
7
+ * equals the checksum of the whole.
8
+ *
9
+ * Measured 2026-09-24 (5k files x 2 KiB; 64 MiB in 1 MiB buffers):
10
+ * node:zlib's crc32 is 5-40x faster than any JavaScript loop in bun, node and
11
+ * workerd (compat 2026-04-01, nodejs_compat), but each call costs ~0.14 us in
12
+ * workerd, so below 128 bytes the table loop wins there. It is reached through
13
+ * `process.getBuiltinModule`, like core's incremental SHA-256, so this module
14
+ * imports nothing and still loads where node:zlib is absent (a browser,
15
+ * workerd without nodejs_compat). The JavaScript path is slicing-by-8: 2-3x
16
+ * the byte-at-a-time table loop in bun and node, and level with it in workerd.
17
+ */
18
+ export declare function crc32(bytes: Uint8Array, previous?: number): number;
19
+ //# sourceMappingURL=crc32.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crc32.d.ts","sourceRoot":"","sources":["../src/crc32.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAqCH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,SAAI,GAAG,MAAM,CAiB7D"}
package/dist/crc32.js ADDED
@@ -0,0 +1,67 @@
1
+ /**
2
+ * CRC-32 (IEEE 802.3, the zip/gzip/PNG polynomial), the one implementation
3
+ * every Nimbus caller uses: the W7 write-batch framing and zip archives.
4
+ *
5
+ * `crc32(bytes, previous)` has node:zlib's contract: `previous` is the
6
+ * finished CRC of the bytes before these, so a checksum computed in pieces
7
+ * equals the checksum of the whole.
8
+ *
9
+ * Measured 2026-09-24 (5k files x 2 KiB; 64 MiB in 1 MiB buffers):
10
+ * node:zlib's crc32 is 5-40x faster than any JavaScript loop in bun, node and
11
+ * workerd (compat 2026-04-01, nodejs_compat), but each call costs ~0.14 us in
12
+ * workerd, so below 128 bytes the table loop wins there. It is reached through
13
+ * `process.getBuiltinModule`, like core's incremental SHA-256, so this module
14
+ * imports nothing and still loads where node:zlib is absent (a browser,
15
+ * workerd without nodejs_compat). The JavaScript path is slicing-by-8: 2-3x
16
+ * the byte-at-a-time table loop in bun and node, and level with it in workerd.
17
+ */
18
+ /** Below this many bytes the native call's overhead exceeds the JavaScript loop's work (workerd). */
19
+ const CRC_NATIVE_MIN_BYTES = 128;
20
+ const nativeCrc32 = (() => {
21
+ try {
22
+ const crc32 = globalThis.process?.getBuiltinModule?.('node:zlib')?.crc32;
23
+ return typeof crc32 === 'function' ? crc32 : null;
24
+ }
25
+ catch {
26
+ return null;
27
+ }
28
+ })();
29
+ /** Eight 256-entry tables: table k maps a byte to its CRC after k further zero bytes. */
30
+ let crcTables = null;
31
+ function createCrcTables() {
32
+ const table = new Uint32Array(256 * 8);
33
+ for (let index = 0; index < 256; index++) {
34
+ let value = index;
35
+ for (let bit = 0; bit < 8; bit++)
36
+ value = (value & 1) !== 0 ? 0xedb8_8320 ^ (value >>> 1) : value >>> 1;
37
+ table[index] = value;
38
+ }
39
+ for (let index = 0; index < 256; index++) {
40
+ let value = table[index];
41
+ for (let k = 1; k < 8; k++) {
42
+ value = table[value & 0xff] ^ (value >>> 8);
43
+ table[k * 256 + index] = value;
44
+ }
45
+ }
46
+ return table;
47
+ }
48
+ export function crc32(bytes, previous = 0) {
49
+ if (nativeCrc32 !== null && bytes.length >= CRC_NATIVE_MIN_BYTES)
50
+ return nativeCrc32(bytes, previous) >>> 0;
51
+ const t = crcTables ??= createCrcTables();
52
+ let value = ~previous;
53
+ const length = bytes.length;
54
+ const whole = length - (length & 7);
55
+ let i = 0;
56
+ for (; i < whole; i += 8) {
57
+ const low = value ^ (bytes[i] | (bytes[i + 1] << 8) | (bytes[i + 2] << 16) | (bytes[i + 3] << 24));
58
+ const high = bytes[i + 4] | (bytes[i + 5] << 8) | (bytes[i + 6] << 16) | (bytes[i + 7] << 24);
59
+ value = t[1792 + (low & 0xff)] ^ t[1536 + ((low >>> 8) & 0xff)]
60
+ ^ t[1280 + ((low >>> 16) & 0xff)] ^ t[1024 + (low >>> 24)]
61
+ ^ t[768 + (high & 0xff)] ^ t[512 + ((high >>> 8) & 0xff)]
62
+ ^ t[256 + ((high >>> 16) & 0xff)] ^ t[high >>> 24];
63
+ }
64
+ for (; i < length; i++)
65
+ value = t[(value ^ bytes[i]) & 0xff] ^ (value >>> 8);
66
+ return ~value >>> 0;
67
+ }
@@ -75,12 +75,6 @@ export interface DiagCounters {
75
75
  * Surfaced as `breakdown.prefetchCacheBytes`. A gauge, not a delta.
76
76
  */
77
77
  prefetchCacheBytes: number;
78
- /**
79
- * Bytes retained by the FacetManager's ESM→CJS transform cache, bounded by
80
- * ESM_TRANSFORM_CACHE_MAX_BYTES. Surfaced as `breakdown.transformCacheBytes`.
81
- * A gauge, not a delta.
82
- */
83
- transformCacheBytes: number;
84
78
  /** Install-facet counters. Populated by npm-installer after a
85
79
  * successful batch-facet dispatch returns. Confirms the install ran
86
80
  * in the facet (tarballsCompleted > 0) and surfaces the
@@ -181,8 +175,6 @@ export declare function prefetchBundleEnd(bytes: number): void;
181
175
  * owns the number and reports it whenever it admits or evicts an entry.
182
176
  */
183
177
  export declare function setPrefetchCacheBytes(bytes: number): void;
184
- /** Publish the transform cache's live retained total; same contract as above. */
185
- export declare function setTransformCacheBytes(bytes: number): void;
186
178
  /** Fold facet-returned counters into the supervisor's diag state.
187
179
  * Called by npm-installer after the batch-facet returns; aggregates
188
180
  * rather than replaces so multiple install runs in the same DO
@@ -1 +1 @@
1
- {"version":3,"file":"diag-counters.d.ts","sourceRoot":"","sources":["../src/diag-counters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,YAAY,EAAE,YAAY,CAAC;IAC3B;;;;;;;;;;;;;;;;;OAiBG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,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;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIvD;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKrD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGzD;AAED;;;qDAGqD;AACrD,wBAAgB,0BAA0B,CAAC,CAAC,EAAE;IAC5C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAMP;AAED;;;;;aAKa;AACb,wBAAgB,sBAAsB,CAAC,CAAC,EAAE;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,GAAG,IAAI,CAiBP;AAED;;sCAEsC;AACtC,wBAAgB,oBAAoB,CAAC,CAAC,EAAE;IACtC,wBAAwB,EAAE,MAAM,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,0BAA0B,EAAE,MAAM,CAAC;IACnC,4BAA4B,EAAE,MAAM,CAAC;CACtC,GAAG,IAAI,CAKP"}
@@ -23,7 +23,6 @@ const _counters = {
23
23
  inFlightRpcPayloadBytes: 0,
24
24
  prefetchBundleBytes: 0,
25
25
  prefetchCacheBytes: 0,
26
- transformCacheBytes: 0,
27
26
  installFacet: {
28
27
  tarballsCompleted: 0,
29
28
  cumulativeBytesDecoded: 0,
@@ -123,11 +122,6 @@ export function setPrefetchCacheBytes(bytes) {
123
122
  const n = Number(bytes);
124
123
  _counters.prefetchCacheBytes = Number.isFinite(n) && n > 0 ? n : 0;
125
124
  }
126
- /** Publish the transform cache's live retained total; same contract as above. */
127
- export function setTransformCacheBytes(bytes) {
128
- const n = Number(bytes);
129
- _counters.transformCacheBytes = Number.isFinite(n) && n > 0 ? n : 0;
130
- }
131
125
  /** Fold facet-returned counters into the supervisor's diag state.
132
126
  * Called by npm-installer after the batch-facet returns; aggregates
133
127
  * rather than replaces so multiple install runs in the same DO
@@ -6,7 +6,7 @@
6
6
  * `process.memoryUsage()` returns 0 for every field inside a Durable
7
7
  * Object class context (only dynamic-worker isolates under nodejs_compat
8
8
  * get the real implementation). The previous `readNodeMem` /
9
- * `sampleMemory` helpers in nimbus-session-diag.ts called it anyway and
9
+ * `sampleMemory` helpers in session/diag.ts called it anyway and
10
10
  * therefore reported zero forever — useless for verifying memory-
11
11
  * containment work in plan §3 Track A'.
12
12
  *
@@ -180,12 +180,6 @@ export interface HeapBreakdown {
180
180
  * the cache holds rather than a reservation it might use.
181
181
  */
182
182
  prefetchCacheBytes: number;
183
- /**
184
- * Bytes retained by the FacetManager's ESM→CJS transform cache
185
- * (diag-counters `transformCacheBytes`), the other cache that persists
186
- * across execs. Bounded by ESM_TRANSFORM_CACHE_MAX_BYTES.
187
- */
188
- transformCacheBytes: number;
189
183
  /**
190
184
  * Shared-budget occupancy not already represented by the named transient
191
185
  * counters. This covers full-budget owners and keeps cross-DO module-local
@@ -1 +1 @@
1
- {"version":3,"file":"heap-estimate.d.ts","sourceRoot":"","sources":["../src/heap-estimate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,sFAM1B,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,wCA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ACnE,uBAAuB,EAAE,MAAM,CAAC;IAChC,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,CAAC;IACzB;;sEAEkE;IAClE,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;;OAYG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,aAAa,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAyBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAQnE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,YAAY,EACf,GAAG,EAAE,aAAa,GACjB,YAAY,CAkDd"}
@@ -6,7 +6,7 @@
6
6
  * `process.memoryUsage()` returns 0 for every field inside a Durable
7
7
  * Object class context (only dynamic-worker isolates under nodejs_compat
8
8
  * get the real implementation). The previous `readNodeMem` /
9
- * `sampleMemory` helpers in nimbus-session-diag.ts called it anyway and
9
+ * `sampleMemory` helpers in session/diag.ts called it anyway and
10
10
  * therefore reported zero forever — useless for verifying memory-
11
11
  * containment work in plan §3 Track A'.
12
12
  *
@@ -160,7 +160,6 @@ export function estimateSupervisorHeap(c, vfs) {
160
160
  streamingBuffersBytes: c.inFlightRpcPayloadBytes,
161
161
  prefetchBundleBytes: c.prefetchBundleBytes,
162
162
  prefetchCacheBytes: c.prefetchCacheBytes,
163
- transformCacheBytes: c.transformCacheBytes,
164
163
  unattributedReservationBytes: Math.max(0, allocationBudget.current - transientAttributedBytes),
165
164
  };
166
165
  const estimatedBytes = breakdown.supervisorBaselineBytes +
@@ -170,7 +169,6 @@ export function estimateSupervisorHeap(c, vfs) {
170
169
  breakdown.streamingBuffersBytes +
171
170
  breakdown.prefetchBundleBytes +
172
171
  breakdown.prefetchCacheBytes +
173
- breakdown.transformCacheBytes +
174
172
  breakdown.unattributedReservationBytes;
175
173
  const percentOfCeiling = Math.round((estimatedBytes / SUPERVISOR_HEAP_CEILING_BYTES) * 1000) / 10;
176
174
  return {
@@ -13,8 +13,6 @@ export interface SupervisorAllocationBudgetStats {
13
13
  readonly current: number;
14
14
  readonly peak: number;
15
15
  readonly queued: number;
16
- /** Credit held for an owner's whole lifetime; see `acquireResident`. */
17
- readonly resident: number;
18
16
  }
19
17
  interface AllocationBudgetLifecycle {
20
18
  onActive?: () => void;
@@ -53,12 +51,6 @@ export declare class SupervisorAllocationBudget {
53
51
  * stops a large read overlapping a large write.
54
52
  */
55
53
  acquireWithoutLifecycle(bytes: number, signal?: AbortSignal): Promise<ResizableCreditLease>;
56
- /**
57
- * Reserve bytes an owner holds for its whole lifetime, not for one
58
- * operation. Recorded as a floor: a later claim larger than what remains
59
- * around it is refused with both numbers rather than parked forever.
60
- */
61
- acquireResidentBytes(bytes: number, signal?: AbortSignal): Promise<ResizableCreditLease>;
62
54
  private _acquire;
63
55
  }
64
56
  /**
@@ -91,11 +83,6 @@ export declare function acquireSupervisorAllocation(bytes: number, signal?: Abor
91
83
  * there to fill.
92
84
  */
93
85
  export declare function acquireSupervisorReadAllocation(bytes: number, signal?: AbortSignal): Promise<ResizableCreditLease>;
94
- /**
95
- * Reserve bytes for the whole life of the owner that takes them — an image
96
- * a pool keeps until it is disposed. See `acquireResidentBytes`.
97
- */
98
- export declare function acquireResidentSupervisorAllocation(bytes: number, signal?: AbortSignal): Promise<ResizableCreditLease>;
99
86
  /**
100
87
  * Reserve the full budget for an allocation whose retained size is not known
101
88
  * accurately enough to overlap safely with other heavy work.
@@ -1 +1 @@
1
- {"version":3,"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ED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAMjF;AAED,wBAAgB,8BAA8B,IAAI,+BAA+B,CAEhF"}
@@ -55,18 +55,8 @@ export class SupervisorAllocationBudget {
55
55
  acquireWithoutLifecycle(bytes, signal) {
56
56
  return this._acquire(bytes, signal, false);
57
57
  }
58
- /**
59
- * Reserve bytes an owner holds for its whole lifetime, not for one
60
- * operation. Recorded as a floor: a later claim larger than what remains
61
- * around it is refused with both numbers rather than parked forever.
62
- */
63
- acquireResidentBytes(bytes, signal) {
64
- return this._acquire(bytes, signal, true, true);
65
- }
66
- async _acquire(bytes, signal, drivesLifecycle, resident = false) {
67
- const credit = resident
68
- ? await this.credits.acquireResident(bytes, signal)
69
- : await this.credits.acquire(bytes, signal);
58
+ async _acquire(bytes, signal, drivesLifecycle) {
59
+ const credit = await this.credits.acquire(bytes, signal);
70
60
  if (drivesLifecycle) {
71
61
  this.lifecycleHolders++;
72
62
  if (!this.active) {
@@ -178,13 +168,6 @@ export function acquireSupervisorAllocation(bytes, signal) {
178
168
  export function acquireSupervisorReadAllocation(bytes, signal) {
179
169
  return supervisorAllocationBudget.acquireWithoutLifecycle(bytes, signal);
180
170
  }
181
- /**
182
- * Reserve bytes for the whole life of the owner that takes them — an image
183
- * a pool keeps until it is disposed. See `acquireResidentBytes`.
184
- */
185
- export function acquireResidentSupervisorAllocation(bytes, signal) {
186
- return supervisorAllocationBudget.acquireResidentBytes(bytes, signal);
187
- }
188
171
  /**
189
172
  * Reserve the full budget for an allocation whose retained size is not known
190
173
  * accurately enough to overlap safely with other heavy work.
package/dist/limits.d.ts CHANGED
@@ -38,6 +38,7 @@ export declare const SQL_MAX_BOUND_PARAMETERS = 100;
38
38
  * clone, with reserve.
39
39
  */
40
40
  export declare const DO_STORAGE_LIMIT_BYTES = 10000000000;
41
+ export declare const HYDRATION_DEADLINE_MS = 30000;
41
42
  /**
42
43
  * Maximum SQL statement text per exec. Documented "100 KB"; read as binary
43
44
  * KiB because the value is SQLite's compile-time SQLITE_MAX_SQL_LENGTH
@@ -93,7 +94,7 @@ export declare const RESIDENT_KEEPALIVE_MS = 5000;
93
94
  export declare const RESIDENT_KEEPALIVE_DETACHED_MS = 60000;
94
95
  /**
95
96
  * Bytes one hibernatable WebSocket attachment may serialize to. Verified in
96
- * workerd source at the pinned version (v1.20260603.1,
97
+ * workerd source at the pinned version (v1.20260926.1,
97
98
  * src/workerd/api/web-socket.h: `MAX_ATTACHMENT_SIZE = 1024 * 16`). The
98
99
  * bound is on the SERIALIZED bytes — workerd re-serializes on every
99
100
  * `serializeAttachment` call to check it — not on UTF-8 JSON text, so a
@@ -103,7 +104,9 @@ export declare const RESIDENT_KEEPALIVE_DETACHED_MS = 60000;
103
104
  */
104
105
  export declare const WS_ATTACHMENT_LIMIT_BYTES = 16384;
105
106
  export declare const MAX_RPC_SAFE_PAYLOAD_BYTES: number;
107
+ export declare const ONE_SHOT_MODULE_MAP_MAX_BYTES: number;
106
108
  export declare const SUPERVISOR_HEAP_CEILING_BYTES: number;
109
+ export declare const FACET_OWN_WRITE_MEMORY_BYTES: number;
107
110
  export declare const SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES: number;
108
111
  export declare const SUPERVISOR_READ_RESERVE_BYTES: number;
109
112
  export declare const MAX_GLOBAL_WRITE_STREAM_CREDIT_BYTES: number;
@@ -1 +1 @@
1
- {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAS,CAAC;AAEjC,eAAO,MAAM,iBAAiB,QAAkB,CAAC;AACjD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAI5C;;;;;;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eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,UAAY,CAAC;AAI9C;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAIlD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAIrD;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAOhD,eAAO,MAAM,0BAA0B,QAAmB,CAAC;AAmB3D,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AA6B9D,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAM9D,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAO7D,eAAO,MAAM,4CAA4C,QAAmB,CAAC;AAY7E,eAAO,MAAM,6BAA6B,QAAc,CAAC;AAKzD,eAAO,MAAM,oCAAoC,QAAkB,CAAC;AAQpE,eAAO,MAAM,0BAA0B,QAA6B,CAAC;AACrE,eAAO,MAAM,sBAAsB,IAAI,CAAC"}
package/dist/limits.js CHANGED
@@ -45,6 +45,11 @@ export const SQL_MAX_BOUND_PARAMETERS = 100;
45
45
  * clone, with reserve.
46
46
  */
47
47
  export const DO_STORAGE_LIMIT_BYTES = 10_000_000_000;
48
+ // N17: how long a launch that reads synchronously (WASI) waits for the paths
49
+ // it names to hydrate out of a lazy import before it fails with EIO naming
50
+ // the first that is not local. Bounded so a fetch that never resolves cannot
51
+ // hold a launch forever.
52
+ export const HYDRATION_DEADLINE_MS = 30_000;
48
53
  /**
49
54
  * Maximum SQL statement text per exec. Documented "100 KB"; read as binary
50
55
  * KiB because the value is SQLite's compile-time SQLITE_MAX_SQL_LENGTH
@@ -103,7 +108,7 @@ export const RESIDENT_KEEPALIVE_DETACHED_MS = 60_000;
103
108
  // ── WebSocket attachment bound ──────────────────────────────────────────
104
109
  /**
105
110
  * Bytes one hibernatable WebSocket attachment may serialize to. Verified in
106
- * workerd source at the pinned version (v1.20260603.1,
111
+ * workerd source at the pinned version (v1.20260926.1,
107
112
  * src/workerd/api/web-socket.h: `MAX_ATTACHMENT_SIZE = 1024 * 16`). The
108
113
  * bound is on the SERIALIZED bytes — workerd re-serializes on every
109
114
  * `serializeAttachment` call to check it — not on UTF-8 JSON text, so a
@@ -117,6 +122,24 @@ export const WS_ATTACHMENT_LIMIT_BYTES = 16_384;
117
122
  // The platform limit is 32 MiB; 28 MiB leaves room for structured-clone
118
123
  // metadata and matches the proven on-demand facet transfer envelope.
119
124
  export const MAX_RPC_SAFE_PAYLOAD_BYTES = 28 * 1024 * 1024;
125
+ // ── A one-shot's module map [#13] ───────────────────────────────────────
126
+ //
127
+ // The largest one-shot module map (its closure's raw bytes) the session DO
128
+ // builds and hands to the Worker Loader. What limits it is the DO, not the
129
+ // loader (whose documented limits are concurrency only): the map is built,
130
+ // serialized and passed on from the DO's 128 MB isolate.
131
+ //
132
+ // Measured on a throwaway (2026-09-26; session DO max memoryUsageBytes from
133
+ // GraphQL durableObjectsPeriodicGroups, one launch per minute; a package of
134
+ // 256 KiB distinct modules required whole, verify/release/do-headroom.md),
135
+ // with the map serialized one side module at a time:
136
+ // 4 MiB 64 MB, 8 MiB 81 MB, 12 MiB 97 MB, 16 MiB 110 MB, 20 MiB 126 MB,
137
+ // 24 MiB 145 MB, 28 MiB 164 MB, over an idle 40-55 MB.
138
+ // That is about 4.5 MB of DO per MiB of map. 18 MiB, about 118 MB, is the
139
+ // largest size that leaves about 10 MB of the 128 MB for the rest of the
140
+ // session's work. (Before the single-copy build it was 6-7 MB per MiB: 24 MiB
141
+ // reset the DO.)
142
+ export const ONE_SHOT_MODULE_MAP_MAX_BYTES = 18 * 1024 * 1024;
120
143
  // ── Supervisor heap budget [C'.1] ───────────────────────────────────────
121
144
  //
122
145
  // Three distinct memory regimes, not one shared pool:
@@ -145,6 +168,11 @@ export const MAX_RPC_SAFE_PAYLOAD_BYTES = 28 * 1024 * 1024;
145
168
  // sites known to be missing are listed in HEAP_BLIND_SPOTS. Read a low
146
169
  // percentOfCeiling accordingly.
147
170
  export const SUPERVISOR_HEAP_CEILING_BYTES = 64 * 1024 * 1024;
171
+ // A process facet's own writes its store could not hold (N18: the session's
172
+ // storage is full) are kept in its heap instead, so a write-then-read still
173
+ // works: at most this many bytes, least recently used out first. An eighth
174
+ // of a facet's measured ~208-256 MiB, the rest left to the program.
175
+ export const FACET_OWN_WRITE_MEMORY_BYTES = 32 * 1024 * 1024;
148
176
  // Shared allowance for transient allocations in the supervisor DO. With the
149
177
  // VFS LRU shrunk to 8 MiB during an active reservation, 40 MiB of admitted
150
178
  // payload plus the 9 MiB bundle baseline stays below the 64 MiB soft ceiling
@@ -123,7 +123,7 @@ export declare function isTransientDoReset(input: unknown): boolean;
123
123
  export declare function isDoOverloaded(input: unknown): boolean;
124
124
  /**
125
125
  * How one failed Durable Object call relates to a retry. The taxonomy
126
- * Proteus hand-wrote in `cf-backend/src/lib/do-rpc.ts:71-79` because the
126
+ * Proteus originally hand-wrote in `cf-backend/src/lib/do-rpc.ts` because the
127
127
  * Agents SDK does not export its own, plus the `overloaded` class both
128
128
  * consumers need: Cloudflare documents that errors carry `.retryable` and
129
129
  * `.overloaded`, that a retryable error should be retried with backoff on a
@@ -1 +1 @@
1
- {"version":3,"file":"oom-classify.d.ts","sourceRoot":"","sources":["../src/oom-classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,QAAA,MAAM,UAAU,kLAYN,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAEjD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ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AG,QAAQ,CAmErD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAO1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW;AACrB,8CAA8C;AAC5C,oBAAoB;AACtB,8CAA8C;GAC5C,iBAAiB;AACnB,uEAAuE;GACrE,eAAe;AACjB,wDAAwD;GACtD,gBAAgB;AAClB;kDACkD;GAChD,YAAY;AACd,kEAAkE;GAChE,WAAW,CAAC;AAEhB;2DAC2D;AAC3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAK7D;AAmBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAsB1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAiBpD"}
@@ -125,11 +125,12 @@ export function classifyMessage(msg) {
125
125
  // Subrequest cap (Cloudflare platform)
126
126
  if (m.includes('too many subrequests'))
127
127
  return 'subrequest_cap';
128
- // Worker Loader concurrency cap (Cloudflare platform): a Durable Object
129
- // admits ~5-6 concurrent dynamic workers, and loader-cache entries are
130
- // never released — every distinct loader.get(id) permanently consumes a
131
- // slot, so this cap recurs until the DO itself is replaced.
132
- if (m.includes('too many concurrent dynamic workers'))
128
+ // Dynamic Worker concurrency limit (Cloudflare platform): a Durable Object
129
+ // may have a fixed number of distinct Dynamic Workers with in-flight
130
+ // requests at once (fabric budgets.ts, DO_DYNAMIC_WORKER_LIMIT). Production
131
+ // words it "Dynamic worker concurrency limit exceeded: each request may
132
+ // have up to 10 concurrent dynamic worker invocations. …".
133
+ if (m.includes('dynamic worker concurrency limit exceeded'))
133
134
  return 'dynamic_worker_cap';
134
135
  // Memory exhaustion. workerd trace outcome `exceededMemory`; in-band it
135
136
  // arrives as a `broken.exceededMemory` actor break, a "…exceeded [its]
@@ -311,7 +312,8 @@ export function describeError(input) {
311
312
  const suffix = cause !== 'unknown' ? ` [${cause}]`
312
313
  : isTransientDoReset(input) ? ' [transient-do-reset]'
313
314
  : isDoOverloaded(input) ? ' [do-overloaded]'
314
- : '';
315
+ : classifyDoCall(input) === 'retryable_flag' ? ' [retryable]'
316
+ : '';
315
317
  return `${name}${message}${suffix}`;
316
318
  }
317
319
  function readMessage(input) {
@@ -0,0 +1,65 @@
1
+ /**
2
+ * tracing.ts — Workers custom spans, for modules that cannot import
3
+ * `cloudflare:workers`, as best-effort telemetry that never changes an
4
+ * outcome.
5
+ *
6
+ * The span API is `tracing` from `cloudflare:workers`
7
+ * (https://developers.cloudflare.com/workers/observability/traces/custom-spans/):
8
+ * `enterSpan(name, callback)` runs the callback in a span that is the active
9
+ * parent of every span and platform call made inside it — automatic RPC
10
+ * spans included — and ends it when the callback returns or its promise
11
+ * settles. A span records nothing unless the invocation was head-sampled
12
+ * (`observability.traces.head_sampling_rate`).
13
+ *
14
+ * `setAttributes` and `recordException` shipped on 2026-09-25
15
+ * (https://developers.cloudflare.com/changelog/post/2026-09-25-custom-span-apis/);
16
+ * a runtime from before then has `isTraced` and `setAttribute` only. So the
17
+ * code being traced never touches the runtime's span. It gets a
18
+ * {@link SpanRecorder}, which records only while the span is traced, uses
19
+ * whichever methods the runtime has, and swallows anything a span method
20
+ * throws.
21
+ *
22
+ * Core and fabric stay importable outside workerd, so they reach the API
23
+ * through this leaf: the Worker's composition root hands it over once, at
24
+ * module scope, with {@link adoptTracing}, exactly as it does `ctx.exports`
25
+ * (./composition.ts). With nothing adopted — unit tests, an embedder that
26
+ * never adopts — {@link traced} runs its callback with {@link untraced}.
27
+ */
28
+ /** Attribute values a span holds; `undefined` entries are ignored. */
29
+ export type SpanAttributes = Record<string, string | number | boolean | undefined>;
30
+ /** The runtime's `Span`, as any Workers runtime with `tracing` may have it. */
31
+ export interface RuntimeSpan {
32
+ readonly isTraced: boolean;
33
+ setAttribute?(key: string, value?: string | number | boolean): unknown;
34
+ setAttributes?(attributes: SpanAttributes): unknown;
35
+ recordException?(exception: string | {
36
+ code?: string | number;
37
+ name?: string;
38
+ message?: string;
39
+ stack?: string;
40
+ }): void;
41
+ }
42
+ /** The part of `cloudflare:workers`'s `tracing` Nimbus uses. */
43
+ export interface Tracer {
44
+ enterSpan<T>(name: string, callback: (span: RuntimeSpan) => T): T;
45
+ }
46
+ /** What traced code records on its span. Never throws; records nothing unless the span is traced. */
47
+ export interface SpanRecorder {
48
+ set(attributes: SpanAttributes): void;
49
+ /**
50
+ * Record `error` as an exception event. `code`, when given, replaces the
51
+ * error's own; `context` is prefixed to its message.
52
+ */
53
+ exception(error: unknown, code?: string, context?: string): void;
54
+ }
55
+ /** The recorder of a span that is not traced, or of no span at all. */
56
+ export declare const untraced: SpanRecorder;
57
+ /** Hand this isolate's `tracing` over. The first adoption stands, like `adoptCtxExports`. */
58
+ export declare function adoptTracing(value: Tracer): void;
59
+ /**
60
+ * Run `fn` in a span named `name` carrying `attributes`, and record on it the
61
+ * exception `fn` throws or its promise rejects with. What `fn` returns or
62
+ * throws reaches the caller unchanged, whatever the span does.
63
+ */
64
+ export declare function traced<T>(name: string, attributes: SpanAttributes, fn: (span: SpanRecorder) => T): T;
65
+ //# sourceMappingURL=tracing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../src/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEnF,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;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