@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
package/docs/types.json CHANGED
@@ -115,7 +115,7 @@
115
115
  "kind": "const",
116
116
  "package": "@nifrajs/agent-protocol",
117
117
  "signature": "export declare const AGENT_PROTOCOL_VERSION: 1;",
118
- "doc": "/**\n * Backend-neutral protocol for local coding-agent hosts.\n *\n * This package deliberately has no runtime dependencies. A Pi adapter, a Nifra-native backend,\n * the CLI, and the Workbench can all implement or consume these contracts without pulling any\n * framework, model provider, or UI code into an application.\n */"
118
+ "doc": "/** The session protocol version every snapshot and event carries; one with another version is refused. */"
119
119
  },
120
120
  {
121
121
  "name": "ALARM_GAP_MS",
@@ -1173,6 +1173,13 @@
1173
1173
  "signature": "export interface AppLike {\n fetch(request: Request): Response | Promise<Response>;\n}",
1174
1174
  "doc": "/** The minimal shape a nifra `server()` app satisfies - its own `fetch`. */"
1175
1175
  },
1176
+ {
1177
+ "name": "AppliedInvariantSetup",
1178
+ "kind": "interface",
1179
+ "package": "@nifrajs/core",
1180
+ "signature": "export interface AppliedInvariantSetup {\n /** The config with the setup's executor, witnesses and prepareRequest merged over it. */\n readonly invariants: InvariantsConfig;\n /** The `\"METHOD /path\"` witness keys the setup returned, in its order. */\n readonly setupWitnesses: readonly string[];\n}",
1181
+ "doc": "/** One L4 run's options once `invariants.setup` has provisioned its target. */"
1182
+ },
1176
1183
  {
1177
1184
  "name": "ApprovalBindingError",
1178
1185
  "kind": "class",
@@ -2349,13 +2356,13 @@
2349
2356
  "name": "BuildServerOptions",
2350
2357
  "kind": "interface",
2351
2358
  "package": "@nifrajs/web",
2352
- "signature": "export interface BuildServerOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** The worker entry module (absolute path) - your `worker.ts`. It imports `{ manifest, clientEntry }`\n * from the generated `./server-manifest`, builds `createWebApp`, and `export default toFetchHandler(app)`. */\n readonly serverEntry: string;\n /** Output directory for the bundled worker (absolute path). */\n readonly outDir: string;\n /**\n * The manifest `buildClient` returned. Supplies {@link clientEntry}, {@link styles},\n * {@link routeStyles}, {@link copyChunks} and {@link buildAssets} at once, so none can be forgotten\n * (a forgotten `styles` ships unstyled pages); an option given explicitly still wins.\n */\n readonly client?: BuildManifest;\n /** The content-hashed client entry URL (from `buildClient`'s manifest) - **baked** into the generated\n * server manifest, since a disk-less worker can't read `manifest.json` at runtime. Required unless\n * {@link client} is given. */\n readonly clientEntry?: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked into the generated\n * manifest so the server entry hands them to `createWebApp` (→ `<link rel=\"stylesheet\">`). Omit ⇒ no CSS\n * link (the built SSR page would otherwise render unstyled). */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked alongside `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** Copy chunk URLs by locale (`buildClient`'s `BuildManifest.copyChunks`) - baked as `copyChunks`. */\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /**\n * Every file the build emitted, by request path (`buildClient`'s `assets` plus its `publicFiles`):\n * baked as `buildAssets` and `isBuildAsset(pathname)` for a host policy or a hand-written static\n * handler. Defaults from {@link client}; without either, the manifest exports neither name.\n */\n readonly buildAssets?: readonly string[] | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n /** Route/layout file → import specifier in the generated manifest (default: a relative path from the\n * manifest's location - written next to `serverEntry` - to `routesDir`). */\n readonly resolve?: (file: string) => string;\n /** Filename for the generated server-manifest module, written next to `serverEntry` (default\n * `\"server-manifest.ts\"`); your `serverEntry` imports it as `./server-manifest`. */\n readonly manifestFile?: string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"ssr\")` - Solid routes need their SSR transform at\n * build time; React's JSX is Bun-native and needs none). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` resolution conditions (default `[\"workerd\", \"edge-light\", \"browser\"]`) - selects each\n * dependency's edge build. */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (default `{ \"process.env.NODE_ENV\": '\"production\"' }` → production\n * React/Solid on the edge). Pass an explicit object to override (e.g. `{}` to opt out). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** `Bun.build` target (default `\"browser\"` - the right shape for edge runtimes: Cloudflare Workers,\n * Vercel Edge, Deno, Deno Deploy). Use `\"node\"` for a `@nifrajs/node` server (so `node:*` built-ins\n * stay external), or `\"bun\"` for a Bun server. The default `conditions` + the edge resolve shims\n * only apply to the `\"browser\"` target; `\"node\"`/`\"bun\"` resolve their own renderer builds via the\n * matching condition. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** **Lazy/code-split routes** (default `false`): emit `() => import(route)` loaders + bundle with\n * `splitting`, so each route is its own chunk loaded on first request (smaller cold-start parse)\n * instead of all parsed at boot. The output becomes the worker entry **+ chunk files** in `outDir`\n * - on Cloudflare, ship them with wrangler's `no_bundle` + `find_additional_modules` + an ESModule\n * `rule` (Node/Deno import the chunks natively). Eager (one self-contained file) stays the default. */\n readonly lazy?: boolean;\n /** The app root the zone rules classify against (default: the directory holding `routesDir`). */\n readonly root?: string;\n /** Modules a build tool wrote or names as an entry (the adapter module a generated entry imports).\n * Like `serverEntry` and the generated manifest, they may import both halves of a route. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix the app's browser code may read (default `\"PUBLIC_\"`). Shared code in\n * the server bundle is held to it too. */\n readonly publicEnvPrefix?: string;\n}"
2359
+ "signature": "export interface BuildServerOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** The worker entry module (absolute path) - your `worker.ts`. It imports `{ manifest, clientEntry }`\n * from the generated `./server-manifest`, builds `createWebApp`, and `export default toFetchHandler(app)`. */\n readonly serverEntry: string;\n /** Output directory for the bundled worker (absolute path). */\n readonly outDir: string;\n /**\n * The manifest `buildClient` returned. Supplies {@link clientEntry}, {@link styles},\n * {@link routeStyles}, {@link copyChunks} and {@link buildAssets} at once, so none can be forgotten\n * (a forgotten `styles` ships unstyled pages); an option given explicitly still wins.\n */\n readonly client?: BuildManifest;\n /** The content-hashed client entry URL (from `buildClient`'s manifest) - **baked** into the generated\n * server manifest, since a disk-less worker can't read `manifest.json` at runtime. Required unless\n * {@link client} is given. */\n readonly clientEntry?: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked into the generated\n * manifest so the server entry hands them to `createWebApp` (→ `<link rel=\"stylesheet\">`). Omit ⇒ no CSS\n * link (the built SSR page would otherwise render unstyled). */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked alongside `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** Copy chunk URLs by locale (`buildClient`'s `BuildManifest.copyChunks`) - baked as `copyChunks`. */\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /**\n * Every file the build emitted, by request path (`buildClient`'s `assets` plus its `publicFiles`):\n * baked as `buildAssets` and `isBuildAsset(pathname)` for a host policy or a hand-written static\n * handler. Defaults from {@link client}; without either, the manifest exports neither name.\n */\n readonly buildAssets?: readonly string[] | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n /** Route/layout file → import specifier in the generated manifest (default: a relative path from the\n * manifest's location - written next to `serverEntry` - to `routesDir`). */\n readonly resolve?: (file: string) => string;\n /** Filename for the generated server-manifest module, written next to `serverEntry` (default\n * `\"server-manifest.ts\"`); your `serverEntry` imports it as `./server-manifest`. */\n readonly manifestFile?: string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"ssr\")` - Solid routes need their SSR transform at\n * build time; React's JSX is Bun-native and needs none). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` resolution conditions (default `[\"workerd\", \"edge-light\", \"browser\"]`) - selects each\n * dependency's edge build. */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (default `{ \"process.env.NODE_ENV\": '\"production\"' }` → production\n * React/Solid on the edge). Pass an explicit object to override (e.g. `{}` to opt out). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** `Bun.build` target (default `\"browser\"` - the right shape for edge runtimes: Cloudflare Workers,\n * Vercel Edge, Deno, Deno Deploy). Use `\"node\"` for a `@nifrajs/node` server (so `node:*` built-ins\n * stay external), or `\"bun\"` for a Bun server. The default `conditions` + the edge resolve shims\n * only apply to the `\"browser\"` target; `\"node\"`/`\"bun\"` resolve their own renderer builds via the\n * matching condition. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Node built-ins the runtime that runs the bundle has besides what `target` implies, kept as imports\n * of the runtime's own module: neither polyfilled nor refused. `buildTarget` passes `node:crypto` for\n * Deno, where Bun's `browser` stand-in for it has no working `createHash`. */\n readonly providedBuiltins?: readonly string[];\n /** **Lazy/code-split routes** (default `false`): emit `() => import(route)` loaders + bundle with\n * `splitting`, so each route is its own chunk loaded on first request (smaller cold-start parse)\n * instead of all parsed at boot. The output becomes the worker entry **+ chunk files** in `outDir`\n * - on Cloudflare, ship them with wrangler's `no_bundle` + `find_additional_modules` + an ESModule\n * `rule` (Node/Deno import the chunks natively). Eager (one self-contained file) stays the default. */\n readonly lazy?: boolean;\n /** The app root the zone rules classify against (default: the directory holding `routesDir`). */\n readonly root?: string;\n /** Modules a build tool wrote or names as an entry (the adapter module a generated entry imports).\n * Like `serverEntry` and the generated manifest, they may import both halves of a route. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix the app's browser code may read (default `\"PUBLIC_\"`). Shared code in\n * the server bundle is held to it too. */\n readonly publicEnvPrefix?: string;\n}"
2353
2360
  },
2354
2361
  {
2355
2362
  "name": "BuildServerViteOptions",
2356
2363
  "kind": "interface",
2357
2364
  "package": "@nifrajs/web",
2358
- "signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /** Every file the build emitted, by request path - baked as `buildAssets` (see `buildServer`). */\n readonly buildAssets?: readonly string[] | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n /** Modules the build generated besides the entry and manifest (a target's adapter import). */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n}",
2365
+ "signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /** Every file the build emitted, by request path - baked as `buildAssets` (see `buildServer`). */\n readonly buildAssets?: readonly string[] | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n /** Modules the build generated besides the entry and manifest (a target's adapter import). */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Node built-ins the runtime provides besides what `target` implies - mirrors `buildServer`. */\n readonly providedBuiltins?: readonly string[];\n}",
2359
2366
  "doc": "/** Options for {@link buildServerVite} - the same surface as `buildServer` minus Bun-plugin specifics. */"
2360
2367
  },
2361
2368
  {
@@ -2368,7 +2375,7 @@
2368
2375
  "name": "BuildTargetOptions",
2369
2376
  "kind": "interface",
2370
2377
  "package": "@nifrajs/web",
2371
- "signature": "export interface BuildTargetOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the assembled deploy dir (absolute path). Cleared and recreated, so the\n * build refuses one that is a filesystem root or is or contains the routes directory, the public\n * directory, an absolute entry module, or the working directory. */\n readonly outDir: string;\n /** A scratch directory for intermediate codegen (the generated server entry + manifest) and the\n * server bundle, cleaned up after. Absolute path. Checked the same way as `outDir`. */\n readonly workDir: string;\n /** The adapter's client runtime module (exports `mountRouter`), e.g. `\"@nifrajs/web-react/client\"`. */\n readonly clientModule: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `adapter`. */\n readonly adapterImport: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `backend`, or `undefined`. */\n readonly backendImport?: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `use` (app-level middleware\n * applied before page routes are declared), or `undefined`. Must resolve to the same edge-safe\n * module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options the server entry imports by name (`apiPrefix`, `mounts`, `csp`, ...), each\n * mapped to the specifier (resolvable from `workDir`) of the same edge-safe module as `adapterImport`. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Factory that builds the app for `static` prerendering, GIVEN the client build's manifest - so the\n * emitted hydration `<script src>` uses the REAL content-hashed entry (`client.entry`) plus the same\n * styles/route-preload the server targets use. A pre-built instance can't work here: the hash isn't known\n * until `buildClient` runs inside `buildTarget`, so a hardcoded entry 404s → pages render but never\n * hydrate. Required for `target: \"static\"` (SSG drives `app.fetch`). For `bun` and `node` it is\n * optional: given, the opted-in routes are prerendered into `_prerendered/` and the server answers\n * them from their file; the other targets ignore it. */\n readonly prerenderApp?: (client: BuildManifest) => PrerenderAppLike | Promise<PrerenderAppLike>;\n /** Client-build plugins (e.g. the MDX/Vue/Solid Bun plugins). */\n readonly clientPlugins?: readonly BunPlugin[];\n /** Server-build plugins (e.g. the SSR variants). */\n readonly serverPlugins?: readonly BunPlugin[];\n /** Extra Bun.build resolve conditions for the CLIENT build. */\n readonly conditions?: readonly string[];\n /** Compile-time `define` replacements layered onto both builds. */\n readonly define?: Readonly<Record<string, string>>;\n /** Project-root static directory copied to deploy root. `false` disables it. */\n readonly publicDir?: string | false;\n /** Prefix of environment variables allowed into the client bundle (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Reviewed false positives of the secret scan over the bundle, `public/` and prerendered pages. */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Vite-only CSS output policy. `false` emits one aggregate stylesheet. The native Bun build does not\n * support this switch and fails closed if it is supplied instead of silently ignoring it.\n */\n readonly cssCodeSplit?: boolean;\n /**\n * Activation policy for framework-owned SSR stylesheet links. Defaults to `\"blocking\"`; `\"deferred\"`\n * fetches with `media=\"print\"` and promotes before hydration. With Vite, pair it with\n * `cssCodeSplit: false`; the native Bun build supports the activation policy but keeps its existing\n * CSS output strategy.\n */\n readonly cssLoading?: CssLoadingMode;\n /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n /** Trust the edge platform's client-address header for `c.clientIp` (`cloudflare`, `vercel`). Off by\n * default, leaving an edge app with no caller address. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** The client entry for a server built with `optionImports.live`: that runtime's `clientEntry`. */\n readonly live?: LiveClientEntry | undefined;\n}"
2378
+ "signature": "export interface BuildTargetOptions {\n /** Vercel-only: opt into Node.js 22 serverless SSR instead of the default Edge function. */\n readonly vercelRuntime?: VercelRuntime;\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the assembled deploy dir (absolute path). Cleared and recreated, so the\n * build refuses one that is a filesystem root or is or contains the routes directory, the public\n * directory, an absolute entry module, or the working directory. */\n readonly outDir: string;\n /** A scratch directory for intermediate codegen (the generated server entry + manifest) and the\n * server bundle, cleaned up after. Absolute path. Checked the same way as `outDir`. */\n readonly workDir: string;\n /** The adapter's client runtime module (exports `mountRouter`), e.g. `\"@nifrajs/web-react/client\"`. */\n readonly clientModule: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `adapter`. */\n readonly adapterImport: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `backend`, or `undefined`. */\n readonly backendImport?: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `use` (app-level middleware\n * applied before page routes are declared), or `undefined`. Must resolve to the same edge-safe\n * module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options the server entry imports by name (`apiPrefix`, `mounts`, `csp`, ...), each\n * mapped to the specifier (resolvable from `workDir`) of the same edge-safe module as `adapterImport`. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Factory that builds the app for `static` prerendering, GIVEN the client build's manifest - so the\n * emitted hydration `<script src>` uses the REAL content-hashed entry (`client.entry`) plus the same\n * styles/route-preload the server targets use. A pre-built instance can't work here: the hash isn't known\n * until `buildClient` runs inside `buildTarget`, so a hardcoded entry 404s → pages render but never\n * hydrate. Required for `target: \"static\"` (SSG drives `app.fetch`). For `bun` and `node` it is\n * optional: given, the opted-in routes are prerendered into `_prerendered/` and the server answers\n * them from their file; the other targets ignore it. */\n readonly prerenderApp?: (client: BuildManifest) => PrerenderAppLike | Promise<PrerenderAppLike>;\n /** Client-build plugins (e.g. the MDX/Vue/Solid Bun plugins). */\n readonly clientPlugins?: readonly BunPlugin[];\n /** Server-build plugins (e.g. the SSR variants). */\n readonly serverPlugins?: readonly BunPlugin[];\n /** Extra Bun.build resolve conditions for the CLIENT build. */\n readonly conditions?: readonly string[];\n /** Compile-time `define` replacements layered onto both builds. */\n readonly define?: Readonly<Record<string, string>>;\n /** Project-root static directory copied to deploy root. `false` disables it. */\n readonly publicDir?: string | false;\n /** Prefix of environment variables allowed into the client bundle (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Reviewed false positives of the secret scan over the bundle, `public/` and prerendered pages. */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Vite-only CSS output policy. `false` emits one aggregate stylesheet. The native Bun build does not\n * support this switch and fails closed if it is supplied instead of silently ignoring it.\n */\n readonly cssCodeSplit?: boolean;\n /**\n * Activation policy for framework-owned SSR stylesheet links. Defaults to `\"blocking\"`; `\"deferred\"`\n * fetches with `media=\"print\"` and promotes before hydration. With Vite, pair it with\n * `cssCodeSplit: false`; the native Bun build supports the activation policy but keeps its existing\n * CSS output strategy.\n */\n readonly cssLoading?: CssLoadingMode;\n /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n /** Trust the edge platform's client-address header for `c.clientIp` (`cloudflare`, `vercel`). Off by\n * default, leaving an edge app with no caller address. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** How a `bun`, `node` or `deno` server stops and keeps idle connections. See\n * {@link ServerEntrySelfHost}. */\n readonly selfHost?: ServerEntrySelfHost;\n /** The client entry for a server built with `optionImports.live`: that runtime's `clientEntry`. */\n readonly live?: LiveClientEntry | undefined;\n}"
2372
2379
  },
2373
2380
  {
2374
2381
  "name": "BuildTargetPlan",
@@ -2393,7 +2400,7 @@
2393
2400
  "name": "Bundler",
2394
2401
  "kind": "interface",
2395
2402
  "package": "@nifrajs/web",
2396
- "signature": "export interface Bundler {\n /** Build the client bundle → the shared {@link BuildManifest}. */\n buildClient(input: {\n readonly routesDir: string;\n readonly outDir: string;\n readonly clientModule: string;\n readonly plugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly publicDir?: string | false;\n readonly publicEnvPrefix?: string;\n /** Vite CSS splitting policy; the Bun strategy rejects `false` and otherwise preserves its native behavior. */\n readonly cssCodeSplit?: boolean;\n /** Framework-owned stylesheet activation policy; supported by both server strategies. */\n readonly cssLoading?: CssLoadingMode;\n /** Project root (Vite needs it; the Bun strategy ignores it). */\n readonly root?: string;\n /** Reviewed false positives of the secret scan. */\n readonly secretExemptions?: readonly SecretExemption[];\n /** The client entry for a live server (`BuildClientOptions.live`). */\n readonly live?: LiveClientEntry | undefined;\n }): Promise<BuildManifest>;\n /** Build the server worker → the shared {@link ServerBuild}. */\n buildServer(input: {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly target: \"browser\" | \"node\" | \"bun\";\n /** The client build's aggregate stylesheet URLs to bake into the server manifest. */\n readonly styles?: readonly string[];\n /** The client build's per-route stylesheet map to bake into the server manifest. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** The client build's copy chunk URLs by locale to bake into the server manifest. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** Every file the build emitted, by request path, to bake into the server manifest. */\n readonly buildAssets?: readonly string[];\n readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n /** Modules the zone rules treat as generated: the adapter module the generated entry imports. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n }): Promise<ServerBuild>;\n}",
2403
+ "signature": "export interface Bundler {\n /** Build the client bundle → the shared {@link BuildManifest}. */\n buildClient(input: {\n readonly routesDir: string;\n readonly outDir: string;\n readonly clientModule: string;\n readonly plugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly publicDir?: string | false;\n readonly publicEnvPrefix?: string;\n /** Vite CSS splitting policy; the Bun strategy rejects `false` and otherwise preserves its native behavior. */\n readonly cssCodeSplit?: boolean;\n /** Framework-owned stylesheet activation policy; supported by both server strategies. */\n readonly cssLoading?: CssLoadingMode;\n /** Project root (Vite needs it; the Bun strategy ignores it). */\n readonly root?: string;\n /** Reviewed false positives of the secret scan. */\n readonly secretExemptions?: readonly SecretExemption[];\n /** The client entry for a live server (`BuildClientOptions.live`). */\n readonly live?: LiveClientEntry | undefined;\n }): Promise<BuildManifest>;\n /** Build the server worker → the shared {@link ServerBuild}. */\n buildServer(input: {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly target: \"browser\" | \"node\" | \"bun\";\n /** The client build's aggregate stylesheet URLs to bake into the server manifest. */\n readonly styles?: readonly string[];\n /** The client build's per-route stylesheet map to bake into the server manifest. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** The client build's copy chunk URLs by locale to bake into the server manifest. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** Every file the build emitted, by request path, to bake into the server manifest. */\n readonly buildAssets?: readonly string[];\n readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n /** Modules the zone rules treat as generated: the adapter module the generated entry imports. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Node built-ins the runtime provides besides what `target` implies, kept as imports. */\n readonly providedBuiltins?: readonly string[];\n }): Promise<ServerBuild>;\n}",
2397
2404
  "doc": "/**\n * A build-tool STRATEGY for {@link buildTargetWith} - the two bundling steps, and nothing else. Everything\n * around them (server-entry codegen, deploy assembly, prerender, size report) is bundler-agnostic and\n * lives in `buildTargetWith`, so a second bundler (Vite) is this interface, not a second orchestrator.\n *\n * Plugin lists are `readonly unknown[]` because a Bun plugin and a Vite plugin are different types; each\n * strategy casts to its own. `buildTargetWith` only forwards them.\n */"
2398
2405
  },
2399
2406
  {
@@ -3287,7 +3294,7 @@
3287
3294
  "kind": "interface",
3288
3295
  "package": "@nifrajs/testing",
3289
3296
  "signature": "export interface CertificationContext {\n /** Deterministic per-check key safe for shared test backends and stable re-runs. */\n readonly key: (suffix: string) => string;\n}",
3290
- "doc": "/**\n * Profile-based adapter certification. Profiles are structural and dependency-free: an adapter package\n * uses this only in its test/CI surface, while the resulting capability matrix is portable JSON evidence.\n */"
3297
+ "doc": "/** What a certification check receives besides the adapter under test. */"
3291
3298
  },
3292
3299
  {
3293
3300
  "name": "CertificationTarget",
@@ -4257,12 +4264,33 @@
4257
4264
  "package": "@nifrajs/web",
4258
4265
  "signature": "export interface CreateCspPolicyOptions {\n /**\n * Build the complete Content-Security-Policy value for one document, or `undefined` to send none:\n *\n * ```ts\n * header: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`\n * ```\n */\n readonly header: (context: CspHeaderContext) => string | undefined;\n /** Generate the nonce for a document that needs one. Default: 122 random bits, CSP base64-safe. */\n readonly generate?: () => string;\n}"
4259
4266
  },
4267
+ {
4268
+ "name": "CreateInfiniteQueryOptions",
4269
+ "kind": "interface",
4270
+ "package": "@nifrajs/web-solid",
4271
+ "signature": "export interface CreateInfiniteQueryOptions<T, P> extends InfiniteQueryOptions<T, P> {\n readonly enabled?: boolean;\n}",
4272
+ "doc": "/** Options for a Solid infinite query. */"
4273
+ },
4274
+ {
4275
+ "name": "CreateInfiniteQueryResult",
4276
+ "kind": "interface",
4277
+ "package": "@nifrajs/web-solid",
4278
+ "signature": "export interface CreateInfiniteQueryResult<T, P> {\n readonly state: Accessor<QueryState<InfiniteData<T, P>>>;\n readonly isPending: Accessor<boolean>;\n readonly isError: Accessor<boolean>;\n readonly isSuccess: Accessor<boolean>;\n readonly hasNextPage: Accessor<boolean>;\n readonly hasPreviousPage: Accessor<boolean>;\n readonly fetchNextPage: () => Promise<InfiniteData<T, P>>;\n readonly fetchPreviousPage: () => Promise<InfiniteData<T, P>>;\n readonly refetch: () => Promise<InfiniteData<T, P>>;\n}",
4279
+ "doc": "/** Infinite-query state and page controls expressed as Solid accessors. */"
4280
+ },
4260
4281
  {
4261
4282
  "name": "CreateMcpServerOptions",
4262
4283
  "kind": "interface",
4263
4284
  "package": "@nifrajs/mcp",
4264
4285
  "signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets - their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n /** Max serialized JSON-RPC response or SSE frame size (default 1 MB). */\n readonly maxResponseBytes?: number;\n /** Max bytes an SSE stream queues for a client that is not reading (default 4 MiB). */\n readonly maxPendingBytes?: number;\n /** Natural-language guidance for LLMs, surfaced in the modern `server/discover` result (2026-07-28). */\n readonly instructions?: string;\n /** Explicitly allow browser clients from any origin. Omit for the secure same-origin default. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. Set it to permit exact cross-origin clients. */\n readonly allowedOrigins?: readonly string[];\n /** Host allowlist; set it for a server on localhost or a private network. See {@link McpHttpOptions}. */\n readonly allowedHosts?: readonly string[];\n /** Shared state for one authenticated MCP session; prefer `resolveState` for multi-session hosts. */\n readonly state?: McpProtocolState;\n /** Resolve a session-scoped request registry after per-message authorization. */\n readonly resolveState?: McpHttpOptions[\"resolveState\"];\n /**\n * Per-message authorization, applied after the message parses and before any tool runs. Return\n * `false` to answer 403 with a JSON-RPC `unauthorized` error (`MCP_ERROR.UNAUTHORIZED`) and no result.\n *\n * This is the seam for \"this caller may list tools but may not call the write ones\" - the HTTP\n * layer above only sees one opaque POST, so a route guard cannot make that distinction.\n * `fetch(request, { authorizeMessage })` overrides it per request when the decision depends on\n * something the surrounding handler resolved (a session, a tenant). With it set, a GET for the\n * server-message stream is answered `405`, since that stream has no message to authorize.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
4265
4286
  },
4287
+ {
4288
+ "name": "CreateMutationResult",
4289
+ "kind": "interface",
4290
+ "package": "@nifrajs/web-solid",
4291
+ "signature": "export interface CreateMutationResult<TData, TVariables> {\n readonly state: Accessor<MutationState<TData, TVariables>>;\n readonly isIdle: Accessor<boolean>;\n readonly isPending: Accessor<boolean>;\n readonly isError: Accessor<boolean>;\n readonly isSuccess: Accessor<boolean>;\n readonly mutate: (variables: TVariables) => void;\n readonly mutateAsync: (variables: TVariables) => Promise<TData>;\n readonly reset: () => void;\n readonly cancel: () => void;\n}",
4292
+ "doc": "/** A mutation result expressed as Solid accessors and imperative controls. */"
4293
+ },
4266
4294
  {
4267
4295
  "name": "CreateNonceResolverOptions",
4268
4296
  "kind": "interface",
@@ -4316,7 +4344,7 @@
4316
4344
  "name": "CreateWebAppOptions",
4317
4345
  "kind": "interface",
4318
4346
  "package": "@nifrajs/web",
4319
- "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** Cache production module imports and layout preparation, never request data. Defaults to NODE_ENV === \"production\"; disable for a mutable manifest. */\n readonly cacheRouteModules?: boolean;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. The resolver does not declare a CSP header because the\n * policy's allowed sources are app-specific.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /** Experimental and unstable: features whose API may change in any release. */\n readonly experimental?: {\n /**\n * Partial prerendering, from `partialPrerendering()` in `@nifrajs/web/ppr`. A route whose backend\n * half exports `shellLoader` streams a shell shared by every visitor, then each `dynamic` boundary\n * as it settles. Needs `csp` (hashes), not `nonce`.\n */\n readonly ppr?: PprSetup;\n };\n /**\n * Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and\n * the rest of {@link ServerOptions}.\n *\n * Needed because the `Server` is constructed in here, so a caller has no other way to reach its\n * constructor: a page app could set no request timeout and no capacity gate, which are exactly the\n * two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -\n * a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that\n * exhausts the pod.\n *\n * Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate\n * sits at the fetch entry, ahead of the request hooks those are dispatched from.\n */\n readonly server?: ServerOptions;\n /**\n * Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,\n * `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.\n *\n * ```ts\n * createWebApp({\n * …,\n * use: (app) => {\n * app.use(securityHeaders())\n * app.use(requestId())\n * },\n * })\n * ```\n *\n * A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,\n * `ContextPlugin` - and only the real call site instantiates the right overload. The return value\n * is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the\n * returned app, where they get their types).\n *\n * **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and\n * `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every\n * page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards would\n * bind them to no page, and outside production it throws (`HOOK_AFTER_PAGES`). `requestId()` is\n * exactly that case: it is a `derive`, so applied late it would leave every page without\n * `c.requestId`. A `group()` is its own scope and stays allowed. Route assurance evidence is order-scoped the same\n * way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`\n * even though it does still set it.\n *\n * `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at\n * request time, so those alone DO work when added late. Using this seam for everything avoids\n * having to remember which is which.\n *\n * Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards\n * a mounted auth handler too.\n *\n * A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of\n * this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are\n * idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the\n * plugin a second time.\n */\n readonly use?: (app: ReturnType<typeof server<Env>>) => void;\n /** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed\n * per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.\n *\n * **Auto-mount.** Every `inProcessClient(backend)` exposes the symbol-keyed platform-aware backend\n * mount interface from `@nifrajs/core/mount`; given an {@link apiPrefix}, `createWebApp` also serves\n * that backend over HTTP there: a request whose pathname starts with the prefix is dispatched before\n * page routing with the same `env`/`waitUntil` platform context, and the backend's `Response` is\n * returned untouched. The mount runs in `nifra dev` too. Without `apiPrefix` the backend is\n * loader-only.\n *\n * **Request-scoped loader calls.** While a page renders, its loaders, actions and boundaries get a\n * `ctx.api` bound to that request's platform identity: a backend handler reached through it sees the\n * visitor's `c.clientIp` (derived under this app's `server.clientIp` trust declaration), `c.env` and\n * `c.waitUntil`, so a per-caller rate limit or audit field keys on the real visitor. `c.clientIp` is\n * the supported way to read the caller - identity travels in the platform, so rebuilding a `Request`\n * does not lose it. Headers do NOT travel: the page request's `cookie` and `authorization` are never\n * copied, so a loader call is anonymous unless the loader passes headers on the call itself. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is mounted at, such as `\"/api\"`. A request whose\n * pathname is exactly the prefix or starts with `prefix + \"/\"` is dispatched to the backend before\n * page routing; the backend therefore defines its routes at the **full** path (`server().post(\"/api/\n * sync\", …)`), matching the in-process `inProcessClient` call sites. Unset or `\"\"`, nothing is\n * mounted: the app serves pages only and `api` stays a loader-only `ctx.api`. Mounting is also a\n * no-op when `api` does not expose the symbol mount.\n *\n * A page file under the prefix (`routes/api/report.tsx`) could never render - the backend answers\n * first and its 404 is final - so `createWebApp` throws, naming the file. The same holds for every\n * other pre-route mount. */\n readonly apiPrefix?: string;\n /**\n * Strip {@link apiPrefix} from the pathname before dispatching to `api` (default `false`).\n *\n * The default suits a backend that declares FULL paths (`server().post(\"/api/sync\", …)`), which is\n * right when it is only ever mounted here. Set this when the backend declares its routes WITHOUT the\n * prefix because it also runs standalone behind its own shell, so its paths cannot carry a prefix that\n * only exists when it is mounted. Without it every request 404s inside the backend, and the workaround\n * is a `Proxy` that rewrites each URL.\n */\n readonly apiStrip?: boolean;\n /**\n * Sub-apps mounted ahead of page routing - an auth handler, a webhook receiver, a stack's routes.\n *\n * Structural on purpose: anything with `{ path, app: { fetch } }` fits, so a library that exposes its\n * routes as such a list mounts as `mounts: theirRoutes` without `@nifrajs/web` taking a dependency on\n * it. `better-auth` is the motivating case - it is not a `backend` route, so `/api/auth/*` used to 404\n * silently.\n *\n * Tried longest-path-first and BEFORE the `api` mount, so a mount at `/api/auth` wins over a backend\n * at `/api` no matter which was declared first. `stripPrefix` is the per-mount form of {@link apiStrip}:\n * leave it off to pass the full path through. `opaque` states why a mount whose routes nifra cannot\n * read (better-auth's handler) is outside assurance; it is then listed as a known gap, with any\n * routes it declares reported as declared.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: MountableApp<Env>;\n readonly stripPrefix?: boolean;\n readonly priority?: number;\n readonly fallbackOn?: 404;\n readonly opaque?: MountOptions<Env>[\"opaque\"];\n }>;\n /** Secret for **draft / preview mode** (see `enableDraft`). When set, a request carrying a valid\n * signed `__nifra_draft` cookie gets `ctx.draft === true` in loaders/actions (else always `false`).\n * Pair with `withISR({ draftSecret })` so editors bypass the cache. Omit to disable draft mode. */\n readonly draftSecret?: string;\n /**\n * Live data refresh, from `live()` in `@nifrajs/web/live`. Loaders declare keys with `ctx.live()`;\n * the app answers live loads at the runtime's load endpoint. Omit and nothing live is loaded.\n */\n readonly live?: LiveRuntimeHandle;\n /** Per-route chunk URLs (`buildClient`'s `BuildManifest.routes`) - `routeId → [layout chunks…, own\n * chunk]`. When present, each page `modulepreload`s its matched route's chunks alongside the entry,\n * so the route code downloads in parallel (no entry→route-chunk waterfall). Omit ⇒ entry-only. */\n readonly routePreload?: Readonly<Record<string, readonly string[]>>;\n /** The app's bundled stylesheet URLs (`buildClient`'s `BuildManifest.css`) - the aggregate, injected\n * as `<link rel=\"stylesheet\">` in a page's `<head>`. Used as the fallback for any route absent from\n * {@link routeStyles}. Omit ⇒ no links (dev, where Vite injects CSS, or a CSS-free app). */\n readonly styles?: readonly string[];\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - `routeId → [chain CSS]`.\n * When a matched route has an entry here, only those (its layout chain + own CSS) are linked instead\n * of the aggregate `styles`, so a page ships only the CSS it uses. An empty array ⇒ no `<link>` (the\n * page imports no CSS). Routes absent here fall back to `styles`. Omit ⇒ always use `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`, the server manifest's\n * `copyChunks`). A production client build moves copy tables (`@nifrajs/i18n/copy`) into one chunk per\n * locale; each page lists them for the browser and preloads its own. Omit ⇒ tables keep their values. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /**\n * The app's locale routing, `defineI18nRouting()` from `@nifrajs/i18n/routing`, registered once:\n * export it as `i18n` from `backend/framework.ts`. Every document then takes its locale from the\n * URL: `<html lang dir>` from the registry unless the route's meta sets `lang`, a `Content-Language`\n * header, and the locale each adapter's `useLocale()` and `<I18nProvider>` read. A route under a\n * `[lang]` or `[[lang]]` directory is checked with its `matchSegment()` before any middleware: an\n * unserved locale, or a page missing from it, is a 404, and a non-canonical prefix (`/en/x` when the\n * default is unprefixed) redirects with a 308.\n */\n readonly i18n?: WebAppI18n;\n /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Handed over as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav\n * into a prerendered route fetches its static `_data.json` instead of hitting the worker, unless the\n * target carries a query string, which renders on demand as a hard request does. A set over\n * 4 KB of JSON is served once from `/__nifra/prerendered.json?v=<version>`, cacheable for good, and\n * pages hand over only that URL; `prerenderRoutes` writes the file into a static output. */\n readonly prerenderedPaths?: readonly string[];\n /**\n * Pages a self-hosted build prerendered, answered from their file instead of rendered. `nifra build\n * --target bun|node` wires this from its prerender pass. The page is served from the page route,\n * so `use` middleware and every request hook run first; a request with a query string, a navigation\n * data or component request, or a draft-mode visitor renders on demand as before. Ignored with\n * {@link nonce}, whose documents need a nonce minted for their request.\n */\n readonly prerenderedPages?: PrerenderedPages;\n /**\n * Which pages and files each host serves, from `createHostPolicy()`. Evaluated before everything\n * else the app answers (prerendered pages, mounts, the API, every page) and, in a `nifra build`\n * server entry, before its static files too. A refused path answers the policy's refusal.\n */\n readonly hostPolicy?: HostPolicy;\n /**\n * Which cookies say who is signed in, for an app with a `keepAlive` route. A response that changes\n * or deletes one rotates the readable identity epoch cookie, and every tab drops the pages it kept\n * for the previous visitor. The session cookies of `@nifrajs/auth` and Auth.js count under their\n * default names, Better Auth's under any `cookiePrefix`; name any other in `identityCookies`. An app\n * run by `nifra dev` and `nifra build` exports this from `backend/framework.ts`. Development reports, once per\n * name, an `HttpOnly` cookie that changes and is in neither list (`NIFRA_KEEPALIVE_IDENTITY_COOKIE`).\n */\n readonly keepAlive?: KeepAliveServerOptions;\n /**\n * The files the build emitted, by request path: `buildAssets` from the generated server manifest.\n * A {@link hostPolicy} rule's `buildAssets` token matches exactly these. `nifra dev` serves the\n * client bundle and `public/` ahead of the app, so the app's own check never sees them there.\n */\n readonly buildAssets?: BuildAssetSet;\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** Serve `/llms.txt` and `/llms-full.txt`: the page routes, and the backend routes when the backend\n * is mounted over HTTP at {@link apiPrefix}, with their request and response schemas in the full\n * text. **Off by default**: both are public and unauthenticated, and they list every route, admin\n * and internal ones included. Turn it on for an app whose whole surface you would publish. */\n readonly llmsTxt?: boolean;\n /** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or\n * the build's `prerendered.json`). A route mapped to `\"404\"` rejects any path NOT in\n * `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `\"ssr\"` (the\n * default for unmapped routes) renders unlisted paths on-demand. */\n readonly staticFallbacks?: Readonly<Record<string, \"ssr\" | \"404\">>;\n /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow. A failure a boundary answers is also written to the\n * server's `logger` (under its `errorLogDetail`) whether or not this is set, exactly as an unhandled\n * error is. Observation only; its own throws are swallowed so a faulty reporter can't break\n * rendering. (`beforeLoader` is intentionally omitted - the core HTTP hooks already cover\n * pre-request work.) */\n readonly onLoaderError?: (error: unknown, ctx: {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly route: string;\n }) => void;\n}"
4347
+ "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** Cache production module imports and layout preparation, never request data. Defaults to NODE_ENV === \"production\"; disable for a mutable manifest. */\n readonly cacheRouteModules?: boolean;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. Pass {@link cspHeader} to have nifra write the\n * Content-Security-Policy header from the same value.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * Build the Content-Security-Policy value for each document a {@link nonce} app renders, or return\n * `undefined` to send none. nifra sets it on every document it renders - pages, status pages,\n * `_error`, streamed and deferred documents - from the nonce it put on that document's scripts, so\n * the header never depends on which `Request` object a wrapper holds. `sources` is the\n * `script-src` list the document needs: `'nonce-…'` plus a `'sha256-…'` hash for each constant\n * inline script nifra writes, which covers a document the resolver left nonce-free.\n *\n * ```ts\n * cspHeader: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`\n * ```\n *\n * Needs `nonce`; `csp` writes its own header, so the two are refused together.\n */\n readonly cspHeader?: (context: CspHeaderContext) => string | undefined;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /**\n * Partial prerendering, from `partialPrerendering()` in `@nifrajs/web/ppr`. A route whose backend\n * half exports `shellLoader` streams a shell shared by every visitor, then each `dynamic` boundary\n * as it settles. `csp` (hashes) is optional; `nonce` is refused, since a per-request nonce would\n * make every shell unique.\n */\n readonly ppr?: PprSetup;\n /**\n * Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and\n * the rest of {@link ServerOptions}.\n *\n * Needed because the `Server` is constructed in here, so a caller has no other way to reach its\n * constructor: a page app could set no request timeout and no capacity gate, which are exactly the\n * two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -\n * a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that\n * exhausts the pod.\n *\n * Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate\n * sits at the fetch entry, ahead of the request hooks those are dispatched from.\n */\n readonly server?: ServerOptions;\n /**\n * Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,\n * `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.\n *\n * ```ts\n * createWebApp({\n * …,\n * use: (app) => {\n * app.use(securityHeaders())\n * app.use(requestId())\n * },\n * })\n * ```\n *\n * A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,\n * `ContextPlugin` - and only the real call site instantiates the right overload. The return value\n * is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the\n * returned app, where they get their types).\n *\n * **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and\n * `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every\n * page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards would\n * bind them to no page, and outside production it throws (`HOOK_AFTER_PAGES`). `requestId()` is\n * exactly that case: it is a `derive`, so applied late it would leave every page without\n * `c.requestId`. A `group()` is its own scope and stays allowed. Route assurance evidence is order-scoped the same\n * way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`\n * even though it does still set it.\n *\n * `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at\n * request time, so those alone DO work when added late. Using this seam for everything avoids\n * having to remember which is which.\n *\n * Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards\n * a mounted auth handler too.\n *\n * A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of\n * this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are\n * idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the\n * plugin a second time.\n */\n readonly use?: (app: ReturnType<typeof server<Env>>) => void;\n /** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed\n * per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.\n *\n * **Auto-mount.** Every `inProcessClient(backend)` exposes the symbol-keyed platform-aware backend\n * mount interface from `@nifrajs/core/mount`; given an {@link apiPrefix}, `createWebApp` also serves\n * that backend over HTTP there: a request whose pathname starts with the prefix is dispatched before\n * page routing with the same `env`/`waitUntil` platform context, and the backend's `Response` is\n * returned untouched. The mount runs in `nifra dev` too. Without `apiPrefix` the backend is\n * loader-only.\n *\n * **Request-scoped loader calls.** While a page renders, its loaders, actions and boundaries get a\n * `ctx.api` bound to that request's platform identity: a backend handler reached through it sees the\n * visitor's `c.clientIp` (derived under this app's `server.clientIp` trust declaration), `c.env` and\n * `c.waitUntil`, so a per-caller rate limit or audit field keys on the real visitor. `c.clientIp` is\n * the supported way to read the caller - identity travels in the platform, so rebuilding a `Request`\n * does not lose it. Headers do NOT travel: the page request's `cookie` and `authorization` are never\n * copied, so a loader call is anonymous unless the loader passes headers on the call itself. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is mounted at, such as `\"/api\"`. A request whose\n * pathname is exactly the prefix or starts with `prefix + \"/\"` is dispatched to the backend before\n * page routing; the backend therefore defines its routes at the **full** path (`server().post(\"/api/\n * sync\", …)`), matching the in-process `inProcessClient` call sites. Unset or `\"\"`, nothing is\n * mounted: the app serves pages only and `api` stays a loader-only `ctx.api`. Mounting is also a\n * no-op when `api` does not expose the symbol mount.\n *\n * A page file under the prefix (`routes/api/report.tsx`) could never render - the backend answers\n * first and its 404 is final - so `createWebApp` throws, naming the file. The same holds for every\n * other pre-route mount. */\n readonly apiPrefix?: string;\n /**\n * Strip {@link apiPrefix} from the pathname before dispatching to `api` (default `false`).\n *\n * The default suits a backend that declares FULL paths (`server().post(\"/api/sync\", …)`), which is\n * right when it is only ever mounted here. Set this when the backend declares its routes WITHOUT the\n * prefix because it also runs standalone behind its own shell, so its paths cannot carry a prefix that\n * only exists when it is mounted. Without it every request 404s inside the backend, and the workaround\n * is a `Proxy` that rewrites each URL.\n */\n readonly apiStrip?: boolean;\n /**\n * Sub-apps mounted ahead of page routing - an auth handler, a webhook receiver, a stack's routes.\n *\n * Structural on purpose: anything with `{ path, app: { fetch } }` fits, so a library that exposes its\n * routes as such a list mounts as `mounts: theirRoutes` without `@nifrajs/web` taking a dependency on\n * it. `better-auth` is the motivating case - it is not a `backend` route, so `/api/auth/*` used to 404\n * silently.\n *\n * Tried longest-path-first and BEFORE the `api` mount, so a mount at `/api/auth` wins over a backend\n * at `/api` no matter which was declared first. `stripPrefix` is the per-mount form of {@link apiStrip}:\n * leave it off to pass the full path through. `opaque` states why a mount whose routes nifra cannot\n * read (better-auth's handler) is outside assurance; it is then listed as a known gap, with any\n * routes it declares reported as declared.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: MountableApp<Env>;\n readonly stripPrefix?: boolean;\n readonly priority?: number;\n readonly fallbackOn?: 404;\n readonly opaque?: MountOptions<Env>[\"opaque\"];\n }>;\n /** Secret for **draft / preview mode** (see `enableDraft`). When set, a request carrying a valid\n * signed `__nifra_draft` cookie gets `ctx.draft === true` in loaders/actions (else always `false`).\n * Pair with `withISR({ draftSecret })` so editors bypass the cache. Omit to disable draft mode. */\n readonly draftSecret?: string;\n /**\n * Live data refresh, from `live()` in `@nifrajs/web/live`. Loaders declare keys with `ctx.live()`;\n * the app answers live loads at the runtime's load endpoint. Omit and nothing live is loaded.\n */\n readonly live?: LiveRuntimeHandle;\n /** Per-route chunk URLs (`buildClient`'s `BuildManifest.routes`) - `routeId → [layout chunks…, own\n * chunk]`. When present, each page `modulepreload`s its matched route's chunks alongside the entry,\n * so the route code downloads in parallel (no entry→route-chunk waterfall). Omit ⇒ entry-only. */\n readonly routePreload?: Readonly<Record<string, readonly string[]>>;\n /** The app's bundled stylesheet URLs (`buildClient`'s `BuildManifest.css`) - the aggregate, injected\n * as `<link rel=\"stylesheet\">` in a page's `<head>`. Used as the fallback for any route absent from\n * {@link routeStyles}. Omit ⇒ no links (dev, where Vite injects CSS, or a CSS-free app). */\n readonly styles?: readonly string[];\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - `routeId → [chain CSS]`.\n * When a matched route has an entry here, only those (its layout chain + own CSS) are linked instead\n * of the aggregate `styles`, so a page ships only the CSS it uses. An empty array ⇒ no `<link>` (the\n * page imports no CSS). Routes absent here fall back to `styles`. Omit ⇒ always use `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`, the server manifest's\n * `copyChunks`). A production client build moves copy tables (`@nifrajs/i18n/copy`) into one chunk per\n * locale; each page lists them for the browser and preloads its own. Omit ⇒ tables keep their values. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /**\n * The app's locale routing, `defineI18nRouting()` from `@nifrajs/i18n/routing`, registered once:\n * export it as `i18n` from `backend/framework.ts`. Every document then takes its locale from the\n * URL: `<html lang dir>` from the registry unless the route's meta sets `lang`, a `Content-Language`\n * header, and the locale each adapter's `useLocale()` and `<I18nProvider>` read. A route under a\n * `[lang]` or `[[lang]]` directory is checked with its `matchSegment()` before any middleware: an\n * unserved locale, or a page missing from it, is a 404, and a non-canonical prefix (`/en/x` when the\n * default is unprefixed) redirects with a 308.\n */\n readonly i18n?: WebAppI18n;\n /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Handed over as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav\n * into a prerendered route fetches its static `_data.json` instead of hitting the worker, unless the\n * target carries a query string, which renders on demand as a hard request does. A set over\n * 4 KB of JSON is served once from `/__nifra/prerendered.json?v=<version>`, cacheable for good, and\n * pages hand over only that URL; `prerenderRoutes` writes the file into a static output. */\n readonly prerenderedPaths?: readonly string[];\n /**\n * Pages a self-hosted build prerendered, answered from their file instead of rendered. `nifra build\n * --target bun|node` wires this from its prerender pass. The page is served from the page route,\n * so `use` middleware and every request hook run first; a request with a query string, a navigation\n * data or component request, or a draft-mode visitor renders on demand as before. Ignored with\n * {@link nonce}, whose documents need a nonce minted for their request.\n */\n readonly prerenderedPages?: PrerenderedPages;\n /**\n * Which pages and files each host serves, from `createHostPolicy()`. Evaluated before everything\n * else the app answers (prerendered pages, mounts, the API, every page) and, in a `nifra build`\n * server entry, before its static files too. A refused path answers the policy's refusal.\n */\n readonly hostPolicy?: HostPolicy;\n /**\n * Which cookies say who is signed in, for an app with a `keepAlive` route. A response that changes\n * or deletes one rotates the readable identity epoch cookie, and every tab drops the pages it kept\n * for the previous visitor. The session cookies of `@nifrajs/auth` and Auth.js count under their\n * default names, Better Auth's under any `cookiePrefix`; name any other in `identityCookies`. An app\n * run by `nifra dev` and `nifra build` exports this from `backend/framework.ts`. Development reports, once per\n * name, an `HttpOnly` cookie that changes and is in neither list (`NIFRA_KEEPALIVE_IDENTITY_COOKIE`).\n */\n readonly keepAlive?: KeepAliveServerOptions;\n /**\n * The files the build emitted, by request path: `buildAssets` from the generated server manifest.\n * A {@link hostPolicy} rule's `buildAssets` token matches exactly these. `nifra dev` serves the\n * client bundle and `public/` ahead of the app, so the app's own check never sees them there.\n */\n readonly buildAssets?: BuildAssetSet;\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** Serve `/llms.txt` and `/llms-full.txt`: the page routes, and the backend routes when the backend\n * is mounted over HTTP at {@link apiPrefix}, with their request and response schemas in the full\n * text. **Off by default**: both are public and unauthenticated, and they list every route, admin\n * and internal ones included. Turn it on for an app whose whole surface you would publish. */\n readonly llmsTxt?: boolean;\n /** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or\n * the build's `prerendered.json`). A route mapped to `\"404\"` rejects any path NOT in\n * `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `\"ssr\"` (the\n * default for unmapped routes) renders unlisted paths on-demand. */\n readonly staticFallbacks?: Readonly<Record<string, \"ssr\" | \"404\">>;\n /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow. A failure a boundary answers is also written to the\n * server's `logger` (under its `errorLogDetail`) whether or not this is set, exactly as an unhandled\n * error is. Observation only; its own throws are swallowed so a faulty reporter can't break\n * rendering. (`beforeLoader` is intentionally omitted - the core HTTP hooks already cover\n * pre-request work.) */\n readonly onLoaderError?: (error: unknown, ctx: {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly route: string;\n }) => void;\n}"
4320
4348
  },
4321
4349
  {
4322
4350
  "name": "CronError",
@@ -4829,7 +4857,7 @@
4829
4857
  "name": "DbRefusalCode",
4830
4858
  "kind": "type",
4831
4859
  "package": "@nifrajs/mcp-db",
4832
- "signature": "export type DbRefusalCode = \"NIFRA_DB_NOT_DECLARED\" | \"NIFRA_DB_CONFIG\" | \"NIFRA_DB_OUTSIDE_ROOT\" | \"NIFRA_DB_REMOTE_HOST\" | \"NIFRA_DB_SUPERUSER\" | \"NIFRA_DB_EXTENSION\" | \"NIFRA_DB_QUERY_OFF\" | \"NIFRA_DB_WRITE_REFUSED\" | \"NIFRA_DB_FUNCTION_REFUSED\" | \"NIFRA_DB_TABLE_EXCLUDED\" | \"NIFRA_DB_COLUMN_REFUSED\" | \"NIFRA_DB_TIMEOUT\" | \"NIFRA_DB_QUERY_FAILED\" | \"NIFRA_DB_DRIVER\";",
4860
+ "signature": "export type DbRefusalCode = \"NIFRA_DB_NOT_DECLARED\" | \"NIFRA_DB_CONFIG\" | \"NIFRA_DB_OUTSIDE_ROOT\" | \"NIFRA_DB_REMOTE_HOST\" | \"NIFRA_DB_SUPERUSER\" | \"NIFRA_DB_EXTENSION\" | \"NIFRA_DB_ROLE_GRANTS\" | \"NIFRA_DB_QUERY_OFF\" | \"NIFRA_DB_WRITE_REFUSED\" | \"NIFRA_DB_FUNCTION_REFUSED\" | \"NIFRA_DB_TABLE_EXCLUDED\" | \"NIFRA_DB_COLUMN_REFUSED\" | \"NIFRA_DB_TIMEOUT\" | \"NIFRA_DB_QUERY_FAILED\" | \"NIFRA_DB_DRIVER\";",
4833
4861
  "doc": "/** Every reason a database call is refused or fails, as a stable code. */"
4834
4862
  },
4835
4863
  {
@@ -4997,6 +5025,20 @@
4997
5025
  "package": "nifra",
4998
5026
  "signature": "export type DefinePluginResult<In extends AnyServer, Out extends AnyServer> = ServerTypeUnpinned<In> extends true ? PluginTypeCollapsed : NifraPlugin<In, Out>;"
4999
5027
  },
5028
+ {
5029
+ "name": "DehydrateOptions",
5030
+ "kind": "interface",
5031
+ "package": "@nifrajs/web",
5032
+ "signature": "export interface DehydrateOptions {\n /** Every dehydrated value is serialized into the page and readable by the visitor, so a query is\n * included only when this returns `true`. Without it `dehydrate` sends nothing. */\n readonly shouldDehydrateQuery?: (query: DehydratedQueryInfo) => boolean;\n}",
5033
+ "doc": "/** Select which successful query values may cross the SSR-to-browser boundary. */"
5034
+ },
5035
+ {
5036
+ "name": "DehydratedQueryInfo",
5037
+ "kind": "interface",
5038
+ "package": "@nifrajs/web",
5039
+ "signature": "export interface DehydratedQueryInfo {\n readonly kind: \"query\" | \"infinite\";\n readonly key: unknown;\n readonly data: unknown;\n readonly updatedAt: number;\n}",
5040
+ "doc": "/** Metadata passed to a dehydration filter before query data is sent to the browser. */"
5041
+ },
5000
5042
  {
5001
5043
  "name": "DehydratedState",
5002
5044
  "kind": "interface",
@@ -5520,7 +5562,7 @@
5520
5562
  "name": "DurableObjectRecordBackend",
5521
5563
  "kind": "class",
5522
5564
  "package": "@nifrajs/core",
5523
- "signature": "export declare class DurableObjectRecordBackend implements DurableRecordBackend {\n private readonly storage;\n constructor(storage: DurableObjectStorage);\n private recordKey;\n private leaseKey;\n create(kind: DurableRecordKind, id: string, record: {\n readonly version: number;\n readonly state?: string;\n readonly updatedAt?: number;\n }): Promise<boolean>;\n get<T extends {\n readonly version: number;\n }>(kind: DurableRecordKind, id: string): Promise<T | undefined>;\n compareAndSet(kind: DurableRecordKind, id: string, expectedVersion: number, record: {\n readonly version: number;\n readonly state?: string;\n readonly updatedAt?: number;\n }): Promise<boolean>;\n scan<T extends {\n readonly state: string;\n readonly updatedAt: number;\n }>(kind: DurableRecordKind, input: ReconciliationScanOptions<string>): Promise<ReconciliationScanPage<T>>;\n acquireLease(input: Parameters<DurableRecordBackend[\"acquireLease\"]>[0]): Promise<ReconciliationLease | undefined>;\n renewLease(input: Parameters<DurableRecordBackend[\"renewLease\"]>[0]): Promise<boolean>;\n checkpointLease(input: Parameters<DurableRecordBackend[\"checkpointLease\"]>[0]): Promise<boolean>;\n releaseLease(input: Parameters<DurableRecordBackend[\"releaseLease\"]>[0]): Promise<boolean>;\n}"
5565
+ "signature": "export declare class DurableObjectRecordBackend implements DurableRecordBackend {\n private readonly storage;\n constructor(storage: DurableObjectStorage);\n private recordKey;\n private leaseKey;\n create(kind: DurableRecordKind, id: string, record: {\n readonly version: number;\n readonly state?: string;\n readonly updatedAt?: number;\n }): Promise<boolean>;\n get<T extends {\n readonly version: number;\n }>(kind: DurableRecordKind, id: string): Promise<T | undefined>;\n compareAndSet(kind: DurableRecordKind, id: string, expectedVersion: number, record: {\n readonly version: number;\n readonly state?: string;\n readonly updatedAt?: number;\n }): Promise<boolean>;\n scan<T extends {\n readonly state: string;\n readonly updatedAt: number;\n }>(kind: DurableRecordKind, input: ReconciliationScanOptions<string>): Promise<ReconciliationScanPage<T>>;\n acquireLease(input: Parameters<DurableRecordBackend[\"acquireLease\"]>[0]): Promise<ReconciliationLease | undefined>;\n renewLease(input: Parameters<DurableRecordBackend[\"renewLease\"]>[0]): Promise<boolean>;\n checkpointLease(input: Parameters<DurableRecordBackend[\"checkpointLease\"]>[0]): Promise<boolean>;\n releaseLease(input: Parameters<DurableRecordBackend[\"releaseLease\"]>[0]): Promise<boolean>;\n /** Write `next(current)` over the lease while `input`'s owner and token still hold it. */\n private updateHeldLease;\n}"
5524
5566
  },
5525
5567
  {
5526
5568
  "name": "DurableObjectStorage",
@@ -5550,7 +5592,7 @@
5550
5592
  "name": "DynamicBoundary",
5551
5593
  "kind": "type",
5552
5594
  "package": "@nifrajs/web",
5553
- "signature": "export type DynamicBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: \"dynamic\";\n readonly load?: (ctx: BoundaryRequestCtx) => Data | Promise<Data>;\n /** Experimental, partial prerendering: the hole ships its props and hydrates. Default `false`. */\n readonly interactive?: boolean;\n /** Experimental, partial prerendering: the hole's deadline in milliseconds. Default 5000. */\n readonly timeout?: number;\n};"
5595
+ "signature": "export type DynamicBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: \"dynamic\";\n readonly load?: (ctx: BoundaryRequestCtx) => Data | Promise<Data>;\n /** Partial prerendering: the hole ships its props and hydrates. Default `false`. */\n readonly interactive?: boolean;\n /** Partial prerendering: the hole's deadline in milliseconds. Default 5000. */\n readonly timeout?: number;\n};"
5554
5596
  },
5555
5597
  {
5556
5598
  "name": "DynamicBoundaryBatch",
@@ -6335,7 +6377,7 @@
6335
6377
  "kind": "interface",
6336
6378
  "package": "@nifrajs/web",
6337
6379
  "signature": "export interface Fetcher {\n /** Current state; stable reference between transitions. */\n snapshot: () => FetcherState;\n /** Subscribe to this fetcher's transitions; returns an unsubscribe fn. */\n subscribe: (listener: () => void) => () => void;\n /** Load a route path's loader data into this fetcher's own `data` (also writes the shared cache).\n * A no-op for an unmatched path. */\n load: (path: string) => Promise<void>;\n /** Submit an action into this fetcher's own state; honors `X-Nifra-Revalidate` by refreshing the\n * active route + any mounted fetcher showing a changed path. Rejects on failure (caller falls back).\n * (No `revalidate` opt-out - a fetcher has no active loader of its own to skip.) */\n submit: (action: string, body: NonNullable<RequestInit[\"body\"]>) => Promise<void>;\n}",
6338
- "doc": "/**\n * An independent load/submit state machine, retrieved by `router.fetcher(key)`. Runs **concurrently**\n * with the main router and with other fetchers - each is single-flight against *itself* (its own\n * monotonic generation), so N row-level mutations / side-channel loads can be in flight at once without\n * disturbing the active view. Loads/submits write the shared cache and honor `X-Nifra-Revalidate`.\n */"
6380
+ "doc": "/**\n * An independent load/submit state machine, retrieved by `router.fetcher(key)`. Runs **concurrently**\n * with the main router and with other fetchers - each is single-flight against *itself* (its own\n * monotonic generation), so N row-level mutations / side-channel loads can be in flight at once without\n * disturbing the active view. Loads/submits write the shared cache and honor `X-Nifra-Revalidate`.\n * When the visitor changes (`identityChanged()` in this tab, or a new identity epoch cookie, read on\n * the next `fetcher()`), every fetcher goes back to idle; a submit in flight still answers.\n */"
6339
6381
  },
6340
6382
  {
6341
6383
  "name": "FetcherHandle",
@@ -6445,6 +6487,12 @@
6445
6487
  "signature": "export interface FileVersion {\n readonly dev: number;\n readonly ino: number;\n readonly size: number;\n readonly mtimeMs: number;\n readonly ctimeMs: number;\n}",
6446
6488
  "doc": "/**\n * The stat fields that tell one version of a file from another on one host: node:fs `Stats` as it is,\n * or Deno's `FileInfo` with its dates as epoch milliseconds and a field it lacks as `NaN`.\n */"
6447
6489
  },
6490
+ {
6491
+ "name": "FilledRoutePath",
6492
+ "kind": "type",
6493
+ "package": "@nifrajs/core",
6494
+ "signature": "export type FilledRoutePath = {\n readonly ok: true;\n readonly path: string;\n} | {\n readonly ok: false;\n /** Params the pattern names that `params` leaves out or holds as the empty string. */\n readonly missing: readonly string[];\n /** Params whose value cannot be carried or would be split differently by this pattern. */\n readonly invalid: readonly string[];\n};"
6495
+ },
6448
6496
  {
6449
6497
  "name": "FixOption",
6450
6498
  "kind": "interface",
@@ -6622,12 +6670,6 @@
6622
6670
  "package": "@nifrajs/testing",
6623
6671
  "signature": "export interface GenerateRegressionTestOptions {\n /** Import specifier for the app under test. Default `\"../src/app\"`. */\n readonly importPath?: string;\n /** Named export of the app. Default `\"app\"`. */\n readonly appExport?: string;\n /** Also assert the response shape. Default false (status-only is the robust regression signal). */\n readonly assertShape?: boolean;\n /** Dotted key paths in the request body whose string values are safe to embed verbatim. */\n readonly allow?: readonly string[];\n /** Query parameter names whose values are safe to embed verbatim. Default none. */\n readonly allowQuery?: readonly string[];\n /** Header names (any case) whose values are safe to embed verbatim. Default `[\"content-type\"]`. */\n readonly allowHeaders?: readonly string[];\n /** Embed the capsule's `note` verbatim. Default false: a note is free text and is redacted. */\n readonly keepNote?: boolean;\n}"
6624
6672
  },
6625
- {
6626
- "name": "GenerateRouteSearchTypesOptions",
6627
- "kind": "interface",
6628
- "package": "@nifrajs/web",
6629
- "signature": "export interface GenerateRouteSearchTypesOptions {\n /** Turn a route source file into a module specifier for a `typeof import(...)` type - the same contract\n * as `generateClientEntry`'s `resolve`, but WITHOUT a file extension (a `.d.ts` imports a module, not a\n * path). Relative to wherever the emitted `.d.ts` is written. */\n readonly resolve: (file: string) => string;\n /** The module whose `RouteSearch` interface is augmented (default `\"@nifrajs/web\"`). Every adapter's\n * `NavigateTarget` reads `@nifrajs/web`'s `RouteSearch`, so the default types `navigate` on all of them. */\n readonly module?: string;\n}"
6630
- },
6631
6673
  {
6632
6674
  "name": "GenerateServerManifestOptions",
6633
6675
  "kind": "interface",
@@ -6796,6 +6838,27 @@
6796
6838
  "signature": "export interface HandoffView {\n readonly requestId: string;\n readonly runId: string;\n readonly nodeId: string;\n readonly capability: string;\n readonly vector: number;\n readonly expiresAt: number;\n readonly state: HandoffLifecycleState;\n /** Opaque origin role. */\n readonly from: string;\n /** Opaque owner role once assigned. */\n readonly to?: string;\n}",
6797
6839
  "doc": "/** Content-free projection of one handoff boundary for a list/inspect view. */"
6798
6840
  },
6841
+ {
6842
+ "name": "HashedFiles",
6843
+ "kind": "type",
6844
+ "package": "@nifrajs/core",
6845
+ "signature": "export type HashedFiles = Iterable<string> | readonly RegExp[] | ((pathname: string) => boolean);",
6846
+ "doc": "/** Which files {@link ServeStaticOptions.hashedFiles} names: paths, patterns, or a predicate. */"
6847
+ },
6848
+ {
6849
+ "name": "HashedFiles",
6850
+ "kind": "type",
6851
+ "package": "@nifrajs/deno",
6852
+ "signature": "export type HashedFiles = Iterable<string> | readonly RegExp[] | ((pathname: string) => boolean);",
6853
+ "doc": "/** Which files {@link ServeStaticOptions.hashedFiles} names: paths, patterns, or a predicate. */"
6854
+ },
6855
+ {
6856
+ "name": "HashedFiles",
6857
+ "kind": "type",
6858
+ "package": "@nifrajs/node",
6859
+ "signature": "export type HashedFiles = Iterable<string> | readonly RegExp[] | ((pathname: string) => boolean);",
6860
+ "doc": "/** Which files {@link ServeStaticOptions.hashedFiles} names: paths, patterns, or a predicate. */"
6861
+ },
6799
6862
  {
6800
6863
  "name": "HealingEvent",
6801
6864
  "kind": "type",
@@ -6832,28 +6895,28 @@
6832
6895
  "kind": "function",
6833
6896
  "package": "@nifrajs/web-preact",
6834
6897
  "signature": "export declare function Hole<Data>(props: HoleProps<Data>): ComponentChildren;",
6835
- "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Preact never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own root from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive root re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6898
+ "doc": "/**\n * One `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Preact never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own root from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive root re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6836
6899
  },
6837
6900
  {
6838
6901
  "name": "Hole",
6839
6902
  "kind": "function",
6840
6903
  "package": "@nifrajs/web-react",
6841
6904
  "signature": "export declare function Hole<Data>(props: HoleProps<Data>): ReactNode;",
6842
- "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host React never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own root from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive root re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6905
+ "doc": "/**\n * One `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host React never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own root from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive root re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6843
6906
  },
6844
6907
  {
6845
6908
  "name": "Hole",
6846
6909
  "kind": "function",
6847
6910
  "package": "@nifrajs/web-solid",
6848
6911
  "signature": "export declare function Hole<Data>(props: HoleProps<Data>): JSX.Element;",
6849
- "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Solid never fills: the PPR runtime puts the server's\n * HTML into it, and an interactive hole then hydrates as its own root from the frame's props. When the\n * page reloads, after an action or a live change, the same host takes the new fill in place: an\n * interactive root gets the new props through its store and keeps its state. After a client\n * navigation the hole renders like any streamed boundary.\n */"
6912
+ "doc": "/**\n * One `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Solid never fills: the PPR runtime puts the server's\n * HTML into it, and an interactive hole then hydrates as its own root from the frame's props. When the\n * page reloads, after an action or a live change, the same host takes the new fill in place: an\n * interactive root gets the new props through its store and keeps its state. After a client\n * navigation the hole renders like any streamed boundary.\n */"
6850
6913
  },
6851
6914
  {
6852
6915
  "name": "Hole",
6853
6916
  "kind": "const",
6854
6917
  "package": "@nifrajs/web-vue",
6855
6918
  "signature": "export declare const Hole: new <Data>(props: HoleProps<Data> & {} & import(\"vue\").VNodeProps & import(\"vue\").AllowedComponentProps & import(\"vue\").ComponentCustomProps) => import(\"vue\").CreateComponentPublicInstanceWithMixins<HoleProps<Data> & {}, {}, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, import(\"vue\").PublicProps, {}, false, {}, HoleSlots, {}, {}, string, {}, any, import(\"vue\").ComponentProvideOptions, {\n P: {};\n B: {};\n D: {};\n C: {};\n M: {};\n Defaults: {};\n}, HoleProps<Data> & {}, {}, {}, {}, {}, {}>;",
6856
- "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Vue never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own app from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive app re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6919
+ "doc": "/**\n * One `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Vue never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own app from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive app re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6857
6920
  },
6858
6921
  {
6859
6922
  "name": "HoleDefinition",
@@ -6986,6 +7049,20 @@
6986
7049
  "package": "@nifrajs/agent",
6987
7050
  "signature": "export type HostileCodeIsolation = \"none\" | \"os\";"
6988
7051
  },
7052
+ {
7053
+ "name": "Href",
7054
+ "kind": "type",
7055
+ "package": "@nifrajs/web",
7056
+ "signature": "export type Href<Pattern extends string = string> = string & {\n readonly \"~nifraHref\": Pattern;\n};",
7057
+ "doc": "/**\n * An in-app URL: what `href()` builds from a route and `rawHref()` returns for a checked path. A string\n * at runtime, a branded string to the compiler, so a plain string or a template literal is not assignable\n * to it. `Pattern` is the {@link RouteTable} key it was built for. The brand is a named property, not a\n * `unique symbol`, so an `Href` from one copy of this package is assignable to another's.\n */"
7058
+ },
7059
+ {
7060
+ "name": "HrefOptions",
7061
+ "kind": "type",
7062
+ "package": "@nifrajs/web",
7063
+ "signature": "export type HrefOptions<K extends Pattern> = {\n readonly to: K;\n readonly search?: SearchOfRoute<K> | undefined;\n readonly hash?: string | undefined;\n} & ParamsOption<K>;",
7064
+ "doc": "/**\n * What {@link href} takes: the route's pattern as `to`, its `params` (required when the pattern has\n * any, absent when it has none), the route's `search` as its `searchSchema` outputs it, and the `hash`\n * without its `#`.\n */"
7065
+ },
6989
7066
  {
6990
7067
  "name": "HreflangLink",
6991
7068
  "kind": "interface",
@@ -7048,6 +7125,13 @@
7048
7125
  "signature": "export interface HydrationAssuranceOptions {\n readonly onWarning?: (message: string) => void;\n}",
7049
7126
  "doc": "/** Hydrate a server-rendered Vue layout `chain` (with the loader `props`) inside `container`. */"
7050
7127
  },
7128
+ {
7129
+ "name": "HydrationBoundary",
7130
+ "kind": "function",
7131
+ "package": "@nifrajs/web-preact",
7132
+ "signature": "export declare function HydrationBoundary(props: {\n readonly state: DehydratedState | undefined;\n readonly children?: ComponentChildren;\n}): ComponentChildren;",
7133
+ "doc": "/** Seed the provider's cache before its child queries read their first snapshot. */"
7134
+ },
7051
7135
  {
7052
7136
  "name": "HydrationBoundary",
7053
7137
  "kind": "function",
@@ -7112,7 +7196,7 @@
7112
7196
  "name": "I18nRoutingOptions",
7113
7197
  "kind": "interface",
7114
7198
  "package": "@nifrajs/i18n",
7115
- "signature": "export interface I18nRoutingOptions<K extends string = string> {\n /** Prefix the default locale too (`/en/about` instead of `/about`). Default `false`. */\n readonly prefixDefaultLocale?: boolean;\n /**\n * The locales a page exists in, by its pathname without the locale prefix, query or hash\n * (`/learn/x`); `undefined` for every served locale. It must be pure: every page of one cluster\n * has to answer the same set, or the alternates stop being reciprocal. A draft locale it names is\n * left out; a key the registry does not declare throws.\n *\n * ```ts\n * pageLocales: (pathname) => (pathname.startsWith(\"/learn/\") ? [\"en\", \"hi\"] : undefined)\n * ```\n */\n readonly pageLocales?: (pathname: string) => readonly K[] | undefined;\n}"
7199
+ "signature": "export interface I18nRoutingOptions<K extends string = string> {\n /** Prefix the default locale too (`/en/about` instead of `/about`). Default `false`. */\n readonly prefixDefaultLocale?: boolean;\n /** Explicit static, unprefixed canonical path → locale path mappings. Missing translations keep\n * the canonical pathname; availability still comes from `pageLocales`. No filesystem aliases,\n * dynamic slug translation or domain routing are created. Unicode is emitted percent-encoded. */\n readonly pathnames?: Readonly<Record<string, Partial<Record<K, string | undefined>>>>;\n /**\n * The locales a page exists in, by its canonical pathname without the locale prefix, query or hash\n * (`/learn/x`, the declared key for a mapped page); `undefined` for every served locale. It must be\n * pure: every page of one cluster has to answer the same set, or alternates stop being reciprocal.\n * A draft locale it names is left out; a key the registry does not declare throws.\n *\n * ```ts\n * pageLocales: (pathname) => (pathname.startsWith(\"/learn/\") ? [\"en\", \"hi\"] : undefined)\n * ```\n */\n readonly pageLocales?: (pathname: string) => readonly K[] | undefined;\n}"
7116
7200
  },
7117
7201
  {
7118
7202
  "name": "IDEMPOTENT_REPLAY_HEADER",
@@ -7142,6 +7226,13 @@
7142
7226
  "signature": "export declare const IDLE_BLOCKER: Blocker;",
7143
7227
  "doc": "/** The idle blocker - a stable reference (no needless adapter re-renders while unblocked). */"
7144
7228
  },
7229
+ {
7230
+ "name": "IMMUTABLE",
7231
+ "kind": "const",
7232
+ "package": "@nifrajs/core",
7233
+ "signature": "export declare const IMMUTABLE = \"public, max-age=31536000, immutable\";",
7234
+ "doc": "/** `cache-control` for a content-hashed file: its name changes with its bytes. */"
7235
+ },
7145
7236
  {
7146
7237
  "name": "ISRApp",
7147
7238
  "kind": "interface",
@@ -7344,28 +7435,40 @@
7344
7435
  "name": "Image",
7345
7436
  "kind": "function",
7346
7437
  "package": "@nifrajs/web-preact",
7347
- "signature": "export declare function Image(props: ImageComponentProps): VNode;",
7348
- "doc": "/**\n * Render a responsive, CLS-safe `<img>`. `width`+`height` are required (reserve layout space);\n * `priority` marks the LCP image (`eager` + `fetchpriority=\"high\"`). Extra DOM props pass through.\n */"
7438
+ "signature": "export declare function Image(props: ImageComponentProps | StaticImageComponentProps): VNode;",
7439
+ "doc": "/**\n * Render a responsive, CLS-safe `<img>`. String URLs require dimensions; asset imports infer them;\n * `priority` marks the LCP image (`eager` + `fetchpriority=\"high\"`). Extra DOM props pass through.\n */"
7349
7440
  },
7350
7441
  {
7351
7442
  "name": "Image",
7352
7443
  "kind": "function",
7353
7444
  "package": "@nifrajs/web-react",
7354
- "signature": "export declare function Image(props: ImageComponentProps): ReactElement;",
7355
- "doc": "/**\n * Render a responsive, CLS-safe `<img>`. `width`+`height` are required (reserve layout space);\n * `priority` marks the LCP image (`eager` + `fetchpriority=\"high\"`). Extra DOM props pass through.\n */"
7445
+ "signature": "export declare function Image(props: ImageComponentProps | StaticImageComponentProps): ReactElement;",
7446
+ "doc": "/**\n * Render a responsive, CLS-safe `<img>`. String URLs require dimensions; asset imports infer them;\n * `priority` marks the LCP image (`eager` + `fetchpriority=\"high\"`). Extra DOM props pass through.\n */"
7356
7447
  },
7357
7448
  {
7358
7449
  "name": "Image",
7359
7450
  "kind": "function",
7360
7451
  "package": "@nifrajs/web-solid",
7361
- "signature": "export declare function Image(props: ImageComponentProps): JSX.Element;",
7362
- "doc": "/**\n * Render a responsive, CLS-safe `<img>`. `width`+`height` are required (reserve layout space);\n * `priority` marks the LCP image (`eager` + `fetchpriority=\"high\"`). Extra DOM props pass through.\n */"
7452
+ "signature": "export declare function Image(props: ImageComponentProps | StaticImageComponentProps): JSX.Element;",
7453
+ "doc": "/**\n * Render a responsive, CLS-safe `<img>`. String URLs require dimensions; asset imports infer them;\n * `priority` marks the LCP image (`eager` + `fetchpriority=\"high\"`). Extra DOM props pass through.\n */"
7363
7454
  },
7364
7455
  {
7365
7456
  "name": "Image",
7366
7457
  "kind": "const",
7367
7458
  "package": "@nifrajs/web-vue",
7368
- "signature": "export declare const Image: import(\"vue\").DefineComponent<import(\"vue\").ExtractPropTypes<{\n src: {\n type: StringConstructor;\n required: true;\n };\n width: {\n type: NumberConstructor;\n required: true;\n };\n height: {\n type: NumberConstructor;\n required: true;\n };\n alt: {\n type: StringConstructor;\n required: true;\n };\n sizes: {\n type: StringConstructor;\n required: false;\n default: undefined;\n };\n widths: {\n type: PropType<readonly number[]>;\n required: false;\n default: undefined;\n };\n quality: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n loading: {\n type: PropType<\"lazy\" | \"eager\">;\n required: false;\n default: undefined;\n };\n priority: {\n type: BooleanConstructor;\n required: false;\n default: undefined;\n };\n loader: {\n type: PropType<ImageLoader>;\n required: false;\n default: undefined;\n };\n}>, () => import(\"vue\").VNode<import(\"vue\").RendererNode, import(\"vue\").RendererElement, {\n [key: string]: any;\n}>, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, string, import(\"vue\").PublicProps, Readonly<import(\"vue\").ExtractPropTypes<{\n src: {\n type: StringConstructor;\n required: true;\n };\n width: {\n type: NumberConstructor;\n required: true;\n };\n height: {\n type: NumberConstructor;\n required: true;\n };\n alt: {\n type: StringConstructor;\n required: true;\n };\n sizes: {\n type: StringConstructor;\n required: false;\n default: undefined;\n };\n widths: {\n type: PropType<readonly number[]>;\n required: false;\n default: undefined;\n };\n quality: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n loading: {\n type: PropType<\"lazy\" | \"eager\">;\n required: false;\n default: undefined;\n };\n priority: {\n type: BooleanConstructor;\n required: false;\n default: undefined;\n };\n loader: {\n type: PropType<ImageLoader>;\n required: false;\n default: undefined;\n };\n}>> & Readonly<{}>, {\n sizes: string;\n widths: readonly number[];\n quality: number;\n loading: \"lazy\" | \"eager\";\n priority: boolean;\n loader: ImageLoader;\n}, {}, {}, {}, string, import(\"vue\").ComponentProvideOptions, true, {}, any>;"
7459
+ "signature": "export declare const Image: import(\"vue\").DefineComponent<import(\"vue\").ExtractPropTypes<{\n src: {\n type: PropType<string | StaticImageData>;\n required: true;\n };\n width: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n height: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n alt: {\n type: StringConstructor;\n required: true;\n };\n sizes: {\n type: StringConstructor;\n required: false;\n default: undefined;\n };\n widths: {\n type: PropType<readonly number[]>;\n required: false;\n default: undefined;\n };\n quality: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n loading: {\n type: PropType<\"lazy\" | \"eager\">;\n required: false;\n default: undefined;\n };\n priority: {\n type: BooleanConstructor;\n required: false;\n default: undefined;\n };\n loader: {\n type: PropType<ImageLoader>;\n required: false;\n default: undefined;\n };\n}>, () => import(\"vue\").VNode<import(\"vue\").RendererNode, import(\"vue\").RendererElement, {\n [key: string]: any;\n}>, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, string, import(\"vue\").PublicProps, Readonly<import(\"vue\").ExtractPropTypes<{\n src: {\n type: PropType<string | StaticImageData>;\n required: true;\n };\n width: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n height: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n alt: {\n type: StringConstructor;\n required: true;\n };\n sizes: {\n type: StringConstructor;\n required: false;\n default: undefined;\n };\n widths: {\n type: PropType<readonly number[]>;\n required: false;\n default: undefined;\n };\n quality: {\n type: NumberConstructor;\n required: false;\n default: undefined;\n };\n loading: {\n type: PropType<\"lazy\" | \"eager\">;\n required: false;\n default: undefined;\n };\n priority: {\n type: BooleanConstructor;\n required: false;\n default: undefined;\n };\n loader: {\n type: PropType<ImageLoader>;\n required: false;\n default: undefined;\n };\n}>> & Readonly<{}>, {\n width: number;\n height: number;\n sizes: string;\n widths: readonly number[];\n quality: number;\n loading: \"lazy\" | \"eager\";\n priority: boolean;\n loader: ImageLoader;\n}, {}, {}, {}, string, import(\"vue\").ComponentProvideOptions, true, {}, any>;"
7460
+ },
7461
+ {
7462
+ "name": "ImageAssetPlugin",
7463
+ "kind": "interface",
7464
+ "package": "@nifrajs/image",
7465
+ "signature": "export interface ImageAssetPlugin {\n /** Nifra emits these content-hashed files with the bundle, never into the application's sources. */\n nifraStaticAssets(): readonly ImageBuildAsset[];\n /** The URL prefix baked into the imports; a build with another publicPath refuses the plugin. */\n readonly nifraPublicPath?: string;\n}"
7466
+ },
7467
+ {
7468
+ "name": "ImageAssets",
7469
+ "kind": "interface",
7470
+ "package": "@nifrajs/image",
7471
+ "signature": "export interface ImageAssets {\n /** Start a new module graph without retaining images from an earlier build. */\n clear(): void;\n load(file: string): Promise<StaticImageData>;\n assets(): readonly ImageBuildAsset[];\n}"
7369
7472
  },
7370
7473
  {
7371
7474
  "name": "ImageBackend",
@@ -7374,6 +7477,26 @@
7374
7477
  "signature": "export interface ImageBackend {\n /** Cheap, header-only metadata read. Throws {@link ImageProcessingError} (`decode` / `too_large`). */\n probe(bytes: Uint8Array): Promise<ImageProbe>;\n /** Decode → resize to `input.width` (aspect-preserving) → encode to `input.format`. */\n transform(input: ResizeInput): Promise<ResizeOutput>;\n}",
7375
7478
  "doc": "/**\n * The codec seam. The handler owns all request-level security (validation, SSRF, byte/pixel caps,\n * concurrency, caching); a backend only decodes/resizes/encodes. Backends MUST translate codec failures\n * into {@link ImageProcessingError} so the handler can map them to stable HTTP statuses.\n */"
7376
7479
  },
7480
+ {
7481
+ "name": "ImageBuildAsset",
7482
+ "kind": "interface",
7483
+ "package": "@nifrajs/image",
7484
+ "signature": "export interface ImageBuildAsset {\n readonly fileName: string;\n readonly source: Uint8Array;\n}",
7485
+ "doc": "/** The structural asset hook consumed by Nifra's build pipelines. Paths are relative to /assets/. */"
7486
+ },
7487
+ {
7488
+ "name": "ImageBuildOptions",
7489
+ "kind": "interface",
7490
+ "package": "@nifrajs/image",
7491
+ "signature": "export interface ImageBuildOptions {\n /** Only local files beneath this directory may be imported (symlinks are resolved). */\n readonly root?: string;\n /** Match the client build's publicPath: a root-relative prefix or an absolute http(s) CDN URL.\n * Default `/assets/`. */\n readonly publicPath?: string;\n /** Omit for codec-free metadata imports. Requested widths are clamped to the source width. */\n readonly widths?: readonly number[];\n /** Required when widths are requested; inject sharp, Bun.Image, or a WASM backend explicitly. */\n readonly backend?: ImageBackend;\n readonly format?: OutputFormat;\n readonly quality?: number;\n readonly maxSourceBytes?: number;\n readonly maxSourcePixels?: number;\n}"
7492
+ },
7493
+ {
7494
+ "name": "ImageBunPlugin",
7495
+ "kind": "interface",
7496
+ "package": "@nifrajs/image",
7497
+ "signature": "export interface ImageBunPlugin extends ImageAssetPlugin {\n readonly name: string;\n setup(build: ImageBunBuild): void;\n}",
7498
+ "doc": "/** Structural Bun hooks keep the shared plugin entry usable without Bun's ambient types. */"
7499
+ },
7377
7500
  {
7378
7501
  "name": "ImageComponentProps",
7379
7502
  "kind": "interface",
@@ -7417,6 +7540,12 @@
7417
7540
  "package": "@nifrajs/image",
7418
7541
  "signature": "export interface ImageInfo {\n readonly width: number;\n readonly height: number;\n readonly format: ImageFormat;\n}"
7419
7542
  },
7543
+ {
7544
+ "name": "ImageInputProps",
7545
+ "kind": "type",
7546
+ "package": "@nifrajs/image",
7547
+ "signature": "export type ImageInputProps = ImageProps | StaticImageProps;"
7548
+ },
7420
7549
  {
7421
7550
  "name": "ImageLoader",
7422
7551
  "kind": "type",
@@ -7431,6 +7560,12 @@
7431
7560
  "signature": "export declare class ImagePixelLimitError extends Error {\n readonly width: number;\n readonly height: number;\n readonly maxPixels: number;\n constructor(width: number, height: number, maxPixels: number);\n}",
7432
7561
  "doc": "/** Thrown before decoding a source larger than `maxPixels`; answer it with a `413`. */"
7433
7562
  },
7563
+ {
7564
+ "name": "ImagePresentationProps",
7565
+ "kind": "interface",
7566
+ "package": "@nifrajs/image",
7567
+ "signature": "export interface ImagePresentationProps {\n /** Alt text - **required** for accessibility (use `alt=\"\"` for decorative images). */\n readonly alt: string;\n /** `sizes` attribute for responsive selection (e.g. `\"(max-width: 600px) 100vw, 600px\"`). */\n readonly sizes?: string;\n /** Widths to generate `srcSet` entries for. Default: `[width, width*2]` (1×/2× retina). */\n readonly widths?: readonly number[];\n /** Quality passed to the loader. */\n readonly quality?: number;\n /** `lazy` (default) or `eager`. `priority` overrides this to eager. */\n readonly loading?: \"lazy\" | \"eager\";\n /** Mark the LCP image: `loading=\"eager\"` + `fetchpriority=\"high\"`. */\n readonly priority?: boolean;\n}"
7568
+ },
7434
7569
  {
7435
7570
  "name": "ImageProbe",
7436
7571
  "kind": "interface",
@@ -7449,7 +7584,8 @@
7449
7584
  "name": "ImageProps",
7450
7585
  "kind": "interface",
7451
7586
  "package": "@nifrajs/image",
7452
- "signature": "export interface ImageProps {\n readonly src: string;\n /** Intrinsic width (px) - **required**, reserves layout space (no CLS). */\n readonly width: number;\n /** Intrinsic height (px) - **required** (no CLS). */\n readonly height: number;\n /** Alt text - **required** for accessibility (use `alt=\"\"` for decorative images). */\n readonly alt: string;\n /** `sizes` attribute for responsive selection (e.g. `\"(max-width: 600px) 100vw, 600px\"`). */\n readonly sizes?: string;\n /** Widths to generate `srcSet` entries for. Default: `[width, width*2]` (1×/2× retina). */\n readonly widths?: readonly number[];\n /** Quality passed to the loader. */\n readonly quality?: number;\n /** `lazy` (default) or `eager`. `priority` overrides this to eager. */\n readonly loading?: \"lazy\" | \"eager\";\n /** Mark the LCP image: `loading=\"eager\"` + `fetchpriority=\"high\"`. */\n readonly priority?: boolean;\n}"
7587
+ "signature": "export interface ImageProps extends ImagePresentationProps {\n readonly src: string;\n readonly width: number;\n readonly height: number;\n}",
7588
+ "doc": "/** String URLs retain the original, extendable props contract. */"
7453
7589
  },
7454
7590
  {
7455
7591
  "name": "ImageReencoder",
@@ -7458,6 +7594,13 @@
7458
7594
  "signature": "export interface ImageReencoder {\n probe(bytes: Uint8Array): Promise<{\n readonly width: number;\n readonly height: number;\n readonly format: string;\n }>;\n transform(input: {\n readonly bytes: Uint8Array;\n readonly width: number;\n readonly quality: number;\n readonly format: StripFormat;\n }): Promise<{\n readonly bytes: Uint8Array;\n }>;\n}",
7459
7595
  "doc": "/** The slice of `@nifrajs/image`'s `ImageBackend` this needs - `probe` for dims/format, `transform` to re-encode. */"
7460
7596
  },
7597
+ {
7598
+ "name": "ImageVitePlugin",
7599
+ "kind": "interface",
7600
+ "package": "@nifrajs/image",
7601
+ "signature": "export interface ImageVitePlugin extends ImageAssetPlugin {\n readonly name: string;\n readonly enforce: \"pre\";\n configResolved(): void;\n load(this: ImageLoadContext, id: string): Promise<string | undefined>;\n configureServer(server: ImageDevServer): void;\n}",
7602
+ "doc": "/** Structural Vite plugin type: the image package does not depend on Vite at runtime. */"
7603
+ },
7461
7604
  {
7462
7605
  "name": "ImpactReport",
7463
7606
  "kind": "interface",
@@ -7654,6 +7797,20 @@
7654
7797
  "signature": "export interface InfiniteQueryOptions<T, P> extends QueryOptions {\n /** The param the FIRST page is fetched with. */\n readonly initialPageParam: P;\n /** Derive the next page's param from the last fetched page (and all pages/params). `undefined`/`null`\n * ⇒ no next page (`hasNextPage` is false). */\n readonly getNextPageParam: (lastPage: T, allPages: readonly T[], lastPageParam: P, allPageParams: readonly P[]) => P | undefined | null;\n /** Derive the previous page's param (for bidirectional infinite lists). Omit ⇒ no previous page. */\n readonly getPreviousPageParam?: (firstPage: T, allPages: readonly T[], firstPageParam: P, allPageParams: readonly P[]) => P | undefined | null;\n}",
7655
7798
  "doc": "/** Options for an {@link InfiniteQueryHandle}. `getNextPageParam` (required) derives the param for the\n * next page from the last page - return `undefined`/`null` to signal there is no next page. */"
7656
7799
  },
7800
+ {
7801
+ "name": "InfiniteQuerySnapshot",
7802
+ "kind": "interface",
7803
+ "package": "@nifrajs/web-svelte",
7804
+ "signature": "export interface InfiniteQuerySnapshot<T, P> extends QueryState<InfiniteData<T, P>> {\n readonly hasNextPage: boolean;\n readonly hasPreviousPage: boolean;\n}",
7805
+ "doc": "/** Svelte's infinite-query snapshot includes page availability alongside the shared query state. */"
7806
+ },
7807
+ {
7808
+ "name": "InfiniteQueryStore",
7809
+ "kind": "type",
7810
+ "package": "@nifrajs/web-svelte",
7811
+ "signature": "export type InfiniteQueryStore<T, P> = Readable<InfiniteQuerySnapshot<T, P>> & {\n readonly fetchNextPage: () => Promise<InfiniteData<T, P>>;\n readonly fetchPreviousPage: () => Promise<InfiniteData<T, P>>;\n readonly refetch: () => Promise<InfiniteData<T, P>>;\n};",
7812
+ "doc": "/** A Svelte readable infinite-query snapshot with page controls. */"
7813
+ },
7657
7814
  {
7658
7815
  "name": "InjectedClock",
7659
7816
  "kind": "interface",
@@ -7717,13 +7874,13 @@
7717
7874
  "kind": "type",
7718
7875
  "package": "@nifrajs/core",
7719
7876
  "signature": "export type InvariantSetup = () => Promise<InvariantSetupResult | undefined | void>;",
7720
- "doc": "/** Provisions a throwaway L4 target. Called once, before the first L4 request - never on import. */"
7877
+ "doc": "/**\n * Provisions a throwaway L4 target. Called once per L4 run, before its first case is generated, so\n * the witnesses it returns are known to every case - never on import.\n */"
7721
7878
  },
7722
7879
  {
7723
7880
  "name": "InvariantSetupResult",
7724
7881
  "kind": "interface",
7725
7882
  "package": "@nifrajs/core",
7726
- "signature": "export interface InvariantSetupResult {\n /** The isolated target for this run. Replaces `invariants.executor`. */\n readonly executor?: InvariantExecutor;\n /** Called once the run ends, after a failure too. */\n readonly teardown?: () => void | Promise<void>;\n}",
7883
+ "signature": "export interface InvariantSetupResult {\n /** The isolated target for this run. Replaces `invariants.executor`. */\n readonly executor?: InvariantExecutor;\n /**\n * Known-good requests that name what only exists once the target is up - a real slug, a row id,\n * a signed-in session - keyed by `\"METHOD /path\"`. Merged over `invariants.witnesses`: a key in\n * both takes this one. Validated as the static ones are.\n */\n readonly witnesses?: Readonly<Record<string, ContractWitness>>;\n /** Replaces `invariants.prepareRequest` for this run, so it can attach what setup created. */\n readonly prepareRequest?: InvariantRunOptions[\"prepareRequest\"];\n /** Called once the run ends, after a failure too. */\n readonly teardown?: () => void | Promise<void>;\n}",
7727
7884
  "doc": "/** What `invariants.setup` provisions for one L4 run. */"
7728
7885
  },
7729
7886
  {
@@ -8452,7 +8609,7 @@
8452
8609
  "name": "LinkProps",
8453
8610
  "kind": "interface",
8454
8611
  "package": "@nifrajs/web-react",
8455
- "signature": "export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n /** Same-origin destination path (e.g. `/users/7?tab=posts`). Rendered as the `<a href>`. */\n readonly to: string;\n /** Replace the current history entry instead of pushing. */\n readonly replace?: boolean;\n /** When the link warms its route ahead of a click - rendered as `data-nifra-prefetch`. Unset, the\n * nearest ancestor's `data-nifra-prefetch` decides, else `intent` (hover or focus). */\n readonly prefetch?: PrefetchMode;\n}",
8612
+ "signature": "export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n /** The destination: an `Href` from `href()` or `rawHref()`. Rendered as the `<a href>`. A value that is\n * not a same-origin path (a forged `Href`) renders the `<a>` without an `href`, does nothing on click and\n * logs a `console.error`; a link to another site is a plain `<a>`. */\n readonly to: Href;\n /** Replace the current history entry instead of pushing. */\n readonly replace?: boolean;\n /** When the link warms its route ahead of a click - rendered as `data-nifra-prefetch`. Unset, the\n * nearest ancestor's `data-nifra-prefetch` decides, else `intent` (hover or focus). */\n readonly prefetch?: PrefetchMode;\n}",
8456
8613
  "doc": "/** {@link Link} props: every `<a>` attribute except `href` (set from `to`), plus `to`, `replace` and\n * `prefetch`. */"
8457
8614
  },
8458
8615
  {
@@ -8785,7 +8942,7 @@
8785
8942
  "name": "LocalizedRouter",
8786
8943
  "kind": "interface",
8787
8944
  "package": "@nifrajs/i18n",
8788
- "signature": "export interface LocalizedRouter<K extends string = string> {\n /** The registry this router reads. */\n readonly locales: Locales<K>;\n /** Prefix `path` with `locale` (`/about` → `/fr/about`), unless it is the unprefixed default.\n * The query and trailing slash ride along, the hash too; an already-prefixed path is re-prefixed.\n * A locale that is not served throws. */\n localizePathname(path: string, locale: K, options?: LocalizeOptions): string;\n /** Strip a served locale prefix (`/fr/about` → `{ locale: \"fr\", pathname: \"/about\" }`). Anything\n * else - `/frank`, a draft's prefix - returns `{ locale: undefined }` with the path unchanged. */\n unlocalizePathname(path: string): UnlocalizedPath<K>;\n /** The served locale a path's first segment names, or `undefined` when unprefixed. */\n getPathLocale(path: string): K | undefined;\n /** The locale a path is in: its prefix, or the default for an unprefixed path. */\n localeOf(path: string): K;\n /** The served locales the page at `path` exists in (any prefix, or none), in registry order: what\n * `pageLocales` says, or every served locale. Also a prerender's static paths. */\n localesOf(path: string): readonly K[];\n /** The page's canonical URL and its `hreflang` alternates, one per locale the page exists in\n * (`pageLocales`, unless `options.locales` names them). `path` may carry any served prefix or none\n * (it decides the canonical's locale); its query is kept and its hash dropped. A page in one locale\n * only, or in none, has no alternates. */\n alternates(path: string, options?: AlternatesOptions<K>): Alternates;\n /**\n * Check the value of a `[lang]` / `[[lang]]` route segment that is the path's first segment.\n * `pathname` is the request's path (query allowed), used to build a redirect. A page that does not\n * exist in the locale (`pageLocales`) is not found.\n *\n * ```ts\n * // routes/[lang]/_layout.backend.ts\n * import { notFound, type RouteMiddleware, redirect } from \"@nifrajs/web\"\n * import { urls } from \"../../shared/i18n\"\n *\n * export const middleware: RouteMiddleware = (ctx) => {\n * const { pathname, search } = new URL(ctx.request.url)\n * const match = urls.matchSegment(ctx.params.lang, pathname + search)\n * if (match.kind === \"not-found\") notFound()\n * if (match.kind === \"redirect\") return redirect(match.location, { status: 308 })\n * }\n * ```\n */\n matchSegment(value: string | undefined, pathname: string): SegmentMatch<K>;\n}"
8945
+ "signature": "export interface LocalizedRouter<K extends string = string> {\n /** The registry this router reads. */\n readonly locales: Locales<K>;\n /** Prefix `path` with `locale` (`/about` → `/fr/about`), unless it is the unprefixed default.\n * The query and trailing slash ride along, the hash too; an already-localized path is translated\n * through its canonical mapping. A locale that is not served throws. */\n localizePathname(path: string, locale: K, options?: LocalizeOptions): string;\n /** Strip a served locale prefix and resolve a translated static pathname to its canonical path.\n * Unmapped paths keep their spelling; unknown and draft prefixes remain ordinary segments. */\n unlocalizePathname(path: string): UnlocalizedPath<K>;\n /** The served locale a path's first segment names, or `undefined` when unprefixed. */\n getPathLocale(path: string): K | undefined;\n /** The locale a path is in: its prefix, or the default for an unprefixed path. */\n localeOf(path: string): K;\n /** The served locales the page at `path` exists in (any prefix, or none), in registry order: what\n * `pageLocales` says, or every served locale. The callback sees the canonical mapping key. */\n localesOf(path: string): readonly K[];\n /** Mapped public paths only, in mapping declaration then served registry order, filtered by\n * `pageLocales`. Unmapped filesystem routes are not enumerated. No query, hash or trailing slash. */\n staticPathnames(): readonly string[];\n /** The page's canonical URL and its `hreflang` alternates, one per locale the page exists in\n * (`pageLocales`, unless `options.locales` names them). `path` may carry any served prefix or none\n * (it decides the canonical's locale); its query is kept and its hash dropped. A page in one locale\n * only, or in none, has no alternates. */\n alternates(path: string, options?: AlternatesOptions<K>): Alternates;\n /**\n * Check the value of a `[lang]` / `[[lang]]` route segment that is the path's first segment.\n * `pathname` is the request's path (query allowed), used to build a redirect. A page that does not\n * exist in the locale (`pageLocales`) is not found.\n *\n * ```ts\n * // routes/[lang]/_layout.backend.ts\n * import { notFound, type RouteMiddleware, redirect } from \"@nifrajs/web\"\n * import { urls } from \"../../shared/i18n\"\n *\n * export const middleware: RouteMiddleware = (ctx) => {\n * const { pathname, search } = new URL(ctx.request.url)\n * const match = urls.matchSegment(ctx.params.lang, pathname + search)\n * if (match.kind === \"not-found\") notFound()\n * if (match.kind === \"redirect\") return redirect(match.location, { status: 308 })\n * }\n * ```\n */\n matchSegment(value: string | undefined, pathname: string): SegmentMatch<K>;\n}"
8789
8946
  },
8790
8947
  {
8791
8948
  "name": "Location",
@@ -9885,14 +10042,28 @@
9885
10042
  "name": "MutationCallbacks",
9886
10043
  "kind": "interface",
9887
10044
  "package": "@nifrajs/web",
9888
- "signature": "export interface MutationCallbacks<TData, TVariables> {\n readonly onMutate?: (variables: TVariables) => void | Promise<void>;\n readonly onSuccess?: (data: TData, variables: TVariables) => void | Promise<void>;\n readonly onError?: (error: unknown, variables: TVariables) => void | Promise<void>;\n readonly onSettled?: (data: TData | undefined, error: unknown, variables: TVariables) => void | Promise<void>;\n}",
10045
+ "signature": "export interface MutationCallbacks<TData, TVariables> {\n readonly onMutate?: (variables: TVariables, context: MutationContext) => void | Promise<void>;\n readonly onSuccess?: (data: TData, variables: TVariables, context: MutationContext) => void | Promise<void>;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContext) => void | Promise<void>;\n readonly onSettled?: (data: TData | undefined, error: unknown, variables: TVariables, context: MutationContext) => void | Promise<void>;\n}",
9889
10046
  "doc": "/** Lifecycle callbacks for a mutation. All optional; `onSettled` runs after success OR error. */"
9890
10047
  },
10048
+ {
10049
+ "name": "MutationCancelledError",
10050
+ "kind": "class",
10051
+ "package": "@nifrajs/web",
10052
+ "signature": "export declare class MutationCancelledError extends Error {\n constructor();\n}",
10053
+ "doc": "/** Rejection returned when {@link MutationHandle.cancel} discards an in-flight result. */"
10054
+ },
10055
+ {
10056
+ "name": "MutationContext",
10057
+ "kind": "interface",
10058
+ "package": "@nifrajs/web",
10059
+ "signature": "export interface MutationContext {\n readonly signal: AbortSignal;\n}",
10060
+ "doc": "/** Cooperative cancellation context supplied to mutation functions and callbacks. */"
10061
+ },
9891
10062
  {
9892
10063
  "name": "MutationHandle",
9893
10064
  "kind": "interface",
9894
10065
  "package": "@nifrajs/web",
9895
- "signature": "export interface MutationHandle<TData, TVariables> {\n snapshot: () => MutationState<TData, TVariables>;\n subscribe: (listener: () => void) => () => void;\n /** Run the mutation. Resolves to the data (and runs onSuccess/onSettled) or rejects (onError/onSettled);\n * a throwing `onMutate` fails it the same way. A throwing `onSuccess` or `onSettled` after the write\n * rejects the call but leaves the state `success` and never calls `onError`. The latest concurrent\n * call wins the published state (older results are dropped). */\n mutate: (variables: TVariables) => Promise<TData>;\n /** Rebind the latest `fn`/callbacks (closures change between renders) without losing state. */\n rebind: (fn: (variables: TVariables) => Promise<TData>, callbacks: MutationCallbacks<TData, TVariables>) => void;\n /** Reset to the idle state (clears data/error/variables). */\n reset: () => void;\n}",
10066
+ "signature": "export interface MutationHandle<TData, TVariables> {\n snapshot: () => MutationState<TData, TVariables>;\n subscribe: (listener: () => void) => () => void;\n /** Run the mutation. Resolves to the data (and runs onSuccess/onSettled) or rejects (onError/onSettled);\n * a throwing `onMutate` fails it the same way. A throwing `onSuccess` or `onSettled` after the write\n * rejects the call but leaves the state `success` and never calls `onError`. The latest concurrent\n * call wins the published state (older results are dropped). */\n mutate: (variables: TVariables) => Promise<TData>;\n /** Rebind the latest `fn`/callbacks (closures change between renders) without losing state. */\n rebind: (fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks: MutationCallbacks<TData, TVariables>) => void;\n /** Reset to the idle state (clears data/error/variables). */\n reset: () => void;\n /** Reject pending mutate promises, discard local state and abort the signal. Uncooperative work may\n * continue; the server may still finish an accepted request. */\n cancel: () => void;\n}",
9896
10067
  "doc": "/** A standalone mutation store: subscribe to its state, fire `mutate`, `reset` back to idle. */"
9897
10068
  },
9898
10069
  {
@@ -9909,6 +10080,13 @@
9909
10080
  "signature": "export type MutationStatus = \"idle\" | \"pending\" | \"success\" | \"error\";",
9910
10081
  "doc": "/** A mutation's lifecycle status. */"
9911
10082
  },
10083
+ {
10084
+ "name": "MutationStore",
10085
+ "kind": "type",
10086
+ "package": "@nifrajs/web-svelte",
10087
+ "signature": "export type MutationStore<TData, TVariables> = Readable<MutationState<TData, TVariables>> & {\n readonly mutate: (variables: TVariables) => void;\n readonly mutateAsync: (variables: TVariables) => Promise<TData>;\n readonly reset: () => void;\n readonly cancel: () => void;\n};",
10088
+ "doc": "/** A Svelte readable mutation state, augmented with imperative controls. */"
10089
+ },
9912
10090
  {
9913
10091
  "name": "NAMESPACED_KEYS",
9914
10092
  "kind": "const",
@@ -9997,7 +10175,14 @@
9997
10175
  "name": "NativeApprovalPort",
9998
10176
  "kind": "interface",
9999
10177
  "package": "@nifrajs/coding-agent",
10000
- "signature": "export interface NativeApprovalPort {\n request(input: {\n readonly sessionId: string;\n /** Stable, bounded identifier for this approval boundary. */\n readonly approvalId: string;\n readonly turnId: string;\n readonly callId: string;\n readonly action: string;\n readonly capability: string;\n readonly tool: NativeTool;\n readonly input: unknown;\n readonly signal: AbortSignal;\n }): boolean | PromiseLike<boolean>;\n}"
10178
+ "signature": "export interface NativeApprovalPort {\n request(input: NativeApprovalRequest): boolean | PromiseLike<boolean>;\n /**\n * Decides before anyone is asked. Anything but a valid answer counts as \"ask\", and so does a\n * review still unsettled after `reviewTimeoutMs`; \"ask\" raises the approval as if there were no\n * review. An allow or a deny emits no approval events.\n */\n review?(input: NativeApprovalRequest): NativeReviewAnswer | PromiseLike<NativeReviewAnswer>;\n}"
10179
+ },
10180
+ {
10181
+ "name": "NativeApprovalRequest",
10182
+ "kind": "interface",
10183
+ "package": "@nifrajs/coding-agent",
10184
+ "signature": "export interface NativeApprovalRequest {\n readonly sessionId: string;\n /** Stable, bounded identifier for this approval boundary. */\n readonly approvalId: string;\n readonly turnId: string;\n readonly callId: string;\n readonly action: string;\n readonly capability: string;\n readonly tool: NativeTool;\n readonly input: unknown;\n readonly signal: AbortSignal;\n}",
10185
+ "doc": "/** One tool call an approval port is asked about. */"
10001
10186
  },
10002
10187
  {
10003
10188
  "name": "NativeGatewayModelPortOptions",
@@ -10077,6 +10262,13 @@
10077
10262
  "package": "@nifrajs/web",
10078
10263
  "signature": "export type NativeRender = (component: unknown, props: Record<string, unknown>, renderId: string) => string | Promise<string>;"
10079
10264
  },
10265
+ {
10266
+ "name": "NativeReviewAnswer",
10267
+ "kind": "type",
10268
+ "package": "@nifrajs/coding-agent",
10269
+ "signature": "export type NativeReviewAnswer = {\n readonly decision: \"allow\";\n} | {\n readonly decision: \"deny\";\n readonly reason: string;\n} | {\n readonly decision: \"ask\";\n};",
10270
+ "doc": "/** A review's decision on one tool call. A deny's reason reaches the model. */"
10271
+ },
10080
10272
  {
10081
10273
  "name": "NativeServerView",
10082
10274
  "kind": "interface",
@@ -10115,49 +10307,49 @@
10115
10307
  "kind": "function",
10116
10308
  "package": "@nifrajs/web-react",
10117
10309
  "signature": "export declare function Navigate({ to, replace }: NavigateProps): null;",
10118
- "doc": "/**\n * Declaratively navigate on mount - the component analogue of `useNavigate` (e.g. a guard that renders\n * `<Navigate to=\"/login\" replace />`). Navigates in an effect, so it's a safe no-op during SSR (renders\n * `null`); the redirect happens once on the client after hydration.\n */"
10310
+ "doc": "/**\n * Declaratively navigate on mount - the component analogue of `useNavigate` (e.g. a guard that renders\n * `<Navigate to={href({ to: \"/login\" })} replace />`). Navigates in an effect, so it's a safe no-op during SSR (renders\n * `null`); the redirect happens once on the client after hydration.\n */"
10119
10311
  },
10120
10312
  {
10121
10313
  "name": "NavigateFunction",
10122
- "kind": "interface",
10314
+ "kind": "type",
10123
10315
  "package": "@nifrajs/web",
10124
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
10125
- "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
10316
+ "signature": "export type NavigateFunction = (to: Href | number, options?: NavigateOptions) => void;",
10317
+ "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. It takes an {@link Href}, built by\n * `href({ to, params, search, hash })` or `rawHref(path)` (push, or replace with `{ replace: true }`), or a\n * history delta (`-1` back, `1` forward). A plain string or a template literal is a compile error: the\n * route, its params and its search are checked where the link is built. A no-op on the server and before\n * hydration.\n */"
10126
10318
  },
10127
10319
  {
10128
10320
  "name": "NavigateFunction",
10129
- "kind": "interface",
10321
+ "kind": "type",
10130
10322
  "package": "@nifrajs/web-preact",
10131
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
10132
- "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
10323
+ "signature": "export type NavigateFunction = (to: Href | number, options?: NavigateOptions) => void;",
10324
+ "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. It takes an {@link Href}, built by\n * `href({ to, params, search, hash })` or `rawHref(path)` (push, or replace with `{ replace: true }`), or a\n * history delta (`-1` back, `1` forward). A plain string or a template literal is a compile error: the\n * route, its params and its search are checked where the link is built. A no-op on the server and before\n * hydration.\n */"
10133
10325
  },
10134
10326
  {
10135
10327
  "name": "NavigateFunction",
10136
- "kind": "interface",
10328
+ "kind": "type",
10137
10329
  "package": "@nifrajs/web-react",
10138
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
10139
- "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
10330
+ "signature": "export type NavigateFunction = (to: Href | number, options?: NavigateOptions) => void;",
10331
+ "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. It takes an {@link Href}, built by\n * `href({ to, params, search, hash })` or `rawHref(path)` (push, or replace with `{ replace: true }`), or a\n * history delta (`-1` back, `1` forward). A plain string or a template literal is a compile error: the\n * route, its params and its search are checked where the link is built. A no-op on the server and before\n * hydration.\n */"
10140
10332
  },
10141
10333
  {
10142
10334
  "name": "NavigateFunction",
10143
- "kind": "interface",
10335
+ "kind": "type",
10144
10336
  "package": "@nifrajs/web-solid",
10145
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
10146
- "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
10337
+ "signature": "export type NavigateFunction = (to: Href | number, options?: NavigateOptions) => void;",
10338
+ "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. It takes an {@link Href}, built by\n * `href({ to, params, search, hash })` or `rawHref(path)` (push, or replace with `{ replace: true }`), or a\n * history delta (`-1` back, `1` forward). A plain string or a template literal is a compile error: the\n * route, its params and its search are checked where the link is built. A no-op on the server and before\n * hydration.\n */"
10147
10339
  },
10148
10340
  {
10149
10341
  "name": "NavigateFunction",
10150
- "kind": "interface",
10342
+ "kind": "type",
10151
10343
  "package": "@nifrajs/web-svelte",
10152
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
10153
- "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
10344
+ "signature": "export type NavigateFunction = (to: Href | number, options?: NavigateOptions) => void;",
10345
+ "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. It takes an {@link Href}, built by\n * `href({ to, params, search, hash })` or `rawHref(path)` (push, or replace with `{ replace: true }`), or a\n * history delta (`-1` back, `1` forward). A plain string or a template literal is a compile error: the\n * route, its params and its search are checked where the link is built. A no-op on the server and before\n * hydration.\n */"
10154
10346
  },
10155
10347
  {
10156
10348
  "name": "NavigateFunction",
10157
- "kind": "interface",
10349
+ "kind": "type",
10158
10350
  "package": "@nifrajs/web-vue",
10159
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
10160
- "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
10351
+ "signature": "export type NavigateFunction = (to: Href | number, options?: NavigateOptions) => void;",
10352
+ "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. It takes an {@link Href}, built by\n * `href({ to, params, search, hash })` or `rawHref(path)` (push, or replace with `{ replace: true }`), or a\n * history delta (`-1` back, `1` forward). A plain string or a template literal is a compile error: the\n * route, its params and its search are checked where the link is built. A no-op on the server and before\n * hydration.\n */"
10161
10353
  },
10162
10354
  {
10163
10355
  "name": "NavigateOptions",
@@ -10170,23 +10362,9 @@
10170
10362
  "name": "NavigateProps",
10171
10363
  "kind": "interface",
10172
10364
  "package": "@nifrajs/web-react",
10173
- "signature": "export interface NavigateProps {\n readonly to: string;\n readonly replace?: boolean;\n}",
10365
+ "signature": "export interface NavigateProps {\n readonly to: Href;\n readonly replace?: boolean;\n}",
10174
10366
  "doc": "/** {@link Navigate} props: the destination `to` and whether to `replace` the history entry. */"
10175
10367
  },
10176
- {
10177
- "name": "NavigateSearchOf",
10178
- "kind": "type",
10179
- "package": "@nifrajs/web",
10180
- "signature": "export type NavigateSearchOf<To extends string> = To extends keyof RouteSearch ? RouteSearch[To] : Record<string, unknown>;",
10181
- "doc": "/**\n * The `search` type for a navigate to `To`: the route's schema output when `To` is a mapped\n * {@link RouteSearch} key, otherwise the loose `Record<string, unknown>` (so a navigate to any path is\n * always allowed). Keyed on `To` rather than a union, so a mapped route can't fall back to the loose form\n * with a wrong shape - `navigate({ to: \"/reports\", search: { page: \"x\" } })` is a compile error.\n */"
10182
- },
10183
- {
10184
- "name": "NavigateTargetInput",
10185
- "kind": "interface",
10186
- "package": "@nifrajs/web",
10187
- "signature": "export interface NavigateTargetInput {\n readonly to: string;\n readonly search?: Record<string, unknown>;\n readonly replace?: boolean;\n readonly state?: unknown;\n}",
10188
- "doc": "/** The runtime shape of an object-form navigate target (loose - the typed narrowing lives in\n * {@link NavigateFunction}'s generic call signature). `to` is a bare pathname; `search` is serialized\n * onto it; `replace` folds into the options. */"
10189
- },
10190
10368
  {
10191
10369
  "name": "Navigation",
10192
10370
  "kind": "interface",
@@ -10241,14 +10419,14 @@
10241
10419
  "name": "NifraBackend",
10242
10420
  "kind": "class",
10243
10421
  "package": "@nifrajs/coding-agent",
10244
- "signature": "export declare class NifraBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly sessions;\n private readonly pendingApprovals;\n constructor(options: NifraBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean, reason?: string): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private run;\n private consumeModel;\n private finish;\n private requestApproval;\n private settleApproval;\n private cancelTurn;\n private clearTurnSignal;\n private clearTurn;\n private isCurrentTurn;\n private assertCurrentTurn;\n private emit;\n private update;\n private requireSession;\n private now;\n private remember;\n private trimHistory;\n}",
10422
+ "signature": "export declare class NifraBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly sessions;\n private readonly pendingApprovals;\n constructor(options: NifraBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean, reason?: string): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private run;\n private consumeModel;\n private finish;\n private requestApproval;\n /**\n * Settles on an allow, a deny, or the turn's abort, and on undefined for everything that goes on\n * to an approval: an ask, a malformed answer, a throw or rejection, and a late answer.\n */\n private review;\n private askApproval;\n private settleApproval;\n private cancelTurn;\n private clearTurnSignal;\n private clearTurn;\n private isCurrentTurn;\n private assertCurrentTurn;\n private emit;\n private update;\n private requireSession;\n private now;\n private remember;\n private trimHistory;\n}",
10245
10423
  "doc": "/**\n * Small provider port for a future Nifra-native backend.\n *\n * It deliberately knows only messages, tools, and the protocol. Provider SDKs, credentials, UI,\n * and framework packages stay outside this module. A model may return one response or stream\n * deltas followed by a final response.\n */"
10246
10424
  },
10247
10425
  {
10248
10426
  "name": "NifraBackendOptions",
10249
10427
  "kind": "interface",
10250
10428
  "package": "@nifrajs/coding-agent",
10251
- "signature": "export interface NifraBackendOptions {\n readonly model: NativeModelPort;\n readonly tools?: readonly NativeTool[];\n readonly approval?: NativeApprovalPort;\n /**\n * Maximum time a protocol-visible native approval may remain unresolved (default 5 minutes, at\n * most 24 h). `\"never\"` removes the timer: the approval waits for an answer, a cancel, the end of\n * its turn, or session close.\n */\n readonly approvalTimeoutMs?: ApprovalTimeout;\n readonly maxSteps?: number;\n /** Longest message `send` accepts (default 64 KiB). */\n readonly maxMessageChars?: number;\n /**\n * Longest reply the model may give in one turn (default 1 MiB); past it the reply is cut with\n * a marker. A reply longer than one event's text travels as consecutive `assistant.message`\n * events, and the model's history keeps it whole.\n */\n readonly maxReplyChars?: number;\n /**\n * Character budget for the conversation a session sends to the model (default 1 MiB). Past it,\n * whole earlier turns are dropped, oldest first; the current turn is always sent in full.\n */\n readonly maxHistoryChars?: number;\n readonly now?: () => number;\n}"
10429
+ "signature": "export interface NifraBackendOptions {\n readonly model: NativeModelPort;\n readonly tools?: readonly NativeTool[];\n readonly approval?: NativeApprovalPort;\n /**\n * Maximum time a protocol-visible native approval may remain unresolved (default 5 minutes, at\n * most 24 h). `\"never\"` removes the timer: the approval waits for an answer, a cancel, the end of\n * its turn, or session close.\n */\n readonly approvalTimeoutMs?: ApprovalTimeout;\n /**\n * Longest the approval port's `review` may take before the call goes on to an approval (default\n * 30 s, at most 10 minutes).\n */\n readonly reviewTimeoutMs?: number;\n readonly maxSteps?: number;\n /** Longest message `send` accepts (default 64 KiB). */\n readonly maxMessageChars?: number;\n /**\n * Longest reply the model may give in one turn (default 1 MiB); past it the reply is cut with\n * a marker. A reply longer than one event's text travels as consecutive `assistant.message`\n * events, and the model's history keeps it whole.\n */\n readonly maxReplyChars?: number;\n /**\n * Character budget for the conversation a session sends to the model (default 1 MiB). Past it,\n * whole earlier turns are dropped, oldest first; the current turn is always sent in full.\n */\n readonly maxHistoryChars?: number;\n readonly now?: () => number;\n}"
10252
10430
  },
10253
10431
  {
10254
10432
  "name": "NifraContextLike",
@@ -10582,6 +10760,13 @@
10582
10760
  "signature": "export interface NotFoundScope {\n /** The directory's URL prefix (`/admin`) or everything beneath it (`/admin/*`). */\n readonly pattern: string;\n /** Param names each layout in {@link NotFoundEntry.layoutIds} owns on this pattern, by index. */\n readonly layoutParams: ReadonlyArray<readonly string[]>;\n /** Param names each middleware in {@link NotFoundEntry.middlewareIds} sees on this pattern, by\n * index. Absent when the page has no middleware. */\n readonly middlewareParams?: ReadonlyArray<readonly string[]>;\n}",
10583
10761
  "doc": "/** One URL pattern a nested `_404` answers when no route matches it. */"
10584
10762
  },
10763
+ {
10764
+ "name": "ONE_DAY",
10765
+ "kind": "const",
10766
+ "package": "@nifrajs/core",
10767
+ "signature": "export declare const ONE_DAY = \"public, max-age=86400\";",
10768
+ "doc": "/** `cache-control` for a file that keeps its name across deploys, as a build's `public/` files do. */"
10769
+ },
10585
10770
  {
10586
10771
  "name": "ObservationAdapter",
10587
10772
  "kind": "interface",
@@ -10779,7 +10964,7 @@
10779
10964
  "name": "OrchestrationHost",
10780
10965
  "kind": "class",
10781
10966
  "package": "@nifrajs/coding-agent",
10782
- "signature": "export declare class OrchestrationHost {\n private readonly catalog;\n private readonly limits;\n private readonly maxSteps;\n private readonly maxDepth;\n private readonly policy;\n private readonly vectors;\n private readonly runs;\n private counter;\n private readonly subagentAbandonment;\n private readonly onSubagentAbandoned;\n private readonly onStepFailed;\n constructor(options: OrchestrationHostOptions);\n /** Subagent executors abandoned by any run of this host that are still running. */\n get abandonedSubagents(): number;\n /**\n * Admit a capability descriptor against the host policy before it can be invoked. Throws\n * {@link OrchestrationStateError} (`E_POLICY_REJECTED`) carrying the admission reason when refused.\n * With no policy configured this is a passthrough - the host admits nothing it is not told to gate.\n */\n admit(descriptor: CapabilityDescriptor): void;\n /**\n * Allocate the next monotonic child vector for a live run, addressing a decision boundary the run\n * pauses on. Strictly increasing per run, so a decision carrying any other vector is provably stale.\n */\n openBoundaryVector(runId: string): number;\n /**\n * Parse, compile, and register a run in `submitted`. All structural ceilings and capability\n * authority are enforced here (a `CompileError` with a stable code), so an over-limit or\n * unauthorized plan never reaches `running`.\n */\n submit(source: RunPlan | unknown, options?: SubmitOptions): Promise<string>;\n /** Content-free progress view. Throws `E_NOT_FOUND` for an unknown run. */\n inspect(runId: string): RunStatus;\n /** `submitted` -> `running`. Begins the driver. */\n start(runId: string): void;\n /** `running` -> `paused`. Takes effect at the next layer boundary; in-flight nodes finish. */\n pause(runId: string): void;\n /** `paused` -> `running`. Releases the layer boundary. */\n resume(runId: string): void;\n /**\n * Cancel from any non-terminal state. Aborts the in-flight layer and any bounded subagent, frees a\n * paused gate, and freezes the run in `cancelled`. A late completion cannot revive it.\n */\n cancel(runId: string): void;\n /** Terminal result. Throws `E_NOT_TERMINAL` while the run is still live. */\n result(runId: string): Promise<RunResult>;\n /** Await the run reaching a terminal state, then return its result. */\n settled(runId: string): Promise<RunResult>;\n private require;\n private transition;\n private buildResult;\n private drive;\n /** Project one kernel event into a content-free evidence record. Frozen once the run is terminal. */\n private project;\n private reportFailure;\n /** Walk the plan tree once: node kinds, idempotency flags, and the full id set. */\n private indexPlan;\n}",
10967
+ "signature": "export declare class OrchestrationHost {\n private readonly catalog;\n private readonly limits;\n private readonly maxSteps;\n private readonly maxDepth;\n private readonly policy;\n private readonly vectors;\n private readonly runs;\n private counter;\n private readonly subagentAbandonment;\n private readonly onSubagentAbandoned;\n private readonly onStepFailed;\n constructor(options: OrchestrationHostOptions);\n /** Subagent executors abandoned by any run of this host that are still running. */\n get abandonedSubagents(): number;\n /**\n * Admit a capability descriptor against the host policy before it can be invoked. Throws\n * {@link OrchestrationStateError} (`E_POLICY_REJECTED`) carrying the admission reason when refused.\n * With no policy configured this is a passthrough - the host admits nothing it is not told to gate.\n */\n admit(descriptor: CapabilityDescriptor): void;\n /**\n * Allocate the next monotonic child vector for a live run, addressing a decision boundary the run\n * pauses on. Strictly increasing per run, so a decision carrying any other vector is provably stale.\n */\n openBoundaryVector(runId: string): number;\n /**\n * Parse, compile, and register a run in `submitted`. All structural ceilings and capability\n * authority are enforced here (a `CompileError` with a stable code), so an over-limit or\n * unauthorized plan never reaches `running`.\n */\n submit(source: RunPlan | unknown, options?: SubmitOptions): Promise<string>;\n /** Content-free progress view. Throws `E_NOT_FOUND` for an unknown run. */\n inspect(runId: string): RunStatus;\n /** `submitted` -> `running`. Begins the driver. */\n start(runId: string): void;\n /** `running` -> `paused`. Takes effect at the next layer boundary; in-flight nodes finish. */\n pause(runId: string): void;\n /** `paused` -> `running`. Releases the layer boundary. */\n resume(runId: string): void;\n /**\n * Cancel from any non-terminal state. Aborts the in-flight layer and any bounded subagent, frees a\n * paused gate, and freezes the run in `cancelled`. A late completion cannot revive it.\n */\n cancel(runId: string): void;\n /** Terminal result. Throws `E_NOT_TERMINAL` while the run is still live. */\n result(runId: string): Promise<RunResult>;\n /** Await the run reaching a terminal state, then return its result. */\n settled(runId: string): Promise<RunResult>;\n private require;\n private transition;\n private buildResult;\n private drive;\n /** Project one kernel event into a content-free evidence record. Frozen once the run is terminal. */\n private project;\n private reportFailure;\n}",
10783
10968
  "doc": "/** Owns run lifecycle and evidence projection over the kernel WorkflowRunner. */"
10784
10969
  },
10785
10970
  {
@@ -11284,7 +11469,7 @@
11284
11469
  "name": "PostgresQueryOptions",
11285
11470
  "kind": "interface",
11286
11471
  "package": "@nifrajs/mcp-db",
11287
- "signature": "export interface PostgresQueryOptions extends ShapeRowsOptions, PostgresScope {\n readonly timeoutMs: number;\n /** Extensions or untrusted languages to accept although the role can use them. */\n readonly allowExtensions?: readonly string[];\n}",
11472
+ "signature": "export interface PostgresQueryOptions extends ShapeRowsOptions, PostgresScope {\n readonly timeoutMs: number;\n /** Extensions or untrusted languages to accept although the role can use them. */\n readonly allowExtensions?: readonly string[];\n /** Functions (`name` or `schema.name`) to accept although the function allowlist refuses them. */\n readonly allowFunctions?: readonly string[];\n}",
11288
11473
  "doc": "/** Options for {@link queryPostgres}. */"
11289
11474
  },
11290
11475
  {
@@ -11311,7 +11496,7 @@
11311
11496
  "name": "PostgresRoleSqlOptions",
11312
11497
  "kind": "interface",
11313
11498
  "package": "@nifrajs/mcp-db",
11314
- "signature": "export interface PostgresRoleSqlOptions extends PostgresScope {\n readonly timeoutMs: number;\n /** The role to create (default `nifra_dev_reader`). */\n readonly role?: string;\n}",
11499
+ "signature": "export interface PostgresRoleSqlOptions extends PostgresScope {\n readonly timeoutMs: number;\n /** The role to create (default `nifra_dev_reader`). */\n readonly role?: string;\n /** The masking the queries will run with: its masked columns are left out of the grants. */\n readonly redaction?: DbRedaction;\n /** The `allowFunctions` the queries will run with: SECURITY DEFINER functions it names are accepted. */\n readonly allowFunctions?: readonly string[];\n}",
11315
11500
  "doc": "/** Options for {@link postgresRoleSql}. */"
11316
11501
  },
11317
11502
  {
@@ -11359,7 +11544,7 @@
11359
11544
  "kind": "interface",
11360
11545
  "package": "@nifrajs/web",
11361
11546
  "signature": "export interface PprSetup {\n readonly [PPR_SETUP]: (environment: PprEnvironment) => PprIntegration;\n}",
11362
- "doc": "/** What `partialPrerendering()` returns for `createWebApp({ experimental: { ppr } })`. */"
11547
+ "doc": "/** What `partialPrerendering()` returns for `createWebApp({ ppr })`. */"
11363
11548
  },
11364
11549
  {
11365
11550
  "name": "PprShells",
@@ -11827,13 +12012,6 @@
11827
12012
  "signature": "export interface ProxyUpstreamResponse {\n readonly status: number;\n /** Empty string is fine - HTTP/2 has no reason phrase, and nothing downstream depends on it. */\n readonly statusText: string;\n readonly headers: Headers;\n readonly body: ReadableStream<Uint8Array> | null;\n /**\n * Whether `body` is still exactly the bytes the upstream sent, `Content-Encoding` intact. `fetch`\n * transparently decodes a compressed response, so its body is identity and the stored\n * `content-encoding`/`content-length` no longer describe it - both are dropped on relay (the\n * default when this is omitted). A transport that does NOT decode (undici's `request` does not)\n * MUST set this `true` so the encoding and length are relayed instead, letting the client decode\n * the bytes it actually receives. Getting this wrong ships a gzip body labelled identity.\n */\n readonly bodyEncoded?: boolean;\n}",
11828
12013
  "doc": "/** What a {@link ProxyTransport} returns. Header hygiene on the way back is the proxy's job. */"
11829
12014
  },
11830
- {
11831
- "name": "PublicDirCache",
11832
- "kind": "interface",
11833
- "package": "@nifrajs/web",
11834
- "signature": "export interface PublicDirCache {\n /** `cache-control` for content-hashed assets (default immutable, one year). */\n readonly hashed?: string;\n /** `cache-control` for everything else under `public/` (default one day). */\n readonly assets?: string;\n}",
11835
- "doc": "/** How long each subtree may be cached. Content-hashed bundle output can be immutable; a\n * user-authored file keeps its name across deploys, so it gets a day and a revalidation. */"
11836
- },
11837
12015
  {
11838
12016
  "name": "PurgeAttempt",
11839
12017
  "kind": "type",
@@ -11863,7 +12041,7 @@
11863
12041
  "name": "QueryClient",
11864
12042
  "kind": "interface",
11865
12043
  "package": "@nifrajs/web",
11866
- "signature": "export interface QueryClient {\n /** Get the stable {@link QueryHandle} for `key`, fetched via `fn`. Re-binds the latest `fn` (and\n * `options`) each call (closures change between renders); returns the same handle for the same\n * (hashed) key. */\n query: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => QueryHandle<T>;\n /** Get the stable {@link InfiniteQueryHandle} for `key`, whose pages are fetched via `fn(pageParam)`. */\n infiniteQuery: <T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: InfiniteQueryOptions<T, P>) => InfiniteQueryHandle<T, P>;\n /** Mark matching cached queries, infinite ones included, stale and refetch the **mounted** ones\n * (subscribers > 0). Array keys match by **prefix** (`[\"todo\"]` ⇒ every `[\"todo\", …]`); other keys\n * match exactly. */\n invalidateQueries: (keyOrPrefix: unknown) => void;\n /** Read a cached query's data (`undefined` if absent or not yet successful). Synchronous, no fetch. */\n getQueryData: <T>(key: unknown) => T | undefined;\n /** Write a query's data directly (optimistic updates, or seeding). Creates the entry if absent; marks\n * it fresh (`updatedAt = now`). `updater` may be a value or a function of the previous data. */\n setQueryData: <T>(key: unknown, updater: T | ((prev: T | undefined) => T)) => void;\n /** Fetch + cache a query's data WITHOUT subscribing (SSR prefetch, hover warm). Resolves when cached;\n * a fresh entry is a no-op. Rejects if the fetch throws (caller may swallow). */\n prefetchQuery: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => Promise<void>;\n /** Serialize every successful query to a transferable snapshot (server → client SSR bridge). */\n dehydrate: () => DehydratedState;\n /** Seed the cache from a {@link dehydrate} snapshot (client boot). Existing fresher entries win. */\n hydrate: (state: DehydratedState) => void;\n /** Drop every cached query: mounted ones go back to pending and refetch, the rest are removed. A\n * live app calls it on every query client in the page when the viewer changes. */\n clear: () => void;\n}",
12044
+ "signature": "export interface QueryClient {\n /** Get the stable {@link QueryHandle} for `key`, fetched via `fn`. Re-binds the latest `fn` (and\n * `options`) each call (closures change between renders); returns the same handle for the same\n * (hashed) key. */\n query: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => QueryHandle<T>;\n /** Get the stable {@link InfiniteQueryHandle} for `key`, whose pages are fetched via `fn(pageParam)`. */\n infiniteQuery: <T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: InfiniteQueryOptions<T, P>) => InfiniteQueryHandle<T, P>;\n /** Mark matching cached queries, infinite ones included, stale and refetch the **mounted** ones\n * (subscribers > 0). Array keys match by **prefix** (`[\"todo\"]` ⇒ every `[\"todo\", …]`); other keys\n * match exactly. */\n invalidateQueries: (keyOrPrefix: unknown) => void;\n /** Read a cached query's data (`undefined` if absent or not yet successful). Synchronous, no fetch. */\n getQueryData: <T>(key: unknown) => T | undefined;\n /** Write a query's data directly (optimistic updates, or seeding). Creates the entry if absent; marks\n * it fresh (`updatedAt = now`). `updater` may be a value or a function of the previous data. */\n setQueryData: <T>(key: unknown, updater: T | ((prev: T | undefined) => T)) => void;\n /** Fetch + cache a query's data WITHOUT subscribing (SSR prefetch, hover warm). Resolves when cached;\n * a fresh entry is a no-op. Rejects if the fetch throws (caller may swallow). */\n prefetchQuery: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => Promise<void>;\n /** Serialize the successful queries that `options.shouldDehydrateQuery` selects to a transferable\n * snapshot (server → client SSR bridge). Deny by default: with no filter the snapshot is empty. */\n dehydrate: (options?: DehydrateOptions) => DehydratedState;\n /** Seed the cache from a {@link dehydrate} snapshot (client boot). Existing fresher entries win. */\n hydrate: (state: DehydratedState) => void;\n /** Drop every cached query: mounted ones go back to pending and refetch, the rest are removed. Every\n * client in the page runs it when the visitor changes: `identityChanged()` in this tab, a live\n * account switch, or, on the client's next read, a new identity epoch cookie. */\n clear: () => void;\n}",
11867
12045
  "doc": "/** The keyed query cache. One per app (a binding registers it like the router). */"
11868
12046
  },
11869
12047
  {
@@ -11872,6 +12050,13 @@
11872
12050
  "package": "@nifrajs/web",
11873
12051
  "signature": "export interface QueryClientOptions {\n /** Monotonic clock in ms - injected so the core stays deterministic + testable; the adapter binding\n * passes `() => Date.now()`. */\n readonly now: () => number;\n /** Data stays fresh this long after a fetch; older ⇒ refetch on the next `fetch()` (default `0`). */\n readonly staleTime?: number;\n /** Evict an entry this long (ms) after its last subscriber leaves (default 5 min). */\n readonly gcTime?: number;\n /** Hard cap on cached entries - LRU-evict the oldest *unsubscribed* entry past it (default 1000). */\n readonly max?: number;\n}"
11874
12052
  },
12053
+ {
12054
+ "name": "QueryClientProvider",
12055
+ "kind": "function",
12056
+ "package": "@nifrajs/web-preact",
12057
+ "signature": "export declare function QueryClientProvider(props: {\n readonly client: QueryClient;\n readonly children?: ComponentChildren;\n}): ComponentChildren;",
12058
+ "doc": "/** Provide an SSR/request-scoped query client or an application-specific client. */"
12059
+ },
11875
12060
  {
11876
12061
  "name": "QueryClientProvider",
11877
12062
  "kind": "function",
@@ -11879,6 +12064,13 @@
11879
12064
  "signature": "export declare function QueryClientProvider(props: {\n readonly client: QueryClient;\n readonly children?: ReactNode;\n}): ReactNode;",
11880
12065
  "doc": "/** Provide a {@link QueryClient} to the tree - required for SSR dehydrate/hydrate and for tests; a\n * client-only app can omit it and rely on the built-in client-side singleton. */"
11881
12066
  },
12067
+ {
12068
+ "name": "QueryClientProvider",
12069
+ "kind": "function",
12070
+ "package": "@nifrajs/web-solid",
12071
+ "signature": "export declare function QueryClientProvider(props: {\n readonly client: QueryClient;\n readonly state?: DehydratedState;\n readonly children?: JSX.Element;\n}): JSX.Element;",
12072
+ "doc": "/** Provide a request-scoped client and optionally seed it before descendants run. */"
12073
+ },
11882
12074
  {
11883
12075
  "name": "QueryHandle",
11884
12076
  "kind": "interface",
@@ -12126,6 +12318,13 @@
12126
12318
  "signature": "export declare const ROUTE_PATTERN_OVERLAP_MAX_STATES = 100000;",
12127
12319
  "doc": "/** Hard budget for the offline route-language intersection. Never use this on the request path. */"
12128
12320
  },
12321
+ {
12322
+ "name": "ROUTE_TABLE_FILE",
12323
+ "kind": "const",
12324
+ "package": "@nifrajs/web",
12325
+ "signature": "export declare const ROUTE_TABLE_FILE = \".nifra/types/routes.d.ts\";",
12326
+ "doc": "/** The generated `RouteTable`, relative to the app root. */"
12327
+ },
12129
12328
  {
12130
12329
  "name": "ROUTE_TYPES_DIR",
12131
12330
  "kind": "const",
@@ -12190,8 +12389,8 @@
12190
12389
  "name": "RateLimitTier",
12191
12390
  "kind": "interface",
12192
12391
  "package": "@nifrajs/middleware",
12193
- "signature": "export interface RateLimitTier {\n /** Static path prefix such as `/api/public`: no params, wildcards, dot segments or trailing slash. */\n readonly prefix: string;\n readonly max: number;\n readonly windowMs: number;\n /** Bucket key for this tier only. Default: the limiter's `key`, or the derived client IP. Like\n * {@link RateLimitOptions.key} it may be async, and a throw or rejection is charged to the client IP. */\n readonly key?: (req: Request, platform?: Platform) => string | Promise<string>;\n}",
12194
- "doc": "/** One bucket of a {@link rateLimitTiers} limiter: the requests at `prefix` or below it. */"
12392
+ "signature": "export interface RateLimitTier {\n /**\n * Static path prefix such as `/api/public`: no params, wildcards, dot segments or trailing slash.\n * A list charges every prefix in it to this tier's one bucket, so\n * `[\"/api/exports\", \"/api/reports/download\"]` with `max: 30` allows 30 across both, not 30 each.\n */\n readonly prefix: string | readonly string[];\n /**\n * The bucket's store scope, `tier:<name>:`. Default: the first prefix. Name a tier whose prefix\n * list may change, so editing the list keeps its live counters. Letters, digits, `/` and\n * `-._~%!$&'()+,;=@`; unique across tiers.\n */\n readonly name?: string;\n readonly max: number;\n readonly windowMs: number;\n /** Bucket key for this tier only. Default: the limiter's `key`, or the derived client IP. Like\n * {@link RateLimitOptions.key} it may be async, and a throw or rejection is charged to the client IP. */\n readonly key?: (req: Request, platform?: Platform) => string | Promise<string>;\n}",
12393
+ "doc": "/** One bucket of a {@link rateLimitTiers} limiter: the requests at a `prefix` or below it. */"
12195
12394
  },
12196
12395
  {
12197
12396
  "name": "RateLimitTiersOptions",
@@ -12199,6 +12398,13 @@
12199
12398
  "package": "@nifrajs/middleware",
12200
12399
  "signature": "export interface RateLimitTiersOptions extends Omit<RateLimitOptions, \"max\" | \"windowMs\"> {\n /**\n * The bucket for every request no tier claims. Omit it when something in front of the app already\n * applies a base limit: a request no tier claims is then not charged and gets no `RateLimit-*`\n * headers, and the rate-limit route evidence covers only the routes under a tier.\n */\n readonly floor?: {\n readonly max: number;\n readonly windowMs: number;\n };\n readonly tiers: readonly RateLimitTier[];\n}"
12201
12400
  },
12401
+ {
12402
+ "name": "RateLimiter",
12403
+ "kind": "interface",
12404
+ "package": "@nifrajs/middleware",
12405
+ "signature": "export interface RateLimiter extends Middleware {\n /**\n * The exact store key `request` would be charged to, so a test or an ops tool can pre-spend,\n * inspect or reset that bucket through the store. A custom key runs as it would on a request,\n * async included, and a key that throws or rejects resolves to the client-IP bucket. `undefined`\n * when the request would not be charged: `skip` leaves it, no tier claims it and there is no\n * floor, or no key can be derived. Nothing is counted.\n */\n keyOf(request: Request, platform?: Platform): Promise<string | undefined>;\n}",
12406
+ "doc": "/** A rate-limit {@link Middleware} that can name the counter a request is charged to. */"
12407
+ },
12202
12408
  {
12203
12409
  "name": "RawHtml",
12204
12410
  "kind": "class",
@@ -12761,6 +12967,20 @@
12761
12967
  "signature": "export interface RequestLedger {\n /** Validate, freeze, and record one entry. Throws on invalid input, overflow, or after seal. */\n append(input: EffectEntryInput): EffectEntry;\n /** Entries recorded so far (frozen snapshot view). */\n entries(): readonly EffectEntry[];\n readonly size: number;\n readonly sealed: boolean;\n /** Finalize the ledger (computing the chain when enabled). Idempotent - always the same result. */\n seal(): Promise<SealedEffectLedger>;\n}",
12762
12968
  "doc": "/** Per-request ledger. `append` is synchronous (hot-path safe); `seal` is idempotent and async. */"
12763
12969
  },
12970
+ {
12971
+ "name": "RequestLocal",
12972
+ "kind": "interface",
12973
+ "package": "@nifrajs/core",
12974
+ "signature": "export interface RequestLocal<T> {\n /** The value set through `request` or any request in its scope, else `undefined`. */\n get(request: Request): T | undefined;\n /** Set the value for `request`'s whole scope. */\n set(request: Request, value: T): void;\n has(request: Request): boolean;\n /** Remove the value from `request`'s scope; `true` when there was one. */\n delete(request: Request): boolean;\n}",
12975
+ "doc": "/** One request-local slot from {@link requestLocal}. */"
12976
+ },
12977
+ {
12978
+ "name": "RequestLocal",
12979
+ "kind": "interface",
12980
+ "package": "nifra",
12981
+ "signature": "export interface RequestLocal<T> {\n /** The value set through `request` or any request in its scope, else `undefined`. */\n get(request: Request): T | undefined;\n /** Set the value for `request`'s whole scope. */\n set(request: Request, value: T): void;\n has(request: Request): boolean;\n /** Remove the value from `request`'s scope; `true` when there was one. */\n delete(request: Request): boolean;\n}",
12982
+ "doc": "/** One request-local slot from {@link requestLocal}. */"
12983
+ },
12764
12984
  {
12765
12985
  "name": "RequestLogFields",
12766
12986
  "kind": "interface",
@@ -12945,7 +13165,7 @@
12945
13165
  "name": "ResponseContractRuntime",
12946
13166
  "kind": "interface",
12947
13167
  "package": "@nifrajs/core",
12948
- "signature": "export interface ResponseContractRuntime {\n readonly mode: ResponseContractMode;\n check(definition: ResponseContractDefinition, result: unknown, context?: {\n readonly req?: Request;\n readonly jsonReply?: Response | undefined;\n readonly jsonBody?: unknown;\n }): ResponseContractOutcome | Promise<ResponseContractOutcome>;\n}",
13168
+ "signature": "export interface ResponseContractRuntime {\n readonly mode: ResponseContractMode;\n check(definition: ResponseContractDefinition, result: unknown, context?: {\n readonly req?: Request;\n readonly jsonReply?: Response | undefined;\n readonly jsonBody?: unknown;\n }): ResponseContractOutcome | Promise<ResponseContractOutcome>;\n /**\n * What a `c.json(body)` reply with this status writes, each `toJSON` hook applied as `check` judges\n * it, so the reply's bytes and its check share one call of each. Without it, as from a plugin of\n * an older copy of core, the reply writes `body` as given.\n */\n write?(definition: ResponseContractDefinition, body: unknown, status: number | undefined): unknown;\n}",
12949
13169
  "doc": "/**\n * What the server holds when the plugin is installed. The kernel calls `check` through this object and\n * never imports the implementation, so an app that does not install the plugin does not carry it.\n */"
12950
13170
  },
12951
13171
  {
@@ -13617,7 +13837,7 @@
13617
13837
  "name": "RouteModule",
13618
13838
  "kind": "interface",
13619
13839
  "package": "@nifrajs/web",
13620
- "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /** Layout loader that must run before actions and is not retained across the action's render. */\n readonly gate?: boolean;\n readonly action?: Action;\n /**\n * Backend half only: which browser origins may POST to {@link action}. When omitted, a request\n * whose `Origin` is another site's is refused with 403 before middleware, gates or the action run;\n * requests without an `Origin` (non-browser clients) pass. An array allows exactly those origins\n * (and refuses a request without one); a function decides, receiving `null` when there is none.\n * Use it for a callback a third party posts to, such as an identity provider's `form_post`.\n * `Origin` is browser-enforced, not authentication: keep the action's own auth checks.\n */\n readonly allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * Backend half only: the schema of what {@link loader} sends to the browser. Required whenever the\n * loader returns data. Keys it does not declare are dropped before the page renders; a declared\n * field of the wrong shape fails the request with a 500 naming the field's path.\n */\n readonly loaderOutput?: StandardSchemaV1;\n /** Backend half only: the schema of what {@link action} sends back, held to the same rule. */\n readonly actionOutput?: StandardSchemaV1;\n /**\n * Experimental, backend half only: the loader of a partially prerendered page's shared shell. It\n * receives no request, so its output is the same for every visitor and the shell is cached.\n */\n readonly shellLoader?: (ctx: ShellCtx) => unknown;\n /** Experimental, backend half only: the schema of what {@link shellLoader} returns. */\n readonly shellOutput?: StandardSchemaV1;\n /**\n * Experimental, backend half only: query parameters that select a different shell, each with its\n * closed set of values (`{ search: { color: [\"red\", \"blue\"] } }`). Any other parameter, or a value\n * outside its set, builds the default shell; holes still read the whole query.\n */\n readonly shellVariations?: ShellVariations;\n /** Optional client-only loader. It runs after hydration and on client navigations. */\n readonly clientLoader?: ClientLoader;\n /** Optional client-only submit wrapper. The server action remains mandatory for mutations. */\n readonly clientAction?: ClientAction;\n /** Named async boundaries owned by this route. The adapter renders their neutral state seam. A\n * boundary's `load` comes from {@link boundaryLoaders} in the route's backend half; the frontend\n * file declares only how it renders. */\n readonly boundaries?: readonly BoundaryRegistration[];\n /** Backend half only: each boundary's server loader, keyed by boundary name. */\n readonly boundaryLoaders?: Readonly<Record<string, BoundaryLoaderEntry>>;\n /** A Standard Schema validating this route's URL search params. When present, `ctx.search` is parsed +\n * validated against it (failing closed to the schema's defaults on invalid input); type it into the\n * loader with `LoaderArgs<Api, Env, typeof searchSchema>`. */\n readonly searchSchema?: StandardSchemaV1<unknown, Record<string, unknown>>;\n /** Search keys that are purely client-side UI (`\"tab\"`, a client-side `\"sort\"`, `\"modal\"`) and do NOT\n * affect this route's loader. When a client navigation stays on the same route + pathname and changes\n * ONLY these keys, the router updates the URL (so `useSearch` re-renders) WITHOUT re-running the loader.\n * Any other key change revalidates as usual - so omitting a data-affecting key here can never serve\n * stale data, it only forgoes the optimization. Client-only: the server always renders fresh. */\n readonly searchClientKeys?: readonly string[];\n /**\n * `false` gives every client reload of this page (an action's revalidation, `invalidate()`, a live\n * refresh) fresh data. By default a reload keeps the identity of the parts of `data` and the layouts'\n * data that it did not change, so an unchanged row keeps its DOM and component state, and a renderer\n * that memoizes on identity skips it. Not every unchanged row, though: an array whose first 32\n * elements all changed is taken whole, later unchanged elements included, so code that needs a row's\n * identity must not count on it. Opt out for a page whose code compares `data` against its value\n * from before the reload, or whose rows re-render whatever their identity, which then pay the\n * comparison for nothing. Client-only.\n */\n readonly shareData?: boolean;\n /**\n * Keep this page mounted after the visitor leaves it, so back and forward show it again as it was\n * left: its component state, form fields, inner scroll offsets and focus. At most three pages are\n * kept per tab, each for at most 10 minutes; a kept page is shown again only by a back or forward to\n * its own history entry, and its data reloads in place. A sign-in or sign-out drops every kept page.\n * Client-only.\n */\n readonly keepAlive?: true | KeepAliveOptions;\n readonly meta?: MetaInput;\n /**\n * Opt this route out of nifra's full-document client hydration. The server still renders the full\n * HTML document, loaders/actions still run, and native links/forms still work; the generated app\n * client, route chunks, and loader globals are omitted for hard navigations. Intended for static or\n * island-hydrated pages where interactivity is mounted by smaller, explicit client entries.\n */\n readonly hydrate?: boolean;\n /**\n * `false` renders this route's component in the browser only. The server still matches the route,\n * runs its gates and loaders, renders the layouts around it and embeds the data - it skips the\n * component alone, putting {@link HydrateFallback} (or nothing) in the page slot. The browser\n * hydrates against that, then renders the component. For a component that cannot render on a\n * server: one that reads `window` or a browser-only API while it renders.\n *\n * The module itself is still imported on the server, for its loader and options - so an import\n * that needs a browser at load time belongs inside the component (a dynamic `import()`), not at the\n * top of the file. Cannot be combined with `hydrate = false`: nothing would ever render the page.\n */\n readonly ssr?: boolean;\n /**\n * What the server renders in the page slot of an `ssr = false` route, and what the browser hydrates\n * before the component takes over - a skeleton, a spinner. Receives the same props as the\n * component, loader `data` included. Omitted ⇒ the slot is empty until the component renders.\n */\n readonly HydrateFallback?: unknown;\n /**\n * Any value to report through `useMatches` - a breadcrumb label, a render function, a flag a layout\n * reads about the page inside it. Layouts, pages, and status pages may export one. It is read from\n * the module on the server and in the browser, so it must be the same value on both.\n */\n readonly handle?: unknown;\n /**\n * On a root status page (`_404.tsx`, `_<status>.tsx`) or an `_error.tsx`. By default (`true`) the\n * page renders inside the layouts above it with their loader data and `meta`, as a nested `_404`\n * renders. When those layouts cannot render it - a loader throws, a gate or the middleware refuses -\n * a root status page renders alone and an `_error` inside its layouts without their data, with the\n * same status. `false` always renders them that way, and runs no layout loader for them.\n */\n readonly inLayouts?: boolean;\n /**\n * Opt a **static** route (no `:param`/`*`) into build-time prerendering (SSG): `prerenderRoutes`\n * (from `@nifrajs/web/build`) renders it to a static `index.html` at build. The loader runs at build\n * with the in-process `api` (build-safe data only - no per-request cookies/secrets); `defer()` on a\n * prerendered route resolves at build. For **dynamic** routes use {@link getStaticPaths} instead.\n */\n readonly prerender?: boolean;\n /**\n * Enumerate the concrete params to prerender for a **dynamic** (`:param`) route - the SSG path list\n * (blogs/docs/etc.). Runs at build; `prerenderRoutes` renders one `index.html` per returned path.\n */\n readonly getStaticPaths?: GetStaticPaths;\n /**\n * ISR freshness for this route, in **seconds**. `createWebApp` emits it as an\n * `x-nifra-isr-revalidate` response header that `withISR` reads to set the page's cache TTL\n * (overriding the wrapper's default). Older-than-`revalidate` cached pages are served stale while\n * regenerating. (Distinct from the action-revalidation `x-nifra-revalidate` header - a CSV path\n * list the client parses to refetch - so the two channels never alias.)\n */\n readonly revalidate?: number;\n /**\n * Bounded tags ISR on-demand invalidation (`?tag=...`) and a CDN purge reach this page by. A list, or\n * a function of the route's params and URL (`({ params }) => [\\`product:${params.id}\\`]`) for tags\n * per page. Tags travel to the CDN and reach anyone reading the origin: never put personal data in one.\n */\n readonly revalidateTags?: RevalidateTags;\n /**\n * No-framework island bundles (`@nifrajs/web/islands`) to load on this route, as `<script\n * type=\"module\">` in the document tail. Loaded **regardless of `hydrate`** - pair with\n * `export const hydrate = false` for a static page that ships zero framework JS and mounts\n * interactivity through `<Island>` markers + `mountIslands` enhancers instead.\n */\n readonly islandScripts?: readonly string[];\n}",
13840
+ "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /** Layout loader that must run before actions and is not retained across the action's render. */\n readonly gate?: boolean;\n readonly action?: Action;\n /**\n * Backend half only: which browser origins may POST to {@link action}. When omitted, a request\n * whose `Origin` is another site's is refused with 403 before middleware, gates or the action run;\n * requests without an `Origin` (non-browser clients) pass. An array allows exactly those origins\n * (and refuses a request without one); a function decides, receiving `null` when there is none.\n * Use it for a callback a third party posts to, such as an identity provider's `form_post`.\n * `Origin` is browser-enforced, not authentication: keep the action's own auth checks.\n */\n readonly allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * Backend half only: the schema of what {@link loader} sends to the browser. Required whenever the\n * loader returns data. Keys it does not declare are dropped before the page renders; a declared\n * field of the wrong shape fails the request with a 500 naming the field's path.\n */\n readonly loaderOutput?: StandardSchemaV1;\n /** Backend half only: the schema of what {@link action} sends back, held to the same rule. */\n readonly actionOutput?: StandardSchemaV1;\n /**\n * Backend half only: the loader of a partially prerendered page's shared shell. It\n * receives no request, so its output is the same for every visitor and the shell is cached.\n */\n readonly shellLoader?: (ctx: ShellCtx) => unknown;\n /** Backend half only: the schema of what {@link shellLoader} returns. */\n readonly shellOutput?: StandardSchemaV1;\n /**\n * Backend half only: query parameters that select a different shell, each with its\n * closed set of values (`{ search: { color: [\"red\", \"blue\"] } }`). Any other parameter, or a value\n * outside its set, builds the default shell; holes still read the whole query.\n */\n readonly shellVariations?: ShellVariations;\n /** Optional client-only loader. It runs after hydration and on client navigations. */\n readonly clientLoader?: ClientLoader;\n /** Optional client-only submit wrapper. The server action remains mandatory for mutations. */\n readonly clientAction?: ClientAction;\n /** Named async boundaries owned by this route. The adapter renders their neutral state seam. A\n * boundary's `load` comes from {@link boundaryLoaders} in the route's backend half; the frontend\n * file declares only how it renders. */\n readonly boundaries?: readonly BoundaryRegistration[];\n /** Backend half only: each boundary's server loader, keyed by boundary name. */\n readonly boundaryLoaders?: Readonly<Record<string, BoundaryLoaderEntry>>;\n /** A Standard Schema validating this route's URL search params. When present, `ctx.search` is parsed +\n * validated against it (failing closed to the schema's defaults on invalid input); type it into the\n * loader with `LoaderArgs<Api, Env, typeof searchSchema>`. */\n readonly searchSchema?: StandardSchemaV1<unknown, Record<string, unknown>>;\n /** Search keys that are purely client-side UI (`\"tab\"`, a client-side `\"sort\"`, `\"modal\"`) and do NOT\n * affect this route's loader. When a client navigation stays on the same route + pathname and changes\n * ONLY these keys, the router updates the URL (so `useSearch` re-renders) WITHOUT re-running the loader.\n * Any other key change revalidates as usual - so omitting a data-affecting key here can never serve\n * stale data, it only forgoes the optimization. Client-only: the server always renders fresh. */\n readonly searchClientKeys?: readonly string[];\n /**\n * `false` gives every client reload of this page (an action's revalidation, `invalidate()`, a live\n * refresh) fresh data. By default a reload keeps the identity of the parts of `data` and the layouts'\n * data that it did not change, so an unchanged row keeps its DOM and component state, and a renderer\n * that memoizes on identity skips it. Not every unchanged row, though: an array whose first 32\n * elements all changed is taken whole, later unchanged elements included, so code that needs a row's\n * identity must not count on it. Opt out for a page whose code compares `data` against its value\n * from before the reload, or whose rows re-render whatever their identity, which then pay the\n * comparison for nothing. Client-only.\n */\n readonly shareData?: boolean;\n /**\n * Keep this page mounted after the visitor leaves it, so back and forward show it again as it was\n * left: its component state, form fields, inner scroll offsets and focus. At most three pages are\n * kept per tab, each for at most 10 minutes; a kept page is shown again only by a back or forward to\n * its own history entry, and its data reloads in place. A sign-in or sign-out drops every kept page.\n * Client-only.\n */\n readonly keepAlive?: true | KeepAliveOptions;\n readonly meta?: MetaInput;\n /**\n * Opt this route out of nifra's full-document client hydration. The server still renders the full\n * HTML document, loaders/actions still run, and native links/forms still work; the generated app\n * client, route chunks, and loader globals are omitted for hard navigations. Intended for static or\n * island-hydrated pages where interactivity is mounted by smaller, explicit client entries.\n */\n readonly hydrate?: boolean;\n /**\n * `false` renders this route's component in the browser only. The server still matches the route,\n * runs its gates and loaders, renders the layouts around it and embeds the data - it skips the\n * component alone, putting {@link HydrateFallback} (or nothing) in the page slot. The browser\n * hydrates against that, then renders the component. For a component that cannot render on a\n * server: one that reads `window` or a browser-only API while it renders.\n *\n * The module itself is still imported on the server, for its loader and options - so an import\n * that needs a browser at load time belongs inside the component (a dynamic `import()`), not at the\n * top of the file. Cannot be combined with `hydrate = false`: nothing would ever render the page.\n */\n readonly ssr?: boolean;\n /**\n * What the server renders in the page slot of an `ssr = false` route, and what the browser hydrates\n * before the component takes over - a skeleton, a spinner. Receives the same props as the\n * component, loader `data` included. Omitted ⇒ the slot is empty until the component renders.\n */\n readonly HydrateFallback?: unknown;\n /**\n * Any value to report through `useMatches` - a breadcrumb label, a render function, a flag a layout\n * reads about the page inside it. Layouts, pages, and status pages may export one. It is read from\n * the module on the server and in the browser, so it must be the same value on both.\n */\n readonly handle?: unknown;\n /**\n * On a root status page (`_404.tsx`, `_<status>.tsx`) or an `_error.tsx`. By default (`true`) the\n * page renders inside the layouts above it with their loader data and `meta`, as a nested `_404`\n * renders. When those layouts cannot render it - a loader throws, a gate or the middleware refuses -\n * a root status page renders alone and an `_error` inside its layouts without their data, with the\n * same status. `false` always renders them that way, and runs no layout loader for them.\n */\n readonly inLayouts?: boolean;\n /**\n * Opt a **static** route (no `:param`/`*`) into build-time prerendering (SSG): `prerenderRoutes`\n * (from `@nifrajs/web/build`) renders it to a static `index.html` at build. The loader runs at build\n * with the in-process `api` (build-safe data only - no per-request cookies/secrets); `defer()` on a\n * prerendered route resolves at build. For **dynamic** routes use {@link getStaticPaths} instead.\n */\n readonly prerender?: boolean;\n /**\n * Enumerate the concrete params to prerender for a **dynamic** (`:param`) route - the SSG path list\n * (blogs/docs/etc.). Runs at build; `prerenderRoutes` renders one `index.html` per returned path.\n */\n readonly getStaticPaths?: GetStaticPaths;\n /**\n * ISR freshness for this route, in **seconds**. `createWebApp` emits it as an\n * `x-nifra-isr-revalidate` response header that `withISR` reads to set the page's cache TTL\n * (overriding the wrapper's default). Older-than-`revalidate` cached pages are served stale while\n * regenerating. (Distinct from the action-revalidation `x-nifra-revalidate` header - a CSV path\n * list the client parses to refetch - so the two channels never alias.)\n */\n readonly revalidate?: number;\n /**\n * Bounded tags ISR on-demand invalidation (`?tag=...`) and a CDN purge reach this page by. A list, or\n * a function of the route's params and URL (`({ params }) => [\\`product:${params.id}\\`]`) for tags\n * per page. Tags travel to the CDN and reach anyone reading the origin: never put personal data in one.\n */\n readonly revalidateTags?: RevalidateTags;\n /**\n * No-framework island bundles (`@nifrajs/web/islands`) to load on this route, as `<script\n * type=\"module\">` in the document tail. Loaded **regardless of `hydrate`** - pair with\n * `export const hydrate = false` for a static page that ships zero framework JS and mounts\n * interactivity through `<Island>` markers + `mountIslands` enhancers instead.\n */\n readonly islandScripts?: readonly string[];\n}",
13621
13841
  "doc": "/** A route module - the default component + optional loader / action / meta. */"
13622
13842
  },
13623
13843
  {
@@ -13672,13 +13892,6 @@
13672
13892
  "signature": "export interface RouteSchema {\n /** Explicit external-protocol mode. The handler owns raw `c.req` parsing/streaming; no JSON body\n * parser or schema-driven 422 path is installed. A finite transport cap still applies by default. */\n readonly wire?: \"raw\";\n /**\n * Choose trust-boundary order for sensitive routes. Public routes validate first by default;\n * routes with `authenticate()` default to auth first. `validate-before-auth` is an explicit\n * compatibility escape hatch, while `auth-before-validation` can reject without parsing the body.\n */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability.\n *\n * 'unlimited' is legal only for schema-less streaming/upload routes. It is rejected with `body` or\n * `idempotency`, because those lanes buffer the body before user code can apply a protocol-specific\n * bound. Read an unlimited route from `c.req.body` as a stream and bound it by the protocol it speaks;\n * `nifra.body-bounded` is deliberately NOT published for an unlimited route. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema; the validated output is `c.headers` and a failure is a `422`.\n * Every client sends headers a route never declares (`host`, `user-agent`, `accept`), so a closed\n * object schema (`t.object`) validates only the names it declares, each read case-insensitively and\n * keyed as declared. `t.headers` is the open form: it receives every header, names lower-cased,\n * and coerces values like `t.query`. A schema that does not expose its JSON Schema (a zod\n * `.strict()` or valibot `strictObject`) receives every header, so declare it open. */\n readonly headers?: StandardSchemaV1;\n /** Optional request-cookie schema. It validates the cookies parsed from the `Cookie` header -\n * names as sent, values URL-decoded strings, the first of a repeated name - before the handler\n * runs, and the validated output is `c.cookies`. A failure is a `422`, like `headers`. A browser\n * sends every cookie the site has set, so declare the ones the route reads with an open schema\n * (`t.cookies`, `t.looseObject`) rather than rejecting the rest. */\n readonly cookies?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`cookies`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\" | \"cookies\") => Response | unknown | Promise<Response | unknown>;\n}",
13673
13893
  "doc": "/** Per-route input schemas. Each is any Standard Schema (zod/valibot/arktype/…). */"
13674
13894
  },
13675
- {
13676
- "name": "RouteSearch",
13677
- "kind": "interface",
13678
- "package": "@nifrajs/web",
13679
- "signature": "export interface RouteSearch {\n}",
13680
- "doc": "/**\n * The augmentable route -> search-type map for typed cross-route navigation. Empty by default (so an\n * object-form navigate to any path is allowed with a loose `search`). A build step (`nifra sync-routes`)\n * OR the app declares one entry per route path against its `searchSchema` output:\n *\n * ```ts\n * declare module \"@nifrajs/web\" {\n * interface RouteSearch {\n * \"/reports\": { page: number; q: string }\n * }\n * }\n * ```\n *\n * With that, `navigate({ to: \"/reports\", search: { page: 2 } })` type-checks `search` against\n * `/reports`'s schema, and a wrong shape is a compile error. See {@link NavigateTarget}.\n */"
13681
- },
13682
13895
  {
13683
13896
  "name": "RouteSnapshot",
13684
13897
  "kind": "interface",
@@ -13692,6 +13905,13 @@
13692
13905
  "package": "@nifrajs/core",
13693
13906
  "signature": "export interface RouteSnapshotSchema {\n readonly headers?: SchemaSnapshot;\n readonly cookies?: SchemaSnapshot;\n readonly body?: SchemaSnapshot;\n readonly query?: SchemaSnapshot;\n readonly params?: SchemaSnapshot;\n readonly response?: SchemaSnapshot;\n readonly sse?: SchemaSnapshot;\n readonly errors?: Readonly<Record<string, SchemaSnapshot>>;\n}"
13694
13907
  },
13908
+ {
13909
+ "name": "RouteTable",
13910
+ "kind": "interface",
13911
+ "package": "@nifrajs/web",
13912
+ "signature": "export interface RouteTable {\n}",
13913
+ "doc": "/**\n * Every route the app serves, keyed by URL pattern. An entry is `{ params, search }`: `params` is the\n * object a link to the route needs (`Record<string, never>` when the pattern has none), `search` the\n * output of the route's `searchSchema` (the raw query when it declares none). Empty here; `nifra types`\n * writes `.nifra/types/routes.d.ts`, which fills it from the route files:\n *\n * ```ts\n * declare module \"@nifrajs/web\" {\n * interface RouteTable {\n * \"/users/:id\": { readonly params: { readonly id: string }; readonly search: { tab: string } }\n * }\n * }\n * ```\n *\n * There is one key per pattern, so an optional segment (`[[lang]]`) is two keys with exact params each.\n * With an empty table every `to` is accepted and `search` is loose.\n */"
13914
+ },
13695
13915
  {
13696
13916
  "name": "RouteTypesOptions",
13697
13917
  "kind": "interface",
@@ -13749,7 +13969,7 @@
13749
13969
  "name": "RouterState",
13750
13970
  "kind": "interface",
13751
13971
  "package": "@nifrajs/web",
13752
- "signature": "export interface RouterState {\n readonly serverComponents?: import(\"./server-components/types.js\").ComponentState | undefined;\n readonly routeId: string;\n readonly params: Record<string, string>;\n /** The current URL path (used to revalidate the active loader after an action). While\n * {@link intercepted} is set it is the target shown in the boundary, not the page's own. */\n readonly path: string;\n readonly data: unknown;\n /** Per-layout loader data, aligned with the matched chain's leading layout prefix. Absent when no\n * layout in that chain has a loader. */\n readonly layoutData?: readonly unknown[] | undefined;\n /** Neutral named-boundary states for the active route. */\n readonly boundaries?: BoundaryStates;\n /** An action's data return after a client-side submit (cleared on navigation). */\n readonly actionData?: unknown;\n /** True while a navigation or submit is in flight (drives loading UI). */\n readonly pending: boolean;\n /** The path a navigation or a submit's redirect is loading while `pending`; a redirect the router\n * follows moves it to the target. Lets a `NavLink` know whether its own `to` is the one loading;\n * `undefined` when idle. */\n readonly pendingPath?: string | undefined;\n /** The in-flight submit (set during a `submit`, cleared when it settles) - for optimistic UI. */\n readonly submission?: Submission;\n /** Set while an intercept boundary shows a navigation's target over the page: the boundary holding\n * it, and the path the page underneath was loaded from. The page revalidates under `pagePath`, the\n * boundary under `path`. */\n readonly intercepted?: Intercepted;\n /** Opaque: which live load the page data on screen came from (`@nifrajs/web/live-client`). */\n readonly live?: unknown;\n /** The page instance on screen, when the app keeps pages alive (`@nifrajs/web/keep-alive`). */\n readonly instance?: string | undefined;\n /** Pages kept mounted and hidden, least recently shown first. Absent when none is kept. */\n readonly kept?: readonly KeptPage[] | undefined;\n /** This publish showed a kept page again. */\n readonly restored?: boolean | undefined;\n /** A page shown again is reloading its data in place: not a navigation, so `pending` stays false. */\n readonly revalidating?: boolean | undefined;\n}",
13972
+ "signature": "export interface RouterState {\n readonly serverComponents?: import(\"./server-components/types.js\").ComponentState | undefined;\n readonly routeId: string;\n readonly params: Record<string, string>;\n /** The current URL path (used to revalidate the active loader after an action). While\n * {@link intercepted} is set it is the target shown in the boundary, not the page's own. */\n readonly path: string;\n readonly data: unknown;\n /** Per-layout loader data, aligned with the matched chain's leading layout prefix. Absent when no\n * layout in that chain has a loader. */\n readonly layoutData?: readonly unknown[] | undefined;\n /** Neutral named-boundary states for the active route. */\n readonly boundaries?: BoundaryStates;\n /** An action's data return after a client-side submit (cleared on navigation). */\n readonly actionData?: unknown;\n /** True while a navigation or submit is in flight (drives loading UI). */\n readonly pending: boolean;\n /** The path a navigation or a submit's redirect is loading while `pending`; a redirect the router\n * follows moves it to the target. Lets a `NavLink` know whether its own `to` is the one loading;\n * `undefined` when idle. */\n readonly pendingPath?: string | undefined;\n /** The in-flight submit (set during a `submit`, cleared when it settles) - for optimistic UI. */\n readonly submission?: Submission;\n /** Set while an intercept boundary shows a navigation's target over the page: the boundary holding\n * it, and the path the page underneath was loaded from. The page revalidates under `pagePath`, the\n * boundary under `path`. */\n readonly intercepted?: Intercepted;\n /** Opaque: which live load the page data on screen came from (`@nifrajs/web/live-client`). */\n readonly live?: unknown;\n /** The page instance on screen, when the app keeps pages alive (`@nifrajs/web/keep-alive`). */\n readonly instance?: string | undefined;\n /** Pages kept mounted and hidden, least recently shown first. Absent when none is kept. */\n readonly kept?: readonly KeptPage[] | undefined;\n /** This publish showed a kept page again. */\n readonly restored?: boolean | undefined;\n /** A page shown again is reloading its data in place: not a navigation, so `pending` stays false. */\n readonly revalidating?: boolean | undefined;\n /**\n * The page on screen was loaded for the previous visitor and a load for the visitor now here failed:\n * reloading it, or a navigation or submit away from it. A browser loads this URL as a document in its\n * place (`installHistory` does, replacing the entry): the server's redirect target, else the URL a\n * native load would show.\n */\n readonly documentLoad?: string | undefined;\n}",
13753
13973
  "doc": "/** The router's observable state. A new object is published on every transition. */"
13754
13974
  },
13755
13975
  {
@@ -14630,7 +14850,7 @@
14630
14850
  "kind": "type",
14631
14851
  "package": "@nifrajs/web",
14632
14852
  "signature": "export type SearchOf<Module> = Module extends {\n searchSchema: infer S;\n} ? S extends StandardSchemaV1 ? InferOutput<S> extends Record<string, unknown> ? InferOutput<S> : never : Record<string, unknown> : Record<string, unknown>;",
14633
- "doc": "/**\n * The search OUTPUT type for a route MODULE - its `searchSchema`'s validated output, or the raw parsed\n * query (`Record<string, unknown>`) when it declares none. The building block for typed cross-route\n * navigation: generated route types (`nifra sync-routes`) map each path to\n * `SearchOf<typeof import(\"./routes/<file>\")>`, populating the augmentable `RouteSearch` interface.\n */"
14853
+ "doc": "/**\n * The search OUTPUT type for a route MODULE - its `searchSchema`'s validated output, or the raw parsed\n * query (`Record<string, unknown>`) when it declares none. The building block for typed cross-route\n * navigation: `nifra types` maps each route pattern to\n * `SearchOf<typeof import(\"./routes/<file>\")>` in `.nifra/types/routes.d.ts`, populating the augmentable\n * `RouteTable` interface.\n */"
14634
14854
  },
14635
14855
  {
14636
14856
  "name": "SearchParamsInit",
@@ -14722,7 +14942,7 @@
14722
14942
  "name": "SegmentMatch",
14723
14943
  "kind": "type",
14724
14944
  "package": "@nifrajs/i18n",
14725
- "signature": "export type SegmentMatch<K extends string = string> = {\n readonly kind: \"ok\";\n readonly locale: K;\n}\n/** Not a served locale (unknown, or a draft): answer 404. */\n | {\n readonly kind: \"not-found\";\n}\n/** A served locale under a non-canonical URL - the default's prefix when the default is served\n * unprefixed, or the wrong case. `location` is the canonical path, query kept. */\n | {\n readonly kind: \"redirect\";\n readonly location: string;\n};",
14945
+ "signature": "export type SegmentMatch<K extends string = string> = {\n readonly kind: \"ok\";\n readonly locale: K;\n}\n/** Not a served locale (unknown, or a draft): answer 404. */\n | {\n readonly kind: \"not-found\";\n}\n/** A served locale under a non-canonical URL - the default's prefix when the default is served\n * unprefixed, the wrong case, or a mapped page's canonical source spelling instead of its translated\n * spelling. `location` is the canonical localized path, query kept and hash dropped. */\n | {\n readonly kind: \"redirect\";\n readonly location: string;\n};",
14726
14946
  "doc": "/** What a `[lang]` segment value means for the request. */"
14727
14947
  },
14728
14948
  {
@@ -14754,26 +14974,34 @@
14754
14974
  "name": "ServeOptions",
14755
14975
  "kind": "interface",
14756
14976
  "package": "@nifrajs/deno",
14757
- "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in,\n * mirroring nifra's Bun `listen({ gracefulSignals })`. The object form is passed to `stop()`.\n */\n readonly signals?: boolean | DenoStopOptions;\n /**\n * Serve HTTPS directly, with no proxy in front: `cert` and `key` as PEM text or the files' bytes.\n * Unset, the server speaks plain HTTP, which is what a proxy or platform that terminates TLS\n * expects.\n */\n readonly tls?: {\n readonly cert: string | Uint8Array;\n readonly key: string | Uint8Array;\n };\n}"
14977
+ "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in, as\n * `server({ gracefulSignals })` is for Bun's `listen()`. The object form is passed to `stop()`.\n */\n readonly gracefulSignals?: boolean | DenoStopOptions;\n /**\n * Serve HTTPS directly, with no proxy in front: `cert` and `key` as PEM text or the files' bytes.\n * Unset, the server speaks plain HTTP, which is what a proxy or platform that terminates TLS\n * expects.\n */\n readonly tls?: {\n readonly cert: string | Uint8Array;\n readonly key: string | Uint8Array;\n };\n /**\n * Sees every request before the app does, so a file it answers wins over any route at the same\n * path. It returns the file's response, or `undefined` to let the app route the request. No hook\n * of the app runs for a request it answers. {@link serveStatic} builds one for files on disk, and\n * `@nifrajs/web`'s Deno build serves its client bundle and public files through it.\n */\n readonly static?: (request: Request) => Response | Promise<Response | undefined> | undefined;\n}"
14758
14978
  },
14759
14979
  {
14760
14980
  "name": "ServeOptions",
14761
14981
  "kind": "interface",
14762
14982
  "package": "@nifrajs/node",
14763
- "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * The default is `\"https\"` when {@link ServeOptions.tls} is set and `\"http\"` otherwise. Deployments\n * behind TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Serve HTTPS directly, with no proxy in front: `{ cert, key }` as PEM text or the files' bytes\n * (`readFileSync(\"cert.pem\")`), plus any other `node:tls` server option (`passphrase`, `ca`,\n * `requestCert` for client certificates, `minVersion`, `SNICallback`, ...). Unset, the server speaks\n * plain HTTP, which is what a proxy or platform that terminates TLS expects.\n */\n readonly tls?: TlsOptions;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in,\n * mirroring nifra's Bun `listen({ gracefulSignals })`. The object form is passed to `stop()`.\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly signals?: boolean | NodeStopOptions;\n /**\n * Serve static files from disk for matching GET/HEAD requests *before* the app runs - non-matching\n * requests fall through to `app.fetch` with the node-direct fast path intact (no perf regression on\n * SSR/API routes). Replaces the hand-rolled `/assets/*` reader in self-hosted entries. An array\n * serves several directories; the first mount whose prefix (and `files`, when set) takes a path\n * answers it.\n */\n readonly static?: ServeStaticOptions | readonly ServeStaticOptions[];\n /**\n * Make a hand-rolled `return new Response(body)` ride the direct-write lane, by swapping\n * `globalThis.Response` for a stand-in that defers a *simple* construction (a string body, no\n * `statusText`, no headers or a plain header record) the way `c.text` / `c.json` already do.\n *\n * Off by default: prefer `c.text` / `c.json`, which get this without a global swap. Reach for the\n * flag only when handlers construct `Response` by hand on the hot path. It patches a process-global\n * builtin, so every `new Response(...)` anywhere in the process goes through the stand-in -\n * transparent (non-simple bodies build a real `Response`, and simple ones stay `instanceof\n * Response`), but a broad enough change to be opt-in.\n */\n readonly fastResponse?: boolean;\n}"
14983
+ "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * The default is `\"https\"` when {@link ServeOptions.tls} is set and `\"http\"` otherwise. Deployments\n * behind TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Serve HTTPS directly, with no proxy in front: `{ cert, key }` as PEM text or the files' bytes\n * (`readFileSync(\"cert.pem\")`), plus any other `node:tls` server option (`passphrase`, `ca`,\n * `requestCert` for client certificates, `minVersion`, `SNICallback`, ...). Unset, the server speaks\n * plain HTTP, which is what a proxy or platform that terminates TLS expects.\n */\n readonly tls?: TlsOptions;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Route a request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed URL,\n * so `/public/../admin` reaches the app as `/admin`; Node's `IncomingMessage.url` is the target as\n * sent. Off, Node routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path. Off by default; enable it when path guards, or a path-normalizing proxy, sit in front\n * of or inside the app. The same option as `server({ normalizeTarget })` on Deno.\n *\n * Off applies to requests the adapter serves from Node's own request object. A request the adapter\n * must hand over as a Web `Request` - one a `static` callback sees, and every WebSocket upgrade -\n * is built by the platform's URL parser, which resolves dot segments whatever this option says.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in, as\n * `server({ gracefulSignals })` is for Bun's `listen()`. The object form is passed to `stop()`.\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly gracefulSignals?: boolean | NodeStopOptions;\n /**\n * Sees every request before the app does, so a file it answers wins over any route at the same\n * path. It returns the file's response, or `undefined` to let the app route the request. No hook\n * of the app runs for a request it answers. The same option as Bun's `app.listen()` and\n * `@nifrajs/deno`'s `serve()`.\n *\n * {@link serveStatic} is the one to pass for files on disk: this adapter runs its mounts on Node's\n * own request, so a request they pass on keeps the app's direct lane. Any other function needs a\n * Web `Request` for every request, which roughly doubles the cost of a small route.\n */\n readonly static?: (request: Request) => Response | Promise<Response | undefined> | undefined;\n /**\n * Make a hand-rolled `return new Response(body)` ride the direct-write lane, by swapping\n * `globalThis.Response` for a stand-in that defers a *simple* construction (a string body, no\n * `statusText`, no headers or a plain header record) the way `c.text` / `c.json` already do.\n *\n * Off by default: prefer `c.text` / `c.json`, which get this without a global swap. Reach for the\n * flag only when handlers construct `Response` by hand on the hot path. It patches a process-global\n * builtin, so every `new Response(...)` anywhere in the process goes through the stand-in -\n * transparent (non-simple bodies build a real `Response`, and simple ones stay `instanceof\n * Response`), but a broad enough change to be opt-in.\n */\n readonly fastResponse?: boolean;\n}"
14764
14984
  },
14765
14985
  {
14766
- "name": "ServePublicDirOptions",
14986
+ "name": "ServeStaticOptions",
14767
14987
  "kind": "interface",
14768
- "package": "@nifrajs/web",
14769
- "signature": "export interface ServePublicDirOptions {\n /** Absolute path of the directory to serve. */\n readonly dir: string;\n /** URL prefix whose files are content-hashed and may be cached immutably (default `\"/assets/\"`).\n * Ignored when `hashedFiles` is set. */\n readonly hashedPrefix?: string;\n /**\n * Encoded URL paths of the content-hashed files, such as a build manifest's `assets`. When set, only\n * these are cached immutably and every other file gets the `assets` policy, so a user-authored file\n * that happens to sit under the hashed prefix still revalidates.\n */\n readonly hashedFiles?: ReadonlySet<string>;\n readonly cache?: PublicDirCache;\n /** Optional encoded URL-path allowlist. When present, route misses avoid a filesystem probe. */\n readonly files?: ReadonlySet<string>;\n}"
14988
+ "package": "@nifrajs/core",
14989
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
14990
+ "doc": "/**\n * One directory `serveStatic()` serves under a URL prefix: the same options on Bun\n * (`@nifrajs/core/serve-static`), `@nifrajs/node` and `@nifrajs/deno`. Each runtime reads the files\n * with its own fastest file API; which request a mount takes, and how it answers, is decided here.\n */"
14991
+ },
14992
+ {
14993
+ "name": "ServeStaticOptions",
14994
+ "kind": "interface",
14995
+ "package": "@nifrajs/deno",
14996
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
14997
+ "doc": "/**\n * One directory `serveStatic()` serves under a URL prefix: the same options on Bun\n * (`@nifrajs/core/serve-static`), `@nifrajs/node` and `@nifrajs/deno`. Each runtime reads the files\n * with its own fastest file API; which request a mount takes, and how it answers, is decided here.\n */"
14770
14998
  },
14771
14999
  {
14772
15000
  "name": "ServeStaticOptions",
14773
15001
  "kind": "interface",
14774
15002
  "package": "@nifrajs/node",
14775
- "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * URL paths of the content-hashed files, such as a client build manifest's `assets`. When set,\n * `immutable` applies only to these; any other file is sent with its validators and no\n * `cache-control`, so a file that keeps its name across deploys still revalidates.\n */\n readonly hashedFiles?: Iterable<string>;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host` (its Host header). `false` passes the request on, without touching the filesystem, to the\n * next mount and then the app - the seam a host policy uses so a host's refused file meets the\n * app's own refusal instead of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered `404` - the same response as a missing file, so probing\n * can't distinguish \"hidden\" from \"absent\". Dotfiles land in build output by accident, not by\n * design (`.env` next to the bundle, a `.git` dir in a copied tree), so serving them is opt-in.\n * `/.well-known` is public by definition (RFC 8615) and always served, as `servePublicDir` does.\n * The rule applies to the requested path and again to the file it resolves to, so a visible name\n * linking to `.env` is denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n}",
14776
- "doc": "/**\n * Serve static files from a directory (e.g. the client build) under a URL prefix - so a self-hosted\n * Node deploy doesn't need a CDN or a hand-rolled `/assets/*` handler. (On Cloudflare/Vercel the\n * platform serves assets; this is for `node server.js`.)\n */"
15003
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15004
+ "doc": "/**\n * One directory `serveStatic()` serves under a URL prefix: the same options on Bun\n * (`@nifrajs/core/serve-static`), `@nifrajs/node` and `@nifrajs/deno`. Each runtime reads the files\n * with its own fastest file API; which request a mount takes, and how it answers, is decided here.\n */"
14777
15005
  },
14778
15006
  {
14779
15007
  "name": "ServeStdioOptions",
@@ -14797,14 +15025,14 @@
14797
15025
  "name": "Server",
14798
15026
  "kind": "class",
14799
15027
  "package": "@nifrajs/core",
14800
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop({ drainMs, delayMs }?: StopOptions): Promise<void>;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
15028
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly normalizeTarget;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n /** {@link fetchMatched} for an app whose `onRequest` hooks run before the route does: the hooks see\n * the request first, and the route Bun matched runs unless one of them replaced the request. */\n private fetchMatchedHooked;\n private fetchMatchedHookedInner;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * The stage chain a hook shape runs - derive, before, handler, after, respond - for the Web lane,\n * built once per server and shared by every route with the same number of hooks in each phase (none,\n * one or several). The chain reads a route's handler and hooks from its `FusedHooks` per request, so\n * a route's own closure (see {@link buildFusedLifecycleWeb}) holds only that record and its schemas,\n * and memory grows with the number of distinct shapes, not routes or hook functions.\n */\n private fusedWebStages;\n /**\n * Compile a fused lifecycle route's entry closure: parse (body) → validate → the shared stage chain\n * of its hook shape (derive → before → handler → after → respond, see {@link fusedWebStages}) in a\n * single frame, where the generic program walks staged hook loops. `selectRouteLanes` admits only\n * derive, before and after hooks - no params or headers schema, onError, around, decorations,\n * response contract or recovery hook, and never a query schema beside a body schema - so the behavior\n * is the compiled program's: the same stage order, the same thrown-value contract (`Response` is\n * control flow, anything else logs and 500s), the same `c.set` semantics and `fusedRespond` render.\n * The route's own closure holds only its `FusedHooks` and schemas and takes the request's context as\n * an argument, so a request allocates no step closures.\n */\n /**\n * Keep the common one-derive/one-before shape bound to its hooks. Inline its synchronous path to\n * avoid stage calls; retain helper closures only for promise continuations.\n */\n private buildFusedLifecycleWebSingle;\n private buildFusedLifecycleWeb;\n /**\n * The Node-direct twin of {@link fusedWebStages}: the same chain, finalizing through the caller's\n * own `finalize`, shared by every route with the same hook shape. A terminal `finalize` throw (an\n * unstringifiable handler return on the Node lane) is caught as `finishLifecycleContract` catches it.\n */\n private fusedNodeStages;\n /**\n * The Node-direct twin of {@link buildFusedLifecycleWeb}: the same steps, finalizing through the\n * caller's own `finalize` (the Node outcome on the direct lane) instead of building a `Response`, so\n * the `!webFast` dispatcher runs these routes in one frame rather than the generic program. A\n * terminal `finalize` throw (an unstringifiable handler return on the Node lane) is caught as\n * `finishLifecycleContract` catches it; the body's 415/400 renders take `wrapResponse` directly.\n */\n private buildFusedLifecycleRunner;\n /** The thrown-value render of the Web fused lifecycle lanes for a route with no error hooks: a\n * `Response` is control flow, anything else is logged and answered with a plain 500. */\n private fusedWebFail;\n /** {@link fusedWebFail} for a fused route that may have error hooks. */\n private fusedWebRouteFail;\n /** The thrown-value render of a fused lifecycle route. A `Response` or `status(...)` is control flow\n * that no error hook sees, unless it cannot render, which is a fault like any other. Anything else\n * goes to the route's error hooks; with none it is logged and answered with a plain 500. */\n private fusedFail;\n /** {@link respondFused} for a fused lifecycle route, whose failures reach its error hooks. */\n private respondHooks;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Paths a composed mount or\n * a WebSocket handshake may reach stay with the portable dispatcher; provably disjoint HTTP routes\n * keep native matching. Request hooks run before the matched route and rewrites return to dispatch.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`, or hold those requests' connections alone with\n * `withIdleTimeout()` from `@nifrajs/core/idle-timeout`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n *\n * `static` sees every request before the app does, the ones Bun's route table serves included, so\n * a file it answers wins over any route at the same path. It returns the file's response, or\n * `undefined` to let the app route the request. No hook of the app runs for a request it answers.\n * `@nifrajs/web`'s Bun build serves its client bundle and public files this way.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n readonly static?: (request: Request) => MaybePromise<Response | undefined>;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop({ drainMs, delayMs }?: StopOptions): Promise<void>;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
14801
15029
  "doc": "/**\n * The inline server. Routes are chainable and fully type-inferred. `derive`/\n * `decorate` extend the handler context (`Ctx`) for routes defined *after* them,\n * with full types; `Ctx` is server-only and never touches the client registry.\n *\n * app.decorate(\"db\", db).derive((c) => ({ user: auth(c) }))\n * .get(\"/me\", (c) => c.user) // c.user + c.db are typed\n */"
14802
15030
  },
14803
15031
  {
14804
15032
  "name": "Server",
14805
15033
  "kind": "class",
14806
15034
  "package": "nifra",
14807
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop({ drainMs, delayMs }?: StopOptions): Promise<void>;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
15035
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly normalizeTarget;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n /** {@link fetchMatched} for an app whose `onRequest` hooks run before the route does: the hooks see\n * the request first, and the route Bun matched runs unless one of them replaced the request. */\n private fetchMatchedHooked;\n private fetchMatchedHookedInner;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * The stage chain a hook shape runs - derive, before, handler, after, respond - for the Web lane,\n * built once per server and shared by every route with the same number of hooks in each phase (none,\n * one or several). The chain reads a route's handler and hooks from its `FusedHooks` per request, so\n * a route's own closure (see {@link buildFusedLifecycleWeb}) holds only that record and its schemas,\n * and memory grows with the number of distinct shapes, not routes or hook functions.\n */\n private fusedWebStages;\n /**\n * Compile a fused lifecycle route's entry closure: parse (body) → validate → the shared stage chain\n * of its hook shape (derive → before → handler → after → respond, see {@link fusedWebStages}) in a\n * single frame, where the generic program walks staged hook loops. `selectRouteLanes` admits only\n * derive, before and after hooks - no params or headers schema, onError, around, decorations,\n * response contract or recovery hook, and never a query schema beside a body schema - so the behavior\n * is the compiled program's: the same stage order, the same thrown-value contract (`Response` is\n * control flow, anything else logs and 500s), the same `c.set` semantics and `fusedRespond` render.\n * The route's own closure holds only its `FusedHooks` and schemas and takes the request's context as\n * an argument, so a request allocates no step closures.\n */\n /**\n * Keep the common one-derive/one-before shape bound to its hooks. Inline its synchronous path to\n * avoid stage calls; retain helper closures only for promise continuations.\n */\n private buildFusedLifecycleWebSingle;\n private buildFusedLifecycleWeb;\n /**\n * The Node-direct twin of {@link fusedWebStages}: the same chain, finalizing through the caller's\n * own `finalize`, shared by every route with the same hook shape. A terminal `finalize` throw (an\n * unstringifiable handler return on the Node lane) is caught as `finishLifecycleContract` catches it.\n */\n private fusedNodeStages;\n /**\n * The Node-direct twin of {@link buildFusedLifecycleWeb}: the same steps, finalizing through the\n * caller's own `finalize` (the Node outcome on the direct lane) instead of building a `Response`, so\n * the `!webFast` dispatcher runs these routes in one frame rather than the generic program. A\n * terminal `finalize` throw (an unstringifiable handler return on the Node lane) is caught as\n * `finishLifecycleContract` catches it; the body's 415/400 renders take `wrapResponse` directly.\n */\n private buildFusedLifecycleRunner;\n /** The thrown-value render of the Web fused lifecycle lanes for a route with no error hooks: a\n * `Response` is control flow, anything else is logged and answered with a plain 500. */\n private fusedWebFail;\n /** {@link fusedWebFail} for a fused route that may have error hooks. */\n private fusedWebRouteFail;\n /** The thrown-value render of a fused lifecycle route. A `Response` or `status(...)` is control flow\n * that no error hook sees, unless it cannot render, which is a fault like any other. Anything else\n * goes to the route's error hooks; with none it is logged and answered with a plain 500. */\n private fusedFail;\n /** {@link respondFused} for a fused lifecycle route, whose failures reach its error hooks. */\n private respondHooks;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Paths a composed mount or\n * a WebSocket handshake may reach stay with the portable dispatcher; provably disjoint HTTP routes\n * keep native matching. Request hooks run before the matched route and rewrites return to dispatch.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`, or hold those requests' connections alone with\n * `withIdleTimeout()` from `@nifrajs/core/idle-timeout`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n *\n * `static` sees every request before the app does, the ones Bun's route table serves included, so\n * a file it answers wins over any route at the same path. It returns the file's response, or\n * `undefined` to let the app route the request. No hook of the app runs for a request it answers.\n * `@nifrajs/web`'s Bun build serves its client bundle and public files this way.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n readonly static?: (request: Request) => MaybePromise<Response | undefined>;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop({ drainMs, delayMs }?: StopOptions): Promise<void>;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
14808
15036
  "doc": "/**\n * The inline server. Routes are chainable and fully type-inferred. `derive`/\n * `decorate` extend the handler context (`Ctx`) for routes defined *after* them,\n * with full types; `Ctx` is server-only and never touches the client registry.\n *\n * app.decorate(\"db\", db).derive((c) => ({ user: auth(c) }))\n * .get(\"/me\", (c) => c.user) // c.user + c.db are typed\n */"
14809
15037
  },
14810
15038
  {
@@ -14915,7 +15143,7 @@
14915
15143
  "name": "ServerComponentsOptions",
14916
15144
  "kind": "interface",
14917
15145
  "package": "@nifrajs/web",
14918
- "signature": "export interface ServerComponentsOptions {\n readonly build: string;\n readonly adapter: ServerComponentRenderAdapter;\n readonly owners: Readonly<Record<string, ComponentOwner>>;\n /**\n * Experimental: route id to the server components its partially prerendered holes may show, each\n * through `serverHole`. A route is an owner or hosts holes, never both.\n */\n readonly holes?: Readonly<Record<string, ComponentHoles>>;\n readonly capabilities?: readonly CapabilityDefinition[];\n readonly assets?: readonly string[];\n}"
15146
+ "signature": "export interface ServerComponentsOptions {\n readonly build: string;\n readonly adapter: ServerComponentRenderAdapter;\n readonly owners: Readonly<Record<string, ComponentOwner>>;\n /**\n * Route id to the server components its partially prerendered holes may show, each\n * through `serverHole`. A route is an owner or hosts holes, never both.\n */\n readonly holes?: Readonly<Record<string, ComponentHoles>>;\n readonly capabilities?: readonly CapabilityDefinition[];\n readonly assets?: readonly string[];\n}"
14919
15147
  },
14920
15148
  {
14921
15149
  "name": "ServerComponentsPluginOptions",
@@ -14943,6 +15171,13 @@
14943
15171
  "signature": "export type ServerEntryOptionImports = Readonly<Partial<Record<ServerEntryOption, string>>>;",
14944
15172
  "doc": "/** Each importable option mapped to the specifier of the module that exports it. */"
14945
15173
  },
15174
+ {
15175
+ "name": "ServerEntrySelfHost",
15176
+ "kind": "interface",
15177
+ "package": "@nifrajs/web",
15178
+ "signature": "export interface ServerEntrySelfHost {\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n readonly delayMs?: number;\n };\n readonly idleTimeoutSec?: number;\n}",
15179
+ "doc": "/**\n * Settings the server of a self-hosting target (`bun`, `node`, `deno`) starts with; an edge target has\n * no process of its own and ignores them. `gracefulSignals` stops the server gracefully on SIGTERM and\n * SIGINT (`docker stop`, Ctrl-C): `true`, or the `{ drainMs, delayMs }` its `stop()` takes.\n * `idleTimeoutSec` is how long Bun keeps a connection that moves no bytes, a whole number from `0`\n * (never) to 255, a request whose handler is still working included. Node and Deno do not close a\n * connection while its request is being handled, so they ignore it.\n */"
15180
+ },
14946
15181
  {
14947
15182
  "name": "ServerFn",
14948
15183
  "kind": "interface",
@@ -15045,13 +15280,13 @@
15045
15280
  "name": "ServerOptions",
15046
15281
  "kind": "interface",
15047
15282
  "package": "@nifrajs/core",
15048
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` on Bun to every Host that Node and Deno refuse: one sent twice, one\n * no URL can be built on (a space, a byte past ASCII, a port past 65535, an IPv6 literal no parser\n * takes), a percent-encoded or sub-delimiter one, and serve an HTTP/1.0 request with no Host as\n * `localhost`. Bun serves those requests itself, building `c.req.url` on the first Host or leaving\n * it relative, so `new URL(c.req.url)` can throw in a handler.\n *\n * Disabled by default: the check reads the Host on every request, which measured about 6% of a bare\n * route on Bun. Left off, a target with `.` or `..` segments is still checked, so a dot segment is\n * never routed raw. Node and Deno refuse these Hosts either way; the option changes nothing there.\n */\n readonly validateHost?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
15283
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` for Hosts the request target cannot safely be built on: one sent\n * twice, one with a space or byte past ASCII, a port past 65535, an IPv6 literal no URL parser\n * takes, a percent-encoded or sub-delimiter Host, or an authority that can change Deno's route.\n * Bun may leave `c.req.url` relative or build it on the first Host, so `new URL(c.req.url)` can\n * throw in a handler.\n *\n * Disabled by default: checking Host on every request measured about 6% of a bare route on Bun.\n * Deno builds `Request.url` from Host; without this check, a malformed Host can change the routed\n * path. Enable it when Deno receives requests with an untrusted Host header.\n */\n readonly validateHost?: boolean;\n /**\n * Route a Deno request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed\n * URL, so `/public/../admin` reaches the app as `/admin`; Deno hands over the target as sent. Off,\n * Deno routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path.\n *\n * Disabled by default: the check reads and scans the whole URL of every request, measured at about\n * 3% of a bare route on Deno. Enable it when path guards, or a path-normalizing proxy, sit in\n * front of or inside the app. Bun already delivers parsed targets and is unaffected; `@nifrajs/node`\n * has the same option on `serve()`.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
15049
15284
  },
15050
15285
  {
15051
15286
  "name": "ServerOptions",
15052
15287
  "kind": "interface",
15053
15288
  "package": "nifra",
15054
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` on Bun to every Host that Node and Deno refuse: one sent twice, one\n * no URL can be built on (a space, a byte past ASCII, a port past 65535, an IPv6 literal no parser\n * takes), a percent-encoded or sub-delimiter one, and serve an HTTP/1.0 request with no Host as\n * `localhost`. Bun serves those requests itself, building `c.req.url` on the first Host or leaving\n * it relative, so `new URL(c.req.url)` can throw in a handler.\n *\n * Disabled by default: the check reads the Host on every request, which measured about 6% of a bare\n * route on Bun. Left off, a target with `.` or `..` segments is still checked, so a dot segment is\n * never routed raw. Node and Deno refuse these Hosts either way; the option changes nothing there.\n */\n readonly validateHost?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
15289
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` for Hosts the request target cannot safely be built on: one sent\n * twice, one with a space or byte past ASCII, a port past 65535, an IPv6 literal no URL parser\n * takes, a percent-encoded or sub-delimiter Host, or an authority that can change Deno's route.\n * Bun may leave `c.req.url` relative or build it on the first Host, so `new URL(c.req.url)` can\n * throw in a handler.\n *\n * Disabled by default: checking Host on every request measured about 6% of a bare route on Bun.\n * Deno builds `Request.url` from Host; without this check, a malformed Host can change the routed\n * path. Enable it when Deno receives requests with an untrusted Host header.\n */\n readonly validateHost?: boolean;\n /**\n * Route a Deno request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed\n * URL, so `/public/../admin` reaches the app as `/admin`; Deno hands over the target as sent. Off,\n * Deno routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path.\n *\n * Disabled by default: the check reads and scans the whole URL of every request, measured at about\n * 3% of a bare route on Deno. Enable it when path guards, or a path-normalizing proxy, sit in\n * front of or inside the app. Bun already delivers parsed targets and is unaffected; `@nifrajs/node`\n * has the same option on `serve()`.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
15055
15290
  },
15056
15291
  {
15057
15292
  "name": "ServerPrerenderedPage",
@@ -15156,7 +15391,7 @@
15156
15391
  "name": "SessionOptions",
15157
15392
  "kind": "interface",
15158
15393
  "package": "@nifrajs/auth",
15159
- "signature": "export interface SessionOptions {\n /** Signing secret (≥ 32 bytes), or a rotation list: the **first** secret signs new cookies and\n * any listed secret verifies, so rotating without invalidating live sessions is: prepend the new\n * secret, drop the old one after `maxAge` has elapsed. A bare secret swap (no list) invalidates\n * all existing sessions. */\n readonly secret: string | readonly string[];\n /** Strongly consistent backend for **store mode**; omit for **cookie mode** (stateless).\n * Declared eventually consistent stores (including KVSessionStore) are refused. */\n readonly store?: SessionStore;\n /** Cookie name. Default `nifra_session`. */\n readonly cookieName?: string;\n /** Session lifetime in **seconds**. Default 7 days. */\n readonly maxAge?: number;\n /** Slide the expiry forward on every commit (default `true`); `false` = fixed absolute expiry. */\n readonly rolling?: boolean;\n /** Extra cookie attributes (the session cookie is always HttpOnly; `Secure`/`SameSite=Lax`/`Path=/`\n * default via `c.set.cookie`). Pass `{ secure: false }` for local http dev. */\n readonly cookie?: SessionCookieOptions;\n /** Clock (ms) - injected for testability; production passes `() => Date.now()` (the default). */\n readonly now?: () => number;\n /**\n * Also accept a session cookie signed by `@nifrajs/auth` before 5.0, whose signature does not cover\n * the cookie name, so upgrading from 4.x signs no one out. Off by default: while it is on, any\n * value the app signs with this secret through `@nifrajs/core`'s `signValue` (a signed preference\n * cookie, say) and that parses as a session reads as one. Turn it on for one `maxAge` after the\n * upgrade, then remove it; each such session is re-signed in the current form on its next commit.\n */\n readonly acceptLegacyCookies?: boolean;\n}"
15394
+ "signature": "export interface SessionOptions<Data extends Record<string, unknown> = Record<string, unknown>> {\n /** Signing secret (≥ 32 bytes), or a rotation list: the **first** secret signs new cookies and\n * any listed secret verifies, so rotating without invalidating live sessions is: prepend the new\n * secret, drop the old one after `maxAge` has elapsed. A bare secret swap (no list) invalidates\n * all existing sessions. */\n readonly secret: string | readonly string[];\n /** Strongly consistent backend for **store mode**; omit for **cookie mode** (stateless).\n * Declared eventually consistent stores (including KVSessionStore) are refused. */\n readonly store?: SessionStore;\n /** Cookie name. Default `nifra_session`. */\n readonly cookieName?: string;\n /** Session lifetime in **seconds**. Default 7 days. */\n readonly maxAge?: number;\n /** Slide the expiry forward on every commit (default `true`); `false` = fixed absolute expiry. */\n readonly rolling?: boolean;\n /** Extra cookie attributes (the session cookie is always HttpOnly; `Secure`/`SameSite=Lax`/`Path=/`\n * default via `c.set.cookie`). Pass `{ secure: false }` for local http dev. */\n readonly cookie?: SessionCookieOptions;\n /** Clock (ms) - injected for testability; production passes `() => Date.now()` (the default). */\n readonly now?: () => number;\n /**\n * Also accept a session cookie signed by `@nifrajs/auth` before 5.0, whose signature does not cover\n * the cookie name, so upgrading from 4.x signs no one out. Off by default: while it is on, any\n * value the app signs with this secret through `@nifrajs/core`'s `signValue` (a signed preference\n * cookie, say) and that parses as a session reads as one. Turn it on for one `maxAge` after the\n * upgrade, then remove it; each such session is re-signed in the current form on its next commit.\n */\n readonly acceptLegacyCookies?: boolean;\n /**\n * The data keys that say who the visitor is: a user id, and any key that changes what a page may\n * show, such as an organization or a role. The session cookie carries a tag that changes only when\n * one of them does, so `@nifrajs/web` keep-alive keeps the pages it holds across a commit that\n * writes other data, a cart say. Unset, every key counts and any change to the data changes the\n * tag. Leaving out a key that decides what a page shows lets the next visitor of a browser see the\n * pages kept for the previous one.\n */\n readonly identity?: readonly (keyof Data & string)[];\n}"
15160
15395
  },
15161
15396
  {
15162
15397
  "name": "SessionRecord",
@@ -15237,14 +15472,14 @@
15237
15472
  "kind": "type",
15238
15473
  "package": "@nifrajs/web",
15239
15474
  "signature": "export type SharedBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: \"shared\";\n readonly load?: (ctx: SharedHoleCtx) => Data | Promise<Data>;\n /** The hole ships its props and hydrates. Default `false`. */\n readonly interactive?: boolean;\n /** How long a visitor waits for a build in milliseconds, then gets the error slot. Default 5000. */\n readonly timeout?: number;\n};",
15240
- "doc": "/**\n * Experimental, partial prerendering: a hole that is the same for every visitor, built like the shell\n * from a request-free context and cached on its own `revalidate`, then written right after the shell.\n * Its loader entry in `boundaryLoaders` needs `revalidate`.\n */"
15475
+ "doc": "/**\n * Partial prerendering: a hole that is the same for every visitor, built like the shell\n * from a request-free context and cached on its own `revalidate`, then written right after the shell.\n * Its loader entry in `boundaryLoaders` needs `revalidate`.\n */"
15241
15476
  },
15242
15477
  {
15243
15478
  "name": "SharedHoleCtx",
15244
15479
  "kind": "interface",
15245
15480
  "package": "@nifrajs/web",
15246
15481
  "signature": "export interface SharedHoleCtx extends ShellCtx {\n readonly live: (...keys: string[]) => void;\n}",
15247
- "doc": "/**\n * Experimental: what a shared hole's loader receives. The keys it declares are kept with the built\n * entry and watched for every visitor it serves; a change reloads the hole, which the shared entry\n * answers until a purge by one of its `revalidateTags` drops it, so publish each key with a tag.\n */"
15482
+ "doc": "/**\n * What a shared hole's loader receives. The keys it declares are kept with the built\n * entry and watched for every visitor it serves; a change reloads the hole, which the shared entry\n * answers until a purge by one of its `revalidateTags` drops it, so publish each key with a tag.\n */"
15248
15483
  },
15249
15484
  {
15250
15485
  "name": "SharedKey",
@@ -15297,7 +15532,7 @@
15297
15532
  "kind": "interface",
15298
15533
  "package": "@nifrajs/web",
15299
15534
  "signature": "export interface ShellCtx {\n /** `\"shell\"`: built on demand at runtime, under the same rules as a build. */\n readonly phase: \"build\" | \"shell\";\n /** The deployment's origin from config, never from a Host header. */\n readonly origin?: string;\n /** Decoded params, as the route pattern matched them. */\n readonly params: Readonly<Record<string, string>>;\n readonly locale: string | undefined;\n /** The route's declared `shellVariations` this request selected: declared keys and values only. */\n readonly variations: Readonly<Record<string, string>>;\n /** Aborts on the shell build deadline, never on one visitor's disconnect. */\n readonly signal: AbortSignal;\n /** The in-process api, unbound to any request: build-safe calls only, as in a prerender. */\n readonly api: unknown;\n}",
15300
- "doc": "/**\n * Experimental: what a partially prerendered page's `shellLoader` receives. No request, env, draft or\n * search: the shell is shared by every visitor whose URL maps to the same params and locale.\n */"
15535
+ "doc": "/**\n * What a partially prerendered page's `shellLoader` receives. No request, env, draft or\n * search: the shell is shared by every visitor whose URL maps to the same params and locale.\n */"
15301
15536
  },
15302
15537
  {
15303
15538
  "name": "ShouldRevalidate",
@@ -15729,6 +15964,71 @@
15729
15964
  "signature": "export interface StaticCtx {\n readonly phase: \"build\";\n /** The deployment's origin, when the caller resolving static boundaries knows it. A request never\n * supplies it: the value is cached for every visitor, and a Host header is the client's to choose. */\n readonly origin?: string;\n}",
15730
15965
  "doc": "/** Build-safe inputs available to a static boundary. It intentionally has no request/session/params API. */"
15731
15966
  },
15967
+ {
15968
+ "name": "StaticFileAccess",
15969
+ "kind": "interface",
15970
+ "package": "@nifrajs/core",
15971
+ "signature": "export interface StaticFileAccess {\n /** The real path the file was opened at: what tags and types it. */\n readonly path: string;\n readonly version: FileVersion;\n /** Read the whole file, up to {@link CONTENT_SNAPSHOT_MAX} bytes, through the open descriptor. */\n readonly readWhole: () => Promise<Uint8Array>;\n /** Stat the open descriptor again. */\n readonly restat: () => Promise<FileVersion>;\n readonly tags: ContentTags;\n /** `@nifrajs/core/range`'s parser, passed in so this module imports nothing. */\n readonly parseRange: (value: string, size: number) => {\n readonly kind: \"none\" | \"unsatisfiable\";\n } | {\n readonly kind: \"satisfiable\";\n readonly ranges: readonly {\n readonly start: number;\n readonly end: number;\n }[];\n };\n}",
15972
+ "doc": "/** How a reader reaches the opened, pinned file for {@link planStatic}. */"
15973
+ },
15974
+ {
15975
+ "name": "StaticImageComponentProps",
15976
+ "kind": "type",
15977
+ "package": "@nifrajs/web-preact",
15978
+ "signature": "export type StaticImageComponentProps = StaticImageProps & Omit<ImageComponentProps, \"src\" | \"width\" | \"height\">;"
15979
+ },
15980
+ {
15981
+ "name": "StaticImageComponentProps",
15982
+ "kind": "type",
15983
+ "package": "@nifrajs/web-react",
15984
+ "signature": "export type StaticImageComponentProps = StaticImageProps & Omit<ImageComponentProps, \"src\" | \"width\" | \"height\">;"
15985
+ },
15986
+ {
15987
+ "name": "StaticImageComponentProps",
15988
+ "kind": "type",
15989
+ "package": "@nifrajs/web-solid",
15990
+ "signature": "export type StaticImageComponentProps = StaticImageProps & Omit<ImageComponentProps, \"src\" | \"width\" | \"height\">;"
15991
+ },
15992
+ {
15993
+ "name": "StaticImageComponentProps",
15994
+ "kind": "type",
15995
+ "package": "@nifrajs/web-svelte",
15996
+ "signature": "export type StaticImageComponentProps = StaticImageProps &\n Omit<ImageComponentProps, \"src\" | \"width\" | \"height\">"
15997
+ },
15998
+ {
15999
+ "name": "StaticImageData",
16000
+ "kind": "interface",
16001
+ "package": "@nifrajs/image",
16002
+ "signature": "export interface StaticImageData {\n readonly src: string;\n readonly width: number;\n readonly height: number;\n readonly variants?: readonly StaticImageVariant[];\n}",
16003
+ "doc": "/** Intrinsic display dimensions (including EXIF orientation), plus optional prebuilt variants. */"
16004
+ },
16005
+ {
16006
+ "name": "StaticImageProps",
16007
+ "kind": "interface",
16008
+ "package": "@nifrajs/image",
16009
+ "signature": "export interface StaticImageProps extends ImagePresentationProps {\n readonly src: StaticImageData;\n readonly width?: number;\n readonly height?: number;\n}"
16010
+ },
16011
+ {
16012
+ "name": "StaticImageVariant",
16013
+ "kind": "interface",
16014
+ "package": "@nifrajs/image",
16015
+ "signature": "export interface StaticImageVariant {\n readonly src: string;\n readonly width: number;\n readonly height: number;\n}",
16016
+ "doc": "/** Browser-safe output of an `?image` import. No filesystem or codec enters the client. */"
16017
+ },
16018
+ {
16019
+ "name": "StaticMatch",
16020
+ "kind": "type",
16021
+ "package": "@nifrajs/core",
16022
+ "signature": "export type StaticMatch = \"pass\" | {\n readonly status: 400 | 403 | 404;\n} | {\n readonly rel: string;\n readonly immutable: boolean;\n};",
16023
+ "doc": "/**\n * What a mount does with a request path: `\"pass\"` to the next mount and then the app, a status to\n * answer with, or the decoded path relative to the mount's directory (no leading slash, no `.` or `..`\n * segment, no backslash or NUL) to read.\n */"
16024
+ },
16025
+ {
16026
+ "name": "StaticMount",
16027
+ "kind": "interface",
16028
+ "package": "@nifrajs/core",
16029
+ "signature": "export interface StaticMount {\n readonly root: string;\n /** `\"/\"`, or the prefix with one leading and no trailing slash. */\n readonly prefix: string;\n readonly isImmutable: (path: string) => boolean;\n readonly cacheControl: string | undefined;\n readonly files: ReadonlySet<string> | undefined;\n readonly allow: ((host: string, pathname: string) => boolean) | undefined;\n /** Lowercased names. */\n readonly headers: Readonly<Record<string, string>> | undefined;\n readonly denyDotfiles: boolean;\n readonly fallthrough: boolean;\n}",
16030
+ "doc": "/** A {@link ServeStaticOptions} checked once, with its directory resolved by the runtime's reader. */"
16031
+ },
15732
16032
  {
15733
16033
  "name": "StaticPath",
15734
16034
  "kind": "interface",
@@ -15743,6 +16043,20 @@
15743
16043
  "signature": "export interface StaticPaths {\n readonly paths: readonly StaticPath[];\n /**\n * How a path NOT in `paths` is handled. `\"ssr\"` (default) → rendered on-demand by the worker\n * (the natural hybrid behavior - an unlisted path simply isn't a static file); `\"404\"` → only the\n * listed paths exist. Recorded by `prerenderRoutes` for the deploy layer.\n */\n readonly fallback?: \"ssr\" | \"404\";\n}",
15744
16044
  "doc": "/** What a route's `getStaticPaths` returns: the param sets to prerender + the unlisted-path policy. */"
15745
16045
  },
16046
+ {
16047
+ "name": "StaticPlan",
16048
+ "kind": "type",
16049
+ "package": "@nifrajs/core",
16050
+ "signature": "export type StaticPlan = {\n readonly status: 200 | 206 | 304 | 416;\n readonly headers: Record<string, string>;\n readonly body: false;\n} | {\n readonly status: 200 | 206;\n readonly headers: Record<string, string>;\n readonly body: true;\n readonly start: number;\n readonly length: number;\n};",
16051
+ "doc": "/**\n * What a reader sends for a file a mount took: a header-only answer, or `length` bytes from `start`.\n * When tagging it called `readWhole`, the body comes from those same bytes.\n */"
16052
+ },
16053
+ {
16054
+ "name": "StaticRequest",
16055
+ "kind": "interface",
16056
+ "package": "@nifrajs/core",
16057
+ "signature": "export interface StaticRequest {\n readonly method: \"GET\" | \"HEAD\";\n readonly header: (name: string) => string | null;\n}",
16058
+ "doc": "/** A request's part of a static answer: its method and its headers by lowercase name. */"
16059
+ },
15746
16060
  {
15747
16061
  "name": "StaticRoutes",
15748
16062
  "kind": "interface",
@@ -16757,8 +17071,8 @@
16757
17071
  "name": "UnlocalizedPath",
16758
17072
  "kind": "interface",
16759
17073
  "package": "@nifrajs/i18n",
16760
- "signature": "export interface UnlocalizedPath<K extends string = string> {\n /** The served locale the leading segment named, or `undefined` for an unprefixed path. */\n readonly locale: K | undefined;\n /** The path without the locale segment, always starting with `/`. */\n readonly pathname: string;\n}",
16761
- "doc": "/** A pathname with its locale prefix removed (or not, when it carries none). */"
17074
+ "signature": "export interface UnlocalizedPath<K extends string = string> {\n /** The served locale the leading segment named, or `undefined` for an unprefixed path. */\n readonly locale: K | undefined;\n /** The canonical unprefixed path, always starting with `/`; mapped Unicode is URL-encoded. */\n readonly pathname: string;\n}",
17075
+ "doc": "/** A canonical pathname with its locale prefix removed (or not, when it carries none). */"
16762
17076
  },
16763
17077
  {
16764
17078
  "name": "UnsafeScriptDescriptor",
@@ -16799,6 +17113,13 @@
16799
17113
  "signature": "export interface UseCapabilityOptions {\n /** Adapter/resource token recorded on the ledger entry (`repo:orders`). */\n readonly target?: string;\n /** Dimensionless resource counters recorded on the ledger entry. */\n readonly cost?: EffectCost;\n /** Keyed payload digest (see `computeEffectDigest`). */\n readonly digest?: string;\n}",
16800
17114
  "doc": "/**\n * Optional effect-ledger fields for one `useCapability` beacon. Token-only by design: an adapter\n * names *what* it touched and *how much resource* it used - never the value it read or wrote.\n */"
16801
17115
  },
17116
+ {
17117
+ "name": "UseInfiniteQueryOptions",
17118
+ "kind": "interface",
17119
+ "package": "@nifrajs/web-preact",
17120
+ "signature": "export interface UseInfiniteQueryOptions<T, P> extends InfiniteQueryOptions<T, P> {\n readonly enabled?: boolean;\n}",
17121
+ "doc": "/** Options for an infinite query. */"
17122
+ },
16802
17123
  {
16803
17124
  "name": "UseInfiniteQueryOptions",
16804
17125
  "kind": "interface",
@@ -16806,6 +17127,27 @@
16806
17127
  "signature": "export interface UseInfiniteQueryOptions<T, P> extends InfiniteQueryOptions<T, P> {\n readonly enabled?: boolean;\n}",
16807
17128
  "doc": "/** Options for {@link useInfiniteQuery} - the engine's {@link InfiniteQueryOptions} plus `enabled`. */"
16808
17129
  },
17130
+ {
17131
+ "name": "UseInfiniteQueryOptions",
17132
+ "kind": "interface",
17133
+ "package": "@nifrajs/web-svelte",
17134
+ "signature": "export interface UseInfiniteQueryOptions<T, P> extends InfiniteQueryOptions<T, P> {\n readonly enabled?: boolean;\n}",
17135
+ "doc": "/** Options for a Svelte infinite query. */"
17136
+ },
17137
+ {
17138
+ "name": "UseInfiniteQueryOptions",
17139
+ "kind": "interface",
17140
+ "package": "@nifrajs/web-vue",
17141
+ "signature": "export interface UseInfiniteQueryOptions<T, P> extends InfiniteQueryOptions<T, P> {\n readonly enabled?: boolean;\n}",
17142
+ "doc": "/** Options for a Vue infinite query. */"
17143
+ },
17144
+ {
17145
+ "name": "UseInfiniteQueryResult",
17146
+ "kind": "interface",
17147
+ "package": "@nifrajs/web-preact",
17148
+ "signature": "export interface UseInfiniteQueryResult<T, P> extends QueryState<InfiniteData<T, P>> {\n readonly isPending: boolean;\n readonly isError: boolean;\n readonly isSuccess: boolean;\n readonly fetchNextPage: () => Promise<InfiniteData<T, P>>;\n readonly fetchPreviousPage: () => Promise<InfiniteData<T, P>>;\n readonly hasNextPage: boolean;\n readonly hasPreviousPage: boolean;\n readonly refetch: () => Promise<InfiniteData<T, P>>;\n}",
17149
+ "doc": "/** Infinite-query state and page controls. */"
17150
+ },
16809
17151
  {
16810
17152
  "name": "UseInfiniteQueryResult",
16811
17153
  "kind": "interface",
@@ -16813,13 +17155,34 @@
16813
17155
  "signature": "export interface UseInfiniteQueryResult<T, P> extends QueryState<InfiniteData<T, P>> {\n readonly isPending: boolean;\n readonly isError: boolean;\n readonly isSuccess: boolean;\n readonly fetchNextPage: () => Promise<InfiniteData<T, P>>;\n readonly fetchPreviousPage: () => Promise<InfiniteData<T, P>>;\n readonly hasNextPage: boolean;\n readonly hasPreviousPage: boolean;\n readonly refetch: () => Promise<InfiniteData<T, P>>;\n}",
16814
17156
  "doc": "/** An infinite query's reactive state + paging controls. */"
16815
17157
  },
17158
+ {
17159
+ "name": "UseInfiniteQueryResult",
17160
+ "kind": "interface",
17161
+ "package": "@nifrajs/web-vue",
17162
+ "signature": "export interface UseInfiniteQueryResult<T, P> {\n readonly state: Readonly<ShallowRef<QueryState<InfiniteData<T, P>>>>;\n readonly isPending: ComputedRef<boolean>;\n readonly isError: ComputedRef<boolean>;\n readonly isSuccess: ComputedRef<boolean>;\n readonly hasNextPage: ComputedRef<boolean>;\n readonly hasPreviousPage: ComputedRef<boolean>;\n readonly fetchNextPage: () => Promise<InfiniteData<T, P>>;\n readonly fetchPreviousPage: () => Promise<InfiniteData<T, P>>;\n readonly refetch: () => Promise<InfiniteData<T, P>>;\n}",
17163
+ "doc": "/** Infinite-query state and page controls as Vue refs/computed values. */"
17164
+ },
17165
+ {
17166
+ "name": "UseMutationResult",
17167
+ "kind": "interface",
17168
+ "package": "@nifrajs/web-preact",
17169
+ "signature": "export interface UseMutationResult<TData, TVariables> extends MutationState<TData, TVariables> {\n readonly isIdle: boolean;\n readonly isPending: boolean;\n readonly isError: boolean;\n readonly isSuccess: boolean;\n readonly mutate: (variables: TVariables) => void;\n readonly mutateAsync: (variables: TVariables) => Promise<TData>;\n readonly reset: () => void;\n readonly cancel: () => void;\n}",
17170
+ "doc": "/** Observable mutation state and imperative controls. */"
17171
+ },
16816
17172
  {
16817
17173
  "name": "UseMutationResult",
16818
17174
  "kind": "interface",
16819
17175
  "package": "@nifrajs/web-react",
16820
- "signature": "export interface UseMutationResult<TData, TVariables> extends MutationState<TData, TVariables> {\n readonly isIdle: boolean;\n readonly isPending: boolean;\n readonly isError: boolean;\n readonly isSuccess: boolean;\n /** Fire-and-forget: runs the mutation and swallows rejection (read `error`/`isError` for failures). */\n readonly mutate: (variables: TVariables) => void;\n /** Run the mutation and return the promise (rejects on failure) - for `await`. */\n readonly mutateAsync: (variables: TVariables) => Promise<TData>;\n /** Reset back to idle. */\n readonly reset: () => void;\n}",
17176
+ "signature": "export interface UseMutationResult<TData, TVariables> extends MutationState<TData, TVariables> {\n readonly isIdle: boolean;\n readonly isPending: boolean;\n readonly isError: boolean;\n readonly isSuccess: boolean;\n /** Fire-and-forget: runs the mutation and swallows rejection (read `error`/`isError` for failures). */\n readonly mutate: (variables: TVariables) => void;\n /** Run the mutation and return the promise (rejects on failure) - for `await`. */\n readonly mutateAsync: (variables: TVariables) => Promise<TData>;\n /** Reset back to idle. */\n readonly reset: () => void;\n /** Cancel pending mutation work. */\n readonly cancel: () => void;\n}",
16821
17177
  "doc": "/** A mutation's reactive state + imperative controls (the TanStack `useMutation` shape). */"
16822
17178
  },
17179
+ {
17180
+ "name": "UseMutationResult",
17181
+ "kind": "interface",
17182
+ "package": "@nifrajs/web-vue",
17183
+ "signature": "export interface UseMutationResult<TData, TVariables> {\n readonly state: Readonly<ShallowRef<MutationState<TData, TVariables>>>;\n readonly isIdle: ComputedRef<boolean>;\n readonly isPending: ComputedRef<boolean>;\n readonly isError: ComputedRef<boolean>;\n readonly isSuccess: ComputedRef<boolean>;\n readonly mutate: (variables: TVariables) => void;\n readonly mutateAsync: (variables: TVariables) => Promise<TData>;\n readonly reset: () => void;\n readonly cancel: () => void;\n}",
17184
+ "doc": "/** A Vue mutation result with reactive state and promise/fire-and-forget controls. */"
17185
+ },
16823
17186
  {
16824
17187
  "name": "UseQueryOptions",
16825
17188
  "kind": "interface",
@@ -16852,14 +17215,14 @@
16852
17215
  "name": "VERSION",
16853
17216
  "kind": "const",
16854
17217
  "package": "@nifrajs/core",
16855
- "signature": "export declare const VERSION: \"5.8.0\";",
17218
+ "signature": "export declare const VERSION: \"5.10.0\";",
16856
17219
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
16857
17220
  },
16858
17221
  {
16859
17222
  "name": "VERSION",
16860
17223
  "kind": "const",
16861
17224
  "package": "nifra",
16862
- "signature": "export declare const VERSION: \"5.8.0\";",
17225
+ "signature": "export declare const VERSION: \"5.10.0\";",
16863
17226
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
16864
17227
  },
16865
17228
  {
@@ -16905,6 +17268,13 @@
16905
17268
  "package": "@nifrajs/web",
16906
17269
  "signature": "export type VercelOptions = ({\n /** `invalidateByTag` from `@vercel/functions`: inside a Vercel Function, no token needed. */\n readonly invalidateByTag: TagPurge;\n /** `dangerouslyDeleteByTag` from `@vercel/functions`, for `mode: \"delete\"`. */\n readonly dangerouslyDeleteByTag?: TagPurge;\n} | {\n /** A Vercel access token for the REST API. Keep it in an env var. */\n readonly token: string;\n readonly projectId: string;\n readonly teamId?: string;\n /** Purge one environment only; default both. */\n readonly target?: \"production\" | \"preview\";\n /** The fetch purge calls go through; tests pass their own. */\n readonly fetch?: typeof fetch;\n}) & {\n /**\n * `invalidate` (default) marks tagged pages stale: the next visitor gets the old page while Vercel\n * refetches. `delete` drops them, so the next visitors wait on the origin together.\n */\n readonly mode?: \"invalidate\" | \"delete\";\n readonly queue?: PurgeQueueOptions;\n};"
16907
17270
  },
17271
+ {
17272
+ "name": "VercelRuntime",
17273
+ "kind": "type",
17274
+ "package": "@nifrajs/web",
17275
+ "signature": "export type VercelRuntime = \"edge\" | \"node\";",
17276
+ "doc": "/** Ordinary Vercel SSR uses Edge unless Node is explicitly selected. */"
17277
+ },
16908
17278
  {
16909
17279
  "name": "VerificationCompletedView",
16910
17280
  "kind": "interface",
@@ -17442,6 +17812,13 @@
17442
17812
  "signature": "export declare function applyHead(head: Meta, path?: string): void;",
17443
17813
  "doc": "/**\n * Sync the document head to a route's resolved {@link Meta} on client navigation. Sets the title\n * (when provided) and replaces the **managed** (`data-nifra`) `<meta>`/`<link>` tags - static head\n * content (charset, hand-written tags) is never touched. SSR injects the same `data-nifra` tags, so\n * the first navigation cleanly takes over from the server-rendered head.\n */"
17444
17814
  },
17815
+ {
17816
+ "name": "applyInvariantSetup",
17817
+ "kind": "function",
17818
+ "package": "@nifrajs/core",
17819
+ "signature": "export declare function applyInvariantSetup(invariants: InvariantsConfig, result: InvariantSetupResult | undefined): AppliedInvariantSetup;",
17820
+ "doc": "/**\n * Merge what `invariants.setup` returned over the static `invariants`, validating it the way\n * `defineAssuranceConfig` validates the static fields: its executor and prepareRequest replace the\n * static ones, and its witnesses are merged over theirs, a key in both taking the setup's. For a\n * harness that runs L4 itself; `nifra levels` calls it once setup resolves.\n */"
17821
+ },
17445
17822
  {
17446
17823
  "name": "applyResponseHeaders",
17447
17824
  "kind": "function",
@@ -17838,6 +18215,13 @@
17838
18215
  "signature": "export declare function browserDenial(classification: Classification, specifier?: string): string | undefined;",
17839
18216
  "doc": "/**\n * Why a classified file may not ship to a browser, or `undefined` when it may. A `drizzle-orm` driver\n * entry is recognized by the import as written (`specifier`) or by the file's path in the package.\n */"
17840
18217
  },
18218
+ {
18219
+ "name": "browserPathSegment",
18220
+ "kind": "function",
18221
+ "package": "@nifrajs/core",
18222
+ "signature": "export declare function browserPathSegment(value: string): string;",
18223
+ "doc": "/**\n * `value` as a browser spells it in a request URL: {@link encodePathSegment} with `; [ ] |` left as\n * written. Used for one thing, registering a public file under the spelling its page links request;\n * it differs from the canonical form on those four characters only.\n */"
18224
+ },
17841
18225
  {
17842
18226
  "name": "buildAssetPaths",
17843
18227
  "kind": "function",
@@ -18055,7 +18439,14 @@
18055
18439
  "kind": "function",
18056
18440
  "package": "@nifrajs/coding-agent",
18057
18441
  "signature": "export declare function canonicalJson(value: unknown): string;",
18058
- "doc": "/** Deterministic JSON with recursively sorted object keys. Arrays keep order. Rejects non-finite numbers. */"
18442
+ "doc": "/** The canonical JSON text of `value`. Throws a `TypeError` on a value JSON cannot carry. */"
18443
+ },
18444
+ {
18445
+ "name": "canonicalJson",
18446
+ "kind": "function",
18447
+ "package": "@nifrajs/core",
18448
+ "signature": "export declare function canonicalJson(value: unknown): string;",
18449
+ "doc": "/** The canonical JSON text of `value`. Throws a `TypeError` on a value JSON cannot carry. */"
18059
18450
  },
18060
18451
  {
18061
18452
  "name": "canonicalManifest",
@@ -18106,6 +18497,20 @@
18106
18497
  "signature": "export declare function captureInto(feed: DevFeed): () => void;",
18107
18498
  "doc": "/**\n * Record the process's console and stream output into `feed`: every line as a log entry, and core's\n * `unhandled request error` line additionally as an `api` error with a full Diagnostic. The one sink\n * both dev servers and `nifra_run` use. Returns the detach function.\n */"
18108
18499
  },
18500
+ {
18501
+ "name": "carryRequestLocals",
18502
+ "kind": "function",
18503
+ "package": "@nifrajs/core",
18504
+ "signature": "export declare function carryRequestLocals(from: Request, to: Request): void;",
18505
+ "doc": "/**\n * Join `to` to `from`'s request-local scope: each then reads every value set through either, now\n * and later. nifra does this wherever it rebuilds a request itself; call it where a wrapper or an\n * `onRequest` hook rebuilds one, right after `new Request(url, req)`. A value `to` already holds is\n * kept where `from` has none.\n */"
18506
+ },
18507
+ {
18508
+ "name": "carryRequestLocals",
18509
+ "kind": "function",
18510
+ "package": "nifra",
18511
+ "signature": "export declare function carryRequestLocals(from: Request, to: Request): void;",
18512
+ "doc": "/**\n * Join `to` to `from`'s request-local scope: each then reads every value set through either, now\n * and later. nifra does this wherever it rebuilds a request itself; call it where a wrapper or an\n * `onRequest` hook rebuilds one, right after `new Request(url, req)`. A value `to` already holds is\n * kept where `from` has none.\n */"
18513
+ },
18109
18514
  {
18110
18515
  "name": "catalogFixPrompts",
18111
18516
  "kind": "function",
@@ -18675,7 +19080,7 @@
18675
19080
  "kind": "function",
18676
19081
  "package": "@nifrajs/web",
18677
19082
  "signature": "export declare function copyPublicDir(from: string, to: string): Promise<string[]>;",
18678
- "doc": "/**\n * Copy `from` into `to`, returning the URL paths copied (sorted). Hidden entries other than\n * `.well-known` are skipped, as development never serves them: every target ships this list, and a\n * CDN-hosted one serves whatever was copied.\n *\n * Lives here, not beside `servePublicDir`, because it is BUILD-time: it reaches for `Bun.Glob` and\n * `node:fs`, and `public-dir.ts` is reachable from the client bundle graph through the package\n * entry - a dynamic `import(\"bun\")` there fails the browser build outright.\n */"
19083
+ "doc": "/**\n * Copy `from` into `to`, returning the URL paths copied (sorted). Hidden entries other than\n * `.well-known` are skipped, as development never serves them: every target ships this list, and a\n * CDN-hosted one serves whatever was copied.\n *\n * Lives here, not in `public-dir.ts`, because it is BUILD-time: it reaches for `Bun.Glob` and\n * `node:fs`, and `public-dir.ts` is reachable from the client bundle graph through the package\n * entry - a dynamic `import(\"bun\")` there fails the browser build outright.\n */"
18679
19084
  },
18680
19085
  {
18681
19086
  "name": "copyRef",
@@ -18903,6 +19308,13 @@
18903
19308
  "signature": "export declare function createHostPolicy(options: HostPolicyOptions): HostPolicy;",
18904
19309
  "doc": "/**\n * Declare which pages and files each host serves. Hand the result to `createWebApp({ hostPolicy })`\n * (or export it as `hostPolicy` from the framework module, which `nifra build`'s server entry reads):\n * it is evaluated before the build's static files, the prerendered pages, the mounts and every page.\n * On Vercel the CDN answers the build's files before the function runs, so there it covers the rest.\n * A hand-written entry calls `check(request, buildAssets)` first, before its own static handler.\n *\n * ```ts\n * export const hostPolicy = createHostPolicy({\n * rules: [{\n * hosts: (host) => !OWN_HOSTS.has(host),\n * pages: [\"/\", \"/p/:id\", \"/share/*\"],\n * paths: [\"/api/submissions/*\"],\n * }],\n * })\n * ```\n */"
18905
19310
  },
19311
+ {
19312
+ "name": "createImageAssets",
19313
+ "kind": "function",
19314
+ "package": "@nifrajs/image",
19315
+ "signature": "export declare function createImageAssets(options?: ImageBuildOptions): ImageAssets;",
19316
+ "doc": "/** Shared builder for client/SSR imports. Processing results depend on bytes, never absolute paths. */"
19317
+ },
18906
19318
  {
18907
19319
  "name": "createImageHandler",
18908
19320
  "kind": "function",
@@ -18910,6 +19322,13 @@
18910
19322
  "signature": "export declare function createImageHandler(options?: ImageHandlerOptions): (req: Request) => Promise<Response>;",
18911
19323
  "doc": "/**\n * Build the resize request handler. Mount its return value at the `selfHostedLoader` endpoint:\n *\n * ```ts\n * const image = createImageHandler({ root: \"./public\", allowedOrigins: [\"https://cdn.example\"] })\n * // inside your router: if (url.pathname === \"/_image\") return image(req)\n * ```\n */"
18912
19324
  },
19325
+ {
19326
+ "name": "createInfiniteQuery",
19327
+ "kind": "function",
19328
+ "package": "@nifrajs/web-solid",
19329
+ "signature": "export declare function createInfiniteQuery<T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: CreateInfiniteQueryOptions<T, P>): CreateInfiniteQueryResult<T, P>;",
19330
+ "doc": "/** Bind a paged query to a Solid owner and fetch its first page on mount. */"
19331
+ },
18913
19332
  {
18914
19333
  "name": "createInvalidator",
18915
19334
  "kind": "function",
@@ -19015,9 +19434,16 @@
19015
19434
  "name": "createMutation",
19016
19435
  "kind": "function",
19017
19436
  "package": "@nifrajs/web",
19018
- "signature": "export declare function createMutation<TData, TVariables>(fn: (variables: TVariables) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): MutationHandle<TData, TVariables>;",
19437
+ "signature": "export declare function createMutation<TData, TVariables>(fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): MutationHandle<TData, TVariables>;",
19019
19438
  "doc": "/**\n * Create a standalone mutation state machine - framework-agnostic, so a per-adapter `useMutation`\n * binding just subscribes to it. Single-flight by a monotonic token: overlapping `mutate` calls each\n * run their `fn`, but only the latest publishes state (an older, slower response can't clobber a newer\n * one). The callbacks fire in TanStack order: `onMutate` (before), then `onSuccess`/`onError`, then\n * `onSettled`.\n */"
19020
19439
  },
19440
+ {
19441
+ "name": "createMutation",
19442
+ "kind": "function",
19443
+ "package": "@nifrajs/web-solid",
19444
+ "signature": "export declare function createMutation<TData, TVariables = void>(fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): CreateMutationResult<TData, TVariables>;",
19445
+ "doc": "/** Bind a mutation to a Solid owner. Identity changes discard late results and callbacks. */"
19446
+ },
19021
19447
  {
19022
19448
  "name": "createNativeGatewayModelPort",
19023
19449
  "kind": "function",
@@ -19185,7 +19611,7 @@
19185
19611
  "name": "createSessions",
19186
19612
  "kind": "function",
19187
19613
  "package": "@nifrajs/auth",
19188
- "signature": "export declare function createSessions<Data extends Record<string, unknown> = Record<string, unknown>>(options: SessionOptions): SessionManager<Data>;"
19614
+ "signature": "export declare function createSessions<Data extends Record<string, unknown> = Record<string, unknown>>(options: SessionOptions<Data>): SessionManager<Data>;"
19189
19615
  },
19190
19616
  {
19191
19617
  "name": "createSlotParking",
@@ -19386,6 +19812,13 @@
19386
19812
  "signature": "export declare function decodeCursor<T = unknown>(cursor: string | null | undefined): T | undefined;",
19387
19813
  "doc": "/** Decode a cursor back to its value. Returns `undefined` for a null/empty/malformed cursor - treat that\n * as \"start from the beginning\" rather than erroring on a client-supplied string. */"
19388
19814
  },
19815
+ {
19816
+ "name": "decodePathSegment",
19817
+ "kind": "function",
19818
+ "package": "@nifrajs/core",
19819
+ "signature": "export declare function decodePathSegment(raw: string): string | undefined;",
19820
+ "doc": "/**\n * `raw` with its percent-escapes decoded, or `undefined` when one is malformed. The inverse of\n * {@link encodePathSegment} and of {@link browserPathSegment}; a segment in any other spelling decodes\n * too. What a malformed escape means is the caller's policy.\n */"
19821
+ },
19389
19822
  {
19390
19823
  "name": "decodeRouteParams",
19391
19824
  "kind": "function",
@@ -19897,7 +20330,7 @@
19897
20330
  "kind": "function",
19898
20331
  "package": "@nifrajs/cli",
19899
20332
  "signature": "export declare function docsTools(loadDocs: () => Promise<string | undefined>, loadExamples: () => Promise<Example[] | undefined>, loadTypes: () => Promise<TypeEntry[] | undefined>): McpTool[];",
19900
- "doc": "/** Build `nifra_docs` + `nifra_example` + `nifra_types` over injected corpus loaders. */"
20333
+ "doc": "/** Build the read-only docs, examples, types, learning, and frontend tools over injected loaders. */"
19901
20334
  },
19902
20335
  {
19903
20336
  "name": "durableCommand",
@@ -20002,6 +20435,13 @@
20002
20435
  "signature": "export declare function encodeCursor(value: unknown): string;",
20003
20436
  "doc": "/** Encode any JSON-serializable value (e.g. the last row's sort key) into an opaque cursor string. */"
20004
20437
  },
20438
+ {
20439
+ "name": "encodePathSegment",
20440
+ "kind": "function",
20441
+ "package": "@nifrajs/core",
20442
+ "signature": "export declare function encodePathSegment(value: string): string;",
20443
+ "doc": "/**\n * `value` as one path segment. Left as written: letters, digits, the at sign and `- . _ ~ ! $ & ' ( ) * + , : =`.\n * Everything else is percent-encoded, UTF-8 and upper-case hex, including `; [ ] | / ? # % \\`.\n *\n * Throws a `RangeError` for a value that no segment can carry: exactly `.` or `..` (a URL parser reads\n * `%2E` and `%2E%2E` as dot segments too) and a lone surrogate (substituting U+FFFD would map distinct\n * values to one URL). The empty string is returned as is; a caller that cannot use it checks for it.\n */"
20444
+ },
20005
20445
  {
20006
20446
  "name": "encodeTransportFrame",
20007
20447
  "kind": "function",
@@ -20239,6 +20679,13 @@
20239
20679
  "package": "@nifrajs/web",
20240
20680
  "signature": "export declare function filePathToPatterns(file: string): string[];"
20241
20681
  },
20682
+ {
20683
+ "name": "fillRoutePath",
20684
+ "kind": "function",
20685
+ "package": "@nifrajs/core",
20686
+ "signature": "export declare function fillRoutePath(pattern: string | CompiledRoutePattern, params: Readonly<Record<string, string | undefined>>): FilledRoutePath;",
20687
+ "doc": "/**\n * The path `pattern` names for `params`, every value spelled by {@link encodePathSegment}. A wildcard\n * value is split on `/` and each part encoded, empty parts dropped; a `.` or `..` part is invalid, as\n * a whole-segment value is. Nothing is thrown for a bad value: the caller decides what a missing or\n * invalid param means. A param inside a mixed segment is invalid when its value holds the literal that ends it (`name` = `a.b` in\n * `:name.:ext`), or when it touches the next param and encodes to more than one character, because the\n * router would split it differently. A param's constraint (`:id{[0-9]+}`) is not checked here.\n */"
20688
+ },
20242
20689
  {
20243
20690
  "name": "filterDevToolsEvents",
20244
20691
  "kind": "function",
@@ -20447,19 +20894,12 @@
20447
20894
  "signature": "export declare function generateRegressionTest(capsule: IncidentCapsule, options?: GenerateRegressionTestOptions): string;",
20448
20895
  "doc": "/**\n * Emit a committable regression test from a capsule. Body strings, query values, header values (bar\n * `content-type`) and the note are redacted BY DEFAULT with a sanitize banner - replace the\n * `<redacted>` placeholders with safe, reproducing values before you commit. The path is kept\n * verbatim because it selects the route, so the file always asks for it to be reviewed. The test\n * asserts the response contract via {@link assertIncidentReplays}.\n */"
20449
20896
  },
20450
- {
20451
- "name": "generateRouteSearchTypes",
20452
- "kind": "function",
20453
- "package": "@nifrajs/web",
20454
- "signature": "export declare function generateRouteSearchTypes(manifest: Manifest, options: GenerateRouteSearchTypesOptions): string;",
20455
- "doc": "/**\n * Codegen: emit a `.d.ts` that types cross-route `navigate({ to, search })` against each route's\n * `searchSchema`. It augments the {@link RouteSearch} map with `\"<pattern>\": SearchOf<typeof import(...)>`\n * for every **static** route (one with no `:param`/`*` segment - a concrete `to` a caller can pass; a\n * dynamic route's concrete path can't match its pattern key, so those keep the loose object form). Written\n * by `nifra sync-routes` next to the route tree and included in the app's `tsconfig`; because it is\n * regenerated from the route files, a `navigate` whose `search` no longer matches the route's schema\n * becomes a `tsc` error - the same drift guarantee as nifra's typed client, no hand-maintained map.\n */"
20456
- },
20457
20897
  {
20458
20898
  "name": "generateServerEntry",
20459
20899
  "kind": "function",
20460
20900
  "package": "@nifrajs/web",
20461
- "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options to import by name, each mapped to the specifier of the edge-safe module\n * that exports it. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n /** URL paths of the content-hashed client outputs (the build manifest's `assets`). When given, a\n * self-hosted entry caches only these immutably; otherwise every file under `/assets/` is. */\n readonly hashedFiles?: readonly string[];\n /** Trust the edge platform's client-address header for `c.clientIp`. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** The server manifest exports `copyChunks` (the client build split copy tables by locale). */\n readonly copyChunks?: boolean;\n /** `bun` / `node` only: the pages the build prerendered into `_prerendered/`, by request path, which\n * the app answers from their file (see `createWebApp`'s `prerenderedPages`). */\n readonly prerenderedPages?: Readonly<Record<string, ServerPrerenderedPage>>;\n}): string;",
20462
- "doc": "/**\n * Codegen the per-target **server entry** module (source text) for `buildServer` to bundle. It imports\n * the app's `adapter` (from `framework.ts`), the optional `backend` (from `backend.ts`), and the\n * generated `{ manifest, clientEntry }` (from `./server-manifest`), builds `createWebApp`, then wires\n * the right host:\n * - `cloudflare` / `vercel`: `export default` the fetch handler (the platform serves /assets/* itself).\n * - `deno`: same fetch-handler default, plus `Deno.serve` self-host when run directly.\n * - `bun` / `node`: a self-hosting server that ALSO serves the client bundle from disk (those\n * runtimes have a filesystem; the static `/assets/*` sit next to the entry).\n * `adapterImport`/`backendImport` are the specifiers the entry uses (relative to where it's written) -\n * `buildServer` writes the entry next to `serverEntry`, so they're resolved from there. Pure (string in,\n * string out) so the generation is unit-testable without a real build.\n */"
20901
+ "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Vercel-only runtime selection; Edge remains the default. */\n readonly vercelRuntime?: VercelRuntime;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options to import by name, each mapped to the specifier of the edge-safe module\n * that exports it. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n /** URL paths of the content-hashed client outputs (the build manifest's `assets`). When given, a\n * self-hosted entry caches only these immutably; otherwise every file under `/assets/` is. */\n readonly hashedFiles?: readonly string[];\n /** Trust the edge platform's client-address header for `c.clientIp`. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** How a self-hosted server stops and keeps idle connections. See {@link ServerEntrySelfHost}. */\n readonly selfHost?: ServerEntrySelfHost;\n /** The server manifest exports `copyChunks` (the client build split copy tables by locale). */\n readonly copyChunks?: boolean;\n /** `bun` / `node` only: the pages the build prerendered into `_prerendered/`, by request path, which\n * the app answers from their file (see `createWebApp`'s `prerenderedPages`). */\n readonly prerenderedPages?: Readonly<Record<string, ServerPrerenderedPage>>;\n}): string;",
20902
+ "doc": "/**\n * Codegen the per-target **server entry** module (source text) for `buildServer` to bundle. It imports\n * the app's `adapter` (from `framework.ts`), the optional `backend` (from `backend.ts`), and the\n * generated `{ manifest, clientEntry }` (from `./server-manifest`), builds `createWebApp`, then wires\n * the right host:\n * - `cloudflare` / `vercel`: `export default` the fetch handler (the platform serves /assets/* itself).\n * - `deno`: a `@nifrajs/deno` server that serves the client bundle with Deno's file API.\n * - `bun` / `node`: a self-hosting server that ALSO serves the client bundle from disk (those\n * runtimes have a filesystem; the static `/assets/*` sit next to the entry).\n * `adapterImport`/`backendImport` are the specifiers the entry uses (relative to where it's written) -\n * `buildServer` writes the entry next to `serverEntry`, so they're resolved from there. Pure (string in,\n * string out) so the generation is unit-testable without a real build.\n */"
20463
20903
  },
20464
20904
  {
20465
20905
  "name": "generateServerManifest",
@@ -20661,7 +21101,7 @@
20661
21101
  "kind": "function",
20662
21102
  "package": "@nifrajs/web",
20663
21103
  "signature": "export declare function holeComponents(client: ComponentClientAdapter | undefined): void;",
20664
- "doc": "/**\n * Experimental: how the client islands inside partially prerendered holes that show server\n * components mount, as the adapter's component client, such as `vueComponentClient({ islands })`;\n * `undefined` forgets it. Call it in the client entry before the router mounts. Without one such a\n * hole shows its error slot.\n */"
21104
+ "doc": "/**\n * How the client islands inside partially prerendered holes that show server\n * components mount, as the adapter's component client, such as `vueComponentClient({ islands })`;\n * `undefined` forgets it. Call it in the client entry before the router mounts. Without one such a\n * hole shows its error slot.\n */"
20665
21105
  },
20666
21106
  {
20667
21107
  "name": "hotUpdateNeedsReload",
@@ -20670,6 +21110,48 @@
20670
21110
  "signature": "export declare const hotUpdateNeedsReload = true;",
20671
21111
  "doc": "/**\n * Preact cannot apply Bun's hot updates, so the generated client entry reloads instead.\n *\n * Bun's dev server runs React Fast Refresh over JSX modules. A Preact component compiles to JSX that\n * looks the same, so the update is ACCEPTED - and then dropped, because Preact's refresh runtime\n * (prefresh) is not the one Bun installs. Measured: `bun:beforeUpdate` and `bun:afterUpdate` both fire,\n * the server logs the rebuild, the browser keeps rendering the old component and never reloads. The\n * edit simply appears not to happen.\n *\n * Reloading loses component state, which React keeps here. That is the honest trade until Bun's dev\n * server can install prefresh: a visible reload beats an edit that silently does nothing.\n */"
20672
21112
  },
21113
+ {
21114
+ "name": "href",
21115
+ "kind": "function",
21116
+ "package": "@nifrajs/web",
21117
+ "signature": "export declare function href<K extends Pattern>(options: HrefOptions<K>): Href<K>;",
21118
+ "doc": "/**\n * The in-app URL for a route: the pattern filled with `params` (each value encoded as one path\n * segment), then `search` serialized as the router reads it, then the `hash`. `to` is a key of the\n * generated route table, so a misspelt route, a missing or misspelt param and a `search` that breaks the\n * route's schema are compile errors; the result is an {@link Href}, the only thing `navigate` takes.\n *\n * ```ts\n * navigate(href({ to: \"/users/:id\", params: { id }, search: { tab: \"posts\" }, hash: \"top\" }))\n * ```\n *\n * A param that is missing, empty, or holds a value no path segment can carry (`.`, `..`, an unpaired\n * surrogate) throws a `TypeError` naming it, in production too: a link built from it would go\n * somewhere else. The result is a pure function of its input, so the server and the browser build the\n * same string. A link to a path built elsewhere is {@link rawHref}; one to another site is a plain `<a>`.\n */"
21119
+ },
21120
+ {
21121
+ "name": "href",
21122
+ "kind": "function",
21123
+ "package": "@nifrajs/web-preact",
21124
+ "signature": "export declare function href<K extends Pattern>(options: HrefOptions<K>): Href<K>;",
21125
+ "doc": "/**\n * The in-app URL for a route: the pattern filled with `params` (each value encoded as one path\n * segment), then `search` serialized as the router reads it, then the `hash`. `to` is a key of the\n * generated route table, so a misspelt route, a missing or misspelt param and a `search` that breaks the\n * route's schema are compile errors; the result is an {@link Href}, the only thing `navigate` takes.\n *\n * ```ts\n * navigate(href({ to: \"/users/:id\", params: { id }, search: { tab: \"posts\" }, hash: \"top\" }))\n * ```\n *\n * A param that is missing, empty, or holds a value no path segment can carry (`.`, `..`, an unpaired\n * surrogate) throws a `TypeError` naming it, in production too: a link built from it would go\n * somewhere else. The result is a pure function of its input, so the server and the browser build the\n * same string. A link to a path built elsewhere is {@link rawHref}; one to another site is a plain `<a>`.\n */"
21126
+ },
21127
+ {
21128
+ "name": "href",
21129
+ "kind": "function",
21130
+ "package": "@nifrajs/web-react",
21131
+ "signature": "export declare function href<K extends Pattern>(options: HrefOptions<K>): Href<K>;",
21132
+ "doc": "/**\n * The in-app URL for a route: the pattern filled with `params` (each value encoded as one path\n * segment), then `search` serialized as the router reads it, then the `hash`. `to` is a key of the\n * generated route table, so a misspelt route, a missing or misspelt param and a `search` that breaks the\n * route's schema are compile errors; the result is an {@link Href}, the only thing `navigate` takes.\n *\n * ```ts\n * navigate(href({ to: \"/users/:id\", params: { id }, search: { tab: \"posts\" }, hash: \"top\" }))\n * ```\n *\n * A param that is missing, empty, or holds a value no path segment can carry (`.`, `..`, an unpaired\n * surrogate) throws a `TypeError` naming it, in production too: a link built from it would go\n * somewhere else. The result is a pure function of its input, so the server and the browser build the\n * same string. A link to a path built elsewhere is {@link rawHref}; one to another site is a plain `<a>`.\n */"
21133
+ },
21134
+ {
21135
+ "name": "href",
21136
+ "kind": "function",
21137
+ "package": "@nifrajs/web-solid",
21138
+ "signature": "export declare function href<K extends Pattern>(options: HrefOptions<K>): Href<K>;",
21139
+ "doc": "/**\n * The in-app URL for a route: the pattern filled with `params` (each value encoded as one path\n * segment), then `search` serialized as the router reads it, then the `hash`. `to` is a key of the\n * generated route table, so a misspelt route, a missing or misspelt param and a `search` that breaks the\n * route's schema are compile errors; the result is an {@link Href}, the only thing `navigate` takes.\n *\n * ```ts\n * navigate(href({ to: \"/users/:id\", params: { id }, search: { tab: \"posts\" }, hash: \"top\" }))\n * ```\n *\n * A param that is missing, empty, or holds a value no path segment can carry (`.`, `..`, an unpaired\n * surrogate) throws a `TypeError` naming it, in production too: a link built from it would go\n * somewhere else. The result is a pure function of its input, so the server and the browser build the\n * same string. A link to a path built elsewhere is {@link rawHref}; one to another site is a plain `<a>`.\n */"
21140
+ },
21141
+ {
21142
+ "name": "href",
21143
+ "kind": "function",
21144
+ "package": "@nifrajs/web-svelte",
21145
+ "signature": "export declare function href<K extends Pattern>(options: HrefOptions<K>): Href<K>;",
21146
+ "doc": "/**\n * The in-app URL for a route: the pattern filled with `params` (each value encoded as one path\n * segment), then `search` serialized as the router reads it, then the `hash`. `to` is a key of the\n * generated route table, so a misspelt route, a missing or misspelt param and a `search` that breaks the\n * route's schema are compile errors; the result is an {@link Href}, the only thing `navigate` takes.\n *\n * ```ts\n * navigate(href({ to: \"/users/:id\", params: { id }, search: { tab: \"posts\" }, hash: \"top\" }))\n * ```\n *\n * A param that is missing, empty, or holds a value no path segment can carry (`.`, `..`, an unpaired\n * surrogate) throws a `TypeError` naming it, in production too: a link built from it would go\n * somewhere else. The result is a pure function of its input, so the server and the browser build the\n * same string. A link to a path built elsewhere is {@link rawHref}; one to another site is a plain `<a>`.\n */"
21147
+ },
21148
+ {
21149
+ "name": "href",
21150
+ "kind": "function",
21151
+ "package": "@nifrajs/web-vue",
21152
+ "signature": "export declare function href<K extends Pattern>(options: HrefOptions<K>): Href<K>;",
21153
+ "doc": "/**\n * The in-app URL for a route: the pattern filled with `params` (each value encoded as one path\n * segment), then `search` serialized as the router reads it, then the `hash`. `to` is a key of the\n * generated route table, so a misspelt route, a missing or misspelt param and a `search` that breaks the\n * route's schema are compile errors; the result is an {@link Href}, the only thing `navigate` takes.\n *\n * ```ts\n * navigate(href({ to: \"/users/:id\", params: { id }, search: { tab: \"posts\" }, hash: \"top\" }))\n * ```\n *\n * A param that is missing, empty, or holds a value no path segment can carry (`.`, `..`, an unpaired\n * surrogate) throws a `TypeError` naming it, in production too: a link built from it would go\n * somewhere else. The result is a pure function of its input, so the server and the browser build the\n * same string. A link to a path built elsewhere is {@link rawHref}; one to another site is a plain `<a>`.\n */"
21154
+ },
20673
21155
  {
20674
21156
  "name": "html",
20675
21157
  "kind": "function",
@@ -20785,6 +21267,13 @@
20785
21267
  "signature": "export declare function ifRangeAllowsPartial(ifRange: string | null, etag: string | undefined, lastModified: number | undefined): boolean;",
20786
21268
  "doc": "/**\n * Whether `If-Range` (the header, or `null`) lets a range request be answered partially; otherwise the\n * whole file is the conformant answer, not a fallback. An entity tag must equal the file's strong\n * `etag` (RFC 9110 section 13.1.5). A date must equal `lastModified` to the second, and counts only\n * for a file with no strong tag: a client holding the tag sends it, and a date cannot tell apart two\n * versions dated in the same second - here or on another instance - so resuming by one could splice\n * them.\n */"
20787
21269
  },
21270
+ {
21271
+ "name": "imageBunPlugin",
21272
+ "kind": "function",
21273
+ "package": "@nifrajs/image",
21274
+ "signature": "export declare function imageBunPlugin(options?: ImageBuildOptions): ImageBunPlugin;",
21275
+ "doc": "/** Install in both clientPlugins and serverPlugins; no codec is loaded unless explicitly supplied. */"
21276
+ },
20788
21277
  {
20789
21278
  "name": "imageDimensions",
20790
21279
  "kind": "function",
@@ -20792,6 +21281,13 @@
20792
21281
  "signature": "export declare function imageDimensions(bytes: Uint8Array): ImageInfo | null;",
20793
21282
  "doc": "/** Parse intrinsic dimensions + format from image header bytes, or `null` if unrecognized/too short. */"
20794
21283
  },
21284
+ {
21285
+ "name": "imageVitePlugin",
21286
+ "kind": "function",
21287
+ "package": "@nifrajs/image",
21288
+ "signature": "export declare function imageVitePlugin(options?: ImageBuildOptions): ImageVitePlugin;",
21289
+ "doc": "/** Use in vitePlugins for both development and production; the dev middleware serves hashed bytes. */"
21290
+ },
20795
21291
  {
20796
21292
  "name": "implement",
20797
21293
  "kind": "function",
@@ -21125,14 +21621,14 @@
21125
21621
  "kind": "function",
21126
21622
  "package": "@nifrajs/core",
21127
21623
  "signature": "export declare function isSameOriginPath(value: string): boolean;",
21128
- "doc": "/**\n * Is `value` a destination that stays on this origin?\n *\n * True only for an absolute path: one leading `/`, never `//` (protocol-relative → another origin),\n * and free of any character a URL parser turns into an origin escape. A leading `/` alone is not\n * enough: under a special scheme `\\` parses as `/`, and tab/CR/LF are STRIPPED before parsing, so\n * `/\\evil.example` and `/<TAB>/evil.example` both resolve to the external host `evil.example` while\n * passing a `//` test. Rejecting CR/LF here also keeps a validated destination out of the\n * response-splitting sink it usually flows into.\n *\n * One implementation, because every caller is the same open-redirect gate: `redirect()` in\n * `@nifrajs/web`, the `redirectTo` of the `@nifrajs/auth` and `@nifrajs/better-auth` guards. Three\n * copies of a security predicate is three chances for one of them to be hardened alone.\n *\n * It answers about a PATH, not a URL: an absolute `https://this.host/x` is false even for the\n * current origin, because the whole point is that the value never got to name a host.\n */"
21624
+ "doc": "/**\n * Is `value` a destination that stays on this origin?\n *\n * True only for an absolute path: one leading `/`, never `//` (protocol-relative → another origin),\n * and free of any character a URL parser turns into an origin escape. A leading `/` alone is not\n * enough: under a special scheme `\\` parses as `/`, and tab/CR/LF are STRIPPED before parsing, so\n * `/\\evil.example` and `/<TAB>/evil.example` both resolve to the external host `evil.example` while\n * passing a `//` test. Rejecting CR/LF here also keeps a validated destination out of the\n * response-splitting sink it usually flows into.\n *\n * One implementation, because every caller is the same open-redirect gate: `redirect()` and\n * `rawHref()` in `@nifrajs/web`, the `redirectTo` of the `@nifrajs/auth` and `@nifrajs/better-auth` guards. Three\n * copies of a security predicate is three chances for one of them to be hardened alone.\n *\n * It answers about a PATH, not a URL: an absolute `https://this.host/x` is false even for the\n * current origin, because the whole point is that the value never got to name a host.\n *\n * It sits in a leaf with no imports, so browser code (`rawHref` in `@nifrajs/web`) can use it without\n * the server entry; `@nifrajs/core/server` and `@nifrajs/core/pattern` both export it.\n */"
21129
21625
  },
21130
21626
  {
21131
21627
  "name": "isSameOriginPath",
21132
21628
  "kind": "function",
21133
21629
  "package": "nifra",
21134
21630
  "signature": "export declare function isSameOriginPath(value: string): boolean;",
21135
- "doc": "/**\n * Is `value` a destination that stays on this origin?\n *\n * True only for an absolute path: one leading `/`, never `//` (protocol-relative → another origin),\n * and free of any character a URL parser turns into an origin escape. A leading `/` alone is not\n * enough: under a special scheme `\\` parses as `/`, and tab/CR/LF are STRIPPED before parsing, so\n * `/\\evil.example` and `/<TAB>/evil.example` both resolve to the external host `evil.example` while\n * passing a `//` test. Rejecting CR/LF here also keeps a validated destination out of the\n * response-splitting sink it usually flows into.\n *\n * One implementation, because every caller is the same open-redirect gate: `redirect()` in\n * `@nifrajs/web`, the `redirectTo` of the `@nifrajs/auth` and `@nifrajs/better-auth` guards. Three\n * copies of a security predicate is three chances for one of them to be hardened alone.\n *\n * It answers about a PATH, not a URL: an absolute `https://this.host/x` is false even for the\n * current origin, because the whole point is that the value never got to name a host.\n */"
21631
+ "doc": "/**\n * Is `value` a destination that stays on this origin?\n *\n * True only for an absolute path: one leading `/`, never `//` (protocol-relative → another origin),\n * and free of any character a URL parser turns into an origin escape. A leading `/` alone is not\n * enough: under a special scheme `\\` parses as `/`, and tab/CR/LF are STRIPPED before parsing, so\n * `/\\evil.example` and `/<TAB>/evil.example` both resolve to the external host `evil.example` while\n * passing a `//` test. Rejecting CR/LF here also keeps a validated destination out of the\n * response-splitting sink it usually flows into.\n *\n * One implementation, because every caller is the same open-redirect gate: `redirect()` and\n * `rawHref()` in `@nifrajs/web`, the `redirectTo` of the `@nifrajs/auth` and `@nifrajs/better-auth` guards. Three\n * copies of a security predicate is three chances for one of them to be hardened alone.\n *\n * It answers about a PATH, not a URL: an absolute `https://this.host/x` is false even for the\n * current origin, because the whole point is that the value never got to name a host.\n *\n * It sits in a leaf with no imports, so browser code (`rawHref` in `@nifrajs/web`) can use it without\n * the server entry; `@nifrajs/core/server` and `@nifrajs/core/pattern` both export it.\n */"
21136
21632
  },
21137
21633
  {
21138
21634
  "name": "isSameOriginRequest",
@@ -21319,7 +21815,7 @@
21319
21815
  "kind": "function",
21320
21816
  "package": "@nifrajs/mcp-db",
21321
21817
  "signature": "export declare function lintPostgresStatement(sql: string): DbRefusal | undefined;",
21322
- "doc": "/** Refuse what the tokenizer layer refuses: a non-query, several statements, a denied function. */"
21818
+ "doc": "/**\n * Refuse what the tokenizer layer refuses before connecting: a non-query, several statements, a row\n * lock, text it cannot read safely. Functions are checked against the catalog once connected.\n */"
21323
21819
  },
21324
21820
  {
21325
21821
  "name": "listFixRecipes",
@@ -21458,6 +21954,13 @@
21458
21954
  "signature": "export declare function matchRoutePattern(compiled: CompiledRoutePattern, pathname: string): RoutePatternMatch;",
21459
21955
  "doc": "/** Match one compiled pattern and return decoded captures. The caller decides cross-pattern order. */"
21460
21956
  },
21957
+ {
21958
+ "name": "matchStatic",
21959
+ "kind": "function",
21960
+ "package": "@nifrajs/core",
21961
+ "signature": "export declare function matchStatic(mount: StaticMount, path: string, host: () => string): StaticMatch;",
21962
+ "doc": "/**\n * Match `path` (the URL path as sent, without the query) against `mount`, without touching the\n * filesystem. `host` names the request's host, read only when the mount has an `allow`.\n */"
21963
+ },
21461
21964
  {
21462
21965
  "name": "matches",
21463
21966
  "kind": "function",
@@ -22059,6 +22562,13 @@
22059
22562
  "signature": "export declare function parseAcceptHeader(value: string | null): readonly ContentPreference[];",
22060
22563
  "doc": "/** Parse an `Accept` header, preserving quality and wildcard specificity. */"
22061
22564
  },
22565
+ {
22566
+ "name": "parseAgentResume",
22567
+ "kind": "function",
22568
+ "package": "@nifrajs/agent",
22569
+ "signature": "export declare function parseAgentResume(raw: unknown): AgentTurnInput[\"resume\"] | undefined;",
22570
+ "doc": "/**\n * The `resume` of an {@link AgentTurnInput} read from an untrusted wire value, or `undefined` when it\n * is not one. Every agent transport parses a resume with this, so a continuation is accepted on the\n * same terms however it arrives.\n */"
22571
+ },
22062
22572
  {
22063
22573
  "name": "parseArtifactRef",
22064
22574
  "kind": "function",
@@ -22462,7 +22972,7 @@
22462
22972
  "kind": "function",
22463
22973
  "package": "@nifrajs/web",
22464
22974
  "signature": "export declare function partialPrerendering(config: PprConfig): PprSetup;",
22465
- "doc": "/**\n * Experimental: partial prerendering for `createWebApp({ experimental: { ppr } })`. Options are\n * checked here, at startup; each app the value is given to gets its own shell cache.\n */"
22975
+ "doc": "/**\n * Partial prerendering for `createWebApp({ ppr })`. Options are\n * checked here, at startup; each app the value is given to gets its own shell cache.\n */"
22466
22976
  },
22467
22977
  {
22468
22978
  "name": "pathTag",
@@ -22521,7 +23031,7 @@
22521
23031
  "name": "planBuildTarget",
22522
23032
  "kind": "function",
22523
23033
  "package": "@nifrajs/web",
22524
- "signature": "export declare function planBuildTarget(target: BuildTarget, outDir: string): BuildTargetPlan;",
23034
+ "signature": "export declare function planBuildTarget(target: BuildTarget, outDir: string, vercelRuntime?: VercelRuntime): BuildTargetPlan;",
22525
23035
  "doc": "/**\n * Resolve the target-specific deploy shape before any bundling starts. Keeping this decision pure\n * means Bun and Vite strategies share the same output filename, server target, and hand-off text;\n * the filesystem emitter only has to execute the plan.\n */"
22526
23036
  },
22527
23037
  {
@@ -22537,6 +23047,13 @@
22537
23047
  "signature": "export declare function planSingleCopy(options?: SingleCopyOptions): SingleCopyPlan;",
22538
23048
  "doc": "/**\n * Work out which foreign copies exist and which of them may be redirected.\n *\n * Pure discovery: it reads `package.json` files and symlink targets, never application source, and\n * never mutates anything. Both the plugin and `nifra check`'s verification are built on it, so the\n * enforcement and the report cannot drift apart.\n */"
22539
23049
  },
23050
+ {
23051
+ "name": "planStatic",
23052
+ "kind": "function",
23053
+ "package": "@nifrajs/core",
23054
+ "signature": "export declare function planStatic(mount: StaticMount, immutable: boolean, request: StaticRequest, file: StaticFileAccess): Promise<StaticPlan>;",
23055
+ "doc": "/**\n * The answer for an opened file, the one sequence every runtime's reader runs: the mount's headers\n * (a caller's own `cache-control`, `last-modified` or `etag` kept), a strong tag from the snapshot\n * served for a file up to {@link CONTENT_SNAPSHOT_MAX} bytes, a `304` for a current copy, then one\n * byte range or the whole file. A larger file streams with no tag, and its date is weak: an\n * `If-Range` gets the whole file rather than a range spliced from two versions.\n */"
23056
+ },
22540
23057
  {
22541
23058
  "name": "port",
22542
23059
  "kind": "function",
@@ -22577,7 +23094,7 @@
22577
23094
  "kind": "function",
22578
23095
  "package": "@nifrajs/mcp-db",
22579
23096
  "signature": "export declare function postgresRoleSql(client: PostgresClient, options: PostgresRoleSqlOptions): Promise<PostgresRoleSql | DbRefusal>;",
22580
- "doc": "/**\n * Write the SQL for a login role that can read the allowed schemas and nothing else: `GRANT SELECT`\n * per schema plus default privileges, and a `REVOKE` for each excluded table and its partitions.\n * `pg_read_all_data` is never used: it reaches every schema, present and future, and overrides a\n * REVOKE. Nothing is executed.\n */"
23097
+ "doc": "/**\n * Write the SQL for a login role that can read the allowed schemas and nothing the declaration hides:\n * `USAGE` on each allowed schema, `SELECT` on its tables plus default privileges, then a `REVOKE` for\n * each excluded table, its partitions and children, and each view or materialized view that reads\n * hidden data, and, for a table with a masked column, a `REVOKE` followed by a column-level `GRANT` of\n * the other columns. That is what the grant gate checks before each query. A grant the role would\n * still read hidden data through (to PUBLIC, or, for a role that exists, to a role whose privileges it\n * has) is listed in comments with the `REVOKE` the gate needs, since that reaches other roles; so is\n * each SECURITY DEFINER function the role may execute, where a grant to the role itself is revoked\n * outright. `pg_read_all_data` is never used: it reaches every schema, present and future, and\n * overrides a REVOKE. Nothing is executed.\n */"
22581
23098
  },
22582
23099
  {
22583
23100
  "name": "poweredBy",
@@ -22591,7 +23108,7 @@
22591
23108
  "kind": "function",
22592
23109
  "package": "@nifrajs/web",
22593
23110
  "signature": "export declare function pprShells(app: object): PprShells;",
22594
- "doc": "/**\n * The shell cache of an app made with `experimental.ppr`. Pass it in `createInvalidator`'s\n * `dataCaches` so a purge by tag also drops the shells built from the purged data.\n */"
23111
+ "doc": "/**\n * The shell cache of an app made with `ppr`. Pass it in `createInvalidator`'s\n * `dataCaches` so a purge by tag also drops the shells built from the purged data.\n */"
22595
23112
  },
22596
23113
  {
22597
23114
  "name": "preRouteMountPaths",
@@ -22708,6 +23225,20 @@
22708
23225
  "signature": "export declare function proveIdempotency(options: {\n readonly run: () => Promise<EffectLedger> | EffectLedger;\n readonly runs?: number;\n}): Promise<IdempotencyProof>;",
22709
23226
  "doc": "/** Run a token-only effect workload repeatedly and report the first stable replay differences. */"
22710
23227
  },
23228
+ {
23229
+ "name": "provideQueryClient",
23230
+ "kind": "function",
23231
+ "package": "@nifrajs/web-svelte",
23232
+ "signature": "export declare function provideQueryClient(client: QueryClient, state?: DehydratedState): void;",
23233
+ "doc": "/** Set the component-tree client and hydrate it before descendants subscribe to queries. */"
23234
+ },
23235
+ {
23236
+ "name": "provideQueryClient",
23237
+ "kind": "function",
23238
+ "package": "@nifrajs/web-vue",
23239
+ "signature": "export declare function provideQueryClient(client: QueryClient, state?: DehydratedState): void;",
23240
+ "doc": "/** Provide a request-scoped client and optionally hydrate it before child setup runs. */"
23241
+ },
22711
23242
  {
22712
23243
  "name": "publicDocsTools",
22713
23244
  "kind": "function",
@@ -22752,7 +23283,7 @@
22752
23283
  "kind": "function",
22753
23284
  "package": "@nifrajs/mcp-db",
22754
23285
  "signature": "export declare function queryPostgres(client: PostgresClient, sql: string, options: PostgresQueryOptions): Promise<DbRows | DbRefusal>;",
22755
- "doc": "/**\n * Run one read-only query through every layer and return capped rows. A column `redaction.column`\n * masks is refused wherever the plan uses it (selected under any alias, inside an expression, in a\n * filter, or within a whole row); a matching result name is masked as well.\n */"
23286
+ "doc": "/**\n * Run one read-only query through every layer and return capped rows. A column `redaction.column`\n * masks is one the role may not read (the grant gate), and is refused wherever the plan uses it\n * (selected under any alias, inside an expression, in a filter, or within a whole row); a matching\n * result name is masked as well.\n */"
22756
23287
  },
22757
23288
  {
22758
23289
  "name": "querySqlite",
@@ -22779,15 +23310,15 @@
22779
23310
  "name": "rateLimit",
22780
23311
  "kind": "function",
22781
23312
  "package": "@nifrajs/middleware",
22782
- "signature": "export declare function rateLimit(options: RateLimitOptions): Middleware;",
23313
+ "signature": "export declare function rateLimit(options: RateLimitOptions): RateLimiter;",
22783
23314
  "doc": "/**\n * Rate limiting as a {@link Middleware}. Runs in `onRequest` (before routing, so it\n * also covers 404s); over the limit → `429` + `Retry-After`. Every response carries\n * `RateLimit-Limit/Remaining/Reset` (added in `onResponse`, keyed off the request).\n */"
22784
23315
  },
22785
23316
  {
22786
23317
  "name": "rateLimitTiers",
22787
23318
  "kind": "function",
22788
23319
  "package": "@nifrajs/middleware",
22789
- "signature": "export declare function rateLimitTiers(options: RateLimitTiersOptions): Middleware;",
22790
- "doc": "/**\n * Rate limiting in tiers under one app-wide floor, as a single {@link Middleware}. Every request is\n * charged to at most one bucket: the tier with the longest `prefix` that is the request's path or an\n * ancestor of it, else the `floor`, else none when there is no floor. Tiers never stack, so a tier\n * may sit above the floor (`600/min` for `/api/public` under a `120/min` floor). It runs in\n * `onRequest`, before routing, so a 404, a 405 or a body that fails validation is charged too.\n * Prefixes are validated here; each tier counts in its own keys, so tiers can share one store.\n */"
23320
+ "signature": "export declare function rateLimitTiers(options: RateLimitTiersOptions): RateLimiter;",
23321
+ "doc": "/**\n * Rate limiting in tiers under one app-wide floor, as a single {@link Middleware}. Every request is\n * charged to at most one bucket: the tier owning the longest prefix that is the request's path or an\n * ancestor of it, across every tier's prefixes, else the `floor`, else none when there is no floor.\n * Tiers never stack, so a tier may sit above the floor (`600/min` for `/api/public` under a\n * `120/min` floor). It runs in `onRequest`, before routing, so a 404, a 405 or a body that fails\n * validation is charged too. Prefixes and names are validated here; each tier counts in its own\n * keys, so tiers can share one store.\n */"
22791
23322
  },
22792
23323
  {
22793
23324
  "name": "raw",
@@ -22803,6 +23334,48 @@
22803
23334
  "signature": "export declare function raw(trusted: string): RawHtml;",
22804
23335
  "doc": "/**\n * Mark a string as trusted, pre-escaped markup - it is emitted verbatim. The deliberate escape\n * hatch (CMS-sanitized HTML, pre-rendered markdown): every call site is greppable, exactly like\n * React's dangerouslySetInnerHTML, without the JSX.\n */"
22805
23336
  },
23337
+ {
23338
+ "name": "rawHref",
23339
+ "kind": "function",
23340
+ "package": "@nifrajs/web",
23341
+ "signature": "export declare function rawHref(path: string): Href;",
23342
+ "doc": "/**\n * An {@link Href} for a same-origin path built elsewhere: a CMS link, a `@nifrajs/content` page, a public\n * file such as `/llms.txt`. The path is returned as written, never encoded, after `isSameOriginPath`\n * (the check `redirect()` makes) accepts it: one leading `/`, not `//`, no backslash and no control\n * character. Anything else throws a `TypeError`. A route of this app is {@link href}; another site is a\n * plain `<a href>`.\n */"
23343
+ },
23344
+ {
23345
+ "name": "rawHref",
23346
+ "kind": "function",
23347
+ "package": "@nifrajs/web-preact",
23348
+ "signature": "export declare function rawHref(path: string): Href;",
23349
+ "doc": "/**\n * An {@link Href} for a same-origin path built elsewhere: a CMS link, a `@nifrajs/content` page, a public\n * file such as `/llms.txt`. The path is returned as written, never encoded, after `isSameOriginPath`\n * (the check `redirect()` makes) accepts it: one leading `/`, not `//`, no backslash and no control\n * character. Anything else throws a `TypeError`. A route of this app is {@link href}; another site is a\n * plain `<a href>`.\n */"
23350
+ },
23351
+ {
23352
+ "name": "rawHref",
23353
+ "kind": "function",
23354
+ "package": "@nifrajs/web-react",
23355
+ "signature": "export declare function rawHref(path: string): Href;",
23356
+ "doc": "/**\n * An {@link Href} for a same-origin path built elsewhere: a CMS link, a `@nifrajs/content` page, a public\n * file such as `/llms.txt`. The path is returned as written, never encoded, after `isSameOriginPath`\n * (the check `redirect()` makes) accepts it: one leading `/`, not `//`, no backslash and no control\n * character. Anything else throws a `TypeError`. A route of this app is {@link href}; another site is a\n * plain `<a href>`.\n */"
23357
+ },
23358
+ {
23359
+ "name": "rawHref",
23360
+ "kind": "function",
23361
+ "package": "@nifrajs/web-solid",
23362
+ "signature": "export declare function rawHref(path: string): Href;",
23363
+ "doc": "/**\n * An {@link Href} for a same-origin path built elsewhere: a CMS link, a `@nifrajs/content` page, a public\n * file such as `/llms.txt`. The path is returned as written, never encoded, after `isSameOriginPath`\n * (the check `redirect()` makes) accepts it: one leading `/`, not `//`, no backslash and no control\n * character. Anything else throws a `TypeError`. A route of this app is {@link href}; another site is a\n * plain `<a href>`.\n */"
23364
+ },
23365
+ {
23366
+ "name": "rawHref",
23367
+ "kind": "function",
23368
+ "package": "@nifrajs/web-svelte",
23369
+ "signature": "export declare function rawHref(path: string): Href;",
23370
+ "doc": "/**\n * An {@link Href} for a same-origin path built elsewhere: a CMS link, a `@nifrajs/content` page, a public\n * file such as `/llms.txt`. The path is returned as written, never encoded, after `isSameOriginPath`\n * (the check `redirect()` makes) accepts it: one leading `/`, not `//`, no backslash and no control\n * character. Anything else throws a `TypeError`. A route of this app is {@link href}; another site is a\n * plain `<a href>`.\n */"
23371
+ },
23372
+ {
23373
+ "name": "rawHref",
23374
+ "kind": "function",
23375
+ "package": "@nifrajs/web-vue",
23376
+ "signature": "export declare function rawHref(path: string): Href;",
23377
+ "doc": "/**\n * An {@link Href} for a same-origin path built elsewhere: a CMS link, a `@nifrajs/content` page, a public\n * file such as `/llms.txt`. The path is returned as written, never encoded, after `isSameOriginPath`\n * (the check `redirect()` makes) accepts it: one leading `/`, not `//`, no backslash and no control\n * character. Anything else throws a `TypeError`. A route of this app is {@link href}; another site is a\n * plain `<a href>`.\n */"
23378
+ },
22806
23379
  {
22807
23380
  "name": "reactAdapter",
22808
23381
  "kind": "const",
@@ -23036,8 +23609,7 @@
23036
23609
  "name": "redirect",
23037
23610
  "kind": "function",
23038
23611
  "package": "@nifrajs/web",
23039
- "signature": "export declare function redirect(location: string, options?: RedirectOptions): ResponseResult;",
23040
- "doc": "/**\n * Build a redirect - return it from a route `action` for the Post/Redirect/Get pattern (POST\n * mutates, 303 sends the browser to a fresh GET, so a reload doesn't re-submit). Defaults to 303\n * (See Other); pass `{ status: 307 }` or `{ status: 308 }` to preserve the method.\n *\n * **Secure by default:** `location` must be a same-origin path (begins with `/`, not `//`). An\n * off-origin/absolute destination throws unless you pass `{ external: true }` - this closes the\n * open-redirect footgun of `return redirect(formData.get(\"next\"))` on the no-JS (native-form) path,\n * which serves the action's control-flow value verbatim.\n *\n * Returns a plain render, not a `Response`. A redirect is a status line and one header - the most\n * body-less response there is - and building a `Response` for it costs the whole Web object plus, on\n * Node, a stream drained back out. As data it renders on the same lane a handler's return takes.\n * `redirect(...)` is still returned or thrown from exactly the same places; only `.status` /\n * `.headers` are gone from the value, replaced by `options.headers` and the request's `c.set`.\n *\n * @param options redirect status, extra headers, and whether an off-origin destination is intentional.\n */"
23612
+ "signature": "export declare function redirect(location: string, options: RedirectOptions & {\n readonly external: true;\n}): ResponseResult;"
23041
23613
  },
23042
23614
  {
23043
23615
  "name": "redisLiveBus",
@@ -23304,6 +23876,20 @@
23304
23876
  "signature": "export declare function requestId(options?: RequestIdOptions): ContextPlugin<{\n requestId: string;\n}>;",
23305
23877
  "doc": "/**\n * A {@link defineContextPlugin} plugin that gives every request a stable id: it reuses an inbound\n * `x-request-id` (or generates one), exposes it on the handler context as **`c.requestId`** (typed,\n * threaded by `derive`), and echoes it on EVERY response leaving the app - handler-returned raw\n * `Response`s and redirects, `onRequest` short-circuits (an auth 401, an admission 429), and\n * framework-generated 404/405/422/timeout responses included. Core deliberately does not merge\n * `c.set.headers` onto a handler-returned `Response`, so the echo lives in an app-global\n * `onResponse` hook (paired with the derive through a `WeakMap` keyed on the request) with a node\n * twin, keeping the Node adapter on its direct writer with no request-walk cost. Idempotent -\n * applying it twice is a no-op.\n *\n * ```ts\n * app.use(requestId()) // c.requestId available downstream; X-Request-Id on responses\n * ```\n */"
23306
23878
  },
23879
+ {
23880
+ "name": "requestLocal",
23881
+ "kind": "function",
23882
+ "package": "@nifrajs/core",
23883
+ "signature": "export declare function requestLocal<T>(): RequestLocal<T>;",
23884
+ "doc": "/**\n * A slot for one per-request value - a verified client IP, a request id, an auth decision - that\n * survives the request copies nifra makes (a mount's prefix strip, a WebSocket pass reused for HTTP,\n * target resolution) and the ones a wrapper makes with {@link carryRequestLocals}. A copy made any\n * other way starts empty. Values are held weakly and never cross requests. Make slots at startup, as\n * below: copies are linked only once a first slot exists, so a request copied before then starts\n * empty.\n *\n * ```ts\n * const clientIp = requestLocal<string>()\n * app.onRequest((req, platform) => { clientIp.set(req, platform?.clientIp ?? \"\") })\n * // ... in a mounted child app, after the prefix strip:\n * clientIp.get(c.req)\n * ```\n */"
23885
+ },
23886
+ {
23887
+ "name": "requestLocal",
23888
+ "kind": "function",
23889
+ "package": "nifra",
23890
+ "signature": "export declare function requestLocal<T>(): RequestLocal<T>;",
23891
+ "doc": "/**\n * A slot for one per-request value - a verified client IP, a request id, an auth decision - that\n * survives the request copies nifra makes (a mount's prefix strip, a WebSocket pass reused for HTTP,\n * target resolution) and the ones a wrapper makes with {@link carryRequestLocals}. A copy made any\n * other way starts empty. Values are held weakly and never cross requests. Make slots at startup, as\n * below: copies are linked only once a first slot exists, so a request copied before then starts\n * empty.\n *\n * ```ts\n * const clientIp = requestLocal<string>()\n * app.onRequest((req, platform) => { clientIp.set(req, platform?.clientIp ?? \"\") })\n * // ... in a mounted child app, after the prefix strip:\n * clientIp.get(c.req)\n * ```\n */"
23892
+ },
23307
23893
  {
23308
23894
  "name": "requireAuthUser",
23309
23895
  "kind": "function",
@@ -23391,8 +23977,8 @@
23391
23977
  "name": "resolveImage",
23392
23978
  "kind": "function",
23393
23979
  "package": "@nifrajs/image",
23394
- "signature": "export declare function resolveImage(props: ImageProps, loader?: ImageLoader): ResolvedImage;",
23395
- "doc": "/**\n * Resolve {@link ImageProps} + an {@link ImageLoader} into `<img>` attributes. CLS-safe (`width`/\n * `height` required + > 0, else a dev error), lazy + async-decoding by default, with a responsive\n * `srcSet` built from `widths` via the loader. If every width produces the same URL (e.g.\n * {@link identityLoader}), `srcSet` is omitted (it'd be redundant).\n */"
23980
+ "signature": "export declare function resolveImage(props: ImageInputProps, loader?: ImageLoader): ResolvedImage;",
23981
+ "doc": "/**\n * Resolve a URL or imported asset into CLS-safe attributes. Explicit dimensions override imported\n * metadata; supplying just one scales the other to preserve the source's aspect ratio. Prebuilt\n * variants need no runtime loader. An explicit CDN loader takes precedence over those variants.\n */"
23396
23982
  },
23397
23983
  {
23398
23984
  "name": "resolveLocale",
@@ -23408,13 +23994,6 @@
23408
23994
  "signature": "export declare function resolveMeta(meta: MetaInput | undefined, args: MetaArgs): Meta;",
23409
23995
  "doc": "/** Resolve a route's `meta` export - a static object, or a function of the route's data/params. */"
23410
23996
  },
23411
- {
23412
- "name": "resolveNavigate",
23413
- "kind": "function",
23414
- "package": "@nifrajs/web",
23415
- "signature": "export declare function resolveNavigate(to: string | number | NavigateTargetInput, options?: NavigateOptions): {\n readonly to: string | number;\n readonly options: NavigateOptions | undefined;\n};",
23416
- "doc": "/**\n * Normalize a navigate argument to the bridge's `(to, options)`: a string path or history-delta passes\n * through; an object target has its `search` serialized onto `to` and its `replace` folded into the\n * options. The one place the object form becomes a URL, so every adapter's `navigate` resolves it\n * identically.\n */"
23417
- },
23418
23997
  {
23419
23998
  "name": "resolvePublicPath",
23420
23999
  "kind": "function",
@@ -24071,11 +24650,25 @@
24071
24650
  "doc": "/**\n * Serve `db` as a mountable MCP server (`mcp.fetch` at `POST /mcp`). See module docs for the\n * security model. Throws {@link McpDbConfigError} on any unsafe configuration - always at\n * construction (boot), never at request time.\n */"
24072
24651
  },
24073
24652
  {
24074
- "name": "servePublicDir",
24653
+ "name": "serveStatic",
24075
24654
  "kind": "function",
24076
- "package": "@nifrajs/web",
24077
- "signature": "export declare function servePublicDir(options: ServePublicDirOptions): (request: Request) => Promise<Response | undefined>;",
24078
- "doc": "/**\n * Build a static-file handler for `dir`.\n *\n * Returns `undefined` on any miss so the caller **falls through to routing** - a static probe must\n * never shadow a route. That ordering is also why a `routes/robots.txt.tsx` beats a\n * `public/robots.txt` only if the caller checks routes first; the documented precedence is that the\n * static probe runs first, so `public/` wins, and an app wanting the route should not ship both.\n *\n * Files up to 256 KiB carry a strong `ETag` from the exact snapshot served, matching the Node and\n * Deno readers. Those snapshots carry `Last-Modified` only while mtime reflects their own last change.\n * Larger files stream without an `ETag`: an open inode can change after a separate hash pass. They\n * are dated once settled, but an `If-Range` request gets the whole file rather than spliced versions.\n */"
24655
+ "package": "@nifrajs/core",
24656
+ "signature": "export declare function serveStatic(mounts: ServeStaticOptions | readonly ServeStaticOptions[]): (request: Request) => Promise<Response | undefined> | undefined;",
24657
+ "doc": "/**\n * The `static` handler for files on disk, for Bun's `listen()`: each mount serves a directory under a\n * URL prefix, and the first mount whose prefix (and `files`, when set) takes a GET or HEAD path\n * answers it. A request no mount takes returns `undefined` synchronously and reaches the app. The\n * same mounts work with `@nifrajs/node`'s and `@nifrajs/deno`'s `serveStatic`.\n *\n * Files up to 256 KiB carry a strong `ETag` from the exact bytes served. Larger files stream with no\n * tag and a weak date, so an `If-Range` gets the whole file rather than a range spliced from two\n * versions.\n *\n * @example\n * ```ts\n * import { serveStatic } from \"@nifrajs/core/serve-static\"\n *\n * app.listen(3000, { static: serveStatic({ dir: new URL(\"./assets/\", import.meta.url) }) })\n * ```\n */"
24658
+ },
24659
+ {
24660
+ "name": "serveStatic",
24661
+ "kind": "function",
24662
+ "package": "@nifrajs/deno",
24663
+ "signature": "export declare function serveStatic(mounts: ServeStaticOptions | readonly ServeStaticOptions[]): (request: Request) => Promise<Response | undefined> | undefined;",
24664
+ "doc": "/**\n * The `static` handler for files on disk: each mount serves a directory under a URL prefix, and the\n * first mount whose prefix (and `files`, when set) takes a GET or HEAD path answers it. A request no\n * mount takes returns `undefined` synchronously and reaches the app. The same mounts work with Bun's\n * `@nifrajs/core/serve-static` and `@nifrajs/node`.\n *\n * Files up to 256 KiB carry a strong `ETag` from the exact bytes served. Larger files stream with no\n * tag and a weak date, so an `If-Range` gets the whole file rather than a range spliced from two\n * versions.\n *\n * @example\n * ```ts\n * await serve(app, { port: 3000, static: serveStatic({ dir: new URL(\"./assets/\", import.meta.url) }) })\n * ```\n */"
24665
+ },
24666
+ {
24667
+ "name": "serveStatic",
24668
+ "kind": "function",
24669
+ "package": "@nifrajs/node",
24670
+ "signature": "export declare function serveStatic(mounts: ServeStaticOptions | readonly ServeStaticOptions[]): (request: Request) => Promise<Response | undefined> | undefined;",
24671
+ "doc": "/**\n * The `static` handler for files on disk: each mount serves a directory under a URL prefix, and the\n * first mount whose prefix (and `files`, when set) takes a GET or HEAD path answers it. Passed to\n * {@link serve}, the mounts run on Node's own request, so a request none of them takes reaches the\n * app on its direct lane. Called with a Web `Request`, it answers the same way. Bun's\n * `@nifrajs/core/serve-static` and `@nifrajs/deno` take the same mounts.\n *\n * @example\n * ```ts\n * await serve(app, { port: 3000, static: serveStatic({ dir: new URL(\"./assets/\", import.meta.url) }) })\n * ```\n */"
24079
24672
  },
24080
24673
  {
24081
24674
  "name": "serveStdio",
@@ -24544,6 +25137,13 @@
24544
25137
  "signature": "export declare function startDynamicBoundaries(boundaries: readonly BoundaryRegistration[], context: BoundaryRequestCtx): DynamicBoundaryBatch;",
24545
25138
  "doc": "/**\n * Start all dynamic boundary loads at once without making the page wait for the slowest sibling.\n * The initial states contain `status: \"pending\"`; callers that support deferred values can attach\n * each `pending.promise` to its own slot. `complete` still provides settled, isolated states to\n * non-streaming callers, preserving the simple reference API.\n */"
24546
25139
  },
25140
+ {
25141
+ "name": "staticCacheControl",
25142
+ "kind": "function",
25143
+ "package": "@nifrajs/core",
25144
+ "signature": "export declare function staticCacheControl(mount: StaticMount, immutable: boolean): string | undefined;",
25145
+ "doc": "/** The `cache-control` a file a mount serves carries, or `undefined` for its validators alone. */"
25146
+ },
24547
25147
  {
24548
25148
  "name": "staticComponentPipeline",
24549
25149
  "kind": "function",
@@ -24551,6 +25151,20 @@
24551
25151
  "signature": "export declare function staticComponentPipeline(source: string, file: string): unknown;",
24552
25152
  "doc": "/** The `componentPipeline` a config module exports as a plain literal, read without running the\n * module, or `undefined` when it exports none or one that is not a literal. */"
24553
25153
  },
25154
+ {
25155
+ "name": "staticMountOf",
25156
+ "kind": "function",
25157
+ "package": "@nifrajs/core",
25158
+ "signature": "export declare function staticMountOf(options: ServeStaticOptions, root: string): StaticMount;",
25159
+ "doc": "/** Check `options` once, with `root` the absolute path its runtime resolved `options.dir` to. */"
25160
+ },
25161
+ {
25162
+ "name": "staticMountsOf",
25163
+ "kind": "function",
25164
+ "package": "@nifrajs/core",
25165
+ "signature": "export declare function staticMountsOf(mounts: ServeStaticOptions | readonly ServeStaticOptions[], rootOf: (dir: string | URL) => string): readonly StaticMount[];",
25166
+ "doc": "/** One mount or several, as `serveStatic()` takes them, each checked by {@link staticMountOf}. */"
25167
+ },
24554
25168
  {
24555
25169
  "name": "status",
24556
25170
  "kind": "function",
@@ -24771,7 +25385,7 @@
24771
25385
  "name": "t",
24772
25386
  "kind": "const",
24773
25387
  "package": "@nifrajs/schema",
24774
- "signature": "export declare const t: {\n readonly string: (options?: StringOptions) => NifraSchema<import(\"@sinclair/typebox\").TString>;\n readonly number: (options?: NumberOptions) => NifraSchema<import(\"@sinclair/typebox\").TNumber>;\n readonly integer: (options?: IntegerOptions) => NifraSchema<import(\"@sinclair/typebox\").TInteger>;\n readonly boolean: () => NifraSchema<import(\"@sinclair/typebox\").TBoolean>;\n readonly null: () => NifraSchema<import(\"@sinclair/typebox\").TNull>;\n readonly literal: <const L extends TLiteralValue>(value: L) => NifraSchema<import(\"@sinclair/typebox\").TLiteral<L>>;\n readonly object: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** Like `t.object` but ACCEPTS (and passes through) unknown fields - the explicit opt-out of the\n * strict default. Prefer `t.object` unless you genuinely need an open object. */\n readonly looseObject: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A list. A list of `t.file()` (from `@nifrajs/schema/form`) honors `minItems` / `maxItems` and is\n * used inside `t.form`.\n */\n readonly array: <T extends TSchema>(item: NifraSchema<T>, options?: ArrayOptions) => NifraSchema<TArray<T>>;\n /** Marks a property optional inside `t.object` / `t.form`; standalone it is `T | undefined`. */\n readonly optional: <T extends TSchema>(schema: NifraSchema<T>) => NifraSchema<T extends import(\"@sinclair/typebox\").TOptional<infer S extends TSchema> ? import(\"@sinclair/typebox\").TOptional<S> : import(\"@sinclair/typebox\").Ensure<import(\"@sinclair/typebox\").TOptional<T>>>;\n readonly union: <const S extends readonly NifraSchema[]>(schemas: S) => NifraSchema<TUnion<{ -readonly [K in keyof S]: S[K][\"jsonSchema\"]; }>>;\n readonly record: <T extends TSchema>(value: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TRecord<import(\"@sinclair/typebox\").TString, T>>;\n /** A cursor-pagination response envelope: `{ items: T[]; nextCursor: string | null }` (`null` = last page). */\n readonly paginated: <T extends TSchema>(item: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n items: TArray<T>;\n nextCursor: TUnion<[import(\"@sinclair/typebox\").TString, import(\"@sinclair/typebox\").TNull]>;\n }>>;\n /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`\n * caps `limit` - a larger value fails validation (a 422), so a client can't request an unbounded page.\n * `coerce` is on because query values arrive as strings (`?limit=20` → `\"20\"`); it's what makes `limit`\n * a real `number` in the handler (`c.query.limit`), not a string. */\n readonly pageQuery: (options?: {\n maxLimit?: number;\n }) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n cursor: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TString>;\n limit: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TInteger>;\n }>>;\n /** A request-query schema with string->scalar COERCION on. Query values always arrive as strings\n * (`?limit=20` -> `\"20\"`), so `t.integer()`/`t.number()`/`t.boolean()` fields become real numbers/\n * booleans in `c.query`. A `t.object` in a `query` slot is converted the same way, and stays closed.\n * **Open by default** (unknown query fields pass through - `additionalProperties:\n * true`): query params are read by name, not spread into a DB write, so unknown params (UTM tracking,\n * `fbclid`, etc.) passing through is safe, and rejecting them is a production-only footgun (ad/social\n * traffic appends params your schema never declares, causing 422s that never appear in dev/CI). Pass\n * `{ additionalProperties: false }` to enforce a strict allowlist. A body slot converts nothing: a\n * JSON body is already typed. */\n readonly query: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-cookie schema for the `cookies` route slot, with the same string->scalar COERCION as\n * `t.query` (cookie values always arrive as strings). **Open by default**: a browser sends every\n * cookie the site has set - analytics, consent, other routes' sessions - so a strict allowlist\n * would 422 real traffic. Declare the cookies the route reads; the rest pass through. */\n readonly cookies: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-header schema for the `headers` route slot, with the same string->scalar COERCION as\n * `t.query` (header values always arrive as strings). **Open**: it receives every header the client\n * sent, names lower-cased, so the declared names must be lower-case too. A closed `t.object` in the\n * slot also works: it validates only the names it declares, converted from text the same way. */\n readonly headers: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A loader value marked with `defer()`, streamed in after the shell. `inner` describes what the\n * promise resolves to; `@nifrajs/web` projects and validates the resolved value by it before it\n * streams, so a deferred value is held to the same output contract as the rest of the data.\n */\n readonly deferred: <T extends TSchema>(inner: NifraSchema<T>) => NifraSchema<TUnsafe<DeferredValue<Static<T>>>>;\n /**\n * Any JSON value: strings, finite numbers, booleans, `null`, and arrays and plain objects of them, at\n * any depth. A function, a class instance, `NaN` or a cycle fails. The output guard cannot see inside\n * it, so `nifra check` and the sensitive-field rule do not either: prefer a declared shape for\n * anything that might hold a credential.\n */\n readonly json: () => NifraSchema<TUnsafe<JsonValue>>;\n /**\n * A `Date` for page data: `loaderOutput`, `actionOutput` and a server function's `output`. The\n * loader may return a `Date` or an ISO 8601 string; the page receives a `Date`, on the server render\n * and in the browser alike. A request body or a `backend/app.ts` response is plain JSON, which has\n * no dates: use `t.string({ format: \"date-time\" })` there.\n */\n readonly date: () => NifraSchema<TUnsafe<Date>>;\n /**\n * Bytes in a JSON response, as a base64 string. The handler returns a `Uint8Array` (or a `Buffer`); a\n * route whose `response` or `errors` declares this field writes every `Uint8Array` in its answer as\n * base64, the one a `beforeHandle`, `afterHandle` or `onError` hook answers in the handler's place\n * included, and the typed client reads a `string`. Response-only for now: a request or `sse` schema\n * that declares it is refused when the route is registered.\n */\n readonly bytes: () => NifraSchema<TUnsafe<Base64Bytes>>;\n /**\n * Allow a field with a sensitive name (`token`, `password`, `apiKey`, ...) in an output schema.\n * An output schema that declares one without this fails at route load; `reason` records why this\n * value may reach the browser, for the reviewer who finds it later.\n */\n readonly declassified: <T extends TSchema>(reason: string, schema: NifraSchema<T>) => NifraSchema<T>;\n};",
25388
+ "signature": "export declare const t: {\n readonly string: (options?: StringOptions) => NifraSchema<import(\"@sinclair/typebox\").TString>;\n readonly number: (options?: NumberOptions) => NifraSchema<import(\"@sinclair/typebox\").TNumber>;\n readonly integer: (options?: IntegerOptions) => NifraSchema<import(\"@sinclair/typebox\").TInteger>;\n readonly boolean: () => NifraSchema<import(\"@sinclair/typebox\").TBoolean>;\n readonly null: () => NifraSchema<import(\"@sinclair/typebox\").TNull>;\n readonly literal: <const L extends TLiteralValue>(value: L) => NifraSchema<import(\"@sinclair/typebox\").TLiteral<L>>;\n readonly object: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** Like `t.object` but ACCEPTS (and passes through) unknown fields - the explicit opt-out of the\n * strict default. Prefer `t.object` unless you genuinely need an open object. */\n readonly looseObject: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A list. A list of `t.file()` (from `@nifrajs/schema/form`) honors `minItems` / `maxItems` and is\n * used inside `t.form`.\n */\n readonly array: <T extends TSchema>(item: NifraSchema<T>, options?: ArrayOptions) => NifraSchema<TArray<T>>;\n /** Marks a property optional inside `t.object` / `t.form`; standalone it is `T | undefined`. */\n readonly optional: <T extends TSchema>(schema: NifraSchema<T>) => NifraSchema<T extends import(\"@sinclair/typebox\").TOptional<infer S extends TSchema> ? import(\"@sinclair/typebox\").TOptional<S> : import(\"@sinclair/typebox\").Ensure<import(\"@sinclair/typebox\").TOptional<T>>>;\n readonly union: <const S extends readonly NifraSchema[]>(schemas: S) => NifraSchema<TUnion<{ -readonly [K in keyof S]: S[K][\"jsonSchema\"]; }>>;\n readonly record: <T extends TSchema>(value: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TRecord<import(\"@sinclair/typebox\").TString, T>>;\n /** A cursor-pagination response envelope: `{ items: T[]; nextCursor: string | null }` (`null` = last page). */\n readonly paginated: <T extends TSchema>(item: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n items: TArray<T>;\n nextCursor: TUnion<[import(\"@sinclair/typebox\").TString, import(\"@sinclair/typebox\").TNull]>;\n }>>;\n /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`\n * caps `limit` - a larger value fails validation (a 422), so a client can't request an unbounded page.\n * `coerce` is on because query values arrive as strings (`?limit=20` → `\"20\"`); it's what makes `limit`\n * a real `number` in the handler (`c.query.limit`), not a string. */\n readonly pageQuery: (options?: {\n maxLimit?: number;\n }) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n cursor: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TString>;\n limit: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TInteger>;\n }>>;\n /** A request-query schema with string->scalar COERCION on. Query values always arrive as strings\n * (`?limit=20` -> `\"20\"`), so `t.integer()`/`t.number()`/`t.boolean()` fields become real numbers/\n * booleans in `c.query`. A `t.object` in a `query` slot is converted the same way, and stays closed.\n * **Open by default** (unknown query fields pass through - `additionalProperties:\n * true`): query params are read by name, not spread into a DB write, so unknown params (UTM tracking,\n * `fbclid`, etc.) passing through is safe, and rejecting them is a production-only footgun (ad/social\n * traffic appends params your schema never declares, causing 422s that never appear in dev/CI). Pass\n * `{ additionalProperties: false }` to enforce a strict allowlist. A body slot converts nothing: a\n * JSON body is already typed. */\n readonly query: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-cookie schema for the `cookies` route slot, with the same string->scalar COERCION as\n * `t.query` (cookie values always arrive as strings). **Open by default**: a browser sends every\n * cookie the site has set - analytics, consent, other routes' sessions - so a strict allowlist\n * would 422 real traffic. Declare the cookies the route reads; the rest pass through. */\n readonly cookies: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-header schema for the `headers` route slot, with the same string->scalar COERCION as\n * `t.query` (header values always arrive as strings). **Open**: it receives every header the client\n * sent, names lower-cased, so the declared names must be lower-case too. A closed `t.object` in the\n * slot also works: it validates only the names it declares, converted from text the same way. */\n readonly headers: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A loader value marked with `defer()`, streamed in after the shell. `inner` describes what the\n * promise resolves to; `@nifrajs/web` projects and validates the resolved value by it before it\n * streams, so a deferred value is held to the same output contract as the rest of the data.\n */\n readonly deferred: <T extends TSchema>(inner: NifraSchema<T>) => NifraSchema<TUnsafe<DeferredValue<Static<T>>>>;\n /**\n * Any JSON value: strings, finite numbers, booleans, `null`, and arrays and plain objects of them, at\n * any depth. A function, a class instance, `NaN` or a cycle fails. The output guard cannot see inside\n * it, so `nifra check` and the sensitive-field rule do not either: prefer a declared shape for\n * anything that might hold a credential.\n */\n readonly json: () => NifraSchema<TUnsafe<JsonValue>>;\n /**\n * A `Date` in your code, an RFC 3339 `date-time` string on the wire (JSON Schema and OpenAPI say\n * `type: \"string\", format: \"date-time\"`).\n *\n * - A route's `response` or `errors`: the handler returns a `Date` (a timestamp column) or such a\n * string; the JSON carries the string, and the typed client reads a `string`.\n * - A request's `body`, `query` or `params`, and a server function's `input`: the string is checked\n * (calendar included, so no `2026-02-30`) and the handler receives a `Date`.\n * - Page data (`loaderOutput`, `actionOutput`, a server function's `output`): the loader returns a\n * `Date` or an ISO 8601 string, and the page receives a `Date` on the server render and in the\n * browser alike.\n *\n * In a union, a string becomes a `Date` only under the first branch that accepts the value, so\n * `t.union([t.date(), t.string()])` hands over a `Date`.\n */\n readonly date: () => NifraSchema<TUnsafe<Date>>;\n /**\n * Bytes in a JSON response, as a base64 string. The handler returns a `Uint8Array` (or a `Buffer`); a\n * route whose `response` or `errors` declares this field writes every `Uint8Array` in its answer as\n * base64, the one a `beforeHandle`, `afterHandle` or `onError` hook answers in the handler's place\n * included, and the typed client reads a `string`. Response-only for now: a request or `sse` schema\n * that declares it is refused when the route is registered.\n */\n readonly bytes: () => NifraSchema<TUnsafe<Base64Bytes>>;\n /**\n * Allow a field with a sensitive name (`token`, `password`, `apiKey`, ...) in an output schema.\n * An output schema that declares one without this fails at route load; `reason` records why this\n * value may reach the browser, for the reviewer who finds it later.\n */\n readonly declassified: <T extends TSchema>(reason: string, schema: NifraSchema<T>) => NifraSchema<T>;\n};",
24775
25389
  "doc": "/**\n * The built-in schema builder. Each constructor returns a `NifraSchema` - a\n * Standard Schema whose validated output type flows into `c.body`/`c.query`, and\n * whose `jsonSchema` powers `toOpenAPI`. Options (min/max, length, pattern, …)\n * pass straight through to TypeBox and so become JSON Schema constraints.\n *\n * Composite constructors are generic over the *inner* TypeBox schema `T extends\n * TSchema` (not over `NifraSchema`): reading `.jsonSchema` off a value typed only as\n * `NifraSchema` would erase to the `TSchema` constraint and collapse the output type\n * to `unknown`. Capturing `T` keeps `Static<T>` precise (`string[]`, not\n * `unknown[]`).\n */"
24776
25390
  },
24777
25391
  {
@@ -25137,7 +25751,7 @@
25137
25751
  "kind": "function",
25138
25752
  "package": "@nifrajs/web-svelte",
25139
25753
  "signature": "export declare function ui<Props extends Record<string, unknown>>(component: Component<Props>, ...props: Record<string, never> extends Props ? [props?: Props] : [props: Props]): SvelteUI;",
25140
- "doc": "/** Experimental: `component` rendered with `props`, for a partially prerendered hole. */"
25754
+ "doc": "/** `component` rendered with `props`, for a partially prerendered hole. */"
25141
25755
  },
25142
25756
  {
25143
25757
  "name": "uiResourceMeta",
@@ -25319,6 +25933,13 @@
25319
25933
  "signature": "export declare function useFetchers(): Readonly<ShallowRef<readonly Fetcher[]>>;",
25320
25934
  "doc": "/**\n * Subscribe to the whole live fetcher collection - for a global busy view (e.g. \"3 saving…\"). Read\n * each entry's `.snapshot()` for its state. The ref updates whenever any fetcher transitions or a new\n * one is created.\n */"
25321
25935
  },
25936
+ {
25937
+ "name": "useInfiniteQuery",
25938
+ "kind": "function",
25939
+ "package": "@nifrajs/web-preact",
25940
+ "signature": "export declare function useInfiniteQuery<T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: UseInfiniteQueryOptions<T, P>): UseInfiniteQueryResult<T, P>;",
25941
+ "doc": "/** A paged query binding that follows Preact's mount and subscription lifecycle. */"
25942
+ },
25322
25943
  {
25323
25944
  "name": "useInfiniteQuery",
25324
25945
  "kind": "function",
@@ -25326,6 +25947,20 @@
25326
25947
  "signature": "export declare function useInfiniteQuery<T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: UseInfiniteQueryOptions<T, P>): UseInfiniteQueryResult<T, P>;",
25327
25948
  "doc": "/**\n * Subscribe to a paged (infinite-scroll) query. Returns the accumulated `data.pages` plus\n * `fetchNextPage`/`fetchPreviousPage`/`hasNextPage`/`hasPreviousPage`. Fetches the first page on mount.\n * SSR-idle unless a `QueryClientProvider` supplies a hydrated client.\n */"
25328
25949
  },
25950
+ {
25951
+ "name": "useInfiniteQuery",
25952
+ "kind": "function",
25953
+ "package": "@nifrajs/web-svelte",
25954
+ "signature": "export declare function useInfiniteQuery<T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: UseInfiniteQueryOptions<T, P>): InfiniteQueryStore<T, P>;",
25955
+ "doc": "/** Bind a paged query as a Svelte readable store. Fetching starts on the first browser subscription. */"
25956
+ },
25957
+ {
25958
+ "name": "useInfiniteQuery",
25959
+ "kind": "function",
25960
+ "package": "@nifrajs/web-vue",
25961
+ "signature": "export declare function useInfiniteQuery<T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: UseInfiniteQueryOptions<T, P>): UseInfiniteQueryResult<T, P>;",
25962
+ "doc": "/** Bind a paged query to Vue's mount and effect-scope lifecycles. */"
25963
+ },
25329
25964
  {
25330
25965
  "name": "useLocale",
25331
25966
  "kind": "function",
@@ -25410,47 +26045,68 @@
25410
26045
  "signature": "export declare function useMatches(): Readonly<Ref<readonly UIMatch[]>>;",
25411
26046
  "doc": "/**\n * The rendered chain - each layout, then the page - with the URL prefix, params and loader data each\n * one owns, plus its `handle` export, as a reactive ref. The same list on the server render and the\n * client mount, so a layout can render breadcrumbs from its children's `handle`s without a hydration\n * mismatch.\n *\n * ```vue\n * // page: export const handle = { crumb: \"Settings\" } (a plain <script> block)\n * const matches = useMatches()\n * const crumbs = computed(() => matches.value.flatMap((m) => (m.handle as { crumb?: string } | undefined)?.crumb ?? []))\n * ```\n */"
25412
26047
  },
26048
+ {
26049
+ "name": "useMutation",
26050
+ "kind": "function",
26051
+ "package": "@nifrajs/web-preact",
26052
+ "signature": "export declare function useMutation<TData, TVariables = void>(fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): UseMutationResult<TData, TVariables>;",
26053
+ "doc": "/** A mutation binding with Preact state subscriptions and identity-boundary cancellation. */"
26054
+ },
25413
26055
  {
25414
26056
  "name": "useMutation",
25415
26057
  "kind": "function",
25416
26058
  "package": "@nifrajs/web-react",
25417
- "signature": "export declare function useMutation<TData, TVariables = void>(fn: (variables: TVariables) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): UseMutationResult<TData, TVariables>;",
25418
- "doc": "/**\n * A mutation hook (create/update/delete). Returns `{ mutate, mutateAsync, data, error, variables, isIdle,\n * isPending, isError, isSuccess, reset }`. Invalidate affected queries from `onSuccess` via\n * `useQueryClient().invalidateQueries(...)`. The handle is stable across renders; the latest `fn`/\n * callbacks re-bind each render.\n */"
26059
+ "signature": "export declare function useMutation<TData, TVariables = void>(fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): UseMutationResult<TData, TVariables>;",
26060
+ "doc": "/**\n * A mutation hook (create/update/delete). Returns `{ mutate, mutateAsync, data, error, variables, isIdle,\n * isPending, isError, isSuccess, reset, cancel }`. Invalidate affected queries from `onSuccess` via\n * `useQueryClient().invalidateQueries(...)`. The handle is stable across renders; the latest `fn`/\n * callbacks re-bind each render.\n */"
26061
+ },
26062
+ {
26063
+ "name": "useMutation",
26064
+ "kind": "function",
26065
+ "package": "@nifrajs/web-svelte",
26066
+ "signature": "export declare function useMutation<TData, TVariables = void>(fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): MutationStore<TData, TVariables>;",
26067
+ "doc": "/** Bind a mutation as a Svelte store. Identity changes discard late results and callbacks. */"
26068
+ },
26069
+ {
26070
+ "name": "useMutation",
26071
+ "kind": "function",
26072
+ "package": "@nifrajs/web-vue",
26073
+ "signature": "export declare function useMutation<TData, TVariables = void>(fn: (variables: TVariables, context: MutationContext) => Promise<TData>, callbacks?: MutationCallbacks<TData, TVariables>): UseMutationResult<TData, TVariables>;",
26074
+ "doc": "/** Bind a mutation to Vue's effect scope. Identity changes discard late results and callbacks. */"
25419
26075
  },
25420
26076
  {
25421
26077
  "name": "useNavigate",
25422
26078
  "kind": "function",
25423
26079
  "package": "@nifrajs/web-preact",
25424
26080
  "signature": "export declare function useNavigate(): NavigateFunction;",
25425
- "doc": "/** Get the {@link NavigateFunction} (a string path, a history delta, or a typed `{ to, search }` object).\n * Stable across renders; resolves the browser navigate at call time, so it works as soon as\n * `installHistory` has run and no-ops before then / on the server. */"
26081
+ "doc": "/** Get the {@link NavigateFunction} (an `Href` from `href()` or `rawHref()`, or a history delta).\n * Stable across renders; resolves the browser navigate at call time, so it works as soon as\n * `installHistory` has run and no-ops before then / on the server. */"
25426
26082
  },
25427
26083
  {
25428
26084
  "name": "useNavigate",
25429
26085
  "kind": "function",
25430
26086
  "package": "@nifrajs/web-react",
25431
26087
  "signature": "export declare function useNavigate(): NavigateFunction;",
25432
- "doc": "/** Get the {@link NavigateFunction} (a string path, a history delta, or a typed `{ to, search }` object;\n * a render-time navigate isn't valid - use {@link Navigate}, which navigates in an effect). Stable across\n * renders; resolves the browser navigate at call time (so it works as soon as `installHistory` has run,\n * and no-ops before then / on the server). */"
26088
+ "doc": "/** Get the {@link NavigateFunction} (an `Href` from `href()` or `rawHref()`, or a history delta;\n * a render-time navigate isn't valid - use {@link Navigate}, which navigates in an effect). Stable across\n * renders; resolves the browser navigate at call time (so it works as soon as `installHistory` has run,\n * and no-ops before then / on the server). */"
25433
26089
  },
25434
26090
  {
25435
26091
  "name": "useNavigate",
25436
26092
  "kind": "function",
25437
26093
  "package": "@nifrajs/web-solid",
25438
26094
  "signature": "export declare function useNavigate(): NavigateFunction;",
25439
- "doc": "/** Get the {@link NavigateFunction} (a string path, a history delta, or a typed `{ to, search }` object).\n * Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops\n * before then / on the server. */"
26095
+ "doc": "/** Get the {@link NavigateFunction} (an `Href` from `href()` or `rawHref()`, or a history delta).\n * Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops\n * before then / on the server. */"
25440
26096
  },
25441
26097
  {
25442
26098
  "name": "useNavigate",
25443
26099
  "kind": "function",
25444
26100
  "package": "@nifrajs/web-svelte",
25445
26101
  "signature": "export declare function useNavigate(): NavigateFunction;",
25446
- "doc": "/** Get the {@link NavigateFunction} (a string path, a history delta, or a typed `{ to, search }` object).\n * Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops\n * before then / on the server. */"
26102
+ "doc": "/** Get the {@link NavigateFunction} (an `Href` from `href()` or `rawHref()`, or a history delta).\n * Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops\n * before then / on the server. */"
25447
26103
  },
25448
26104
  {
25449
26105
  "name": "useNavigate",
25450
26106
  "kind": "function",
25451
26107
  "package": "@nifrajs/web-vue",
25452
26108
  "signature": "export declare function useNavigate(): NavigateFunction;",
25453
- "doc": "/** Get the {@link NavigateFunction} (a string path, a history delta, or a typed `{ to, search }` object).\n * Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops\n * before then / on the server. */"
26109
+ "doc": "/** Get the {@link NavigateFunction} (an `Href` from `href()` or `rawHref()`, or a history delta).\n * Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops\n * before then / on the server. */"
25454
26110
  },
25455
26111
  {
25456
26112
  "name": "useNavigation",
@@ -25730,6 +26386,13 @@
25730
26386
  "signature": "export declare function validateUpload(input: Uint8Array | ArrayBuffer | Blob, options: ValidateUploadOptions): Promise<UploadResult>;",
25731
26387
  "doc": "/** Validate uploaded bytes/Blob: size cap + magic-byte type sniff against an optional allow-list. */"
25732
26388
  },
26389
+ {
26390
+ "name": "validateVercelRuntime",
26391
+ "kind": "function",
26392
+ "package": "@nifrajs/web",
26393
+ "signature": "export declare function validateVercelRuntime(target: BuildTarget, runtime: unknown): void;",
26394
+ "doc": "/** Validate before any deploy directory is cleared, including untyped config/API callers. */"
26395
+ },
25733
26396
  {
25734
26397
  "name": "vanillaAdapter",
25735
26398
  "kind": "const",
@@ -25737,6 +26400,20 @@
25737
26400
  "signature": "export declare const vanillaAdapter: RenderAdapter;",
25738
26401
  "doc": "/** The zero-framework server render adapter - pass to @nifrajs/web's `renderPage`/`createWebApp`. */"
25739
26402
  },
26403
+ {
26404
+ "name": "varyOn",
26405
+ "kind": "function",
26406
+ "package": "@nifrajs/core",
26407
+ "signature": "export declare function varyOn(value: string | null, names: readonly string[]): string;",
26408
+ "doc": "/**\n * A `Vary` header value (`null` when the response has none) that names each of `names` once, matched\n * without regard to case. `Vary: *` already covers every request header, so it comes back unchanged.\n */"
26409
+ },
26410
+ {
26411
+ "name": "varyOn",
26412
+ "kind": "function",
26413
+ "package": "nifra",
26414
+ "signature": "export declare function varyOn(value: string | null, names: readonly string[]): string;",
26415
+ "doc": "/**\n * A `Vary` header value (`null` when the response has none) that names each of `names` once, matched\n * without regard to case. `Vary: *` already covers every request header, so it comes back unchanged.\n */"
26416
+ },
25740
26417
  {
25741
26418
  "name": "vectorAdvances",
25742
26419
  "kind": "function",
@@ -25949,6 +26626,13 @@
25949
26626
  "signature": "export declare function withISR(app: ISRApp, options: ISROptions): (req: Request, platform?: ISRPlatform) => Promise<Response>;",
25950
26627
  "doc": "/**\n * Wrap a nifra app with **Incremental Static Regeneration**: a cacheable page is served from\n * {@link CacheStore} when fresh, served **stale while a fresh copy regenerates in the background**\n * (`platform.waitUntil` on edge), or rendered + stored on a miss. Framework-agnostic (it caches the\n * rendered bytes). Returns a `fetch(req, platform?)` handler - hand it to `Bun.serve`/the Workers\n * `export default`, etc. Regeneration is single-flight per key (no stampede on a hot stale page).\n *\n * Each route's freshness comes from the `revalidate` header the app sets (per-route\n * `export const revalidate`), falling back to `options.revalidate`. Only full-document `text/html`\n * GET 200s are cached; everything else (assets, data-mode GETs, redirects, errors) passes through.\n */"
25951
26628
  },
26629
+ {
26630
+ "name": "withIdleTimeout",
26631
+ "kind": "function",
26632
+ "package": "@nifrajs/core",
26633
+ "signature": "export declare function withIdleTimeout<T>(c: Context, seconds: number, work: () => MaybePromise<T>): MaybePromise<T>;",
26634
+ "doc": "/**\n * Run `work` with the idle timeout of the request's connection set to `seconds` (`0` turns it off),\n * then put back the listener's.\n *\n * Bun closes a connection that moves no bytes for `listen()`'s `idleTimeoutSec` seconds (10 by\n * default), and a handler that is still working sends none, so an export or a long upstream call is\n * cut mid-flight. Raising `idleTimeoutSec` raises it for every connection, idle keep-alive ones\n * included; this raises it for one request. The listener's value is back before the response goes\n * out because Bun keeps the last value on the socket for the requests that follow on it, so a value\n * left in place would hold an idle connection open.\n *\n * The request's deadline (`requestTimeoutMs`, an inbound deadline) still bounds the response: when it\n * fires, the 503 is sent with the listener's timeout back and `c.signal` aborts, but `work`\n * keeps running unless it stops on that signal. Scopes nest: while several run on one request the\n * longest applies, and `0` outlasts any number. `seconds` runs from 0 to 255, the longest Bun holds\n * an idle connection; work that may idle longer takes `0`.\n *\n * A streamed response is sent after the handler returns, so call this inside the stream's producer\n * to hold it until the last chunk. Off `listen()` - another adapter, `app.fetch` in a test - it runs\n * `work` unchanged.\n *\n * @example\n * ```ts\n * import { withIdleTimeout } from \"@nifrajs/core/idle-timeout\"\n *\n * app.post(\"/exports\", (c) => withIdleTimeout(c, 0, () => buildExport(c.body)))\n * // Every route declared after this one:\n * app.around((c, next) => withIdleTimeout(c, 120, next))\n * ```\n */"
26635
+ },
25952
26636
  {
25953
26637
  "name": "withResponseObserver",
25954
26638
  "kind": "function",