@nifrajs/cli 5.8.0 → 5.10.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 (308) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/dist/agent-files.d.ts +0 -22
  3. package/dist/agent-files.d.ts.map +1 -1
  4. package/dist/agent-files.js +3 -1
  5. package/dist/agent-files.js.map +1 -1
  6. package/dist/assure-hydration.d.ts.map +1 -1
  7. package/dist/assure-hydration.js +2 -10
  8. package/dist/assure-hydration.js.map +1 -1
  9. package/dist/assure.d.ts.map +1 -1
  10. package/dist/assure.js +3 -3
  11. package/dist/assure.js.map +1 -1
  12. package/dist/check-diagnostics.d.ts +1 -0
  13. package/dist/check-diagnostics.d.ts.map +1 -1
  14. package/dist/check-diagnostics.js +4 -0
  15. package/dist/check-diagnostics.js.map +1 -1
  16. package/dist/check-scan.d.ts +3 -0
  17. package/dist/check-scan.d.ts.map +1 -1
  18. package/dist/check-scan.js +62 -87
  19. package/dist/check-scan.js.map +1 -1
  20. package/dist/check.d.ts +3 -0
  21. package/dist/check.d.ts.map +1 -1
  22. package/dist/check.js +27 -25
  23. package/dist/check.js.map +1 -1
  24. package/dist/cli.d.ts +8 -0
  25. package/dist/cli.d.ts.map +1 -1
  26. package/dist/cli.js +53 -20
  27. package/dist/cli.js.map +1 -1
  28. package/dist/command-catalog.d.ts +1 -5
  29. package/dist/command-catalog.d.ts.map +1 -1
  30. package/dist/command-catalog.js +20 -49
  31. package/dist/command-catalog.js.map +1 -1
  32. package/dist/config-target.js +1 -1
  33. package/dist/config-target.js.map +1 -1
  34. package/dist/db-child.js +3 -10
  35. package/dist/db-child.js.map +1 -1
  36. package/dist/db-config.d.ts +2 -0
  37. package/dist/db-config.d.ts.map +1 -1
  38. package/dist/db-config.js +2 -0
  39. package/dist/db-config.js.map +1 -1
  40. package/dist/doctor.d.ts +14 -3
  41. package/dist/doctor.d.ts.map +1 -1
  42. package/dist/doctor.js +91 -6
  43. package/dist/doctor.js.map +1 -1
  44. package/dist/frontend-guidance.d.ts +19 -0
  45. package/dist/frontend-guidance.d.ts.map +1 -1
  46. package/dist/frontend-guidance.js +267 -23
  47. package/dist/frontend-guidance.js.map +1 -1
  48. package/dist/hand-built-manifest.d.ts.map +1 -1
  49. package/dist/hand-built-manifest.js +1 -1
  50. package/dist/hand-built-manifest.js.map +1 -1
  51. package/dist/internal/control-character.d.ts +3 -0
  52. package/dist/internal/control-character.d.ts.map +1 -0
  53. package/dist/internal/control-character.js +10 -0
  54. package/dist/internal/control-character.js.map +1 -0
  55. package/dist/internal/escape-regexp.d.ts +3 -0
  56. package/dist/internal/escape-regexp.d.ts.map +1 -0
  57. package/dist/internal/escape-regexp.js +5 -0
  58. package/dist/internal/escape-regexp.js.map +1 -0
  59. package/dist/internal/line-at.d.ts +3 -0
  60. package/dist/internal/line-at.d.ts.map +1 -0
  61. package/dist/internal/line-at.js +5 -0
  62. package/dist/internal/line-at.js.map +1 -0
  63. package/dist/internal/nifra-project.d.ts.map +1 -1
  64. package/dist/internal/nifra-project.js +35 -41
  65. package/dist/internal/nifra-project.js.map +1 -1
  66. package/dist/internal/posix-path.d.ts +3 -0
  67. package/dist/internal/posix-path.d.ts.map +1 -0
  68. package/dist/internal/posix-path.js +5 -0
  69. package/dist/internal/posix-path.js.map +1 -0
  70. package/dist/internal/project-specifiers.d.ts.map +1 -1
  71. package/dist/internal/project-specifiers.js +3 -10
  72. package/dist/internal/project-specifiers.js.map +1 -1
  73. package/dist/internal/realpath-or-self.d.ts +3 -0
  74. package/dist/internal/realpath-or-self.d.ts.map +1 -0
  75. package/dist/internal/realpath-or-self.js +11 -0
  76. package/dist/internal/realpath-or-self.js.map +1 -0
  77. package/dist/internal/record.d.ts +3 -0
  78. package/dist/internal/record.d.ts.map +1 -0
  79. package/dist/internal/record.js +5 -0
  80. package/dist/internal/record.js.map +1 -0
  81. package/dist/internal/source-facts.d.ts +30 -0
  82. package/dist/internal/source-facts.d.ts.map +1 -1
  83. package/dist/internal/source-facts.js +155 -25
  84. package/dist/internal/source-facts.js.map +1 -1
  85. package/dist/introspect.d.ts +0 -22
  86. package/dist/introspect.d.ts.map +1 -1
  87. package/dist/introspect.js +11 -151
  88. package/dist/introspect.js.map +1 -1
  89. package/dist/levels-tool.d.ts +2 -0
  90. package/dist/levels-tool.d.ts.map +1 -1
  91. package/dist/levels-tool.js +54 -64
  92. package/dist/levels-tool.js.map +1 -1
  93. package/dist/load.d.ts +8 -1
  94. package/dist/load.d.ts.map +1 -1
  95. package/dist/load.js +5 -0
  96. package/dist/load.js.map +1 -1
  97. package/dist/local-cli.d.ts +7 -0
  98. package/dist/local-cli.d.ts.map +1 -1
  99. package/dist/local-cli.js +13 -0
  100. package/dist/local-cli.js.map +1 -1
  101. package/dist/mcp-docs-tools.d.ts +1 -1
  102. package/dist/mcp-docs-tools.d.ts.map +1 -1
  103. package/dist/mcp-docs-tools.js +46 -3
  104. package/dist/mcp-docs-tools.js.map +1 -1
  105. package/dist/mcp-http.d.ts +1 -1
  106. package/dist/mcp-http.js +2 -2
  107. package/dist/mcp-http.js.map +1 -1
  108. package/dist/mcp-io.d.ts +16 -0
  109. package/dist/mcp-io.d.ts.map +1 -1
  110. package/dist/mcp-io.js +63 -0
  111. package/dist/mcp-io.js.map +1 -1
  112. package/dist/mcp-isolate.d.ts.map +1 -1
  113. package/dist/mcp-isolate.js +2 -1
  114. package/dist/mcp-isolate.js.map +1 -1
  115. package/dist/mcp-project-child.d.ts.map +1 -1
  116. package/dist/mcp-project-child.js +5 -12
  117. package/dist/mcp-project-child.js.map +1 -1
  118. package/dist/mcp-render.d.ts.map +1 -1
  119. package/dist/mcp-render.js +9 -51
  120. package/dist/mcp-render.js.map +1 -1
  121. package/dist/mcp-root.js +1 -1
  122. package/dist/mcp-root.js.map +1 -1
  123. package/dist/mcp-run.d.ts.map +1 -1
  124. package/dist/mcp-run.js +3 -46
  125. package/dist/mcp-run.js.map +1 -1
  126. package/dist/mcp-tool-meta.d.ts.map +1 -1
  127. package/dist/mcp-tool-meta.js +0 -1
  128. package/dist/mcp-tool-meta.js.map +1 -1
  129. package/dist/mcp-ws.d.ts.map +1 -1
  130. package/dist/mcp-ws.js +2 -18
  131. package/dist/mcp-ws.js.map +1 -1
  132. package/dist/migrate-layout.d.ts.map +1 -1
  133. package/dist/migrate-layout.js +36 -57
  134. package/dist/migrate-layout.js.map +1 -1
  135. package/dist/output-schemas.d.ts.map +1 -1
  136. package/dist/output-schemas.js +7 -7
  137. package/dist/output-schemas.js.map +1 -1
  138. package/dist/port.d.ts.map +1 -1
  139. package/dist/port.js +1 -2
  140. package/dist/port.js.map +1 -1
  141. package/dist/ppr-read-fix.js +2 -2
  142. package/dist/ppr-read-fix.js.map +1 -1
  143. package/dist/recipes/5.10.0.d.ts +12 -0
  144. package/dist/recipes/5.10.0.d.ts.map +1 -0
  145. package/dist/recipes/5.10.0.js +44 -0
  146. package/dist/recipes/5.10.0.js.map +1 -0
  147. package/dist/recipes/5.9.0.d.ts +10 -0
  148. package/dist/recipes/5.9.0.d.ts.map +1 -0
  149. package/dist/recipes/5.9.0.js +41 -0
  150. package/dist/recipes/5.9.0.js.map +1 -0
  151. package/dist/recipes/index.d.ts +5 -0
  152. package/dist/recipes/index.d.ts.map +1 -1
  153. package/dist/recipes/index.js +4 -0
  154. package/dist/recipes/index.js.map +1 -1
  155. package/dist/review.d.ts.map +1 -1
  156. package/dist/review.js +12 -13
  157. package/dist/review.js.map +1 -1
  158. package/dist/rules/codes.d.ts +3 -0
  159. package/dist/rules/codes.d.ts.map +1 -1
  160. package/dist/rules/codes.js +3 -0
  161. package/dist/rules/codes.js.map +1 -1
  162. package/dist/rules/contract-visibility.d.ts.map +1 -1
  163. package/dist/rules/contract-visibility.js +3 -9
  164. package/dist/rules/contract-visibility.js.map +1 -1
  165. package/dist/rules/data-guard.d.ts.map +1 -1
  166. package/dist/rules/data-guard.js +3 -10
  167. package/dist/rules/data-guard.js.map +1 -1
  168. package/dist/rules/explanations.d.ts.map +1 -1
  169. package/dist/rules/explanations.js +15 -0
  170. package/dist/rules/explanations.js.map +1 -1
  171. package/dist/rules/internal-links.d.ts +5 -0
  172. package/dist/rules/internal-links.d.ts.map +1 -0
  173. package/dist/rules/internal-links.js +418 -0
  174. package/dist/rules/internal-links.js.map +1 -0
  175. package/dist/rules/legacy.d.ts.map +1 -1
  176. package/dist/rules/legacy.js +20 -0
  177. package/dist/rules/legacy.js.map +1 -1
  178. package/dist/rules/pages.d.ts.map +1 -1
  179. package/dist/rules/pages.js +41 -58
  180. package/dist/rules/pages.js.map +1 -1
  181. package/dist/rules/routes.d.ts.map +1 -1
  182. package/dist/rules/routes.js +20 -27
  183. package/dist/rules/routes.js.map +1 -1
  184. package/dist/rules/security.d.ts.map +1 -1
  185. package/dist/rules/security.js +206 -313
  186. package/dist/rules/security.js.map +1 -1
  187. package/dist/rules/server-fn-namespace.d.ts +8 -0
  188. package/dist/rules/server-fn-namespace.d.ts.map +1 -0
  189. package/dist/rules/server-fn-namespace.js +43 -0
  190. package/dist/rules/server-fn-namespace.js.map +1 -0
  191. package/dist/rules/source-scan.d.ts +29 -0
  192. package/dist/rules/source-scan.d.ts.map +1 -0
  193. package/dist/rules/source-scan.js +38 -0
  194. package/dist/rules/source-scan.js.map +1 -0
  195. package/dist/rules/text-slot-boolean.d.ts.map +1 -1
  196. package/dist/rules/text-slot-boolean.js +21 -43
  197. package/dist/rules/text-slot-boolean.js.map +1 -1
  198. package/dist/rules/zones.d.ts.map +1 -1
  199. package/dist/rules/zones.js +3 -10
  200. package/dist/rules/zones.js.map +1 -1
  201. package/dist/runtime-differences.d.ts +62 -0
  202. package/dist/runtime-differences.d.ts.map +1 -0
  203. package/dist/runtime-differences.js +222 -0
  204. package/dist/runtime-differences.js.map +1 -0
  205. package/dist/sdk.d.ts.map +1 -1
  206. package/dist/sdk.js +43 -43
  207. package/dist/sdk.js.map +1 -1
  208. package/dist/smoke.d.ts.map +1 -1
  209. package/dist/smoke.js +4 -12
  210. package/dist/smoke.js.map +1 -1
  211. package/dist/source-rewrites.d.ts +27 -0
  212. package/dist/source-rewrites.d.ts.map +1 -0
  213. package/dist/source-rewrites.js +517 -0
  214. package/dist/source-rewrites.js.map +1 -0
  215. package/dist/stylex-migrate.d.ts.map +1 -1
  216. package/dist/stylex-migrate.js +1 -1
  217. package/dist/stylex-migrate.js.map +1 -1
  218. package/dist/symptom-search.d.ts +5 -0
  219. package/dist/symptom-search.d.ts.map +1 -0
  220. package/dist/symptom-search.js +21 -0
  221. package/dist/symptom-search.js.map +1 -0
  222. package/dist/typecheck-coverage.d.ts +9 -0
  223. package/dist/typecheck-coverage.d.ts.map +1 -1
  224. package/dist/typecheck-coverage.js +16 -0
  225. package/dist/typecheck-coverage.js.map +1 -1
  226. package/dist/upgrade.d.ts +28 -3
  227. package/dist/upgrade.d.ts.map +1 -1
  228. package/dist/upgrade.js +153 -64
  229. package/dist/upgrade.js.map +1 -1
  230. package/dist/verification-plan.d.ts.map +1 -1
  231. package/dist/verification-plan.js +5 -3
  232. package/dist/verification-plan.js.map +1 -1
  233. package/docs/examples.json +51 -9
  234. package/docs/llms-full.txt +1296 -287
  235. package/docs/types.json +854 -170
  236. package/package.json +11 -11
  237. package/src/agent-files.ts +4 -1
  238. package/src/assure-hydration.ts +2 -9
  239. package/src/assure.ts +3 -4
  240. package/src/check-diagnostics.ts +5 -0
  241. package/src/check-scan.ts +74 -83
  242. package/src/check.ts +40 -26
  243. package/src/cli.ts +76 -20
  244. package/src/command-catalog.ts +22 -56
  245. package/src/config-target.ts +1 -1
  246. package/src/db-child.ts +3 -10
  247. package/src/db-config.ts +4 -0
  248. package/src/doctor.ts +128 -12
  249. package/src/frontend-guidance.ts +344 -25
  250. package/src/hand-built-manifest.ts +1 -2
  251. package/src/internal/control-character.ts +8 -0
  252. package/src/internal/escape-regexp.ts +4 -0
  253. package/src/internal/line-at.ts +4 -0
  254. package/src/internal/nifra-project.ts +39 -35
  255. package/src/internal/posix-path.ts +4 -0
  256. package/src/internal/project-specifiers.ts +3 -10
  257. package/src/internal/realpath-or-self.ts +10 -0
  258. package/src/internal/record.ts +4 -0
  259. package/src/internal/source-facts.ts +194 -29
  260. package/src/introspect.ts +16 -156
  261. package/src/levels-tool.ts +71 -78
  262. package/src/load.ts +15 -1
  263. package/src/local-cli.ts +12 -0
  264. package/src/mcp-docs-tools.ts +51 -3
  265. package/src/mcp-http.ts +2 -2
  266. package/src/mcp-io.ts +77 -0
  267. package/src/mcp-isolate.ts +2 -3
  268. package/src/mcp-project-child.ts +5 -14
  269. package/src/mcp-render.ts +11 -59
  270. package/src/mcp-root.ts +1 -1
  271. package/src/mcp-run.ts +5 -54
  272. package/src/mcp-tool-meta.ts +0 -1
  273. package/src/mcp-ws.ts +2 -19
  274. package/src/migrate-layout.ts +52 -72
  275. package/src/output-schemas.ts +7 -8
  276. package/src/port.ts +1 -4
  277. package/src/ppr-read-fix.ts +2 -2
  278. package/src/recipes/5.10.0.ts +45 -0
  279. package/src/recipes/5.9.0.ts +42 -0
  280. package/src/recipes/index.ts +9 -0
  281. package/src/review.ts +15 -15
  282. package/src/rules/codes.ts +3 -0
  283. package/src/rules/contract-visibility.ts +3 -8
  284. package/src/rules/data-guard.ts +3 -10
  285. package/src/rules/explanations.ts +15 -0
  286. package/src/rules/internal-links.ts +490 -0
  287. package/src/rules/legacy.ts +21 -0
  288. package/src/rules/pages.ts +47 -58
  289. package/src/rules/routes.ts +21 -27
  290. package/src/rules/security.ts +224 -255
  291. package/src/rules/server-fn-namespace.ts +47 -0
  292. package/src/rules/source-scan.ts +66 -0
  293. package/src/rules/text-slot-boolean.ts +26 -42
  294. package/src/rules/zones.ts +3 -10
  295. package/src/runtime-differences.ts +302 -0
  296. package/src/sdk.ts +55 -58
  297. package/src/smoke.ts +4 -13
  298. package/src/source-rewrites.ts +592 -0
  299. package/src/stylex-migrate.ts +1 -3
  300. package/src/symptom-search.ts +27 -0
  301. package/src/typecheck-coverage.ts +23 -0
  302. package/src/upgrade.ts +194 -74
  303. package/src/verification-plan.ts +10 -4
  304. package/dist/sync-routes.d.ts +0 -29
  305. package/dist/sync-routes.d.ts.map +0 -1
  306. package/dist/sync-routes.js +0 -56
  307. package/dist/sync-routes.js.map +0 -1
  308. package/src/sync-routes.ts +0 -70
@@ -47,7 +47,7 @@ cd my-app
47
47
  bun install
48
48
  bun run dev`
49
49
 
50
- See the [CLI guide](/docs/cli) for other templates, UI frameworks, and deploy
50
+ See the CLI guide for other templates, UI frameworks, and deploy
51
51
  targets.
52
52
 
53
53
  ### One app, two agent loops
@@ -55,8 +55,8 @@ targets.
55
55
  A coding agent can inspect the live project, change it, run real requests, and prove the result.
56
56
  A user-facing agent can discover explicit page tools, stream progress into the UI, predict a
57
57
  state change, and reconcile it with the server. Both use the same typed capabilities and
58
- verification boundary. Start with the [agent layer](/docs/agents) or the
59
- [WebMCP & predictive UI guide](/docs/webmcp) when you are ready to add them.
58
+ verification boundary. Start with the agent layer or the
59
+ WebMCP & predictive UI guide when you are ready to add them.
60
60
 
61
61
  ### A backend-only alternative
62
62
 
@@ -104,12 +104,12 @@ In the `site` template, a route is two files: the page, and a
104
104
  `.backend.ts` half whose loader calls your backend in-process during SSR and
105
105
  whose `actions` handle mutations. Only what the loader's output schema declares
106
106
  reaches the browser. Add streaming, `defer()`, optimistic UI, and a keyed query
107
- cache as you grow, then [live refresh](/docs/live),
108
- [keep-alive](/docs/keep-alive) pages,
109
- [server components](/docs/server-components) and
110
- [partial prerendering](/docs/partial-prerendering) where a page needs them. The
107
+ cache as you grow, then live refresh,
108
+ keep-alive pages,
109
+ server components and
110
+ partial prerendering where a page needs them. The
111
111
  data model is framework-agnostic, so the renderer stays replaceable. See
112
- [Project structure](/docs/structure) for where code lives.
112
+ Project structure for where code lives.
113
113
 
114
114
  ```ts
115
115
  // routes/index.backend.ts - the loader runs on the server (in-process during SSR, no network),
@@ -150,9 +150,9 @@ export default function Page({ data }: Route.ComponentProps) {
150
150
  -
151
151
  **Vercel Edge, AWS Lambda, or a static host** - `nifra build --target vercel`,
152
152
  `@nifrajs/aws-lambda`, or `nifra build --target static` for a
153
- prerendered site. See [Deployment](/docs/deployment).
153
+ prerendered site. See Deployment.
154
154
 
155
- See the [benchmarks](/benchmarks) for how it performs.
155
+ See the benchmarks for how it performs.
156
156
 
157
157
  ## Nifra vs. other frameworks - the honest comparison
158
158
 
@@ -202,23 +202,23 @@ Across the board, Nifra ships the modern full-stack feature set on all five UI f
202
202
 
203
203
  -
204
204
  File routing (dynamic / catch-all / groups / optional) + nested layouts, typed search
205
- params, and a route [opened in a modal](/docs/routing#modal-routes).
205
+ params, and a route opened in a modal.
206
206
 
207
207
  -
208
208
  SSR · SSG · ISR, streaming SSR with out-of-order Suspense,
209
- [partial prerendering](/docs/partial-prerendering) (experimental), view
209
+ partial prerendering, view
210
210
  transitions, and a ~0 KB-client vanilla adapter with
211
- [islands](/docs/islands) and slot swaps.
211
+ islands and slot swaps.
212
212
 
213
213
  -
214
- Loaders + actions + [server functions](/docs/server-functions) (typed
214
+ Loaders + actions + server functions (typed
215
215
  `serverFn` RPC, server code never shipped to the browser) + progressive-enhancement
216
216
  forms; `defer()` / `<Await>` streaming data; query cache, optimistic
217
217
  UI, concurrent fetchers, revalidation.
218
218
 
219
219
  -
220
- [Live refresh](/docs/live) (a publish reloads only the loaders that read the
221
- changed keys) and [keep-alive](/docs/keep-alive) pages (back and forward bring
220
+ Live refresh (a publish reloads only the loaders that read the
221
+ changed keys) and keep-alive pages (back and forward bring
222
222
  the same page back, state and scroll included).
223
223
 
224
224
  - Head/meta, hover/focus prefetch, scroll restoration.
@@ -234,11 +234,11 @@ of one.
234
234
  ### Server code and server-only views
235
235
 
236
236
  Nifra provides typed loaders and actions, streaming SSR, islands and typed
237
- [server functions](/docs/server-functions). Server functions keep their
237
+ server functions. Server functions keep their
238
238
  implementation, secrets and database handles off the browser and use the same validated
239
239
  mutation API across the supported UI libraries.
240
240
 
241
- The optional [server-components pipeline](/docs/server-components) adds
241
+ The optional server-components pipeline adds
242
242
  server-only views and state-preserving refresh. React uses native RSC/Flight; Vue, Svelte,
243
243
  Solid and Preact use their native islands in validated server-rendered ranges. All five
244
244
  adapters pass the same certification, and a partially prerendered page can show a server
@@ -247,14 +247,14 @@ component in a hole. Server functions remain the mutation API; native React
247
247
 
248
248
  ### Caching and fresh data
249
249
 
250
- [SSG and ISR](/docs/rendering) cover pages that change rarely. Three more tools
250
+ SSG and ISR cover pages that change rarely. Three more tools
251
251
  cover the pages that do not:
252
252
 
253
253
  -
254
254
  **
255
- [Partial prerendering](/docs/partial-prerendering)
255
+ Partial prerendering
256
256
  **
257
- (experimental, all five adapters). The part of a page that is the same for every visitor is
257
+ (all five adapters). The part of a page that is the same for every visitor is
258
258
  built once, cached and sent at once; each per-visitor hole streams into it as its own loader
259
259
  settles. The build refuses a shell whose code reaches a module that reads the visitor, and
260
260
  `checkShellCanaries` looks for visitor data in a served shell. A shared hole, such
@@ -263,7 +263,7 @@ as partial prerendering under Cache Components.
263
263
 
264
264
  -
265
265
  **
266
- [Live refresh](/docs/live)
266
+ Live refresh
267
267
  **
268
268
  . A loader names the keys its data read with `live(...keys)`; a
269
269
  `publish`, or an action's `revalidate(paths, data, { keys })`,
@@ -280,7 +280,7 @@ the write. A page store shared between processes is signed.
280
280
 
281
281
  -
282
282
  **
283
- [Keep-alive](/docs/keep-alive)
283
+ Keep-alive
284
284
  **
285
285
  (all five adapters). `export const keepAlive = true` keeps a page mounted after
286
286
  the visitor leaves it; back and forward bring it back with its state, scroll and focus.
@@ -427,7 +427,7 @@ chain (so `n` optionals → `2ⁿ` patterns).
427
427
  -
428
428
  `x.backend.ts` beside a page or layout is its server half: `loader`,
429
429
  `action`, their output schemas, and the other server-only exports. It never
430
- reaches the browser - see [Project structure](/docs/structure).
430
+ reaches the browser - see Project structure.
431
431
 
432
432
  -
433
433
  `_404.tsx` renders unmatched paths, and whatever a loader answers with
@@ -519,7 +519,7 @@ routes/
519
519
  Each page default-exports a component; an optional `meta` export drives
520
520
  `<head>` (applied on SSR and on client navigation). Its data comes from a
521
521
  `loader` in its `.backend.ts` half - see
522
- [Loaders & actions](/docs/data).
522
+ Loaders & actions.
523
523
 
524
524
  A layout's `meta` receives its own loader's data as `data`, the value its
525
525
  component renders, or `null` when the layout has no loader. The page's data is
@@ -560,12 +560,12 @@ before a nested `_404` there. Middleware higher in the tree runs first.
560
560
 
561
561
  ```ts
562
562
  // routes/account/_layout.backend.ts - runs before every page under /account
563
- import { type RouteMiddleware, redirect } from "@nifrajs/web"
563
+ import { type RouteMiddleware, rawHref, redirect } from "@nifrajs/web"
564
564
 
565
565
  export const middleware: RouteMiddleware = ({ request, set }) => {
566
566
  set.headers["cache-control"] = "private, no-store"
567
567
  const signedIn = request.headers.get("cookie")?.includes("session=") ?? false
568
- return signedIn ? undefined : redirect("/login")
568
+ return signedIn ? undefined : redirect(rawHref("/login"))
569
569
  }
570
570
  ```
571
571
 
@@ -692,15 +692,93 @@ React/Preact, a `Ref` on Vue, an accessor on Solid/Svelte. For imperative reads
692
692
  writes of the raw query, `useSearchParams()` mirrors react-router's
693
693
  `[params, setParams]` tuple.
694
694
 
695
- To WRITE search, `useNavigate` takes an object target:
696
- `navigate({ to: "/reports", search: { page: 2 } })` serializes `search`
697
- onto `to` (no hand-built query strings). Run `nifra sync-routes` to generate
698
- `nifra-routes.d.ts` (each static route mapped to its schema output) and include it in
699
- your tsconfig, and `search` becomes typed against the target route's schema - a wrong
700
- shape for a known route is a compile error, while any other path takes a loose `search`.
701
- Re-run it after adding a route or changing a `searchSchema`; a stale shape is a
702
- `tsc` error. The plain string-path and history-delta forms
703
- (`navigate("/about")`, `navigate(-1)`) are unchanged.
695
+ To WRITE search, build the link with `href` and hand it to `useNavigate`:
696
+ `navigate(href({ to: "/reports", search: { page: 2 } }))`. `href` and
697
+ `rawHref` are exported by every adapter's router entry (
698
+ `@nifrajs/web-<framework>/router`). `nifra dev`,
699
+ `nifra build`, `nifra check` and `nifra types` write
700
+ `.nifra/types/routes.d.ts`, which maps every route pattern to its params and its
701
+ schema output, and each route's generated `./+types` module loads it. So
702
+ `to` is one of those patterns, `params` holds that route's params, and
703
+ `search` is typed against its schema: a misspelt route, a missing param and a wrong
704
+ search shape are compile errors, and a changed `searchSchema` shows up as a
705
+ `tsc` error at the stale call. A route without a `searchSchema` takes any
706
+ `search`.
707
+
708
+ Each param is encoded as one path segment, so a value such as `a/b` or
709
+ `//evil.com` stays inside the segment and never changes where the link goes. A
710
+ param that is missing, empty, `.`, `..` or an unpaired surrogate throws a
711
+ `TypeError` naming it. `navigate` takes only an `href` result,
712
+ or a history delta such as `navigate(-1)`; a string or a template literal is a
713
+ compile error. So do React's `Link`, `NavLink` and `Navigate`
714
+ (`<Link to={href({ to: "/pricing" })}>`) and the server's
715
+ `redirect()`; when `to` is not a same-origin path,
716
+ `Link` and `NavLink` render the anchor without an `href`,
717
+ and `Navigate` and `setSearchParams` do not navigate; each logs a
718
+ `console.error` that names the call and never the value. `redirect`
719
+ takes an off-origin location with `{ external: true }`, which still refuses
720
+ one holding a line break. For a same-origin path built elsewhere - a CMS link,
721
+ `/llms.txt` - `rawHref("/llms.txt")` checks it (one leading
722
+ `/`, no backslash or control character) and returns the same type. A link to
723
+ another site is a plain `<a href>`. A path that comes from outside is
724
+ checked where it is read: `rawHref` throws a `TypeError` for one that is
725
+ not same-origin, so catch it at that call when a field cannot be trusted. A value that gets
726
+ past it as a forged `Href` costs only its own link.
727
+
728
+ ### Moving existing links to href()
729
+
730
+ A link written as a string is not checked: `navigate("/pricng")` and
731
+ `<a href="/pricng">` compile and then 404. Moving one is mechanical.
732
+
733
+ ```tsx
734
+ // doc-check: skip - routes of your own app; one line per call, before and after.
735
+ import { href, rawHref } from "@nifrajs/web-react/router"
736
+
737
+ navigate(`/users/${id}?tab=posts`)
738
+ navigate(href({ to: "/users/:id", params: { id }, search: { tab: "posts" } }))
739
+
740
+ <a href="/pricing">Pricing</a>
741
+ <a href={href({ to: "/pricing" })}>Pricing</a>
742
+
743
+ <Link to="/docs#install">Install</Link>
744
+ <Link to={href({ to: "/docs", hash: "install" })}>Install</Link>
745
+
746
+ throw redirect("/login")
747
+ throw redirect(href({ to: "/login" }))
748
+
749
+ navigate(cmsLink) // a same-origin path built elsewhere
750
+ navigate(rawHref(cmsLink))
751
+ ```
752
+
753
+ A leftover `navigate("/x")`, `<Link to="/x">` or
754
+ `redirect("/x")` is a compile error at the call, so `tsc` lists what is
755
+ left. A plain `<a href="/x">` is not an error, so search for
756
+ `href="/` and `href={`/` too; a link that opens another site stays
757
+ an `<a href>`. This site, the examples and the starters are held to it by a
758
+ test that fails on a literal internal anchor.
759
+
760
+ `nifra check` finds the plain anchors in your app too, and reads the route table to
761
+ tell two cases apart. `NF-C057` (a warning) is a path that no page, no backend route
762
+ and no file in `public/` serves: the link is a 404, and the message names the
763
+ nearest page when it is a typo away. `NF-C058` (info) is a path that is a page
764
+ today; the message gives the `href()` call that replaces it. A template literal such
765
+ as ``/users/${id}`` is judged by its shape and never reported as dead, since the
766
+ route it builds may live outside the file routes. Links in `.tsx`, `.vue`
767
+ and `.svelte` files are read. Raise, lower or silence either code with
768
+ `rules` in `nifra.config`, or keep one link as written with
769
+ `rawHref()` or `// nifra-expect NF-C058: <reason>` above the
770
+ attribute (`<!-- nifra-expect NF-C058: <reason> -->` above the anchor in a
771
+ `.vue` or `.svelte` template). A backend mounted under
772
+ `apiPrefix` counts as serving its paths, read from `backend/framework.ts`
773
+ or `nifra.config.ts`; when either holds a value `check` cannot read, no
774
+ link is reported dead. `.jsx` files and an `href` built by a function are
775
+ not read.
776
+
777
+ The table is a generated file, `.nifra/types/routes.d.ts`. A program in which no route
778
+ imports a `./+types/...` module does not load it, and `to` then accepts no
779
+ route at all, and `nifra check` warns. List `.nifra/types/routes.d.ts` under
780
+ the tsconfig `files`: the `**` globs skip a dot directory, and a
781
+ `files` entry is not filtered by `exclude`.
704
782
 
705
783
  ### Prefetching
706
784
 
@@ -730,7 +808,7 @@ around it (the nearest one wins), says when:
730
808
  </nav>
731
809
 
732
810
  // React's <Link> takes it as a prop.
733
- <Link to="/pricing" prefetch="render">Pricing</Link>
811
+ <Link to={href({ to: "/pricing" })} prefetch="render">Pricing</Link>
734
812
  ```
735
813
 
736
814
  Warmed data is used by a click within 30 seconds; after that the click loads the route
@@ -840,9 +918,10 @@ type it with that route's `LoaderData`. `routes/photos/[id].tsx`
840
918
  stays an ordinary page.
841
919
 
842
920
  -
843
- Back closes the modal and forward reopens it. A link inside the modal to another matching
844
- URL replaces its content, and back steps through each one. Navigating anywhere else closes
845
- it.
921
+ Back closes the modal and forward reopens it. Closing shows the page underneath as it was,
922
+ with its loader data and boundaries, without fetching it again; a page loaded for a
923
+ previous visitor loads again. A link inside the modal to another matching URL replaces its
924
+ content, and back steps through each one. Navigating anywhere else closes it.
846
925
 
847
926
  -
848
927
  A reload, a shared link, or a navigation from a page outside the declaring layout or page
@@ -957,7 +1036,7 @@ arktype, …); outputs are inferred end-to-end.
957
1036
 
958
1037
  Everything on this page is just `@nifrajs/core` - no frontend, no build step. Use Nifra
959
1038
  as a standalone backend the way you'd use Hono or Elysia, deploy it to any runtime, and reach
960
- for [the frontend adapters](/docs/frameworks) only if and when you go full-stack.
1039
+ for the frontend adapters only if and when you go full-stack.
961
1040
 
962
1041
  ### An inline server
963
1042
 
@@ -1592,9 +1671,9 @@ client sends nothing rather than reach a route the call does not name.
1592
1671
  `.ws()` throws.
1593
1672
 
1594
1673
  The same client runs in the browser and on the server. During SSR, a route's
1595
- [loader](/docs/data) calls it **in-process** (no network hop) via
1596
- `ctx.api`. Next: [file routing](/docs/routing),
1597
- [loaders & actions](/docs/data), and [plugins](/docs/plugins).
1674
+ loader calls it **in-process** (no network hop) via
1675
+ `ctx.api`. Next: file routing,
1676
+ loaders & actions, and plugins.
1598
1677
 
1599
1678
  ## Nifra - Loaders & actions
1600
1679
 
@@ -1615,9 +1694,9 @@ leaves the server. Declare a timestamp as `t.date()` and the page gets a
1615
1694
  field that is any JSON value, passed through whole - a tool-call payload or a settings blob
1616
1695
  the page does not pick apart. A loader without a schema is flagged by
1617
1696
  `nifra check`. See
1618
- [Project structure](/docs/structure) for the route pair. A loader that names the
1697
+ Project structure for the route pair. A loader that names the
1619
1698
  data it read with `live(...keys)` reloads on its own when that data changes - see
1620
- [Live refresh](/docs/live).
1699
+ Live refresh.
1621
1700
 
1622
1701
  ```ts
1623
1702
  // routes/users/[id].backend.ts - a loader runs on the server: in-process during SSR (no network
@@ -1689,7 +1768,7 @@ loader **revalidates** (no full reload); with JS disabled the native form POST r
1689
1768
  `actionData`, bounded by `actionOutput`.
1690
1769
 
1691
1770
  A reload of the page on screen (an action's revalidation, `invalidate()`, a
1692
- [live refresh](/docs/live), a fetcher loading its path again) keeps every part of `data` and the
1771
+ live refresh, a fetcher loading its path again) keeps every part of `data` and the
1693
1772
  layouts' data that it did not change as the same object, with one bound: an array none of
1694
1773
  whose first 32 elements is unchanged is replaced whole, so a reload that changed every row
1695
1774
  stops comparing early. A row kept this way keeps its DOM and component state: a Solid
@@ -1752,7 +1831,7 @@ in middleware. In development, nifra warns the first time a layout loader withou
1752
1831
  `gate` refuses a request with a redirect, a `Response`, or a 401 or 403,
1753
1832
  and `nifra check` reports one whose loader refuses in its own body (NF-C042). A
1754
1833
  `_layout.backend.ts` that exports `middleware` guards a directory, with
1755
- or without a layout component - see [Route middleware](/docs/routing#middleware).
1834
+ or without a layout component - see Route middleware.
1756
1835
 
1757
1836
  A layout's `shouldRevalidate` overrides that default. It runs on the server and
1758
1837
  receives `defaultShouldRevalidate` with the URL and params being left and the ones
@@ -1815,8 +1894,8 @@ export async function loader() {
1815
1894
  ```
1816
1895
 
1817
1896
  For optimistic UI, concurrent fetchers, and a keyed query cache, the same primitives compose
1818
- on all five adapters: see [fetchers](/docs/mutations) and
1819
- [the query cache](/docs/query).
1897
+ on all five adapters: see fetchers and
1898
+ the query cache.
1820
1899
 
1821
1900
  ## Nifra - Server functions
1822
1901
 
@@ -1896,9 +1975,10 @@ The namespace becomes a URL segment, so it is constrained to lowercase dot/dash
1896
1975
  branded export mounts at `/_nifra/fn/<namespace>/<exportName>`; anything
1897
1976
  in the module that is not a server function is ignored rather than mounted.
1898
1977
 
1899
- One thing worth knowing: the namespace you pass here and the `*.fn.ts` filename are
1900
- not statically checked against each other. If they disagree the call 404s, and the generated
1901
- stub names the mismatch - but the compiler will not catch it for you. The build fails on a
1978
+ One thing worth knowing: the namespace you pass here and the `*.fn.ts` filename must
1979
+ agree, or the call 404s. The compiler does not compare them, but `nifra check`
1980
+ reports a mismatch as NF-C056 when the module is imported with
1981
+ `import * as todos from "./todos.fn"` and mounted in the same file. The build fails on a
1902
1982
  filename that is not a valid namespace (`todoItems.fn.ts`; use
1903
1983
  `todo-items.fn.ts`). Two files with one basename (`admin/todos.fn.ts`
1904
1984
  and `user/todos.fn.ts`) share the namespace: both mount, and an export name they
@@ -1996,8 +2076,8 @@ nifra assure
1996
2076
  ✖ POST /_nifra/fn/todos/addTodo (authenticated-write) is missing nifra.authenticated
1997
2077
  ```
1998
2078
 
1999
- See [effect provenance](/docs/capabilities) for what the declaration is checked
2000
- against, and [the verification ladder](/docs/verification) for where this sits.
2079
+ See effect provenance for what the declaration is checked
2080
+ against, and the verification ladder for where this sits.
2001
2081
 
2002
2082
  ### Cost
2003
2083
 
@@ -2067,6 +2147,11 @@ function Row({ id }: { id: string }) {
2067
2147
  const anyPending = useFetchers().some((f) => f.snapshot().pending)
2068
2148
  ```
2069
2149
 
2150
+ A fetcher holds nothing for the next visitor: `identityChanged()` returns every
2151
+ fetcher to idle, and a load still in flight loads once more for the new visitor. In an app with a keepAlive route, so
2152
+ does the identity epoch cookie a sign-in or sign-out response rotates, on the next
2153
+ `useFetcher` read.
2154
+
2070
2155
  ## Nifra - Rendering: SSR, streaming, SSG & ISR
2071
2156
 
2072
2157
  > Render critical HTML first, stream deferred data progressively, prerender static routes, and cache rendered pages with stale-while-revalidate - on every runtime including the edge.
@@ -2127,7 +2212,7 @@ export default function Product({ data }: Route.ComponentProps) {
2127
2212
  This is request-time progressive SSR: the whole page, shell included, renders for each
2128
2213
  request, and deferred values remain request-scoped. To serve the part that is the same for
2129
2214
  every visitor from a cache and stream only the per-visitor parts, use
2130
- [partial prerendering](/docs/partial-prerendering) (experimental).
2215
+ partial prerendering.
2131
2216
 
2132
2217
  ### SSG - prerender at build
2133
2218
 
@@ -2337,7 +2422,7 @@ and is reported once to `onInvalidationError`.
2337
2422
  A per-request CSP nonce makes a page uncacheable. For a strict policy under ISR, give
2338
2423
  `createWebApp` a `csp` from `createCspPolicy` instead of a
2339
2424
  `nonce`: constant scripts are allowed by hash, so only a page that needs a nonce
2340
- carries one - see [A strict CSP that still caches](/docs/contract#strict-csp).
2425
+ carries one - see A strict CSP that still caches.
2341
2426
 
2342
2427
  A page that must not be cached as a whole, because it is personalized or carries a nonce, can
2343
2428
  still cache the data its loader reads. Wrap the expensive call in `cache.wrap` from
@@ -2440,14 +2525,14 @@ cache. Pass the same `draftSecret` to `createWebApp` and
2440
2525
  `withISR`; a forged or tampered cookie fails the constant-time signature check.
2441
2526
 
2442
2527
  ```ts
2443
- // doc-check: skip - fragment spanning three files: your `app`, `env`, `redirect`, and route `slug`.
2528
+ // doc-check: skip - fragment spanning three files: your `app`, `env`, and route `slug`.
2444
2529
  // 1. Mount the preview entry point your CMS links to. It checks the token in CONSTANT TIME,
2445
2530
  // sets the signed HttpOnly cookie, and refuses an off-site ?to= (an open redirect otherwise).
2446
- import { previewEndpoint, disableDraft } from "@nifrajs/web"
2531
+ import { previewEndpoint, disableDraft, redirect, rawHref } from "@nifrajs/web"
2447
2532
 
2448
2533
  const preview = previewEndpoint({ secret: env.PREVIEW_TOKEN, draftSecret: env.DRAFT_SECRET })
2449
2534
  app.get("/api/preview", (c) => preview(c.req)) // ?token=…&to=/posts/hello
2450
- app.get("/api/preview/exit", (c) => (disableDraft(c), redirect("/")))
2535
+ app.get("/api/preview/exit", (c) => (disableDraft(c), redirect(rawHref("/"))))
2451
2536
  // Gating it yourself instead? Use enableDraft(c, env.DRAFT_SECRET) AFTER your own check - and
2452
2537
  // compare the token in constant time, since === leaks it one character at a time.
2453
2538
 
@@ -2529,9 +2614,8 @@ a metric instead of its final value - aggregate those with `delta` or
2529
2614
  Content that's the same for everyone and changes rarely → **SSG**. Content that changes
2530
2615
  occasionally and can tolerate seconds-to-minutes of staleness → **ISR**. Per-request or
2531
2616
  per-user content → plain **SSR** (the default). A page that is mostly shared with a few
2532
- per-visitor parts → [partial prerendering](/docs/partial-prerendering)
2533
- (experimental). You can mix them in one app, route by route. A page that must update while it
2534
- is open, without a reload, adds [live refresh](/docs/live) to any of them.
2617
+ per-visitor parts → partial prerendering. You can mix them in one app, route by route. A page that must update while it
2618
+ is open, without a reload, adds live refresh to any of them.
2535
2619
 
2536
2620
  ## Nifra - Hydration & pre-hydration forms
2537
2621
 
@@ -3035,10 +3119,10 @@ export default function Page({ data }: Route.ComponentProps) {
3035
3119
  The same `defer()` works in actions and across client-side soft navigations (an
3036
3120
  NDJSON stream settles the deferred values), and it's framework-agnostic - React
3037
3121
  `<Suspense>` and Solid's streaming both drive it from one core. See
3038
- [Frameworks](/docs/frameworks) for which adapters stream the boundary in the
3122
+ Frameworks for which adapters stream the boundary in the
3039
3123
  server HTML.
3040
3124
 
3041
- [Partial prerendering](/docs/partial-prerendering) (experimental) streams the same
3125
+ Partial prerendering streams the same
3042
3126
  way from a cached shell: the part of the page every visitor shares goes out at once from the
3043
3127
  cache, and each per-visitor hole streams in as its loader settles.
3044
3128
 
@@ -3130,7 +3214,7 @@ feed.close()
3130
3214
 
3131
3215
  ## Nifra - Query cache
3132
3216
 
3133
- > Nifra's keyed query cache: useQuery / createQuery, dedup, staleness, invalidation.
3217
+ > Nifra's cross-framework keyed query cache: reactive queries, mutations, infinite lists, and SSR hydration.
3134
3218
 
3135
3219
  For client-side data that isn't a route loader - lists, widgets, anything refetchable -
3136
3220
  Nifra ships a keyed query cache (TanStack-Query-style), agnostic across all five adapters.
@@ -3141,8 +3225,9 @@ Nifra ships a keyed query cache (TanStack-Query-style), agnostic across all five
3141
3225
  `createQuery(key, fn)` (Solid), each from the adapter's `/query`
3142
3226
  entry, subscribe a component to a cached, keyed query. Concurrent reads of the same key
3143
3227
  **dedup** into one in-flight fetch; results are cached with a `staleTime` (the
3144
- third argument's option), a background refetch, and bounded GC. React also has
3145
- `useMutation`, `useInfiniteQuery` and `HydrationBoundary`.
3228
+ third argument's option), a background refetch, and bounded GC. The query cache also has
3229
+ mutation and infinite-query bindings across the adapters, using each framework's reactive
3230
+ model.
3146
3231
 
3147
3232
  ```ts
3148
3233
  import { useQuery, useQueryClient } from "@nifrajs/web-react/query"
@@ -3164,16 +3249,102 @@ function CreateUser() {
3164
3249
  }
3165
3250
  ```
3166
3251
 
3252
+ ### Mutations and infinite queries
3253
+
3254
+ React and Preact expose `useMutation` and `useInfiniteQuery`. Vue
3255
+ exposes composables whose reactive state is read from refs. Svelte returns readable stores,
3256
+ and Solid exposes `createMutation` and `createInfiniteQuery` accessors.
3257
+ Each mutation has `mutate`, `mutateAsync`, `reset`, and
3258
+ `cancel`; each paged query exposes next/previous-page controls and page-availability
3259
+ state. Mutations remain client state bindings: the server action or endpoint still enforces
3260
+ authorization. Mutation functions receive a shared context with a `signal` as
3261
+ their second argument. `onMutate` receives that context second;
3262
+ `onSuccess` and `onError` receive it third; and `onSettled`
3263
+ receives it fourth. Pass `context.signal` to `fetch` and check it before
3264
+ side effects after an `await`. `cancel` aborts that signal, rejects the local promise, and
3265
+ discards local results; the request or server action only stops if it honors the signal, and accepted server work may
3266
+ finish.
3267
+
3268
+ ```ts
3269
+ // React / Preact: hooks with a promise-returning mutation.
3270
+ // The mutation function receives a context with a shared AbortSignal as its second argument.
3271
+ const saveProfile = async (profile, { signal }) => {
3272
+ const response = await fetch("/api/profile", {
3273
+ method: "PUT",
3274
+ headers: { "content-type": "application/json" },
3275
+ body: JSON.stringify(profile),
3276
+ signal,
3277
+ })
3278
+ if (!response.ok) throw new Error("Profile save failed")
3279
+ return response
3280
+ }
3281
+ const save = useMutation(saveProfile)
3282
+ await save.mutateAsync(profile)
3283
+
3284
+ // Vue: state is a ref; read it with .value.
3285
+ const save = useMutation(saveProfile)
3286
+ await save.mutateAsync(profile)
3287
+ save.state.value.status
3288
+
3289
+ // Svelte: mutation and infinite-query bindings are readable stores.
3290
+ const save = useMutation(saveProfile)
3291
+ await save.mutateAsync(profile)
3292
+ // In markup, read $save.status.
3293
+
3294
+ // Solid: state is exposed through accessors.
3295
+ const save = createMutation(saveProfile)
3296
+ await save.mutateAsync(profile)
3297
+ save.state().status
3298
+ ```
3299
+
3300
+ ### SSR cache hydration
3301
+
3302
+ Query-cache hydration is separate from hydrating server-rendered markup. Create a fresh query
3303
+ client for each server request, prefetch the data, and pass its dehydrated state through Nifra
3304
+ route data. React and Preact use `QueryClientProvider` with
3305
+ `HydrationBoundary`; Solid accepts the state on `QueryClientProvider`;
3306
+ Vue and Svelte call `provideQueryClient(client, state)` in the app root before child
3307
+ queries initialize. The browser may keep one client for the app. Query state is cleared on
3308
+ identity changes, and in-flight mutation results are discarded at that boundary.
3309
+
3310
+ Every value included by `dehydrate` is serialized to the browser and is visible to
3311
+ that visitor, so `dehydrate` sends nothing by default. Pass
3312
+ `shouldDehydrateQuery` to name the regular and infinite queries that are safe to
3313
+ send; pass `() => true` only when every successful query in that client is
3314
+ meant for the browser. Never include tokens or server-only fields.
3315
+
3316
+ ```ts
3317
+ // Create one QueryClient for this server request.
3318
+ const queryClient = createQueryClient({ now: () => Date.now() })
3319
+ await queryClient.prefetchQuery(["profile", user.id], loadProfile)
3320
+ const queryState = queryClient.dehydrate({
3321
+ // Nothing is sent unless this returns true: name what is safe for the visitor to read.
3322
+ shouldDehydrateQuery: ({ key }) => Array.isArray(key) && key[0] === "profile",
3323
+ })
3324
+
3325
+ // Return queryState through the route's normal loader-data serializer.
3326
+ // On the client, seed the app's client before query components mount.
3327
+ ```
3328
+
3167
3329
  ### Invalidation
3168
3330
 
3169
3331
  After a mutation, `useQueryClient().invalidateQueries(key)` marks matching entries
3170
3332
  stale (by exact key or array **prefix**) and refetches the mounted ones - no manual cache
3171
3333
  surgery.
3172
3334
 
3173
- In an app with [live refresh](/docs/live), a query can name the live keys its data
3335
+ In an app with live refresh, a query can name the live keys its data
3174
3336
  depends on: `useQuery(key, fn, { live: [`post:${id}`] })` refetches whenever
3175
3337
  the server publishes one of them.
3176
3338
 
3339
+ ### Sign-in and sign-out
3340
+
3341
+ A cached query never answers for the next visitor. `identityChanged()` from
3342
+ `@nifrajs/web/client` clears every query client in the page: mounted queries go
3343
+ back to pending and refetch, the rest drop their data. A fetch still loading loads once more
3344
+ for the new visitor before it settles. In an app with a
3345
+ keepAlive route, the identity epoch cookie a sign-in
3346
+ or sign-out response rotates does the same on the client's next read.
3347
+
3177
3348
  It's the same agnostic core under every adapter: the cache, dedup, and invalidation logic
3178
3349
  live in `@nifrajs/web`; each binding is a thin wrapper in its framework's own
3179
3350
  reactivity (`useSyncExternalStore`, a signal, a `shallowRef`, a store).
@@ -3238,7 +3409,7 @@ Everything that lives in `@nifrajs/web` rather than the view layer works unchang
3238
3409
  loaders, actions, ISR, SSG, head management, streaming. What you give up is hydration - these
3239
3410
  are server-rendered documents, so set `export const hydrate = false` in the route's
3240
3411
  `.backend.ts` half and reach for
3241
- [islands](/docs/hydration) where a page needs interactivity.
3412
+ islands where a page needs interactivity.
3242
3413
 
3243
3414
  Worth it for the surfaces where HTML is the product: landing pages, listings, docs, comparison
3244
3415
  tables. This documentation site renders that way.
@@ -3281,7 +3452,7 @@ export async function loader({ api }: Route.LoaderArgs) {
3281
3452
 
3282
3453
  Component `<style scoped>` (Vue) and `<style>` (Svelte -
3283
3454
  scoped by default) are compiled and scoped into the app stylesheet - no runtime, no FOUC - plus
3284
- CSS Modules and global imports. See [Dev & HMR → Styling](/docs/dev).
3455
+ CSS Modules and global imports. See Dev & HMR → Styling.
3285
3456
  `examples/routing-vue-sfc` is a full SSR + hydration + client-nav demo.
3286
3457
 
3287
3458
  ### Same features, every framework
@@ -3301,13 +3472,13 @@ progressive-enhancement forms (work with JS off).
3301
3472
  - Optimistic UI, targeted revalidation, hover-prefetch, and scroll restoration.
3302
3473
 
3303
3474
  -
3304
- [Live refresh](/docs/live), [keep-alive](/docs/keep-alive) pages,
3305
- [server components](/docs/server-components), and
3306
- [partial prerendering](/docs/partial-prerendering) (experimental).
3475
+ Live refresh, keep-alive pages,
3476
+ server components, and
3477
+ partial prerendering.
3307
3478
 
3308
3479
  -
3309
3480
  True HMR in dev for all five (`@nifrajs/web/vite`) - see
3310
- [Dev & HMR](/docs/dev).
3481
+ Dev & HMR.
3311
3482
 
3312
3483
  ### One line changes
3313
3484
 
@@ -3371,7 +3542,7 @@ the client, with a warning in development.
3371
3542
  Dev HMR works for all five adapters through `createViteDevServer` and the
3372
3543
  framework's Vite plugin. React, Preact, and Vue preserve edited component state. Solid
3373
3544
  and Svelte update live without a full page reload, and the edited component may remount. Full
3374
- matrix in [Dev & HMR](/docs/dev).
3545
+ matrix in Dev & HMR.
3375
3546
 
3376
3547
  ### React Compiler
3377
3548
 
@@ -3571,6 +3742,51 @@ sent. When none answers, the error is logged and the client gets the default
3571
3742
  `500`. A thrown `Response` or `status()` value is sent as
3572
3743
  if returned.
3573
3744
 
3745
+ #### State that follows the request
3746
+
3747
+ A value tied to one request - a verified client IP, a request id, an auth decision - is often
3748
+ kept in a `WeakMap<Request, T>`, which loses it at the first copy of the
3749
+ request. nifra copies requests itself: a `mount()` that strips its prefix, a
3750
+ WebSocket pass reused for HTTP, a target it resolves, and the transport and idempotency
3751
+ lanes, as do `methodOverride()`, a rewriting `trimTrailingSlash()` or
3752
+ `appendTrailingSlash()`, and a live load. `requestLocal<T>()` from
3753
+ `@nifrajs/core/server` is a slot with `get`, `set`,
3754
+ `has` and `delete` whose value every one of those copies shares: a
3755
+ value set before a mount is read in the child, and one the child sets is read through the
3756
+ parent's request. Where your own code rebuilds a request - a wrapper in front of the app,
3757
+ an `onRequest` hook returning a new one - call
3758
+ `carryRequestLocals(from, to)` right after `new Request(url, req)`; a
3759
+ copy made without it starts empty. Values are held weakly and never cross requests. Make
3760
+ slots at startup, as below: copies are linked only once a first slot exists, so a request
3761
+ copied before then starts empty.
3762
+
3763
+ ```ts
3764
+ import { carryRequestLocals, requestLocal, server } from "@nifrajs/core/server"
3765
+
3766
+ // One slot per value. A WeakMap<Request, T> would lose it at the first copy of the request.
3767
+ const requestId = requestLocal<string>()
3768
+
3769
+ const billing = server().get("/invoices", (c) => ({ requestId: requestId.get(c.req) }))
3770
+
3771
+ export const app = server()
3772
+ .onRequest((req) => {
3773
+ requestId.set(req, req.headers.get("x-request-id") ?? crypto.randomUUID())
3774
+ })
3775
+ // The child sees a copy of the request with /billing stripped, and reads the same value.
3776
+ .mount({ path: "/billing", app: billing, stripPrefix: true })
3777
+
3778
+ // A wrapper that rebuilds the request carries the values itself. It keeps the host, which the
3779
+ // same-origin check on a form POST compares with the browser's Origin.
3780
+ export const fetch = (req: Request): Response | Promise<Response> => {
3781
+ const url = new URL(req.url)
3782
+ if (!url.pathname.startsWith("/v1/")) return app.fetch(req)
3783
+ url.pathname = url.pathname.slice("/v1".length)
3784
+ const rebuilt = new Request(url.href, req)
3785
+ carryRequestLocals(req, rebuilt)
3786
+ return app.fetch(rebuilt)
3787
+ }
3788
+ ```
3789
+
3574
3790
  #### Which hooks run where
3575
3791
 
3576
3792
  Where a hook is registered decides which requests it sees. `nifra routes --hooks`
@@ -3752,7 +3968,7 @@ plugin, the principal is read from the **returned instance** - `auth.principal(r
3752
3968
  (nullable) or `auth.requirePrincipal(req)` (throws `401`) - mirroring
3753
3969
  `@nifrajs/auth` and `@nifrajs/better-auth`. It's verified once per request and
3754
3970
  cached. For full session-based auth (OAuth, magic links, 2FA), see
3755
- [Auth & sessions](/docs/auth).
3971
+ Auth & sessions.
3756
3972
 
3757
3973
  ```ts
3758
3974
  // doc-check: skip - fragment: `app`, `lookupUser`, and the `db` lookup are your application's.
@@ -3855,7 +4071,7 @@ app
3855
4071
  `idempotency()` makes a retried unsafe request (same `Idempotency-Key` header)
3856
4072
  replay the first response instead of re-running the side effect - no double-charge on a dropped
3857
4073
  connection. It short-circuits before the handler; a concurrent retry gets a `409`. See
3858
- [Security & hardening](/docs/security) for the store contract, the production
4074
+ Security & hardening for the store contract, the production
3859
4075
  guidance (shared store + DB constraint), and the `Set-Cookie` rule.
3860
4076
 
3861
4077
  ```ts
@@ -4002,6 +4218,44 @@ const app = server().use(
4002
4218
  )
4003
4219
  ```
4004
4220
 
4221
+ A tier's `prefix` can be a list: every prefix in it charges the tier's one bucket,
4222
+ so traffic of one kind spread over several paths shares one allowance. Selection is still the
4223
+ longest prefix across every tier, so a longer prefix that belongs to another tier charges only
4224
+ that tier. A prefix listed in two tiers is refused when the limiter is built. A tier counts
4225
+ under `tier:<name>:`, and `name` defaults to the first prefix; name
4226
+ a tier whose list may change, so editing the list neither resets nor splits its counters. Two
4227
+ tiers with one name are refused too. Both limiters have `keyOf(request, platform?)`,
4228
+ which resolves to the exact store key a request would be charged to, running an async key and
4229
+ its client-IP fallback as a request would, or `undefined` when the request would not
4230
+ be charged. It counts nothing, so a test can pre-spend or reset a bucket without copying the key
4231
+ format.
4232
+
4233
+ ```ts
4234
+ import { server } from "@nifrajs/core/server"
4235
+ import { MemoryStore, rateLimitTiers } from "@nifrajs/middleware"
4236
+
4237
+ const store = new MemoryStore()
4238
+ const limiter = rateLimitTiers({
4239
+ store,
4240
+ floor: { max: 120, windowMs: 60_000 },
4241
+ tiers: [
4242
+ // One 30/min allowance across all three, not 30 each. The name is the bucket's
4243
+ // store scope, so adding or removing a prefix later keeps the live counters.
4244
+ {
4245
+ name: "exports",
4246
+ prefix: ["/api/exports", "/api/reports/download", "/api/invoices/pdf"],
4247
+ max: 30,
4248
+ windowMs: 60_000,
4249
+ },
4250
+ ],
4251
+ })
4252
+ const app = server().use(limiter)
4253
+
4254
+ // The store key a request is charged to, for a test or an ops tool: "tier:exports:<ip>".
4255
+ const key = await limiter.keyOf(new Request("http://x/api/exports/csv"), { clientIp: "203.0.113.9" })
4256
+ if (key !== undefined) await store.hit(key, 60_000) // pre-spend one hit
4257
+ ```
4258
+
4005
4259
  ### A shared store in production
4006
4260
 
4007
4261
  `MemoryStore` counts per instance, so it refuses to start under
@@ -4068,7 +4322,7 @@ touches one key, so it runs on whichever node owns it.
4068
4322
  The security set - `csrf` (signed double-submit + Origin/Referer), `jwt`,
4069
4323
  `ipRestriction` (IPv4/IPv6 + CIDR, fails closed), and `bodyLimit`
4070
4324
  (Content-Length cap before routing) - is documented with hardening guidance on
4071
- [Security & hardening](/docs/security). All comparisons are constant-time and all
4325
+ Security & hardening. All comparisons are constant-time and all
4072
4326
  defaults fail closed.
4073
4327
 
4074
4328
  ### Error reporting
@@ -4095,7 +4349,7 @@ The pieces every production endpoint needs - a body-size cap for raw routes, rea
4095
4349
  validation, constant-time webhook verification, and idempotent retries - ship as first-party
4096
4350
  primitives. All are **edge-safe** (WebCrypto, no `node:crypto`) and run unchanged
4097
4351
  on Bun, Node, Deno, and Workers. For how these defaults stack up against Hono, Fastify,
4098
- Express, and Elysia, see [security posture, compared](/docs/security-comparison).
4352
+ Express, and Elysia, see security posture, compared.
4099
4353
 
4100
4354
  ### Responses that cannot leak more than they declare
4101
4355
 
@@ -4190,7 +4444,7 @@ export const app = server().use(
4190
4444
 
4191
4445
  A `merge()`d server's routes are covered by a contract the parent installed
4192
4446
  before the merge, as long as the route declares a response and its own server installed none.
4193
- See [what a parent's use() covers](/docs/plugins#parent-use).
4447
+ See what a parent's use() covers.
4194
4448
 
4195
4449
  The check itself is essentially free: with a compiled validator it measures in the
4196
4450
  ~100ns-per-response range, and a realistic middleware-carrying route benchmarks within noise
@@ -4543,7 +4797,7 @@ covering common image / A-V / archive types.
4543
4797
  `signDownloadUrl` / `verifyDownloadUrl` mint short-TTL, tamper-evident
4544
4798
  download links (HMAC-SHA256 over the path + expiry, constant-time verify). And
4545
4799
  `stripImageMetadata` drops EXIF/GPS by re-encoding the image - through any
4546
- [@nifrajs/image](/docs/images) backend, with no dependency on it:
4800
+ @nifrajs/image backend, with no dependency on it:
4547
4801
 
4548
4802
  ```ts
4549
4803
  // doc-check: skip - fragment: continues the upload handler above (`result.bytes`).
@@ -4752,7 +5006,7 @@ nonce. For a strict `script-src` on web pages, give `createWebApp` a
4752
5006
  `csp` from `createCspPolicy`: it allows the framework's constant
4753
5007
  scripts by hash and adds a nonce only to a page that needs one, so every other page sends the
4754
5008
  same header and stays cacheable under `withISR` or a CDN. See
4755
- [A strict CSP that still caches](/docs/contract#strict-csp).
5009
+ A strict CSP that still caches.
4756
5010
 
4757
5011
  ### Route assurance - prove every route is guarded
4758
5012
 
@@ -4916,9 +5170,9 @@ rejected), SSR serialization that escapes every inline-script value,
4916
5170
  `__Host-`/`__Secure-` cookie-prefix enforcement (a cookie whose
4917
5171
  attributes violate its prefix contract fails at serialization rather than being silently
4918
5172
  dropped by the browser), signed-cookie sessions + CSRF + route guards
4919
- ([@nifrajs/auth](/docs/auth)), bearer/apiKey auth + a shared-store rate
4920
- limiter ([@nifrajs/middleware](/docs/plugins)), and a hardened image-resize endpoint
4921
- ([@nifrajs/image/server](/docs/images)).
5173
+ (@nifrajs/auth), bearer/apiKey auth + a shared-store rate
5174
+ limiter (@nifrajs/middleware), and a hardened image-resize endpoint
5175
+ (@nifrajs/image/server).
4922
5176
 
4923
5177
  ### Redacting logs
4924
5178
 
@@ -5262,8 +5516,8 @@ $ nifra levels
5262
5516
  ✓ L2 capability lockfile
5263
5517
  ```
5264
5518
 
5265
- That is L2 on [the verification ladder](/docs/verification). See also
5266
- [server functions](/docs/server-functions), which are public POST endpoints and are
5519
+ That is L2 on the verification ladder. See also
5520
+ server functions, which are public POST endpoints and are
5267
5521
  covered by exactly the same policy.
5268
5522
 
5269
5523
  ### Turning it down
@@ -5375,9 +5629,10 @@ rewritten onto, or set `trustHost` when a proxy you control fixes the host. Give
5375
5629
  ### Set up a session manager
5376
5630
 
5377
5631
  `createSessions` signs the cookie (HMAC, verified constant-time) and always marks it
5378
- `HttpOnly`. In **store mode** the cookie is just an opaque id and the data lives in
5379
- a `SessionStore`; in **cookie mode** (no store) the data is signed into the cookie.
5380
- `MemorySessionStore` is prod-guarded. Production store mode needs a strongly
5632
+ `HttpOnly`. In **store mode** the cookie is an opaque id, with a tag that changes
5633
+ whenever the data that says who the visitor is does, and the data lives in a
5634
+ `SessionStore`; in **cookie mode** (no store) the data is signed into the
5635
+ cookie. `MemorySessionStore` is prod-guarded. Production store mode needs a strongly
5381
5636
  consistent shared `SessionStore`, such as a transactional adapter or Durable Object.
5382
5637
  Every instance must observe completed writes and deletes, including revocation markers.
5383
5638
 
@@ -5397,6 +5652,13 @@ session lives at most `maxAge`, whatever expiry its payload names. Upgrading fro
5397
5652
  session-shaped value the app signs with the same secret through `signValue` reads
5398
5653
  as a session.
5399
5654
 
5655
+ `identity` names the data keys that say who the visitor is: the user id, and any
5656
+ key that changes what a page may show, such as an organization or a role. The cookie's tag,
5657
+ in either mode, then changes only when one of them does, so
5658
+ keep-alive keeps the pages it holds across a commit
5659
+ that writes a cart or a preference. Unset, every key counts. A key left out that decides what
5660
+ a page shows lets the next visitor of a browser see the pages kept for the previous one.
5661
+
5400
5662
  ```ts
5401
5663
  // backend/auth.ts - one session manager, created on first use so the secret is read at request time.
5402
5664
  // Store mode keeps data server-side; cookie mode (no store) is stateless.
@@ -5406,6 +5668,7 @@ let manager: ReturnType<typeof createSessions> | undefined
5406
5668
  export const getSessions = () => (manager ??= createSessions({
5407
5669
  secret: process.env.SESSION_SECRET!, // at least 32 bytes; never reuse another signing secret
5408
5670
  store: new MemorySessionStore(), // production: a strongly consistent shared SessionStore
5671
+ // identity: ["userId", "orgId", "role"], // the keys that say who the visitor is; unset, all of them
5409
5672
  // cookie: { secure: false }, // local http dev only
5410
5673
  }))
5411
5674
  ```
@@ -5428,12 +5691,12 @@ app.post("/api/login", async (c) => {
5428
5691
  session.set("userId", String(username))
5429
5692
  sessions.regenerate(session) // rotate the id on login (fixation defense)
5430
5693
  await sessions.commit(c, session)
5431
- return redirect("/") // the Set-Cookie rides the redirect
5694
+ return redirect(rawHref("/")) // the Set-Cookie rides the redirect
5432
5695
  })
5433
5696
 
5434
5697
  app.post("/api/logout", async (c) => {
5435
5698
  await sessions.destroy(c, await sessions.get(c))
5436
- return redirect("/login")
5699
+ return redirect(rawHref("/login"))
5437
5700
  })
5438
5701
  ```
5439
5702
 
@@ -5447,7 +5710,7 @@ path), and `requireSession` passes it, so guard a signed-in page with
5447
5710
  `requireUser`. It is plain data, not
5448
5711
  a `Response`: same bytes on the wire, on the lane an ordinary return takes. To guard
5449
5712
  every page under a directory, run the same check in the `middleware` export of that
5450
- directory's `_layout.backend.ts` - see [Route middleware](/docs/routing#middleware).
5713
+ directory's `_layout.backend.ts` - see Route middleware.
5451
5714
 
5452
5715
  ```ts
5453
5716
  // routes/account.backend.ts - a protected route's loader reads the session and redirects when absent.
@@ -5578,7 +5841,7 @@ A page or a `frontend/` component that imported `backend/auth.ts` fails
5578
5841
  the build with the import chain that reached it, so a secret cannot ride into the browser
5579
5842
  bundle. A page that needs the user reads it from its loader data, which
5580
5843
  `loaderOutput` narrows to the fields it declares - see
5581
- [Project structure](/docs/structure).
5844
+ Project structure.
5582
5845
 
5583
5846
  ### CSRF
5584
5847
 
@@ -5653,9 +5916,9 @@ loader at a CDN and the runtime stays tiny. Or self-host: the optional
5653
5916
 
5654
5917
  ### The <Image> component
5655
5918
 
5656
- `width` and `height` are **required** and validated
5657
- `> 0` - they reserve layout space so the page never shifts when the image loads
5658
- (the CLS contract). It's `loading="lazy"` + `decoding="async"` by default;
5919
+ For string URLs, `width` and `height` are **required** and validated
5920
+ `> 0`. Imported metadata can supply them automatically. Dimensions reserve layout
5921
+ space so the page never shifts (the CLS contract). It's `loading="lazy"` + `decoding="async"` by default;
5659
5922
  mark the LCP image with `priority` to get `eager` +
5660
5923
  `fetchpriority="high"`. Extra DOM props (`className`, `style`,
5661
5924
  `id`, `data-*`) pass straight through to the `<img>`.
@@ -5688,6 +5951,81 @@ The responsive `srcSet` is built from `widths` (default
5688
5951
  the same URL (e.g. the identity loader), `srcSet` is omitted. The browser then picks
5689
5952
  the right candidate for the device's pixel ratio and the `sizes` you declare.
5690
5953
 
5954
+ ### Local image imports
5955
+
5956
+ Opt into `?image` imports to read PNG, JPEG, GIF and WebP dimensions at build time,
5957
+ including JPEG, PNG and WebP display orientation. The import is a browser-safe `StaticImageData`
5958
+ object; no filesystem code or codec ships to the browser. Ordinary string URLs are unchanged.
5959
+
5960
+ ```ts
5961
+ // env.d.ts — enable the typed metadata import:
5962
+ /// <reference types="@nifrajs/image/imports" />
5963
+
5964
+ // routes/index.tsx (React; also supported by Preact, Solid, Vue and Svelte)
5965
+ import { Image } from "@nifrajs/web-react/image"
5966
+ import hero from "../shared/images/hero.jpg?image"
5967
+
5968
+ export default function Page() {
5969
+ return <Image src={hero} alt="Mountain lake" priority />
5970
+ // Optional width={600} infers height from the source aspect ratio.
5971
+ }
5972
+ ```
5973
+
5974
+ ```ts
5975
+ // backend/framework.ts — add these beside your existing framework plugins:
5976
+ import { imageBunPlugin } from "@nifrajs/image/plugins"
5977
+
5978
+ const images = { root: process.cwd() }
5979
+ export const clientPlugins = [imageBunPlugin(images)]
5980
+ export const serverPlugins = [imageBunPlugin(images)]
5981
+
5982
+ // For the Vite pipeline instead (including component mode):
5983
+ // import { imageVitePlugin } from "@nifrajs/image/plugins"
5984
+ // export const vitePlugins = [imageVitePlugin(images)]
5985
+ ```
5986
+
5987
+ Keep the same image options in client and server builds. Preserve your framework's existing
5988
+ plugins when adding these. Metadata-only imports need no native dependency. Nifra emits the
5989
+ original bytes under `/assets/_images/` with content-hashed names, registers them in
5990
+ the build manifest, and serves them in development. Static builds deploy these files too;
5991
+ no image endpoint is needed. For standalone bundler use, emit the plugin's
5992
+ `nifraStaticAssets()` files yourself. A custom `publicPath` (a root-relative prefix
5993
+ or an absolute http(s) URL) must match your client build's asset prefix; a mismatch fails the build.
5994
+
5995
+ ### Build-time responsive variants
5996
+
5997
+ Supply `widths` and an explicit `ImageBackend` to generate real responsive
5998
+ files at build time. This reuses the sharp, Bun.Image or WASM backend seam; sharp is an optional
5999
+ application dependency, not a Nifra runtime dependency. Both the processor and sharp path work
6000
+ on Node without Bun. Outputs support WebP (default), JPEG and PNG; widths never upscale the source.
6001
+
6002
+ ```ts
6003
+ // doc-check: skip - install sharp and merge with your framework's existing plugins.
6004
+ import sharp from "sharp"
6005
+ import { Buffer } from "node:buffer"
6006
+ import { sharpImageBackend } from "@nifrajs/image/backends"
6007
+ import { imageBunPlugin } from "@nifrajs/image/plugins"
6008
+
6009
+ const images = {
6010
+ root: process.cwd(),
6011
+ widths: [320, 640, 1200],
6012
+ format: "webp" as const,
6013
+ quality: 80,
6014
+ backend: sharpImageBackend((bytes) => sharp(Buffer.from(bytes))),
6015
+ }
6016
+ export const clientPlugins = [imageBunPlugin(images)]
6017
+ export const serverPlugins = [imageBunPlugin(images)]
6018
+ // Vite: use imageVitePlugin(images) in vitePlugins instead.
6019
+ ```
6020
+
6021
+ The component chooses only emitted variants; per-render `widths` filters available
6022
+ candidates rather than creating files. Build-time `quality` is baked in. An explicit
6023
+ CDN loader overrides the static variant selection. Defaults cap sources at 16 MiB and 40 million
6024
+ pixels; `maxSourceBytes` and `maxSourcePixels` are configurable. At most 32
6025
+ widths, each up to 8192 pixels, are accepted. Sources must remain inside `root`,
6026
+ including symlink targets. GIF, animated PNG and animated WebP imports are metadata-only; AVIF and SVG metadata
6027
+ imports are not supported.
6028
+
5691
6029
  ### Loaders
5692
6030
 
5693
6031
  A loader is a pure `({ src, width, quality? }) => string` URL builder. Ship with
@@ -5840,7 +6178,7 @@ const url = signImageUrl("/_image", { src: "/private/a.jpg", width: 800 }, {
5840
6178
  Signatures over `(src, w, q)` are **stable** (no expiry), so an SSR-rendered
5841
6179
  `<Image>` srcset hydrates and caches identically. The secret makes a loader
5842
6180
  config **server-only** - inject it from `env` in backend code, never a page or
5843
- `frontend/` module (same discipline as a [session secret](/docs/auth)). For time-limited links to
6181
+ `frontend/` module (same discipline as a session secret). For time-limited links to
5844
6182
  private images, `signImageUrl(…, { expiresIn })` adds an `&exp=` the
5845
6183
  handler enforces.
5846
6184
 
@@ -5940,7 +6278,7 @@ permanent redirect - on full page loads, client navigations and form posts alike
5940
6278
  // routes/[lang]/_layout.backend.ts - 404 unknown and draft locales, redirect /en/... to /...
5941
6279
  import { defineLocales } from "@nifrajs/i18n"
5942
6280
  import { defineI18nRouting } from "@nifrajs/i18n/routing"
5943
- import { notFound, type RouteMiddleware, redirect } from "@nifrajs/web"
6281
+ import { notFound, type RouteMiddleware, rawHref, redirect } from "@nifrajs/web"
5944
6282
 
5945
6283
  const urls = defineI18nRouting(
5946
6284
  defineLocales({ default: "en", locales: { en: {}, hi: {}, gu: { draft: true } } }),
@@ -5950,7 +6288,7 @@ export const middleware: RouteMiddleware = (ctx) => {
5950
6288
  const { pathname, search } = new URL(ctx.request.url)
5951
6289
  const match = urls.matchSegment(ctx.params.lang, pathname + search)
5952
6290
  if (match.kind === "not-found") notFound()
5953
- if (match.kind === "redirect") return redirect(match.location, { status: 308 })
6291
+ if (match.kind === "redirect") return redirect(rawHref(match.location), { status: 308 })
5954
6292
  return undefined
5955
6293
  }
5956
6294
  ```
@@ -5988,7 +6326,7 @@ export function meta({ params, origin }: MetaArgs): Meta {
5988
6326
  ```
5989
6327
 
5990
6328
  A page that exists in some languages only is declared once, with `pageLocales`
5991
- (given the path without its locale prefix; it must be pure). Then
6329
+ (given the canonical path without its locale prefix; it must be pure). Then
5992
6330
  `matchSegment` answers not-found for the other locales, `alternates`
5993
6331
  lists only the page's own (none for a page in one locale), `localesOf(path)` names
5994
6332
  them for a prerender's static paths, and `localizePathname(path, locale, { fallback: "default" })`
@@ -5996,6 +6334,84 @@ links a menu entry to the default locale's page where the page is missing. A
5996
6334
  `pageLocales` that throws, or names a locale the registry does not declare, throws
5997
6335
  rather than serving every locale.
5998
6336
 
6337
+ #### Explicit static translated pathnames
6338
+
6339
+ Optionally declare `pathnames`: canonical unprefixed static paths mapped to
6340
+ unprefixed locale spellings. Missing entries keep the canonical spelling; they do not make a
6341
+ page unavailable (`pageLocales` still owns that). Language switches, reverse
6342
+ lookup, canonical links, `hreflang` and `matchSegment` redirects all
6343
+ use the same table. With no table, existing prefix-only behavior is unchanged.
6344
+
6345
+ ```ts
6346
+ // shared/i18n.ts - explicit STATIC pathname translations, not content or dynamic slug translation.
6347
+ import { defineLocales } from "@nifrajs/i18n"
6348
+ import { defineI18nRouting } from "@nifrajs/i18n/routing"
6349
+
6350
+ const locales = defineLocales({ default: "en", locales: { en: {}, fr: {}, de: {} } })
6351
+ export const urls = defineI18nRouting(locales, {
6352
+ pathnames: {
6353
+ "/about": { fr: "/a-propos", de: "/ueber-uns" },
6354
+ "/contact": { fr: "/contactez-nous" }, // Missing German name; availability is separate below.
6355
+ },
6356
+ // Always the canonical key, even when the incoming URL is /fr/contactez-nous.
6357
+ pageLocales: (path) => path === "/contact" ? ["en", "fr"] : undefined,
6358
+ })
6359
+
6360
+ urls.localizePathname("/about", "fr") // "/fr/a-propos"
6361
+ urls.localizePathname("/fr/a-propos", "de") // "/de/ueber-uns"
6362
+ urls.unlocalizePathname("/de/ueber-uns") // { locale: "de", pathname: "/about" }
6363
+ urls.alternates("/fr/a-propos").canonical // "/fr/a-propos"
6364
+ urls.staticPathnames() // ["/about", "/fr/a-propos", "/de/ueber-uns", "/contact", "/fr/contactez-nous"]
6365
+ ```
6366
+
6367
+ `staticPathnames()` enumerates mapped public URLs only, in mapping declaration
6368
+ order then served-locale registry order, filtered by `pageLocales`. Feed explicit
6369
+ static entries to your prerender setup after wiring incoming routing; the prerender driver
6370
+ does not automatically enumerate catch-all routes. Unmapped pages are not discovered.
6371
+ Draft locales are never included. Unicode spellings such as `/紹介` are
6372
+ emitted URL-encoded and resolve from `new URL(request.url).pathname`. Reverse
6373
+ lookup returns a URL-encoded canonical pathname; `pageLocales` sees the declared
6374
+ canonical key. Query strings and trailing slashes survive translation, hashes too;
6375
+ SEO links and redirects omit the hash as before.
6376
+
6377
+ **Mappings do not create files or filesystem aliases.** A file named
6378
+ ` about.tsx` alone will not serve `/fr/a-propos`. Supply matching
6379
+ routes yourself, or use a catch-all dispatcher that resolves
6380
+ ` unlocalizePathname` to an explicit page registry, for example:
6381
+
6382
+ ```ts
6383
+ // doc-check: skip - imports the app's own routing module and generated route types.
6384
+ // routes/[...path].backend.ts, paired with routes/[...path].tsx rendering props.data.page.
6385
+ // A root catch-all receives /about, /fr/a-propos and /de/ueber-uns; it needs at least one segment.
6386
+ import { notFound, redirect } from "@nifrajs/web"
6387
+ import { t } from "@nifrajs/schema"
6388
+ import { urls } from "../shared/i18n"
6389
+ import type { Route } from "./+types/[...path]"
6390
+
6391
+ const pages = new Map([["/about", "about"], ["/contact", "contact"]])
6392
+ export const loaderOutput = t.object({ page: t.string(), locale: t.string() })
6393
+ export function loader({ request }: Route.LoaderArgs) {
6394
+ const { pathname, search } = new URL(request.url)
6395
+ const match = urls.matchSegment(urls.getPathLocale(pathname), pathname + search)
6396
+ if (match.kind === "not-found") notFound()
6397
+ if (match.kind === "redirect") return redirect(match.location, { status: 308 })
6398
+ const canonical = urls.unlocalizePathname(pathname).pathname.replace(/\/$/, "") || "/"
6399
+ const page = pages.get(canonical)
6400
+ if (!page) notFound() // Includes unknown and draft-prefixed paths: never dispatch arbitrary input.
6401
+ return { page, locale: urls.localeOf(pathname) }
6402
+ }
6403
+ ```
6404
+
6405
+ Keep a separate `routes/index.tsx` for the root; a catch-all needs at least one
6406
+ segment. Literal routes take precedence, so ensure they also use the same canonical checks
6407
+ when they overlap this dispatcher. Registering `i18n` below supplies locale
6408
+ metadata and prefix guards, not pathname rewrites. Dynamic slug maps, automatic filesystem
6409
+ aliases, automatic content translation and domain-based routing are outside this API.
6410
+ Invalid static paths (patterns, URL delimiters, dot segments or encoded separators), unknown
6411
+ locale keys, per-locale collisions including fallback paths, and translations shadowing
6412
+ another canonical key throw when the router is defined. Paths must not already carry a
6413
+ served locale prefix.
6414
+
5999
6415
  ### Register the routing once
6000
6416
 
6001
6417
  Export the router as `i18n` from `backend/framework.ts` (re-export it from
@@ -6431,7 +6847,7 @@ export default { fetch: (req: Request, env: Env, ctx: ExecutionContext) =>
6431
6847
  Export through `toFetchHandler` rather than handing the app out directly. Besides
6432
6848
  `env` and `ctx.waitUntil`, it tells nifra the request came from the
6433
6849
  platform's own HTTP parser, which lets the
6434
- [bounded-body cap](/docs/security) trust the declared
6850
+ bounded-body cap trust the declared
6435
6851
  `Content-Length` as a real transport frame instead of re-counting every JSON body.
6436
6852
  A bare `export default app` has no such signal and pays the extra pass unless you
6437
6853
  set `server({ trustBodyFraming: true })`.
@@ -6555,7 +6971,7 @@ HTTP request, and `upgrade` reads what the guards derived. The origin check runs
6555
6971
  first. A socket registered before a guard stays public, like an HTTP route there. A browser
6556
6972
  cannot set a header on the handshake, so `authenticate()` can read a short-lived,
6557
6973
  single-use ticket from `input.query` - see
6558
- [Authentication runs first](/docs/auth#auth-first).
6974
+ Authentication runs first.
6559
6975
 
6560
6976
  ```ts
6561
6977
  // doc-check: skip - illustrative: an existing auth guard and session lookup.
@@ -6906,7 +7322,7 @@ server()
6906
7322
 
6907
7323
  ## Nifra - Deployment
6908
7324
 
6909
- > One Nifra app, one command per target - Bun, Node (Docker), Deno Deploy, Cloudflare Pages, Vercel Edge.
7325
+ > One Nifra app, one command per target - Bun, Node (Docker), Deno Deploy, Cloudflare Pages, Vercel Edge or Node.
6910
7326
 
6911
7327
  `app.fetch(request)` is a pure Web-standard handler, so the same app runs
6912
7328
  anywhere. Pick a runtime; the code doesn't change.
@@ -6976,7 +7392,7 @@ Cloudflare Pages
6976
7392
 
6977
7393
  `wrangler.toml`
6978
7394
 
6979
- Vercel Edge
7395
+ Vercel (Edge by default; Node opt-in)
6980
7396
 
6981
7397
  `.vercel/output/`
6982
7398
 
@@ -6986,11 +7402,45 @@ none (Build Output API v3)
6986
7402
 
6987
7403
  `nifra build --target static` also builds a site with no server: the prerendered
6988
7404
  pages, the client bundle and `public/`, for any static host. See
6989
- [SSG & ISR](/docs/rendering).
7405
+ SSG & ISR.
6990
7406
 
6991
7407
  The Bun, Node and Deno entries serve the client bundle from disk next to themselves; on
6992
7408
  Cloudflare and Vercel the platform serves it.
6993
7409
 
7410
+ #### Vercel: Edge or Node.js
7411
+
7412
+ Ordinary SSR keeps the existing Edge output for `nifra build --target vercel`.
7413
+ For Node built-ins and Node-compatible server libraries, keep the target and opt into Node
7414
+ in `nifra.config.ts` (there is no separate runtime CLI flag):
7415
+
7416
+ ```ts
7417
+ // nifra.config.ts (alongside your adapter/clientModule exports)
7418
+ export const target = "vercel"
7419
+ export const vercelRuntime = "node" // "edge" or omitted preserves the Edge function
7420
+
7421
+ // Build and deploy from the project root:
7422
+ // bunx nifra build # or: bunx nifra build --target vercel
7423
+ // vercel deploy --prebuilt
7424
+ ```
7425
+
7426
+ Both Bun and Vite production pipelines emit Build Output API v3 at
7427
+ `.vercel/output`: `static/` holds the client chunks and public files;
7428
+ `functions/index.func/` holds the SSR function. Node mode declares
7429
+ `nodejs22.x` and exports an HTTP handler without listening at import. It serves
7430
+ pages and the backend mounted with `apiPrefix`. Programmatic builds use
7431
+ `buildTarget("vercel", { ...options, vercelRuntime: "node" })`, or the same
7432
+ option on `buildTargetVite`. A different target or an unsupported runtime is
7433
+ refused before clearing the previous build; remove the selector when switching targets.
7434
+
7435
+ This is serverless Node, not the self-hosted `node` target: no Bun APIs, listening
7436
+ sockets, persistent in-process jobs or WebSocket server. Execution duration, streaming and
7437
+ filesystem availability remain subject to Vercel limits; native dependencies must be
7438
+ deploy-compatible. `selfHost` does not start a server here. Builds still require
7439
+ Bun. Static files are served first by Vercel, so host policy in the function cannot protect
7440
+ CDN files. The component pipeline retains its existing Vercel Node output and does not take
7441
+ this ordinary-SSR selector. The generated handler is tested locally under Node; this is not
7442
+ a claim of a live Vercel deployment test.
7443
+
6994
7444
  The Bun, Node and Deno entries pass the socket peer as `c.clientIp`. Cloudflare
6995
7445
  and Vercel expose no socket, so an edge build has no caller address unless
6996
7446
  `nifra.config.ts` declares `export const clientIp = "platform"`: then
@@ -7000,6 +7450,20 @@ The scaffold declares it. The trust holds only while that edge is the one way in
7000
7450
  bundle served by `wrangler pages dev` or a self-hosted workerd takes the header from
7001
7451
  the client, so drop the line before serving it publicly any other way.
7002
7452
 
7453
+ A SIGTERM or SIGINT kills the Bun, Node and Deno servers at once unless
7454
+ `nifra.config.ts` exports a `selfHost` that sets
7455
+ `gracefulSignals`, such as
7456
+ `export const selfHost = { gracefulSignals: { drainMs: 8_000 }, idleTimeoutSec: 60 }`.
7457
+ With `gracefulSignals` the server drains instead (`docker stop`,
7458
+ Ctrl-C): in-flight requests get `drainMs` to finish, and `delayMs` keeps
7459
+ it serving first while a load balancer sees it go. `idleTimeoutSec` is how long Bun
7460
+ keeps a connection that moves no bytes, a request whose handler is still working included:
7461
+ a whole number from `0` (never) to `255`, 10 by default. Node and Deno
7462
+ do not close a connection while its request is being handled, so they ignore it, and an edge
7463
+ build ignores
7464
+ `selfHost`. `nifra start` runs the built server, so it applies there
7465
+ too.
7466
+
7003
7467
  Nifra never runs the deploy or enters your cloud credentials - it scaffolds the config + a
7004
7468
  `deploy` script that shells out to the vendor CLI you've already authed.
7005
7469
 
@@ -7075,7 +7539,7 @@ host-specific deploy step for you to fill in (Fly, a registry push, SSH, …).
7075
7539
  ### Bun (its home)
7076
7540
 
7077
7541
  `app.listen(3000)` - the native Bun server. Bun is the runtime where Nifra measures
7078
- fastest (see [benchmarks](/benchmarks)).
7542
+ fastest (see benchmarks).
7079
7543
 
7080
7544
  **Every core:** Bun is single-threaded per process - for multi-core boxes,
7081
7545
  spawn one process per core, each binding the same port with
@@ -7084,8 +7548,8 @@ across them (Linux balances ~evenly). A supervisor that spawns + restarts worker
7084
7548
  lines - see `examples/cluster.ts`. Anything shared across workers (rate limits,
7085
7549
  sessions, pub/sub) needs a shared store, as in any multi-instance deploy. So do an ISR page
7086
7550
  store (signed with one `storeSecret` in every process - see
7087
- [SSG & ISR](/docs/rendering)) and
7088
- [live refresh](/docs/live) (one Redis Streams bus for every process).
7551
+ SSG & ISR) and
7552
+ live refresh (one Redis Streams bus for every process).
7089
7553
 
7090
7554
  ### Node & Deno
7091
7555
 
@@ -7095,10 +7559,21 @@ store (signed with one `storeSecret` in every process - see
7095
7559
  -
7096
7560
  `@nifrajs/deno` - serves `app.fetch` on `Deno.serve`.
7097
7561
 
7098
- Self-hosting (no CDN in front)? Hand `@nifrajs/node`'s `serve` a
7099
- `static` mount and it serves the client bundle from disk - traversal-guarded,
7100
- content-typed, with an immutable cache - before the app runs, leaving the SSR fast path
7101
- untouched: `serve(app, { port, static: { dir: new URL("./assets/", import.meta.url) } })`.
7562
+ The servers that `nifra build --target node` and `--target deno` emit
7563
+ run on these adapters, so the app installs the one for its target, from the same release as
7564
+ `@nifrajs/web`. Each server's `static` sees every request first: it
7565
+ answers with a file's response, or `undefined` to let the app route it. The
7566
+ generated servers serve their client bundle and `public/` files that way.
7567
+
7568
+ Self-hosting (no CDN in front)? Hand `serve` a `serveStatic` mount, from
7569
+ `@nifrajs/node` or `@nifrajs/deno` (on Bun,
7570
+ `@nifrajs/core/serve-static` for `listen()`), and it serves the client
7571
+ bundle from disk - traversal-guarded, content-typed, with an immutable cache - before the app
7572
+ runs, leaving the SSR fast path untouched:
7573
+ `
7574
+ serve(app, { port, static: serveStatic({ dir: new URL("./assets/", import.meta.url) }) })
7575
+ `
7576
+ .
7102
7577
  On Cloudflare/Vercel the platform serves assets, so you don't need it there.
7103
7578
 
7104
7579
  Every file under the mount is cached as immutable by default. If the directory also holds
@@ -7188,8 +7663,9 @@ export default toFetchHandler(app)
7188
7663
  ```
7189
7664
 
7190
7665
  Deploy: `wrangler pages deploy dist` (Pages) or `wrangler deploy`
7191
- (Workers). The `vercel` target emits the same edge bundle as a Build Output API
7192
- function under `.vercel/output`.
7666
+ (Workers). The `vercel` target defaults to an Edge Build Output API function
7667
+ under `.vercel/output`; [opt into Node.js](#vercel-node) for
7668
+ Node-compatible server dependencies.
7193
7669
 
7194
7670
  ## Nifra - CLI
7195
7671
 
@@ -7215,7 +7691,7 @@ nifra build --target cloudflare # also: node | deno | vercel | static; add --re
7215
7691
 
7216
7692
  ### The layout the CLI reads
7217
7693
 
7218
- `nifra dev` runs the Bun-native [HMR dev server](/docs/dev);
7694
+ `nifra dev` runs the Bun-native HMR dev server;
7219
7695
  `nifra build` runs the production build (content-hashed client assets plus a
7220
7696
  target-specific server); `nifra start` runs the default Bun output. The generated
7221
7697
  server serves assets and SSR with matched-route chunks preloaded and route CSS linked in each
@@ -7229,7 +7705,7 @@ pipeline cannot run those, so that app gets Vite for dev and build alike, and sa
7229
7705
  Vite-only app rather than dropping its transforms silently. Every `dev` and
7230
7706
  `build` run prints which bundler it picked and why, and `nifra check`
7231
7707
  answers the same question without starting a server - see
7232
- [which pipeline runs, when](/docs/dev) for the full table.
7708
+ which pipeline runs, when for the full table.
7233
7709
 
7234
7710
  ```ts
7235
7711
  my-app/
@@ -7252,7 +7728,7 @@ and `nifra check` reports it as NF-C038: run
7252
7728
  `backend/app.ts` a composition root - merging modules, registering no routes of
7253
7729
  its own - so each route's capability reach stays its own module's. What goes in each
7254
7730
  zone, and what the builds refuse to cross, is on
7255
- [Project structure](/docs/structure).
7731
+ Project structure.
7256
7732
 
7257
7733
  ### backend/framework.ts and nifra.config.ts
7258
7734
 
@@ -7284,6 +7760,17 @@ export const vitePlugins = [react()] // only if you want Vite's dev pip
7284
7760
  // define = { __VUE_OPTIONS_API__: "true", ... } // Vue feature flags
7285
7761
  ```
7286
7762
 
7763
+ Ordinary `vercel` builds default to Edge. To opt into Node.js 22, export both
7764
+ `target = "vercel"` and `vercelRuntime = "node"` from
7765
+ `nifra.config.ts`, then run `nifra build` (or
7766
+ `nifra build --target vercel`) and `vercel deploy --prebuilt` from
7767
+ the project root. Both Bun and Vite builds write `.vercel/output` unless
7768
+ `--out` overrides it. Omit the selector or use `"edge"` to retain
7769
+ Edge; other values and use with a different target are refused before output is cleared.
7770
+ There is no separate runtime flag. Node functions support Node built-ins but not Bun APIs
7771
+ or a persistent server; the CLI/build still requires Bun. See
7772
+ runtime output and limitations.
7773
+
7287
7774
  ### Command reference
7288
7775
 
7289
7776
  Every command `nifra --help` lists, by what it is for. Most take
@@ -7421,23 +7908,19 @@ What it does
7421
7908
 
7422
7909
  `nifra types [--check]`
7423
7910
 
7424
- Each route's `./+types` module under `.nifra/types`: params, schema-typed data, and `api` typed by `backend/app.ts`. `dev`, `build` and `check` refresh them too.
7911
+ Each route's `./+types` module under `.nifra/types`: params, schema-typed data, and `api` typed by `backend/app.ts`. It also writes `routes.d.ts`, the route table `href()` reads. `dev`, `build` and `check` refresh them too.
7425
7912
 
7426
7913
  `nifra schemas [--write] [--check]`
7427
7914
 
7428
7915
  Draft `loaderOutput` and `actionOutput` from each loader's and action's return type. `--write` adds the missing ones; it also lists returned fields a hand-written schema drops.
7429
7916
 
7430
- `nifra sync-routes`
7431
-
7432
- Regenerate `nifra-routes.d.ts` so `navigate({ to, search })` is typed by each route's search schema.
7433
-
7434
7917
  `nifra sync-manifest`
7435
7918
 
7436
7919
  Regenerate a committed `server-manifest.ts` from `routes/` without a full build.
7437
7920
 
7438
7921
  `nifra scaffold hole <route> <name> [--shared] [--interactive] [--timeout <ms>] [--server]`
7439
7922
 
7440
- Experimental. Add a hole to a [partially prerendered](/docs/partial-prerendering) route: its definition, `boundaries` entry and `Hole` in a JSX page, and a loader with its output schema in the backend half. A Vue or Svelte page gets the code to paste.
7923
+ Add a hole to a partially prerendered route: its definition, `boundaries` entry and `Hole` in a JSX page, and a loader with its output schema in the backend half. A Vue or Svelte page gets the code to paste.
7441
7924
 
7442
7925
  `nifra openapi [--format json | yaml] [--path <prefix>]`
7443
7926
 
@@ -7601,14 +8084,18 @@ pins are installed it would judge the release you are leaving, and the command p
7601
8084
  install to run first instead. With `--write` it also saves the hook report from
7602
8085
  before the edits and, once the target is installed, prints how hook scope changed across the
7603
8086
  upgrade (`--no-hooks` skips that); before then,
7604
- `nifra routes --hooks --since` compares after the install.
8087
+ `nifra routes --hooks --since .nifra/hooks-before-upgrade.json` compares after the
8088
+ install. Run from a CLI whose
8089
+ `@nifrajs/core` is not the project's - `bunx @nifrajs/cli@<new>
8090
+ upgrade` before the new release is installed - it takes no hook report, since that
8091
+ copy cannot reflect the project's app, and says so in one line.
7605
8092
  `nifra doctor` and
7606
8093
  `nifra check` (NF-D002) point here when a workspace carries more than one version;
7607
- see [mixed nifra versions](/docs/troubleshooting#mixed-versions). A
8094
+ see mixed nifra versions. A
7608
8095
  `file:` package whose dependencies this upgrade moves keeps its old ones in
7609
8096
  `bun.lock`, where Bun never refreshes them; the plan lists each, and
7610
8097
  `--write` drops those entries so the next `bun install` records them
7611
- again (see [stale file: links](/docs/troubleshooting#stale-file-links)).
8098
+ again (see stale file: links).
7612
8099
 
7613
8100
  A `link:` or `file:` dependency outside the root that installs its own
7614
8101
  `@nifrajs/*` at another version stops the upgrade before anything is written: its
@@ -7638,7 +8125,7 @@ fixes for data loss ship as patches of it, so move to the latest with
7638
8125
 
7639
8126
  `nifra build` defaults to a self-hosted Bun server. Use `--target node`,
7640
8127
  `deno`, `cloudflare`, `vercel`, or `static` for another
7641
- complete deploy shape (see [Deployment](/docs/deployment)). Run non-Bun outputs with
8128
+ complete deploy shape (see Deployment). Run non-Bun outputs with
7642
8129
  the command printed by the build.
7643
8130
 
7644
8131
  ## Nifra - Coding agents
@@ -7648,7 +8135,7 @@ the command printed by the build.
7648
8135
  Nifra ships an MCP server. It is not a documentation lookup bolted onto a framework: an agent
7649
8136
  can read the project, learn the real API, run actual requests against the backend it just
7650
8137
  edited, and finish with a report of what the change proved. The same typed capabilities can
7651
- power the agent inside your product through [WebMCP and predictive UI](/docs/webmcp)
8138
+ power the agent inside your product through WebMCP and predictive UI
7652
8139
  or stream into a product surface through AG-UI.
7653
8140
 
7654
8141
  ### One MCP, two ways to connect
@@ -7914,9 +8401,9 @@ URL
7914
8401
  none
7915
8402
 
7916
8403
  tables a query may not read (`name`, or `schema.name` on Postgres),
7917
- also through views, CTEs, partitions and child tables. On Postgres the check reads the
7918
- query plan, so a function that reads the table inside its own body is not seen; the
7919
- `REVOKE` that `nifra db role` prints is what closes that
8404
+ also through views, CTEs, partitions and child tables. On Postgres the role itself must be
8405
+ unable to read it, or any view over it, so a function body or a materialized view cannot
8406
+ reach it either; the `REVOKE` that `nifra db role` prints does that
7920
8407
 
7921
8408
  `query`
7922
8409
 
@@ -7944,10 +8431,13 @@ columns a query may not read on top of the credential-name rule, and columns it
7944
8431
  none
7945
8432
  SQLite: paths outside the project the file may resolve to
7946
8433
 
7947
- `allowHosts`, `allowExtensions`, `schemas`
8434
+ `allowHosts`, `allowExtensions`, `allowFunctions`,
8435
+ `schemas`
8436
+
8437
+ none, none, none, public
7948
8438
 
7949
- none, none, public
7950
- Postgres: remote hosts, extensions to accept, schemas a query may read
8439
+ Postgres: remote hosts, extensions to accept, functions to trust past the allowlist
8440
+ (`name` or `schema.name`), schemas a query may read
7951
8441
 
7952
8442
  Each call runs in a fresh process that loads the declaration, answers and exits:
7953
8443
 
@@ -7963,11 +8453,14 @@ statement, lock and idle timeouts, always rolled back, inside a session that sta
7963
8453
 
7964
8454
  -
7965
8455
  **Layers that each refuse on their own.** One statement, read-only, checked by a
7966
- tokenizer that also refuses functions that reach outside a query (server files,
7967
- `dblink`, `set_config`, advisory locks, `pg_notify`,
7968
- `nextval`). On Postgres the statement runs as one extended-protocol
7969
- `DECLARE CURSOR`, which the server accepts only for SELECT and VALUES. Every table
7970
- the plan reads (SQLite: every table its compiled statement opens) must be exposed.
8456
+ tokenizer. On Postgres every function the statement or its plan calls is looked up in
8457
+ `pg_proc` and must be immutable or stable, parallel safe when it ships with
8458
+ Postgres or an extension, and not SECURITY DEFINER, so `pg_sleep`,
8459
+ `set_config`, advisory locks, `dblink` and functions that run SQL from
8460
+ a string are refused unless `allowFunctions` names them. The statement runs as one
8461
+ extended-protocol `DECLARE CURSOR`, which the server accepts only for SELECT and
8462
+ VALUES. Every table the plan reads (SQLite: every table its compiled statement opens) must be
8463
+ exposed.
7971
8464
 
7972
8465
  -
7973
8466
  **No superuser.** A Postgres superuser, a member of
@@ -7982,9 +8475,11 @@ untrusted language is refused too, unless `allowExtensions` names it.
7982
8475
  credential (`password`, `token`, `secret`,
7983
8476
  `api_key`, ...) or one in `redactColumns` is refused wherever the
7984
8477
  query plan uses it: selected under another name, inside an expression, in a filter, through
7985
- a view, or renamed by a table's column alias list. Functions that run SQL from a string,
7986
- which the plan cannot see, are refused outright. Every other value goes through the same
7987
- redactor as the dev feed: keys, tokens, JWTs and the project's environment values.
8478
+ a view, or renamed by a table's column alias list. On Postgres the role must also be unable
8479
+ to read the column at all, so the database refuses it where no plan shows it: run
8480
+ `nifra db role`, which grants a table's other columns only. Every other value
8481
+ goes through the same redactor as the dev feed: keys, tokens, JWTs and the project's
8482
+ environment values.
7988
8483
 
7989
8484
  -
7990
8485
  **Data, not instructions.** Rows, and names from the schema, are marked
@@ -8045,6 +8540,23 @@ that role. The schema tool keeps working meanwhile.
8045
8540
  The role can use dblink, postgres_fdw, file_fdw or an untrusted language, any of which reaches
8046
8541
  outside this database. Use a role without it, or accept it in `allowExtensions`.
8047
8542
 
8543
+ #### NIFRA_DB_ROLE_GRANTS
8544
+
8545
+ The Postgres role may itself read what the declaration hides: a masked column, an excluded
8546
+ table or one inheriting from it, or a view or materialized view over any of them (or reaching
8547
+ outside `schemas`). A materialized view stores its rows and a function reads with
8548
+ no plan to check, so only the role's privileges can refuse those. Run `nifra db role`,
8549
+ apply its SQL, and connect as that role; run it again after adding a table or view, since
8550
+ default privileges grant every column of a new one. The role may not execute a SECURITY
8551
+ DEFINER function either (or an aggregate over one): it reads with its owner's rights through
8552
+ an operator, a cast, a view or another function, where no allowlist sees its name. Name it in
8553
+ `devDatabase.allowFunctions` to trust it. Otherwise the refusal names each grantee
8554
+ the role holds the privilege through, and every one must be revoked: PUBLIC, the role itself,
8555
+ and any role whose privileges it has, since a REVOKE from PUBLIC leaves a direct or inherited
8556
+ grant in place. `nifra db role` writes the REVOKE from the role itself as a statement
8557
+ and the others as comments, since they reach other roles; it lists the same for a table or
8558
+ column grant that would still expose hidden data.
8559
+
8048
8560
  #### NIFRA_DB_QUERY_OFF
8049
8561
 
8050
8562
  `devDatabase.query` is `false`. Only the schema tool answers.
@@ -8056,8 +8568,11 @@ tokenizer, the cursor, or the read-only transaction. Send one SELECT.
8056
8568
 
8057
8569
  #### NIFRA_DB_FUNCTION_REFUSED
8058
8570
 
8059
- The statement calls a function that reaches outside a read-only query: server files, other
8060
- sessions, settings, locks, sequences, notifications, or another database. Remove it.
8571
+ The statement, or a view it reads, calls a function the allowlist refuses: one that is volatile
8572
+ (it can act outside the query: locks, settings, sequences, files, other sessions, another
8573
+ database), not parallel safe (it can run SQL of its own), or SECURITY DEFINER (it reads with
8574
+ its owner's privileges). Every function a name can resolve to is checked. Remove it, or name
8575
+ it in `allowFunctions` if you trust what it reads.
8061
8576
 
8062
8577
  #### NIFRA_DB_TABLE_EXCLUDED
8063
8578
 
@@ -8149,7 +8664,7 @@ Passing tests say the code does what its tests say. `nifra_levels` answers the
8149
8664
  different question of what the project _holds_, as a cumulative ladder from a typed
8150
8665
  contract (L0) to contract-derived invariant tests (L4). A scaffolded app starts at L1, and each
8151
8666
  rung it has not reached reports the specific thing missing - so the ladder doubles as the list
8152
- of what to do next. See [the verification ladder](/docs/verification).
8667
+ of what to do next. See the verification ladder.
8153
8668
 
8154
8669
  ```bash
8155
8670
  # The two an agent should gate on. Both exit non-zero on failure, so they work in CI unchanged.
@@ -8252,7 +8767,10 @@ timeout, and closed sessions all fail closed, and `approvalTimeoutMs` bounds how
8252
8767
  a pending decision can remain open: 5 minutes by default, at most 24 hours, or
8253
8768
  `"never"` to wait until it is answered, cancelled, its turn ends, or the session
8254
8769
  closes. The host's broker takes the same values as `approvals.timeoutMs` on
8255
- `CodingAgentHost` and `CodingAgentRpcServer`.
8770
+ `CodingAgentHost` and `CodingAgentRpcServer`. An approval port's
8771
+ optional `review` may allow or deny a call before anyone is asked, with no approval
8772
+ events; any other answer, or a review still unsettled after `reviewTimeoutMs`,
8773
+ raises the approval as usual.
8256
8774
 
8257
8775
  ### Expose the same agent to other clients
8258
8776
 
@@ -8651,7 +9169,7 @@ export function Counter(props: { message: string }) {
8651
9169
 
8652
9170
  `@nifrajs/devtools` is a plugin that streams what each request actually did - loader
8653
9171
  traces, ISR status, route metadata - over a secured SSE endpoint, with an overlay to read it
8654
- in the browser. In an app with [keep-alive](/docs/keep-alive) routes, the overlay
9172
+ in the browser. In an app with keep-alive routes, the overlay
8655
9173
  also lists the pages kept hidden.
8656
9174
 
8657
9175
  ```ts
@@ -8674,12 +9192,12 @@ reads it through `nifra_errors`, `nifra_logs` and
8674
9192
  `nifra_inspect`, and you can read it with `nifra errors` and
8675
9193
  `nifra logs`. Pages get a small inline script that reports browser errors and
8676
9194
  hydration mismatches back to the dev server; the dev server writes `.nifra/dev-server.json`
8677
- so the tools can find it. See [coding agents](/docs/agents).
9195
+ so the tools can find it. See coding agents.
8678
9196
 
8679
9197
  When a page reports an error, a badge appears in its corner. It lists that page's errors with
8680
9198
  their code, message, codeframe and fix, and a **Copy prompt** button per fix hands
8681
9199
  a coding agent the error, one fix and the steps to check it worked (the
8682
- [error codes](/docs/errors) page has the same prompts). The badge lives in a closed
9200
+ error codes page has the same prompts). The badge lives in a closed
8683
9201
  shadow root, so the page's styles cannot reach it, and it loads under the page's CSP: by nonce,
8684
9202
  by its exact URL, or through `'strict-dynamic'`. A page that never errors never
8685
9203
  fetches it. Turn it off for one run with `nifra dev --no-indicator`, for every run
@@ -9208,7 +9726,7 @@ never reported.
9208
9726
  This applies to every framework with module-global render state, not just React (Preact,
9209
9727
  Vue, Solid, Svelte). Nifra dedupes the active adapter's runtime in build and dev; a
9210
9728
  `file:`-linked package shipping its own copy is the thing to fix. See
9211
- [Dev & HMR](/docs/dev) and the `file:`-linked-package note in
9729
+ Dev & HMR and the `file:`-linked-package note in
9212
9730
  `AGENTS.md`.
9213
9731
 
9214
9732
  ###
@@ -9224,7 +9742,7 @@ That route's `data` infers `never` (Nifra can't see the shape). Return a
9224
9742
  plain object and shape the response with `c.set` - reach for `c.json` /
9225
9743
  `c.text` only for an error short-circuit (`throw` from a
9226
9744
  `derive` / `beforeHandle`), not a route's happy path. See
9227
- [API & typed client](/docs/api).
9745
+ API & typed client.
9228
9746
 
9229
9747
  -
9230
9748
  **A plugin widened the app's type.** A plugin that registers routes/hooks but whose return
@@ -9233,7 +9751,7 @@ makes `.use()` return `Server<any, any>` and the client loses your
9233
9751
  registry. Build it with `defineRouterPlugin(name, …)` (the clearer-named
9234
9752
  `defineIdentityPlugin`) so `.use()` returns your server unchanged and
9235
9753
  routes added after it stay typed. See
9236
- [Plugins → keep types with defineRouterPlugin](/docs/plugins).
9754
+ Plugins → keep types with defineRouterPlugin.
9237
9755
 
9238
9756
  `nifra check` flags the raw-`Response` case; the plugin case surfaces as a
9239
9757
  `never` client at the call site.
@@ -9299,7 +9817,7 @@ export const app = server()
9299
9817
  upfront**, and `implement(contract, handlers)` binds handlers to it. Nothing
9300
9818
  grows a registry per call, so there is **no ceiling at all** - this is the path for
9301
9819
  an API that will keep adding routes for years. Handlers stay checked against the contract exactly
9302
- as inline routes are. See [Contract-first](/docs/contract).
9820
+ as inline routes are. See Contract-first.
9303
9821
 
9304
9822
  ```ts
9305
9823
  import { defineContract, implement } from "@nifrajs/core/contract"
@@ -9376,7 +9894,7 @@ those, whatever the workspace installs, so two live-linked repositories that eac
9376
9894
  version still run two), and the running CLI. When they disagree it names each version and
9377
9895
  where it came from. It only reads files, and it never fails the run.
9378
9896
 
9379
- The fix is [`nifra upgrade <highest>`](/docs/cli#upgrade), not a
9897
+ The fix is `nifra upgrade <highest>`, not a
9380
9898
  hand edit of the pins: it runs
9381
9899
  every release's migration steps between your oldest pin and the target, then re-pins. Run it
9382
9900
  without `--write` first to see each planned edit. It edits files under the
@@ -9406,7 +9924,7 @@ the manifests it is about to write and leaves `bun.lock` as it is.
9406
9924
 
9407
9925
  Run `nifra check --json` as the done-gate - it surfaces the import-chain leaks,
9408
9926
  typed-client drift, and raw-`Response`-from-a-route issues before you ship. The
9409
- full machine-readable contract is at [/llms-full.txt](/llms-full.txt), and each
9927
+ full machine-readable contract is at /llms-full.txt, and each
9410
9928
  package ships a tight `LLM.md` contract card.
9411
9929
 
9412
9930
  ## Nifra - Backends & API (dev and prod)
@@ -10048,7 +10566,7 @@ A route is two files. The page (`x.tsx`) holds the view and its head:
10048
10566
  `revalidate`. A `loader` runs on **GET** and feeds
10049
10567
  `props.data`; an `action` runs on **POST** and feeds
10050
10568
  `props.actionData`. A server-only export in the page file is a build error - see
10051
- [Project structure](/docs/structure).
10569
+ Project structure.
10052
10570
 
10053
10571
  ```ts
10054
10572
  // routes/users/[id].tsx - the page: it ships to the browser whole. Only `default` is required.
@@ -10105,7 +10623,7 @@ with `ctx.set.cookie()` / `ctx.set.deleteCookie()`.
10105
10623
  ```ts
10106
10624
  // routes/account.backend.ts - response headers and cookies, from a loader or an action.
10107
10625
  import { t } from "@nifrajs/schema"
10108
- import { type LoaderContext, redirect } from "@nifrajs/web"
10626
+ import { type LoaderContext, rawHref, redirect } from "@nifrajs/web"
10109
10627
 
10110
10628
  declare function signIn(email: string, password: string): Promise<{ token: string } | null>
10111
10629
 
@@ -10125,7 +10643,7 @@ export async function action(ctx: LoaderContext) {
10125
10643
  if (session === null) return { error: "Wrong email or password" }
10126
10644
  // HttpOnly; Secure; SameSite=Lax; Path=/ unless the options say otherwise.
10127
10645
  ctx.set.cookie("session", session.token, { maxAge: 60 * 60 * 24 * 7 })
10128
- throw redirect("/dashboard") // the cookie rides the redirect
10646
+ throw redirect(rawHref("/dashboard")) // the cookie rides the redirect
10129
10647
  }
10130
10648
  ```
10131
10649
 
@@ -10453,6 +10971,33 @@ export const handler = withISR(app, {
10453
10971
  })
10454
10972
  ```
10455
10973
 
10974
+ An app that wants a nonce on every document still gets its header from nifra: pass
10975
+ `cspHeader` beside `nonce`, and each document nifra renders - a page, a
10976
+ status page, `_error`, a streamed or deferred one - carries the policy built from
10977
+ the nonce on its own scripts. A wrapper that rebuilds the request with
10978
+ `new Request(url, req)` (a mount that strips a prefix, a request id, an origin
10979
+ rewrite) no longer has to find which nonce a document used. `cspHeader` needs
10980
+ `nonce`, and is refused beside `csp` or a resolver made with its own
10981
+ `header`. The documents stay `private, no-store`.
10982
+
10983
+ ```ts
10984
+ import { createNonceResolver, createWebApp } from "@nifrajs/web"
10985
+
10986
+ declare const adapter: import("@nifrajs/web").RenderAdapter
10987
+ declare const manifest: import("@nifrajs/web").Manifest
10988
+
10989
+ // A fresh nonce on every document, and nifra writes the header from that same value - on pages,
10990
+ // status pages, _error, and streamed or deferred documents - whatever rebuilds the Request in front.
10991
+ export const app = createWebApp({
10992
+ adapter,
10993
+ manifest,
10994
+ clientEntry: "/assets/client.js",
10995
+ nonce: createNonceResolver(),
10996
+ // `sources`: 'nonce-…' plus a sha256 hash per constant inline script nifra writes.
10997
+ cspHeader: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`,
10998
+ })
10999
+ ```
11000
+
10456
11001
  ### The client ↔ server boundary
10457
11002
 
10458
11003
  Loaders, actions, and head resolution run on the server. The client receives the loader's
@@ -10482,7 +11027,7 @@ file that reaches it.
10482
11027
 
10483
11028
  ### Optional server components
10484
11029
 
10485
- The optional [server-components pipeline](/docs/server-components) supports
11030
+ The optional server-components pipeline supports
10486
11031
  React, Preact, Vue, Svelte and Solid. Declare closed input/public-props schemas and authorization
10487
11032
  in `*.component.server.ts(x)`, register owner instances and export a named
10488
11033
  `componentPipeline` configuration. React uses native RSC/Flight; the other four
@@ -10655,8 +11200,8 @@ stable. The consumer still gets full end-to-end types both ways -
10655
11200
  `.merge()` threads the router's routes into the host app's registry, and
10656
11201
  `client(contract, url)` types every call from the same exported object.
10657
11202
 
10658
- See [SSG & ISR](/docs/rendering) for prerendering, [Dev & HMR](/docs/dev) for the
10659
- two dev loops and the `--port` flag, and [Loaders & actions](/docs/data) for the
11203
+ See SSG & ISR for prerendering, Dev & HMR for the
11204
+ two dev loops and the `--port` flag, and Loaders & actions for the
10660
11205
  data layer in depth.
10661
11206
 
10662
11207
  ## Nifra - Control APIs (one schema, every client)
@@ -10826,8 +11371,8 @@ Everything on this page in one file. The sections below explain each part. This
10826
11371
  typechecks against the current packages.
10827
11372
 
10828
11373
  ```ts
10829
- import { fileURLToPath } from "node:url"
10830
- import { createCspPolicy, createWebApp, servePublicDir } from "@nifrajs/web"
11374
+ import { ONE_DAY, serveStatic } from "@nifrajs/core/serve-static"
11375
+ import { createCspPolicy, createWebApp } from "@nifrajs/web"
10831
11376
  import type { Manifest, RenderAdapter } from "@nifrajs/web"
10832
11377
 
10833
11378
  // From your build: the framework adapter, the route manifest, and what buildClient() returned.
@@ -10842,11 +11387,16 @@ declare const build: {
10842
11387
  declare const errors: { capture(error: unknown, tags: Record<string, string>): void }
10843
11388
 
10844
11389
  // buildClient({ outDir: "dist/assets" }) writes the chunks where their /assets/ URLs point.
10845
- const bundle = servePublicDir({
10846
- dir: fileURLToPath(new URL("./dist/", import.meta.url)),
10847
- hashedFiles: new Set(build.assets),
10848
- })
10849
- const publicFiles = servePublicDir({ dir: fileURLToPath(new URL("./public/", import.meta.url)) })
11390
+ const files = serveStatic([
11391
+ { dir: new URL("./dist/assets/", import.meta.url), hashedFiles: build.assets, cacheControl: ONE_DAY },
11392
+ {
11393
+ dir: new URL("./public/", import.meta.url),
11394
+ prefix: "/",
11395
+ immutable: false,
11396
+ cacheControl: ONE_DAY,
11397
+ fallthrough: true,
11398
+ },
11399
+ ])
10850
11400
 
10851
11401
  const csp = createCspPolicy({
10852
11402
  header: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`,
@@ -10860,48 +11410,71 @@ export const app = createWebApp({
10860
11410
  styles: build.css ?? [],
10861
11411
  csp,
10862
11412
  server: { requestTimeoutMs: 15_000, gracefulSignals: { drainMs: 8_000 } },
10863
- use: (app) => {
10864
- app.onRequest(async (request) => (await bundle(request)) ?? (await publicFiles(request)))
10865
- },
10866
11413
  onLoaderError: (error, { route }) => errors.capture(error, { route }),
10867
11414
  })
10868
11415
 
10869
- app.listen(3000)
11416
+ app.listen(3000, { static: files })
10870
11417
  ```
10871
11418
 
10872
11419
  ### Static and hashed files
10873
11420
 
10874
- `servePublicDir` from `@nifrajs/web` serves a directory on Bun, Node and
10875
- Deno. It answers `GET` and `HEAD` only, refuses paths that leave the
10876
- directory or name a hidden file, sets the content type and `nosniff`, handles range
10877
- requests, and returns `undefined` on a miss so the request falls through to your
10878
- routes.
11421
+ `serveStatic` serves directories under URL prefixes, with the same options on every
11422
+ runtime: import it from `@nifrajs/core/serve-static` on Bun, and from
11423
+ `@nifrajs/node` or `@nifrajs/deno` there. Pass it as
11424
+ `static`, which runs before every route. It answers `GET` and
11425
+ `HEAD` only, refuses paths that leave the directory or name a hidden file, sets the
11426
+ content type and `nosniff`, and handles range requests. A path no mount's prefix
11427
+ covers reaches your routes.
10879
11428
 
10880
11429
  -
10881
- **Hashed build output.** Pass `buildClient()`'s `assets` as
10882
- `hashedFiles`: those files get `immutable` for a year, and anything
10883
- else in the directory gets one day. Write the build to `outDir: "dist/assets"` so
10884
- a chunk's `/assets/...` URL is also its path under `dist/`.
11430
+ **Hashed build output.** A mount's `prefix` defaults to `/assets`.
11431
+ Pass `buildClient()`'s `assets` as `hashedFiles`: those
11432
+ files get `immutable` for a year, and any other file gets
11433
+ `cacheControl`. A missing file under the prefix is a `404`, never a
11434
+ rendered page.
10885
11435
 
10886
11436
  -
10887
- **Your own files.** A second handler on `public/` serves them at the root,
10888
- with the one-day policy.
11437
+ **Your own files.** A second mount on `public/` serves them at
11438
+ `/`, with `fallthrough: true` so a path it has no file for reaches
11439
+ your routes.
10889
11440
 
10890
11441
  -
10891
- **Where it runs.** Register the handlers with `app.onRequest` inside
10892
- `use`, so a static hit never reaches page rendering.
11442
+ **Files hashed before the build.** The fonts `loadGoogleFont` writes into
11443
+ `public/fonts/` are in no manifest, so the `public/` mount names them
11444
+ with an array of patterns, matched on the encoded URL path, as below. A mount that serves
11445
+ both the build and such files takes a `(path) => boolean` predicate instead,
11446
+ with `assets` as `new Set(build.assets)`:
11447
+ `(path) => assets.has(path) || HASHED_FONT.test(path)`. A global or sticky
11448
+ pattern in the array is used without that flag, so `lastIndex` never skips a
11449
+ match; a predicate runs as written, so keep the patterns it tests free of `g`
11450
+ and `y`.
11451
+
11452
+ ```ts
11453
+ import { ONE_DAY, serveStatic } from "@nifrajs/core/serve-static"
10893
11454
 
10894
- On Node, `serve()` from `@nifrajs/node` can serve the bundle itself before
10895
- the app runs, which keeps the direct request path for everything else:
11455
+ // The fonts loadGoogleFont wrote into public/fonts/ are content-hashed; the rest of public/ is not.
11456
+ const HASHED_FONT = /^\/fonts\/[\w-]+-[0-9a-f]{16}\.woff2$/
11457
+
11458
+ export const publicFiles = serveStatic({
11459
+ dir: new URL("./public/", import.meta.url),
11460
+ prefix: "/",
11461
+ hashedFiles: [HASHED_FONT],
11462
+ cacheControl: ONE_DAY,
11463
+ fallthrough: true,
11464
+ })
11465
+ ```
11466
+
11467
+ On Node and Deno, `serve()` takes the same mounts. On Node they run before the app
11468
+ builds a Web request, which keeps the direct request path for everything else:
10896
11469
 
10897
11470
  ```ts
10898
11471
  // doc-check: skip - fragment: app and build are the createWebApp app and buildClient() output above.
10899
- import { serve } from "@nifrajs/node"
11472
+ import { serve, serveStatic } from "@nifrajs/node" // or "@nifrajs/deno"
10900
11473
 
10901
11474
  await serve(app, {
10902
11475
  port: 3000,
10903
- static: { dir: new URL("./dist/assets/", import.meta.url), hashedFiles: build.assets },
10904
- signals: { drainMs: 8_000 },
11476
+ static: serveStatic({ dir: new URL("./dist/assets/", import.meta.url), hashedFiles: build.assets }),
11477
+ gracefulSignals: { drainMs: 8_000 },
10905
11478
  })
10906
11479
  ```
10907
11480
 
@@ -10972,6 +11545,14 @@ before its own static files on Bun, Node and Deno, and before the Cloudflare wor
10972
11545
  through the worker). Vercel serves files from its CDN before the function runs, so there the policy
10973
11546
  governs pages and the API only.
10974
11547
 
11548
+ -
11549
+ **In your own server.** `static` runs before the app, so a file would skip
11550
+ the policy. Give each mount the check the generated entries use:
11551
+ `
11552
+ allow: (host, pathname) => hostPolicy.allows(host, pathname, buildAssets)
11553
+ `
11554
+ . A path it refuses reaches the app, which applies the policy and answers 404.
11555
+
10975
11556
  -
10976
11557
  **In development.** `nifra dev` serves the bundle and `public/`
10977
11558
  ahead of the app, so only pages and the API are checked there.
@@ -11062,8 +11643,8 @@ running. On Bun, new connections can still arrive during that window, so the loa
11062
11643
  should stop routing to the instance first, as most platforms do before they send
11063
11644
  `SIGTERM`. Keep `drainMs` under your platform's kill grace period:
11064
11645
  `docker stop` waits 10 seconds. `true` uses the default. On Node and
11065
- Deno, pass
11066
- `signals: { drainMs }` to `serve()` instead, as above.
11646
+ Deno, pass the same
11647
+ `gracefulSignals: { drainMs }` to `serve()` instead, as above.
11067
11648
 
11068
11649
  When the platform sends `SIGTERM` without taking the instance out of rotation first,
11069
11650
  add `delayMs`. The stop then runs the app's `onStopping` hooks, keeps
@@ -11081,7 +11662,7 @@ read the app import it, so everything the app does at module scope runs. A comma
11081
11662
  reads what the app declares sets `NIFRA_REFLECT` to its own name first:
11082
11663
  `check`, `routes`, `context`, `openapi`,
11083
11664
  `contracts`, `capabilities`, `manifest`, `doctor`
11084
- , `diff`, `sync-routes`, `sync-manifest`, and
11665
+ , `diff`, `sync-manifest`, and
11085
11666
  `assure` without `--bundle`, `--strict`,
11086
11667
  `--hydration`, `--interact` or `--out`. Commands that send the
11087
11668
  app requests, such as `smoke`, `prove`, `levels` and the
@@ -11144,7 +11725,7 @@ nifra loads this app's copy for every importer:
11144
11725
 
11145
11726
  Packages duplicated the same way are reported as one finding with one combined
11146
11727
  `singleCopy` list. The preload this needs, and the version-skew case it cannot
11147
- cover, are in [Troubleshooting](/docs/troubleshooting).
11728
+ cover, are in Troubleshooting.
11148
11729
 
11149
11730
  ## Nifra - Databases
11150
11731
 
@@ -11333,7 +11914,7 @@ CREATE POLICY tenant_isolation ON notes
11333
11914
 
11334
11915
  The policy is the source of truth; `scoped()` just supplies the identity. Pair it with a
11335
11916
  UUIDv7 `user_id` and an index on it. Connect `c.session.userId` from
11336
- [@nifrajs/better-auth](/docs/auth).
11917
+ @nifrajs/better-auth.
11337
11918
 
11338
11919
  ### Postgres (Raw Driver)
11339
11920
 
@@ -11406,13 +11987,13 @@ Cloudflare D1, Turso/libSQL
11406
11987
  Neon serverless, Postgres over Hyperdrive, Prisma Accelerate
11407
11988
 
11408
11989
  On Cloudflare, bindings like D1 are **typed** through `c.env` - see
11409
- [Edge & bindings](/docs/edge). For Workers MySQL/Postgres, Hyperdrive pools the
11990
+ Edge & bindings. For Workers MySQL/Postgres, Hyperdrive pools the
11410
11991
  connection so a native driver works over the binding.
11411
11992
 
11412
11993
  **Security:** always parameterize (`?` / driver placeholders or an ORM) - never
11413
11994
  string-build SQL from request input. Nifra validates the request body/params at the boundary
11414
11995
  (with `t` or any Standard Schema), so malformed input is rejected before your query
11415
- runs. See [Security](/docs/security).
11996
+ runs. See Security.
11416
11997
 
11417
11998
  Complete runnable references - a typed CRUD API you can diff your own against:
11418
11999
  `examples/db-postgres` (Drizzle + Postgres, embedded PGlite - zero setup) and
@@ -11539,7 +12120,7 @@ patched the server HTML. In development the page reports it to the dev server as
11539
12120
  `Date.now()`, `Math.random()`, locale formatting, reads of
11540
12121
  `window` or `localStorage`, invalid HTML nesting. With happy-dom
11541
12122
  installed in the project, `nifra_hydrate` reproduces it with a stable diagnostic.
11542
- See [hydration](/docs/hydration).
12123
+ See hydration.
11543
12124
 
11544
12125
  #### NIFRA_SCHEMA_PARSE
11545
12126
 
@@ -11602,7 +12183,7 @@ them. Development reports each cookie name once.
11602
12183
  carries the session, or in `keepAlive.ignoreCookies` if it does not. When the
11603
12184
  session is a token in client storage, call `identityChanged()` from
11604
12185
  `@nifrajs/web/client` at sign-in and sign-out. See
11605
- [keep-alive and sign-in](/docs/keep-alive#sign-in).
12186
+ keep-alive and sign-in.
11606
12187
 
11607
12188
  #### NIFRA_KEEPALIVE_DIRECT_CHILD_CSS
11608
12189
 
@@ -11838,6 +12419,77 @@ stylesheet can't redirect the download elsewhere - an SSRF gate), and caps each
11838
12419
  Filenames are derived only from validated tokens plus a content hash, so there's no path
11839
12420
  traversal.
11840
12421
 
12422
+ ## Nifra - Frontend gotchas
12423
+
12424
+ > Version-scoped React, Preact, Solid, Vue, Svelte, and Nifra frontend gotchas exposed through the CLI and MCP.
12425
+
12426
+ Nifra owns the server/client seam, while each frontend framework owns its own reactivity and
12427
+ lifecycle rules. The frontend catalog connects those two layers without pretending Nifra can
12428
+ replace the framework's compiler or linter.
12429
+
12430
+ ### Use the same catalog from every surface
12431
+
12432
+ `nifra frontend` is the human CLI and `nifra_frontend` is the MCP tool. Both
12433
+ select the same entries. Pass `--json` to the CLI, or read the MCP result's `structuredContent`,
12434
+ to receive a stable result with `schemaVersion`, an optional top-level `adapter`, match status,
12435
+ and `entries`. Entries include their `adapters` and may omit framework
12436
+ version ranges, categories, or source URLs.
12437
+
12438
+ ```sh
12439
+ # Browse all entries
12440
+ nifra frontend
12441
+
12442
+ # Search a framework and symptom
12443
+ nifra frontend solid "list reorder state"
12444
+
12445
+ # Give an agent stable JSON with versions and source links
12446
+ nifra frontend vue "watcher never runs" --json
12447
+
12448
+ # The same catalog is available over MCP, as text plus structuredContent
12449
+ nifra_frontend({ adapter: "react", symptom: "hydration mismatch" })
12450
+ ```
12451
+
12452
+ ### What Nifra reports
12453
+
12454
+ -
12455
+ **Shared seam cases:** server-only imports, hydration determinism, typed loader
12456
+ data, duplicate runtimes, and stable list identity.
12457
+
12458
+ -
12459
+ **React and Preact:** effect dependencies and cleanup, hydration browser reads,
12460
+ state identity, compat boundaries, and runtime duplication.
12461
+
12462
+ -
12463
+ **Solid:** tracked reads, props and stores, `For` versus
12464
+ `Index`, and owner cleanup.
12465
+
12466
+ -
12467
+ **Vue:** refs in script, watch sources and traversal, reactive props, and SSR
12468
+ hydration.
12469
+
12470
+ -
12471
+ **Svelte:** runes, keyed each blocks, effect teardown, and browser-only SSR
12472
+ reads.
12473
+
12474
+ -
12475
+ **CSP and browser:** React `Activity` hydration, inline styles under a
12476
+ strict Content-Security-Policy, and WebKit's handling of streamed module scripts. Server-runtime differences are in
12477
+ runtime differences.
12478
+
12479
+ ### Version-sensitive advice
12480
+
12481
+ Ecosystem entries may include the framework versions covered by the advice and link to the
12482
+ framework's documentation. When a major version changes the rule, add a new entry or update
12483
+ the version range with a fixture. Keep high-confidence, statically provable rules in
12484
+ `nifra check`; use this catalog for symptoms that need context or an ecosystem linter.
12485
+
12486
+ ### Contributing a gotcha
12487
+
12488
+ Add a broken and fixed fixture, a symptom users actually report, the exact cause, a safe fix,
12489
+ and an authoritative source. If the issue is Nifra's own boundary, add a check code and a
12490
+ regression test. If it belongs to React, Preact, Solid, Vue, or Svelte, link the ecosystem
12491
+ linter or compiler instead of duplicating its entire rule set.
12492
+
11841
12493
  ## Nifra - Integrations (Stripe, and any npm library)
11842
12494
 
11843
12495
  > Third-party libraries work in Nifra as-is - handlers are plain TypeScript. The Stripe recipe end-to-end: SDK calls in a route, constant-time webhook verification, and idempotent processing.
@@ -11908,7 +12560,7 @@ This is the part teams hand-roll incorrectly. `verifyWebhook` reads the raw body
11908
12560
  bounded (DoS guard), verifies the signature in constant time, checks the timestamp
11909
12561
  tolerance, and only then hands you the payload. Presets exist for Stripe and GitHub, and a
11910
12562
  generic header/encoding form covers any other provider - including key rotation via an
11911
- array of secrets. Details in [security](/docs/security).
12563
+ array of secrets. Details in security.
11912
12564
 
11913
12565
  #### 3. Processing exactly once
11914
12566
 
@@ -11928,7 +12580,7 @@ duplicate while the first is in flight.
11928
12580
 
11929
12581
  ### When to write a plugin
11930
12582
 
11931
- Reach for [a plugin](/docs/plugins) only when a library should participate in
12583
+ Reach for a plugin only when a library should participate in
11932
12584
  the framework itself: contribute typed context to every handler (`c.stripe`, a
11933
12585
  session, a tenant), mount routes of its own, or hook the request lifecycle. That is
11934
12586
  `definePlugin` - a few lines, typed end-to-end. For everything else, an import
@@ -11999,7 +12651,7 @@ Going back and then following a link drops the pages ahead of it, as the browser
11999
12651
  those history entries.
12000
12652
 
12001
12653
  -
12002
- A page left with a [route open in a modal](/docs/routing#modal-routes) over
12654
+ A page left with a route open in a modal over
12003
12655
  it is kept with the modal. Back to that entry shows the page and opens the modal over it
12004
12656
  again.
12005
12657
 
@@ -12022,7 +12674,7 @@ them; reset in `onPageShow` what must start fresh.
12022
12674
 
12023
12675
  -
12024
12676
  Each kept page holds its DOM and its components' memory, at most three per tab. In
12025
- development, the [devtools overlay](/docs/dev#devtools) lists them with their
12677
+ development, the devtools overlay lists them with their
12026
12678
  path, how long each has been hidden and how many elements it renders.
12027
12679
 
12028
12680
  ### Fresh data
@@ -12033,14 +12685,14 @@ nothing below an unchanged value renders again, and form input in a list survive
12033
12685
  `revalidate: false` to skip the reload; an action submitted while the page was
12034
12686
  hidden still reloads it.
12035
12687
 
12036
- A [partially prerendered](/docs/partial-prerendering) page that is kept stops its
12688
+ A partially prerendered page that is kept stops its
12037
12689
  holes while it is hidden: a hole still loading is cancelled on the server, and a reload on its
12038
12690
  way is dropped. When the page comes back each hole reloads in place, its old content marked
12039
12691
  `aria-busy="true"` until the new arrives, with `revalidate: false` too.
12040
12692
  An interactive hole keeps its state through it, in React as well, where
12041
12693
  `<Activity>` cleans the page's effects up while it is hidden.
12042
12694
 
12043
- With [live refresh](/docs/live), a hidden page is not watched. When it comes back,
12695
+ With live refresh, a hidden page is not watched. When it comes back,
12044
12696
  what changed while it was hidden reloads, whatever `revalidate` says, and a grant
12045
12697
  that expired in the meantime is loaded again.
12046
12698
 
@@ -12155,7 +12807,7 @@ export const clock = defineIsland((el) => {
12155
12807
  })
12156
12808
  ```
12157
12809
 
12158
- The [server components](/docs/server-components) of a kept page stay mounted too.
12810
+ The server components of a kept page stay mounted too.
12159
12811
  With `bindComponentRouter` installed, navigation leaves them alone while the page
12160
12812
  is hidden, and the reload of a page that comes back updates them.
12161
12813
 
@@ -12180,7 +12832,7 @@ main section { padding: 2rem; }
12180
12832
 
12181
12833
  In development, the first time a kept page is shown the client reads the page's
12182
12834
  same-origin stylesheets and reports each such selector once, as
12183
- [NIFRA_KEEPALIVE_DIRECT_CHILD_CSS](/docs/errors#keepalive-direct-child-css).
12835
+ NIFRA_KEEPALIVE_DIRECT_CHILD_CSS.
12184
12836
 
12185
12837
  ### Keep-alive and sign-in
12186
12838
 
@@ -12190,7 +12842,25 @@ visitor in or out, the server also rotates a readable epoch cookie (
12190
12842
  with the session cookie's lifetime. A tab that reads a new epoch drops every page it kept and
12191
12843
  tells the other tabs of the origin to do the same. A sign-out by a native form post, or a
12192
12844
  session that expires while the visitor is away, is covered the same way: back compares the
12193
- epoch before it shows a kept page.
12845
+ epoch before it shows a kept page. The page on screen reloads in place at the next render or
12846
+ navigation that reads the new epoch, and shows as it was, pending, until the reload lands. If
12847
+ that reload fails, or a navigation or submit away from the page does, the browser loads the
12848
+ URL as a document in its place, replacing the history entry. Without
12849
+ `installHistory`, the router names that URL in `documentLoad` and
12850
+ keeps what it shows.
12851
+
12852
+ A response that renews the same visitor's session keeps the epoch: a session cookie re-sent
12853
+ with a new lifetime, or an `@nifrajs/auth` session committed again with the same
12854
+ data. Any change to an `@nifrajs/auth` session's data rotates it, in either mode,
12855
+ so a sign-in or sign-out shows even when the session id stays the same. With
12856
+
12857
+ `identity`
12858
+
12859
+ set on `createSessions`, only a change to the keys it names rotates it, and a write
12860
+ to a cart or a preference keeps it. An Auth.js session
12861
+ read writes a new token every time; mounted through `@nifrajs/authjs`, it keeps
12862
+ the epoch when both tokens decrypt and every claim but the times Auth.js renews matches.
12863
+ Auth.js mounted any other way rotates it on each read.
12194
12864
 
12195
12865
  The session cookies of `@nifrajs/auth` and Auth.js count under their default
12196
12866
  names, and Better Auth's under any `cookiePrefix`. Name any other, such as one
@@ -12209,7 +12879,7 @@ export const keepAlive = {
12209
12879
 
12210
12880
  In development, an `HttpOnly` cookie that changes and is in neither list is
12211
12881
  reported once, as
12212
- [NIFRA_KEEPALIVE_IDENTITY_COOKIE](/docs/errors#keepalive-identity-cookie). A flow
12882
+ NIFRA_KEEPALIVE_IDENTITY_COOKIE. A flow
12213
12883
  that changes who is signed in without changing a cookie rotates the epoch itself:
12214
12884
 
12215
12885
  ```ts
@@ -12224,7 +12894,10 @@ export const api = server().post("/switch-account", (c) => {
12224
12894
  ```
12225
12895
 
12226
12896
  When identity lives in client storage, as a bearer token, call `identityChanged()`
12227
- at sign-in and sign-out:
12897
+ at sign-in and sign-out. It also clears every query client, returns every fetcher to idle,
12898
+ and reloads the page on screen in place. A navigation, fetcher load or query fetch still
12899
+ loading loads once more for the new visitor before it settles, and a submit still posting
12900
+ finishes first:
12228
12901
 
12229
12902
  ```ts
12230
12903
  import { identityChanged } from "@nifrajs/web/client"
@@ -12239,6 +12912,14 @@ export function signOut(): void {
12239
12912
  A document the browser puts in its back/forward cache drops its kept pages first, so a
12240
12913
  cached document never carries them.
12241
12914
 
12915
+ `nifra doctor` warns about `keepAlive` routes in an app where nothing
12916
+ names the sign-in cookie: no `identityCookies`, no `identityChanged()`,
12917
+ and no `@nifrajs/auth`, Better Auth or Auth.js reachable. It follows the app's
12918
+ installed and linked dependencies, so an app that reaches Better Auth through a workspace
12919
+ package of its own gets a note naming the chain instead: the default names and Better
12920
+ Auth's `<prefix>.session_token` suffix still cover it, unless that
12921
+ package renames the cookie outright.
12922
+
12242
12923
  ### Limits
12243
12924
 
12244
12925
  -
@@ -12298,7 +12979,7 @@ seed.
12298
12979
  is your own name for a piece of data, such as `post:42`: a letter, then up to
12299
12980
  127 of `A-Z a-z 0-9 . _ : / -`. A frame holds at most 64. A live load returns
12300
12981
  an encrypted grant for its keys beside the data. A hole of a
12301
- [partially prerendered page](/docs/partial-prerendering) declares its own the
12982
+ partially prerendered page declares its own the
12302
12983
  same way, and a change reloads that hole alone.
12303
12984
 
12304
12985
  ```ts
@@ -12987,7 +13668,7 @@ Past 5.0, 5.1 adds one change a frontend on another origin sees. A route with a
12987
13668
  it. List that frontend's origin, or an identity provider's for a
12988
13669
  `form_post` callback, in the `formOrigins` server option (an array of
12989
13670
  exact origins or a function; `@nifrajs/edge` takes it too). JSON bodies are
12990
- unchanged. [Security](/docs/security) covers what the check leaves to
13671
+ unchanged. Security covers what the check leaves to
12991
13672
  `csrf()`.
12992
13673
 
12993
13674
  ### 6. Run the release gates
@@ -13019,7 +13700,7 @@ rest needs a hand:
13019
13700
  longer mounted. An islets `island("id", setup)` becomes
13020
13701
  `bindIsland(setup)` passed to `mountIslands({ id })`, and a
13021
13702
  nano signal is read by calling it (`count()`). See
13022
- [Islands](/docs/islands).
13703
+ Islands.
13023
13704
 
13024
13705
  -
13025
13706
  `withISR` over any store but `MemoryCacheStore` takes a
@@ -13135,8 +13816,8 @@ becomes a return.
13135
13816
  1:1: `.get/.post` + a `t` schema, and an Eden-style typed client. You
13136
13817
  gain Node / Deno / edge portability and an optional SSR frontend on five UI libraries.
13137
13818
 
13138
- Then connect a database ([Database](/docs/database)) and, if you're going
13139
- full-stack, see [Migrating a meta-framework](/docs/migrate-frontend).
13819
+ Then connect a database (Database) and, if you're going
13820
+ full-stack, see Migrating a meta-framework.
13140
13821
 
13141
13822
  ## Nifra - Migrating from Next.js, Nuxt, SvelteKit & SolidStart
13142
13823
 
@@ -13193,26 +13874,26 @@ Nifra's client router - `Link` + hover/focus prefetch, scroll restoration
13193
13874
 
13194
13875
  an action's `revalidate(paths, data, { tags })`, or
13195
13876
  `revalidateEndpoint` for a webhook - see
13196
- [SSG & ISR](/docs/rendering)
13877
+ SSG & ISR
13197
13878
 
13198
13879
  Server Components · `"use client"`
13199
13880
 
13200
- opt-in [server components](/docs/server-components) on all five adapters
13881
+ opt-in server components on all five adapters
13201
13882
 
13202
13883
  Partial prerendering (Cache Components)
13203
13884
 
13204
13885
  a `shellLoader` and holes - see
13205
- [Partial prerendering](/docs/partial-prerendering) (experimental)
13886
+ Partial prerendering
13206
13887
 
13207
13888
  Intercepting routes (`(.)photo`)
13208
13889
 
13209
13890
  a boundary with `{ intercept: "/photos/:id" }` - see
13210
- [Opening a route in a modal](/docs/routing#modal-routes)
13891
+ Opening a route in a modal
13211
13892
 
13212
13893
  `keepalive` in `definePageMeta`
13213
13894
 
13214
13895
  `export const keepAlive = true` - see
13215
- [Keep-alive](/docs/keep-alive)
13896
+ Keep-alive
13216
13897
 
13217
13898
  ### Data loading (Next.js → Nifra + React)
13218
13899
 
@@ -13267,14 +13948,14 @@ app.
13267
13948
  **Much faster SSR** - the current dynamic-page snapshot reports Nifra at
13268
13949
  15× the throughput of Next.js, 7.2× Nuxt, and
13269
13950
  3.9× SvelteKit / 2.2× SolidStart, with a fraction
13270
- of the client JavaScript. See [benchmarks](/benchmarks).
13951
+ of the client JavaScript. See benchmarks.
13271
13952
 
13272
13953
  -
13273
13954
  **End-to-end types with no codegen**, the same app on Bun / Node / Deno / the edge, and a
13274
- backend you can also ship on its own. Start with [Getting started](/docs).
13955
+ backend you can also ship on its own. Start with Getting started.
13275
13956
 
13276
13957
  Moving a backend (Express, Hono, Fastify, Elysia) instead? See
13277
- [Migrating a backend](/docs/migrate-backend).
13958
+ Migrating a backend.
13278
13959
 
13279
13960
  ## Nifra - Migrate route by route
13280
13961
 
@@ -13302,7 +13983,7 @@ app. Mount before the plugin when the legacy app keeps its own auth.
13302
13983
  A mounted fetch handler carries HTTP only. A WebSocket upgrade under the mount reaches it as
13303
13984
  an ordinary request and never becomes a socket, so keep the legacy app's sockets on its own
13304
13985
  server until they move to `app.ws()` routes (see
13305
- [WebSockets in a composed app](/docs/websockets#composed)).
13986
+ WebSockets in a composed app).
13306
13987
 
13307
13988
  ```ts
13308
13989
  import { Hono } from "hono"
@@ -13513,7 +14194,7 @@ No span carries a request body, a job payload, an event payload, a raw cache key
13513
14194
  Without a tracer configured, the cache and the queue run the code they ran before: no clock
13514
14195
  reads, no events, no extra frames.
13515
14196
 
13516
- ## Nifra - Partial prerendering (experimental)
14197
+ ## Nifra - Partial prerendering
13517
14198
 
13518
14199
  > Serve a page's shared frame from a cached shell at once, then stream each per-visitor part as its own loader settles. Shared holes, server components in holes, a store shared by processes, Deno and Workers, eligibility rules, the no-JavaScript limit, proxies and connection limits.
13519
14200
 
@@ -13521,9 +14202,6 @@ Most of a product page is the same for everyone: the title, the description, the
13521
14202
  partially prerendered route serves that part from a cached shell at once, then streams each
13522
14203
  per-visitor part, a hole, into it as its own loader settles.
13523
14204
 
13524
- [!WARNING] Experimental. It is enabled through `experimental.ppr`, and its API may
13525
- change in any release.
13526
-
13527
14205
  ### Set it up
13528
14206
 
13529
14207
  `compileShells` bundles each route's shell and refuses one whose emitted code
@@ -13561,9 +14239,7 @@ export const app = createWebApp({
13561
14239
  csp: createCspPolicy({
13562
14240
  header: ({ sources }) => `script-src 'self' ${sources}; object-src 'none'; base-uri 'none'`,
13563
14241
  }),
13564
- experimental: {
13565
- ppr: partialPrerendering({ shellChecks, origin: "https://shop.example" }),
13566
- },
14242
+ ppr: partialPrerendering({ shellChecks, origin: "https://shop.example" }),
13567
14243
  })
13568
14244
  ```
13569
14245
 
@@ -13764,7 +14440,14 @@ largest timeout plus one second, at most 30 seconds.
13764
14440
 
13765
14441
  -
13766
14442
  A layout above it may have a loader only as a `gate`: the gate runs to redirect
13767
- or refuse, and its data reaches no response. Intercepting boundaries are not supported.
14443
+ or refuse, and its data reaches no response.
14444
+
14445
+ -
14446
+ A route may declare an intercepting boundary (a
14447
+ modal route) beside its holes. It is not a hole and
14448
+ is not counted against the limit above. The shell carries it unresolved; a client
14449
+ navigation to its URL opens the target over the page, which stays mounted with its holes
14450
+ filled.
13768
14451
 
13769
14452
  -
13770
14453
  `shellVariations` lists closed sets of query values that each select their own
@@ -14134,6 +14817,157 @@ await invalidate({ tags: ["catalog"] }) // shells listing "catalog" are rebuilt
14134
14817
  console.log(shells.stats()) // admitted, denied and shed holes, aborted slow readers, unsent bytes
14135
14818
  ```
14136
14819
 
14820
+ ## Nifra - Runtime differences
14821
+
14822
+ > Where Bun, Node, Deno and Cloudflare Workers behave differently under the same Nifra app, with the fix and the Nifra option that decides it, exposed through the CLI and MCP.
14823
+
14824
+ Nifra runs the same `app.fetch(Request): Response` on Bun, Node, Deno and Cloudflare
14825
+ Workers. The runtimes underneath do not behave identically, and none of the differences below
14826
+ is Nifra's doing: they come from the runtimes and their engines. Where Nifra has a switch
14827
+ that decides which behavior an app gets, the entry names it.
14828
+
14829
+ ### Use the same catalog from every surface
14830
+
14831
+ `nifra runtime` is the human CLI and `nifra_runtime` is the MCP tool. Both
14832
+ read one catalog. Each entry records what you observe, what each runtime does, the fix, how to
14833
+ verify it on your own runtime, and the versions it was measured on (Bun 1.4.4, Node 26.12 and
14834
+ Deno 2.9.8 unless it says otherwise).
14835
+
14836
+ ```sh
14837
+ # Browse every difference
14838
+ nifra runtime
14839
+
14840
+ # Filter by runtime, and search by what you observe
14841
+ nifra runtime deno "path guard skipped"
14842
+
14843
+ # Stable JSON for an agent, with versions and categories
14844
+ nifra runtime node "pipelined requests" --json
14845
+
14846
+ # The same catalog over MCP, as text plus structuredContent
14847
+ nifra_runtime({ runtime: "bun", symptom: "env var undefined" })
14848
+ ```
14849
+
14850
+ ### Requests
14851
+
14852
+ entry
14853
+ what differs
14854
+ Nifra switch
14855
+
14856
+ `dot-segment-targets`
14857
+
14858
+ Bun and Workers hand over a resolved URL, so `/public/../admin` arrives as
14859
+ `/admin`; Deno and Node hand over the target as sent.
14860
+
14861
+ `normalizeTarget`
14862
+
14863
+ `host-builds-url`
14864
+
14865
+ Deno builds `Request.url` from the Host it received, so a Host holding
14866
+ `/` or `#` changes the routed path; Bun leaves the URL relative;
14867
+ `@nifrajs/node` answers 400.
14868
+
14869
+ `validateHost`
14870
+
14871
+ `missing-or-repeated-host`
14872
+
14873
+ No Host: a relative URL on Bun, `http://localhost/…` through
14874
+ `@nifrajs/node`, `http://localhost:port/…` on Deno. Two Host lines:
14875
+ Bun uses the first, `@nifrajs/node` and Deno answer 400.
14876
+
14877
+ `validateHost`
14878
+
14879
+ `pipelined-requests`
14880
+
14881
+ Node runs every pipelined request's handler at once (30 of 30 in the probe); Bun and
14882
+ Deno run one per connection.
14883
+
14884
+ `requestTimeoutMs`, proxy limits
14885
+
14886
+ ```ts
14887
+ import { server } from "@nifrajs/core"
14888
+ import { serve } from "@nifrajs/node"
14889
+
14890
+ // Deno (and Bun's Host handling): the Host header and the request target are checked and resolved.
14891
+ const app = server({ validateHost: true, normalizeTarget: true })
14892
+
14893
+ // Node: the adapter has the same normalizeTarget switch.
14894
+ await serve(app, { port: 3000, normalizeTarget: true })
14895
+ ```
14896
+
14897
+ Both switches are off by default because checking costs throughput: about 6% of a bare route
14898
+ for Host validation on Bun, and about 3% for target normalization on Deno. Turn on target
14899
+ normalization when upstream guards and proxies apply a different path policy, or when your path
14900
+ guards run after Nifra normalizes the target. Turn on Host validation when the app builds URLs
14901
+ from the Host header.
14902
+
14903
+ ### Responses and the language
14904
+
14905
+ entry
14906
+ what differs
14907
+
14908
+ `json-content-type`
14909
+
14910
+ `Response.json` sends `application/json;charset=utf-8` on Bun and
14911
+ `application/json` on Node and Deno, and Nifra keeps each runtime's value.
14912
+
14913
+ `engine-error-messages`
14914
+
14915
+ Bun is JavaScriptCore; Node and Deno are V8. `JSON.parse`, `new URL`
14916
+ and null reads word their errors differently, so match on the class or a code.
14917
+
14918
+ `deep-recursion`
14919
+
14920
+ Bun runs `return f()` as a tail call (200,000 deep returned); Node and Deno
14921
+ overflow between 9,000 and 20,000 frames.
14922
+
14923
+ ### Process, files and the edge
14924
+
14925
+ entry
14926
+ what differs
14927
+
14928
+ `dotenv-autoload`
14929
+
14930
+ Bun loads `.env` at startup; Node and Deno need `--env-file`.
14931
+
14932
+ `spawn-env`
14933
+
14934
+ `Bun.spawn` without `env` ignores `process.env` changes made
14935
+ after startup.
14936
+
14937
+ `glob-symlinks`
14938
+
14939
+ `Bun.Glob` skips symlinks unless `followSymlinks: true`.
14940
+
14941
+ `workerd-node-builtins`
14942
+
14943
+ Which `node:` builtins a Worker gets without `nodejs_compat` depends on
14944
+ its `compatibility_date`.
14945
+
14946
+ ### Frontend frameworks and browsers
14947
+
14948
+ The browser side has the same property: the behavior belongs to React or the
14949
+ browser, and Nifra only sits on top of it. Those entries live in the
14950
+ frontend gotchas catalog (`nifra frontend`),
14951
+ next to the per-framework reactivity cases:
14952
+
14953
+ -
14954
+ `react-activity-markers`: React 19.3.1 hangs hydrating an `<Activity>`
14955
+ whose boundary comments are missing from the server HTML.
14956
+
14957
+ -
14958
+ `csp-inline-style-attribute`: what a strict Content-Security-Policy does to inline
14959
+ `style` attributes, and the `<slot>` wrapper that avoids it.
14960
+
14961
+ -
14962
+ `webkit-streamed-modules`: WebKit runs module scripts of a streamed document only
14963
+ after the parser ends.
14964
+
14965
+ ### Keeping it true
14966
+
14967
+ A runtime release can change any entry. The catalog test checks the Bun claims for JSON parsing, JSON content type, recursion depth and
14968
+ URL errors against the Bun it runs on; the other entries are recorded observations. To add or fix an entry, reproduce it on
14969
+ each runtime, record the versions, and keep the cause to what the runtime does.
14970
+
14137
14971
  ## Nifra security posture vs Hono, Fastify, Express, Elysia
14138
14972
 
14139
14973
  > A dimension-by-dimension security comparison of Nifra against the current releases of Hono, Fastify, Express, and Elysia - which hardening each framework ships by default, which is opt-in, and which is left to third-party packages.
@@ -14141,7 +14975,7 @@ console.log(shells.stats()) // admitted, denied and shed holes, aborted slow rea
14141
14975
  Which hardening each framework actually ships. A dimension-by-dimension read of Nifra's
14142
14976
  security defaults against the **current releases** of Hono, Fastify, Express, and Elysia -
14143
14977
  what is on by default, what is opt-in, and what is left to a third-party package. For how each
14144
- Nifra primitive works, see [Security & hardening](/docs/security).
14978
+ Nifra primitive works, see Security & hardening.
14145
14979
 
14146
14980
  ### The honest verdict
14147
14981
 
@@ -14548,8 +15382,81 @@ claim; Express's ubiquity means every hire already knows it. Nifra's argument is
14548
15382
  narrower and honest: it makes the dangerous configurations _unrepresentable_, ships the
14549
15383
  hardening primitives first-party, and lets `nifra assure` prove in CI that every
14550
15384
  route is guarded. For the full capability and throughput comparison, see
14551
- [vs other frameworks](/docs/comparison) and the
14552
- [per-framework pages](/compare).
15385
+ vs other frameworks and the
15386
+ per-framework pages.
15387
+
15388
+ ## Nifra - Security testing
15389
+
15390
+ > Security invariants, mutation testing, adversarial inputs, and runtime differential checks in Nifra.
15391
+
15392
+ Nifra treats security claims as executable invariants. A rule is useful only when a hostile
15393
+ input, a deliberate mutation, or a recovery fault would make a test fail if the protection
15394
+ disappeared.
15395
+
15396
+ ### One invariant, several kinds of evidence
15397
+
15398
+ `security-invariants.json` is the index for the repository's security claims. Each
15399
+ entry names the behavior, regression tests, mutation targets, and documentation that explain
15400
+ it. `bun run check:security-invariants` fails when a referenced test or target is
15401
+ removed, so the index cannot silently become a list of aspirations.
15402
+
15403
+ The ledger is intentionally separate from an application's secrets and tenant data. Add a
15404
+ reduced public regression fixture for a real finding; keep private application details in the
15405
+ private test suite.
15406
+
15407
+ ### Mutation testing
15408
+
15409
+ Mutation testing changes one condition, operator, return value, or statement at a time. A
15410
+ security target passes only when its tests kill every meaningful mutant. A surviving mutant
15411
+ needs a regression test or an explicit equivalence explanation in
15412
+ `mutation-equivalents.json`; adding a survivor to a baseline is a temporary record,
15413
+ not proof of safety.
15414
+
15415
+ ```sh
15416
+ # Validate every invariant has executable evidence
15417
+ bun run check:security-invariants
15418
+
15419
+ # Run the fast changed-line mutation report
15420
+ bun scripts/mutate.ts --changed
15421
+
15422
+ # Run a selected security target locally
15423
+ bun scripts/mutate.ts --target core-capabilities --gate
15424
+
15425
+ # Build artifacts required by the Node, Deno, and workerd lanes
15426
+ bun run build
15427
+
15428
+ # Exercise hostile requests across supported runtimes
15429
+ bun run check:runtime-differential
15430
+ ```
15431
+
15432
+ ### What to test at a security boundary
15433
+
15434
+ -
15435
+ **Authorization:** denial happens before the handler, database write, or side
15436
+ effect; ownership is checked for the requested resource.
15437
+
15438
+ -
15439
+ **Replay and recovery:** repeated idempotency keys do not repeat effects, and an
15440
+ uncertain commit becomes an explicit reconciliation state.
15441
+
15442
+ -
15443
+ **Input limits:** raw and multipart bodies stop at their read budget, malformed
15444
+ encodings are rejected, and prototype-pollution keys cannot alter output objects.
15445
+
15446
+ -
15447
+ **Data boundaries:** response projection strips fields, errors redact provider
15448
+ details, and server-only imports cannot reach browser chunks.
15449
+
15450
+ -
15451
+ **Runtime parity:** Bun, Node, Deno, and Workers agree on rejection status,
15452
+ headers, redaction, and side-effect behavior for the same hostile request.
15453
+
15454
+ ### Adding a new edge case
15455
+
15456
+ Start with the smallest reproduction that proves the failure. Give it a stable diagnostic or
15457
+ test name, add the fixed behavior to the relevant invariant, add a mutation that would remove
15458
+ the guard when practical, and document the trigger, consequence, fix, and verification
15459
+ command. This keeps the docs, CLI, MCP, and test suite growing from evidence.
14553
15460
 
14554
15461
  ## Nifra - Project structure
14555
15462
 
@@ -14585,9 +15492,8 @@ Reaches the browser
14585
15492
  `routes/x.tsx` (`.svelte`, `.vue`, `.mdx`)
14586
15493
 
14587
15494
  a page: the component, `meta`,
14588
- [
15495
+
14589
15496
  `keepAlive`
14590
- ](/docs/keep-alive)
14591
15497
 
14592
15498
  yes
14593
15499
 
@@ -14596,7 +15502,7 @@ yes
14596
15502
  that page's `loader`, `action`, `loaderOutput`,
14597
15503
  `actionOutput`, `hydrate`, `revalidate`,
14598
15504
  `shellLoader` and `boundaryLoaders` (a
14599
- [partially prerendered](/docs/partial-prerendering) page),
15505
+ partially prerendered page),
14600
15506
  `middleware` (in `_layout.backend.ts`)
14601
15507
 
14602
15508
  never
@@ -14709,7 +15615,7 @@ Those commands, the contract lock and the route lints see only what
14709
15615
  same app from `backend/app.ts` built with stand-in dependencies, so every operation
14710
15616
  is visible without a database or secrets; `nifra check` names an implemented
14711
15617
  operation it does not serve (NF-C039). See
14712
- [the stand-in entry](/docs/types-first#stub-entry).
15618
+ the stand-in entry.
14713
15619
 
14714
15620
  ### A route is two files
14715
15621
 
@@ -14758,7 +15664,9 @@ and `Route.ComponentProps` types `data` as exactly what
14758
15664
  `loaderOutput` lets through. `nifra dev`, `nifra build`,
14759
15665
  `nifra check` and `nifra types` write these files under
14760
15666
  `.nifra/types`; the app's `tsconfig.json` resolves them with
14761
- `"rootDirs": [".", "./.nifra/types"]`.
15667
+ `"rootDirs": [".", "./.nifra/types"]`. The same directory holds
15668
+ `routes.d.ts`, one entry per URL pattern with its params and search output, and
15669
+ every generated `./+types` module loads it.
14762
15670
 
14763
15671
  ### What may import what
14764
15672
 
@@ -14902,9 +15810,9 @@ Whether it catches _undeclared extra_ fields depends on your validator, not on n
14902
15810
  strict schema (`@nifrajs/schema`'s `t.object`) reports them and the
14903
15811
  test fails, while a stripping one (Zod, Valibot) accepts them silently. To catch extras
14904
15812
  regardless, or to stop them reaching the wire in production, use
14905
- [
15813
+
14906
15814
  `responseContract`
14907
- ](/docs/security)
15815
+
14908
15816
  .
14909
15817
 
14910
15818
  ### Opaque schemas stay validator-neutral
@@ -15179,7 +16087,7 @@ more than one service, declare it with `defineContract` and connect handlers wit
15179
16087
  `implement`. That keeps the contract type available without importing a server
15180
16088
  implementation into the client.
15181
16089
 
15182
- See [Framework contract](/docs/contract) for the decoupled form and its scaling
16090
+ See Framework contract for the decoupled form and its scaling
15183
16091
  guidance.
15184
16092
 
15185
16093
  The tooling reads the backend `backend/app.ts` exports. An app that
@@ -15247,7 +16155,7 @@ would refuse: backend code in a page, or a server package in browser code.
15247
16155
  -
15248
16156
  Validation only covers what you put in a schema. A raw-body, file-upload, or
15249
16157
  bring-your-own-validation route reads the body directly - cap and validate those yourself
15250
- (see [Security](/docs/security)'s `c.boundedBody`).
16158
+ (see Security's `c.boundedBody`).
15251
16159
 
15252
16160
  -
15253
16161
  The typed client infers from the server _type_, so it needs an
@@ -15353,9 +16261,18 @@ rewriting requests inside the executor: `witnesses`, `prepareRequest`,
15353
16261
  `isRejected`, `include` and `maxMutationsPerInput` on
15354
16262
  `invariants` reach every L4 run, from `nifra levels` and the
15355
16263
  `nifra_levels` MCP tool alike. `setup` provisions a throwaway target only
15356
- when L4 runs: it is called once, before the first L4 request, and its `teardown`
15357
- always runs after the run, a failing one included. The example keeps its target in memory; a
15358
- database or container belongs in your own `setup`.
16264
+ when L4 runs: it is called once, before the run generates its first case, and its
16265
+ `teardown` always runs after the run, a failing one included. What a success
16266
+ witness must name often exists only once the target is up - a real slug, a row id, a
16267
+ signed-in session - so `setup` may return `witnesses` and
16268
+ `prepareRequest` too. Its witnesses are merged over the static ones, a
16269
+ `"METHOD /path"` in both taking the setup's, and validated the same way; its
16270
+ `prepareRequest` replaces the static one. `nifra levels` lists the
16271
+ witnesses that came from `setup` under L4, and the `nifra_levels` result
16272
+ carries them as `setupWitnesses`. A harness that runs L4 itself merges a setup
16273
+ result with `applyInvariantSetup` from `@nifrajs/core/assurance`. The
16274
+ example keeps its target in memory; a database or container belongs in your own
16275
+ `setup`.
15359
16276
 
15360
16277
  ```ts
15361
16278
  // nifra.assurance.ts
@@ -15367,18 +16284,21 @@ export default defineAssuranceConfig({
15367
16284
  source: createBackend({ rows: new Map() }),
15368
16285
  policy: { rules: [/* ... */] },
15369
16286
  invariants: {
15370
- // Called once, before the first L4 request - never when this file is imported, so
16287
+ // Called once per L4 run, before its first case - never when this file is imported, so
15371
16288
  // `nifra check` and `nifra assure` provision nothing.
15372
16289
  setup: async () => {
15373
- const rows = new Map([["row_1", { id: "row_1", owner: "fixture" }]])
16290
+ const id = crypto.randomUUID()
16291
+ const rows = new Map([[id, { id, owner: "fixture" }]])
15374
16292
  const target = createBackend({ rows })
15375
16293
  return {
15376
16294
  executor: (request) => target.fetch(request),
16295
+ // Names the row this run created, so no executor rewrites a placeholder id.
16296
+ witnesses: { "PATCH /rows/:id": { params: { id }, body: { title: "ok" } } },
15377
16297
  teardown: () => rows.clear(), // runs after a failing run too
15378
16298
  }
15379
16299
  },
15380
- // Known-good inputs for schemas L4 cannot synthesize (an opaque validator, a real id).
15381
- witnesses: { "PATCH /rows/:id": { params: { id: "row_1" }, body: { title: "ok" } } },
16300
+ // Known-good inputs for schemas L4 cannot synthesize, when they are known up front.
16301
+ witnesses: { "POST /rows": { body: { title: "ok" } } },
15382
16302
  // Attach what the app needs on every case: a session, a signed token.
15383
16303
  prepareRequest: (request) => {
15384
16304
  const headers = new Headers(request.headers)
@@ -16864,6 +17784,13 @@ closes; `maxPending` (default 32) still bounds how many can wait. `NifraBackend`
16864
17784
  denies, so the shorter of the two applies. A never-expiring approval reports `expiresAt` as
16865
17785
  `APPROVAL_NEVER_EXPIRES_AT`, which survives JSON and stays later than any `Date.now()`.
16866
17786
 
17787
+ A `NativeApprovalPort` may also `review` a call before anyone is asked: `{ decision: "allow" }`
17788
+ runs it, `{ decision: "deny", reason }` refuses it with `REVIEW_DENIED` and a reason the model
17789
+ reads, and `{ decision: "ask" }` raises the approval as usual. Any other answer, a throw, or a
17790
+ review still unsettled after `reviewTimeoutMs` (default 30 s, at most 10 minutes) asks; an abort
17791
+ during a review stops the turn. Review answers are host-owned like approvals, but an allow or a
17792
+ deny emits no approval events, so a host that needs an audit trail records its own reviews.
17793
+
16867
17794
  `nifra-agent` loads `.nifra/extensions/**` from `--cwd` only when started with
16868
17795
  `--extensions`. An extension module's top-level code runs as soon as it is
16869
17796
  imported, before its declared `capabilities` are checked, so pass the flag only
@@ -17093,9 +18020,13 @@ route. Split groups before the compiler reports `TS2589`, rather than weakening
17093
18020
  concurrency, filters, cancellation, and token-only metrics. A worker invocation always terminates.
17094
18021
  - **`bigint` in plain JSON.** A JSON answer writes a `bigint` as its decimal string
17095
18022
  (`{ "id": "9007199254740993" }`) instead of failing with a 500, and the typed client reads a
17096
- `string`. A `Uint8Array` is base64 only where the response schema declares `t.bytes()` from
17097
- `@nifrajs/schema`; elsewhere it is the `{ "0": 1, ... }` object `JSON.stringify` writes, and a
17098
- Node `Buffer` is the `{ "type": "Buffer", "data": [...] }` its `toJSON` writes.
18023
+ `string`. A `BigInt` wrapper object (`Object(1n)`) is not a `bigint`: its answer fails with a 500.
18024
+ One moved onto `Object.prototype` is written as `{}` instead by Bun in an answer that holds no
18025
+ `Date`, and one moved onto any plain or `null` prototype is written as `{}` on every runtime when a
18026
+ plain `Date` sits on the answer's first row. A `Uint8Array` is base64 only where the response
18027
+ schema declares `t.bytes()` from `@nifrajs/schema`; elsewhere it is the `{ "0": 1, ... }` object
18028
+ `JSON.stringify` writes, and a Node `Buffer` is the `{ "type": "Buffer", "data": [...] }` its
18029
+ `toJSON` writes.
17099
18030
  - **Rich wire values (opt in).** `@nifrajs/core/wire` round-trips dates, bigints, maps, sets, binary,
17100
18031
  shared references, and cycles through JSON transports. Decoding validates every reachable shape,
17101
18032
  preserves owned `__proto__` keys without prototype mutation, and enforces configurable node, depth,
@@ -17147,7 +18078,8 @@ contract-first registry.
17147
18078
  `responseContract("enforce")` before the routes it should cover to validate JSON/status payloads and
17148
18079
  prevent extra fields from reaching the wire. That covers a `status(...)` or `c.json(...)` reply a
17149
18080
  handler returns or throws, a hook returns, or `onError` answers with. `warn` preserves the original
17150
- payload during migration.
18081
+ payload during migration. The contract judges what JSON writes: a `toJSON` hook's output, and a
18082
+ `Date` as its ISO string, so a timestamp column declares `t.date()` and may hold the `Date`.
17151
18083
  Raw `Response`, streams, redirects, and `mountFetch` remain explicit transport escape hatches and
17152
18084
  must be governed by assurance/static review.
17153
18085
 
@@ -17257,10 +18189,40 @@ a Bun-`listen()`-style graceful `stop()` and opt-in signals.
17257
18189
  ## Graceful shutdown on signals
17258
18190
 
17259
18191
  ```ts
17260
- await serve(app, { port: 3000, signals: true }) // SIGTERM/SIGINT → graceful stop()
17261
- await serve(app, { port: 3000, signals: { drainMs: 8_000 } }) // the same, with an 8 s drain window
18192
+ await serve(app, { port: 3000, gracefulSignals: true }) // SIGTERM/SIGINT → graceful stop()
18193
+ await serve(app, { port: 3000, gracefulSignals: { drainMs: 8_000 } }) // the same, with an 8 s drain window
18194
+ ```
18195
+
18196
+ ## Files ahead of the app
18197
+
18198
+ ```ts
18199
+ await serve(app, {
18200
+ port: 3000,
18201
+ static: (req) =>
18202
+ new URL(req.url).pathname === "/robots.txt" ? new Response("User-agent: *\n") : undefined,
18203
+ })
18204
+ ```
18205
+
18206
+ `static` sees every request before the app does, so a file it answers wins over any route at the
18207
+ same path. It returns a response, or `undefined` (or a promise of one) to let the app route the
18208
+ request. No hook of the app runs for a request it answers, and a throw answers a plain `500`.
18209
+
18210
+ `serveStatic` builds one for files on disk, read with Deno's own file API:
18211
+
18212
+ ```ts
18213
+ import { serve, serveStatic } from "@nifrajs/deno"
18214
+
18215
+ await serve(app, { port: 3000, static: serveStatic({ dir: new URL("./assets/", import.meta.url) }) })
17262
18216
  ```
17263
18217
 
18218
+ It takes one mount or a list, with the same options as Bun's `@nifrajs/core/serve-static` and
18219
+ `@nifrajs/node`'s: `dir`, `prefix` (default `/assets`), `immutable`, `hashedFiles` (paths, RegExps or
18220
+ a predicate), `cacheControl`, `files`, `allow`, `headers`, `dotfiles` and `fallthrough`. A path
18221
+ under a mount's prefix that it cannot serve answers 404 (400 malformed, 403 traversing) unless the
18222
+ mount sets `fallthrough: true`, which hands it to the next mount and then the app. Run Deno with
18223
+ `--allow-read` for the served directories. The server that `nifra build --target deno` emits serves
18224
+ its client bundle and public files this way.
18225
+
17264
18226
  ## Client disconnect and `c.req.signal`
17265
18227
 
17266
18228
  `Deno.serve` aborts a request's `signal` when the client goes away and, by default, also once a
@@ -18214,10 +19176,8 @@ Each layer refuses on its own, in this order:
18214
19176
 
18215
19177
  1. **Host.** Only loopback, `*.localhost` and unix sockets connect unless `allowHosts` names the host.
18216
19178
  URL parameters other than host, port, user, password, database and `sslmode` are ignored.
18217
- 2. **Tokenizer.** One SELECT, WITH, VALUES or TABLE statement; row-locking clauses, unicode-escaped
18218
- identifiers, functions that reach outside a query (server files, `dblink`, `set_config`, advisory
18219
- locks, `pg_notify`, `nextval`, backend signals) and functions that run SQL from a string the plan
18220
- check cannot see (`query_to_xml`, `ts_stat`, `ts_rewrite`, `crosstab`, `connectby`) are refused.
19179
+ 2. **Tokenizer.** One SELECT, WITH, VALUES or TABLE statement; row-locking clauses and
19180
+ unicode-escaped identifiers are refused.
18221
19181
  3. **Read-only transaction.** `BEGIN READ ONLY` with `statement_timeout`, `lock_timeout` and
18222
19182
  `idle_in_transaction_session_timeout` set to `timeoutMs`, always rolled back. Sessions also start
18223
19183
  with `default_transaction_read_only = on`.
@@ -18225,21 +19185,50 @@ Each layer refuses on its own, in this order:
18225
19185
  role that may execute server-file functions is refused (`NIFRA_DB_SUPERUSER`). A role that can use
18226
19186
  dblink, postgres_fdw, file_fdw or an untrusted language is refused (`NIFRA_DB_EXTENSION`) unless
18227
19187
  `allowExtensions` names it.
18228
- 5. **Cursor.** The statement runs as one extended-protocol `DECLARE ... NO SCROLL CURSOR`, which the
19188
+ 5. **Grant gate.** The role itself must be unable to read what the declaration hides: a column
19189
+ `redaction.column` matches, an `exclude`d table or one inheriting from it, and a view or
19190
+ materialized view that reads any of those or reaches outside `schemas`. A role that can is refused
19191
+ (`NIFRA_DB_ROLE_GRANTS`), so the database's privileges refuse such a read even where no plan shows
19192
+ it: inside a function's body, or from the rows a materialized view stores. Nor may the role execute
19193
+ a SECURITY DEFINER function, or an aggregate over one, unless `allowFunctions` names it: such a
19194
+ function reads with its owner's rights wherever a query reaches it, through an operator, a cast, a
19195
+ view folded at plan time or another function's body, and only
19196
+ the EXECUTE privilege is checked on every one of those paths. Either refusal names each grantee the
19197
+ role holds the privilege through.
19198
+ 6. **Function allowlist.** Every function the statement names, and every one its plan calls (inside
19199
+ views too), is looked up in `pg_proc`, each overload the name can resolve to. A built-in or
19200
+ extension function must be immutable or stable and parallel safe (a few value-only ones such as
19201
+ `random()`, `clock_timestamp()` and `pg_total_relation_size()` pass as well); one the database
19202
+ defines must be immutable or stable; none may be SECURITY DEFINER. Anything else is refused
19203
+ (`NIFRA_DB_FUNCTION_REFUSED`) unless `allowFunctions` names it, so a function added in a later
19204
+ Postgres release is refused until it is known to be safe. The names are checked before the server
19205
+ plans the statement, since planning already runs immutable functions on constants.
19206
+ 7. **Cursor.** The statement runs as one extended-protocol `DECLARE ... NO SCROLL CURSOR`, which the
18229
19207
  server accepts only for SELECT and VALUES and refuses for a data-modifying WITH, then one `FETCH`
18230
19208
  of `maxRows + 1` rows.
18231
- 6. **Plan scope.** Every relation in the `EXPLAIN (VERBOSE)` plan, every table it inherits from, and
19209
+ 8. **Plan scope.** Every relation in the `EXPLAIN (VERBOSE)` plan, every table it inherits from, and
18232
19210
  every `pg_catalog` function scanned in FROM must sit in `schemas` (default `public`) and outside
18233
19211
  `exclude`. With `redaction`, a column `redaction.column` matches that any plan expression uses
18234
19212
  (output, filter, join, sort or index condition), or a whole row holding one, is refused
18235
19213
  (`NIFRA_DB_COLUMN_REFUSED`). A plan names a scan's columns by the table's column alias list
18236
19214
  (`FROM users AS t(a, b)`), so while any relation the query reads holds a matching column, a query
18237
- that gives a table one is refused as well.
19215
+ that gives a table one is refused as well. This is the second line behind the grant gate.
18238
19216
 
18239
19217
  `explainPostgres` returns the plan (with `analyze`, executed inside the same transaction),
18240
19218
  `readPostgresSchema` reads tables, columns, keys and indexes from `pg_catalog`, and `postgresRoleSql`
18241
- writes the SQL for a read-only role (`GRANT SELECT` on each allowed schema, with a `REVOKE` for each
18242
- excluded table and its partitions) without running it.
19219
+ writes the SQL for the role the grant gate accepts, without running it: `GRANT USAGE` on each allowed
19220
+ schema and `GRANT SELECT` on all tables in each allowed schema; a `REVOKE` for each excluded table,
19221
+ its partitions and children, and each view or materialized view that reads hidden data; and, for a
19222
+ table with a masked column (pass the same `redaction`), a `REVOKE` followed by a column-level `GRANT`
19223
+ of its other columns. Run it again after adding a table or view: default privileges grant every
19224
+ column of a new one. A privilege reaches a role through PUBLIC, a grant to the role itself, or a role
19225
+ whose privileges it has, and a `REVOKE` from one leaves the others. So a grant that would still
19226
+ expose hidden data, to PUBLIC or (for a role that exists) to a role it inherits from, is listed in
19227
+ comments with its `REVOKE`, and so is each SECURITY DEFINER function the role may execute, grantee by
19228
+ grantee (pass the same `allowFunctions` to skip the ones you trust). Only a grant to the role itself
19229
+ is revoked by a statement; the rest are comments because they reach other roles. The grant gate's
19230
+ refusal names the same grantees. A query that names a column the role may not read is
19231
+ refused with `NIFRA_DB_COLUMN_REFUSED`, naming the columns it may.
18243
19232
 
18244
19233
  The live tests run against a throwaway server: set `NIFRA_TEST_POSTGRES_URL` to its superuser URL.
18245
19234
 
@@ -18467,7 +19456,21 @@ authority. If neither option is set, treat the host in `request.url` as client-c
18467
19456
 
18468
19457
  ## Static files
18469
19458
 
18470
- The optional `static` root is served before `app.fetch` for GET and HEAD requests. It is a
19459
+ `static` sees every request before `app.fetch`, as it does on Bun's `app.listen()` and
19460
+ `@nifrajs/deno`'s `serve()`: a function from the Web `Request` to the file's `Response`, or
19461
+ `undefined` to let the app route it. `static: serveStatic({ dir })` serves a directory for GET and
19462
+ HEAD requests, and this adapter runs it on Node's own request, so every other request keeps the
19463
+ app's direct lane. Any other function needs a Web `Request` for every request, which roughly
19464
+ doubles the cost of a small route.
19465
+
19466
+ `serveStatic` takes one mount or a list, with the same options as Bun's
19467
+ `@nifrajs/core/serve-static` and `@nifrajs/deno`'s: `dir`, `prefix` (default `/assets`),
19468
+ `immutable`, `hashedFiles` (paths, RegExps or a predicate), `cacheControl`, `files`, `allow`,
19469
+ `headers`, `dotfiles` and `fallthrough`. A path under a mount's prefix that it cannot serve answers
19470
+ 404 (400 malformed, 403 traversing) unless the mount sets `fallthrough: true`, which hands it to the
19471
+ next mount and then the app.
19472
+
19473
+ A served directory is a
18471
19474
  public asset directory and must contain nothing private: no secrets, source maps, build
18472
19475
  metadata, or user uploads. The directory and its ancestor path must be read-only and owned by
18473
19476
  the service (or otherwise protected from untrusted local writers). Nifra resolves and confines
@@ -18481,7 +19484,7 @@ an application or object-storage path with its own validation policy.
18481
19484
 
18482
19485
  Every file carries `Accept-Ranges: bytes`. A file up to 256 KiB is read whole and carries a strong
18483
19486
  `ETag` from exactly the bytes served: 128 bits of their SHA-256, the same for the same bytes on every
18484
- instance and on `servePublicDir`. A replacement that keeps a file's size and timestamps still changes
19487
+ instance and on every runtime's `serveStatic`. A replacement that keeps a file's size and timestamps still changes
18485
19488
  its tag. The tag is remembered per file version (device, inode, size, mtime and ctime): a file over
18486
19489
  4 KiB reuses it without hashing when a second stat after the read shows the same version, and a
18487
19490
  `HEAD` or a `304` for that tag is answered from the stat without reading the file at all. A
@@ -18496,25 +19499,25 @@ file is dated only once that change is more than 2 s old, so a write during the
18496
19499
  later second than the date it was sent with. Explicit
18497
19500
  validator headers still apply. `If-None-Match` takes precedence over `If-Modified-Since`; a matching
18498
19501
  condition gets a bodyless 304. `Range` on GET is parsed by a copy of `@nifrajs/core/range`, the parser
18499
- `servePublicDir` uses, and gated by `If-Range`: it must name the file's strong tag, or its exact date
19502
+ every runtime's `serveStatic` uses, and gated by `If-Range`: it must name the file's strong tag, or its exact date
18500
19503
  when the file has no strong tag. One range (overlapping or adjacent ones merge into one) gets 206, a
18501
19504
  range-set that selects nothing gets 416, and several disjoint ranges get the whole file.
18502
19505
 
18503
19506
  ## Graceful shutdown on signals
18504
19507
 
18505
19508
  Opt in to SIGTERM/SIGINT handling so a `docker stop` / Ctrl-C drains in-flight requests
18506
- before exit (mirrors Bun's `listen({ gracefulSignals })` - off by default, since owning
18507
- process signals should be a deliberate choice):
19509
+ before exit (the same `gracefulSignals` as Bun's `server({ gracefulSignals })` - off by default,
19510
+ since owning process signals should be a deliberate choice):
18508
19511
 
18509
19512
  ```ts
18510
- await serve(app, { port: 3000, signals: true })
19513
+ await serve(app, { port: 3000, gracefulSignals: true })
18511
19514
  ```
18512
19515
 
18513
19516
  In-flight requests get 10 s to finish before the stop forces them closed. Set the window to fit
18514
19517
  the platform's kill grace period:
18515
19518
 
18516
19519
  ```ts
18517
- await serve(app, { port: 3000, signals: { drainMs: 8_000 } })
19520
+ await serve(app, { port: 3000, gracefulSignals: { drainMs: 8_000 } })
18518
19521
  ```
18519
19522
 
18520
19523
  ## What you get for free
@@ -18900,7 +19903,11 @@ const openapi = toOpenAPI(app) // OpenAPI 3.1
18900
19903
  `array`/`optional`/`union`/`record`, with options (`min`/`max`, `pattern`, `format`,
18901
19904
  …) that become JSON Schema constraints. Validators are compiled (fast).
18902
19905
  - **Validating string formats** - `email`/`uuid`/`date-time`/`date`/`time`/`uri`/`ipv4`
18903
- validate *and* annotate; register more with `registerFormat`.
19906
+ validate *and* annotate; register more with `registerFormat`. `date-time`, `date` and `time`
19907
+ follow RFC 3339, calendar included, so `2026-02-30` fails.
19908
+ - **Dates** - `t.date()` is a `Date` in your code and an RFC 3339 `date-time` string on the wire. A
19909
+ request `body`, `query` or `params` carries the string and the handler receives a `Date`; a
19910
+ response may hold the `Date` (a timestamp column), and the typed client reads a `string`.
18904
19911
  - **Bytes in a response** - `t.bytes()` declares a field the handler fills with a `Uint8Array` (or a
18905
19912
  `Buffer`). The route writes it as a base64 string, the typed client reads a `string`, and the
18906
19913
  document says `{ type: "string", contentEncoding: "base64" }`. Response-only for now: a request or
@@ -18939,6 +19946,8 @@ await Bun.write(
18939
19946
  The server imports `body` from `./generated/users.ts` and uses it as its route schema. The generated
18940
19947
  source-schema import is type-only and disappears from the deployed bundle. Regenerate when the source
18941
19948
  schema changes. Custom string formats must be registered in the serving process, as with ordinary schemas.
19949
+ The generated module typechecks under `strict`, `noUnusedLocals` and `noUnusedParameters`, and Node runs
19950
+ it with its built-in type stripping.
18942
19951
 
18943
19952
  Compilation refuses coercing schemas (`t.query`, `t.form` and the other request-slot schemas), a
18944
19953
  schema whose `validate` does more than check its `jsonSchema`, custom registry kinds such as dates/deferred values,
@@ -19454,7 +20463,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
19454
20463
 
19455
20464
  ## @nifrajs/ts-plugin
19456
20465
 
19457
- A TypeScript language-service plugin for [nifra](https://github.com/nifrajs/nifra). It adds go-to-definition on route-path string literals: put your cursor on `"/orders"` in `navigate({ to: "/orders" })`, `<Link to="/orders">`, or `href="/orders"`, and jump straight to the `routes/` file that serves it.
20466
+ A TypeScript language-service plugin for [nifra](https://github.com/nifrajs/nifra). It adds go-to-definition on route-path string literals: put your cursor on `"/orders"` in `href({ to: "/orders" })`, `rawHref("/orders")`, or `<a href="/orders">`, and jump straight to the `routes/` file that serves it. A route-table pattern such as `"/users/:id"` resolves to its file too.
19458
20467
 
19459
20468
  The routing rules are nifra's own - it discovers routes with `@nifrajs/web` and matches them with `@nifrajs/core`'s pattern matcher - so a path resolves to exactly the file it would serve at runtime, dynamic segments included (`/users/42` → `routes/users/[id].tsx`).
19460
20469
 
@@ -19540,8 +20549,8 @@ One package, the same on React, Preact, Vue, Solid and Svelte (pick the renderer
19540
20549
  - Streaming SSR with `defer()`, SSG, and ISR with tag purges - [rendering](https://nifra.dev/docs/rendering).
19541
20550
  - [Live refresh](https://nifra.dev/docs/live) (`@nifrajs/web/live`, `/live-client`, `/live-redis`):
19542
20551
  loaders declare keys, a publish reloads only what read them.
19543
- - [Partial prerendering](https://nifra.dev/docs/partial-prerendering) (`@nifrajs/web/ppr`,
19544
- experimental): a cached shell, with per-visitor holes streamed in.
20552
+ - [Partial prerendering](https://nifra.dev/docs/partial-prerendering) (`@nifrajs/web/ppr`): a cached
20553
+ shell, with per-visitor holes streamed in.
19545
20554
  - [Keep-alive](https://nifra.dev/docs/keep-alive) pages, a query cache, optimistic fetchers, and
19546
20555
  [islands](https://nifra.dev/docs/islands) (`@nifrajs/web/islands`) for pages with no framework runtime.
19547
20556
  - Optional [server components](https://nifra.dev/docs/server-components) on all five adapters:
@@ -20032,7 +21041,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20032
21041
 
20033
21042
  ## @nifrajs/agent
20034
21043
 
20035
- `AgentApprovalPort`, `AgentApprovalResult`, `AgentDefinition`, `AgentDeltaSink`, `AgentDeployment`, `AgentDeploymentAdapter`, `AgentDeploymentPlan`, `AgentModelDelta`, `AgentModelPort`, `AgentModelRequest`, `AgentModelResponse`, `AgentPendingContinuation`, `AgentPendingKind`, `AgentPorts`, `AgentResumeMismatchError`, `AgentRunResult`, `AgentSharedState`, `AgentStatePatchOp`, `AgentStateStore`, `AgentStatus`, `AgentStepEvidence`, `AgentTelemetryPort`, `AgentToolContract`, `AgentToolDescriptor`, `AgentToolResult`, `AgentTranscript`, `AgentTurnBaseResult`, `AgentTurnError`, `AgentTurnInput`, `AgentTurnResult`, `AgentTurnState`, `ApprovalClass`, `CAPABILITY_DESCRIPTOR_VERSION`, `CapabilityDescriptor`, `CapabilityKind`, `ContextAssembly`, `ContextAssemblyOptions`, `ContextBudget`, `ContextBudgetError`, `ContextItem`, `ContextSource`, `ContextTokenCounter`, `DeploymentActivationOptions`, `DeploymentAuthority`, `DeploymentCancelRequest`, `DeploymentCancelResult`, `DeploymentCancellation`, `DeploymentCapabilities`, `DeploymentCapabilityReport`, `DeploymentDisposeRequest`, `DeploymentDisposeResult`, `DeploymentError`, `DeploymentErrorCode`, `DeploymentEvidence`, `DeploymentFilesystem`, `DeploymentInspectRequest`, `DeploymentInspection`, `DeploymentNetwork`, `DeploymentPrepareRequest`, `DeploymentPrepareResult`, `DeploymentProcess`, `DeploymentRuntime`, `DeploymentSecrets`, `DeploymentStartRequest`, `DeploymentStartResult`, `DeploymentState`, `DescriptorInput`, `ExecutionPolicy`, `ExecutionPolicyAdapter`, `FakeModelGateway`, `FakeModelGatewayOptions`, `HostileCodeIsolation`, `IdempotencyClass`, `IsolationClass`, `LOCAL_PROCESS_LIMITATION`, `LocalProcessAdapter`, `LocalProcessAdapterOptions`, `LocalProcessPolicyError`, `LocalProcessRequest`, `LocalProcessResult`, `MODEL_GATEWAY_ERROR_CODES`, `MemoryAgentStateStore`, `ModelGateway`, `ModelGatewayAttemptRequest`, `ModelGatewayBudget`, `ModelGatewayEnvelope`, `ModelGatewayError`, `ModelGatewayErrorCode`, `ModelGatewayEvidence`, `ModelGatewayExecutionResult`, `ModelGatewayFailure`, `ModelGatewayFailureError`, `ModelGatewayRawResult`, `ModelGatewayRequest`, `ModelGatewayResult`, `ModelGatewaySuccess`, `ModelGatewayTerminalFailure`, `ModelGatewayUsage`, `ModelRoute`, `ModelRoutePolicy`, `ModelRouteRef`, `REGISTRY_SNAPSHOT_VERSION`, `RegistryError`, `RegistryErrorCode`, `RegistrySnapshot`, `ReplayModelGateway`, `ReplayModelGatewayOptions`, `RetryClass`, `RunAgentOptions`, `StructuredOutputParser`, `ToolDescriptorOptions`, `approximateContextTokens`, `assembleContext`, `assertDeploymentAuthorityMonotonic`, `collectContext`, `combineAgentDeltaSinks`, `combineAgentTelemetry`, `composeDescriptor`, `composeRegistrySnapshot`, `createAgentSharedState`, `createAgentState`, `createDeploymentAuthority`, `createLocalProcessAdapter`, `createStructuredOutputParser`, `descriptorFromTool`, `isModelGatewayErrorCode`, `parseCapabilityDescriptor`, `parseDeploymentCapabilityReport`, `parseDeploymentPlan`, `parseModelGatewayError`, `parseModelGatewayResult`, `replayAgent`, `resumeAgent`, `runAgent`, `runModelGateway`, `structuredOutputParser`, `turn`
21044
+ `AgentApprovalPort`, `AgentApprovalResult`, `AgentDefinition`, `AgentDeltaSink`, `AgentDeployment`, `AgentDeploymentAdapter`, `AgentDeploymentPlan`, `AgentModelDelta`, `AgentModelPort`, `AgentModelRequest`, `AgentModelResponse`, `AgentPendingContinuation`, `AgentPendingKind`, `AgentPorts`, `AgentResumeMismatchError`, `AgentRunResult`, `AgentSharedState`, `AgentStatePatchOp`, `AgentStateStore`, `AgentStatus`, `AgentStepEvidence`, `AgentTelemetryPort`, `AgentToolContract`, `AgentToolDescriptor`, `AgentToolResult`, `AgentTranscript`, `AgentTurnBaseResult`, `AgentTurnError`, `AgentTurnInput`, `AgentTurnResult`, `AgentTurnState`, `ApprovalClass`, `CAPABILITY_DESCRIPTOR_VERSION`, `CapabilityDescriptor`, `CapabilityKind`, `ContextAssembly`, `ContextAssemblyOptions`, `ContextBudget`, `ContextBudgetError`, `ContextItem`, `ContextSource`, `ContextTokenCounter`, `DeploymentActivationOptions`, `DeploymentAuthority`, `DeploymentCancelRequest`, `DeploymentCancelResult`, `DeploymentCancellation`, `DeploymentCapabilities`, `DeploymentCapabilityReport`, `DeploymentDisposeRequest`, `DeploymentDisposeResult`, `DeploymentError`, `DeploymentErrorCode`, `DeploymentEvidence`, `DeploymentFilesystem`, `DeploymentInspectRequest`, `DeploymentInspection`, `DeploymentNetwork`, `DeploymentPrepareRequest`, `DeploymentPrepareResult`, `DeploymentProcess`, `DeploymentRuntime`, `DeploymentSecrets`, `DeploymentStartRequest`, `DeploymentStartResult`, `DeploymentState`, `DescriptorInput`, `ExecutionPolicy`, `ExecutionPolicyAdapter`, `FakeModelGateway`, `FakeModelGatewayOptions`, `HostileCodeIsolation`, `IdempotencyClass`, `IsolationClass`, `LOCAL_PROCESS_LIMITATION`, `LocalProcessAdapter`, `LocalProcessAdapterOptions`, `LocalProcessPolicyError`, `LocalProcessRequest`, `LocalProcessResult`, `MODEL_GATEWAY_ERROR_CODES`, `MemoryAgentStateStore`, `ModelGateway`, `ModelGatewayAttemptRequest`, `ModelGatewayBudget`, `ModelGatewayEnvelope`, `ModelGatewayError`, `ModelGatewayErrorCode`, `ModelGatewayEvidence`, `ModelGatewayExecutionResult`, `ModelGatewayFailure`, `ModelGatewayFailureError`, `ModelGatewayRawResult`, `ModelGatewayRequest`, `ModelGatewayResult`, `ModelGatewaySuccess`, `ModelGatewayTerminalFailure`, `ModelGatewayUsage`, `ModelRoute`, `ModelRoutePolicy`, `ModelRouteRef`, `REGISTRY_SNAPSHOT_VERSION`, `RegistryError`, `RegistryErrorCode`, `RegistrySnapshot`, `ReplayModelGateway`, `ReplayModelGatewayOptions`, `RetryClass`, `RunAgentOptions`, `StructuredOutputParser`, `ToolDescriptorOptions`, `approximateContextTokens`, `assembleContext`, `assertDeploymentAuthorityMonotonic`, `collectContext`, `combineAgentDeltaSinks`, `combineAgentTelemetry`, `composeDescriptor`, `composeRegistrySnapshot`, `createAgentSharedState`, `createAgentState`, `createDeploymentAuthority`, `createLocalProcessAdapter`, `createStructuredOutputParser`, `descriptorFromTool`, `isModelGatewayErrorCode`, `parseAgentResume`, `parseCapabilityDescriptor`, `parseDeploymentCapabilityReport`, `parseDeploymentPlan`, `parseModelGatewayError`, `parseModelGatewayResult`, `replayAgent`, `resumeAgent`, `runAgent`, `runModelGateway`, `structuredOutputParser`, `turn`
20036
21045
 
20037
21046
  ## @nifrajs/agent-app
20038
21047
 
@@ -20076,7 +21085,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20076
21085
 
20077
21086
  ## @nifrajs/coding-agent
20078
21087
 
20079
- `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`, `NativeGatewayModelPortOptions`, `NativeMessage`, `NativeModelChunk`, `NativeModelPort`, `NativeModelRequest`, `NativeModelResponse`, `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`
21088
+ `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`
20080
21089
 
20081
21090
  ## @nifrajs/content
20082
21091
 
@@ -20084,7 +21093,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20084
21093
 
20085
21094
  ## @nifrajs/core
20086
21095
 
20087
- `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`, `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`, `TypedSSEStream`, `UrlParts`, `VERSION`, `ValidationOutcome`, `VercelHandler`, `Version`, `WebSocketContext`, `WebSocketData`, `WebSocketHandler`, `WebSocketUpgradeOutcome`, `authenticated`, `beforeHandler`, `commonSecretPatterns`, `cookieNamePrefix`, `defineContextPlugin`, `defineIdentityPlugin`, `definePlugin`, `defineRouterPlugin`, `hasDuplicateCookie`, `isAuthenticatedRequest`, `isSameOriginForm`, `isSameOriginPath`, `isSameOriginRequest`, `jsonLogger`, `markAuthenticatedRequest`, `parseCookies`, `pathnameOf`, `redactLogFields`, `rejected`, `replacedRequestOf`, `routePatternOverlap`, `routeTemplateOf`, `serializeCookie`, `server`, `signValue`, `silentLogger`, `status`, `toFetchHandler`, `toLambdaHandler`, `toNetlifyHandler`, `toVercelHandler`, `unsignValue`, `urlPartsOf`, `writableResponse`
21096
+ `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`, `TypedSSEStream`, `UrlParts`, `VERSION`, `ValidationOutcome`, `VercelHandler`, `Version`, `WebSocketContext`, `WebSocketData`, `WebSocketHandler`, `WebSocketUpgradeOutcome`, `authenticated`, `beforeHandler`, `carryRequestLocals`, `commonSecretPatterns`, `cookieNamePrefix`, `defineContextPlugin`, `defineIdentityPlugin`, `definePlugin`, `defineRouterPlugin`, `hasDuplicateCookie`, `isAuthenticatedRequest`, `isSameOriginForm`, `isSameOriginPath`, `isSameOriginRequest`, `jsonLogger`, `markAuthenticatedRequest`, `parseCookies`, `pathnameOf`, `redactLogFields`, `rejected`, `replacedRequestOf`, `requestLocal`, `routePatternOverlap`, `routeTemplateOf`, `serializeCookie`, `server`, `signValue`, `silentLogger`, `status`, `toFetchHandler`, `toLambdaHandler`, `toNetlifyHandler`, `toVercelHandler`, `unsignValue`, `urlPartsOf`, `varyOn`, `writableResponse`
20088
21097
 
20089
21098
  ## @nifrajs/cron
20090
21099
 
@@ -20092,7 +21101,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20092
21101
 
20093
21102
  ## @nifrajs/deno
20094
21103
 
20095
- `DenoServer`, `DenoStopOptions`, `FetchHandler`, `ServeOptions`, `serve`
21104
+ `DenoServer`, `DenoStopOptions`, `FetchHandler`, `HashedFiles`, `ServeOptions`, `ServeStaticOptions`, `serve`, `serveStatic`
20096
21105
 
20097
21106
  ## @nifrajs/devtools
20098
21107
 
@@ -20120,7 +21129,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20120
21129
 
20121
21130
  ## @nifrajs/image
20122
21131
 
20123
- `CloudflareLoaderOptions`, `HtmlImageAttrs`, `ImageFormat`, `ImageInfo`, `ImageLoader`, `ImageProps`, `OgImageOptions`, `OgImageRasterized`, `OgImageRasterizer`, `PngRenderer`, `ResolvedImage`, `ResvgConstructor`, `ResvgRenderer`, `SelfHostedLoaderOptions`, `SignImageUrlOptions`, `cloudflareLoader`, `createPngRasterizer`, `createResvgRasterizer`, `identityLoader`, `imageDimensions`, `ogImageResponse`, `readImageDimensions`, `renderOgImage`, `resolveImage`, `selfHostedLoader`, `signImageUrl`, `toHtmlAttrs`
21132
+ `CloudflareLoaderOptions`, `HtmlImageAttrs`, `ImageFormat`, `ImageInfo`, `ImageInputProps`, `ImageLoader`, `ImagePresentationProps`, `ImageProps`, `OgImageOptions`, `OgImageRasterized`, `OgImageRasterizer`, `PngRenderer`, `ResolvedImage`, `ResvgConstructor`, `ResvgRenderer`, `SelfHostedLoaderOptions`, `SignImageUrlOptions`, `StaticImageData`, `StaticImageProps`, `StaticImageVariant`, `cloudflareLoader`, `createPngRasterizer`, `createResvgRasterizer`, `identityLoader`, `imageDimensions`, `ogImageResponse`, `readImageDimensions`, `renderOgImage`, `resolveImage`, `selfHostedLoader`, `signImageUrl`, `toHtmlAttrs`
20124
21133
 
20125
21134
  ## @nifrajs/island-trigger
20126
21135
 
@@ -20140,7 +21149,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20140
21149
 
20141
21150
  ## @nifrajs/middleware
20142
21151
 
20143
- `AdmissionControllerHandle`, `AdmissionEvidence`, `AdmissionOptions`, `AdmissionPolicy`, `AdmissionSnapshot`, `ApiKeyStaticOptions`, `ApiKeyVerifyOptions`, `AuthPlugin`, `BasicAuthPlugin`, `BasicAuthStaticOptions`, `BasicAuthVerifyOptions`, `BearerOptions`, `BodyLimitOptions`, `ByteRange`, `ByteRangeResult`, `CacheControlOptions`, `CacheOptions`, `CachedResponse`, `Composable`, `CompressionOptions`, `ConditionalResponseOptions`, `ContentPreference`, `CorsOptions`, `CsrfOptions`, `DurableCommandOptions`, `ETagOptions`, `HealthcheckOptions`, `IdempotencyClaim`, `IdempotencyOptions`, `IdempotencyRecord`, `IdempotencyStore`, `IpMatcher`, `IpRestrictionOptions`, `JwkKey`, `JwksOptions`, `JwtAlgorithm`, `JwtClaims`, `JwtHeader`, `JwtKeyResolver`, `JwtOptions`, `JwtPlugin`, `JwtVerificationKey`, `LanguageMatch`, `LanguageOptions`, `LoggerOptions`, `LoopDelayHistogram`, `LoopDelayMonitor`, `MemoryIdempotencyStore`, `MemoryIdempotencyStoreOptions`, `MemoryResponseCache`, `MemoryResponseCacheOptions`, `MemoryStore`, `MemoryStoreOptions`, `MethodOverrideOptions`, `MultipartBody`, `MultipartHeadersInit`, `MultipartPart`, `MultipartResponseOptions`, `OpenApiInfo`, `OpenApiOptions`, `OpenApiServer`, `OpenApiTag`, `OpenApiUiOptions`, `PoweredByOptions`, `PrettyJsonOptions`, `ProblemDetailsOptions`, `RangeResponseOptions`, `RateLimitOptions`, `RateLimitResult`, `RateLimitStore`, `RateLimitTier`, `RateLimitTiersOptions`, `ReadinessCheck`, `ReadinessCheckOptions`, `ReadinessCheckResult`, `ReadinessCheckStatus`, `ReadinessReport`, `RequestIdOptions`, `RequestLogFields`, `ResponseCacheStore`, `RouteLike`, `SecurityHeadersOptions`, `SecurityRequirement`, `ShedReason`, `TimingControls`, `TimingMetric`, `TimingOptions`, `TrailingSlashOptions`, `VerifiedJwt`, `VerifyJwtOptions`, `VerifyJwtResult`, `apiKey`, `appendTrailingSlash`, `basicAuth`, `bearer`, `bodyLimit`, `buildOpenApiDocument`, `cache`, `cacheControl`, `combine`, `compression`, `conditionalResponse`, `cors`, `createAdmissionController`, `createCsrfToken`, `createEventLoopLagSampler`, `csrf`, `durableCommand`, `etag`, `healthcheck`, `idempotency`, `ipRestriction`, `jwk`, `jwks`, `jwt`, `language`, `logger`, `methodOverride`, `multipartResponse`, `namedCombine`, `negotiateContentType`, `openapi`, `parseAcceptHeader`, `parseByteRange`, `pickLanguage`, `poweredBy`, `prettyJson`, `problemDetails`, `rangeResponse`, `rateLimit`, `rateLimitTiers`, `requestId`, `responseCache`, `securityHeaders`, `timing`, `trimTrailingSlash`, `tryVerifyJwt`, `verifyCsrfToken`, `verifyJwt`
21152
+ `AdmissionControllerHandle`, `AdmissionEvidence`, `AdmissionOptions`, `AdmissionPolicy`, `AdmissionSnapshot`, `ApiKeyStaticOptions`, `ApiKeyVerifyOptions`, `AuthPlugin`, `BasicAuthPlugin`, `BasicAuthStaticOptions`, `BasicAuthVerifyOptions`, `BearerOptions`, `BodyLimitOptions`, `ByteRange`, `ByteRangeResult`, `CacheControlOptions`, `CacheOptions`, `CachedResponse`, `Composable`, `CompressionOptions`, `ConditionalResponseOptions`, `ContentPreference`, `CorsOptions`, `CsrfOptions`, `DurableCommandOptions`, `ETagOptions`, `HealthcheckOptions`, `IdempotencyClaim`, `IdempotencyOptions`, `IdempotencyRecord`, `IdempotencyStore`, `IpMatcher`, `IpRestrictionOptions`, `JwkKey`, `JwksOptions`, `JwtAlgorithm`, `JwtClaims`, `JwtHeader`, `JwtKeyResolver`, `JwtOptions`, `JwtPlugin`, `JwtVerificationKey`, `LanguageMatch`, `LanguageOptions`, `LoggerOptions`, `LoopDelayHistogram`, `LoopDelayMonitor`, `MemoryIdempotencyStore`, `MemoryIdempotencyStoreOptions`, `MemoryResponseCache`, `MemoryResponseCacheOptions`, `MemoryStore`, `MemoryStoreOptions`, `MethodOverrideOptions`, `MultipartBody`, `MultipartHeadersInit`, `MultipartPart`, `MultipartResponseOptions`, `OpenApiInfo`, `OpenApiOptions`, `OpenApiServer`, `OpenApiTag`, `OpenApiUiOptions`, `PoweredByOptions`, `PrettyJsonOptions`, `ProblemDetailsOptions`, `RangeResponseOptions`, `RateLimitOptions`, `RateLimitResult`, `RateLimitStore`, `RateLimitTier`, `RateLimitTiersOptions`, `RateLimiter`, `ReadinessCheck`, `ReadinessCheckOptions`, `ReadinessCheckResult`, `ReadinessCheckStatus`, `ReadinessReport`, `RequestIdOptions`, `RequestLogFields`, `ResponseCacheStore`, `RouteLike`, `SecurityHeadersOptions`, `SecurityRequirement`, `ShedReason`, `TimingControls`, `TimingMetric`, `TimingOptions`, `TrailingSlashOptions`, `VerifiedJwt`, `VerifyJwtOptions`, `VerifyJwtResult`, `apiKey`, `appendTrailingSlash`, `basicAuth`, `bearer`, `bodyLimit`, `buildOpenApiDocument`, `cache`, `cacheControl`, `combine`, `compression`, `conditionalResponse`, `cors`, `createAdmissionController`, `createCsrfToken`, `createEventLoopLagSampler`, `csrf`, `durableCommand`, `etag`, `healthcheck`, `idempotency`, `ipRestriction`, `jwk`, `jwks`, `jwt`, `language`, `logger`, `methodOverride`, `multipartResponse`, `namedCombine`, `negotiateContentType`, `openapi`, `parseAcceptHeader`, `parseByteRange`, `pickLanguage`, `poweredBy`, `prettyJson`, `problemDetails`, `rangeResponse`, `rateLimit`, `rateLimitTiers`, `requestId`, `responseCache`, `securityHeaders`, `timing`, `trimTrailingSlash`, `tryVerifyJwt`, `verifyCsrfToken`, `verifyJwt`
20144
21153
 
20145
21154
  ## @nifrajs/mock
20146
21155
 
@@ -20148,7 +21157,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20148
21157
 
20149
21158
  ## @nifrajs/node
20150
21159
 
20151
- `FetchHandler`, `NodeServer`, `NodeStopOptions`, `RequestProtocol`, `RequestProtocolOption`, `ServeOptions`, `ServeStaticOptions`, `serve`
21160
+ `FetchHandler`, `HashedFiles`, `NodeServer`, `NodeStopOptions`, `RequestProtocol`, `RequestProtocolOption`, `ServeOptions`, `ServeStaticOptions`, `serve`, `serveStatic`
20152
21161
 
20153
21162
  ## @nifrajs/otel
20154
21163
 
@@ -20192,7 +21201,7 @@ done-gate, or `nifra mcp` to give the agent live project tools.
20192
21201
 
20193
21202
  ## @nifrajs/web
20194
21203
 
20195
- `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`, `DehydratedState`, `DocumentParts`, `DraftCookieControls`, `DynamicBoundary`, `DynamicBoundaryBatch`, `EnableDraftOptions`, `FetchRouteData`, `Fetcher`, `FetcherState`, `FontDisplay`, `FontFace`, `FontPreloadInput`, `FontSource`, `GenerateClientEntryOptions`, `GenerateRouteSearchTypesOptions`, `GenerateServerManifestOptions`, `GetStaticPaths`, `HANDOVER_ID`, `HostPolicy`, `HostPolicyOptions`, `HostPolicyRule`, `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`, `MutationHandle`, `MutationState`, `MutationStatus`, `NAV_FROM_HEADER`, `NavigateFunction`, `NavigateOptions`, `NavigateSearchOf`, `NavigateTargetInput`, `NonceContext`, `NonceGenerator`, `NonceHeader`, `NonceHeaderContext`, `NonceResolver`, `NotFoundEntry`, `NotFoundScope`, `OpenGraphInput`, `PREFETCH_HEADER`, `PRE_HYDRATION_GUARD`, `PageLocale`, `PageLocales`, `PendingBoundary`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `PublicDirCache`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `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`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RoutePattern`, `RouteSearch`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchOf`, `ServePublicDirOptions`, `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`, `generateRouteSearchTypes`, `generateServerManifest`, `getBrowserNavigate`, `gone`, `hashQueryKey`, `isCacheablePage`, `isDraftEnabled`, `isHostPolicy`, `jsonLd`, `localeOfProps`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `redirect`, `registerBlocker`, `renderPage`, `renderPageResult`, `resolveChainMeta`, `resolveDynamicBoundaries`, `resolveMeta`, `resolveNavigate`, `resolvePublicPath`, `resolveStaticBoundaries`, `revalidate`, `revalidateEndpoint`, `rotateIdentityEpoch`, `sanitizeHtml`, `sanitizedHtml`, `searchOf`, `searchOfChain`, `serializeData`, `serializeSearch`, `servePublicDir`, `setBlockerController`, `setBrowserNavigate`, `setSsrModuleLoader`, `ssrModuleLoader`, `startDynamicBoundaries`, `statusPage`, `trustHtml`, `unsafeInlineScript`, `webProjectEvidence`, `withISR`
21204
+ `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`, `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`, `PendingBoundary`, `PrefetchMode`, `PrerenderedPageReaderOptions`, `PrerenderedPages`, `PreviewEndpointOptions`, `QueryClient`, `QueryClientOptions`, `QueryHandle`, `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`, `RouteMatch`, `RouteMiddleware`, `RouteModule`, `RoutePattern`, `RouteTable`, `RouterState`, `SERVER_FN_MODULE`, `STATUS_HEADER`, `SanitizedHtml`, `ScriptDescriptor`, `SearchOf`, `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`, `jsonLd`, `localeOfProps`, `mergeHeads`, `nifraScriptHashes`, `normalizeCssLoading`, `notFound`, `openGraph`, `pageLocaleIn`, `prerenderedPageReader`, `previewEndpoint`, `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`
20196
21205
 
20197
21206
  ## @nifrajs/web-preact
20198
21207