@nimbus-sh/worker 0.1.1 → 0.1.3

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +6 -0
  3. package/README.md +38 -3
  4. package/dist/_shared/cache-stats.d.ts +1 -1
  5. package/dist/_shared/cache-stats.js +1 -1
  6. package/dist/_shared/exports-resolver.d.ts +0 -2
  7. package/dist/_shared/exports-resolver.d.ts.map +1 -1
  8. package/dist/_shared/exports-resolver.js +0 -2
  9. package/dist/_shared/session-id.d.ts +10 -8
  10. package/dist/_shared/session-id.d.ts.map +1 -1
  11. package/dist/_shared/session-id.js +13 -12
  12. package/dist/_shared/session-router.d.ts +0 -1
  13. package/dist/_shared/session-router.d.ts.map +1 -1
  14. package/dist/_shared/session-router.js +0 -1
  15. package/dist/auth/index.d.ts +1 -1
  16. package/dist/auth/index.d.ts.map +1 -1
  17. package/dist/auth/index.js +1 -1
  18. package/dist/auth/types.d.ts +2 -1
  19. package/dist/auth/types.d.ts.map +1 -1
  20. package/dist/auth/types.js +4 -1
  21. package/dist/constants.d.ts.map +1 -1
  22. package/dist/constants.js +0 -1
  23. package/dist/facets/cirrus-real.d.ts +1 -1
  24. package/dist/facets/cirrus-real.js +1 -1
  25. package/dist/facets/manager.d.ts +0 -1
  26. package/dist/facets/manager.d.ts.map +1 -1
  27. package/dist/facets/manager.js +3 -15
  28. package/dist/facets/process.d.ts +2 -2
  29. package/dist/facets/process.js +2 -2
  30. package/dist/facets/vite-dev-server.d.ts +3 -3
  31. package/dist/facets/vite-dev-server.d.ts.map +1 -1
  32. package/dist/facets/vite-dev-server.js +6 -8
  33. package/dist/facets/wasm-swap-registry.d.ts +15 -21
  34. package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
  35. package/dist/facets/wasm-swap-registry.js +41 -54
  36. package/dist/facets/ws-terminal.d.ts +4 -5
  37. package/dist/facets/ws-terminal.d.ts.map +1 -1
  38. package/dist/facets/ws-terminal.js +7 -8
  39. package/dist/git/commands.d.ts.map +1 -1
  40. package/dist/git/commands.js +0 -1
  41. package/dist/git/network-facet.d.ts.map +1 -1
  42. package/dist/git/network-facet.js +0 -2
  43. package/dist/git-bundle.generated.d.ts +0 -1
  44. package/dist/git-bundle.generated.d.ts.map +1 -1
  45. package/dist/git-bundle.generated.js +0 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/loaders/child-process/spawn-facet.d.ts +7 -52
  49. package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -1
  50. package/dist/loaders/child-process/spawn-facet.js +7 -49
  51. package/dist/loaders/child-process/spawn-pool.d.ts +5 -44
  52. package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
  53. package/dist/loaders/child-process/spawn-pool.js +5 -44
  54. package/dist/loaders/fanout-pool.d.ts +18 -65
  55. package/dist/loaders/fanout-pool.d.ts.map +1 -1
  56. package/dist/loaders/fanout-pool.js +25 -87
  57. package/dist/loaders/generated-workers.d.ts +1 -2
  58. package/dist/loaders/generated-workers.d.ts.map +1 -1
  59. package/dist/loaders/generated-workers.js +3 -4
  60. package/dist/loaders/loader-pool.d.ts +1 -2
  61. package/dist/loaders/loader-pool.d.ts.map +1 -1
  62. package/dist/loaders/loader-pool.js +1 -1
  63. package/dist/loaders/npm-resolve-preamble.d.ts +4 -5
  64. package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
  65. package/dist/loaders/npm-resolve-preamble.js +14 -21
  66. package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -1
  67. package/dist/loaders/pre-bundle-preamble.js +0 -1
  68. package/dist/npm/cache.js +1 -1
  69. package/dist/npm/install-batch-facet.d.ts.map +1 -1
  70. package/dist/npm/install-batch-facet.js +7 -12
  71. package/dist/npm/installer.d.ts +5 -7
  72. package/dist/npm/installer.d.ts.map +1 -1
  73. package/dist/npm/installer.js +20 -101
  74. package/dist/npm/r2-cache.d.ts +17 -29
  75. package/dist/npm/r2-cache.d.ts.map +1 -1
  76. package/dist/npm/r2-cache.js +16 -27
  77. package/dist/npm/resolve-facet.d.ts +11 -17
  78. package/dist/npm/resolve-facet.d.ts.map +1 -1
  79. package/dist/npm/resolve-facet.js +14 -28
  80. package/dist/npm/resolve-one-facet.d.ts +10 -13
  81. package/dist/npm/resolve-one-facet.d.ts.map +1 -1
  82. package/dist/npm/resolve-one-facet.js +8 -10
  83. package/dist/npm/resolver.d.ts +0 -2
  84. package/dist/npm/resolver.d.ts.map +1 -1
  85. package/dist/npm/resolver.js +0 -12
  86. package/dist/observability/oom-discriminator.d.ts +0 -2
  87. package/dist/observability/oom-discriminator.d.ts.map +1 -1
  88. package/dist/observability/oom-discriminator.js +0 -2
  89. package/dist/replica/routing.js +1 -1
  90. package/dist/router/index.d.ts +6 -2
  91. package/dist/router/index.d.ts.map +1 -1
  92. package/dist/router/index.js +4 -0
  93. package/dist/router/remote-api.d.ts +44 -0
  94. package/dist/router/remote-api.d.ts.map +1 -0
  95. package/dist/router/remote-api.js +333 -0
  96. package/dist/runtime/barrel-synthesizer.js +1 -1
  97. package/dist/runtime/clang-runner.d.ts +5 -6
  98. package/dist/runtime/clang-runner.d.ts.map +1 -1
  99. package/dist/runtime/clang-runner.js +5 -6
  100. package/dist/runtime/esbuild-service.d.ts.map +1 -1
  101. package/dist/runtime/esbuild-service.js +0 -3
  102. package/dist/runtime/framework-detect.d.ts +0 -1
  103. package/dist/runtime/framework-detect.d.ts.map +1 -1
  104. package/dist/runtime/framework-detect.js +0 -1
  105. package/dist/runtime/node-runner.d.ts +1 -1
  106. package/dist/runtime/node-runner.js +1 -1
  107. package/dist/runtime/node-shims.d.ts.map +1 -1
  108. package/dist/runtime/node-shims.js +0 -22
  109. package/dist/runtime/package-manager.d.ts +2 -7
  110. package/dist/runtime/package-manager.d.ts.map +1 -1
  111. package/dist/runtime/package-manager.js +2 -7
  112. package/dist/runtime/process-logs-api.js +1 -1
  113. package/dist/runtime/process-logs.d.ts +0 -1
  114. package/dist/runtime/process-logs.d.ts.map +1 -1
  115. package/dist/runtime/process-table.d.ts +2 -2
  116. package/dist/runtime/process-table.d.ts.map +1 -1
  117. package/dist/runtime/process-table.js +1 -1
  118. package/dist/runtime/python-repl.d.ts +0 -1
  119. package/dist/runtime/python-repl.d.ts.map +1 -1
  120. package/dist/runtime/python-repl.js +0 -1
  121. package/dist/runtime/python-runner.d.ts +1 -2
  122. package/dist/runtime/python-runner.d.ts.map +1 -1
  123. package/dist/runtime/python-runner.js +1 -3
  124. package/dist/runtime/repl-session.d.ts +0 -1
  125. package/dist/runtime/repl-session.d.ts.map +1 -1
  126. package/dist/runtime/repl-session.js +1 -2
  127. package/dist/runtime/require-resolver.d.ts.map +1 -1
  128. package/dist/runtime/require-resolver.js +1 -4
  129. package/dist/runtime/ruby-runner.d.ts +0 -1
  130. package/dist/runtime/ruby-runner.d.ts.map +1 -1
  131. package/dist/runtime/ruby-runner.js +0 -1
  132. package/dist/runtime/runtime-catalog.d.ts +2 -4
  133. package/dist/runtime/runtime-catalog.d.ts.map +1 -1
  134. package/dist/runtime/runtime-catalog.js +2 -4
  135. package/dist/runtime/runtime-registry.d.ts +1 -1
  136. package/dist/runtime/runtime-registry.js +1 -1
  137. package/dist/runtime/streams.d.ts.map +1 -1
  138. package/dist/runtime/streams.js +0 -1
  139. package/dist/runtime/wasi-instance.d.ts +35 -45
  140. package/dist/runtime/wasi-instance.d.ts.map +1 -1
  141. package/dist/runtime/wasi-instance.js +87 -103
  142. package/dist/runtime/wasm-runner.d.ts +9 -15
  143. package/dist/runtime/wasm-runner.d.ts.map +1 -1
  144. package/dist/runtime/wasm-runner.js +23 -29
  145. package/dist/session/bindings.d.ts +2 -7
  146. package/dist/session/bindings.d.ts.map +1 -1
  147. package/dist/session/bindings.js +3 -8
  148. package/dist/session/helpers.d.ts +2 -9
  149. package/dist/session/helpers.d.ts.map +1 -1
  150. package/dist/session/helpers.js +2 -10
  151. package/dist/session/init.d.ts +3 -6
  152. package/dist/session/init.d.ts.map +1 -1
  153. package/dist/session/init.js +25 -30
  154. package/dist/session/nimbus-session.d.ts +1 -1
  155. package/dist/session/nimbus-session.js +5 -5
  156. package/dist/session/routes.d.ts.map +1 -1
  157. package/dist/session/routes.js +9 -16
  158. package/dist/session/rpc.d.ts +2 -2
  159. package/dist/session/rpc.js +6 -6
  160. package/dist/session/supervisor-rpc.d.ts +1 -2
  161. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  162. package/dist/session/supervisor-rpc.js +1 -5
  163. package/dist/shell/features.d.ts +5 -5
  164. package/dist/shell/features.js +6 -6
  165. package/dist/shell/unix-commands.js +15 -15
  166. package/dist/vfs/dev-provider.d.ts +1 -1
  167. package/dist/vfs/dev-provider.js +1 -1
  168. package/dist/vfs/sqlite-vfs.d.ts +3 -3
  169. package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
  170. package/dist/vfs/sqlite-vfs.js +10 -11
  171. package/package.json +13 -2
  172. package/public/s/index.html +44 -75
  173. package/scripts/bundle-facet-workers.mjs +1 -1
  174. package/scripts/bundle-git.mjs +1 -1
@@ -1,20 +1,16 @@
1
1
  /**
2
- * r2-cache.ts — L3 cross-tenant npm cache backed by R2 [W4]
3
- * + L2 colo cache via `caches.default` [cache-and-scrub P3]
2
+ * r2-cache.ts — cross-tenant npm cache backed by R2 and caches.default.
4
3
  *
5
4
  * Purpose
6
5
  * ───────
7
- * Mirrors the Pyodide / Python Workers Package Bundling System pattern
8
- * (EW/SPEC at wiki.cfdata.org). The supervisor DO already maintains a
9
- * per-tenant SQLite cache (src/npm-cache.ts). This module adds an L3
10
- * cross-tenant tier in R2 so that one tenant's first-install of a package
11
- * benefits every subsequent tenant on the platform — the win that drops
12
- * Mossaic-class cold installs from ~60 s to a target ≤ 15 s.
6
+ * The supervisor DO already maintains a per-tenant SQLite cache. This
7
+ * module adds a cross-tenant tier in R2 so that one tenant's first install
8
+ * of a package benefits subsequent tenants on the platform.
13
9
  *
14
10
  * Caching layers (top-down):
15
11
  * L1 — per-DO SQLite (warmest, in-memory; ~1 ms per file)
16
- * L2 — `caches.default` (per-colo; ~50-500 µs hit / ~5-30 ms cold) ← P3 wins
17
- * L3 — R2 (global; ~30-100 ms regional) ← THIS MODULE
12
+ * L2 — caches.default (per-colo; ~50-500 µs hit / ~5-30 ms cold)
13
+ * L3 — R2 (global; ~30-100 ms regional)
18
14
  * L4 — registry.npmjs.org origin (~100-300 ms cross-region)
19
15
  *
20
16
  * Two buckets, two key shapes:
@@ -38,24 +34,18 @@
38
34
  * (deploy without buckets created, or wrangler dev without remote
39
35
  * buckets), all R2 calls return null on read and no-op on write. The
40
36
  * installer falls through to the existing network-fetch path with
41
- * identical behaviour to today's main.
37
+ * identical behaviour to the uncached install path.
42
38
  *
43
- * NOT in W4 scope (deferred):
39
+ * Deliberately out of scope here:
44
40
  * - Streamed R2 reads via ReadableStream<Uint8Array> RPC return type
45
- * (W7 — Streams over RPC). Today: bytes returned via structured-clone
41
+ * Today: bytes returned via structured-clone
46
42
  * subject to the 32 MiB cap. Packages > 30 MiB skip the R2 path and
47
43
  * stream directly from npm.
48
- * - npm publish webhook → cache invalidation (CT2 future).
49
- * - L2 Cache API (D3.5) — separate work.
50
- *
51
- * References:
52
- * - audit/sections/CF-INTERNAL-OPTIMIZATION-RESEARCH.md §D
53
- * - audit/_drafts/D-npm-install.md (per-section provenance)
54
- * - audit/sections/W4-plan.md
44
+ * - npm publish webhook -> cache invalidation.
55
45
  */
56
46
  import type { CacheTier, CacheKind } from '../_shared/cache-stats.js';
57
47
  /**
58
- * Per-call cache-stat event (cache-observability wave). R2CacheClient
48
+ * Per-call cache-stat event (cache metrics support). R2CacheClient
59
49
  * accumulates these in instance state so the SupervisorRPC caller can
60
50
  * drain + forward to the DO isolate (where /api/_diag/cache reads from).
61
51
  * The local-singleton-write approach would be invisible to the DO's
@@ -76,7 +66,7 @@ export type R2CacheStatEvent = {
76
66
  * everything atomically (e.g. if the storage shape changes or a bug
77
67
  * poisoned a class of keys). */
78
68
  export declare const R2_CACHE_PREFIX = "v1";
79
- /** Packument TTL — 60 min (cache-observability wave; was 5 min pre-wave).
69
+ /** Packument TTL — 60 min (cache metrics support; was 5 min pre-wave).
80
70
  *
81
71
  * Rationale for the bump (~12× longer than pre-wave):
82
72
  *
@@ -154,18 +144,17 @@ export declare const L2_KEY_HOST = "https://nimbus-cache.invalid";
154
144
  /**
155
145
  * Compose the R2 object key for a tarball.
156
146
  *
157
- * Scheme A from W4-plan §3: `t/<name>/<version>.tgz`. Scope-prefixed
147
+ * Tarball keys use `t/<name>/<version>.tgz`. Scope-prefixed
158
148
  * names (`@scope/pkg`) keep their `@` and `/` because R2 keys allow any
159
149
  * UTF-8; we don't URL-encode them. Examples:
160
150
  *
161
151
  * react@19.0.0 → `v1/t/react/19.0.0.tgz`
162
152
  * @vitejs/plugin-react@4.3.4 → `v1/t/@vitejs/plugin-react/4.3.4.tgz`
163
153
  *
164
- * The integrity digest is NOT in the key (Scheme B was rejected per
165
- * W4-plan §3; reads validate integrity post-fetch). Scheme A enables
166
- * pipelining: as soon as the resolver yields {name, version}, the
167
- * install facet can speculatively kick off getTarball() in parallel
168
- * with the network fetch.
154
+ * The integrity digest is not in the key; reads validate integrity
155
+ * post-fetch. This shape enables pipelining: as soon as the resolver yields
156
+ * {name, version}, the install facet can speculatively kick off getTarball()
157
+ * in parallel with the network fetch.
169
158
  */
170
159
  export declare function tarballKey(name: string, version: string): string;
171
160
  /** Compose the R2 object key for a packument. */
@@ -174,7 +163,6 @@ export declare function packumentKey(name: string): string;
174
163
  * Per-instance counters surfaced for tests / probes. Read via
175
164
  * `R2CacheClient.stats()`. Track at the FUNCTION boundary level so a
176
165
  * call that hits L2 bumps `l2HitsPackument` but NOT `l3GetsPackument`,
177
- * and vice versa. The probe at audit/probes/cache-and-scrub/* asserts
178
166
  * "after the first call, no more l3GetsPackument" — structurally
179
167
  * proving the L2 layer is functional even when local-dev wall-clock
180
168
  * latency is too noisy to demonst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C,eAAe,GAAG,IAAI,CAAC;IA8EjE;;;;;;OAMG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAchE,yDAAyD;IACnD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUrD,uEAAuE;IACvE,gBAAgB,IAAI,OAAO;IAI3B,uEAAuE;IACvE,kBAAkB,IAAI,OAAO;CAG9B"}
@@ -1,20 +1,16 @@
1
1
  /**
2
- * r2-cache.ts — L3 cross-tenant npm cache backed by R2 [W4]
3
- * + L2 colo cache via `caches.default` [cache-and-scrub P3]
2
+ * r2-cache.ts — cross-tenant npm cache backed by R2 and caches.default.
4
3
  *
5
4
  * Purpose
6
5
  * ───────
7
- * Mirrors the Pyodide / Python Workers Package Bundling System pattern
8
- * (EW/SPEC at wiki.cfdata.org). The supervisor DO already maintains a
9
- * per-tenant SQLite cache (src/npm-cache.ts). This module adds an L3
10
- * cross-tenant tier in R2 so that one tenant's first-install of a package
11
- * benefits every subsequent tenant on the platform — the win that drops
12
- * Mossaic-class cold installs from ~60 s to a target ≤ 15 s.
6
+ * The supervisor DO already maintains a per-tenant SQLite cache. This
7
+ * module adds a cross-tenant tier in R2 so that one tenant's first install
8
+ * of a package benefits subsequent tenants on the platform.
13
9
  *
14
10
  * Caching layers (top-down):
15
11
  * L1 — per-DO SQLite (warmest, in-memory; ~1 ms per file)
16
- * L2 — `caches.default` (per-colo; ~50-500 µs hit / ~5-30 ms cold) ← P3 wins
17
- * L3 — R2 (global; ~30-100 ms regional) ← THIS MODULE
12
+ * L2 — caches.default (per-colo; ~50-500 µs hit / ~5-30 ms cold)
13
+ * L3 — R2 (global; ~30-100 ms regional)
18
14
  * L4 — registry.npmjs.org origin (~100-300 ms cross-region)
19
15
  *
20
16
  * Two buckets, two key shapes:
@@ -38,26 +34,20 @@
38
34
  * (deploy without buckets created, or wrangler dev without remote
39
35
  * buckets), all R2 calls return null on read and no-op on write. The
40
36
  * installer falls through to the existing network-fetch path with
41
- * identical behaviour to today's main.
37
+ * identical behaviour to the uncached install path.
42
38
  *
43
- * NOT in W4 scope (deferred):
39
+ * Deliberately out of scope here:
44
40
  * - Streamed R2 reads via ReadableStream<Uint8Array> RPC return type
45
- * (W7 — Streams over RPC). Today: bytes returned via structured-clone
41
+ * Today: bytes returned via structured-clone
46
42
  * subject to the 32 MiB cap. Packages > 30 MiB skip the R2 path and
47
43
  * stream directly from npm.
48
- * - npm publish webhook → cache invalidation (CT2 future).
49
- * - L2 Cache API (D3.5) — separate work.
50
- *
51
- * References:
52
- * - audit/sections/CF-INTERNAL-OPTIMIZATION-RESEARCH.md §D
53
- * - audit/_drafts/D-npm-install.md (per-section provenance)
54
- * - audit/sections/W4-plan.md
44
+ * - npm publish webhook -> cache invalidation.
55
45
  */
56
46
  /** Schema version baked into every cache key. Bump to invalidate
57
47
  * everything atomically (e.g. if the storage shape changes or a bug
58
48
  * poisoned a class of keys). */
59
49
  export const R2_CACHE_PREFIX = 'v1';
60
- /** Packument TTL — 60 min (cache-observability wave; was 5 min pre-wave).
50
+ /** Packument TTL — 60 min (cache metrics support; was 5 min pre-wave).
61
51
  *
62
52
  * Rationale for the bump (~12× longer than pre-wave):
63
53
  *
@@ -180,18 +170,17 @@ async function l2Put(key, body) {
180
170
  /**
181
171
  * Compose the R2 object key for a tarball.
182
172
  *
183
- * Scheme A from W4-plan §3: `t/<name>/<version>.tgz`. Scope-prefixed
173
+ * Tarball keys use `t/<name>/<version>.tgz`. Scope-prefixed
184
174
  * names (`@scope/pkg`) keep their `@` and `/` because R2 keys allow any
185
175
  * UTF-8; we don't URL-encode them. Examples:
186
176
  *
187
177
  * react@19.0.0 → `v1/t/react/19.0.0.tgz`
188
178
  * @vitejs/plugin-react@4.3.4 → `v1/t/@vitejs/plugin-react/4.3.4.tgz`
189
179
  *
190
- * The integrity digest is NOT in the key (Scheme B was rejected per
191
- * W4-plan §3; reads validate integrity post-fetch). Scheme A enables
192
- * pipelining: as soon as the resolver yields {name, version}, the
193
- * install facet can speculatively kick off getTarball() in parallel
194
- * with the network fetch.
180
+ * The integrity digest is not in the key; reads validate integrity
181
+ * post-fetch. This shape enables pipelining: as soon as the resolver yields
182
+ * {name, version}, the install facet can speculatively kick off getTarball()
183
+ * in parallel with the network fetch.
195
184
  */
196
185
  export function tarballKey(name, version) {
197
186
  return `${R2_CACHE_PREFIX}/t/${name}/${version}.tgz`;
@@ -59,9 +59,9 @@
59
59
  * over the wire). For warm sessions, ~500 B per cached entry × at
60
60
  * most 5000 entries = 2.5 MB, well under the 32 MB RPC cap.
61
61
  *
62
- * Cache writes flow back via env.SUPERVISOR.putRegistryEntries in
63
- * waves (every 50 resolved packages or end-of-phase, whichever first).
64
- * Doesn't block forward progress.
62
+ * Cache writes flow back via env.SUPERVISOR.putRegistryEntries in batches
63
+ * of 50 resolved packages or at end-of-phase. They do not block forward
64
+ * progress.
65
65
  */
66
66
  import type { ResolvedPackage } from './resolver.js';
67
67
  export interface FacetCachedEntry {
@@ -72,8 +72,7 @@ export interface FacetCachedEntry {
72
72
  tarballUrl: string;
73
73
  integrity: string;
74
74
  depsJson: string;
75
- /** X.5-F R2: required peerDependencies (optionals filtered). Optional
76
- * for backward compat with supervisor builds that pre-date X.5-F. */
75
+ /** Required peerDependencies with optionals filtered. */
77
76
  peerDepsJson?: string;
78
77
  exportsJson: string;
79
78
  main: string;
@@ -94,15 +93,13 @@ export interface ResolveFacetSpec {
94
93
  fetchTimeoutMs: number;
95
94
  /** Cap on retries for transient failures. */
96
95
  retries: number;
97
- /** W11: when true, FRAMEWORK_REQUIRED_PACKAGES (vite, …) are exempted
98
- * from the skip list. See audit/sections/W11-plan.md §3.0. */
96
+ /** When true, framework-required packages such as vite bypass the skip list. */
99
97
  frameworkAware?: boolean;
100
98
  }
101
99
  /**
102
- * W6.5: Telemetry-event mirror of `RegistryEvent` (defined in
103
- * `src/wasm-swap-registry.ts`). The facet cannot import the registry
104
- * (preamble has no import surface), so the type is duplicated here.
105
- * Parity is gated by audit/probes/w6.5/regression/event-fires-from-facet.mjs.
100
+ * Telemetry-event mirror of `RegistryEvent`. The facet cannot import the
101
+ * registry directly because the preamble has no import surface, so the type
102
+ * is duplicated here.
106
103
  */
107
104
  export type FacetRegistryEvent = {
108
105
  type: 'swap';
@@ -127,12 +124,9 @@ export interface ResolveFacetResult {
127
124
  * `[resolve-facet] <line>`. Bounded to ~one line per resolved spec. */
128
125
  messages: string[];
129
126
  /**
130
- * W6.5: registry decisions taken inside the facet (swap / transitive-
131
- * skip / reject). Drained by the supervisor and forwarded to the
132
- * registry sink via `emitRegistryEvent`. See npm-installer.ts.
133
- *
134
- * Note: throw-path reject events do NOT reach this field today (the
135
- * facet throws before returning). Documented gap in W6.5-plan §5.3.
127
+ * Registry decisions taken inside the facet. Successful returns are drained
128
+ * by the supervisor and forwarded to the registry sink. Throw-path rejects
129
+ * do not reach this field because the facet returns through the error path.
136
130
  */
137
131
  registryEvents: FacetRegistryEvent[];
138
132
  /** Counter snapshot at end of phase. Mirrors src/diag-counters.ts shape
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-facet.d.ts","sourceRoot":"","sources":["../../src/npm/resolve-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIrD,MAAM,WAAW,gBAAgB;IAC/B;iEAC6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;0EACsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC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59,9 @@
59
59
  * over the wire). For warm sessions, ~500 B per cached entry × at
60
60
  * most 5000 entries = 2.5 MB, well under the 32 MB RPC cap.
61
61
  *
62
- * Cache writes flow back via env.SUPERVISOR.putRegistryEntries in
63
- * waves (every 50 resolved packages or end-of-phase, whichever first).
64
- * Doesn't block forward progress.
62
+ * Cache writes flow back via env.SUPERVISOR.putRegistryEntries in batches
63
+ * of 50 resolved packages or at end-of-phase. They do not block forward
64
+ * progress.
65
65
  */
66
66
  // ── Facet function ──────────────────────────────────────────────────────
67
67
  //
@@ -440,22 +440,16 @@ export const resolveTreeInFacet = async function resolveTreeInFacet(spec, env) {
440
440
  };
441
441
  // X.5-F R1: names the user typed at the top level + required peer-deps
442
442
  // bypass SKIP_PACKAGES. Populated lazily as the BFS walk discovers
443
- // peer-deps. See audit/sections/X5F-plan.md §6.1-§6.2.
444
443
  const topLevelNames = new Set(Object.keys(spec.specs));
445
444
  /** Resolve one spec: cache-hit or fetch packument. */
446
445
  const resolveOne = async (name, range) => {
447
446
  // @ts-ignore — SHOULD_SKIP_PACKAGE provided by preamble.
448
447
  if (!topLevelNames.has(name) && SHOULD_SKIP_PACKAGE(name, !!spec.frameworkAware))
449
448
  return null;
450
- // W6: registry transitive policy. Swap rewrites name in flight;
451
- // 'fail' rejects throw; 'warn' rejects log [skip] and drop.
452
- // W6.5: each decision also pushes a RegistryEvent into __pendingEvents
453
- // (preamble-provided), drained by the supervisor after the facet
454
- // returns. NOTE: the throw-path reject case below stops execution
455
- // BEFORE __DRAIN_EVENTS is read by the caller — so reject events
456
- // from the facet are an accepted incomplete-coverage gap (W6.5-plan
457
- // §5.3). We still push them in case a future caller change drains
458
- // events from the rejected ResolveFacetResult.
449
+ // Registry transitive policy. Swaps rewrite names in flight; 'fail'
450
+ // rejects throw; 'warn' rejects log [skip] and drop. Decisions are also
451
+ // pushed into the preamble-provided event buffer, which the supervisor
452
+ // drains after successful facet returns.
459
453
  let effName = name;
460
454
  // @ts-ignore — SHOULD_SWAP provided by preamble.
461
455
  const __swap = SHOULD_SWAP(name);
@@ -489,9 +483,9 @@ export const resolveTreeInFacet = async function resolveTreeInFacet(spec, env) {
489
483
  // registry reject without relying on message-prefix string
490
484
  // matching. Mirror of supervisor-side RegistryRejectError.
491
485
  const err = new Error(`npm install rejected: ${__fail.from} — ${__fail.reason}`);
492
- err.__w6_reject = true;
493
- err.__w6_reject_from = __fail.from;
494
- err.__w6_reject_reason = __fail.reason;
486
+ err.__nimbus_registry_reject = true;
487
+ err.__nimbus_registry_reject_from = __fail.from;
488
+ err.__nimbus_registry_reject_reason = __fail.reason;
495
489
  throw err;
496
490
  }
497
491
  }
@@ -632,8 +626,6 @@ export const resolveTreeInFacet = async function resolveTreeInFacet(spec, env) {
632
626
  // killed the install once X.5-26b made lightningcss `transitive:
633
627
  // 'fail'`. The user only typed `npm install drizzle-orm`; expo-sqlite
634
628
  // and its mobile-build chain are best-effort by intent. See
635
- // audit/sections/X5-drizzle-plan.md §2 (revised) and the trace probe
636
- // audit/probes/x5-drizzle/investigation/04-trace-lightningcss-from-drizzle.mjs.
637
629
  const bestEffortNames = new Set();
638
630
  const queue2 = Object.entries(spec.specs);
639
631
  // F-2 profiling: emit per-layer width when host marks the diag flag.
@@ -677,14 +669,10 @@ export const resolveTreeInFacet = async function resolveTreeInFacet(spec, env) {
677
669
  return pkg;
678
670
  }
679
671
  catch (e) {
680
- // W6: REJECT_INSTALL with transitive='fail' throws from
681
- // resolveOne tagged with `__w6_reject = true`. Propagate
682
- // those — turning them into "UNHANDLED" log lines would
683
- // silently partial-install. Other UNHANDLEDs continue to
684
- // log + drop. Detection via own-property survives the
685
- // postMessage / fn.toString() boundary (prototype is lost
686
- // on that boundary, so `instanceof` would not work).
687
- if (e && typeof e === 'object' && e.__w6_reject === true) {
672
+ // REJECT_INSTALL with transitive='fail' throws from resolveOne
673
+ // with an own-property tag. Propagate those; turning them into
674
+ // "UNHANDLED" log lines would silently partial-install.
675
+ if (e && typeof e === 'object' && e.__nimbus_registry_reject === true) {
688
676
  // X.5-drizzle: REJECT_INSTALL transitive='fail' that fires
689
677
  // INSIDE an X.5-J best-effort optional-peer subtree
690
678
  // (R2.5 enqueue) softly skips the offending package
@@ -692,7 +680,6 @@ export const resolveTreeInFacet = async function resolveTreeInFacet(spec, env) {
692
680
  // not explicitly ask for the optional-peer-rooted
693
681
  // subtree; mirror npm's --omit=optional behaviour for
694
682
  // its descendants. See VERIFY-9D4B61D §6 + the trace
695
- // probe at audit/probes/x5-drizzle/investigation/
696
683
  // 04-trace-lightningcss-from-drizzle.mjs for the
697
684
  // canonical drizzle-orm → expo-sqlite → expo → @expo/
698
685
  // metro-config → lightningcss chain.
@@ -772,7 +759,6 @@ export const resolveTreeInFacet = async function resolveTreeInFacet(spec, env) {
772
759
  // Uses preamble-injected SHOULD_REJECT_FAIL +
773
760
  // SHOULD_WARN_SKIP_TRANSITIVE accessors (the facet body is
774
761
  // serialised via fn.toString() and cannot import lookupReject).
775
- // See audit/sections/X5J-plan.md §3 for the full rationale and
776
762
  // §3.6 for why we soft-skip BOTH transitive='fail' (loud reject)
777
763
  // and transitive='warn' optional peers — symmetry with the
778
764
  // existing transitive walk's silent-skip of warn-tier peers, plus
@@ -1,13 +1,11 @@
1
1
  /**
2
- * resolve-one-facet.ts — F-2 frontier-coordinator per-package task body.
2
+ * resolve-one-facet.ts — per-package resolution task body.
3
3
  *
4
4
  * Why this exists
5
5
  * ───────────────
6
- * F-2 (cleanup-not-done wave) replaces the single resolve-facet that
7
- * runs the WHOLE BFS in one isolate with a frontier-coordinator at the
8
- * supervisor that submits each layer of N packages as N independent
9
- * fanout tasks. This file is the per-task body — one packument fetch +
10
- * version pick + edge-extraction.
6
+ * The supervisor coordinates each dependency layer and submits packages as
7
+ * independent fanout tasks. This file is the per-task body: one packument
8
+ * fetch, one version pick, and edge extraction.
11
9
  *
12
10
  * Each task runs inside a Worker Loader isolate (NimbusFanoutPool routes
13
11
  * automatically: <5 = in-DO, ≥5 = peer-DO). The isolate is short-lived;
@@ -35,17 +33,17 @@
35
33
  * out of the returned `pkg` and decides what goes in layer N+1.
36
34
  * - Cycle detection: the supervisor maintains the `seen` set across
37
35
  * layers. The task only sees one (name, range) per call.
38
- * - X.5-drizzle best-effort tagging: the supervisor maintains the
36
+ * - Best-effort optional-peer tagging: the supervisor maintains the
39
37
  * bestEffortNames set; the task returns the `pkg` raw and the
40
38
  * supervisor decides whether a downstream reject silent-skips or
41
39
  * propagates.
42
- * - X.5-F top-level handling: the supervisor maintains topLevelNames.
40
+ * - Top-level handling: the supervisor maintains topLevelNames.
43
41
  * `topLevel` is passed in per task so SKIP_PACKAGES bypass works.
44
42
  *
45
43
  * What the task DOES do
46
44
  * ─────────────────────
47
45
  * 1. Apply SKIP_PACKAGES filter (unless `topLevel`).
48
- * 2. Apply W6 swap / warn-skip / reject-fail registry policy.
46
+ * 2. Apply swap / warn-skip / reject-fail registry policy.
49
47
  * 3. Try in-task cache from `cachedHit` (one entry shipped from
50
48
  * supervisor's NpmCache).
51
49
  * 4. R2 packument cache race (250 ms timeout) via env.SUPERVISOR
@@ -115,7 +113,7 @@ export interface ResolveOneResult {
115
113
  cacheWrites: any[];
116
114
  /** [npm] log lines, forwarded by the supervisor. */
117
115
  messages: string[];
118
- /** W6.5 telemetry events to emitRegistryEvent. */
116
+ /** Registry telemetry events to emitRegistryEvent. */
119
117
  events: FacetRegistryEvent[];
120
118
  /**
121
119
  * Diagnostic: how many bytes the task fetched/decoded. Folded into
@@ -149,9 +147,8 @@ export interface ResolveOneResult {
149
147
  cacheKind: 'packument';
150
148
  }>;
151
149
  /**
152
- * W6 reject. The supervisor inspects this and either propagates
153
- * (regular path) or silent-skips (X.5-drizzle best-effort path) —
154
- * the task doesn't see bestEffortNames.
150
+ * Registry reject. The supervisor inspects this and either propagates it
151
+ * or silent-skips best-effort optional-peer paths.
155
152
  */
156
153
  error?: {
157
154
  type: 'w6-reject';
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-one-facet.d.ts","source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;YACE,MAAM,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,OAAO,CAAA;aAAE,GAAG,IAAI,CAAC;YACjE,MAAM,EAAE,KAAK,CACT;gBAAE,IAAI,EAAE,KAAK,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,GAC/D;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE,CACpD,CAAC;SACH,CACJ,CAAC;QACF,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KACvE,CAAC;CACH,KACA,OAAO,CAAC,gBAAgB,CAmV1B,CAAC"}
@@ -1,13 +1,11 @@
1
1
  /**
2
- * resolve-one-facet.ts — F-2 frontier-coordinator per-package task body.
2
+ * resolve-one-facet.ts — per-package resolution task body.
3
3
  *
4
4
  * Why this exists
5
5
  * ───────────────
6
- * F-2 (cleanup-not-done wave) replaces the single resolve-facet that
7
- * runs the WHOLE BFS in one isolate with a frontier-coordinator at the
8
- * supervisor that submits each layer of N packages as N independent
9
- * fanout tasks. This file is the per-task body — one packument fetch +
10
- * version pick + edge-extraction.
6
+ * The supervisor coordinates each dependency layer and submits packages as
7
+ * independent fanout tasks. This file is the per-task body: one packument
8
+ * fetch, one version pick, and edge extraction.
11
9
  *
12
10
  * Each task runs inside a Worker Loader isolate (NimbusFanoutPool routes
13
11
  * automatically: <5 = in-DO, ≥5 = peer-DO). The isolate is short-lived;
@@ -35,17 +33,17 @@
35
33
  * out of the returned `pkg` and decides what goes in layer N+1.
36
34
  * - Cycle detection: the supervisor maintains the `seen` set across
37
35
  * layers. The task only sees one (name, range) per call.
38
- * - X.5-drizzle best-effort tagging: the supervisor maintains the
36
+ * - Best-effort optional-peer tagging: the supervisor maintains the
39
37
  * bestEffortNames set; the task returns the `pkg` raw and the
40
38
  * supervisor decides whether a downstream reject silent-skips or
41
39
  * propagates.
42
- * - X.5-F top-level handling: the supervisor maintains topLevelNames.
40
+ * - Top-level handling: the supervisor maintains topLevelNames.
43
41
  * `topLevel` is passed in per task so SKIP_PACKAGES bypass works.
44
42
  *
45
43
  * What the task DOES do
46
44
  * ─────────────────────
47
45
  * 1. Apply SKIP_PACKAGES filter (unless `topLevel`).
48
- * 2. Apply W6 swap / warn-skip / reject-fail registry policy.
46
+ * 2. Apply swap / warn-skip / reject-fail registry policy.
49
47
  * 3. Try in-task cache from `cachedHit` (one entry shipped from
50
48
  * supervisor's NpmCache).
51
49
  * 4. R2 packument cache race (250 ms timeout) via env.SUPERVISOR
@@ -99,7 +97,7 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
99
97
  if (!spec.topLevel && SHOULD_SKIP_PACKAGE(spec.name, !!spec.frameworkAware)) {
100
98
  return out(null, 0, 'skipped');
101
99
  }
102
- // 2. W6 registry policy.
100
+ // 2. Registry policy.
103
101
  let effName = spec.name;
104
102
  // @ts-ignore — preamble.
105
103
  const __swap = SHOULD_SWAP(spec.name);
@@ -74,7 +74,6 @@ export declare function resolvePackage(name: string, versionRange: string, cache
74
74
  * W11: pass `opts.frameworkAware = true` when the project is detected as
75
75
  * one of {next, astro, nuxt, remix, sveltekit, vite, wrangler} so that
76
76
  * `vite` (and any future FRAMEWORK_REQUIRED_PACKAGES additions) actually
77
- * land in node_modules. See audit/sections/W11-plan.md §3.0.
78
77
  */
79
78
  export declare function resolveTree(specs: Record<string, string>, cache: NpmCache, onResolved?: (pkg: ResolvedPackage) => void, onProgress?: (msg: string) => void, fetchFn?: FetchFn, opts?: {
80
79
  frameworkAware?: boolean;
@@ -103,7 +102,6 @@ export declare function shouldSkipPackage(name: string): boolean;
103
102
  * Callers detect framework presence via `framework-detect.ts` BEFORE
104
103
  * starting resolution and thread the flag through `resolveTree`.
105
104
  *
106
- * See audit/sections/W11-plan.md §3.0.
107
105
  */
108
106
  export declare function shouldSkipPackageWithFramework(name: string, frameworkAware: boolean): boolean;
109
107
  //# sourceMappingURL=resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/npm/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AA0B/D;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAmBnF;AAID,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;yBAEqB;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;kEAG8D;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C;;8CAE0C;IAC1C,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,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E,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GACrC,SAAS,CA8BX;AAyDD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,OAAO,GACtB,OAAO,CAGT"}
@@ -462,7 +462,6 @@ function versionToResolved(vData) {
462
462
  * when there are no required peers, so downstream code can use a single
463
463
  * truthiness check.
464
464
  *
465
- * X.5-F R2 — see audit/sections/X5F-plan.md §3.
466
465
  */
467
466
  function extractRequiredPeers(vData) {
468
467
  const peers = vData.peerDependencies;
@@ -507,7 +506,6 @@ function registryCacheToResolved(entry) {
507
506
  * W11: pass `opts.frameworkAware = true` when the project is detected as
508
507
  * one of {next, astro, nuxt, remix, sveltekit, vite, wrangler} so that
509
508
  * `vite` (and any future FRAMEWORK_REQUIRED_PACKAGES additions) actually
510
- * land in node_modules. See audit/sections/W11-plan.md §3.0.
511
509
  */
512
510
  export async function resolveTree(specs, cache, onResolved, onProgress, fetchFn, opts) {
513
511
  const frameworkAware = !!(opts && opts.frameworkAware);
@@ -516,13 +514,11 @@ export async function resolveTree(specs, cache, onResolved, onProgress, fetchFn,
516
514
  // X.5-F R1: names the user typed at the top level (or that are
517
515
  // required peer-deps of an installed package — see R2 below) bypass
518
516
  // SKIP_PACKAGES. Transitive `dependencies` walks do NOT add to this
519
- // set, preserving silent-skip for build-tool noise. See audit/sections/
520
517
  // X5F-plan.md §6.1.
521
518
  const topLevelNames = new Set(Object.keys(specs));
522
519
  // X.5-G G1: names that came from a parent's `optionalDependencies`.
523
520
  // These are best-effort per npm 4828 — fetch failures and platform-
524
521
  // native-binding detection silent-skip them rather than propagating
525
- // as install errors. See audit/sections/X5G-plan.md §2.
526
522
  const optionalNames = new Set();
527
523
  // X.5-drizzle: names enqueued by the X.5-J top-level optional-peer
528
524
  // path (R2.5) and ALL their transitive descendants. The user did not
@@ -530,15 +526,12 @@ export async function resolveTree(specs, cache, onResolved, onProgress, fetchFn,
530
526
  // best-effort convenience. When a `transitive: 'fail'` REJECT_INSTALL
531
527
  // fires for a name in this set, we silent-skip the offending name +
532
528
  // log a notice, instead of throwing and killing the parent install.
533
- // Mirrors src/npm-resolve-facet.ts. See audit/sections/X5-drizzle-plan.md.
534
529
  const bestEffortNames = new Set();
535
530
  const queue = Object.entries(specs);
536
531
  const limit = pLimit(RESOLVE_CONCURRENCY);
537
532
  // F-2 profiling support: emit per-layer width when
538
533
  // NIMBUS_DIAG_INSTALL_PIPELINE=1 (same flag used by VFS pipeline diag).
539
- // Used by audit/probes/f2-resolver-fanout/ to measure the BFS-frontier
540
534
  // width distribution against the top-30 cohort. Zero cost in prod
541
- // (env not set). See audit/sections/F2-RESOLVER-FANOUT-plan.md.
542
535
  const __f2Diag = (globalThis.process?.env?.NIMBUS_DIAG_INSTALL_PIPELINE === '1');
543
536
  let __f2LayerN = 0;
544
537
  while (queue.length > 0) {
@@ -685,7 +678,6 @@ export async function resolveTree(specs, cache, onResolved, onProgress, fetchFn,
685
678
  // X.5-G G1: enqueue transitive optionalDependencies, tagged so
686
679
  // resolveOne skips platform-native bindings silently and any
687
680
  // fetch failure becomes optional-dep-skip rather than fail. See
688
- // audit/sections/X5G-plan.md §2 for the npm 4828 rationale.
689
681
  if (pkg.optionalDependencies) {
690
682
  for (const [depName, depRange] of Object.entries(pkg.optionalDependencies)) {
691
683
  if (!resolved.has(depName) && !seen.has(depName)) {
@@ -699,7 +691,6 @@ export async function resolveTree(specs, cache, onResolved, onProgress, fetchFn,
699
691
  // X.5-F R2: enqueue REQUIRED peer-deps (optionals already
700
692
  // filtered in versionToResolved). Mark them as topLevelNames so
701
693
  // they bypass SKIP_PACKAGES — ts-jest needs typescript even
702
- // though typescript is in SKIP_PACKAGES. See audit/sections/
703
694
  // X5F-plan.md §3 for the bug evidence and §6.2 for the fix.
704
695
  if (pkg.peerDependencies) {
705
696
  for (const [peerName, peerRange] of Object.entries(pkg.peerDependencies)) {
@@ -732,7 +723,6 @@ export async function resolveTree(specs, cache, onResolved, onProgress, fetchFn,
732
723
  // still hard-fail via the R2 path above (peerDependencies set
733
724
  // excludes optionals); transitive REQUIRED deps in REJECT_INSTALL
734
725
  // also still hard-fail via the dep walk's resolveOne reject path.
735
- // See audit/sections/X5J-plan.md §3 for the full rationale.
736
726
  if (topLevelNames.has(pkg.name)) {
737
727
  const allPeers = pkg.__allPeerDependencies;
738
728
  if (allPeers) {
@@ -829,7 +819,6 @@ export function computeHoistPlan(resolved) {
829
819
  // from the user's installed `vite` to call createServer() — so when a
830
820
  // framework is detected, `vite` must actually land in node_modules.
831
821
  // `shouldSkipPackageWithFramework({ frameworkAware: true })` exempts
832
- // it. See audit/sections/W11-plan.md §3.0.
833
822
  //
834
823
  // X.5-G: `rollup` removed from SKIP_PACKAGES because it's now in
835
824
  // WASM_SWAPS (rollup → @rollup/wasm-node). SKIP would mask the swap at
@@ -881,7 +870,6 @@ export function shouldSkipPackage(name) {
881
870
  * Callers detect framework presence via `framework-detect.ts` BEFORE
882
871
  * starting resolution and thread the flag through `resolveTree`.
883
872
  *
884
- * See audit/sections/W11-plan.md §3.0.
885
873
  */
886
874
  export function shouldSkipPackageWithFramework(name, frameworkAware) {
887
875
  if (frameworkAware && FRAMEWORK_REQUIRED_PACKAGES.has(name))
@@ -33,8 +33,6 @@
33
33
  * - per-facet-id: single slot, one object.
34
34
  *
35
35
  * Snapshot ≤40 KB even with both rings full. Verified by
36
- * audit/probes/w5/functional/ring-persistence.mjs (failures) and
37
- * audit/probes/c-prime/recovery-events/ (recovery — Phase 1 C'.2).
38
36
  */
39
37
  import type { OomCause } from './oom-classify.js';
40
38
  export interface RpcFrame {