@nifrajs/cli 5.16.0 → 5.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/check-diagnostics.d.ts +7 -0
  3. package/dist/check-diagnostics.d.ts.map +1 -1
  4. package/dist/check-diagnostics.js +3 -0
  5. package/dist/check-diagnostics.js.map +1 -1
  6. package/dist/check-scan-sql.d.ts +95 -0
  7. package/dist/check-scan-sql.d.ts.map +1 -0
  8. package/dist/check-scan-sql.js +1190 -0
  9. package/dist/check-scan-sql.js.map +1 -0
  10. package/dist/check-scan.d.ts +5 -93
  11. package/dist/check-scan.d.ts.map +1 -1
  12. package/dist/check-scan.js +20 -1207
  13. package/dist/check-scan.js.map +1 -1
  14. package/dist/check.d.ts.map +1 -1
  15. package/dist/check.js +9 -0
  16. package/dist/check.js.map +1 -1
  17. package/dist/cli.d.ts +2 -6
  18. package/dist/cli.d.ts.map +1 -1
  19. package/dist/cli.js +249 -80
  20. package/dist/cli.js.map +1 -1
  21. package/dist/command-catalog.d.ts +3 -0
  22. package/dist/command-catalog.d.ts.map +1 -1
  23. package/dist/command-catalog.js +18 -4
  24. package/dist/command-catalog.js.map +1 -1
  25. package/dist/frontend-guidance.js +1 -1
  26. package/dist/frontend-guidance.js.map +1 -1
  27. package/dist/internal/a11y-element.d.ts +33 -0
  28. package/dist/internal/a11y-element.d.ts.map +1 -0
  29. package/dist/internal/a11y-element.js +124 -0
  30. package/dist/internal/a11y-element.js.map +1 -0
  31. package/dist/internal/a11y-jsx.d.ts +12 -0
  32. package/dist/internal/a11y-jsx.d.ts.map +1 -0
  33. package/dist/internal/a11y-jsx.js +42 -0
  34. package/dist/internal/a11y-jsx.js.map +1 -0
  35. package/dist/internal/a11y-template.d.ts +11 -0
  36. package/dist/internal/a11y-template.d.ts.map +1 -0
  37. package/dist/internal/a11y-template.js +56 -0
  38. package/dist/internal/a11y-template.js.map +1 -0
  39. package/dist/internal/aria-data.d.ts +23 -0
  40. package/dist/internal/aria-data.d.ts.map +1 -0
  41. package/dist/internal/aria-data.js +220 -0
  42. package/dist/internal/aria-data.js.map +1 -0
  43. package/dist/internal/edit-distance.d.ts +3 -0
  44. package/dist/internal/edit-distance.d.ts.map +1 -0
  45. package/dist/internal/edit-distance.js +12 -0
  46. package/dist/internal/edit-distance.js.map +1 -0
  47. package/dist/internal/imported-as.d.ts +10 -0
  48. package/dist/internal/imported-as.d.ts.map +1 -0
  49. package/dist/internal/imported-as.js +23 -0
  50. package/dist/internal/imported-as.js.map +1 -0
  51. package/dist/internal/source-facts.d.ts +3 -0
  52. package/dist/internal/source-facts.d.ts.map +1 -1
  53. package/dist/internal/source-facts.js +2 -0
  54. package/dist/internal/source-facts.js.map +1 -1
  55. package/dist/internal/template-markup.d.ts +58 -0
  56. package/dist/internal/template-markup.d.ts.map +1 -0
  57. package/dist/internal/template-markup.js +221 -0
  58. package/dist/internal/template-markup.js.map +1 -0
  59. package/dist/internal/typescript-import.d.ts.map +1 -1
  60. package/dist/internal/typescript-import.js +11 -0
  61. package/dist/internal/typescript-import.js.map +1 -1
  62. package/dist/mcp-exec.d.ts.map +1 -1
  63. package/dist/mcp-exec.js +37 -23
  64. package/dist/mcp-exec.js.map +1 -1
  65. package/dist/mcp-http.js +1 -1
  66. package/dist/mcp-io.d.ts.map +1 -1
  67. package/dist/mcp-io.js +5 -3
  68. package/dist/mcp-io.js.map +1 -1
  69. package/dist/mcp-root.js +1 -1
  70. package/dist/mcp-root.js.map +1 -1
  71. package/dist/mcp-ws.d.ts.map +1 -1
  72. package/dist/mcp-ws.js +3 -2
  73. package/dist/mcp-ws.js.map +1 -1
  74. package/dist/migrate-layout-config.d.ts +63 -0
  75. package/dist/migrate-layout-config.d.ts.map +1 -0
  76. package/dist/migrate-layout-config.js +507 -0
  77. package/dist/migrate-layout-config.js.map +1 -0
  78. package/dist/migrate-layout-split.d.ts +46 -0
  79. package/dist/migrate-layout-split.d.ts.map +1 -0
  80. package/dist/migrate-layout-split.js +687 -0
  81. package/dist/migrate-layout-split.js.map +1 -0
  82. package/dist/migrate-layout.d.ts +4 -24
  83. package/dist/migrate-layout.d.ts.map +1 -1
  84. package/dist/migrate-layout.js +8 -1183
  85. package/dist/migrate-layout.js.map +1 -1
  86. package/dist/output-schemas.d.ts.map +1 -1
  87. package/dist/output-schemas.js +78 -10
  88. package/dist/output-schemas.js.map +1 -1
  89. package/dist/recipes/5.17.0.d.ts +10 -0
  90. package/dist/recipes/5.17.0.d.ts.map +1 -0
  91. package/dist/recipes/5.17.0.js +20 -0
  92. package/dist/recipes/5.17.0.js.map +1 -0
  93. package/dist/recipes/5.18.0.d.ts +9 -0
  94. package/dist/recipes/5.18.0.d.ts.map +1 -0
  95. package/dist/recipes/5.18.0.js +56 -0
  96. package/dist/recipes/5.18.0.js.map +1 -0
  97. package/dist/recipes/index.d.ts.map +1 -1
  98. package/dist/recipes/index.js +4 -0
  99. package/dist/recipes/index.js.map +1 -1
  100. package/dist/review.d.ts.map +1 -1
  101. package/dist/review.js +6 -0
  102. package/dist/review.js.map +1 -1
  103. package/dist/rules/a11y.d.ts +5 -0
  104. package/dist/rules/a11y.d.ts.map +1 -0
  105. package/dist/rules/a11y.js +78 -0
  106. package/dist/rules/a11y.js.map +1 -0
  107. package/dist/rules/codes.d.ts +6 -0
  108. package/dist/rules/codes.d.ts.map +1 -1
  109. package/dist/rules/codes.js +6 -0
  110. package/dist/rules/codes.js.map +1 -1
  111. package/dist/rules/comment-markers.js +1 -1
  112. package/dist/rules/comment-markers.js.map +1 -1
  113. package/dist/rules/explanations.d.ts.map +1 -1
  114. package/dist/rules/explanations.js +30 -0
  115. package/dist/rules/explanations.js.map +1 -1
  116. package/dist/rules/host-exposure.d.ts +23 -0
  117. package/dist/rules/host-exposure.d.ts.map +1 -0
  118. package/dist/rules/host-exposure.js +380 -0
  119. package/dist/rules/host-exposure.js.map +1 -0
  120. package/dist/rules/internal-links.d.ts.map +1 -1
  121. package/dist/rules/internal-links.js +16 -141
  122. package/dist/rules/internal-links.js.map +1 -1
  123. package/dist/rules/islands.d.ts +54 -0
  124. package/dist/rules/islands.d.ts.map +1 -1
  125. package/dist/rules/islands.js +577 -80
  126. package/dist/rules/islands.js.map +1 -1
  127. package/dist/rules/security.d.ts +1 -0
  128. package/dist/rules/security.d.ts.map +1 -1
  129. package/dist/rules/security.js +34 -7
  130. package/dist/rules/security.js.map +1 -1
  131. package/dist/runtime-differences.js +3 -3
  132. package/dist/runtime-differences.js.map +1 -1
  133. package/dist/scaffold.d.ts +1 -1
  134. package/dist/scaffold.d.ts.map +1 -1
  135. package/dist/scaffold.js +2 -2
  136. package/dist/scaffold.js.map +1 -1
  137. package/dist/source-rewrites.d.ts.map +1 -1
  138. package/dist/source-rewrites.js +2 -19
  139. package/dist/source-rewrites.js.map +1 -1
  140. package/docs/examples.json +4 -4
  141. package/docs/llms-full.txt +443 -46
  142. package/docs/types.json +490 -66
  143. package/package.json +12 -12
  144. package/src/check-diagnostics.ts +11 -0
  145. package/src/check-scan-sql.ts +1746 -0
  146. package/src/check-scan.ts +34 -1754
  147. package/src/check.ts +10 -1
  148. package/src/cli.ts +258 -98
  149. package/src/command-catalog.ts +21 -4
  150. package/src/frontend-guidance.ts +1 -1
  151. package/src/internal/a11y-element.ts +227 -0
  152. package/src/internal/a11y-jsx.ts +54 -0
  153. package/src/internal/a11y-template.ts +74 -0
  154. package/src/internal/aria-data.ts +242 -0
  155. package/src/internal/edit-distance.ts +16 -0
  156. package/src/internal/imported-as.ts +30 -0
  157. package/src/internal/source-facts.ts +4 -0
  158. package/src/internal/template-markup.ts +270 -0
  159. package/src/internal/typescript-import.ts +15 -0
  160. package/src/mcp-exec.ts +43 -22
  161. package/src/mcp-http.ts +1 -1
  162. package/src/mcp-io.ts +5 -3
  163. package/src/mcp-root.ts +1 -1
  164. package/src/mcp-ws.ts +3 -2
  165. package/src/migrate-layout-config.ts +615 -0
  166. package/src/migrate-layout-split.ts +870 -0
  167. package/src/migrate-layout.ts +37 -1468
  168. package/src/output-schemas.ts +85 -17
  169. package/src/recipes/5.17.0.ts +28 -0
  170. package/src/recipes/5.18.0.ts +63 -0
  171. package/src/recipes/index.ts +4 -0
  172. package/src/review.ts +6 -0
  173. package/src/rules/a11y.ts +119 -0
  174. package/src/rules/codes.ts +6 -0
  175. package/src/rules/comment-markers.ts +2 -2
  176. package/src/rules/explanations.ts +30 -0
  177. package/src/rules/host-exposure.ts +531 -0
  178. package/src/rules/internal-links.ts +21 -154
  179. package/src/rules/islands.ts +698 -86
  180. package/src/rules/security.ts +48 -7
  181. package/src/runtime-differences.ts +3 -3
  182. package/src/scaffold.ts +3 -3
  183. package/src/source-rewrites.ts +2 -15
@@ -299,14 +299,14 @@ to full-stack later without a rewrite.
299
299
  **Throughput - the realistic case.** Router micro-benchmarks flatter Hono (a single compiled
300
300
  regex), but a real request also pays for middleware and validation,
301
301
  context, and serialization. In the current matrix Nifra runs **level with Elysia on Bun** -
302
- 100% of Elysia on `GET /users/:id` and
302
+ 99% of Elysia on `GET /users/:id` and
303
303
  103% on the validated `POST` - and
304
304
  **level with Fastify on Node** (105% of Fastify on GET,
305
- 102% on the validated `POST`), with Elysia, Hono,
306
- and Express behind. On **Deno** it runs at 117% of Elysia on
307
- GET and 139% on the validated `POST`. In the realistic shape (security headers + CORS +
305
+ 103% on the validated `POST`), with Elysia, Hono,
306
+ and Express behind. On **Deno** it runs at 113% of Elysia on
307
+ GET and 143% on the validated `POST`. In the realistic shape (security headers + CORS +
308
308
  bearer auth + cookies + validated query/body + a ~2.4 KB JSON response, measured on
309
- **Bun** with `oha`) Nifra runs at **123% of Elysia on GET and 121% on POST**. Treat benchmark
309
+ **Bun** with `oha`) Nifra runs at **129% of Elysia on GET and 132% on POST**. Treat benchmark
310
310
  rows as same-run evidence, not a permanent law of nature.
311
311
 
312
312
  -
@@ -697,6 +697,17 @@ export async function loader({ search, api }: Route.LoaderArgs) {
697
697
  }
698
698
  ```
699
699
 
700
+ For a deterministic validator, wrap the exported schema with `memoizeSearchSchema`
701
+ from `@nifrajs/web/client` to reuse validation within one SSR request. The
702
+ validator can depend on the query alone and must leave its input unchanged. Reuse is decided
703
+ per reader chain: the page loader and the render validate the layout schemas and the page
704
+ schema, so one unwrapped schema among them turns reuse off there, while the first context
705
+ (guards and early hooks) validates the page schema alone. A result must also be plain data:
706
+ objects and arrays of primitives that are not frozen or sealed and have no accessors, class
707
+ instances, dates or maps. Then each reader gets an independent copy. Otherwise the validator
708
+ runs for each reader and its result is used as returned, so a nested object the validator
709
+ returns from a shared source stays shared.
710
+
700
711
  Without a `searchSchema`, `ctx.search`, the `search` prop and
701
712
  `useSearch` are the raw parsed query (`Record<string, unknown>`).
702
713
  `useSearch` and `useParams` ship on every adapter (React, Preact, Vue,
@@ -2751,6 +2762,10 @@ broken. A store that also implements `fence()` keeps a purge that lands while a
2751
2762
  page renders from being undone when that render stores the page it built from the old data;
2752
2763
  both built-in stores do.
2753
2764
 
2765
+ ISR captures up to `maxEntryBytes` per document (2 MiB by default). Larger pages
2766
+ stream directly. `MemoryCacheStore` also has a `maxTotalBytes` budget
2767
+ for retained HTML (64 MiB by default) and evicts least-recently-used entries to stay within it.
2768
+
2754
2769
  Workers KV is eventually consistent: a purge is usually seen at once where it was made and
2755
2770
  reaches other locations as their copies expire, which Cloudflare puts at up to 60 seconds or
2756
2771
  more. Until then those locations serve the old page. A page one of them rebuilt from the old
@@ -3218,8 +3233,12 @@ Toggles a class per pair.
3218
3233
  `data-bind-attr="aria-expanded:open"`
3219
3234
 
3220
3235
  Sets an attribute per pair, removing it for `false` or
3221
- `null`. Never an `on*` attribute or `srcdoc`, and a
3222
- URL attribute takes only an http(s), mailto, tel or relative URL.
3236
+ `null`. Event handler attributes and `srcdoc` are blocked. URL
3237
+ bindings accept explicit http(s), mailto, tel, and relative URLs without an authority.
3238
+ They are blocked on a
3239
+ `script`, `iframe`, `object`, `embed`,
3240
+ `link` or `base` element. SVG animation elements such as
3241
+ `<animate>` reject all attribute bindings.
3223
3242
 
3224
3243
  `data-bind-value="query"`
3225
3244
 
@@ -3234,7 +3253,24 @@ nearest island, and nothing inside a `data-island-ignore` element binds or mount
3234
3253
  - render user HTML there. Because both sides are literal, `nifra check` matches
3235
3254
  them: `NF-C047` warns when a name has no `state("...")` key
3236
3255
  or returned handler, and `NF-C048` when a binding sits where no
3237
- `bindIsland` host will ever walk it.
3256
+ `bindIsland` host will ever walk it. `NF-C066` warns when a
3257
+ `data-bind-attr` names an attribute the runtime refuses.
3258
+
3259
+ The same check reads the host. `NF-C064` warns when a `data-island`
3260
+ id appears in no `mountIslands` map (it stays quiet once a map is held in a
3261
+ variable, spread or aliased, since the ids are then unknowable). `NF-C065`
3262
+ compares the props a host passes with the enhancer's type: a missing required prop, an
3263
+ undeclared one, or a literal of another primitive type. It reads a type literal on
3264
+ `defineIsland<{ ... }>` or `bindIsland` (or an
3265
+ annotated second parameter) and an object literal in `islandProps({...})`,
3266
+ `JSON.stringify({...})` or JSX `props`; the props are still
3267
+ JSON in an attribute at runtime, so nothing is validated in the browser.
3268
+
3269
+ In development a `data-bind-text` whose server-rendered text, or a
3270
+ `data-bind-show` whose hidden state, differs from the signal's first value
3271
+ logs one console warning: the page would change on mount. An empty text slot is not a
3272
+ mismatch. The check sits behind `process.env.NODE_ENV`, so a production build
3273
+ that defines it carries none of that code; one that does not define it keeps the warning.
3238
3274
 
3239
3275
  ### Signals
3240
3276
 
@@ -3464,14 +3500,20 @@ a binding inside a slot that belongs to an island outside it.
3464
3500
  ### Load strategies
3465
3501
 
3466
3502
  A host's `data-island-strategy` defers its enhancer: `load`
3467
- (default), `idle`, `visible` (mount when it scrolls into view), or
3468
- `media` with the query in `data-island-media`. A host with no matching
3503
+ (default), `idle`, `visible` (mount when it scrolls into view),
3504
+ `interaction` (mount on the first hover, press, focus or click on the host), or
3505
+ `media` with the query in
3506
+ `data-island-media`. A host with no matching
3469
3507
  enhancer, or an invalid strategy, stays inert server-rendered HTML - forward-compatible,
3470
3508
  never a runtime error. The scheduling itself is `@nifrajs/island-trigger`'s
3471
3509
  `scheduleTrigger`, which has no DOM or framework dependency, for a runtime of
3472
3510
  your own.
3473
3511
 
3474
- ## Nifra - Streaming
3512
+ An interaction click mounts during capture on the host. Listeners attached during mount can
3513
+ receive that click at a descendant target or in the host's non-capture phase. Capture
3514
+ listeners added to the host during mount start with the next click.
3515
+
3516
+ ## Nifra - Streaming and SSE
3475
3517
 
3476
3518
  > Streaming SSR, Suspense, and defer() in Nifra - on every runtime including the edge.
3477
3519
 
@@ -3541,6 +3583,9 @@ resolves, you call `stream.close()`, or the client disconnects (
3541
3583
  `stream.signal`). It's a Web `ReadableStream` too, so it runs on Bun,
3542
3584
  Node, Deno, and the edge - no `new Function`, no per-runtime API.
3543
3585
 
3586
+ Use `stream.signal` to release subscriptions when the stream ends, including
3587
+ when the producer closes the stream or fails.
3588
+
3544
3589
  ```ts
3545
3590
  import { server } from "@nifrajs/core/server"
3546
3591
  import { sse } from "@nifrajs/core/sse"
@@ -4542,9 +4587,11 @@ app.use(basicAuth({ username: "admin", password: process.env.PASS!, realm: "stag
4542
4587
  ### Response caching
4543
4588
 
4544
4589
  `cache` is a full response cache with a pluggable store, `Vary`-aware keys,
4545
- and a byte cap. It **bypasses `Set-Cookie`** and honors request/response
4546
- `Cache-Control` (`no-store`/`private`) so it never serves one
4547
- user's response to another. `MemoryResponseCache` is per-instance and refuses
4590
+ and a byte cap. It checks the final response's `Set-Cookie`, `Vary`,
4591
+ and `Cache-Control` before storing an entry. Keep request gates that must run on
4592
+ hits before the cache. A custom store must retain the entire entry, including its
4593
+ `finalized` flag. Older entries without that flag miss.
4594
+ `MemoryResponseCache` is per-instance and refuses
4548
4595
  `NODE_ENV=production` unless opted in - use a shared store in prod. `prettyJson`
4549
4596
  pretty-prints JSON responses (capped, with an optional query toggle).
4550
4597
 
@@ -5111,8 +5158,9 @@ must post to the app in the server's `formOrigins`; the origins
5111
5158
  list, for that server's own routes only: a mounted server keeps its own policy, a
5112
5159
  parent must list the same sites itself, and a web page action checks the backend's
5113
5160
  `allowedOrigins` instead. Audit those origins: one named there may post a form
5114
- whatever methods or credentials the CORS policy allows. A request without an `Origin` passes, so a cookie-authenticated upload
5115
- route still needs `csrf()` like any other state change.
5161
+ whatever methods or credentials the CORS policy allows. Without an `Origin` header,
5162
+ Core still rejects forms marked `same-site` or `cross-site` by
5163
+ `Sec-Fetch-Site`. Keep `csrf()` on cookie-authenticated upload routes.
5116
5164
 
5117
5165
  -
5118
5166
  **The form is held in memory.** Budget roughly twice `bodyLimit` per request in
@@ -5240,7 +5288,8 @@ set an explicit cap for the bytes you pass to `validateUpload`. The detection al
5240
5288
  covering common image / A-V / archive types.
5241
5289
 
5242
5290
  `signDownloadUrl` / `verifyDownloadUrl` mint short-TTL, tamper-evident
5243
- download links (HMAC-SHA256 over the path + expiry, constant-time verify). And
5291
+ download links (HMAC-SHA256 over the path, ordered query parameters, and expiry, with
5292
+ constant-time verification). And
5244
5293
  `stripImageMetadata` drops EXIF/GPS by re-encoding the image - through any
5245
5294
  @nifrajs/image backend, with no dependency on it:
5246
5295
 
@@ -5623,17 +5672,17 @@ limiter (@nifrajs/middleware), and a hardened image-resize endpoint
5623
5672
  ### Redacting logs
5624
5673
 
5625
5674
  The built-in `jsonLogger` redacts values under sensitive **keys**
5626
- (`password`, `authorization`, `token`, …) by default. For
5627
- secrets that land in a **value** or the message itself (e.g. an `err.message` that
5628
- embeds a token), pass opt-in `valuePatterns` - `commonSecretPatterns` covers
5629
- bearer tokens, JWTs, emails, and a few well-known key formats, or supply your own:
5675
+ (`password`, `authorization`, `token`, …) and applies
5676
+ `commonSecretPatterns` to string values and messages. It covers bearer tokens,
5677
+ JWTs, emails, and several well-known key formats. Pass `valuePatterns` to set your
5678
+ own rules or extend the defaults:
5630
5679
 
5631
5680
  ```ts
5632
5681
  import { server, jsonLogger, commonSecretPatterns } from "@nifrajs/core/server"
5633
5682
 
5634
- // Key-name redaction is always on; valuePatterns adds opt-in value + message scanning.
5683
+ // The default logger redacts sensitive keys and scans string values and messages.
5635
5684
  const app = server({
5636
- logger: jsonLogger(undefined, { valuePatterns: commonSecretPatterns }),
5685
+ logger: jsonLogger(),
5637
5686
  })
5638
5687
 
5639
5688
  // logger.error("auth failed for user@example.com with Bearer abc.def")
@@ -7646,6 +7695,10 @@ that fails is not delivered; `onError` gets a `TypeError` naming the
7646
7695
  issues, with the frame as its `cause`. Frames keep their arrival order, an async
7647
7696
  schema included.
7648
7697
 
7698
+ `maxPendingMessages` defaults to 256 per iterator and per validation queue.
7699
+ An iterator that falls behind ends and discards its buffered frames. If validation falls
7700
+ behind, the socket closes with code `4008`. Both report through `onError`.
7701
+
7649
7702
  ```ts
7650
7703
  import { client } from "@nifrajs/client"
7651
7704
  import { type InferOutput, server } from "@nifrajs/core/server"
@@ -8695,8 +8748,8 @@ starts from unless nothing else, installed or declared, names one.
8695
8748
 
8696
8749
  ```bash
8697
8750
  nifra upgrade --list # the release targets this CLI knows
8698
- nifra upgrade 5.16.0 # dry-run: every planned edit, nothing written
8699
- nifra upgrade 5.16.0 --write # apply; it verifies with nifra check once the target is installed
8751
+ nifra upgrade 5.18.0 # dry-run: every planned edit, nothing written
8752
+ nifra upgrade 5.18.0 --write # apply; it verifies with nifra check once the target is installed
8700
8753
  # if pins were already bumped by hand, add --from <installed-version>
8701
8754
  bun install # install the new pins
8702
8755
  nifra check # verify against them
@@ -9694,7 +9747,7 @@ below - without starting a server:
9694
9747
  ```ts
9695
9748
  # doc-check: skip - fragment: terminal output, not source.
9696
9749
  $ nifra dev
9697
- nifra dev (bun) → http://localhost:3000
9750
+ nifra dev (bun) → http://localhost:4321
9698
9751
  bundler: bun (default; --vite to switch)
9699
9752
 
9700
9753
  $ nifra build
@@ -9893,11 +9946,11 @@ supply that plugin yourself through your own `bunfig.toml`; plain CSS and Tailwi
9893
9946
  need nothing either way.
9894
9947
 
9895
9948
  **
9896
- Server functions and `*.server` modules work under `--bun`
9949
+ Server functions and backend-only modules under `--bun`
9897
9950
  **
9898
- - and the plumbing is worth knowing. The client build strips them: a `*.fn` module
9899
- is replaced with an RPC stub and a `*.server` module is emptied, so their bodies
9900
- (DB handles, secrets, imports) never reach a browser. Bun's dev-server bundling accepts
9951
+ - the client build replaces a `*.fn.ts` module with an RPC stub and rejects
9952
+ browser imports that reach `backend/`, a route's `x.backend.ts`, or
9953
+ a module marked with `@nifrajs/web/backend-only`. Bun's dev-server bundling accepts
9901
9954
  plugins only through `bunfig.toml` (`[serve.static] plugins`) - not
9902
9955
  programmatically, and a runtime `Bun.plugin` never reaches it (upstream ask:
9903
9956
  oven-sh/bun#36830). So `nifra dev --bun` generates a config under
@@ -13243,9 +13296,15 @@ A storage key was refused before any read or write: it is empty or over 1024 cha
13243
13296
 
13244
13297
  #### NIFRA_STORAGE_READ_LIMIT
13245
13298
 
13246
- An R2 object is larger than maxReadBytes (or reports invalid size metadata), so R2Storage refuses to buffer it. The key itself was valid.
13299
+ An object exceeds the adapter's `maxReadBytes` setting, or R2 reported invalid size metadata.
13247
13300
 
13248
- **Fix:** Raise maxReadBytes on the R2Storage if objects of that size are expected; otherwise find why the object is larger than the limit.
13301
+ Use `getStream` for large objects, or raise `maxReadBytes` if buffering objects of that size is intentional.
13302
+
13303
+ #### NIFRA_STORAGE_PROVIDER
13304
+
13305
+ An S3 or Google Cloud Storage request failed or returned an invalid upload response.
13306
+
13307
+ Check the HTTP status and operation in the message. Verify the bucket, endpoint, credentials and provider permissions for that operation.
13249
13308
 
13250
13309
  #### NIFRA_OPENAPI_IMPORT
13251
13310
 
@@ -15123,7 +15182,7 @@ the command below, which runs every recipe since its installed version. The 5.6
15123
15182
  its imports and dependencies; the follow-up changes below need a hand.
15124
15183
 
15125
15184
  ```sh
15126
- nifra upgrade 5.16.0
15185
+ nifra upgrade 5.18.0
15127
15186
  ```
15128
15187
 
15129
15188
  -
@@ -15554,9 +15613,9 @@ Migrate a backend. For the full
15554
15613
  rendering and route model, see Loaders & actions
15555
15614
  and Routing.
15556
15615
 
15557
- The current dynamic SSR snapshot reports Nifra at 19× the throughput
15558
- of Next.js, 8.4× Nuxt, 5.3× SvelteKit, and
15559
- 2.2× SolidStart on the measured pages. See the
15616
+ The current dynamic SSR snapshot reports Nifra at 30× the throughput
15617
+ of Next.js, 15× Nuxt, 6.2× SvelteKit, and
15618
+ 2.3× SolidStart on the measured pages. See the
15560
15619
  benchmark methodology and full results.
15561
15620
 
15562
15621
  ## Nifra - Migrate route by route
@@ -18614,7 +18673,8 @@ When more than one caller shares the route, also pass `evidenceOwner: (c) => <th
18614
18673
  tenant id>`: turns are recorded and replayed under that owner, so another caller's reconnect or
18615
18674
  reused `runId` finds none of them. Without it a turn id (by default the client's `runId`) works as a
18616
18675
  bearer capability. The owner function runs before any replay; throwing from it refuses the request with `403`, and a
18617
- thrown `Response` answers the request as built, as one thrown from `ports` does.
18676
+ thrown `Response` answers the request as built, as one thrown from `ports` does. `ports` also runs on
18677
+ a reconnect, before anything is replayed, so a budget or rate-limit charge made there is made again.
18618
18678
 
18619
18679
  The seam performs no authentication or authorization - wrap it with your app's route guards and scope every port in `ports(c)` to the caller.
18620
18680
 
@@ -20725,6 +20785,10 @@ With `subscriptions: true`, a socket is admitted only when `authorize` accepts i
20725
20785
 
20726
20786
  By default responses use the `application/graphql-response+json` media type with spec status codes: `200` for an executed result (including field errors in `errors`), `400` for a parse or validation failure, `401` for a rejected `authorize`, `405` for a mutation attempted over GET, `415` for a POST whose body is not `application/json` (or another `+json` type). The last keeps a cross-site HTML form, which can send only urlencoded, multipart or plain-text bodies, from posting a mutation with the visitor's cookies. Set `legacyJsonResponse: true` for the older always-`200` `application/json` behavior some clients expect.
20727
20787
 
20788
+ Over HTTP, an `authorize` that throws is answered with a `500`. The default formatter masks the cause. A custom `formatError` receives a thrown `Error` as `originalError`, and any other value as `originalError.cause`, and decides what the response shows. A thrown `Response` is the exception: it is sent as is and not logged. On a subscription socket, an `authorize` or `onConnect` that throws refuses the connection.
20789
+
20790
+ The thrown value is passed whole to `console.error`, so keep credentials out of its message, its attached properties and its `cause`. The handler adds nothing from the request to that log.
20791
+
20728
20792
  ## License
20729
20793
 
20730
20794
  MIT
@@ -20946,9 +21010,13 @@ const dispose = scheduleTrigger({ media: "(min-width: 768px)" }, () => {
20946
21010
  dispose() // cancel before the trigger fires
20947
21011
  ```
20948
21012
 
20949
- `load`, `idle`, `visible`, and media-query triggers are one-shot. Idle and visibility strategies
20950
- fall back safely when the browser capability is unavailable; malformed or oversized media queries
20951
- remain inert. The package only schedules the callback - each island runtime owns its own markers,
21013
+ `load`, `idle`, `visible`, `interaction`, and media-query triggers are one-shot. Idle and visibility
21014
+ strategies fall back safely when the browser capability is unavailable; malformed or oversized media
21015
+ queries remain inert. `interaction` waits for the first `pointerover`, `pointerdown`, `focusin` or
21016
+ `click` on the `target`. A click mounts during capture on the host. Listeners attached during mount
21017
+ can receive it at a descendant target or in the host's non-capture phase. Capture listeners added to
21018
+ the host during mount start with the next click. The callback runs at once when the target cannot take
21019
+ listeners. Each island runtime owns its own markers,
20952
21020
  registry, signals, and framework integration.
20953
21021
 
20954
21022
  For AI agents, see [`LLM.md`](./LLM.md). The wider reference is in
@@ -21428,6 +21496,10 @@ const app = server()
21428
21496
  - **`combine()` / `namedCombine()`** - reusable runtime bundles for middleware/plugins.
21429
21497
  - **`requestId()` / `logger()` / `etag()` / `compression()` / `cacheControl()` /
21430
21498
  `idempotency()` / `healthcheck()` / `openapi()`** - additional operational middleware for APIs.
21499
+ - **`compression({ inlineMax })`** - on Node, gzip runs on the thread pool by default, which pays when a
21500
+ process has idle cores. With one process per core (a cluster, or `reusePort`), set `inlineMax` (bytes) to
21501
+ gzip buffered bodies up to that size on the calling thread; streamed bodies are unaffected. At 1 CPU
21502
+ per process on Node 26 (2-66 KB bodies) it measured 1.5-4x the pool's throughput.
21431
21503
 
21432
21504
  ## Header middleware: declared headers and `onResponseHeaders`
21433
21505
 
@@ -21643,6 +21715,325 @@ one cheap read instead of the whole corpus. For the wider framework: the repo's
21643
21715
  [`llms-full.txt`](../../llms-full.txt) is the full machine-readable corpus. Run `nifra check` as the
21644
21716
  done-gate, or `nifra mcp` to give the agent live project tools.
21645
21717
 
21718
+ ## @nifrajs/node-engine
21719
+
21720
+ **Experimental.** Serve a nifra app from Node on Nifra's own Rust engine (`native/nifra-engine`): a native HTTP/1.1, HTTP/2 and WebSocket server with in-process TLS, polled by Node's libuv loop and reached through a N-API addon (`nifra-napi`).
21721
+
21722
+ It is a sibling of `@nifrajs/node` and `@nifrajs/node-uws`. The engine hands requests over in batches through shared buffers, with the head and body complete, so requests reach the app through the node-direct lane with no `http.Server` underneath and no Web `Request` unless a route asks for one.
21723
+
21724
+ ```ts
21725
+ import { server } from "@nifrajs/core"
21726
+ import { serve } from "@nifrajs/node-engine"
21727
+
21728
+ const app = server().get("/hello", () => ({ hello: "world" }))
21729
+ const running = await serve(app, { port: 3000 })
21730
+ // later
21731
+ await running.stop()
21732
+ ```
21733
+
21734
+ Requires Node 22 or newer and the built addon (`win32`, `darwin`, and `linux`, with `NIFRA_ENGINE_TRANSPORT=uring|epoll|uv` on Linux; pass `fallback: true` to fall back to `@nifrajs/node` if no native binary is available). `@nifrajs/node` is a peer dependency: this package reuses its Host policy, lifecycle and outcome runtime.
21735
+
21736
+ Build `nifra-napi` with Cargo from `native/nifra-engine` (or stage prebuilt `.node` binaries via `bun run scripts/stage-native-addon.ts`); `serve()` loads from `NIFRA_RUST_ENGINE_PATH`, installed platform packages (`@nifrajs/node-engine-<platform>-<arch>[-gnu|-musl]`), local `packages/node-engine/prebuilds/`, or `native/nifra-engine/target/{release,debug}`. The loader opens the shared library in place.
21737
+
21738
+ Run the TypeScript integration tests from the repository root on Node 22.18 or newer. On macOS:
21739
+
21740
+ ```sh
21741
+ cargo build --release --manifest-path native/nifra-engine/Cargo.toml -p nifra-napi
21742
+ bun run --filter @nifrajs/node-engine build
21743
+ cp native/nifra-engine/target/release/libnifra_napi.dylib /tmp/nifra_napi.node
21744
+ NIFRA_RUST_ENGINE_PATH=/tmp/nifra_napi.node node --test packages/node-engine/test-node/*.test.ts packages/node-engine/test/rust-runtime.test.mjs
21745
+ ```
21746
+
21747
+ On Linux, use `libnifra_napi.so`.
21748
+
21749
+ Set `NIFRA_ENGINE_TEST_DENO=1` with Deno on `PATH` to include the live adapter comparison in
21750
+ `parity.test.ts`. CI enables this comparison.
21751
+
21752
+ ## Robustness checks
21753
+
21754
+ - Parser fuzzing: `cargo test --manifest-path native/nifra-engine/Cargo.toml -p nifra-http -p nifra-ws --test fuzz`; `NIFRA_FUZZ_CASES` lengthens it.
21755
+ - WebSocket conformance (Docker): `node packages/node-engine/conformance/autobahn.mjs`.
21756
+ - HTTP/2 conformance: `H2SPEC=/path/to/h2spec node packages/node-engine/conformance/h2spec.mjs`.
21757
+ - Soak: `SOAK_SECONDS=600 node packages/node-engine/conformance/soak.mjs`. Run it on Linux; macOS
21758
+ runs short of client ports at this connection rate.
21759
+
21760
+ Each takes the addon from `NIFRA_RUST_ENGINE_PATH` and the package's built `dist`. A panic in the
21761
+ engine closes the connection or fails the request that raised it; an out-of-memory abort or a stack
21762
+ overflow still ends the process.
21763
+
21764
+ ## `serve(app, options)`
21765
+
21766
+ Resolves to an `EngineServer` once the port is bound. Invalid options throw before anything is started.
21767
+
21768
+ | Option | Meaning |
21769
+ |---|---|
21770
+ | `port` | Required unless `path` is set. `0` picks a free port; read it from `running.port`. |
21771
+ | `hostname` | Interface to bind. Default: all. |
21772
+ | `path` | Unix domain socket path to listen on instead of TCP `hostname`/`port`. |
21773
+ | `protocol` | The scheme `Request.url` carries. `"https"` when `tls` is set, else `"http"`. |
21774
+ | `tls` | In-process TLS (rustls): inline `cert` / `key`, or `cert_file_name` / `key_file_name`, optional `serverNames` SNI entries, plus optional `ticketKeys`. |
21775
+ | `http2` | HTTP/2 beside HTTP/1.1 on the same port (including RFC 8441 WebSocket over HTTP/2). `true`, or an object of settings. |
21776
+ | `compression` | Native response compression (`zstd`, `br`, `gzip`, `deflate`) via `Accept-Encoding`. |
21777
+ | `fallback` | Fall back to `@nifrajs/node` (`node:http`/`node:https`) when no native addon can be loaded. |
21778
+ | `static` | Static file middleware (`serveStatic(...)`) or handler consulted before routes on GET/HEAD. |
21779
+ | `fastResponse` | Swap `globalThis.Response` for the lazy direct-write wrapper to skip stream drains. |
21780
+ | `maxBodySize` | Largest request body, in bytes (default 1 MiB) when buffering request bodies. |
21781
+ | `oversizeWindow` | Bytes past `maxBodySize` still buffered so the app can answer with its own 413 body. Default 1 MiB; `0` turns it off. |
21782
+ | `wsMaxMessageSize` | Largest WebSocket message before the engine fails the connection with 1009. |
21783
+ | `wsDeflate` | Enable RFC 7692 WebSocket `permessage-deflate` compression (`true` or options); individual routes may override via `handler.deflate`. |
21784
+ | `allowedHosts`, `canonicalHost`, `normalizeTarget` | The same Host and target policy `@nifrajs/node` applies. |
21785
+ | `validateHost` | `true` checks every request's `Host`. Off by default; setting `allowedHosts` or `canonicalHost` turns it on. |
21786
+ | `engine` | Engine limits & streaming: `streamRequestBodies`, `wsMaxBackpressure`, `wsCloseOnBackpressureLimit`, `idleTimeoutMs`, `headersTimeoutMs`, `requestTimeoutMs`, `maxHeaderBytes`, `maxConnections`, `reusePort`. |
21787
+ | `gracefulSignals` | `true`, or stop options: SIGTERM and SIGINT call `stop()`. Off by default. |
21788
+
21789
+ ### The server handle
21790
+
21791
+ | Member | Meaning |
21792
+ |---|---|
21793
+ | `port` | The bound port (`0` for Unix domain sockets). |
21794
+ | `path` | The bound Unix domain socket path when started with `path`. |
21795
+ | `stop({ drainMs, delayMs })` | Runs the app's `onStopping` hooks, keeps serving for `delayMs`, stops accepting, lets in-flight requests and sockets finish for up to `drainMs` (default 10 s), closes what is left, then runs `onStop`. Open WebSockets are closed with 1001 "server shutting down". |
21796
+ | `reloadTls(tls?)` | Swaps the certificate for every new handshake. See below. |
21797
+ | `addServerName(entry)` / `removeServerName(host)` | Adds/replaces or removes an SNI certificate at runtime. |
21798
+ | `[Symbol.asyncDispose]()` | `await using` support; same as `stop()`. |
21799
+
21800
+ ## Request bodies
21801
+
21802
+ By default the engine buffers a request whole before the app runs, so `maxBodySize` bounds the memory one request can hold. This section describes that mode; with `engine.streamRequestBodies` on, see [buffered vs streaming request bodies](#notes-on-buffered-vs-streaming-request-bodies). The default is 1 MiB, or the largest `maxBodyBytes` among the app and the apps mounted in it when that is more; a route with its own larger `schema.bodyLimit` needs `maxBodySize` set to match.
21803
+
21804
+ A body over `maxBodySize` gets a 413. The engine buffers up to `oversizeWindow` (default 1 MiB) past the cap so that a body only a little over it is answered with the same JSON body the app's own 413 carries (`{"ok":false,"error":"payload_too_large"}`), on a connection that stays usable. Past the window the engine refuses natively and closes the connection as the body passes it: a declared `Content-Length` is refused before any body is read, and a chunked upload is cut off a chunk or so past the window. That refusal has an empty body, which the engine gives no way to change. `oversizeWindow: 0` skips the window: every body over the cap is refused natively and the request path does no size check. A request therefore holds at most `maxBodySize` plus `oversizeWindow` in memory.
21805
+
21806
+ ## Headers
21807
+
21808
+ The engine hands headers over one call at a time or all at once, and the second costs more the more headers a request carries. The request path asks for the few it needs (`Host`, `Content-Length`, `Content-Type`, `Transfer-Encoding`, `Upgrade`) and reads the whole list only if the app asks for another header or for `Headers`. A repeated `Content-Type` reads as its first value, as on Node; the engine refuses a repeated `Host`, a conflicting `Content-Length` and a repeated `Transfer-Encoding` before the app runs. A request's headers are read from the engine while it is being answered, so a handler still running after its client disconnected finds none that it had not already read.
21809
+
21810
+ ### Host validation
21811
+
21812
+ Off by default, as `validateHost` is on the Bun and Deno server. With it off, `Host` is read only when `req.url` is asked for, as sent. It never takes part in routing here, which comes from the request target the engine parsed. A `Host` holding a path, query, fragment or userinfo delimiter is refused with a 400, and an empty one reads as `localhost`, so `req.url` never names a path the router did not see. What gets through is a `Host` the URL parser refuses, such as an out-of-range port: the request is answered, and reading `req.url` then throws.
21813
+
21814
+ `validateHost: true` reads and checks every request's `Host` before the app runs: a malformed one is refused with a 400, and `req.url` is built from the normalized authority. It costs one engine call per request. Turn it on for a server that clients reach directly. Behind a proxy or CDN that already checks `Host`, leave it off. `allowedHosts` and `canonicalHost` need every `Host` read, so setting either turns it on, and `validateHost: false` beside them is refused. Fixed replies answered inside the engine are skipped while it is on, since they would not be checked.
21815
+
21816
+ ## Fixed replies
21817
+
21818
+ `staticResponse()` (`GET` and `POST`) and `echoParam()` `GET` routes are registered with the engine, which answers them without calling into JS. They are skipped under a Host policy (every request's Host must be read), `GET` fast paths are skipped when `static` middleware is active, and a fixed `POST` carrying browser origin headers (`Origin` / `Sec-Fetch-Site`) stays on the router for cross-site checks.
21819
+
21820
+ ## HTTP/2
21821
+
21822
+ ```ts
21823
+ await serve(app, { port: 443, tls: { cert, key }, http2: true })
21824
+ ```
21825
+
21826
+ With `tls`, clients negotiate `h2` by ALPN. Without it, a client opening with the HTTP/2 preface is served (prior knowledge, `curl --http2-prior-knowledge`). Every other client gets HTTP/1.1 on the same port. A request on an HTTP/2 stream reaches the app identically to an HTTP/1 request, including RFC 8441 Extended CONNECT WebSocket upgrades (`:protocol: websocket`) and streaming request/response bodies. Server push is not supported.
21827
+
21828
+ `engine.requestTimeoutMs` bounds reception of each HTTP/2 request from its initial headers.
21829
+ An upload that exceeds the deadline is cancelled while other streams keep running.
21830
+ If the deadline expires inside an unfinished frame or HPACK header block, the connection closes.
21831
+
21832
+ Response header fields are compressed (Huffman coding and the HPACK dynamic table). `set-cookie` is sent as never-indexed.
21833
+
21834
+ `stop()` shuts each connection down in two steps: a `GOAWAY` that refuses nothing and a `PING`, then, once the peer answers or after one second, the final `GOAWAY`. Requests already on their way are served.
21835
+
21836
+ ### Settings
21837
+
21838
+ `http2` also takes an object. A value out of range makes `serve()` throw.
21839
+
21840
+ | Setting | Default | Meaning |
21841
+ |---|---|---|
21842
+ | `maxConcurrentStreams` | 128 | Streams open at once on a connection. |
21843
+ | `initialWindowSize` | 1 MiB | Flow-control window of each request body. |
21844
+ | `connectionWindowSize` | 4 MiB | Flow-control window of the connection, 65535 or more. |
21845
+ | `maxFrameSize` | 16384 | Largest frame accepted. |
21846
+ | `headerTableSize` | 4096 | Bytes of each HPACK table, request and response side. 0 to 65536. |
21847
+ | `maxSendBuffer` | 16 MiB | Queued response bytes per connection. At this limit the next buffered response with a body is reset with `ENHANCE_YOUR_CALM`, and past it a streamed one is told to wait. |
21848
+ | `pingIntervalMs` | 0 (off) | Quiet time after which a `PING` is sent, checked once a second. A peer that answers is not idle: set this below `idleTimeoutMs` to keep a live one open. |
21849
+ | `pingTimeoutMs` | 20000 | Budget for the answer before the connection closes. |
21850
+
21851
+ ### Response trailers
21852
+
21853
+ HTTP/2 only:
21854
+
21855
+ ```ts
21856
+ import { setResponseTrailers } from "@nifrajs/node-engine"
21857
+
21858
+ app.get("/report", (c) => {
21859
+ setResponseTrailers(c.req, { "x-checksum": "abc123" })
21860
+ return { ok: true }
21861
+ })
21862
+ ```
21863
+
21864
+ Pass the `Request` the engine made (`c.req`, or the first `fetch` argument), not a copy, and call it before the body ends: a streamed body can call it from its last `pull`. It returns `false`, and sets nothing, on HTTP/1.1, once the response is complete, or for a name that cannot be a trailer (a pseudo-header, a connection field, `content-length`, `host`, `te`).
21865
+
21866
+ ### HTTP/2 benchmarks
21867
+
21868
+ There are none yet. HTTP/2 here is covered by correctness tests only, and no throughput or latency figure for it has been measured or is quoted anywhere in this package. Figures for this repository's public pages come from the benchmark-accuracy CI run, not from a developer machine, and that run has no HTTP/2 target.
21869
+
21870
+ To measure it, use a client that speaks HTTP/2 and is not itself the limit:
21871
+
21872
+ ```bash
21873
+ # cleartext, prior knowledge
21874
+ h2load -c 64 -m 10 -D 10 http://127.0.0.1:3000/hello
21875
+ # TLS, negotiated by ALPN
21876
+ h2load -c 64 -m 10 -D 10 https://127.0.0.1:3000/hello
21877
+ # the same server over HTTP/1.1, for the comparison that matters
21878
+ h2load -c 64 -m 10 -D 10 --h1 http://127.0.0.1:3000/hello
21879
+ ```
21880
+
21881
+ `h2load` ships with nghttp2. `oha --http2` and `bombardier --http2` also work, but on a fast server they run out of client before the server does, so a figure from them says little about the server. A comparison is only fair against another server on the same machine, with the same route, the same TLS settings, and `http2: true` on this one. Report the scope with every number: runtime and engine version, cleartext or TLS, connections and streams per connection, and whether the client was the bottleneck.
21882
+
21883
+ ## WebSockets
21884
+
21885
+ An app that exposes `resolveWebSocketUpgrade` (every nifra app does) serves its `app.ws()` routes. A plain `{ fetch }` handler cannot, and a handshake to it is refused with 501.
21886
+
21887
+ - A guard's rejection answers the handshake with its own status, headers and body. A path with no socket route is answered by its HTTP route.
21888
+ - Text arrives as a `string`, binary as a `Uint8Array`. A handler that throws reaches the route's `error()` and never ends the connection.
21889
+ - `ws.close()` refuses a code or reason a server may not send, with a `RangeError`, as on the other adapters.
21890
+ - `ws.raw` is an `EngineSocket`: `id`, `headers()`, `query()` and `remoteAddress()` of the handshake. The engine keeps no socket object to hand out.
21891
+ - The engine takes one message cap per listener. Unless `wsMaxMessageSize` is set, it is the largest `wsMaxPayloadBytes` among the app and the apps mounted in it that serve sockets, else the engine's 16 MiB. A route whose app declares less is held to its own, and a message over it closes the socket with 1009.
21892
+
21893
+ - The peer's close code and close reason (`ws.close` / `handler.close`) are reported verbatim, and `ws.getBufferedAmount()` / `handler.drain` track per-socket backpressure.
21894
+
21895
+ ## Notes on buffered vs streaming request bodies
21896
+
21897
+ - By default, request bodies are buffered up to `maxBodySize` plus `oversizeWindow`; a body past the window gets the engine's empty 413 rather than the app's own error.
21898
+ - Set `engine.streamRequestBodies: true` to stream HTTP/1.1 and HTTP/2 request bodies incrementally with socket/window backpressure. `requestTimeoutMs` bounds the whole upload, and an HTTP/2 peer that sends more than the larger of `http2.initialWindowSize` and 65535 bytes into a paused stream has that stream reset. `maxBodySize` does not apply to a streamed body: the route's `bodyLimit` does, except that `c.boundedBody(maxBytes)` and `c.boundedJson(maxBytes)` use the cap they are given, which may be larger. Where no route limit applies (a `bodyLimit: "unlimited"` route, or an `onRequest` hook), the request's own readers (`text()`, `json()`, `arrayBuffer()`, `bytes()`, `blob()`, `formData()`, `clone()`) are held to `maxBodySize` and answer 413 past it; reading `req.body` yourself has no cap.
21899
+
21900
+ ## Certificate reload
21901
+
21902
+ ```ts
21903
+ running.reloadTls({ cert, key }) // a new certificate
21904
+ running.reloadTls() // read the current files again
21905
+ ```
21906
+
21907
+ New handshakes, HTTP/1.1 and HTTP/2, get the new certificate; connections already open keep theirs. The argument is the whole `tls` shape, not a diff. With none, the current `tls` options are read again, which is how rotated certificate files are picked up. Session tickets carry over, so resumption survives the new certificate. It throws, leaving the certificate in place, on material the engine refuses, on a server without `tls`, and after `stop()`. Nothing watches the files; call it from a signal handler or a timer.
21908
+
21909
+ ## Failed streams
21910
+
21911
+ When a streamed body fails after its head is out, the response is cut so the client sees a failure instead of a complete answer. The engine has no call that cuts one connection, so this uses two of its own behaviours:
21912
+
21913
+ | Response | HTTP/1.1 | HTTP/2 |
21914
+ |---|---|---|
21915
+ | Declared `Content-Length`, body falls short | Connection closed | Stream reset |
21916
+ | No declared length | Connection closed, no chunk terminator | Stream reset |
21917
+
21918
+ The failure is also reported through the app's error hook.
21919
+
21920
+ ## Clustering
21921
+
21922
+ ```ts
21923
+ import { serveCluster } from "@nifrajs/node-engine/cluster"
21924
+
21925
+ const node = await serveCluster(() => buildApp(), { port: 3000, workers: 4 })
21926
+ if (node.role === "primary") {
21927
+ // node.workers(), node.stop(), node.restart(), node.reloadTls()
21928
+ }
21929
+ ```
21930
+
21931
+ A primary process supervises worker processes that each run the engine on the same port with `SO_REUSEPORT`, so the kernel spreads accepted connections across them. The file runs in the primary and again in every worker, as with `node:cluster`; the app is built only in workers. `serveCluster` takes every `serve()` option plus:
21932
+
21933
+ | Option | Meaning |
21934
+ |---|---|
21935
+ | `workers` | Worker processes. Default: one per core. |
21936
+ | `respawn` | Replace a worker that dies. Default `true`; a worker that keeps dying within seconds of starting is given up on after ten tries. |
21937
+ | `onWorkerEvent` | Called in the primary with `listening` and `exit` events. |
21938
+
21939
+ The primary resolves once every worker is listening, and rejects after stopping the others if one cannot start. `stop()` and `gracefulSignals` drain every worker; one still alive well past the drain is killed. Workers share a set of TLS session-ticket keys, and the primary's `reloadTls()` reloads the certificate in every worker (PEM text or file names only, since it crosses a process boundary).
21940
+
21941
+ ### Rolling restart
21942
+
21943
+ ```ts
21944
+ process.on("SIGUSR2", () => void node.restart({ drainMs: 10_000 }))
21945
+ ```
21946
+
21947
+ `restart()` replaces the workers one at a time: a new worker starts and is listening before the one it replaces is stopped, so the port is always served and capacity never drops. Each old worker gets the usual graceful stop (`drainMs`, `delayMs`). New workers run whatever the entry file and its imports are on disk when they start, which is how a deploy picks up new code without dropping the port. It resolves once the last old worker has exited.
21948
+
21949
+ If a new worker does not start within `startTimeoutMs` (default 30 s), the restart stops there and rejects: workers not yet replaced keep serving, and the ones already replaced stay replaced. `stop()` during a restart ends it. A second call while one is under way returns the first.
21950
+
21951
+ On Linux, closing a worker's listening socket resets the connections that were still being accepted on it, so a client can see a reset on a connection it opened in that instant. It is a small fraction of new connections and it scales with the connection rate. A client that retries an idempotent request once, as any client behind a load balancer does, does not notice: in testing, a second attempt never failed. On macOS no request failed. Setting `net.ipv4.tcp_migrate_req=1` makes the kernel hand those connections to the other workers, which reduced the resets in testing but also left some requests stalled until the client timed out, so it is not recommended with this engine.
21952
+
21953
+ `port` must be fixed: workers cannot share an ephemeral one. Windows has no `SO_REUSEPORT` and is refused. The Linux kernel balances accepts across the workers; macOS and BSD accept the shared bind but send new connections to one worker, so use it there for development only.
21954
+
21955
+ ## Feature parity
21956
+
21957
+ `@nifrajs/node-engine` supports `static`, `fastResponse`, `compression`, `path` (Unix domain sockets), SNI multi-cert (`tls.serverNames` + `addServerName`/`removeServerName`), WebSocket native pub/sub + backpressure + peer close reason + RFC 8441 over HTTP/2, `> 4 GiB` response framing, and incremental streaming request bodies (`engine.streamRequestBodies`).
21958
+
21959
+ ## Benchmark
21960
+
21961
+ `bench/compare.mjs` runs a rotated, serial `wrk` comparison on one Linux box, in two tiers:
21962
+
21963
+ - **Frameworks**, each answering the same three routes as an ordinary app: nifra on the Rust engine (`nifra-engine`, and `nifra-engine-host` with `validateHost`), on `@nifrajs/node-uws` (`nifra-uws`) and on `node:http` (`nifra-node`), and the Moro framework (`moro`). Workloads are a path-parameter GET, the same with a browser-sized header set, and 13 B and 1 KiB JSON POSTs with validation.
21964
+ - **Raw engines**, each driven directly by one shared handler (`bench/raw-handler.mjs`) with no router, hooks or content-type check, so every engine does the same work for the same bytes: `raw-nifra-engine` (the addon on its batch ABI), `raw-uws`, `raw-node` and `raw-moro-engine` (`@morojs/engine`).
21965
+
21966
+ The first table reports median req/s, spread, and each row's ratio to `moro` and to `nifra-uws`. The second divides each framework by its own raw engine, which is that framework's layer cost; comparing raw engines to each other is the engine gap. `nifra-engine#2` is an A/A control, so its gap to `nifra-engine` is noise. A framework row set against a raw row of another stack is not a like-for-like comparison.
21967
+
21968
+ Moro is a benchmark competitor only. No nifra package depends on it: `bench/moro` holds its own `package.json` and `package-lock.json` (outside the workspace), installed with `npm ci` and found through `MORO_DIR`.
21969
+
21970
+ ```sh
21971
+ npm ci --prefix packages/node-engine/bench/moro --ignore-scripts
21972
+ ROOT="$PWD" MORO_DIR="$PWD/packages/node-engine/bench/moro" NIFRA_RUST_ENGINE_PATH=/path/to/nifra_napi.node node packages/node-engine/bench/compare.mjs
21973
+ ```
21974
+
21975
+ Numbers that are reported come from the `Engine compare` workflow (manual dispatch), not from a developer machine. Configuration is environment: `ROUNDS`, `DURATION`, `TARGETS`, `WORKLOADS`, `OUT`.
21976
+
21977
+ ## For AI agents
21978
+
21979
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
21980
+
21981
+ ## @nifrajs/node-engine-darwin-arm64
21982
+
21983
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `darwin-arm64`.
21984
+
21985
+ ## For AI agents
21986
+
21987
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-darwin-arm64/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
21988
+
21989
+ ## @nifrajs/node-engine-darwin-x64
21990
+
21991
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `darwin-x64`.
21992
+
21993
+ ## For AI agents
21994
+
21995
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-darwin-x64/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
21996
+
21997
+ ## @nifrajs/node-engine-linux-arm64-gnu
21998
+
21999
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `linux-arm64-gnu`.
22000
+
22001
+ ## For AI agents
22002
+
22003
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-linux-arm64-gnu/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
22004
+
22005
+ ## @nifrajs/node-engine-linux-arm64-musl
22006
+
22007
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `linux-arm64-musl`.
22008
+
22009
+ ## For AI agents
22010
+
22011
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-linux-arm64-musl/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
22012
+
22013
+ ## @nifrajs/node-engine-linux-x64-gnu
22014
+
22015
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `linux-x64-gnu`.
22016
+
22017
+ ## For AI agents
22018
+
22019
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-linux-x64-gnu/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
22020
+
22021
+ ## @nifrajs/node-engine-linux-x64-musl
22022
+
22023
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `linux-x64-musl`.
22024
+
22025
+ ## For AI agents
22026
+
22027
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-linux-x64-musl/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
22028
+
22029
+ ## @nifrajs/node-engine-win32-x64
22030
+
22031
+ Prebuilt native Rust engine binary for `@nifrajs/node-engine` on `win32-x64`.
22032
+
22033
+ ## For AI agents
22034
+
22035
+ See the [package contract card](https://github.com/nifrajs/nifra/blob/main/packages/node-engine-win32-x64/LLM.md) and the [full Nifra corpus](https://github.com/nifrajs/nifra/blob/main/llms-full.txt).
22036
+
21646
22037
  ## @nifrajs/node-uws
21647
22038
 
21648
22039
  Serve a [nifra](../../README.md) app on [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js)
@@ -22398,10 +22789,12 @@ import { assertSafeKey, StorageKeyError } from "@nifrajs/storage"
22398
22789
 
22399
22790
  ## API
22400
22791
 
22401
- - `new MemoryStorage()` · `new FileStorage(root)` · `new R2Storage(bucket, { maxReadBytes? })`.
22792
+ - `new MemoryStorage()` · `new FileStorage(root, { maxReadBytes?, maxMetadataBytes? })` · `new R2Storage(bucket, { maxReadBytes? })`.
22402
22793
  - `put(key, data, { contentType?, metadata? })` - `data` is `Uint8Array | ArrayBuffer | string`.
22403
22794
  - `get(key)` → `{ body, size, contentType?, metadata? } | null` · `delete(key)` · `exists(key)` · `list({ prefix?, limit? })`.
22404
- `R2Storage.get` defaults to a 16 MiB read limit and throws a `RangeError` for oversized objects.
22795
+ `R2Storage.get` and `FileStorage.get` default to a 16 MiB read limit and throw a `RangeError` for
22796
+ oversized objects. `FileStorage` applies a separate 16 MiB limit, `maxMetadataBytes`, to an object's
22797
+ metadata file. `put` has no limit: raise the read limit to read back larger objects.
22405
22798
  `FileStorage.list` reads and sorts each directory it enters, so even `limit: 1` costs time in
22406
22799
  proportion to those directories' entries; split a very large store across key prefixes.
22407
22800
  - `assertSafeKey(key)` / `StorageKeyError` · `toBytes(data)`.
@@ -23302,7 +23695,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
23302
23695
 
23303
23696
  ## @nifrajs/coding-agent
23304
23697
 
23305
- `AGENT_CAPABILITY_MANIFEST_VERSION`, `AGENT_PRESETS`, `APPROVAL_NEVER_EXPIRES_AT`, `AgentCapability`, `AgentCapabilityManifest`, `AgentPlan`, `AgentPreset`, `AgentPresetName`, `ApprovalDecision`, `ApprovalManager`, `ApprovalManagerOptions`, `ApprovalMatchRejection`, `ApprovalMatchResult`, `ApprovalRequest`, `ApprovalTimeout`, `BoundedSubagentRunner`, `BoundedText`, `CapabilityDescriptor`, `CiDeploymentAdapter`, `CodingAgentExtension`, `CodingAgentHost`, `CodingAgentHostOptions`, `CodingAgentRpcServer`, `CodingAgentRpcServerHandle`, `CodingAgentRpcServerOptions`, `CompactionReport`, `ContextRecord`, `ContextWindow`, `ContextWindowOptions`, `DEPLOYMENT_REFERENCE_PROFILES`, `ExtensionCommand`, `ExtensionContext`, `ExtensionDescriptorOptions`, `ExtensionDescriptorSource`, `ExtensionEventHandler`, `ExtensionHost`, `ExtensionHostOptions`, `ExtensionProvider`, `ExtensionReloadResult`, `ExtensionSubagent`, `ExtensionTool`, `FileSessionStore`, `FileSessionStoreOptions`, `HandoffCoordinator`, `HandoffCoordinatorOptions`, `HandoffDecision`, `HandoffError`, `HandoffRejection`, `HandoffView`, `HealingEvent`, `HealingOptions`, `HealingResult`, `IsolatedExtensionSnapshot`, `IsolatedExtensionTool`, `IsolatedExtensionWorker`, `IsolatedExtensionWorkerOptions`, `LocalProcessDeploymentAdapter`, `MigrateLegacySessionOptions`, `NIFRA_AGENT_INSTRUCTIONS`, `NativeApprovalPort`, `NativeApprovalRequest`, `NativeGatewayModelPortOptions`, `NativeMessage`, `NativeModelChunk`, `NativeModelPort`, `NativeModelRequest`, `NativeModelResponse`, `NativeReviewAnswer`, `NativeTool`, `NifraAgentTool`, `NifraBackend`, `NifraBackendOptions`, `NifraContextOptions`, `NifraContextResult`, `OpenHandoffInput`, `PiBackend`, `PiBackendOptions`, `PlanEvent`, `PlanPhase`, `PlanResult`, `PlanRunner`, `PlanRunnerOptions`, `ProjectDiffOptions`, `ProjectDiffResult`, `RepairProposal`, `ReplayBackend`, `ReplayBackendOptions`, `ReplayDeploymentAdapter`, `ReviewExecutionErrorCode`, `ReviewExecutionResult`, `ReviewOptions`, `SESSION_EVIDENCE_VERSION`, `SelfHealingController`, `SessionEvidenceRecord`, `SessionLogEntry`, `SessionMigrationError`, `SessionMigrationReport`, `SessionStore`, `SubagentAbandonment`, `SubagentAbandonmentLedger`, `SubagentChildLedger`, `SubagentExecutor`, `SubagentResult`, `SubagentRunnerOptions`, `SubagentSpec`, `UiExtensionHost`, `UiExtensionHostOptions`, `UiExtensionManifest`, `UiExtensionSlot`, `UiReloadResult`, `UiStatusWidget`, `UiThemeDescriptor`, `VerificationOptions`, `VerificationRepairTask`, `VerificationResult`, `WorkflowContext`, `WorkflowEvent`, `WorkflowResult`, `WorkflowRunner`, `WorkflowRunnerOptions`, `WorkflowStep`, `approvalRequestFromEvent`, `approvalResolvedEvent`, `createCapabilityManifest`, `createCiDeploymentAdapter`, `createLocalProcessDeploymentAdapter`, `createNativeGatewayModelPort`, `createNifraTools`, `createPresetSpec`, `createReplayDeploymentAdapter`, `createVerificationRepairTask`, `deniedCapabilities`, `discoverExtensions`, `extensionDescriptor`, `extensionDescriptors`, `getAgentPreset`, `isSafeReviewDiff`, `isVerificationAvailable`, `migrateLegacySession`, `parseCapabilityManifest`, `parseSessionEvidenceRecord`, `readBoundedText`, `readProjectDiff`, `readReplayEvents`, `runNifraContext`, `runNifraReview`, `runNifraVerification`, `stableSessionEventCode`, `validateExtensionModule`
23698
+ `AGENT_CAPABILITY_MANIFEST_VERSION`, `AGENT_PRESETS`, `APPROVAL_NEVER_EXPIRES_AT`, `AgentCapability`, `AgentCapabilityManifest`, `AgentPlan`, `AgentPreset`, `AgentPresetName`, `ApprovalDecision`, `ApprovalManager`, `ApprovalManagerOptions`, `ApprovalMatchRejection`, `ApprovalMatchResult`, `ApprovalRequest`, `ApprovalTimeout`, `BoundedSubagentRunner`, `BoundedText`, `CapabilityDescriptor`, `CiDeploymentAdapter`, `CodingAgentExtension`, `CodingAgentHost`, `CodingAgentHostOptions`, `CodingAgentRpcServer`, `CodingAgentRpcServerHandle`, `CodingAgentRpcServerOptions`, `CompactionReport`, `ContainerSandboxProfile`, `ContextRecord`, `ContextWindow`, `ContextWindowOptions`, `CustomSandboxProfile`, `DEPLOYMENT_REFERENCE_PROFILES`, `ExtensionCommand`, `ExtensionContext`, `ExtensionDescriptorOptions`, `ExtensionDescriptorSource`, `ExtensionEventHandler`, `ExtensionHost`, `ExtensionHostOptions`, `ExtensionProvider`, `ExtensionReloadResult`, `ExtensionSandboxProfile`, `ExtensionSubagent`, `ExtensionTool`, `FileSessionStore`, `FileSessionStoreOptions`, `HandoffCoordinator`, `HandoffCoordinatorOptions`, `HandoffDecision`, `HandoffError`, `HandoffRejection`, `HandoffView`, `HealingEvent`, `HealingOptions`, `HealingResult`, `IsolatedExtensionSnapshot`, `IsolatedExtensionTool`, `IsolatedExtensionWorker`, `IsolatedExtensionWorkerOptions`, `LocalProcessDeploymentAdapter`, `MacOsSeatbeltSandboxProfile`, `MigrateLegacySessionOptions`, `NIFRA_AGENT_INSTRUCTIONS`, `NativeApprovalPort`, `NativeApprovalRequest`, `NativeGatewayModelPortOptions`, `NativeMessage`, `NativeModelChunk`, `NativeModelPort`, `NativeModelRequest`, `NativeModelResponse`, `NativeReviewAnswer`, `NativeTool`, `NifraAgentTool`, `NifraBackend`, `NifraBackendOptions`, `NifraContextOptions`, `NifraContextResult`, `OpenHandoffInput`, `PiBackend`, `PiBackendOptions`, `PlanEvent`, `PlanPhase`, `PlanResult`, `PlanRunner`, `PlanRunnerOptions`, `ProjectDiffOptions`, `ProjectDiffResult`, `RepairProposal`, `ReplayBackend`, `ReplayBackendOptions`, `ReplayDeploymentAdapter`, `ReviewExecutionErrorCode`, `ReviewExecutionResult`, `ReviewOptions`, `SESSION_EVIDENCE_VERSION`, `SandboxedSpawnSpec`, `SelfHealingController`, `SessionEvidenceRecord`, `SessionLogEntry`, `SessionMigrationError`, `SessionMigrationReport`, `SessionStore`, `SubagentAbandonment`, `SubagentAbandonmentLedger`, `SubagentChildLedger`, `SubagentExecutor`, `SubagentResult`, `SubagentRunnerOptions`, `SubagentSpec`, `UiExtensionHost`, `UiExtensionHostOptions`, `UiExtensionManifest`, `UiExtensionSlot`, `UiReloadResult`, `UiStatusWidget`, `UiThemeDescriptor`, `VerificationOptions`, `VerificationRepairTask`, `VerificationResult`, `WorkflowContext`, `WorkflowEvent`, `WorkflowResult`, `WorkflowRunner`, `WorkflowRunnerOptions`, `WorkflowStep`, `approvalRequestFromEvent`, `approvalResolvedEvent`, `buildSandboxedSpawn`, `buildSeatbeltProfile`, `createCapabilityManifest`, `createCiDeploymentAdapter`, `createLocalProcessDeploymentAdapter`, `createNativeGatewayModelPort`, `createNifraTools`, `createPresetSpec`, `createReplayDeploymentAdapter`, `createVerificationRepairTask`, `deniedCapabilities`, `discoverExtensions`, `extensionDescriptor`, `extensionDescriptors`, `getAgentPreset`, `isSafeReviewDiff`, `isVerificationAvailable`, `migrateLegacySession`, `parseCapabilityManifest`, `parseSessionEvidenceRecord`, `readBoundedText`, `readProjectDiff`, `readReplayEvents`, `runNifraContext`, `runNifraReview`, `runNifraVerification`, `stableSessionEventCode`, `validateExtensionModule`
23306
23699
 
23307
23700
  ## @nifrajs/content
23308
23701
 
@@ -23310,7 +23703,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
23310
23703
 
23311
23704
  ## @nifrajs/core
23312
23705
 
23313
- `AdmissionController`, `AdmissionDecision`, `AnyServer`, `AuthHeaders`, `AuthMaybePromise`, `AuthenticationFailure`, `AuthenticationFailureReason`, `AuthenticationInput`, `AuthenticationResult`, `AuthenticationStage`, `AuthenticationSuccess`, `Context`, `ContextPlugin`, `CookieOptions`, `CookieSecret`, `DeclaredMountRoute`, `DefinePluginResult`, `DurableObjectNamespaceLike`, `ExecutionContext`, `FRAMEWORK_NAME`, `FetchApp`, `FrameworkError`, `FrameworkName`, `Handler`, `IdentityPlugin`, `InferInput`, `InferOutput`, `JoinRoutePath`, `LambdaEvent`, `LambdaHandler`, `LambdaResponse`, `LambdaV1Event`, `LambdaV2Event`, `ListenTlsOptions`, `LogFields`, `Logger`, `METHODS`, `McpPromptDescriptor`, `McpResourceDescriptor`, `Method`, `Middleware`, `MountFetchOptions`, `MountOptions`, `MountableApp`, `NetlifyEvent`, `NetlifyHandler`, `NifraFeatureVersion`, `NifraPlugin`, `NifraWebSocket`, `NodeRequestContext`, `NodeRequestHook`, `NodeResponseBodyHook`, `NodeResponseContext`, `NodeResponseHook`, `NodeServeOutcome`, `OnRequestResult`, `OpaqueMountDeclaration`, `Params`, `PlainRender`, `Platform`, `PlatformResponse`, `PluginTypeCollapsed`, `PrefixRegistry`, `Prettify`, `PromptArgument`, `PromptMessage`, `ROUTE_PATTERN_OVERLAP_MAX_STATES`, `RedactOptions`, `Registry`, `RequestLocal`, `RequestPath`, `ResponseBodyHook`, `ResponseBodyReplacement`, `ResponseControls`, `ResponseFinalization`, `ResponseHeadersHook`, `ResponseHeadersView`, `ResponseMapFor`, `ResponseResult`, `RouteConfigError`, `RouteConfigErrorCode`, `RouteDescriptor`, `RouteInfo`, `RouteInfoFor`, `RouteMethod`, `RoutePatternOverlapLimitError`, `RouteSchema`, `Router`, `RouterMatch`, `RunningServer`, `SSEContext`, `SSEInit`, `SSEMessage`, `SSEStream`, `ScheduledController`, `ScheduledHandler`, `Server`, `ServerOptions`, `StandardIssue`, `StandardResult`, `StandardSchemaV1`, `StandardTypes`, `StandardWebSocket`, `StatusResponse`, `ToolAnnotations`, `TopicAdapter`, `TypedSSEStream`, `UrlParts`, `VERSION`, `ValidationOutcome`, `VercelHandler`, `Version`, `WebSocketContext`, `WebSocketData`, `WebSocketHandler`, `WebSocketUpgradeOutcome`, `authenticated`, `beforeHandler`, `carryRequestLocals`, `commonSecretPatterns`, `cookieNamePrefix`, `defineContextPlugin`, `defineIdentityPlugin`, `definePlugin`, `defineRouterPlugin`, `echoParam`, `hasDuplicateCookie`, `isAuthenticatedRequest`, `isSameOriginForm`, `isSameOriginPath`, `isSameOriginRequest`, `jsonLogger`, `markAuthenticatedRequest`, `parseCookies`, `pathnameOf`, `redactLogFields`, `rejected`, `replacedRequestOf`, `requestLocal`, `routePatternOverlap`, `routeTemplateOf`, `serializeCookie`, `server`, `signValue`, `silentLogger`, `staticResponse`, `status`, `toFetchHandler`, `toLambdaHandler`, `toNetlifyHandler`, `toVercelHandler`, `unsignValue`, `urlPartsOf`, `varyOn`, `writableResponse`
23706
+ `AdmissionController`, `AdmissionDecision`, `AnyServer`, `AuthHeaders`, `AuthMaybePromise`, `AuthenticationFailure`, `AuthenticationFailureReason`, `AuthenticationInput`, `AuthenticationResult`, `AuthenticationStage`, `AuthenticationSuccess`, `Context`, `ContextPlugin`, `CookieOptions`, `CookieSecret`, `DeclaredMountRoute`, `DefinePluginResult`, `DurableObjectNamespaceLike`, `ExecutionContext`, `FRAMEWORK_NAME`, `FetchApp`, `FrameworkError`, `FrameworkName`, `Handler`, `IdentityPlugin`, `InferInput`, `InferOutput`, `JoinRoutePath`, `LambdaEvent`, `LambdaHandler`, `LambdaResponse`, `LambdaV1Event`, `LambdaV2Event`, `ListenTlsOptions`, `LogFields`, `Logger`, `METHODS`, `McpPromptDescriptor`, `McpResourceDescriptor`, `Method`, `Middleware`, `MountFetchOptions`, `MountOptions`, `MountableApp`, `NetlifyEvent`, `NetlifyHandler`, `NifraFeatureVersion`, `NifraPlugin`, `NifraWebSocket`, `NodeRequestContext`, `NodeRequestHook`, `NodeResponseBodyHook`, `NodeResponseContext`, `NodeResponseHook`, `NodeServeOutcome`, `OnRequestResult`, `OpaqueMountDeclaration`, `Params`, `PlainRender`, `Platform`, `PlatformResponse`, `PluginTypeCollapsed`, `PrefixRegistry`, `Prettify`, `PromptArgument`, `PromptMessage`, `ROUTE_PATTERN_OVERLAP_MAX_STATES`, `RedactOptions`, `Registry`, `RequestLocal`, `RequestPath`, `ResponseBodyHook`, `ResponseBodyReplacement`, `ResponseControls`, `ResponseFinalization`, `ResponseHeadersHook`, `ResponseHeadersView`, `ResponseMapFor`, `ResponseResult`, `RouteConfigError`, `RouteConfigErrorCode`, `RouteDescriptor`, `RouteInfo`, `RouteInfoFor`, `RouteMethod`, `RoutePatternOverlapLimitError`, `RouteSchema`, `Router`, `RouterMatch`, `RunningServer`, `SSEContext`, `SSEInit`, `SSEMessage`, `SSEStream`, `ScheduledController`, `ScheduledHandler`, `Server`, `ServerOptions`, `StandardIssue`, `StandardResult`, `StandardSchemaV1`, `StandardTypes`, `StandardWebSocket`, `StatusResponse`, `ToolAnnotations`, `TopicAdapter`, `TypedSSEStream`, `UrlParts`, `VERSION`, `ValidationOutcome`, `VercelHandler`, `Version`, `WebSocketContext`, `WebSocketData`, `WebSocketHandler`, `WebSocketUpgradeOutcome`, `authenticated`, `beforeHandler`, `carryRequestLocals`, `commonSecretPatterns`, `cookieNamePrefix`, `defineContextPlugin`, `defineIdentityPlugin`, `definePlugin`, `defineRouterPlugin`, `echoParam`, `hasDuplicateCookie`, `isAuthenticatedRequest`, `isSameOriginForm`, `isSameOriginPath`, `isSameOriginRequest`, `jsonLogger`, `markAuthenticatedRequest`, `parseCookies`, `pathnameOf`, `redactLogFields`, `rejected`, `replacedRequestOf`, `requestLocal`, `routePatternOverlap`, `routeTemplateOf`, `serializeCookie`, `server`, `sharedResponseCacheBypass`, `signValue`, `silentLogger`, `staticResponse`, `status`, `toFetchHandler`, `toLambdaHandler`, `toNetlifyHandler`, `toVercelHandler`, `unsignValue`, `urlPartsOf`, `varyOn`, `writableResponse`
23314
23707
 
23315
23708
  ## @nifrajs/cron
23316
23709
 
@@ -23384,6 +23777,10 @@ done-gate, or `nifra mcp` to give the agent live project tools.
23384
23777
 
23385
23778
  `FetchHandler`, `HashedFiles`, `NodeServer`, `NodeStopOptions`, `RequestProtocol`, `RequestProtocolOption`, `ServeOptions`, `ServeStaticOptions`, `serve`, `serveStatic`
23386
23779
 
23780
+ ## @nifrajs/node-engine
23781
+
23782
+ `CompressionOptions`, `ConnectHandler`, `EngineServer`, `EngineSocket`, `EngineTuning`, `FetchHandler`, `Http2Options`, `NodeCompatPair`, `NodeMiddleware`, `NodeMiddlewareContextLike`, `NodeRequestListener`, `NodeStopOptions`, `PeerCertificateInfo`, `ProbeResult`, `ServeOptions`, `TlsOptions`, `TlsSniEntry`, `WsDeflateOptions`, `bodyCeiling`, `createNodeCompat`, `fromNodeHandler`, `fromNodeMiddleware`, `getPeerCertificate`, `isNativeAvailable`, `mayServeSockets`, `payloadCeiling`, `probe`, `serve`, `serveStatic`, `setResponseTrailers`, `writeEarlyHints`, `writeInformational`
23783
+
23387
23784
  ## @nifrajs/node-uws
23388
23785
 
23389
23786
  `FetchHandler`, `NodeStopOptions`, `ServeOptions`, `UwsServer`, `UwsTlsOptions`, `serve`
@@ -23414,7 +23811,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
23414
23811
 
23415
23812
  ## @nifrajs/storage
23416
23813
 
23417
- `BeaconingStorageAdapter`, `CapabilityBeacon`, `FileStorage`, `ListOptions`, `MemoryStorage`, `MovableStorageAdapter`, `PagedStorageAdapter`, `PresignableStorageAdapter`, `PutOptions`, `R2BucketLike`, `R2ObjectLike`, `R2Storage`, `StorageAdapter`, `StorageAdapterConformanceError`, `StorageAdapterConformanceOptions`, `StorageBeaconOptions`, `StorageCapabilities`, `StorageData`, `StorageKeyError`, `StorageListPage`, `StorageListPageOptions`, `StorageObject`, `StoragePresignOperation`, `StoragePresignOptions`, `StoragePresignedUrl`, `assertSafeKey`, `assertStorageAdapterConformance`, `toBytes`, `withCapabilityBeacon`
23814
+ `BeaconingStorageAdapter`, `CapabilityBeacon`, `FileStorage`, `GcsStorage`, `GcsStorageOptions`, `ListOptions`, `MemoryStorage`, `MovableStorageAdapter`, `PagedStorageAdapter`, `PresignableStorageAdapter`, `PutOptions`, `R2BucketLike`, `R2ObjectLike`, `R2Storage`, `S3Storage`, `S3StorageOptions`, `StorageAdapter`, `StorageAdapterConformanceError`, `StorageAdapterConformanceOptions`, `StorageBeaconOptions`, `StorageCapabilities`, `StorageData`, `StorageKeyError`, `StorageListPage`, `StorageListPageOptions`, `StorageObject`, `StorageObjectMetadata`, `StoragePresignOperation`, `StoragePresignOptions`, `StoragePresignedUrl`, `StorageStreamObject`, `StreamableStorageAdapter`, `assertSafeKey`, `assertStorageAdapterConformance`, `toBytes`, `withCapabilityBeacon`
23418
23815
 
23419
23816
  ## @nifrajs/testing
23420
23817
 
@@ -23434,7 +23831,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
23434
23831
 
23435
23832
  ## @nifrajs/web
23436
23833
 
23437
- `ACTION_GLOBAL`, `Action`, `BOUNDARY_GLOBAL`, `BackendOnly`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `Boundary`, `BoundaryDescriptor`, `BoundaryError`, `BoundaryLoaderEntry`, `BoundaryLoadersOf`, `BoundaryMode`, `BoundaryRegistration`, `BoundaryRequestCtx`, `BoundaryState`, `BoundaryStates`, `BoundaryStatus`, `BrowserNavigate`, `BuildAssetSet`, `CacheStore`, `CachedResponse`, `CdnPurgeOutcome`, `CdnPurgeTarget`, `ClientAction`, `ClientActionArgs`, `ClientActionResult`, `ClientLoader`, `ClientLoaderArgs`, `ClientRequestBody`, `ClientRouteHooks`, `ClientRouter`, `ClientRouterOptions`, `CreateCspPolicyOptions`, `CreateNonceResolverOptions`, `CreateWebAppOptions`, `CspHeaderContext`, `CspPolicy`, `CssLoadingMode`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_CSS_LOADING`, `DEFAULT_DEV_PORT`, `DRAFT_COOKIE`, `DataText`, `Deferred`, `DehydrateOptions`, `DehydratedQueryInfo`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HostPolicy`, `HostPolicyOptions`, `HostPolicyRule`, `Href`, `HrefOptions`, `HrefRefusal`, `HtmlSanitizer`, `IDLE_BLOCKER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `ISRQuery`, `ISRStoreOp`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `IdentityEpochContext`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `InterceptBoundary`, `Intercepted`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `KeepAliveOptions`, `KeepAliveServerOptions`, `KeptPage`, `LAYOUT_DATA_GLOBAL`, `LOCALES_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `LiveClientEntry`, `Loader`, `LoaderContext`, `LoaderResponseControls`, `LoadingEntry`, `Manifest`, `MatchChain`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `MemoryStaticBoundaryCache`, `Meta`, `MetaArgs`, `MetaDescriptor`, `MetaInput`, `MiddlewareOutcome`, `MountRouterOptions`, `MutationCallbacks`, `MutationCancelledError`, `MutationContext`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PREFETCH_HEADER`, `PRE_HYDRATION_GUARD`, `PageLocale`, `PageLocales`, `ParamsOfFrom`, `PendingBoundary`, `PlainKeyDefault`, `PlainQueryKey`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryKey`, `QueryOptions`, `QueryState`, `QueryStatus`, `REDIRECT_HEADER`, `RETAIN_HEADER`, `REVALIDATE_HEADER`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RedirectOptions`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderPageInput`, `RenderPageOptions`, `RenderProps`, `RenderStreamOptions`, `RenderedPage`, `RevalidateEndpointOptions`, `RevalidateOptions`, `RevalidateResult`, `RevalidateTags`, `RevalidateTagsInput`, `RouteEntry`, `RouteFrom`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RouteParamsOf`, `RoutePattern`, `RouteSearchInOf`, `RouteSearchOf`, `RouteSlotName`, `RouteSlotPatternsOf`, `RouteSlotRegistry`, `RouteSlotTarget`, `RouteTable`, `RouteTablePattern`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchInputOf`, `SearchOf`, `SearchOfFrom`, `SharedBoundary`, `SharedHoleCtx`, `ShellCtx`, `ShouldRevalidate`, `ShouldRevalidateArgs`, `SsrModuleLoader`, `StaticBoundary`, `StaticBoundaryCache`, `StaticBoundaryImportEdge`, `StaticBoundaryRoot`, `StaticCtx`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `StatusPageOptions`, `Submission`, `SubmitOptions`, `TrustedHtml`, `UIMatch`, `UnsafeScriptDescriptor`, `WebAppI18n`, `assertCssLoadingCompatible`, `assertRenderAdapterConformance`, `assertStaticBoundaryImports`, `boundaryDescriptors`, `boundaryModeKey`, `buildManifest`, `canonical`, `closeBoundary`, `createClientRouter`, `createCspPolicy`, `createHostPolicy`, `createMatcher`, `createMutation`, `createNonceResolver`, `createQueryClient`, `createWebApp`, `defer`, `disableDraft`, `enableDraft`, `enumerateStaticRoutes`, `filePathToPattern`, `filePathToPatterns`, `fontFace`, `fontPreload`, `generateClientEntry`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `href`, `isCacheablePage`, `isDraftEnabled`, `isHostPolicy`, `isInertHref`, `jsonLd`, `localeOfProps`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `onHrefRefused`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `queryKey`, `rawHref`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `rotateIdentityEpoch`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
23834
+ `ACTION_GLOBAL`, `Action`, `BOUNDARY_GLOBAL`, `BackendOnly`, `Blocker`, `BlockerController`, `BlockerFunction`, `BlockerLocation`, `BlockerState`, `Boundary`, `BoundaryDescriptor`, `BoundaryError`, `BoundaryLoaderEntry`, `BoundaryLoadersOf`, `BoundaryMode`, `BoundaryRegistration`, `BoundaryRequestCtx`, `BoundaryState`, `BoundaryStates`, `BoundaryStatus`, `BrowserNavigate`, `BuildAssetSet`, `CacheStore`, `CachedResponse`, `CdnPurgeOutcome`, `CdnPurgeTarget`, `ClientAction`, `ClientActionArgs`, `ClientActionResult`, `ClientLoader`, `ClientLoaderArgs`, `ClientRequestBody`, `ClientRouteHooks`, `ClientRouter`, `ClientRouterOptions`, `CreateCspPolicyOptions`, `CreateNonceResolverOptions`, `CreateWebAppOptions`, `CspHeaderContext`, `CspPolicy`, `CssLoadingMode`, `DATA_GLOBAL`, `DATA_HEADER`, `DEFAULT_CSS_LOADING`, `DEFAULT_DEV_PORT`, `DRAFT_COOKIE`, `DataText`, `Deferred`, `DehydrateOptions`, `DehydratedQueryInfo`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HostPolicy`, `HostPolicyOptions`, `HostPolicyRule`, `Href`, `HrefOptions`, `HrefRefusal`, `HtmlSanitizer`, `IDLE_BLOCKER`, `ISRApp`, `ISROptions`, `ISRPlatform`, `ISRQuery`, `ISRStoreOp`, `ISR_REVALIDATE_HEADER`, `ISR_REVALIDATE_TAGS_HEADER`, `ISR_STATUS_HEADER`, `IdentityEpochContext`, `InertScriptType`, `InfiniteData`, `InfiniteQueryHandle`, `InfiniteQueryOptions`, `InterceptBoundary`, `Intercepted`, `KVCacheStore`, `KVCacheStoreOptions`, `KVNamespaceLike`, `KeepAliveOptions`, `KeepAliveServerOptions`, `KeptPage`, `LAYOUT_DATA_GLOBAL`, `LOCALES_GLOBAL`, `LayoutEntry`, `LinkDescriptor`, `LiveClientEntry`, `Loader`, `LoaderContext`, `LoaderResponseControls`, `LoadingEntry`, `Manifest`, `MatchChain`, `MemoryCacheStore`, `MemoryCacheStoreOptions`, `MemoryStaticBoundaryCache`, `Meta`, `MetaArgs`, `MetaDescriptor`, `MetaInput`, `MiddlewareOutcome`, `MountRouterOptions`, `MutationCallbacks`, `MutationCancelledError`, `MutationContext`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PREFETCH_HEADER`, `PRE_HYDRATION_GUARD`, `PageLocale`, `PageLocales`, `ParamsOfFrom`, `PendingBoundary`, `PlainKeyDefault`, `PlainQueryKey`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `QueryKey`, `QueryOptions`, `QueryState`, `QueryStatus`, `REDIRECT_HEADER`, `RETAIN_HEADER`, `REVALIDATE_HEADER`, `ROOT_ATTRIBUTE`, `ROUTE_GLOBAL`, `RedirectOptions`, `RenderAdapter`, `RenderAdapterConformanceError`, `RenderAdapterConformanceFixture`, `RenderAssemblyCache`, `RenderPageInput`, `RenderPageOptions`, `RenderProps`, `RenderStreamOptions`, `RenderedPage`, `RevalidateEndpointOptions`, `RevalidateOptions`, `RevalidateResult`, `RevalidateTags`, `RevalidateTagsInput`, `RouteEntry`, `RouteFrom`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RouteParamsOf`, `RoutePattern`, `RouteSearchInOf`, `RouteSearchOf`, `RouteSlotName`, `RouteSlotPatternsOf`, `RouteSlotRegistry`, `RouteSlotTarget`, `RouteTable`, `RouteTablePattern`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchInputOf`, `SearchOf`, `SearchOfFrom`, `SharedBoundary`, `SharedHoleCtx`, `ShellCtx`, `ShouldRevalidate`, `ShouldRevalidateArgs`, `SsrModuleLoader`, `StaticBoundary`, `StaticBoundaryCache`, `StaticBoundaryImportEdge`, `StaticBoundaryRoot`, `StaticCtx`, `StaticPath`, `StaticPaths`, `StaticRoutes`, `StatusPageOptions`, `Submission`, `SubmitOptions`, `TrustedHtml`, `UIMatch`, `UnsafeScriptDescriptor`, `WebAppI18n`, `assertCssLoadingCompatible`, `assertRenderAdapterConformance`, `assertStaticBoundaryImports`, `boundaryDescriptors`, `boundaryModeKey`, `buildManifest`, `canonical`, `closeBoundary`, `createClientRouter`, `createCspPolicy`, `createHostPolicy`, `createMatcher`, `createMutation`, `createNonceResolver`, `createQueryClient`, `createWebApp`, `defer`, `disableDraft`, `enableDraft`, `enumerateStaticRoutes`, `filePathToPattern`, `filePathToPatterns`, `fontFace`, `fontPreload`, `generateClientEntry`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `href`, `isCacheablePage`, `isDraftEnabled`, `isHostPolicy`, `isInertHref`, `jsonLd`, `localeOfProps`, `memoizeSearchSchema`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `onHrefRefused`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `queryKey`, `rawHref`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `rotateIdentityEpoch`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
23438
23835
 
23439
23836
  ## @nifrajs/web-preact
23440
23837