@nifrajs/cli 5.12.1 → 5.14.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 (379) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +3 -1
  3. package/dist/agent-files.js +0 -74
  4. package/dist/agent-files.js.map +1 -1
  5. package/dist/app-files.js +0 -19
  6. package/dist/app-files.js.map +1 -1
  7. package/dist/assure-hydration.js +0 -23
  8. package/dist/assure-hydration.js.map +1 -1
  9. package/dist/assure.js +0 -14
  10. package/dist/assure.js.map +1 -1
  11. package/dist/capabilities-tool.js +0 -51
  12. package/dist/capabilities-tool.js.map +1 -1
  13. package/dist/cdn-check.js +0 -2
  14. package/dist/cdn-check.js.map +1 -1
  15. package/dist/check-diagnostics.js +0 -29
  16. package/dist/check-diagnostics.js.map +1 -1
  17. package/dist/check-scan.js +10 -621
  18. package/dist/check-scan.js.map +1 -1
  19. package/dist/check.js +0 -86
  20. package/dist/check.js.map +1 -1
  21. package/dist/cli.d.ts +9 -2
  22. package/dist/cli.d.ts.map +1 -1
  23. package/dist/cli.js +139 -351
  24. package/dist/cli.js.map +1 -1
  25. package/dist/client-module.js +0 -13
  26. package/dist/client-module.js.map +1 -1
  27. package/dist/command-catalog.d.ts +29 -1
  28. package/dist/command-catalog.d.ts.map +1 -1
  29. package/dist/command-catalog.js +100 -23
  30. package/dist/command-catalog.js.map +1 -1
  31. package/dist/component-check.js +1 -7
  32. package/dist/component-check.js.map +1 -1
  33. package/dist/config-target.js +0 -13
  34. package/dist/config-target.js.map +1 -1
  35. package/dist/contract-proof.js +0 -1
  36. package/dist/contract-proof.js.map +1 -1
  37. package/dist/contracts.js +0 -36
  38. package/dist/contracts.js.map +1 -1
  39. package/dist/db-audit.js +0 -15
  40. package/dist/db-audit.js.map +1 -1
  41. package/dist/db-child.js +0 -20
  42. package/dist/db-child.js.map +1 -1
  43. package/dist/db-config.js +0 -23
  44. package/dist/db-config.js.map +1 -1
  45. package/dist/db-tool.js +0 -24
  46. package/dist/db-tool.js.map +1 -1
  47. package/dist/deployment-adapters.d.ts +12 -0
  48. package/dist/deployment-adapters.d.ts.map +1 -0
  49. package/dist/deployment-adapters.js +86 -0
  50. package/dist/deployment-adapters.js.map +1 -0
  51. package/dist/dev-bun-config.d.ts +4 -3
  52. package/dist/dev-bun-config.d.ts.map +1 -1
  53. package/dist/dev-bun-config.js +9 -101
  54. package/dist/dev-bun-config.js.map +1 -1
  55. package/dist/dev-feed-tool.js +0 -32
  56. package/dist/dev-feed-tool.js.map +1 -1
  57. package/dist/dev-server-client.js +0 -16
  58. package/dist/dev-server-client.js.map +1 -1
  59. package/dist/diagnostics.js +0 -10
  60. package/dist/diagnostics.js.map +1 -1
  61. package/dist/diff-tool.js +0 -23
  62. package/dist/diff-tool.js.map +1 -1
  63. package/dist/docs-search.js +0 -35
  64. package/dist/docs-search.js.map +1 -1
  65. package/dist/doctor.js +3 -161
  66. package/dist/doctor.js.map +1 -1
  67. package/dist/env-file.js +0 -66
  68. package/dist/env-file.js.map +1 -1
  69. package/dist/examples.js +0 -16
  70. package/dist/examples.js.map +1 -1
  71. package/dist/fix-recipes.js +0 -20
  72. package/dist/fix-recipes.js.map +1 -1
  73. package/dist/frontend-guidance.js +0 -36
  74. package/dist/frontend-guidance.js.map +1 -1
  75. package/dist/hand-built-manifest.js +0 -17
  76. package/dist/hand-built-manifest.js.map +1 -1
  77. package/dist/hooks-report.js +0 -4
  78. package/dist/hooks-report.js.map +1 -1
  79. package/dist/i18n-check.js +0 -30
  80. package/dist/i18n-check.js.map +1 -1
  81. package/dist/init-agents.d.ts +5 -0
  82. package/dist/init-agents.d.ts.map +1 -1
  83. package/dist/init-agents.js +2 -134
  84. package/dist/init-agents.js.map +1 -1
  85. package/dist/internal/code-unit-order.js +0 -2
  86. package/dist/internal/code-unit-order.js.map +1 -1
  87. package/dist/internal/config-paths.js +0 -12
  88. package/dist/internal/config-paths.js.map +1 -1
  89. package/dist/internal/control-character.js +0 -1
  90. package/dist/internal/control-character.js.map +1 -1
  91. package/dist/internal/escape-regexp.d.ts +1 -2
  92. package/dist/internal/escape-regexp.d.ts.map +1 -1
  93. package/dist/internal/escape-regexp.js +1 -4
  94. package/dist/internal/escape-regexp.js.map +1 -1
  95. package/dist/internal/git-ignored.js +0 -11
  96. package/dist/internal/git-ignored.js.map +1 -1
  97. package/dist/internal/installed-package.js +0 -2
  98. package/dist/internal/installed-package.js.map +1 -1
  99. package/dist/internal/line-at.js +0 -1
  100. package/dist/internal/line-at.js.map +1 -1
  101. package/dist/internal/nifra-project.js +0 -31
  102. package/dist/internal/nifra-project.js.map +1 -1
  103. package/dist/internal/posix-path.js +0 -1
  104. package/dist/internal/posix-path.js.map +1 -1
  105. package/dist/internal/project-specifiers.js +0 -34
  106. package/dist/internal/project-specifiers.js.map +1 -1
  107. package/dist/internal/realpath-or-self.js +0 -1
  108. package/dist/internal/realpath-or-self.js.map +1 -1
  109. package/dist/internal/record.d.ts +1 -1
  110. package/dist/internal/record.d.ts.map +1 -1
  111. package/dist/internal/record.js +1 -4
  112. package/dist/internal/record.js.map +1 -1
  113. package/dist/internal/reserved-segment-codemod.js +0 -44
  114. package/dist/internal/reserved-segment-codemod.js.map +1 -1
  115. package/dist/internal/script-kind.js +0 -5
  116. package/dist/internal/script-kind.js.map +1 -1
  117. package/dist/internal/source-facts.js +3 -37
  118. package/dist/internal/source-facts.js.map +1 -1
  119. package/dist/internal/typescript-import.js +0 -49
  120. package/dist/internal/typescript-import.js.map +1 -1
  121. package/dist/internal/workspace-packages.js +0 -24
  122. package/dist/internal/workspace-packages.js.map +1 -1
  123. package/dist/introspect.js +1 -89
  124. package/dist/introspect.js.map +1 -1
  125. package/dist/learn.js +0 -16
  126. package/dist/learn.js.map +1 -1
  127. package/dist/levels-tool.js +0 -34
  128. package/dist/levels-tool.js.map +1 -1
  129. package/dist/load.d.ts +12 -3
  130. package/dist/load.d.ts.map +1 -1
  131. package/dist/load.js +19 -75
  132. package/dist/load.js.map +1 -1
  133. package/dist/local-cli.js +0 -23
  134. package/dist/local-cli.js.map +1 -1
  135. package/dist/lock-links.js +0 -20
  136. package/dist/lock-links.js.map +1 -1
  137. package/dist/manifest-tool.js +0 -5
  138. package/dist/manifest-tool.js.map +1 -1
  139. package/dist/mcp-app-tool.js +0 -9
  140. package/dist/mcp-app-tool.js.map +1 -1
  141. package/dist/mcp-context.js +0 -30
  142. package/dist/mcp-context.js.map +1 -1
  143. package/dist/mcp-delegate.js +0 -45
  144. package/dist/mcp-delegate.js.map +1 -1
  145. package/dist/mcp-docs-tools.js +0 -13
  146. package/dist/mcp-docs-tools.js.map +1 -1
  147. package/dist/mcp-exec.js +0 -71
  148. package/dist/mcp-exec.js.map +1 -1
  149. package/dist/mcp-http.js +1 -38
  150. package/dist/mcp-http.js.map +1 -1
  151. package/dist/mcp-io.d.ts +5 -1
  152. package/dist/mcp-io.d.ts.map +1 -1
  153. package/dist/mcp-io.js +3 -68
  154. package/dist/mcp-io.js.map +1 -1
  155. package/dist/mcp-isolate.js +0 -28
  156. package/dist/mcp-isolate.js.map +1 -1
  157. package/dist/mcp-path.js +0 -8
  158. package/dist/mcp-path.js.map +1 -1
  159. package/dist/mcp-project-child.js +0 -19
  160. package/dist/mcp-project-child.js.map +1 -1
  161. package/dist/mcp-protocol.js +0 -5
  162. package/dist/mcp-protocol.js.map +1 -1
  163. package/dist/mcp-reflect.js +0 -11
  164. package/dist/mcp-reflect.js.map +1 -1
  165. package/dist/mcp-relay.d.ts +4 -0
  166. package/dist/mcp-relay.d.ts.map +1 -1
  167. package/dist/mcp-relay.js +9 -20
  168. package/dist/mcp-relay.js.map +1 -1
  169. package/dist/mcp-render.js +1 -42
  170. package/dist/mcp-render.js.map +1 -1
  171. package/dist/mcp-root.d.ts.map +1 -1
  172. package/dist/mcp-root.js +18 -90
  173. package/dist/mcp-root.js.map +1 -1
  174. package/dist/mcp-run.js +1 -38
  175. package/dist/mcp-run.js.map +1 -1
  176. package/dist/mcp-tool-meta.js +3 -8
  177. package/dist/mcp-tool-meta.js.map +1 -1
  178. package/dist/mcp-ws.js +0 -16
  179. package/dist/mcp-ws.js.map +1 -1
  180. package/dist/mcp.js +0 -86
  181. package/dist/mcp.js.map +1 -1
  182. package/dist/migrate-layout.js +0 -313
  183. package/dist/migrate-layout.js.map +1 -1
  184. package/dist/openapi-tool.js +0 -18
  185. package/dist/openapi-tool.js.map +1 -1
  186. package/dist/openapi-types.js +0 -22
  187. package/dist/openapi-types.js.map +1 -1
  188. package/dist/output-schemas.js +0 -67
  189. package/dist/output-schemas.js.map +1 -1
  190. package/dist/pipeline-guard.js +0 -58
  191. package/dist/pipeline-guard.js.map +1 -1
  192. package/dist/pipeline-report.js +0 -71
  193. package/dist/pipeline-report.js.map +1 -1
  194. package/dist/port.d.ts +6 -3
  195. package/dist/port.d.ts.map +1 -1
  196. package/dist/port.js +16 -92
  197. package/dist/port.js.map +1 -1
  198. package/dist/ppr-read-fix.js +0 -29
  199. package/dist/ppr-read-fix.js.map +1 -1
  200. package/dist/project-facts.js +0 -5
  201. package/dist/project-facts.js.map +1 -1
  202. package/dist/project-path.js +0 -7
  203. package/dist/project-path.js.map +1 -1
  204. package/dist/project-site.js +0 -2
  205. package/dist/project-site.js.map +1 -1
  206. package/dist/recipes/1.8.0.js +0 -9
  207. package/dist/recipes/1.8.0.js.map +1 -1
  208. package/dist/recipes/2.0.0.js +0 -6
  209. package/dist/recipes/2.0.0.js.map +1 -1
  210. package/dist/recipes/3.0.0.js +0 -7
  211. package/dist/recipes/3.0.0.js.map +1 -1
  212. package/dist/recipes/4.0.0.js +0 -6
  213. package/dist/recipes/4.0.0.js.map +1 -1
  214. package/dist/recipes/5.0.0.js +0 -8
  215. package/dist/recipes/5.0.0.js.map +1 -1
  216. package/dist/recipes/5.1.0.js +0 -6
  217. package/dist/recipes/5.1.0.js.map +1 -1
  218. package/dist/recipes/5.10.0.js +0 -10
  219. package/dist/recipes/5.10.0.js.map +1 -1
  220. package/dist/recipes/5.11.0.js +0 -7
  221. package/dist/recipes/5.11.0.js.map +1 -1
  222. package/dist/recipes/5.12.0.js +0 -6
  223. package/dist/recipes/5.12.0.js.map +1 -1
  224. package/dist/recipes/5.13.0.d.ts +9 -0
  225. package/dist/recipes/5.13.0.d.ts.map +1 -0
  226. package/dist/recipes/5.13.0.js +34 -0
  227. package/dist/recipes/5.13.0.js.map +1 -0
  228. package/dist/recipes/5.14.0.d.ts +10 -0
  229. package/dist/recipes/5.14.0.d.ts.map +1 -0
  230. package/dist/recipes/5.14.0.js +26 -0
  231. package/dist/recipes/5.14.0.js.map +1 -0
  232. package/dist/recipes/5.2.0.js +0 -7
  233. package/dist/recipes/5.2.0.js.map +1 -1
  234. package/dist/recipes/5.3.0.js +0 -8
  235. package/dist/recipes/5.3.0.js.map +1 -1
  236. package/dist/recipes/5.4.0.js +0 -8
  237. package/dist/recipes/5.4.0.js.map +1 -1
  238. package/dist/recipes/5.5.0.js +0 -6
  239. package/dist/recipes/5.5.0.js.map +1 -1
  240. package/dist/recipes/5.6.0.js +0 -7
  241. package/dist/recipes/5.6.0.js.map +1 -1
  242. package/dist/recipes/5.7.0.js +0 -9
  243. package/dist/recipes/5.7.0.js.map +1 -1
  244. package/dist/recipes/5.8.0.js +0 -6
  245. package/dist/recipes/5.8.0.js.map +1 -1
  246. package/dist/recipes/5.9.0.js +0 -9
  247. package/dist/recipes/5.9.0.js.map +1 -1
  248. package/dist/recipes/index.d.ts.map +1 -1
  249. package/dist/recipes/index.js +4 -9
  250. package/dist/recipes/index.js.map +1 -1
  251. package/dist/release-verification.js +0 -14
  252. package/dist/release-verification.js.map +1 -1
  253. package/dist/replay.js +0 -3
  254. package/dist/replay.js.map +1 -1
  255. package/dist/review.js +0 -21
  256. package/dist/review.js.map +1 -1
  257. package/dist/route-types.js +0 -17
  258. package/dist/route-types.js.map +1 -1
  259. package/dist/rule-explain.js +0 -5
  260. package/dist/rule-explain.js.map +1 -1
  261. package/dist/rules/codes.js +0 -2
  262. package/dist/rules/codes.js.map +1 -1
  263. package/dist/rules/comment-markers.js +0 -25
  264. package/dist/rules/comment-markers.js.map +1 -1
  265. package/dist/rules/contract-visibility.js +0 -27
  266. package/dist/rules/contract-visibility.js.map +1 -1
  267. package/dist/rules/data-guard.js +1 -52
  268. package/dist/rules/data-guard.js.map +1 -1
  269. package/dist/rules/internal-links.js +0 -36
  270. package/dist/rules/internal-links.js.map +1 -1
  271. package/dist/rules/islands.js +2 -65
  272. package/dist/rules/islands.js.map +1 -1
  273. package/dist/rules/layout.js +0 -1
  274. package/dist/rules/layout.js.map +1 -1
  275. package/dist/rules/legacy.js +0 -31
  276. package/dist/rules/legacy.js.map +1 -1
  277. package/dist/rules/merge-auth.js +0 -9
  278. package/dist/rules/merge-auth.js.map +1 -1
  279. package/dist/rules/pages.js +0 -95
  280. package/dist/rules/pages.js.map +1 -1
  281. package/dist/rules/ppr.js +0 -8
  282. package/dist/rules/ppr.js.map +1 -1
  283. package/dist/rules/route-statement.js +0 -13
  284. package/dist/rules/route-statement.js.map +1 -1
  285. package/dist/rules/routes.js +1 -67
  286. package/dist/rules/routes.js.map +1 -1
  287. package/dist/rules/secrets.js +0 -15
  288. package/dist/rules/secrets.js.map +1 -1
  289. package/dist/rules/security.js +0 -113
  290. package/dist/rules/security.js.map +1 -1
  291. package/dist/rules/server-fn-namespace.js +0 -5
  292. package/dist/rules/server-fn-namespace.js.map +1 -1
  293. package/dist/rules/source-scan.js +0 -5
  294. package/dist/rules/source-scan.js.map +1 -1
  295. package/dist/rules/swap.js +0 -21
  296. package/dist/rules/swap.js.map +1 -1
  297. package/dist/rules/text-slot-boolean.js +0 -5
  298. package/dist/rules/text-slot-boolean.js.map +1 -1
  299. package/dist/rules/typescript.js +0 -5
  300. package/dist/rules/typescript.js.map +1 -1
  301. package/dist/rules/undeclared-response.js +0 -8
  302. package/dist/rules/undeclared-response.js.map +1 -1
  303. package/dist/rules/zones.js +0 -45
  304. package/dist/rules/zones.js.map +1 -1
  305. package/dist/runtime-differences.js +0 -20
  306. package/dist/runtime-differences.js.map +1 -1
  307. package/dist/scaffold-hole.js +1 -45
  308. package/dist/scaffold-hole.js.map +1 -1
  309. package/dist/scaffold.js +3 -60
  310. package/dist/scaffold.js.map +1 -1
  311. package/dist/sdk.js +1 -13
  312. package/dist/sdk.js.map +1 -1
  313. package/dist/search-terms.js +0 -12
  314. package/dist/search-terms.js.map +1 -1
  315. package/dist/shell-files.d.ts +44 -0
  316. package/dist/shell-files.d.ts.map +1 -0
  317. package/dist/shell-files.js +186 -0
  318. package/dist/shell-files.js.map +1 -0
  319. package/dist/shell-init.d.ts +33 -0
  320. package/dist/shell-init.d.ts.map +1 -0
  321. package/dist/shell-init.js +84 -0
  322. package/dist/shell-init.js.map +1 -0
  323. package/dist/smoke.js +0 -4
  324. package/dist/smoke.js.map +1 -1
  325. package/dist/source-rewrites.js +0 -43
  326. package/dist/source-rewrites.js.map +1 -1
  327. package/dist/stylex-migrate.js +0 -29
  328. package/dist/stylex-migrate.js.map +1 -1
  329. package/dist/symptom-search.js +0 -3
  330. package/dist/symptom-search.js.map +1 -1
  331. package/dist/sync-manifest.js +3 -33
  332. package/dist/sync-manifest.js.map +1 -1
  333. package/dist/test-tool.js +0 -10
  334. package/dist/test-tool.js.map +1 -1
  335. package/dist/typecheck-coverage.js +0 -36
  336. package/dist/typecheck-coverage.js.map +1 -1
  337. package/dist/types-search.js +0 -35
  338. package/dist/types-search.js.map +1 -1
  339. package/dist/upgrade.js +0 -214
  340. package/dist/upgrade.js.map +1 -1
  341. package/dist/verification-plan.js +0 -19
  342. package/dist/verification-plan.js.map +1 -1
  343. package/dist/verification.js +0 -23
  344. package/dist/verification.js.map +1 -1
  345. package/dist/version-drift.js +0 -8
  346. package/dist/version-drift.js.map +1 -1
  347. package/dist/web-app-options.js +0 -16
  348. package/dist/web-app-options.js.map +1 -1
  349. package/dist/work-graph.js +0 -21
  350. package/dist/work-graph.js.map +1 -1
  351. package/dist/workspace-link.js +0 -31
  352. package/dist/workspace-link.js.map +1 -1
  353. package/docs/examples.json +97 -1
  354. package/docs/llms-full.txt +1347 -59
  355. package/docs/types.json +756 -37
  356. package/package.json +12 -11
  357. package/src/assure-hydration.ts +3 -3
  358. package/src/cli.ts +189 -39
  359. package/src/command-catalog.ts +144 -7
  360. package/src/deployment-adapters.ts +107 -0
  361. package/src/dev-bun-config.ts +21 -2
  362. package/src/init-agents.ts +1 -1
  363. package/src/internal/escape-regexp.ts +1 -4
  364. package/src/internal/record.ts +1 -3
  365. package/src/internal/typescript-import.ts +1 -1
  366. package/src/load.ts +36 -3
  367. package/src/mcp-http.ts +1 -1
  368. package/src/mcp-io.ts +8 -5
  369. package/src/mcp-relay.ts +19 -7
  370. package/src/mcp-render.ts +1 -1
  371. package/src/mcp-root.ts +21 -3
  372. package/src/mcp-tool-meta.ts +3 -3
  373. package/src/port.ts +25 -8
  374. package/src/recipes/5.13.0.ts +41 -0
  375. package/src/recipes/5.14.0.ts +34 -0
  376. package/src/recipes/index.ts +4 -0
  377. package/src/rules/routes.ts +2 -2
  378. package/src/shell-files.ts +225 -0
  379. package/src/shell-init.ts +139 -0
package/docs/types.json CHANGED
@@ -157,6 +157,30 @@
157
157
  "package": "@nifrajs/acp",
158
158
  "signature": "export interface AcpClientInfo {\n readonly name: string;\n readonly title?: string;\n readonly version: string;\n}"
159
159
  },
160
+ {
161
+ "name": "ActDecision",
162
+ "kind": "type",
163
+ "package": "@nifrajs/e2e",
164
+ "signature": "export type ActDecision = {\n readonly kind: \"tap\";\n readonly target: Target;\n} | {\n readonly kind: \"fill\";\n readonly target: Target;\n readonly value: string;\n} | {\n readonly kind: \"press\";\n readonly target: Target;\n readonly key: string;\n} | {\n readonly kind: \"goto\";\n readonly path: string;\n} | {\n readonly kind: \"done\";\n readonly summary?: string;\n} | {\n readonly kind: \"fail\";\n readonly reason: string;\n};"
165
+ },
166
+ {
167
+ "name": "ActOptions",
168
+ "kind": "interface",
169
+ "package": "@nifrajs/e2e",
170
+ "signature": "export interface ActOptions extends StepOptions {\n /** Model decisions one goal may use. Default 12. */\n readonly maxModelCalls?: number;\n /** Page actions one goal may take, failed ones included. Default 25. */\n readonly maxActions?: number;\n /** ms for the whole goal on the session clock. Default 120000. */\n readonly timeout?: number;\n}"
171
+ },
172
+ {
173
+ "name": "ActRequest",
174
+ "kind": "interface",
175
+ "package": "@nifrajs/e2e",
176
+ "signature": "export interface ActRequest {\n readonly kind: \"act\";\n readonly goal: string;\n readonly context?: string;\n readonly snapshot: string;\n readonly history: readonly ActionRecord[];\n /** Names of params whose values stay out of the goal and the snapshot; write `{name}` to type one. */\n readonly secrets: readonly string[];\n readonly modelCallsLeft: number;\n readonly actionsLeft: number;\n readonly handoff: HandOff | undefined;\n readonly signal: AbortSignal;\n}"
177
+ },
178
+ {
179
+ "name": "ActResult",
180
+ "kind": "interface",
181
+ "package": "@nifrajs/e2e",
182
+ "signature": "export interface ActResult {\n /** `replay`: no model call. `handoff`: a recording stopped and the model finished the goal. */\n readonly source: \"model\" | \"replay\" | \"handoff\";\n readonly modelCalls: number;\n /** The actions the page accepted, in order. */\n readonly actions: readonly PerformedDecision[];\n readonly summary?: string;\n}"
183
+ },
160
184
  {
161
185
  "name": "Action",
162
186
  "kind": "type",
@@ -178,6 +202,13 @@
178
202
  "signature": "export type ActionData<A> = A extends (...args: never[]) => infer R ? Awaited<R> extends infer D ? D extends {\n readonly __nifraRevalidate: readonly string[];\n readonly data: infer W;\n} ? Exclude<W, Response> : Exclude<D, Response> : never : never;",
179
203
  "doc": "/**\n * The (awaited) data return of an `action`, for typing a page component's `actionData` prop.\n * A `Response` return (redirect/custom) is excluded - it never reaches the component. A\n * `revalidate(paths, data)` wrapper (from `@nifrajs/web`) is transparent: matched structurally (so this\n * stays decoupled from `@nifrajs/web`) and unwrapped to its inner `data` - what the component receives.\n */"
180
204
  },
205
+ {
206
+ "name": "ActionRecord",
207
+ "kind": "interface",
208
+ "package": "@nifrajs/e2e",
209
+ "signature": "export interface ActionRecord {\n readonly action: PerformedDecision;\n readonly ok: boolean;\n readonly error?: string;\n}",
210
+ "doc": "/** One thing the agent tried inside a goal, and whether the page took it. */"
211
+ },
181
212
  {
182
213
  "name": "ActiveObservation",
183
214
  "kind": "interface",
@@ -327,6 +358,12 @@
327
358
  "signature": "export interface AgUIRunUsage {\n readonly provider?: string;\n readonly model?: string;\n readonly inputTokens?: number;\n readonly outputTokens?: number;\n readonly totalTokens?: number;\n readonly reasoningTokens?: number;\n readonly cachedInputTokens?: number;\n}",
328
359
  "doc": "/**\n * One aggregated token-usage entry in the spec's `RUN_FINISHED.usage` array: the model port's\n * `usage` deltas summed per `(provider, model)` pair, matching AG-UI's `TokenUsage` shape.\n */"
329
360
  },
361
+ {
362
+ "name": "Agent",
363
+ "kind": "interface",
364
+ "package": "@nifrajs/e2e",
365
+ "signature": "export interface Agent {\n report(): AgentReport;\n act(goal: string, options?: ActOptions): Promise<ActResult>;\n assert(statement: string, options?: StepOptions): Promise<void>;\n waitFor(statement: string, options?: WaitForOptions): Promise<void>;\n extract<S extends StandardSchemaV1>(prompt: string, options: ExtractOptions<S>): Promise<InferOutput<S>>;\n}"
366
+ },
330
367
  {
331
368
  "name": "AgentAppClient",
332
369
  "kind": "class",
@@ -772,6 +809,13 @@
772
809
  "package": "@nifrajs/agent-protocol",
773
810
  "signature": "export interface AgentRepairTask {\n readonly id: string;\n readonly verification: \"check\" | \"assure\" | \"test\";\n readonly cwd: string;\n readonly reason: string;\n readonly capabilities: readonly string[];\n readonly output?: string;\n readonly report?: unknown;\n}"
774
811
  },
812
+ {
813
+ "name": "AgentReport",
814
+ "kind": "interface",
815
+ "package": "@nifrajs/e2e",
816
+ "signature": "export interface AgentReport {\n readonly replayed: number;\n readonly handedOff: number;\n readonly missed: number;\n readonly modelCalls: number;\n}",
817
+ "doc": "/** What the replay cache did for this session, and how many model calls it still took. */"
818
+ },
775
819
  {
776
820
  "name": "AgentResumeMismatchError",
777
821
  "kind": "class",
@@ -2319,7 +2363,7 @@
2319
2363
  "name": "BuildClientOptions",
2320
2364
  "kind": "interface",
2321
2365
  "package": "@nifrajs/web",
2322
- "signature": "export interface BuildClientOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the bundle + `manifest.json` (absolute path). */\n readonly outDir: string;\n /** The adapter's client runtime (exports `mountRouter`), e.g. `\"@nifrajs/web-solid/client\"`. */\n readonly clientModule: string;\n /** Route/layout file → import specifier (default: `${routesDir}/${file}`). */\n readonly resolve?: (file: string) => string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"dom\")`). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` export conditions (e.g. `[\"bun\", \"solid\", \"browser\"]`). */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (e.g. `{ \"process.env.NODE_ENV\": '\"production\"' }`). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** URL prefix the assets are served under (default `\"/assets/\"`); also Bun's chunk `publicPath`. */\n readonly publicPath?: string;\n /**\n * Directory of user-authored static files copied into the build and served at the root (default\n * `\"public\"`). Absent directory ⇒ nothing copied, no error.\n *\n * NOT the same thing as {@link publicPath}, despite the names: that is the URL prefix for\n * content-hashed bundle chunks and never covers files an author put on disk. The collision is a\n * real source of confusion, which is why both are spelled out here.\n */\n readonly publicDir?: string | false;\n /**\n * Prefix that opts an environment variable into the **client** bundle (Vite/Next convention; default\n * `\"PUBLIC_\"`). Every var in the build environment whose name starts with this prefix is baked into\n * the client `define` as `\"process.env.NAME\": JSON.stringify(value)`, so `process.env.PUBLIC_API_URL`\n * compiles to its literal value in the browser. Vars WITHOUT the prefix are never exposed - the bare\n * `process.env` define resolves them to `undefined`, so server secrets can't leak into the client\n * bundle. Set to `\"\"` to disable auto-exposure entirely (no var is baked in). `options.define` still\n * wins over an auto-exposed var (it's layered last). Sourced from `Bun.env` (falls back to\n * `process.env`) at build time. */\n readonly publicEnvPrefix?: string;\n /**\n * Reviewed false positives of the secret scan, which fails the build when a bundle, source map or\n * `public/` file carries what looks like a credential or the value of a non-public environment\n * variable. Each names its rule, its file (or, for an environment value, its variable) and a reason.\n */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Move copy tables (`@nifrajs/i18n/copy`) into one chunk per locale, so a page's JavaScript carries\n * only the copy of the locale it renders in (default: on when minifying). The server bundle keeps\n * every table whole; the server entry passes the manifest's `copyChunks` to `createWebApp`.\n */\n readonly copySplit?: boolean;\n /**\n * The server runs `createWebApp({ live })`: the client entry sends route loads through its live load\n * endpoint and keeps what is on screen fresh: the runtime's `clientEntry`.\n */\n readonly live?: LiveClientEntry | undefined;\n}"
2366
+ "signature": "export interface BuildClientOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the bundle + `manifest.json` (absolute path). */\n readonly outDir: string;\n /** The adapter's client runtime (exports `mountRouter`), e.g. `\"@nifrajs/web-solid/client\"`. */\n readonly clientModule: string;\n /** Route/layout file → import specifier (default: `${routesDir}/${file}`). */\n readonly resolve?: (file: string) => string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"dom\")`). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` export conditions (e.g. `[\"bun\", \"solid\", \"browser\"]`). */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (e.g. `{ \"process.env.NODE_ENV\": '\"production\"' }`). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** URL prefix the assets are served under (default `\"/assets/\"`); also Bun's chunk `publicPath`. */\n readonly publicPath?: string;\n /**\n * Directory of user-authored static files copied into the build and served at the root (default\n * `\"public\"`). Absent directory ⇒ nothing copied, no error.\n *\n * NOT the same thing as {@link publicPath}, despite the names: that is the URL prefix for\n * content-hashed bundle chunks and never covers files an author put on disk. The collision is a\n * real source of confusion, which is why both are spelled out here.\n */\n readonly publicDir?: string | false;\n /**\n * Prefix that opts an environment variable into the **client** bundle (Vite/Next convention; default\n * `\"PUBLIC_\"`). Every var in the build environment whose name starts with this prefix is baked into\n * the client `define` as `\"process.env.NAME\": JSON.stringify(value)`, so `process.env.PUBLIC_API_URL`\n * compiles to its literal value in the browser. Vars WITHOUT the prefix are never exposed - the bare\n * `process.env` define resolves them to `undefined`, so server secrets can't leak into the client\n * bundle. Set to `\"\"` to disable auto-exposure entirely (no var is baked in). `options.define` still\n * wins over an auto-exposed var (it's layered last). Sourced from `Bun.env` (falls back to\n * `process.env`) at build time. */\n readonly publicEnvPrefix?: string;\n /**\n * Reviewed false positives of the secret scan, which fails the build when a bundle, source map or\n * `public/` file carries what looks like a credential or the value of a non-public environment\n * variable. Each names its rule, its file (or, for an environment value, its variable) and a reason.\n */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Move copy tables (`@nifrajs/i18n/copy`) into one chunk per locale, so a page's JavaScript carries\n * only the copy of the locale it renders in (default: on when minifying). The server bundle keeps\n * every table whole; the server entry passes the manifest's `copyChunks` to `createWebApp`.\n */\n readonly copySplit?: boolean;\n /**\n * The server runs `createWebApp({ live })`: the client entry sends route loads through its live load\n * endpoint and keeps what is on screen fresh: the runtime's `clientEntry`.\n */\n readonly live?: LiveClientEntry | undefined;\n /**\n * A module whose default export is the `fetch` the client router reaches its server through (see\n * {@link serverFetch}). For pages that ship inside a native shell while the server lives elsewhere:\n * the route-data GETs, prefetches and action POSTs go through it.\n */\n readonly transport?: string | undefined;\n}"
2323
2367
  },
2324
2368
  {
2325
2369
  "name": "BuildClientViteOptions",
@@ -2375,7 +2419,7 @@
2375
2419
  "name": "BuildTargetOptions",
2376
2420
  "kind": "interface",
2377
2421
  "package": "@nifrajs/web",
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}"
2422
+ "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 /** `static` only: pages to prerender for this build whether or not their route exports `prerender`, by\n * path. A shell build uses it to ship the page the shell opens on without making a web build of the\n * same app serve that page as a snapshot. Refused for any other target. */\n readonly prerenderPaths?: readonly string[] | undefined;\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 /** A module whose default export is the `fetch` the client router reaches its server through: see\n * {@link BuildClientOptions.transport}. */\n readonly transport?: string | undefined;\n}"
2379
2423
  },
2380
2424
  {
2381
2425
  "name": "BuildTargetPlan",
@@ -2400,7 +2444,7 @@
2400
2444
  "name": "Bundler",
2401
2445
  "kind": "interface",
2402
2446
  "package": "@nifrajs/web",
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}",
2447
+ "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 /** The router's server `fetch` module (`BuildClientOptions.transport`). */\n readonly transport?: string | 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}",
2404
2448
  "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 */"
2405
2449
  },
2406
2450
  {
@@ -2569,6 +2613,12 @@
2569
2613
  "package": "@nifrajs/middleware",
2570
2614
  "signature": "export interface CacheControlOptions {\n /** Methods whose responses get the header. Default `[\"GET\", \"HEAD\"]`. */\n readonly methods?: readonly string[];\n /** Predicate over the response status. Default: 2xx only. */\n readonly status?: (status: number) => boolean;\n /** When `true` (default), don't overwrite a `Cache-Control` the handler already set. */\n readonly respectExisting?: boolean;\n}"
2571
2615
  },
2616
+ {
2617
+ "name": "CacheEntry",
2618
+ "kind": "interface",
2619
+ "package": "@nifrajs/e2e",
2620
+ "signature": "export interface CacheEntry {\n readonly version: 1;\n readonly instruction: string;\n readonly startRoute: string;\n readonly actions: readonly RecordedAction[];\n readonly end: {\n readonly route: string;\n readonly appeared: readonly string[];\n readonly disappeared: readonly string[];\n };\n}"
2621
+ },
2572
2622
  {
2573
2623
  "name": "CacheEvent",
2574
2624
  "kind": "interface",
@@ -2583,6 +2633,13 @@
2583
2633
  "signature": "export type CacheKeyAttribute = \"prefix\" | \"none\" | ((key: string) => string | undefined);",
2584
2634
  "doc": "/**\n * What of a key (or an invalidated tag) a span carries:\n * - `\"prefix\"` (default): the leading token before the first `:`, exported as `nifra.cache.key_prefix`\n * only when it matches `^[a-z][a-z0-9_-]{0,31}$` - `user:42` gives `user`, a key with no `:` gives\n * nothing;\n * - `\"none\"`: nothing;\n * - a function: its result is exported as `nifra.cache.key` (return `undefined` to omit). It runs on\n * raw keys, so it owns the redaction.\n */"
2585
2635
  },
2636
+ {
2637
+ "name": "CacheMode",
2638
+ "kind": "type",
2639
+ "package": "@nifrajs/e2e",
2640
+ "signature": "export type CacheMode = \"read-write\" | \"read-only\" | \"strict\" | \"off\";",
2641
+ "doc": "/**\n * `read-write` replays and records; `read-only` replays and hands off but never writes or deletes (CI);\n * `strict` replays only, and a missing or stale recording fails; `off` ignores the cache.\n */"
2642
+ },
2586
2643
  {
2587
2644
  "name": "CacheObserver",
2588
2645
  "kind": "type",
@@ -2603,6 +2660,12 @@
2603
2660
  "package": "@nifrajs/cache",
2604
2661
  "signature": "export interface CacheOptions {\n /** Storage adapter. Default: a fresh {@link MemoryCache}. */\n readonly store?: CacheStore;\n /**\n * Make cache operations produce capability evidence:\n *\n * import { useCapability } from \"@nifrajs/core/capabilities\"\n * const cache = createCache({ beacon: useCapability })\n *\n * Then `cache.for(context)` announces its capability before each operation. Evidence from the CALL is\n * per-route and exact, where evidence from an import is per-module and therefore as broad as the\n * module - which is why a beacon can say something a provenance rule cannot.\n */\n readonly beacon?: CapabilityBeacon;\n /** Override the announced tokens when the app names its capabilities differently. */\n readonly capabilities?: CacheCapabilities;\n /** Default TTL (ms) for `set`/`wrap` when none is given. Default 60_000. */\n readonly defaultTtlMs?: number;\n /** Injectable clock (tests). Default `() => Date.now()`. */\n readonly now?: () => number;\n /** Called when a background SWR revalidation throws. Default: `console.error`. */\n readonly onError?: (error: unknown, key: string) => void;\n /**\n * Called when `wrap` meets a store failure: a `get` that throws or rejects is answered as a miss, so\n * the loader runs, and a `set` that fails still returns the loaded value. A `fence` that fails\n * leaves that load uncached. Other operations reject as before. Default: one `console.error` line per operation per minute, never naming the key.\n */\n readonly onStoreError?: (error: unknown, info: {\n readonly op: CacheStoreOp;\n }) => void;\n /**\n * Receives one {@link CacheEvent} per operation - the seam `cacheTracing()` from `@nifrajs/otel/cache`\n * plugs into. Without one the cache reads no extra clock and allocates no event.\n */\n readonly observer?: CacheObserver;\n}"
2605
2662
  },
2663
+ {
2664
+ "name": "CacheOptions",
2665
+ "kind": "interface",
2666
+ "package": "@nifrajs/e2e",
2667
+ "signature": "export interface CacheOptions {\n readonly mode?: CacheMode;\n /** Where entries live. Default `.nifra/e2e-cache` under the working directory. */\n readonly dir?: string;\n /** Replaces the file store. */\n readonly store?: CacheStore;\n /** Names the test, so two tests that say the same thing do not share a recording. Pass it: the default is empty. */\n readonly testId?: string;\n /** Anything that should invalidate every recording when it changes, such as the app's version. */\n readonly appIdentity?: string;\n}"
2668
+ },
2606
2669
  {
2607
2670
  "name": "CacheOptions",
2608
2671
  "kind": "interface",
@@ -2623,6 +2686,12 @@
2623
2686
  "signature": "export interface CacheStore {\n /** The live entry for `key`, or `undefined` if missing or hard-expired (`now >= expiresAt`). */\n get(key: string): StoredEntry | undefined | Promise<StoredEntry | undefined>;\n /** Store `entry` under `key`, indexed by `tags` for {@link CacheStore.invalidateTag}. */\n set(key: string, entry: StoredEntry, tags: readonly string[]): void | Promise<void>;\n delete(key: string): void | Promise<void>;\n /** Drop every entry carrying `tag`. */\n invalidateTag(tag: string): void | Promise<void>;\n clear(): void | Promise<void>;\n /**\n * Optional, with {@link CacheStore.setIfFence}, for a store several caches or processes share. An\n * opaque token naming this moment for `key` and `tags`. A `wrap` load takes one before it starts.\n */\n fence?(key: string, tags: readonly string[]): unknown | Promise<unknown>;\n /**\n * Optional, with {@link CacheStore.fence}. Store `entry` only when nothing has run since `fence`\n * returned `token` that a load must not overwrite: a `set` or `delete` of `key`, an `invalidateTag`\n * of one of `tags`, or a `clear`, from any cache sharing the store. The check and the write are one\n * atomic step. Resolves `true` when it wrote. A store that cannot tell may refuse; the load's value\n * still reaches its caller, it is just not cached.\n */\n setIfFence?(key: string, entry: StoredEntry, tags: readonly string[], token: unknown): boolean | Promise<boolean>;\n}",
2624
2687
  "doc": "/**\n * Raw key→entry storage. The default {@link MemoryCache} is in-process; implement this over CF KV /\n * Redis / etc. for a cache shared across instances. All methods may be sync or async - the cache awaits them.\n */"
2625
2688
  },
2689
+ {
2690
+ "name": "CacheStore",
2691
+ "kind": "interface",
2692
+ "package": "@nifrajs/e2e",
2693
+ "signature": "export interface CacheStore {\n read(key: string): Promise<CacheEntry | undefined>;\n write(key: string, entry: CacheEntry): Promise<void>;\n delete(key: string): Promise<void>;\n}"
2694
+ },
2626
2695
  {
2627
2696
  "name": "CacheStore",
2628
2697
  "kind": "interface",
@@ -3483,7 +3552,7 @@
3483
3552
  "name": "ClientRouterOptions",
3484
3553
  "kind": "interface",
3485
3554
  "package": "@nifrajs/web",
3486
- "signature": "export interface ClientRouterOptions {\n readonly patterns: readonly RoutePattern[];\n readonly initial: RouterState;\n /** Override the loader-data fetch (tests inject a stub; defaults to a same-origin JSON GET). */\n readonly fetchData?: FetchRouteData;\n /** Ensure a route's code chunk is loaded before rendering (code-splitting). Awaited in parallel\n * with the loader data, so `pending` covers both. Omit when the bundle isn't split. `path` is the URL\n * the route is about to render, for code loaded per URL (a production build's copy chunks). */\n readonly loadModule?: (routeId: string, path?: string) => Promise<void>;\n /** Terminal status → client route id. Generated entries populate this from `_404` and\n * `_<status>` files so soft navigation renders the same boundary as a hard request. */\n readonly statusRoutes?: Readonly<Record<number, string>>;\n /** Status route ids whose page renders inside layouts (all but `inLayouts = false`), filled in by the generated entry's\n * `loadModule`. A soft navigation that ends on one loads the URL as a document, as one ending on a\n * nested `_404` does: only the server runs those layouts' loaders. */\n readonly layoutStatusRoutes?: Readonly<Record<string, true>>;\n /** routeId → the route's client-only search keys (its `searchClientKeys` export). When a soft\n * navigation stays on the same route + pathname and changes ONLY these keys, `navigate` publishes the\n * new URL WITHOUT re-running the loader (re-render, not revalidate). Populated lazily by the generated\n * entry's `loadModule` (so a route's keys are present once it has been visited, which is exactly when a\n * same-route nav can consult them). Omit ⇒ every search change revalidates (the safe default). */\n readonly searchClientKeys?: Readonly<Record<string, readonly string[]>>;\n /** routeId → client-only loader/action hooks, populated by the generated route entry. */\n readonly routeHooks?: Readonly<Record<string, ClientRouteHooks | undefined>>;\n}"
3555
+ "signature": "export interface ClientRouterOptions {\n readonly patterns: readonly RoutePattern[];\n readonly initial: RouterState;\n /** Override the loader-data fetch (tests inject a stub; defaults to a same-origin JSON GET). */\n readonly fetchData?: FetchRouteData;\n /**\n * How the router reaches its server: the route-data GET, prefetches and action POSTs. Defaults to\n * the global `fetch` against this document's own origin; an app served from a native shell passes\n * {@link serverFetch}. Prerendered data files ship in the bundle and always load locally.\n */\n readonly fetch?: RouterFetch;\n /** Ensure a route's code chunk is loaded before rendering (code-splitting). Awaited in parallel\n * with the loader data, so `pending` covers both. Omit when the bundle isn't split. `path` is the URL\n * the route is about to render, for code loaded per URL (a production build's copy chunks). */\n readonly loadModule?: (routeId: string, path?: string) => Promise<void>;\n /** Terminal status → client route id. Generated entries populate this from `_404` and\n * `_<status>` files so soft navigation renders the same boundary as a hard request. */\n readonly statusRoutes?: Readonly<Record<number, string>>;\n /** Status route ids whose page renders inside layouts (all but `inLayouts = false`), filled in by the generated entry's\n * `loadModule`. A soft navigation that ends on one loads the URL as a document, as one ending on a\n * nested `_404` does: only the server runs those layouts' loaders. */\n readonly layoutStatusRoutes?: Readonly<Record<string, true>>;\n /** routeId → the route's client-only search keys (its `searchClientKeys` export). When a soft\n * navigation stays on the same route + pathname and changes ONLY these keys, `navigate` publishes the\n * new URL WITHOUT re-running the loader (re-render, not revalidate). Populated lazily by the generated\n * entry's `loadModule` (so a route's keys are present once it has been visited, which is exactly when a\n * same-route nav can consult them). Omit ⇒ every search change revalidates (the safe default). */\n readonly searchClientKeys?: Readonly<Record<string, readonly string[]>>;\n /** routeId → client-only loader/action hooks, populated by the generated route entry. */\n readonly routeHooks?: Readonly<Record<string, ClientRouteHooks | undefined>>;\n}"
3487
3556
  },
3488
3557
  {
3489
3558
  "name": "ClientServerFn",
@@ -3492,6 +3561,12 @@
3492
3561
  "signature": "export type ClientServerFn<Input, Output> = (input: Input) => MaybePromise<Output>;",
3493
3562
  "doc": "/** The one-argument callable emitted into a client bundle for a {@link ServerFn}. */"
3494
3563
  },
3564
+ {
3565
+ "name": "Clock",
3566
+ "kind": "interface",
3567
+ "package": "@nifrajs/e2e",
3568
+ "signature": "export interface Clock {\n now(): number;\n sleep(ms: number): Promise<void>;\n}"
3569
+ },
3495
3570
  {
3496
3571
  "name": "CloudflareLoaderOptions",
3497
3572
  "kind": "interface",
@@ -4261,7 +4336,7 @@
4261
4336
  "name": "CorsOptions",
4262
4337
  "kind": "interface",
4263
4338
  "package": "@nifrajs/middleware",
4264
- "signature": "export interface CorsOptions {\n /** Allowed origin(s): `\"*\"`, an exact origin, a list, or a predicate. Default `\"*\"`. */\n readonly origin?: string | ReadonlyArray<string> | ((origin: string) => boolean);\n /** Methods advertised in the preflight response. Default the common verbs. */\n readonly methods?: ReadonlyArray<string>;\n /** Headers allowed on the actual request. Default: reflect the preflight's requested headers. */\n readonly allowedHeaders?: ReadonlyArray<string>;\n /** Response headers exposed to the browser. */\n readonly exposedHeaders?: ReadonlyArray<string>;\n /** Allow credentials (cookies / `Authorization`). Cannot be combined with `origin: \"*\"`. Default false. */\n readonly credentials?: boolean;\n /** Preflight cache duration, in seconds. */\n readonly maxAge?: number;\n}"
4339
+ "signature": "export interface CorsOptions {\n /** Allowed origin(s): `\"*\"`, an exact origin, a list, or a predicate. Default `\"*\"`. A named origin\n * is also trusted to post a form or a bodyless unsafe request to the server, as if it were in the\n * server's `formOrigins`; `\"*\"` adds nothing. */\n readonly origin?: string | ReadonlyArray<string> | ((origin: string) => boolean);\n /** Methods advertised in the preflight response. Default the common verbs. */\n readonly methods?: ReadonlyArray<string>;\n /** Headers allowed on the actual request. Default: reflect the preflight's requested headers. */\n readonly allowedHeaders?: ReadonlyArray<string>;\n /** Response headers exposed to the browser. */\n readonly exposedHeaders?: ReadonlyArray<string>;\n /** Allow credentials (cookies / `Authorization`). Cannot be combined with `origin: \"*\"`. Default false. */\n readonly credentials?: boolean;\n /** Preflight cache duration, in seconds. */\n readonly maxAge?: number;\n}"
4265
4340
  },
4266
4341
  {
4267
4342
  "name": "Counter",
@@ -4356,7 +4431,7 @@
4356
4431
  "name": "CreateWebAppOptions",
4357
4432
  "kind": "interface",
4358
4433
  "package": "@nifrajs/web",
4359
- "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}"
4434
+ "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; the routing layer\n * must strip the mount prefix before dispatching.\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}"
4360
4435
  },
4361
4436
  {
4362
4437
  "name": "CronError",
@@ -4403,7 +4478,7 @@
4403
4478
  "name": "CsrfOptions",
4404
4479
  "kind": "interface",
4405
4480
  "package": "@nifrajs/middleware",
4406
- "signature": "export interface CsrfOptions {\n /** HMAC secret (≥ 32 bytes), or a rotation list - see {@link CsrfSecret}. */\n readonly secret: CsrfSecret;\n /** Cookie carrying the signed token. Default `\"csrf-token\"`. */\n readonly cookie?: string;\n /** Header carrying the same signed token. Default `\"x-csrf-token\"`. */\n readonly header?: string;\n /**\n * Form field that may carry the token when the header is absent, so a plain HTML `<form>` (no\n * script to set a header) can submit - e.g. `field: \"_csrf\"` with\n * `<input type=\"hidden\" name=\"_csrf\" value=\"...\">`. Read from `application/x-www-form-urlencoded`\n * and `multipart/form-data` bodies only, through a clone, so the handler still reads the body.\n * Unset (default), only the header is accepted.\n *\n * A cross-site form can set any field but never a custom header, so keep `checkOrigin` on with a\n * field: the Origin check is what stops a site that can plant a cookie on your domain (a sibling\n * subdomain) from pairing it with a matching field.\n */\n readonly field?: string;\n /**\n * Largest body scanned for {@link field}, in bytes. Default 64 KiB. A bigger form (a file upload)\n * fails closed - send the header, or raise this for that app.\n */\n readonly fieldMaxBytes?: number;\n /** Unsafe methods to protect. Default: every method except GET/HEAD/OPTIONS/TRACE/QUERY. */\n readonly methods?: readonly string[];\n /** Allowed request origins. Default: same host as the request URL, where an `https:` Origin may\n * reach an `http:` URL (what a TLS-terminating proxy looks like from the server). */\n readonly origins?: readonly string[];\n /** Check Origin/Referer on protected requests. Default true. */\n readonly checkOrigin?: boolean;\n}"
4481
+ "signature": "export interface CsrfOptions {\n /** HMAC secret (≥ 32 bytes), or a rotation list - see {@link CsrfSecret}. */\n readonly secret: CsrfSecret;\n /** Cookie carrying the signed token. Default `\"csrf-token\"`. */\n readonly cookie?: string;\n /** Header carrying the same signed token. Default `\"x-csrf-token\"`. */\n readonly header?: string;\n /**\n * Form field that may carry the token when the header is absent, so a plain HTML `<form>` (no\n * script to set a header) can submit - e.g. `field: \"_csrf\"` with\n * `<input type=\"hidden\" name=\"_csrf\" value=\"...\">`. Read from `application/x-www-form-urlencoded`\n * and `multipart/form-data` bodies only, through a clone, so the handler still reads the body.\n * Unset (default), only the header is accepted.\n *\n * A cross-site form can set any field but never a custom header, so keep `checkOrigin` on with a\n * field: the Origin check is what stops a site that can plant a cookie on your domain (a sibling\n * subdomain) from pairing it with a matching field.\n */\n readonly field?: string;\n /**\n * Largest body scanned for {@link field}, in bytes. Default 64 KiB. A bigger form (a file upload)\n * fails closed - send the header, or raise this for that app.\n */\n readonly fieldMaxBytes?: number;\n /** Unsafe methods to protect. Default: every method except GET/HEAD/OPTIONS/TRACE/QUERY. */\n readonly methods?: readonly string[];\n /** Allowed request origins. Default: same host as the request URL, where an `https:` Origin may\n * reach an `http:` URL (what a TLS-terminating proxy looks like from the server). A listed origin is\n * also trusted to post a form to the server, as if it were in the server's `formOrigins`. */\n readonly origins?: readonly string[];\n /** Check Origin/Referer on protected requests. Default true. */\n readonly checkOrigin?: boolean;\n}"
4407
4482
  },
4408
4483
  {
4409
4484
  "name": "CssLoadingMode",
@@ -4533,6 +4608,13 @@
4533
4608
  "signature": "export declare const DEFAULT_IDEMPOTENCY_HEADER = \"idempotency-key\";",
4534
4609
  "doc": "/** Canonical request header carrying the client-chosen idempotency key. */"
4535
4610
  },
4611
+ {
4612
+ "name": "DEFAULT_IDEMPOTENCY_MAX_RESPONSE_BYTES",
4613
+ "kind": "const",
4614
+ "package": "@nifrajs/core",
4615
+ "signature": "export declare const DEFAULT_IDEMPOTENCY_MAX_RESPONSE_BYTES = 1000000;",
4616
+ "doc": "/** Default maximum response body retained by the standalone idempotency helpers: 1 MB. */"
4617
+ },
4536
4618
  {
4537
4619
  "name": "DEFAULT_IDEMPOTENCY_PENDING_TTL_MS",
4538
4620
  "kind": "const",
@@ -4574,6 +4656,12 @@
4574
4656
  "package": "@nifrajs/core",
4575
4657
  "signature": "export declare const DEFAULT_WIRE_DECODE_LIMITS: Readonly<Required<WireDecodeLimits>>;"
4576
4658
  },
4659
+ {
4660
+ "name": "DEPLOYMENT_ADAPTER_API_VERSION",
4661
+ "kind": "const",
4662
+ "package": "@nifrajs/web",
4663
+ "signature": "export declare const DEPLOYMENT_ADAPTER_API_VERSION: 1;"
4664
+ },
4577
4665
  {
4578
4666
  "name": "DEPLOYMENT_REFERENCE_PROFILES",
4579
4667
  "kind": "const",
@@ -5076,7 +5164,7 @@
5076
5164
  "name": "DenoServer",
5077
5165
  "kind": "interface",
5078
5166
  "package": "@nifrajs/deno",
5079
- "signature": "export interface DenoServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, then stop accepting connections,\n * let in-flight requests drain (up to `drainMs`), force-close stragglers, and run the app's\n * `onStop` hooks. A request is in flight until its whole response body is sent, so a live stream\n * is force-closed at the deadline too. Mirrors nifra's Bun `stop()`.\n */\n stop(options?: DenoStopOptions): Promise<void>;\n}"
5167
+ "signature": "export interface DenoServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, then stop accepting connections,\n * let in-flight requests drain (up to `drainMs`), force-close stragglers, and run the app's\n * `onStop` hooks. A request is in flight until its whole response body is sent, so a live stream\n * is force-closed at the deadline too. Mirrors nifra's Bun `stop()`.\n */\n stop(options?: DenoStopOptions): Promise<void>;\n /** `await using server = await serve(app, { port: 3000 })`: `stop()` with default options. Waits for a shutdown already under way. */\n [Symbol.asyncDispose](): Promise<void>;\n}"
5080
5168
  },
5081
5169
  {
5082
5170
  "name": "DenoStopOptions",
@@ -5091,6 +5179,39 @@
5091
5179
  "package": "@nifrajs/agent",
5092
5180
  "signature": "export interface DeploymentActivationOptions {\n /** Host-owned approval obtained from a separately reviewed/certified isolation decision. */\n readonly approved?: boolean;\n}"
5093
5181
  },
5182
+ {
5183
+ "name": "DeploymentAdapterBuildInput",
5184
+ "kind": "interface",
5185
+ "package": "@nifrajs/web",
5186
+ "signature": "export interface DeploymentAdapterBuildInput<T> {\n readonly adapter: DeploymentTargetAdapter;\n readonly appRoot: string;\n readonly outDir: string;\n readonly options?: unknown;\n readonly secretExemptions?: readonly SecretExemption[] | undefined;\n /** External source paths the final output must never replace, especially an external `publicDir`. */\n readonly protectedPaths: readonly string[];\n readonly componentPipeline?: boolean;\n /** The existing target builder, called with a fresh sibling staging directory. */\n readonly build: (stagingOutDir: string) => Promise<T>;\n}"
5187
+ },
5188
+ {
5189
+ "name": "DeploymentAdapterBuildResult",
5190
+ "kind": "interface",
5191
+ "package": "@nifrajs/web",
5192
+ "signature": "export interface DeploymentAdapterBuildResult<T> {\n /**\n * The base builder's result. Paths in it may point into the temporary staging directory, which is\n * deleted before this function returns; use the returned `DeploymentAdapterBuildResult.outDir` for\n * published paths.\n */\n readonly result: T;\n readonly outDir: string;\n readonly run: string;\n readonly adapterId: string;\n readonly baseTarget: BuildTarget;\n}"
5193
+ },
5194
+ {
5195
+ "name": "DeploymentAdapterContext",
5196
+ "kind": "interface",
5197
+ "package": "@nifrajs/web",
5198
+ "signature": "export interface DeploymentAdapterContext {\n readonly adapterId: string;\n readonly appRoot: string;\n readonly baseTarget: BuildTarget;\n /** Staged, completed build output. Treat it as read-only; Nifra publishes it after validation. */\n readonly outDir: string;\n /** The adapter's validated and normalized options. */\n readonly options: Readonly<Record<string, unknown>>;\n /** The base builder's result. Its shape depends on whether the app uses ordinary SSR or components. */\n readonly result: unknown;\n}",
5199
+ "doc": "/** Stable facts passed to an adapter after the selected built-in target has been assembled. */"
5200
+ },
5201
+ {
5202
+ "name": "DeploymentAdapterFile",
5203
+ "kind": "interface",
5204
+ "package": "@nifrajs/web",
5205
+ "signature": "export interface DeploymentAdapterFile {\n /** POSIX path relative to the deploy directory, such as `Dockerfile` or `.well-known/host.txt`. */\n readonly path: string;\n /** Text or bytes. Text files and decodable byte files are scanned for credentials before publish. */\n readonly contents: string | Uint8Array;\n}",
5206
+ "doc": "/** A portable file an adapter wants to add to the finished deploy directory. */"
5207
+ },
5208
+ {
5209
+ "name": "DeploymentAdapterOutput",
5210
+ "kind": "interface",
5211
+ "package": "@nifrajs/web",
5212
+ "signature": "export interface DeploymentAdapterOutput {\n readonly files: readonly DeploymentAdapterFile[];\n readonly run: string;\n}",
5213
+ "doc": "/** Files and deploy/run guidance emitted by a deployment adapter. */"
5214
+ },
5094
5215
  {
5095
5216
  "name": "DeploymentAuthority",
5096
5217
  "kind": "interface",
@@ -5230,6 +5351,13 @@
5230
5351
  "package": "@nifrajs/agent",
5231
5352
  "signature": "export type DeploymentState = \"prepared\" | \"running\" | \"cancelled\" | \"disposed\";"
5232
5353
  },
5354
+ {
5355
+ "name": "DeploymentTargetAdapter",
5356
+ "kind": "interface",
5357
+ "package": "@nifrajs/web",
5358
+ "signature": "export interface DeploymentTargetAdapter {\n readonly apiVersion: typeof DEPLOYMENT_ADAPTER_API_VERSION;\n /** Stable lowercase target key used by `nifra build --target <id>` and `nifra target <id>`. */\n readonly id: string;\n readonly baseTarget: BuildTarget;\n readonly capabilities: {\n /** Whether this adapter knows how to package the coordinated component pipeline output. */\n readonly componentPipeline: boolean;\n };\n /** Validate and normalize untrusted config data before Nifra starts a build or clears output. */\n readonly validateOptions: (input: unknown) => Readonly<Record<string, unknown>>;\n /** Return additional files and the provider-specific deployment instruction. No filesystem writes. */\n readonly emit: (context: DeploymentAdapterContext) => DeploymentAdapterOutput | Promise<DeploymentAdapterOutput>;\n}",
5359
+ "doc": "/**\n * A versioned public deployment adapter. `baseTarget` selects Nifra's runtime/build semantics; the\n * adapter only describes packaging metadata and files. `componentPipeline` must be true for an\n * adapter to opt into Nifra's separate coordinated component pipeline.\n */"
5360
+ },
5233
5361
  {
5234
5362
  "name": "DescriptorInput",
5235
5363
  "kind": "interface",
@@ -5627,6 +5755,31 @@
5627
5755
  "signature": "export interface E2EApp {\n fetch(request: Request): Response | Promise<Response>;\n}",
5628
5756
  "doc": "/** The minimal shape a nifra `server()` app satisfies - its own `fetch`. */"
5629
5757
  },
5758
+ {
5759
+ "name": "E2EError",
5760
+ "kind": "class",
5761
+ "package": "@nifrajs/e2e",
5762
+ "signature": "export declare class E2EError extends Error {\n readonly code: E2EErrorCode;\n constructor(code: E2EErrorCode, message: string, options?: ErrorOptions);\n}"
5763
+ },
5764
+ {
5765
+ "name": "E2EErrorCode",
5766
+ "kind": "type",
5767
+ "package": "@nifrajs/e2e",
5768
+ "signature": "export type E2EErrorCode = \"LOCATOR_NOT_FOUND\" | \"LOCATOR_AMBIGUOUS\" | \"EXPECT_FAILED\" | \"HYDRATION_TIMEOUT\" | \"ENGINE_MISSING\" | \"NAVIGATION_FAILED\" | \"BAD_PATH\" | \"MODEL_MISSING\" | \"MODEL_INVALID\" | \"STEP_FAILED\" | \"STEP_BUDGET_EXCEEDED\" | \"STEP_TIMEOUT\" | \"ASSERTION_FAILED\" | \"ASSERTION_INCONCLUSIVE\" | \"WAIT_TIMEOUT\" | \"EXTRACT_INVALID\" | \"REPLAY_MISSING\" | \"REPLAY_STALE\";"
5769
+ },
5770
+ {
5771
+ "name": "E2EModel",
5772
+ "kind": "interface",
5773
+ "package": "@nifrajs/e2e",
5774
+ "signature": "export interface E2EModel {\n decide(request: ModelRequest): unknown | PromiseLike<unknown>;\n}",
5775
+ "doc": "/**\n * The seam to a model. Answer an `act` request with a decision (`{ kind: \"tap\", target }`, `fill`,\n * `press`, `goto`, `done` or `fail`), an `assert` or `waitFor` with `{ pass, reason }`, and an\n * `extract` with `{ value }`. The answer is unknown until the runner has parsed it. Nothing here\n * names a vendor; the caller owns credentials, retries and cost.\n */"
5776
+ },
5777
+ {
5778
+ "name": "E2EOptions",
5779
+ "kind": "interface",
5780
+ "package": "@nifrajs/e2e",
5781
+ "signature": "export interface E2EOptions {\n /** Defaults to the Playwright engine (`@nifrajs/e2e/playwright`), which needs `playwright` installed. */\n readonly engine?: EngineFactory;\n /** A `testSession().cookies` jar (or anything with `header()`): logs the browser in without a UI login. */\n readonly cookies?: {\n header(): string;\n };\n readonly hydration?: HydrationMode;\n /** ms an action waits for its element. Default 5000. */\n readonly actionTimeout?: number;\n /** ms an assertion retries before it fails. Default 5000. */\n readonly assertionTimeout?: number;\n readonly pollInterval?: number;\n readonly clock?: Clock;\n /** Answers agent steps. Without it `t.agent` rejects with `MODEL_MISSING`; locator tests need none. */\n readonly model?: E2EModel | undefined;\n /** Words every agent step should know: the product, its jargon, what a plan is called. */\n readonly agentContext?: string;\n /** Characters of page outline one model call may carry. Default 12000. */\n readonly snapshotChars?: number;\n /** The replay cache for `agent.act`. On by default; `false` turns it off. */\n readonly cache?: CacheOptions | false;\n}"
5782
+ },
5630
5783
  {
5631
5784
  "name": "E2EPaths",
5632
5785
  "kind": "type",
@@ -5634,6 +5787,12 @@
5634
5787
  "signature": "export type E2EPaths<App> = App extends Server<infer R, infer _Ctx> ? keyof R & string : never;",
5635
5788
  "doc": "/** Every route path the app declares - constrains `e2eUrl`, so a wrong path is a type error. */"
5636
5789
  },
5790
+ {
5791
+ "name": "E2ESession",
5792
+ "kind": "interface",
5793
+ "package": "@nifrajs/e2e",
5794
+ "signature": "export interface E2ESession<App> extends UrlSource, AsyncDisposable {\n readonly baseUrl: string;\n readonly screen: Screen;\n readonly agent: Agent;\n open<P extends E2EPaths<App>>(path: P, ...args: OpenArgs<P>): Promise<void>;\n close(): Promise<void>;\n}"
5795
+ },
5637
5796
  {
5638
5797
  "name": "EMPTY_PARAMS",
5639
5798
  "kind": "const",
@@ -5698,7 +5857,7 @@
5698
5857
  "name": "EdgeOptions",
5699
5858
  "kind": "interface",
5700
5859
  "package": "@nifrajs/edge",
5701
- "signature": "export interface EdgeOptions {\n /** Maximum request body size in bytes before a `413`. Defaults to 1 MB. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for JSON bodies. Defaults to `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Other sites whose HTML forms may post to a body-schema route. A form body whose `Origin` is\n * another site's, and not listed, is refused with `403`. */\n readonly formOrigins?: FormOrigins;\n /** Answers a request no route matched, in place of the default `404` body. Build it with\n * {@link notFound}: `server({ notFound: notFound(handler) })`. */\n readonly notFound?: EdgeNotFound;\n}",
5860
+ "signature": "export interface EdgeOptions {\n /** Maximum request body size in bytes before a `413`. Defaults to 1 MB. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for JSON bodies. Defaults to `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Other sites whose HTML forms may post to a route. A urlencoded, multipart or `text/plain`\n * request whose `Origin` is another site's, and not listed, is refused with `403`: before the body is\n * read on a body-schema route, and before the handler runs on a `POST`, `PUT`, `PATCH` or `DELETE`\n * route without one. On a route without one, an unsafe request with no content type, which `fetch`\n * with `no-cors` sends, is refused the same way, unless it carries an `Authorization` header whose\n * scheme is not Basic, Digest, Negotiate or NTLM: a script set that one, so a preflight judged it. */\n readonly formOrigins?: FormOrigins;\n /** Answers a request no route matched, in place of the default `404` body. Build it with\n * {@link notFound}: `server({ notFound: notFound(handler) })`. */\n readonly notFound?: EdgeNotFound;\n}",
5702
5861
  "doc": "/** Construction-time options. The defaults mirror `@nifrajs/core`'s `ServerOptions`. */"
5703
5862
  },
5704
5863
  {
@@ -5866,6 +6025,18 @@
5866
6025
  "package": "@nifrajs/otel",
5867
6026
  "signature": "export interface EffectTracingPlugin extends IdentityPlugin {\n /** Pass the same observer to `createSagaEngine({ observer })` and reconciliation helpers. */\n readonly observer: EffectLifecycleObserver;\n}"
5868
6027
  },
6028
+ {
6029
+ "name": "ElementAction",
6030
+ "kind": "type",
6031
+ "package": "@nifrajs/e2e",
6032
+ "signature": "export type ElementAction = {\n readonly kind: \"tap\";\n} | {\n readonly kind: \"fill\";\n readonly value: string;\n} | {\n readonly kind: \"press\";\n readonly key: string;\n};"
6033
+ },
6034
+ {
6035
+ "name": "ElementState",
6036
+ "kind": "interface",
6037
+ "package": "@nifrajs/e2e",
6038
+ "signature": "export interface ElementState {\n readonly visible: boolean;\n readonly text: string;\n readonly value?: string;\n}"
6039
+ },
5869
6040
  {
5870
6041
  "name": "EmitEffectLifecycleInput",
5871
6042
  "kind": "interface",
@@ -5884,6 +6055,25 @@
5884
6055
  "package": "@nifrajs/otel",
5885
6056
  "signature": "export interface EndObservation {\n readonly statusCode?: number;\n /** Explicit status wins over status-code and recorded-error classification. */\n readonly status?: Exclude<SpanStatus, \"unset\">;\n readonly attributes?: Readonly<Record<string, AttributeValue>>;\n /** Measured duration in ms, for work recorded after it settled. The end time becomes start + duration. */\n readonly durationMs?: number;\n}"
5886
6057
  },
6058
+ {
6059
+ "name": "Engine",
6060
+ "kind": "interface",
6061
+ "package": "@nifrajs/e2e",
6062
+ "signature": "export interface Engine {\n goto(url: string): Promise<void>;\n url(): Promise<string>;\n resolve(selector: Selector): Promise<readonly ElementState[]>;\n /** The page as an accessibility-tree outline, one node per line; what an agent step reads. */\n snapshot(): Promise<string>;\n act(selector: Selector, action: ElementAction, timeout: number): Promise<void>;\n close(): Promise<void>;\n}",
6063
+ "doc": "/**\n * What a browser or device must offer. `act` waits up to `timeout` ms for exactly one actionable\n * match, then performs the action; it throws `LOCATOR_NOT_FOUND` or `LOCATOR_AMBIGUOUS` otherwise.\n * `resolve` never waits and never throws on zero matches.\n */"
6064
+ },
6065
+ {
6066
+ "name": "EngineFactory",
6067
+ "kind": "type",
6068
+ "package": "@nifrajs/e2e",
6069
+ "signature": "export type EngineFactory = (init: EngineInit) => Promise<Engine>;"
6070
+ },
6071
+ {
6072
+ "name": "EngineInit",
6073
+ "kind": "interface",
6074
+ "package": "@nifrajs/e2e",
6075
+ "signature": "export interface EngineInit {\n readonly baseUrl: string;\n readonly cookies: readonly {\n readonly name: string;\n readonly value: string;\n }[];\n readonly hydration: HydrationMode;\n}"
6076
+ },
5887
6077
  {
5888
6078
  "name": "EnqueueOptions",
5889
6079
  "kind": "interface",
@@ -6171,6 +6361,18 @@
6171
6361
  "signature": "export type ExtensionWorkflow = (context: ExtensionContext) => WorkflowStep | PromiseLike<WorkflowStep>;",
6172
6362
  "doc": "/** A workflow factory keeps orchestration lazy and lets every extension fully customize its steps. */"
6173
6363
  },
6364
+ {
6365
+ "name": "ExtractOptions",
6366
+ "kind": "interface",
6367
+ "package": "@nifrajs/e2e",
6368
+ "signature": "export interface ExtractOptions<S extends StandardSchemaV1> extends StepOptions {\n readonly schema: S;\n readonly jsonSchema?: unknown;\n}"
6369
+ },
6370
+ {
6371
+ "name": "ExtractRequest",
6372
+ "kind": "interface",
6373
+ "package": "@nifrajs/e2e",
6374
+ "signature": "export interface ExtractRequest {\n readonly kind: \"extract\";\n readonly prompt: string;\n readonly context?: string;\n readonly snapshot: string;\n readonly secrets: readonly string[];\n /** The JSON Schema the caller supplied, to put in the prompt; the answer is validated against the real schema. */\n readonly jsonSchema?: unknown;\n readonly signal: AbortSignal;\n}"
6375
+ },
6174
6376
  {
6175
6377
  "name": "FILE_TYPE_PREFIX_BYTES",
6176
6378
  "kind": "const",
@@ -6268,6 +6470,18 @@
6268
6470
  "package": "@nifrajs/testing",
6269
6471
  "signature": "export interface FailureScenarioReport {\n readonly name: string;\n readonly ok: boolean;\n readonly replay: FailureReplay;\n readonly evidence: readonly FailureEvidence[];\n /** Sanitized failure identity. Messages and stacks are deliberately excluded. */\n readonly error?: {\n readonly name: string;\n readonly kind?: FailureInjectedError[\"kind\"];\n };\n}"
6270
6472
  },
6473
+ {
6474
+ "name": "FakeEngineOptions",
6475
+ "kind": "interface",
6476
+ "package": "@nifrajs/e2e",
6477
+ "signature": "export interface FakeEngineOptions {\n /** Pages by `pathname + search`, falling back to bare `pathname`. */\n readonly pages: Readonly<Record<string, readonly FakeNode[]>>;\n /** Runs after a tap or press on the matched node; return a path to navigate to it. */\n readonly onAct?: (node: FakeNode, action: ElementAction) => string | undefined;\n}"
6478
+ },
6479
+ {
6480
+ "name": "FakeLogEntry",
6481
+ "kind": "interface",
6482
+ "package": "@nifrajs/e2e",
6483
+ "signature": "export interface FakeLogEntry {\n readonly kind: \"goto\" | ElementAction[\"kind\"];\n readonly detail: string;\n}"
6484
+ },
6271
6485
  {
6272
6486
  "name": "FakeModelGateway",
6273
6487
  "kind": "class",
@@ -6281,6 +6495,13 @@
6281
6495
  "package": "@nifrajs/agent",
6282
6496
  "signature": "export interface FakeModelGatewayOptions {\n readonly responses: readonly ModelGatewayRawResult[];\n}"
6283
6497
  },
6498
+ {
6499
+ "name": "FakeNode",
6500
+ "kind": "interface",
6501
+ "package": "@nifrajs/e2e",
6502
+ "signature": "export interface FakeNode {\n role?: string;\n /** Accessible name, matched by `getByRole(role, name)`. */\n name?: string;\n /** Own text, matched by `getByText`. */\n text?: string;\n testId?: string;\n /** Label text, matched by `getByLabel`. */\n label?: string;\n value?: string;\n hidden?: boolean;\n children?: FakeNode[];\n}",
6503
+ "doc": "/** A node of the in-memory page tree the fake engine matches locators against. */"
6504
+ },
6284
6505
  {
6285
6506
  "name": "FastlyOptions",
6286
6507
  "kind": "interface",
@@ -6377,6 +6598,13 @@
6377
6598
  "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: NodePlatform): Response | Promise<Response>;\n /** Nifra apps also expose this WS-upgrade seam; present → this adapter serves `app.ws()` routes via\n * the optional `ws` package (lazy-imported on the first upgrade). Absent (a plain `{ fetch }`\n * handler) → HTTP only, and an upgrade request gets a 404. */\n resolveWebSocketUpgrade?(request: Request, platform?: NodePlatform): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
6378
6599
  "doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
6379
6600
  },
6601
+ {
6602
+ "name": "FetchHandler",
6603
+ "kind": "interface",
6604
+ "package": "@nifrajs/node-uws",
6605
+ "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: {\n readonly clientIp?: string | undefined;\n }): Response | Promise<Response>;\n /** Present on every nifra app: the node-direct lane, which skips building a Web `Request`. */\n resolveNodeSource?(source: unknown, platform?: unknown, runtime?: object | undefined): NodeServeOutcome | Promise<NodeServeOutcome>;\n}",
6606
+ "doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
6607
+ },
6380
6608
  {
6381
6609
  "name": "FetchRouteData",
6382
6610
  "kind": "type",
@@ -6544,6 +6772,13 @@
6544
6772
  "package": "@nifrajs/cli",
6545
6773
  "signature": "export interface FixRecipe {\n readonly id: string;\n readonly description: string;\n /** Run only by `nifra fix --code <code>`: the change it makes is a decision a person reviews first. */\n readonly onlyWhenNamed?: true;\n apply(root: string, diagnostic: Diagnostic): Promise<readonly string[]>;\n readonly verify: string;\n}"
6546
6774
  },
6775
+ {
6776
+ "name": "FlyOptions",
6777
+ "kind": "interface",
6778
+ "package": "@nifrajs/deploy-fly",
6779
+ "signature": "interface FlyOptions {\n readonly app: string;\n readonly primaryRegion?: string;\n readonly internalPort?: number;\n readonly forceHttps?: boolean;\n readonly healthCheckPath?: string;\n readonly image?: string;\n}",
6780
+ "doc": "/** The options a project passes; only `app` is required. */"
6781
+ },
6547
6782
  {
6548
6783
  "name": "FontAsset",
6549
6784
  "kind": "interface",
@@ -6681,7 +6916,7 @@
6681
6916
  "name": "GenerateClientEntryOptions",
6682
6917
  "kind": "interface",
6683
6918
  "package": "@nifrajs/web",
6684
- "signature": "export interface GenerateClientEntryOptions {\n /**\n * Module specifier for the adapter's client runtime, e.g. `\"@nifrajs/web-solid/client\"`.\n *\n * **Contract:** the module MUST export `mountRouter({ router, routes, container })`. The generated\n * bootstrap imports the specifier and calls it - so a self-executing entry that mounts on import\n * builds cleanly and then does nothing, which is the trap this contract exists to name. The type is\n * a bare `string` because a specifier is resolved by the bundler, not the type system, so the\n * requirement is enforced by the bootstrap instead: it throws immediately, naming this module and\n * the missing export, rather than failing later as `mountRouter is not a function`.\n */\n readonly clientModule: string;\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier. */\n readonly resolve: (file: string) => string;\n readonly serverComponents?: boolean;\n /** The build moved copy tables into per-locale chunks: the handover carries the chunk URLs, and a\n * navigation loads the copy of the URL it goes to beside the route's code. */\n readonly copyChunks?: boolean;\n /**\n * The server runs `createWebApp({ live })`: route loads go through its live load endpoint and the\n * entry keeps what is on screen fresh (`@nifrajs/web/live-client`). Absent, the entry is exactly the\n * non-live one.\n */\n readonly live?: LiveClientEntry | undefined;\n}"
6919
+ "signature": "export interface GenerateClientEntryOptions {\n /**\n * Module specifier for the adapter's client runtime, e.g. `\"@nifrajs/web-solid/client\"`.\n *\n * **Contract:** the module MUST export `mountRouter({ router, routes, container })`. The generated\n * bootstrap imports the specifier and calls it - so a self-executing entry that mounts on import\n * builds cleanly and then does nothing, which is the trap this contract exists to name. The type is\n * a bare `string` because a specifier is resolved by the bundler, not the type system, so the\n * requirement is enforced by the bootstrap instead: it throws immediately, naming this module and\n * the missing export, rather than failing later as `mountRouter is not a function`.\n */\n readonly clientModule: string;\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier. */\n readonly resolve: (file: string) => string;\n readonly serverComponents?: boolean;\n /** The build moved copy tables into per-locale chunks: the handover carries the chunk URLs, and a\n * navigation loads the copy of the URL it goes to beside the route's code. */\n readonly copyChunks?: boolean;\n /**\n * The server runs `createWebApp({ live })`: route loads go through its live load endpoint and the\n * entry keeps what is on screen fresh (`@nifrajs/web/live-client`). Absent, the entry is exactly the\n * non-live one.\n */\n readonly live?: LiveClientEntry | undefined;\n /**\n * A module whose default export is the `fetch` the router reaches its server through: for pages\n * that ship inside a native shell while the server lives elsewhere. An absolute path.\n */\n readonly transport?: string | undefined;\n}"
6685
6920
  },
6686
6921
  {
6687
6922
  "name": "GenerateRegressionTestOptions",
@@ -6768,6 +7003,13 @@
6768
7003
  "signature": "export declare const HANDOVER_ID = \"__nifra-handover\";",
6769
7004
  "doc": "/**\n * `id` of the inert `<script type=\"application/json\">` a hydrating document hands its page state over\n * in: one JSON object keyed by the `*_GLOBAL` names below, which the client entry assigns onto\n * `window` before anything reads them. Data the browser never executes needs no CSP nonce or hash.\n */"
6770
7005
  },
7006
+ {
7007
+ "name": "HandOff",
7008
+ "kind": "interface",
7009
+ "package": "@nifrajs/e2e",
7010
+ "signature": "export interface HandOff {\n readonly reason: StopReason;\n readonly detail: string;\n /** How many actions at the start of `history` the replay performed. */\n readonly performed: number;\n}",
7011
+ "doc": "/** A recorded run that stopped partway: its actions are already done, so do not redo them. */"
7012
+ },
6771
7013
  {
6772
7014
  "name": "Handler",
6773
7015
  "kind": "type",
@@ -7024,12 +7266,25 @@
7024
7266
  "signature": "export interface HostPolicy {\n /** Capability kinds the host will admit. A descriptor of any other kind is refused. */\n readonly allowedKinds: readonly CapabilityKind[];\n /** Required-capability allowlist. Every `requiredCapabilities` entry must be present. */\n readonly allowedCapabilities: readonly string[];\n /** Isolation floor. A descriptor offering weaker isolation than this is refused. */\n readonly minIsolation: IsolationClass;\n /** When true, a descriptor whose approval class is `none` is refused as a downgrade. */\n readonly requireApproval: boolean;\n}",
7025
7267
  "doc": "/** The authoritative admission policy. Empty allowlists deny everything of that kind. */"
7026
7268
  },
7269
+ {
7270
+ "name": "HostPolicy",
7271
+ "kind": "interface",
7272
+ "package": "@nifrajs/node",
7273
+ "signature": "export interface HostPolicy {\n readonly allowedHosts: ReadonlySet<string> | ((host: string) => boolean) | undefined;\n readonly canonicalHost: string | undefined;\n readonly normalizeTarget: boolean;\n}",
7274
+ "doc": "/** The Host and target options `serve()` accepts, resolved once at startup. */"
7275
+ },
7027
7276
  {
7028
7277
  "name": "HostPolicy",
7029
7278
  "kind": "interface",
7030
7279
  "package": "@nifrajs/web",
7031
7280
  "signature": "export interface HostPolicy {\n readonly rules: readonly HostPolicyRule[];\n /**\n * Whether `pathname` (as requested, percent-encoded, without the query) may be served on `host` (a\n * Host header value; its port and case are ignored). `buildAssets` is the build's file set; without\n * it a rule's `buildAssets` matches nothing.\n */\n allows(host: string, pathname: string, buildAssets?: BuildAssetSet): boolean;\n /** The refusal for `pathname` on `host`, or `undefined` to serve it. */\n refusal(host: string, pathname: string, buildAssets?: BuildAssetSet): Response | undefined;\n /** {@link HostPolicy.refusal} for a request: its Host header (else its URL's host) and path. */\n check(request: Request, buildAssets?: BuildAssetSet): Response | undefined;\n}"
7032
7281
  },
7282
+ {
7283
+ "name": "HostPolicyOptions",
7284
+ "kind": "interface",
7285
+ "package": "@nifrajs/node",
7286
+ "signature": "export interface HostPolicyOptions {\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n readonly canonicalHost?: string;\n readonly normalizeTarget?: boolean;\n}"
7287
+ },
7033
7288
  {
7034
7289
  "name": "HostPolicyOptions",
7035
7290
  "kind": "interface",
@@ -7158,6 +7413,13 @@
7158
7413
  "signature": "export declare function HydrationBoundary(props: {\n readonly state: DehydratedState | undefined;\n readonly children?: ReactNode;\n}): ReactNode;",
7159
7414
  "doc": "/**\n * Seed the context's {@link QueryClient} from a server {@link dehydrate} snapshot - the SSR data bridge.\n * Wrap the app (inside `QueryClientProvider`) so server-prefetched queries are in the cache before the\n * first client render, avoiding a loading flash. Hydration runs during render (idempotent, fresher-wins),\n * so the data is available synchronously to child `useQuery`s.\n */"
7160
7415
  },
7416
+ {
7417
+ "name": "HydrationMode",
7418
+ "kind": "type",
7419
+ "package": "@nifrajs/e2e",
7420
+ "signature": "export type HydrationMode = \"auto\" | \"off\";",
7421
+ "doc": "/** `auto` waits for nifra's `data-nifra-hydrated` marker only on pages that load a module script. */"
7422
+ },
7161
7423
  {
7162
7424
  "name": "I18nProvider",
7163
7425
  "kind": "function",
@@ -8209,6 +8471,12 @@
8209
8471
  "package": "@nifrajs/client",
8210
8472
  "signature": "export type Jsonify<T> = [unknown] extends [T] ? unknown : T extends BinaryResponse ? Blob : T extends RawResponse<infer U> ? Jsonify<U> : T extends string | number | boolean | null ? T : T extends Date ? string : T extends bigint ? string : T extends (...args: never[]) => unknown ? never : T extends undefined ? undefined : T extends BigIntArray ? {\n [index: number]: string;\n} : T extends NumberArray ? JsonifyNumberArray<T> : T extends ReadonlyArray<infer U> ? Array<Jsonify<U>> : T extends object ? {\n [K in keyof T as [JsonifyObjectProperty<T[K]>] extends [never] ? never : K]: JsonifyObjectProperty<T[K]>;\n} : never;"
8211
8473
  },
8474
+ {
8475
+ "name": "JudgeRequest",
8476
+ "kind": "interface",
8477
+ "package": "@nifrajs/e2e",
8478
+ "signature": "export interface JudgeRequest {\n readonly kind: \"assert\" | \"waitFor\";\n readonly statement: string;\n readonly context?: string;\n readonly snapshot: string;\n readonly secrets: readonly string[];\n readonly signal: AbortSignal;\n}"
8479
+ },
8212
8480
  {
8213
8481
  "name": "JwkKey",
8214
8482
  "kind": "interface",
@@ -8733,7 +9001,7 @@
8733
9001
  "name": "LiveClientOptions",
8734
9002
  "kind": "interface",
8735
9003
  "package": "@nifrajs/web",
8736
- "signature": "export interface LiveClientOptions {\n /** The live socket, as `live({ path })` serves it. Default `/_nifra/live`. */\n readonly path?: string;\n /** The live load endpoint, as `live({ loadPath })` serves it. Default `/_nifra/live/load`. */\n readonly loadPath?: string;\n /**\n * Sends every live load. Give one that adds an `Authorization` header when the app authenticates\n * that way; cookies are sent by default.\n */\n readonly fetch?: (input: string, init: RequestInit) => Promise<Response>;\n /** Route id to its layout ids, outermost first. The generated client entry passes its own table. */\n readonly layoutIdsOf?: Readonly<Record<string, readonly string[]>>;\n}"
9004
+ "signature": "export interface LiveClientOptions {\n /** The live socket, as `live({ path })` serves it. Default `/_nifra/live`. */\n readonly path?: string;\n /** The live load endpoint, as `live({ loadPath })` serves it. Default `/_nifra/live/load`. */\n readonly loadPath?: string;\n /**\n * Sends every live load. Give one that adds an `Authorization` header when the app authenticates\n * that way; cookies are sent by default.\n */\n readonly fetch?: (input: string, init: RequestInit) => Promise<Response>;\n /** The server's origin when the page is served from another one, such as a native shell's. The\n * socket connects there; the loads reach it through `fetch`. */\n readonly origin?: string;\n /** Route id to its layout ids, outermost first. The generated client entry passes its own table. */\n readonly layoutIdsOf?: Readonly<Record<string, readonly string[]>>;\n}"
8737
9005
  },
8738
9006
  {
8739
9007
  "name": "LiveHubObject",
@@ -8983,6 +9251,24 @@
8983
9251
  "signature": "export interface Location {\n readonly pathname: string;\n readonly search: string;\n readonly hash: string;\n}",
8984
9252
  "doc": "/** The parsed current location. `hash` is always `\"\"` - the fragment is client-only and never reaches\n * the router state / server, so exposing a live hash would hydration-mismatch; read `window.location.hash`\n * directly (in an effect) if you truly need it. */"
8985
9253
  },
9254
+ {
9255
+ "name": "Locator",
9256
+ "kind": "class",
9257
+ "package": "@nifrajs/e2e",
9258
+ "signature": "export declare class Locator implements Finders {\n #private;\n readonly context: LocatorContext;\n readonly selector: Selector;\n constructor(context: LocatorContext, selector: Selector);\n getByRole(role: string, nameOrOptions?: string | RoleOptions): Locator;\n getByLabel(text: string, options?: TextOptions): Locator;\n getByText(text: string, options?: TextOptions): Locator;\n getByTestId(id: string): Locator;\n nth(index: number): Locator;\n filter(options: {\n readonly hasText: string;\n }): Locator;\n states(): Promise<readonly ElementState[]>;\n count(): Promise<number>;\n tap(): Promise<void>;\n fill(value: string): Promise<void>;\n press(key: string): Promise<void>;\n describe(): string;\n}"
9259
+ },
9260
+ {
9261
+ "name": "LocatorContext",
9262
+ "kind": "interface",
9263
+ "package": "@nifrajs/e2e",
9264
+ "signature": "export interface LocatorContext {\n readonly engine: Engine;\n readonly clock: Clock;\n readonly actionTimeout: number;\n readonly assertionTimeout: number;\n readonly pollInterval: number;\n /** Told when an assertion passes or fails, so the replay cache learns whether the steps before it held. */\n readonly onCheck?: ((passed: boolean) => Promise<void>) | undefined;\n}"
9265
+ },
9266
+ {
9267
+ "name": "LocatorMatchers",
9268
+ "kind": "interface",
9269
+ "package": "@nifrajs/e2e",
9270
+ "signature": "export interface LocatorMatchers {\n toBeVisible(options?: MatcherOptions): Promise<void>;\n toBeHidden(options?: MatcherOptions): Promise<void>;\n toHaveText(expected: string | RegExp, options?: MatcherOptions): Promise<void>;\n toContainText(expected: string | RegExp, options?: MatcherOptions): Promise<void>;\n toHaveCount(expected: number, options?: MatcherOptions): Promise<void>;\n toHaveValue(expected: string | RegExp, options?: MatcherOptions): Promise<void>;\n readonly not: LocatorMatchers;\n}"
9271
+ },
8986
9272
  {
8987
9273
  "name": "LogFields",
8988
9274
  "kind": "type",
@@ -9235,6 +9521,12 @@
9235
9521
  "signature": "export interface MatchChain {\n /** Layout ids (`orgs/[org]/_layout`), then the page's route id. */\n readonly ids: readonly string[];\n /** Each module's `handle` export, index-aligned with {@link ids}. */\n readonly handles: readonly unknown[];\n}",
9236
9522
  "doc": "/**\n * The modules a render stacks, as `useMatches` needs them: each one's id and `handle` export,\n * outermost layout first and the page (or status page) last. Built by the server for SSR and by the\n * generated client entry per route, from the same manifest, so both sides report the same matches.\n */"
9237
9523
  },
9524
+ {
9525
+ "name": "MatcherOptions",
9526
+ "kind": "interface",
9527
+ "package": "@nifrajs/e2e",
9528
+ "signature": "export interface MatcherOptions {\n /** Overrides the session's `assertionTimeout` for this assertion, in ms. */\n readonly timeout?: number;\n}"
9529
+ },
9238
9530
  {
9239
9531
  "name": "MaybePromise",
9240
9532
  "kind": "type",
@@ -9934,6 +10226,12 @@
9934
10226
  "package": "@nifrajs/agent",
9935
10227
  "signature": "export interface ModelGatewayUsage {\n readonly inputTokens?: number;\n readonly outputTokens?: number;\n}"
9936
10228
  },
10229
+ {
10230
+ "name": "ModelRequest",
10231
+ "kind": "type",
10232
+ "package": "@nifrajs/e2e",
10233
+ "signature": "export type ModelRequest = ActRequest | JudgeRequest | ExtractRequest;"
10234
+ },
9937
10235
  {
9938
10236
  "name": "ModelRoute",
9939
10237
  "kind": "interface",
@@ -10695,6 +10993,12 @@
10695
10993
  "signature": "export type NodeServeOutcome = {\n readonly kind: \"response\";\n readonly response: Response;\n} | {\n readonly kind: \"json\";\n readonly status: number;\n /** Header record after native hooks; repeated values are retained as arrays. */\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n /** Queued `Set-Cookie` lines, or `undefined`; the adapter emits one header line each. */\n readonly cookies: readonly string[] | undefined;\n /** The JSON body already stringified, or `null` for an empty (204) response. */\n readonly body: string | null;\n} | {\n readonly kind: \"body\";\n readonly status: number;\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n readonly body: string | Uint8Array;\n};",
10696
10994
  "doc": "/**\n * What {@link Server.resolveNode} returns: either a plain-data render the `@nifrajs/node` adapter writes\n * to the socket directly (`kind: \"json\"` - status + headers + cookies + a pre-stringified body, **no**\n * undici `Response` built or drained), a marked buffered response body (`kind: \"body\"` - e.g.\n * @nifrajs/web's non-deferred SSR HTML), or a `Response` (`kind: \"response\"`) for everything else\n * (redirects, 404/405/errors, unmarked or streaming bodies). Internal to the nifra<->node bridge.\n */"
10697
10995
  },
10996
+ {
10997
+ "name": "NodeServeOutcome",
10998
+ "kind": "type",
10999
+ "package": "@nifrajs/node",
11000
+ "signature": "export type NodeServeOutcome = {\n readonly kind: \"response\";\n readonly response: Response;\n} | {\n readonly kind: \"json\";\n readonly status: number;\n /** Header record after native hooks; repeated values are retained as arrays. */\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n /** Queued `Set-Cookie` lines, or `undefined`; the adapter emits one header line each. */\n readonly cookies: readonly string[] | undefined;\n /** The JSON body already stringified, or `null` for an empty (204) response. */\n readonly body: string | null;\n} | {\n readonly kind: \"body\";\n readonly status: number;\n readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;\n readonly body: string | Uint8Array;\n};"
11001
+ },
10698
11002
  {
10699
11003
  "name": "NodeServeOutcome",
10700
11004
  "kind": "type",
@@ -10706,7 +11010,7 @@
10706
11010
  "name": "NodeServer",
10707
11011
  "kind": "interface",
10708
11012
  "package": "@nifrajs/node",
10709
- "signature": "export interface NodeServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, then stop accepting connections,\n * let in-flight requests drain (up to `drainMs`), force-close stragglers + idle keep-alives, and\n * run the app's `onStop` hooks. Open WebSockets get a 1001 close when the drain starts and are\n * terminated if still open at the deadline. Mirrors nifra's Bun `stop()`.\n */\n stop(options?: NodeStopOptions): Promise<void>;\n}"
11013
+ "signature": "export interface NodeServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, then stop accepting connections,\n * let in-flight requests drain (up to `drainMs`), force-close stragglers + idle keep-alives, and\n * run the app's `onStop` hooks. Open WebSockets get a 1001 close when the drain starts and are\n * terminated if still open at the deadline. Mirrors nifra's Bun `stop()`.\n */\n stop(options?: NodeStopOptions): Promise<void>;\n /** `await using server = await serve(app, { port: 3000 })`: `stop()` with default options. Waits for a shutdown already under way. */\n [Symbol.asyncDispose](): Promise<void>;\n}"
10710
11014
  },
10711
11015
  {
10712
11016
  "name": "NodeStopOptions",
@@ -10715,6 +11019,13 @@
10715
11019
  "signature": "export interface NodeStopOptions {\n /** How long in-flight requests get to finish before the stop forces them closed. Default 10_000. */\n readonly drainMs?: number;\n /**\n * How long the server keeps serving after `stop()` began, before it stops accepting connections:\n * the time a load balancer takes to see readiness fail. Default 0.\n */\n readonly delayMs?: number;\n}",
10716
11020
  "doc": "/** How `stop()` winds the server down; the same shape as nifra's Bun `stop()` takes. */"
10717
11021
  },
11022
+ {
11023
+ "name": "NodeStopOptions",
11024
+ "kind": "interface",
11025
+ "package": "@nifrajs/node-uws",
11026
+ "signature": "export interface NodeStopOptions {\n readonly drainMs?: number;\n readonly delayMs?: number;\n}",
11027
+ "doc": "/** How `stop()` winds the server down; the same shape `serve()` takes in `@nifrajs/node`. */"
11028
+ },
10718
11029
  {
10719
11030
  "name": "NonceContext",
10720
11031
  "kind": "interface",
@@ -10972,6 +11283,13 @@
10972
11283
  "signature": "export interface OpenApiUiOptions {\n /** Where to serve the UI page. Default `\"/reference\"`. */\n readonly path?: string;\n /** Page title. Defaults to `info.title`. */\n readonly title?: string;\n /**\n * The Scalar script URL. Default: `@scalar/api-reference` 1.72.1's standalone build on jsDelivr,\n * pinned by {@link integrity}. Point it at a copy you serve yourself (no third-party origin to\n * allow in a `script-src` policy, nothing to trust but your own deploy).\n */\n readonly cdn?: string;\n /**\n * The script's Subresource Integrity hash (`sha384-...`), which makes the browser refuse a script\n * whose bytes differ. Default: the default build's hash when `cdn` is unset, none when it is set.\n * Pass the hash of your own copy, or `false` to send none.\n */\n readonly integrity?: string | false;\n}",
10973
11284
  "doc": "/** Scalar API-reference UI options. */"
10974
11285
  },
11286
+ {
11287
+ "name": "OpenArgs",
11288
+ "kind": "type",
11289
+ "package": "@nifrajs/e2e",
11290
+ "signature": "export type OpenArgs<P extends string> = [PathParams<P>] extends [never] ? [options?: {\n readonly query?: OpenOptions<P>[\"query\"];\n}] : [\n options: {\n readonly params: Record<PathParams<P>, string | number>;\n readonly query?: OpenOptions<P>[\"query\"];\n }\n];",
11291
+ "doc": "/** A route with `:params` must be given them; one without takes only an optional query. */"
11292
+ },
10975
11293
  {
10976
11294
  "name": "OpenGraphInput",
10977
11295
  "kind": "interface",
@@ -10985,6 +11303,12 @@
10985
11303
  "package": "@nifrajs/coding-agent",
10986
11304
  "signature": "export interface OpenHandoffInput {\n readonly runId: string;\n readonly nodeId: string;\n readonly capability: string;\n readonly requestId: string;\n /** Opaque origin role. */\n readonly from: string;\n /** Milliseconds until the boundary expires closed. Falls back to the coordinator default. */\n readonly expiresInMs?: number;\n /** When true, a paired approval is opened on the composed {@link ApprovalManager}, if present. */\n readonly requireApproval?: boolean;\n readonly sessionId?: string;\n}"
10987
11305
  },
11306
+ {
11307
+ "name": "OpenOptions",
11308
+ "kind": "interface",
11309
+ "package": "@nifrajs/e2e",
11310
+ "signature": "export interface OpenOptions<P extends string> {\n readonly params?: Record<PathParams<P>, string | number>;\n readonly query?: Readonly<Record<string, string | number | boolean>>;\n}"
11311
+ },
10988
11312
  {
10989
11313
  "name": "OperationDef",
10990
11314
  "kind": "interface",
@@ -11231,6 +11555,12 @@
11231
11555
  "signature": "export interface PagedStorageAdapter extends StorageAdapter {\n listPage(options?: StorageListPageOptions): Promise<StorageListPage>;\n}",
11232
11556
  "doc": "/** Optional cursor-listing capability. Kept out of {@link StorageAdapter} for simple stores. */"
11233
11557
  },
11558
+ {
11559
+ "name": "Param",
11560
+ "kind": "type",
11561
+ "package": "@nifrajs/e2e",
11562
+ "signature": "export type Param = string | number | boolean | Secret | Unique;"
11563
+ },
11234
11564
  {
11235
11565
  "name": "ParamConstraint",
11236
11566
  "kind": "interface",
@@ -11245,6 +11575,12 @@
11245
11575
  "signature": "export type Params<Path extends string> = Path extends `${string}?` ? SplitOptionalRun<Path> extends [infer Head extends string, infer Run extends string] ? Prettify<RawParams<Head> & Partial<RawParams<Run>>> : Prettify<RawParams<Path>> : Prettify<RawParams<Path>>;",
11246
11576
  "doc": "/**\n * The params a handler for `Path` reads. A parameter in a trailing optional run is optional, since\n * the one handler serves the path with and without it: `/users/:id?` → `{ id?: string }`.\n */"
11247
11577
  },
11578
+ {
11579
+ "name": "Params",
11580
+ "kind": "type",
11581
+ "package": "@nifrajs/e2e",
11582
+ "signature": "export type Params = Readonly<Record<string, Param>>;"
11583
+ },
11248
11584
  {
11249
11585
  "name": "Params",
11250
11586
  "kind": "type",
@@ -11286,6 +11622,13 @@
11286
11622
  "signature": "export type PartialMessages<M> = string extends keyof M ? M : {\n readonly [K in keyof M]?: PartialValue<M[K]>;\n};",
11287
11623
  "doc": "/** Another locale's catalog for `M`: every key optional at every level, and any string where `M`\n * has one. A key it lacks falls back through the formatter's `fallback` catalogs. */"
11288
11624
  },
11625
+ {
11626
+ "name": "PathParams",
11627
+ "kind": "type",
11628
+ "package": "@nifrajs/e2e",
11629
+ "signature": "export type PathParams<P extends string> = P extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer Tail}` ? Name | PathParams<`/${Tail}`> : Rest : never;",
11630
+ "doc": "/** The `:name` segments of a route path. */"
11631
+ },
11289
11632
  {
11290
11633
  "name": "PendingApprovalView",
11291
11634
  "kind": "interface",
@@ -11299,6 +11642,12 @@
11299
11642
  "signature": "export interface PendingBoundary {\n readonly name: string;\n readonly mode: BoundaryMode;\n readonly errorId?: string;\n readonly promise: Promise<unknown>;\n}",
11300
11643
  "doc": "/** A dynamic load that has started but is not part of the initial render barrier. */"
11301
11644
  },
11645
+ {
11646
+ "name": "PerformedDecision",
11647
+ "kind": "type",
11648
+ "package": "@nifrajs/e2e",
11649
+ "signature": "export type PerformedDecision = Exclude<ActDecision, {\n kind: \"done\";\n} | {\n kind: \"fail\";\n}>;"
11650
+ },
11302
11651
  {
11303
11652
  "name": "PgConnection",
11304
11653
  "kind": "interface",
@@ -11417,6 +11766,12 @@
11417
11766
  "package": "nifra",
11418
11767
  "signature": "export interface PlatformResponse {\n readonly statusCode: number;\n /** Single-valued headers. `set-cookie` never appears here - see the two fields below. */\n readonly headers: Readonly<Record<string, string>>;\n /**\n * Repeated headers, currently only `set-cookie`. Netlify Functions and API Gateway REST (v1) read\n * this; omitted when the response sets no cookies.\n */\n readonly multiValueHeaders?: Readonly<Record<string, readonly string[]>>;\n /** API Gateway HTTP API (v2) takes cookies here rather than in a header. Omitted when there are none. */\n readonly cookies?: readonly string[];\n readonly body: string;\n readonly isBase64Encoded: true;\n}"
11419
11768
  },
11769
+ {
11770
+ "name": "PlaywrightEngineOptions",
11771
+ "kind": "interface",
11772
+ "package": "@nifrajs/e2e",
11773
+ "signature": "export interface PlaywrightEngineOptions {\n readonly browser?: \"chromium\" | \"firefox\" | \"webkit\";\n readonly headless?: boolean;\n /** ms to wait for `data-nifra-hydrated` before `HYDRATION_TIMEOUT`. Default 5000. */\n readonly hydrationTimeout?: number;\n /** Replaces the Playwright launch; used by tests. */\n readonly launch?: () => Promise<PwBrowser>;\n /** Replaces the dynamic `import()` of `playwright`; used by tests. */\n readonly load?: (specifier: string) => Promise<unknown>;\n}"
11774
+ },
11420
11775
  {
11421
11776
  "name": "PluginBuilder",
11422
11777
  "kind": "type",
@@ -11730,7 +12085,7 @@
11730
12085
  "name": "PrerenderOptions",
11731
12086
  "kind": "interface",
11732
12087
  "package": "@nifrajs/web",
11733
- "signature": "export interface PrerenderOptions {\n /** The built web app (a `createWebApp` result). A synthetic `GET <origin><pattern>` is issued per\n * prerenderable route; its drained response body is written to disk. */\n readonly app: PrerenderApp;\n /** The route manifest's `routes`. Only **static** routes whose module exports `prerender === true`\n * are emitted; everything else is recorded in {@link PrerenderResult.skipped} with a reason. */\n readonly routes: readonly RouteEntry[];\n /** Absolute output directory. `<pattern>/index.html` is written under it (`/` → `index.html`). */\n readonly outDir: string;\n /** Origin for the synthetic request URL. Default `http://localhost`. Only the path is meaningful;\n * loaders see this as `request.url`, so set it if a loader builds absolute URLs from the origin. */\n readonly origin?: string;\n /** The secret scan every page and `_data.json` passes before it is written: what looks like a\n * credential, or the value of a non-public build environment variable, fails the prerender. */\n readonly secrets?: {\n /** Default: the build environment (`Bun.env`, else `process.env`). */\n readonly env?: Readonly<Record<string, string | undefined>>;\n /** Default `\"PUBLIC_\"`. */\n readonly publicEnvPrefix?: string;\n readonly exemptions?: readonly SecretExemption[];\n };\n}"
12088
+ "signature": "export interface PrerenderOptions {\n /** The built web app (a `createWebApp` result). A synthetic `GET <origin><pattern>` is issued per\n * prerenderable route; its drained response body is written to disk. */\n readonly app: PrerenderApp;\n /** The route manifest's `routes`. Only **static** routes whose module exports `prerender === true`\n * are emitted; everything else is recorded in {@link PrerenderResult.skipped} with a reason. */\n readonly routes: readonly RouteEntry[];\n /** Static routes to prerender for this run whether or not their module exports `prerender`, by path\n * (`\"/\"`, `\"/about\"`). A path that is not a static route of {@link routes} throws, so a typo cannot\n * build a site without the page it was meant to hold. */\n readonly include?: readonly string[] | undefined;\n /** Absolute output directory. `<pattern>/index.html` is written under it (`/` → `index.html`). */\n readonly outDir: string;\n /** Origin for the synthetic request URL. Default `http://localhost`. Only the path is meaningful;\n * loaders see this as `request.url`, so set it if a loader builds absolute URLs from the origin. */\n readonly origin?: string;\n /** The secret scan every page and `_data.json` passes before it is written: what looks like a\n * credential, or the value of a non-public build environment variable, fails the prerender. */\n readonly secrets?: {\n /** Default: the build environment (`Bun.env`, else `process.env`). */\n readonly env?: Readonly<Record<string, string | undefined>>;\n /** Default `\"PUBLIC_\"`. */\n readonly publicEnvPrefix?: string;\n readonly exemptions?: readonly SecretExemption[];\n };\n}"
11734
12089
  },
11735
12090
  {
11736
12091
  "name": "PrerenderResult",
@@ -12063,6 +12418,37 @@
12063
12418
  "package": "@nifrajs/storage",
12064
12419
  "signature": "export interface PutOptions {\n /** MIME type stored alongside the object (returned by `get`). */\n readonly contentType?: string;\n /** Arbitrary string metadata stored with the object. */\n readonly metadata?: Readonly<Record<string, string>>;\n}"
12065
12420
  },
12421
+ {
12422
+ "name": "PwBrowser",
12423
+ "kind": "interface",
12424
+ "package": "@nifrajs/e2e",
12425
+ "signature": "export interface PwBrowser {\n newContext(): Promise<PwContext>;\n close(): Promise<void>;\n}"
12426
+ },
12427
+ {
12428
+ "name": "PwContext",
12429
+ "kind": "interface",
12430
+ "package": "@nifrajs/e2e",
12431
+ "signature": "export interface PwContext {\n addCookies(cookies: {\n name: string;\n value: string;\n url: string;\n }[]): Promise<void>;\n newPage(): Promise<PwPage>;\n close(): Promise<void>;\n}"
12432
+ },
12433
+ {
12434
+ "name": "PwFinder",
12435
+ "kind": "interface",
12436
+ "package": "@nifrajs/e2e",
12437
+ "signature": "export interface PwFinder {\n getByRole(role: string, options?: {\n name?: string;\n exact?: boolean;\n }): PwLocator;\n getByLabel(text: string, options?: {\n exact?: boolean;\n }): PwLocator;\n getByText(text: string, options?: {\n exact?: boolean;\n }): PwLocator;\n getByTestId(id: string): PwLocator;\n}",
12438
+ "doc": "/** The slice of Playwright this engine calls, so the package carries no Playwright types and tests can stand in for it. */"
12439
+ },
12440
+ {
12441
+ "name": "PwLocator",
12442
+ "kind": "interface",
12443
+ "package": "@nifrajs/e2e",
12444
+ "signature": "export interface PwLocator extends PwFinder {\n filter(options: {\n hasText: string;\n }): PwLocator;\n nth(index: number): PwLocator;\n evaluateAll<R>(pageFunction: (elements: readonly unknown[]) => R): Promise<R>;\n click(options: {\n timeout: number;\n }): Promise<void>;\n fill(value: string, options: {\n timeout: number;\n }): Promise<void>;\n press(key: string, options: {\n timeout: number;\n }): Promise<void>;\n}"
12445
+ },
12446
+ {
12447
+ "name": "PwPage",
12448
+ "kind": "interface",
12449
+ "package": "@nifrajs/e2e",
12450
+ "signature": "export interface PwPage extends PwFinder {\n locator(selector: string): {\n ariaSnapshot(): Promise<string>;\n };\n goto(url: string, options: {\n waitUntil: \"load\";\n }): Promise<unknown>;\n url(): string;\n evaluate<R>(expression: string): Promise<R>;\n waitForSelector(selector: string, options: {\n state: \"attached\";\n timeout: number;\n }): Promise<unknown>;\n waitForLoadState(state: \"domcontentloaded\"): Promise<void>;\n}"
12451
+ },
12066
12452
  {
12067
12453
  "name": "PwaManifestOptions",
12068
12454
  "kind": "interface",
@@ -12575,6 +12961,13 @@
12575
12961
  "package": "@nifrajs/core",
12576
12962
  "signature": "export interface ReconciliationWorkerResult {\n readonly acquired: boolean;\n readonly pages: number;\n readonly scanned: number;\n readonly handled: number;\n}"
12577
12963
  },
12964
+ {
12965
+ "name": "RecordedAction",
12966
+ "kind": "type",
12967
+ "package": "@nifrajs/e2e",
12968
+ "signature": "export type RecordedAction = {\n readonly kind: \"tap\";\n readonly target: Target;\n readonly matches: number;\n} | {\n readonly kind: \"fill\";\n readonly target: Target;\n readonly matches: number;\n readonly value: string;\n} | {\n readonly kind: \"press\";\n readonly target: Target;\n readonly matches: number;\n readonly key: string;\n} | {\n readonly kind: \"goto\";\n readonly path: string;\n};",
12969
+ "doc": "/** One action as it was taken. A fill's value and a goto's path keep their `{name}` placeholders. */"
12970
+ },
12578
12971
  {
12579
12972
  "name": "RecordingObservationLifecycle",
12580
12973
  "kind": "interface",
@@ -13685,6 +14078,12 @@
13685
14078
  "package": "@nifrajs/core",
13686
14079
  "signature": "export interface RobotsRule {\n /** A single user-agent token (`\"*\"`, `\"Googlebot\"`, …) or several sharing the same directives. */\n readonly userAgent: string | readonly string[];\n readonly allow?: readonly string[];\n readonly disallow?: readonly string[];\n /** Seconds between requests (honored by some crawlers). */\n readonly crawlDelay?: number;\n}"
13687
14080
  },
14081
+ {
14082
+ "name": "RoleOptions",
14083
+ "kind": "interface",
14084
+ "package": "@nifrajs/e2e",
14085
+ "signature": "export interface RoleOptions extends TextOptions {\n readonly name?: string;\n}"
14086
+ },
13688
14087
  {
13689
14088
  "name": "RouteActionReturn",
13690
14089
  "kind": "type",
@@ -13876,7 +14275,7 @@
13876
14275
  "name": "RouteModule",
13877
14276
  "kind": "interface",
13878
14277
  "package": "@nifrajs/web",
13879
- "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /**\n * Named, independently navigable route regions. Each name is bound to route patterns from the\n * generated route table; URL state selects only one of these registered identities.\n */\n readonly routeSlots?: Readonly<Record<string, readonly string[]>>;\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}",
14278
+ "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /**\n * Named, independently navigable route regions. Each name is bound to route patterns from the\n * generated route table; URL state selects only one of these registered identities.\n */\n readonly routeSlots?: Readonly<Record<string, readonly string[]>>;\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 and,\n * as its second argument, whether the default same-origin check would admit the request, so a route\n * can accept its own site and one more origin: `(origin, sameOrigin) => sameOrigin || origin === shell`.\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, sameOrigin: boolean) => 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}",
13880
14279
  "doc": "/** A route module - the default component + optional loader / action / meta. */"
13881
14280
  },
13882
14281
  {
@@ -14115,6 +14514,13 @@
14115
14514
  "signature": "export interface RouterContextValue {\n /** The matched route's decoded path params (`/users/:id` → `{ id: \"7\" }`). */\n readonly params: Readonly<Record<string, string>>;\n /** The current URL's `pathname + search` (no hash - the router never carries one). */\n readonly path: string;\n /** The route's typed, validated search params (the loader's `ctx.search`), derived from the URL via\n * the shared `searchOf` on SSR + client alike, read by {@link useSearch}. `{}` when the route\n * declares no `searchSchema` (then it is the raw parsed query) or outside a nifra route tree. */\n readonly search: Record<string, unknown>;\n /** True while a client navigation (or revalidation) is in flight - the current route stays mounted\n * until the new one is ready. Always `false` on SSR (loaders block before render). Drives loading UI\n * via {@link useNavigation}. */\n readonly pending: boolean;\n /** The `pathname + search` a navigation is transitioning TO while `pending` (`undefined` when idle or\n * during a same-route revalidation). Powers {@link NavLink}'s per-link `isPending`. */\n readonly pendingPath?: string | undefined;\n /** The render's props, which {@link useMatches} derives the matches from. */\n readonly renderProps?: RenderProps | undefined;\n}",
14116
14515
  "doc": "/** The current route the routing hooks read. Provided by `compose` on SSR + client mount alike. */"
14117
14516
  },
14517
+ {
14518
+ "name": "RouterFetch",
14519
+ "kind": "type",
14520
+ "package": "@nifrajs/web",
14521
+ "signature": "export type RouterFetch = (input: string, init?: RequestInit) => Promise<Response>;",
14522
+ "doc": "/** A `fetch` the router sends its server requests through. */"
14523
+ },
14118
14524
  {
14119
14525
  "name": "RouterMatch",
14120
14526
  "kind": "type",
@@ -14553,14 +14959,14 @@
14553
14959
  "name": "RunningServer",
14554
14960
  "kind": "interface",
14555
14961
  "package": "@nifrajs/core",
14556
- "signature": "export interface RunningServer {\n readonly port: number;\n readonly hostname: string;\n readonly pendingRequests: number;\n stop(closeActiveConnections?: boolean): void;\n /** Bun's native topic broadcast, present on the Bun `Server` handle. `app.publish` delegates to it\n * in native-pubsub mode; absent on other runtimes' running-server views. */\n publish?(topic: string, data: string | ArrayBufferView | ArrayBuffer): number;\n}",
14962
+ "signature": "export interface RunningServer {\n readonly port: number;\n readonly hostname: string;\n readonly pendingRequests: number;\n stop(closeActiveConnections?: boolean): void;\n /** `await using server = app.listen(3000)`: the app's graceful `stop()` with default options, not Bun's raw one. Waits for a shutdown already under way. */\n [Symbol.asyncDispose](): Promise<void>;\n /** Bun's native topic broadcast, present on the Bun `Server` handle. `app.publish` delegates to it\n * in native-pubsub mode; absent on other runtimes' running-server views. */\n publish?(topic: string, data: string | ArrayBufferView | ArrayBuffer): number;\n}",
14557
14963
  "doc": "/**\n * The handle `listen()` returns - the slice of Bun's server nifra holds and exposes.\n * Declared explicitly (rather than `ReturnType<typeof Bun.serve>`) so the public type\n * surface doesn't leak the ambient `Bun` global into consumers' `.d.ts` resolution.\n */"
14558
14964
  },
14559
14965
  {
14560
14966
  "name": "RunningServer",
14561
14967
  "kind": "interface",
14562
14968
  "package": "nifra",
14563
- "signature": "export interface RunningServer {\n readonly port: number;\n readonly hostname: string;\n readonly pendingRequests: number;\n stop(closeActiveConnections?: boolean): void;\n /** Bun's native topic broadcast, present on the Bun `Server` handle. `app.publish` delegates to it\n * in native-pubsub mode; absent on other runtimes' running-server views. */\n publish?(topic: string, data: string | ArrayBufferView | ArrayBuffer): number;\n}",
14969
+ "signature": "export interface RunningServer {\n readonly port: number;\n readonly hostname: string;\n readonly pendingRequests: number;\n stop(closeActiveConnections?: boolean): void;\n /** `await using server = app.listen(3000)`: the app's graceful `stop()` with default options, not Bun's raw one. Waits for a shutdown already under way. */\n [Symbol.asyncDispose](): Promise<void>;\n /** Bun's native topic broadcast, present on the Bun `Server` handle. `app.publish` delegates to it\n * in native-pubsub mode; absent on other runtimes' running-server views. */\n publish?(topic: string, data: string | ArrayBufferView | ArrayBuffer): number;\n}",
14564
14970
  "doc": "/**\n * The handle `listen()` returns - the slice of Bun's server nifra holds and exposes.\n * Declared explicitly (rather than `ReturnType<typeof Bun.serve>`) so the public type\n * surface doesn't leak the ambient `Bun` global into consumers' `.d.ts` resolution.\n */"
14565
14971
  },
14566
14972
  {
@@ -14902,13 +15308,13 @@
14902
15308
  "name": "ScaffoldOptions",
14903
15309
  "kind": "interface",
14904
15310
  "package": "create-nifra",
14905
- "signature": "export interface ScaffoldOptions {\n /** Destination directory. */\n readonly target: string;\n /** Template to copy. Default `\"api\"`. */\n readonly template?: TemplateName;\n /** Frontend framework (site template only). Default `\"react\"`. */\n readonly framework?: string;\n /** Where the site deploys (site template only): `bun` (default), `node`, `deno`, `cloudflare` or\n * `vercel`. */\n readonly deployTarget?: string;\n /** Add a Dockerfile that builds and runs the server (`bun` and `node` targets). */\n readonly docker?: boolean;\n /** Emit a CI deploy workflow for the site's target. Only `\"github\"` today. */\n readonly ci?: string;\n /** Wire a data layer: `drizzle-{libsql,postgres,sqlite}` | `prisma-{postgres,sqlite}` | `kysely-postgres`. */\n readonly db?: string;\n /** Wire authentication: `better-auth` (requires `--db` - auth needs a database). */\n readonly auth?: string;\n /** Allow scaffolding into a non-empty directory (copies template, overwrites collisions). */\n readonly force?: boolean;\n /** Path to a local nifra monorepo - replaces `@nifrajs/*` semver deps with `file:` refs so\n * the app runs against the local source before the packages are published to npm. */\n readonly link?: string;\n}"
15311
+ "signature": "export interface ScaffoldOptions {\n /** Destination directory. */\n readonly target: string;\n /** Template to copy. Default `\"api\"`. */\n readonly template?: TemplateName;\n /** Frontend framework (site template only). Default `\"react\"`. */\n readonly framework?: string;\n /** Where the site deploys (site template only): `bun` (default), `node`, `deno`, `cloudflare` or\n * `vercel`. */\n readonly deployTarget?: string;\n /** Add a Dockerfile that builds and runs the server (`bun` and `node` targets). */\n readonly docker?: boolean;\n /** Emit a CI deploy workflow for the site's target. Only `\"github\"` today. */\n readonly ci?: string;\n /** Add a native shell for the site's pages: `tauri` (Tauri 2). */\n readonly shell?: string;\n /** Wire a data layer: `drizzle-{libsql,postgres,sqlite}` | `prisma-{postgres,sqlite}` | `kysely-postgres`. */\n readonly db?: string;\n /** Wire authentication: `better-auth` (requires `--db` - auth needs a database). */\n readonly auth?: string;\n /** Allow scaffolding into a non-empty directory (copies template, overwrites collisions). */\n readonly force?: boolean;\n /** Path to a local nifra monorepo - replaces `@nifrajs/*` semver deps with `file:` refs so\n * the app runs against the local source before the packages are published to npm. */\n readonly link?: string;\n}"
14906
15312
  },
14907
15313
  {
14908
15314
  "name": "ScaffoldResult",
14909
15315
  "kind": "interface",
14910
15316
  "package": "create-nifra",
14911
- "signature": "export interface ScaffoldResult {\n readonly name: string;\n readonly template: TemplateName;\n readonly framework?: Framework;\n /** Where a site deploys, and whether it ships a Dockerfile. */\n readonly deploy?: {\n readonly target: DeployTarget;\n readonly label: string;\n readonly docker: boolean;\n };\n /** The CI provider a workflow was generated for, when `--ci` was passed. */\n readonly ci?: \"github\";\n /** Repo secrets the generated workflow needs (for the next-steps message). */\n readonly ciSecrets?: readonly string[];\n /** The Drizzle preset wired in, when `--db` was passed. */\n readonly db?: DbChoice;\n /** The auth preset wired in, when `--auth` was passed. */\n readonly auth?: AuthChoice;\n /** Local nifra monorepo path when `--link` was used; undefined when using published packages. */\n readonly link?: string;\n}"
15317
+ "signature": "export interface ScaffoldResult {\n readonly name: string;\n readonly template: TemplateName;\n readonly framework?: Framework;\n /** Where a site deploys, and whether it ships a Dockerfile. */\n readonly deploy?: {\n readonly target: DeployTarget;\n readonly label: string;\n readonly docker: boolean;\n };\n /** The native shell added, when `--shell` was passed. */\n readonly shell?: \"tauri\";\n /** The CI provider a workflow was generated for, when `--ci` was passed. */\n readonly ci?: \"github\";\n /** Repo secrets the generated workflow needs (for the next-steps message). */\n readonly ciSecrets?: readonly string[];\n /** The Drizzle preset wired in, when `--db` was passed. */\n readonly db?: DbChoice;\n /** The auth preset wired in, when `--auth` was passed. */\n readonly auth?: AuthChoice;\n /** Local nifra monorepo path when `--link` was used; undefined when using published packages. */\n readonly link?: string;\n}"
14912
15318
  },
14913
15319
  {
14914
15320
  "name": "ScheduledController",
@@ -14942,7 +15348,7 @@
14942
15348
  "name": "Scheduler",
14943
15349
  "kind": "interface",
14944
15350
  "package": "@nifrajs/cron",
14945
- "signature": "export interface Scheduler {\n /** Register a job. Throws `CronError` now (not at fire time) on a bad expression or duplicate name. */\n add(name: string, expression: string, handler: CronHandler): Scheduler;\n /** Begin checking on an interval (default 15s - well under a minute, so no minute is missed). */\n start(checkIntervalMs?: number): void;\n /** Stop checking. In-flight handlers are left to finish (graceful). */\n stop(): void;\n /** Run every job DUE at `now` that hasn't fired this minute. Exposed for tests + custom drivers. */\n tick(now?: Date): void;\n /** Fire a job immediately by name, off-schedule (e.g. a manual admin trigger). No-op if unknown. */\n runNow(name: string): void;\n /** Registered job names, in insertion order. */\n readonly jobNames: readonly string[];\n}"
15351
+ "signature": "export interface Scheduler {\n /** Register a job. Throws `CronError` now (not at fire time) on a bad expression or duplicate name. */\n add(name: string, expression: string, handler: CronHandler): Scheduler;\n /** Begin checking on an interval (default 15s - well under a minute, so no minute is missed). */\n start(checkIntervalMs?: number): void;\n /** Stop checking. In-flight handlers are left to finish (graceful). */\n stop(): void;\n /** `using scheduler = createScheduler()`: the same as `stop()`. */\n [Symbol.dispose](): void;\n /** Run every job DUE at `now` that hasn't fired this minute. Exposed for tests + custom drivers. */\n tick(now?: Date): void;\n /** Fire a job immediately by name, off-schedule (e.g. a manual admin trigger). No-op if unknown. */\n runNow(name: string): void;\n /** Registered job names, in insertion order. */\n readonly jobNames: readonly string[];\n}"
14946
15352
  },
14947
15353
  {
14948
15354
  "name": "SchedulerOptions",
@@ -14978,6 +15384,13 @@
14978
15384
  "signature": "export interface ScoreTolerance {\n readonly rubricId?: string;\n /** Absolute worsening tolerated. Default 0. */\n readonly abs?: number;\n /** Relative worsening tolerated, as a fraction of the baseline magnitude. Default 0. */\n readonly rel?: number;\n}",
14979
15385
  "doc": "/** Explicit tolerance for a score regression. `rubricId` omitted applies to every rubric. */"
14980
15386
  },
15387
+ {
15388
+ "name": "Screen",
15389
+ "kind": "class",
15390
+ "package": "@nifrajs/e2e",
15391
+ "signature": "export declare class Screen implements Finders {\n #private;\n constructor(context: LocatorContext);\n getByRole(role: string, nameOrOptions?: string | RoleOptions): Locator;\n getByLabel(text: string, options?: TextOptions): Locator;\n getByText(text: string, options?: TextOptions): Locator;\n getByTestId(id: string): Locator;\n}",
15392
+ "doc": "/** The page root: every chain starts here. */"
15393
+ },
14981
15394
  {
14982
15395
  "name": "ScriptDescriptor",
14983
15396
  "kind": "interface",
@@ -15037,6 +15450,13 @@
15037
15450
  "signature": "export type SearchSchemaOf<Module> = Module extends {\n readonly searchSchema: infer S;\n} ? S : undefined;",
15038
15451
  "doc": "/** The `searchSchema` a route's frontend half declares, or `undefined`. */"
15039
15452
  },
15453
+ {
15454
+ "name": "Secret",
15455
+ "kind": "class",
15456
+ "package": "@nifrajs/e2e",
15457
+ "signature": "export declare class Secret {\n #private;\n readonly name: string;\n constructor(name: string, value: string);\n /** Read by the step runner when it types the value; nothing else should call it. */\n static reveal(secret: Secret): string;\n toJSON(): string;\n toString(): string;\n}",
15458
+ "doc": "/**\n * A value a step may use but the model must never read: it is typed into the page by name, and\n * `String(secret)`, `JSON.stringify(secret)` and template literals all print the name only.\n */"
15459
+ },
15040
15460
  {
15041
15461
  "name": "SecretExemption",
15042
15462
  "kind": "interface",
@@ -15109,6 +15529,12 @@
15109
15529
  "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};",
15110
15530
  "doc": "/** What a `[lang]` segment value means for the request. */"
15111
15531
  },
15532
+ {
15533
+ "name": "Selector",
15534
+ "kind": "type",
15535
+ "package": "@nifrajs/e2e",
15536
+ "signature": "export type Selector = readonly Step[];"
15537
+ },
15112
15538
  {
15113
15539
  "name": "SelfHealingController",
15114
15540
  "kind": "class",
@@ -15146,6 +15572,12 @@
15146
15572
  "package": "@nifrajs/node",
15147
15573
  "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}"
15148
15574
  },
15575
+ {
15576
+ "name": "ServeOptions",
15577
+ "kind": "interface",
15578
+ "package": "@nifrajs/node-uws",
15579
+ "signature": "export interface ServeOptions extends HostPolicyOptions {\n readonly port: number;\n readonly hostname?: string;\n /** The scheme `Request.url` carries. `\"https\"` by default when {@link tls} is set, else `\"http\"`. */\n readonly protocol?: \"http\" | \"https\";\n readonly tls?: UwsTlsOptions;\n /** SIGTERM/SIGINT call `stop()`; off by default, as in `@nifrajs/node`. */\n readonly gracefulSignals?: boolean | NodeStopOptions;\n}"
15580
+ },
15149
15581
  {
15150
15582
  "name": "ServeStaticOptions",
15151
15583
  "kind": "interface",
@@ -15189,14 +15621,14 @@
15189
15621
  "name": "Server",
15190
15622
  "kind": "class",
15191
15623
  "package": "@nifrajs/core",
15192
- "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 /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\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 adapter 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 custom topic adapter,\n * a validated-send route, 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 * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<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 route's params → 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 routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\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 ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * 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}",
15624
+ "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 /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\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 adapter 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 custom topic adapter,\n * a validated-send route, or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private 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 stopRun;\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 * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<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 route's params → 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 routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\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 ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * 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(options?: StopOptions): Promise<void>;\n private stopListener;\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}",
15193
15625
  "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 */"
15194
15626
  },
15195
15627
  {
15196
15628
  "name": "Server",
15197
15629
  "kind": "class",
15198
15630
  "package": "nifra",
15199
- "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 /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\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 adapter 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 custom topic adapter,\n * a validated-send route, 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 * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<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 route's params → 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 routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\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 ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * 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}",
15631
+ "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 /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\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 adapter 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 custom topic adapter,\n * a validated-send route, or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private 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 stopRun;\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 * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<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 route's params → 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 routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\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 ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * 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(options?: StopOptions): Promise<void>;\n private stopListener;\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}",
15200
15632
  "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 */"
15201
15633
  },
15202
15634
  {
@@ -15342,6 +15774,19 @@
15342
15774
  "signature": "export interface ServerEntrySelfHost {\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n readonly delayMs?: number;\n };\n readonly idleTimeoutSec?: number;\n}",
15343
15775
  "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 */"
15344
15776
  },
15777
+ {
15778
+ "name": "ServerFetch",
15779
+ "kind": "type",
15780
+ "package": "@nifrajs/web",
15781
+ "signature": "export type ServerFetch = RouterFetch & {\n readonly origin: string;\n};",
15782
+ "doc": "/** A router `fetch` that also names the origin it sends to, which the live socket needs. */"
15783
+ },
15784
+ {
15785
+ "name": "ServerFetchOptions",
15786
+ "kind": "interface",
15787
+ "package": "@nifrajs/web",
15788
+ "signature": "export interface ServerFetchOptions {\n /** The server's origin, for example `https://api.example.com`. */\n readonly origin: string;\n /** Headers added to every request to the server's origin, or a function that returns them, such as a\n * bearer token that refreshes. They replace a request's own header of the same name. A request to any\n * other origin goes out as written, without them. */\n readonly headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);\n /** Sent as the `credentials` of every request to the server's origin. Left out, the request's own\n * value applies, which sends no cookie to another origin. For a cookie session use `\"include\"`, and the\n * server needs `credentials: true` in its CORS options and cookies a cross-site context may send\n * (`SameSite=None; Secure`); a web view may restrict them further. */\n readonly credentials?: RequestCredentials;\n /** The `fetch` the requests go out through, such as a native shell's own HTTP client. */\n readonly fetch?: RouterFetch;\n}"
15789
+ },
15345
15790
  {
15346
15791
  "name": "ServerFn",
15347
15792
  "kind": "interface",
@@ -15433,6 +15878,12 @@
15433
15878
  "signature": "export interface ServerFnStubPlugin {\n readonly name: string;\n readonly enforce: \"pre\";\n /** Applied only to the CLIENT build; the server build keeps the real module. */\n readonly applyToEnvironment?: (environment: {\n readonly name: string;\n }) => boolean;\n transform(code: string, id: string, options?: {\n readonly ssr?: boolean;\n }): {\n code: string;\n map: null;\n } | null;\n}",
15434
15879
  "doc": "/** The slice of a Vite/Rollup plugin this returns. Structural, so `vite` stays an optional peer. */"
15435
15880
  },
15881
+ {
15882
+ "name": "ServerFunctionsOptions",
15883
+ "kind": "interface",
15884
+ "package": "@nifrajs/web",
15885
+ "signature": "export interface ServerFunctionsOptions {\n /**\n * Origins besides the server's own that may call these functions, as the `Origin` header writes\n * them: a native shell's pages post from `tauri://localhost` or `capacitor://localhost`. Exact\n * matches, or a function that decides. Left out, only the server's own origin is accepted.\n */\n readonly origins?: ReadonlyArray<string> | ((origin: string) => boolean);\n}"
15886
+ },
15436
15887
  {
15437
15888
  "name": "ServerOnlyFinding",
15438
15889
  "kind": "interface",
@@ -15444,13 +15895,13 @@
15444
15895
  "name": "ServerOptions",
15445
15896
  "kind": "interface",
15446
15897
  "package": "@nifrajs/core",
15447
- "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 /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\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}"
15898
+ "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 route: exact origins, or a function that receives the\n * `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can send with the\n * visitor's cookies and no preflight, so one whose `Origin` names another site is refused with `403`\n * before it is read. A route without a body schema refuses the same sites' unsafe requests that carry\n * no content type too, which `fetch` with `no-cors` sends; one with a script-set `Authorization` header\n * passes, since a browser preflights it, but `Basic`, `Digest`, `Negotiate` and `NTLM` do not, because\n * a browser re-sends those from its auth cache without one. Same-origin posts and requests without an `Origin`, such as\n * server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n * The origins a `cors()` list or predicate and a `csrf({ origins })` list name are trusted as well,\n * so a frontend those already allow needs no second list here; `cors()` with `\"*\"` adds none. That\n * trust is for form posts to this server's own routes only: a mounted or grouped server keeps its own\n * policy, so a parent that must accept the same sites sets them in its own `formOrigins`, and a web\n * page action checks the origin against the backend's `allowedOrigins`, not this list.\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 /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\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}"
15448
15899
  },
15449
15900
  {
15450
15901
  "name": "ServerOptions",
15451
15902
  "kind": "interface",
15452
15903
  "package": "nifra",
15453
- "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 /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\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}"
15904
+ "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 route: exact origins, or a function that receives the\n * `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can send with the\n * visitor's cookies and no preflight, so one whose `Origin` names another site is refused with `403`\n * before it is read. A route without a body schema refuses the same sites' unsafe requests that carry\n * no content type too, which `fetch` with `no-cors` sends; one with a script-set `Authorization` header\n * passes, since a browser preflights it, but `Basic`, `Digest`, `Negotiate` and `NTLM` do not, because\n * a browser re-sends those from its auth cache without one. Same-origin posts and requests without an `Origin`, such as\n * server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n * The origins a `cors()` list or predicate and a `csrf({ origins })` list name are trusted as well,\n * so a frontend those already allow needs no second list here; `cors()` with `\"*\"` adds none. That\n * trust is for form posts to this server's own routes only: a mounted or grouped server keeps its own\n * policy, so a parent that must accept the same sites sets them in its own `formOrigins`, and a web\n * page action checks the origin against the backend's `allowedOrigins`, not this list.\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 /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\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}"
15454
15905
  },
15455
15906
  {
15456
15907
  "name": "ServerPrerenderedPage",
@@ -16275,6 +16726,13 @@
16275
16726
  "package": "@nifrajs/mcp",
16276
16727
  "signature": "export interface StdioTransportOptions {\n /** Default `process.stdin`. String chunks are UTF-8 encoded before framing. */\n readonly input?: AsyncIterable<Uint8Array | string>;\n /** Default `process.stdout`. */\n readonly output?: StdioOutput;\n /** Cap on one message in UTF-8 bytes, in either direction. Default {@link MAX_STDIO_MESSAGE_BYTES}. */\n readonly maxMessageBytes?: number;\n /**\n * A client request or notification. Resolve to its response, or `null` to send none. Requests are\n * dispatched concurrently as their lines arrive. A rejection is answered with a generic `-32603`\n * error for a request and with nothing for a notification - the rejection's message is never sent.\n */\n readonly onRequest: (message: JsonRpcRequest, connection: StdioConnection) => Promise<JsonRpcResponse | null>;\n /**\n * A response to a request this side sent through {@link StdioConnection.send}. Return `false` when no\n * request with that id is pending, and the line is answered as an Invalid Request. Omitted, every\n * response is invalid.\n */\n readonly onResponse?: (message: JsonRpcResponse, connection: StdioConnection) => boolean;\n}"
16277
16728
  },
16729
+ {
16730
+ "name": "Step",
16731
+ "kind": "type",
16732
+ "package": "@nifrajs/e2e",
16733
+ "signature": "export type Step = {\n readonly kind: \"role\";\n readonly role: string;\n readonly name?: string;\n readonly exact?: boolean;\n} | {\n readonly kind: \"label\";\n readonly text: string;\n readonly exact?: boolean;\n} | {\n readonly kind: \"text\";\n readonly text: string;\n readonly exact?: boolean;\n} | {\n readonly kind: \"testId\";\n readonly id: string;\n} | {\n readonly kind: \"hasText\";\n readonly text: string;\n} | {\n readonly kind: \"nth\";\n readonly index: number;\n};",
16734
+ "doc": "/** One link of a locator chain; the first finds from the page, each later one searches inside the matches so far. */"
16735
+ },
16278
16736
  {
16279
16737
  "name": "StepCatalog",
16280
16738
  "kind": "interface",
@@ -16296,6 +16754,12 @@
16296
16754
  "signature": "export interface StepFailure {\n readonly code: \"STEP_FAILED\" | \"GATE_REJECTED\";\n /** What the step threw (bounded), or a rejecting verify gate's string `reason`. Not masked. */\n readonly message?: string;\n}",
16297
16755
  "doc": "/** Why one node failed, handed to {@link OrchestrationHostOptions.onStepFailed}. */"
16298
16756
  },
16757
+ {
16758
+ "name": "StepOptions",
16759
+ "kind": "interface",
16760
+ "package": "@nifrajs/e2e",
16761
+ "signature": "export interface StepOptions {\n readonly params?: Params;\n readonly signal?: AbortSignal;\n}"
16762
+ },
16299
16763
  {
16300
16764
  "name": "StepRunContext",
16301
16765
  "kind": "interface",
@@ -16303,6 +16767,13 @@
16303
16767
  "signature": "export interface StepRunContext {\n readonly nodeId: string;\n readonly planDigest: string;\n readonly signal: AbortSignal;\n /** Caller-owned artifact sink. The step routes any raw payload here to get a content-free ref. */\n readonly artifact: ArtifactPort;\n readonly values: ReadonlyMap<string, unknown>;\n set(name: string, value: unknown): void;\n}",
16304
16768
  "doc": "/** Runtime context handed to a step body. Payloads leave only through {@link StepRunContext.artifact}. */"
16305
16769
  },
16770
+ {
16771
+ "name": "StopReason",
16772
+ "kind": "type",
16773
+ "package": "@nifrajs/e2e",
16774
+ "signature": "export type StopReason = \"target-not-found\" | \"ambiguous\" | \"end-mismatch\" | \"action-uncertain\" | \"route-mismatch\";",
16775
+ "doc": "/** Why a replay stopped short of finishing the recorded actions. */"
16776
+ },
16306
16777
  {
16307
16778
  "name": "StorageAdapter",
16308
16779
  "kind": "interface",
@@ -16543,7 +17014,7 @@
16543
17014
  "name": "Subscription",
16544
17015
  "kind": "interface",
16545
17016
  "package": "@nifrajs/client",
16546
- "signature": "export interface Subscription {\n /** Stop the subscription: aborts the live stream and cancels any pending reconnect. */\n close(): void;\n}"
17017
+ "signature": "export interface Subscription {\n /** Stop the subscription: aborts the live stream and cancels any pending reconnect. */\n close(): void;\n /** `using sub = client.x.subscribe(...)`: the same as `close()`. A runtime without `Symbol.dispose` needs a polyfill first. */\n [Symbol.dispose](): void;\n}"
16547
17018
  },
16548
17019
  {
16549
17020
  "name": "SvelteUI",
@@ -16606,6 +17077,13 @@
16606
17077
  "signature": "export interface TableCatalogs {\n /** Each locale's catalog: every table under its id, whose dots nest, so a finding's key reads as the\n * table's id (`routes/index.tsx:12`, or `shop.faq.0` for a list item). Every locale `locales`\n * declares has one, empty when no table has a value for it. */\n readonly catalogs: Readonly<Record<string, MessageTree>>;\n /** Ids that collide with another table's (`home` beside `home.title`); those tables are left out. */\n readonly conflicts: readonly string[];\n}",
16607
17078
  "doc": "/** Copy tables as one catalog per locale, for {@link checkCatalogs}. */"
16608
17079
  },
17080
+ {
17081
+ "name": "Target",
17082
+ "kind": "interface",
17083
+ "package": "@nifrajs/e2e",
17084
+ "signature": "export interface Target {\n readonly role?: string;\n readonly name?: string;\n readonly label?: string;\n readonly text?: string;\n readonly testId?: string;\n readonly exact?: boolean;\n /** Zero-based pick among several matches. */\n readonly nth?: number;\n}",
17085
+ "doc": "/** Which control a step means: exactly one of `role`, `label`, `text`, `testId`. */"
17086
+ },
16609
17087
  {
16610
17088
  "name": "Template",
16611
17089
  "kind": "class",
@@ -16644,6 +17122,12 @@
16644
17122
  "package": "@nifrajs/testing",
16645
17123
  "signature": "export interface TestSessionOptions extends Omit<ClientOptions, \"fetch\"> {\n /** Origin used to resolve relative paths. Default `\"http://nifra.internal\"`. */\n readonly origin?: string;\n /** Reuse an existing jar (e.g. seed a session cookie, or share one across sessions). */\n readonly cookies?: CookieJar;\n}"
16646
17124
  },
17125
+ {
17126
+ "name": "TextOptions",
17127
+ "kind": "interface",
17128
+ "package": "@nifrajs/e2e",
17129
+ "signature": "export interface TextOptions {\n readonly exact?: boolean;\n}"
17130
+ },
16647
17131
  {
16648
17132
  "name": "TimingControls",
16649
17133
  "kind": "interface",
@@ -17252,6 +17736,13 @@
17252
17736
  "package": "@nifrajs/proxy",
17253
17737
  "signature": "export interface UndiciTransportOptions {\n /**\n * Connection pool to dial through - an undici `Agent`, `Pool`, or any other `Dispatcher`. Omit to\n * use undici's global dispatcher. Supply one to tune `connections` per origin, which is the knob\n * that matters under load. It must not compose a redirect interceptor: this proxy relays 3xx\n * rather than following it, and a dispatcher that follows would hand the upstream the next hop.\n */\n readonly dispatcher?: Dispatcher;\n /**\n * Milliseconds of silence tolerated *within* the response body before undici destroys it.\n * `createProxy`'s own `timeoutMs` only covers the wait for response headers - after the status is\n * relayed a `504` is no longer sendable - so this is what protects against a body that starts and\n * then stalls. Default `30_000`; `0` disables it.\n */\n readonly bodyTimeoutMs?: number;\n}"
17254
17738
  },
17739
+ {
17740
+ "name": "Unique",
17741
+ "kind": "class",
17742
+ "package": "@nifrajs/e2e",
17743
+ "signature": "export declare class Unique {\n readonly value: string;\n constructor(value: string);\n toString(): string;\n}",
17744
+ "doc": "/**\n * Run-varying data (a generated email, a timestamp). The model and the page get the value; the replay\n * cache keys on the fact that it varies, so a new value does not miss, and re-types the new value.\n */"
17745
+ },
17255
17746
  {
17256
17747
  "name": "UnlocalizedPath",
17257
17748
  "kind": "interface",
@@ -17279,6 +17770,12 @@
17279
17770
  "signature": "export type UploadResult = {\n readonly ok: true;\n readonly mime: string;\n readonly ext: string;\n readonly bytes: Uint8Array;\n} | {\n readonly ok: false;\n readonly reason: \"too_large\" | \"empty\" | \"unrecognized\" | \"type_not_allowed\";\n /** The sniffed type, when one was detected (set for `type_not_allowed`). */\n readonly detected?: FileType;\n};",
17280
17771
  "doc": "/**\n * Validate an upload's **size** and **real type** (by magic bytes, not the client's `Content-Type`).\n * Direct request reads follow the configured route body limit. Use `c.boundedBody(maxBytes)` from `@nifrajs/core`\n * for an explicit per-read cap, then `validateUpload(bytes, …)` to confirm the size and sniff the type.\n */"
17281
17772
  },
17773
+ {
17774
+ "name": "UrlMatchers",
17775
+ "kind": "interface",
17776
+ "package": "@nifrajs/e2e",
17777
+ "signature": "export interface UrlMatchers {\n toHaveURL(expected: string | RegExp, options?: MatcherOptions): Promise<void>;\n readonly not: UrlMatchers;\n}"
17778
+ },
17282
17779
  {
17283
17780
  "name": "UrlParts",
17284
17781
  "kind": "interface",
@@ -17291,6 +17788,13 @@
17291
17788
  "package": "nifra",
17292
17789
  "signature": "export interface UrlParts {\n readonly pathname: string;\n readonly search: string;\n}"
17293
17790
  },
17791
+ {
17792
+ "name": "UrlSource",
17793
+ "kind": "interface",
17794
+ "package": "@nifrajs/e2e",
17795
+ "signature": "export interface UrlSource {\n readonly context: LocatorContext;\n url(): Promise<string>;\n /** Path plus query of the current URL. */\n path(): Promise<string>;\n}",
17796
+ "doc": "/** Anything with a current URL; `E2ESession` is one. */"
17797
+ },
17294
17798
  {
17295
17799
  "name": "UseCapabilityOptions",
17296
17800
  "kind": "interface",
@@ -17396,18 +17900,31 @@
17396
17900
  "signature": "export interface UseQueryResult<T> {\n readonly state: Readonly<ShallowRef<QueryState<T>>>;\n /** Force a refetch (ignores `staleTime`). */\n readonly refetch: () => Promise<T>;\n}",
17397
17901
  "doc": "/** A query's reactive {@link QueryState} (read `.value`) plus `refetch`. */"
17398
17902
  },
17903
+ {
17904
+ "name": "UwsServer",
17905
+ "kind": "interface",
17906
+ "package": "@nifrajs/node-uws",
17907
+ "signature": "export interface UwsServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, stop accepting connections, let\n * in-flight requests finish for up to `drainMs`, then close what is left and run `onStop`.\n */\n stop(options?: NodeStopOptions): Promise<void>;\n [Symbol.asyncDispose](): Promise<void>;\n}"
17908
+ },
17909
+ {
17910
+ "name": "UwsTlsOptions",
17911
+ "kind": "interface",
17912
+ "package": "@nifrajs/node-uws",
17913
+ "signature": "export interface UwsTlsOptions {\n readonly keyFileName: string;\n readonly certFileName: string;\n readonly passphrase?: string;\n readonly caFileName?: string;\n readonly dhParamsFileName?: string;\n readonly sslCiphers?: string;\n readonly sslPreferLowMemoryUsage?: boolean;\n}",
17914
+ "doc": "/**\n * HTTPS from files, in uWS's own terms: it reads the key and certificate itself, so these are paths\n * rather than the PEM text `@nifrajs/node` takes.\n */"
17915
+ },
17399
17916
  {
17400
17917
  "name": "VERSION",
17401
17918
  "kind": "const",
17402
17919
  "package": "@nifrajs/core",
17403
- "signature": "export declare const VERSION: \"5.12.1\";",
17920
+ "signature": "export declare const VERSION: \"5.14.0\";",
17404
17921
  "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 */"
17405
17922
  },
17406
17923
  {
17407
17924
  "name": "VERSION",
17408
17925
  "kind": "const",
17409
17926
  "package": "nifra",
17410
- "signature": "export declare const VERSION: \"5.12.1\";",
17927
+ "signature": "export declare const VERSION: \"5.14.0\";",
17411
17928
  "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 */"
17412
17929
  },
17413
17930
  {
@@ -17460,6 +17977,12 @@
17460
17977
  "signature": "export type VercelRuntime = \"edge\" | \"node\";",
17461
17978
  "doc": "/** Ordinary Vercel SSR uses Edge unless Node is explicitly selected. */"
17462
17979
  },
17980
+ {
17981
+ "name": "Verdict",
17982
+ "kind": "interface",
17983
+ "package": "@nifrajs/e2e",
17984
+ "signature": "export interface Verdict {\n readonly pass: boolean | \"inconclusive\";\n readonly reason: string;\n}"
17985
+ },
17463
17986
  {
17464
17987
  "name": "VerificationCompletedView",
17465
17988
  "kind": "interface",
@@ -17530,7 +18053,13 @@
17530
18053
  "name": "ViteDevServerOptions",
17531
18054
  "kind": "interface",
17532
18055
  "package": "@nifrajs/web",
17533
- "signature": "export interface ViteDevServerOptions {\n /** Absolute (or cwd-relative) path to the `routes/` dir. */\n readonly routesDir: string;\n /** Client runtime module providing `mountRouter` (e.g. `\"@nifrajs/web-react/client\"`). */\n readonly clientModule: string;\n /**\n * Build the nifra app for the given dev client-entry URL.\n *\n * `load` resolves a route module through **Vite's** graph (`ssrLoadModule`). Pass it to\n * `discoverRoutes(routesDir, { load })` so SSR and the client are resolved by the SAME toolchain.\n * Without it SSR resolves through Bun while the client resolves through Vite - two resolvers, one\n * process - which is what makes `resolve.dedupe` fail to reach SSR and produces the dual-React\n * crash. Vite re-evaluates on change, so no `importQuery` cache-buster is needed alongside it.\n *\n * Pass `dev.onLoaderError` to `createWebApp` so failures an `_error` boundary renders still reach the\n * dev feed (`nifra errors`).\n */\n readonly createApp: (clientEntry: string, load: (absolutePath: string) => Promise<unknown>, dev: DevAppHooks) => FetchApp | Promise<FetchApp>;\n /** Vite plugins - inject your framework's official plugin, e.g. `[react()]`. */\n readonly plugins?: readonly unknown[];\n /**\n * Extra `resolve.conditions` prepended ahead of nifra's defaults - some frameworks need their own\n * (e.g. Solid's `\"solid\"` condition routes `solid-js` to its source/JSX-dev build).\n */\n readonly conditions?: readonly string[];\n /**\n * Compile-time `define` replacements (e.g. Vue's `__VUE_OPTIONS_API__` flags). Vite already sets\n * `process.env.NODE_ENV` in dev; this is for framework feature flags the plugin doesn't inject.\n */\n readonly define?: Readonly<Record<string, string>>;\n /** Vite project root (default `process.cwd()`). */\n readonly root?: string;\n /** Port (default {@link DEFAULT_DEV_PORT}). */\n readonly port?: number;\n /**\n * Use polling for the file watcher. Native fs events (fsevents/inotify) are unreliable inside\n * containers, networked filesystems, and some sandboxes - there, HMR silently never fires. Set\n * `true` (or the env var `CHOKIDAR_USEPOLLING=1`) to poll instead. Default: off (native events).\n */\n readonly poll?: boolean;\n /** Vite public directory. Defaults to `<root>/public`; `false` disables it. */\n readonly publicDir?: string | false;\n /** Client-visible environment prefix (default `\"PUBLIC_\"`; empty disables exposure). */\n readonly publicEnvPrefix?: string;\n /**\n * Downgrade the startup identity-parity check from a hard failure to a loud warning (dev only).\n * The check catches two physical copies of an identity-sensitive package (e.g. React) resolving in\n * one process, which reliably breaks hydration and framework context. When a duplicate comes from a\n * linked sibling repo you cannot fix in the moment, set this to keep the dev server running while you\n * resolve it; `nifra build` never honors it. Wired to `nifra dev --allow-duplicate-identity`.\n */\n readonly allowDuplicateIdentity?: boolean;\n /**\n * Write `.nifra/dev-server.json` (how `nifra errors`/`nifra logs` and the MCP tools find this server)\n * and the persisted dev log beside it (default `true`).\n */\n readonly record?: boolean;\n /**\n * Show the browser errors a dev page reports in a badge on that page, with a Copy prompt button per\n * fix (default `true`). Off, the errors still reach the feed.\n */\n readonly indicator?: boolean;\n /** The app runs `createWebApp({ live })`: the same option as the build's (`BuildClientOptions.live`). */\n readonly live?: LiveClientEntry | undefined;\n}"
18056
+ "signature": "export interface ViteDevServerOptions {\n /** Absolute (or cwd-relative) path to the `routes/` dir. */\n readonly routesDir: string;\n /** Client runtime module providing `mountRouter` (e.g. `\"@nifrajs/web-react/client\"`). */\n readonly clientModule: string;\n /**\n * Build the nifra app for the given dev client-entry URL.\n *\n * `load` resolves a route module through **Vite's** graph (`ssrLoadModule`). Pass it to\n * `discoverRoutes(routesDir, { load })` so SSR and the client are resolved by the SAME toolchain.\n * Without it SSR resolves through Bun while the client resolves through Vite - two resolvers, one\n * process - which is what makes `resolve.dedupe` fail to reach SSR and produces the dual-React\n * crash. Vite re-evaluates on change, so no `importQuery` cache-buster is needed alongside it.\n *\n * Pass `dev.onLoaderError` to `createWebApp` so failures an `_error` boundary renders still reach the\n * dev feed (`nifra errors`).\n */\n readonly createApp: (clientEntry: string, load: (absolutePath: string) => Promise<unknown>, dev: DevAppHooks) => FetchApp | Promise<FetchApp>;\n /** Vite plugins - inject your framework's official plugin, e.g. `[react()]`. */\n readonly plugins?: readonly unknown[];\n /**\n * Extra `resolve.conditions` prepended ahead of nifra's defaults - some frameworks need their own\n * (e.g. Solid's `\"solid\"` condition routes `solid-js` to its source/JSX-dev build).\n */\n readonly conditions?: readonly string[];\n /**\n * Compile-time `define` replacements (e.g. Vue's `__VUE_OPTIONS_API__` flags). Vite already sets\n * `process.env.NODE_ENV` in dev; this is for framework feature flags the plugin doesn't inject.\n */\n readonly define?: Readonly<Record<string, string>>;\n /** Vite project root (default `process.cwd()`). */\n readonly root?: string;\n /** Port (default {@link DEFAULT_DEV_PORT}). */\n readonly port?: number;\n /**\n * Use polling for the file watcher. Native fs events (fsevents/inotify) are unreliable inside\n * containers, networked filesystems, and some sandboxes - there, HMR silently never fires. Set\n * `true` (or the env var `CHOKIDAR_USEPOLLING=1`) to poll instead. Default: off (native events).\n */\n readonly poll?: boolean;\n /** Vite public directory. Defaults to `<root>/public`; `false` disables it. */\n readonly publicDir?: string | false;\n /** Client-visible environment prefix (default `\"PUBLIC_\"`; empty disables exposure). */\n readonly publicEnvPrefix?: string;\n /**\n * Downgrade the startup identity-parity check from a hard failure to a loud warning (dev only).\n * The check catches two physical copies of an identity-sensitive package (e.g. React) resolving in\n * one process, which reliably breaks hydration and framework context. When a duplicate comes from a\n * linked sibling repo you cannot fix in the moment, set this to keep the dev server running while you\n * resolve it; `nifra build` never honors it. Wired to `nifra dev --allow-duplicate-identity`.\n */\n readonly allowDuplicateIdentity?: boolean;\n /**\n * Write `.nifra/dev-server.json` (how `nifra errors`/`nifra logs` and the MCP tools find this server)\n * and the persisted dev log beside it (default `true`).\n */\n readonly record?: boolean;\n /**\n * Show the browser errors a dev page reports in a badge on that page, with a Copy prompt button per\n * fix (default `true`). Off, the errors still reach the feed.\n */\n readonly indicator?: boolean;\n /** The app runs `createWebApp({ live })`: the same option as the build's (`BuildClientOptions.live`). */\n readonly live?: LiveClientEntry | undefined;\n /** The router's server `fetch` module: the same option as the build's (`BuildClientOptions.transport`). */\n readonly transport?: string | undefined;\n}"
18057
+ },
18058
+ {
18059
+ "name": "WaitForOptions",
18060
+ "kind": "interface",
18061
+ "package": "@nifrajs/e2e",
18062
+ "signature": "export interface WaitForOptions extends StepOptions {\n /** ms to wait for the statement to hold. Default 30000. */\n readonly timeout?: number;\n}"
17534
18063
  },
17535
18064
  {
17536
18065
  "name": "WaitForStylesOptions",
@@ -17779,7 +18308,7 @@
17779
18308
  "name": "Worker",
17780
18309
  "kind": "interface",
17781
18310
  "package": "@nifrajs/jobs",
17782
- "signature": "export interface Worker {\n /** Stop polling and await every job in flight (graceful). */\n stop(): Promise<void>;\n readonly running: boolean;\n}"
18311
+ "signature": "export interface Worker {\n /** Stop polling and await every job in flight (graceful). */\n stop(): Promise<void>;\n /** `await using worker = queue.start()`: the same as `stop()`. */\n [Symbol.asyncDispose](): Promise<void>;\n readonly running: boolean;\n}"
17783
18312
  },
17784
18313
  {
17785
18314
  "name": "WorkerOptions",
@@ -17854,7 +18383,7 @@
17854
18383
  "name": "WsHandle",
17855
18384
  "kind": "interface",
17856
18385
  "package": "@nifrajs/client",
17857
- "signature": "export interface WsHandle<In, Out> {\n /** Send one typed frame (JSON-encoded). Queued until the socket opens, so it never throws. */\n send(message: In): void;\n /** Async-iterate incoming typed frames. Ends when the socket closes (or `signal` aborts). */\n messages(options?: {\n signal?: AbortSignal;\n }): AsyncIterableIterator<Out>;\n /** Callback form of {@link messages}; returns an unsubscribe. */\n onMessage(callback: (message: Out) => void): () => void;\n /** Resolves when the socket is open (rejects on a connect failure). */\n readonly opened: Promise<void>;\n close(code?: number, reason?: string): void;\n /** The underlying socket, for anything off the typed contract (binary frames, bufferedAmount…). */\n readonly raw: WebSocket;\n}",
18386
+ "signature": "export interface WsHandle<In, Out> {\n /** Send one typed frame (JSON-encoded). Queued until the socket opens, so it never throws. */\n send(message: In): void;\n /** Async-iterate incoming typed frames. Ends when the socket closes (or `signal` aborts). */\n messages(options?: {\n signal?: AbortSignal;\n }): AsyncIterableIterator<Out>;\n /** Callback form of {@link messages}; returns an unsubscribe. */\n onMessage(callback: (message: Out) => void): () => void;\n /** Resolves when the socket is open (rejects on a connect failure). */\n readonly opened: Promise<void>;\n close(code?: number, reason?: string): void;\n /** `using socket = client.x.ws()`: closes with the default code, as `close()` does. A runtime without `Symbol.dispose` needs a polyfill first. */\n [Symbol.dispose](): void;\n /** The underlying socket, for anything off the typed contract (binary frames, bufferedAmount…). */\n readonly raw: WebSocket;\n}",
17858
18387
  "doc": "/**\n * A live typed WebSocket connection to an `app.ws()` route. `send` accepts the route's\n * `messageSchema` input type (validated server-side at the trust boundary); received frames are\n * typed from its `sendSchema` and JSON-parsed. Binary frames are not part of the typed contract\n * and are ignored by `messages()`/`onMessage` - use `raw` for them.\n */"
17859
18388
  },
17860
18389
  {
@@ -17889,6 +18418,13 @@
17889
18418
  "signature": "export declare class ZoneConfigError extends Error {\n readonly name = \"ZoneConfigError\";\n /** The file holding the setting, as the caller named it. */\n readonly source: string;\n constructor(source: string, problem: string);\n}",
17890
18419
  "doc": "/** A `\"nifra\": { \"zones\": ... }` setting that cannot be applied. Thrown when a classifier is created. */"
17891
18420
  },
18421
+ {
18422
+ "name": "activateAsyncContextFrame",
18423
+ "kind": "const",
18424
+ "package": "@nifrajs/node",
18425
+ "signature": "export declare const activateAsyncContextFrame: () => void;",
18426
+ "doc": "/** Node's async-context bookkeeping flips on lazily; flipping it before listening keeps the tick loop monomorphic. */"
18427
+ },
17892
18428
  {
17893
18429
  "name": "addSourceTransform",
17894
18430
  "kind": "function",
@@ -17977,6 +18513,13 @@
17977
18513
  "package": "@nifrajs/middleware",
17978
18514
  "signature": "export declare function apiKey<P>(options: ApiKeyVerifyOptions<P>): AuthPlugin<P>;"
17979
18515
  },
18516
+ {
18517
+ "name": "appFetch",
18518
+ "kind": "const",
18519
+ "package": "@nifrajs/web",
18520
+ "signature": "export declare const appFetch: RouterFetch;",
18521
+ "doc": "/**\n * The `fetch` an app's own requests to its server should use: the build's `transport` when it has\n * one, the global `fetch` otherwise. Hand it to `useQuery`'s fetcher or to the typed client\n * (`client(url, { fetch: appFetch })`) and the same code runs in a browser and in a native shell.\n */"
18522
+ },
17980
18523
  {
17981
18524
  "name": "appendTrailingSlash",
17982
18525
  "kind": "function",
@@ -18184,7 +18727,7 @@
18184
18727
  "kind": "function",
18185
18728
  "package": "@nifrajs/core",
18186
18729
  "signature": "export declare function assertTransportTextBounded(text: string, options: TransportDecodeOptions): void;",
18187
- "doc": "/**\n * Enforce the transport byte cap on already-read text - the same limit (and the same error) the\n * streaming reader applies during a bounded read. Exported for callers that read a body through a\n * native, non-streaming path (the typed client's in-process branch) and still owe the cap contract.\n */"
18730
+ "doc": "/**\n * Enforce the transport byte cap on already-read text - the same limit (and the same error) the\n * streaming reader applies during a bounded read. Exported for callers that need to decode text\n * after a bounded read while preserving the text decoder's lenient UTF-8 behavior.\n */"
18188
18731
  },
18189
18732
  {
18190
18733
  "name": "assertUnauthenticated",
@@ -18552,6 +19095,13 @@
18552
19095
  "signature": "export declare function buildTargetWith(target: BuildTarget, options: BuildTargetOptions, bundler: Bundler): Promise<BuildTargetResult>;",
18553
19096
  "doc": "/**\n * The bundler-agnostic deploy orchestrator: everything `buildTarget` does EXCEPT the two bundling steps,\n * which come from `bundler`. `buildTarget` passes {@link bunBundler}; `buildTargetVite`\n * (`@nifrajs/web/build-vite`) passes the Vite strategy. One orchestrator, so the deploy-dir shape,\n * server-entry codegen, prerender and size report are identical across pipelines.\n */"
18554
19097
  },
19098
+ {
19099
+ "name": "buildWithDeploymentAdapter",
19100
+ "kind": "function",
19101
+ "package": "@nifrajs/web",
19102
+ "signature": "export declare function buildWithDeploymentAdapter<T>(input: DeploymentAdapterBuildInput<T>): Promise<DeploymentAdapterBuildResult<T>>;",
19103
+ "doc": "/**\n * Build a base target and publish adapter additions as one transaction. A failed base build, adapter,\n * validation, secret scan or publish leaves the prior output directory in place.\n */"
19104
+ },
18555
19105
  {
18556
19106
  "name": "buildWorkGraph",
18557
19107
  "kind": "function",
@@ -18591,6 +19141,13 @@
18591
19141
  "package": "@nifrajs/web",
18592
19142
  "signature": "export declare function bytesStream(bytes: Uint8Array): ReadableStream<Uint8Array>;"
18593
19143
  },
19144
+ {
19145
+ "name": "bytesToHex",
19146
+ "kind": "function",
19147
+ "package": "@nifrajs/utils",
19148
+ "signature": "export declare function bytesToHex(bytes: Uint8Array): string;",
19149
+ "doc": "/** Lowercase hex, two digits per byte. */"
19150
+ },
18594
19151
  {
18595
19152
  "name": "cache",
18596
19153
  "kind": "function",
@@ -19141,6 +19698,13 @@
19141
19698
  "signature": "export declare function computed<T>(fn: () => T): Computed<T>;",
19142
19699
  "doc": "/**\n * Derived value, cached into a signal and computed on first read. While an effect (or another\n * computed) reads it, it recomputes when its tracked inputs change. Once nothing reads it, the next\n * input change stops it instead of recomputing, so a dropped computed costs nothing; reading it\n * again starts it afresh. `dispose()` stops it at once.\n */"
19143
19700
  },
19701
+ {
19702
+ "name": "concatBytes",
19703
+ "kind": "function",
19704
+ "package": "@nifrajs/utils",
19705
+ "signature": "export declare function concatBytes(chunks: readonly Uint8Array[], total: number): Uint8Array;",
19706
+ "doc": "/** Concatenate chunks into an output array with the supplied total byte length. */"
19707
+ },
19144
19708
  {
19145
19709
  "name": "concatSourceMaps",
19146
19710
  "kind": "function",
@@ -19908,6 +20472,13 @@
19908
20472
  "signature": "export declare function createZoneClassifier(options: ZoneClassifierOptions): ZoneClassifier;",
19909
20473
  "doc": "/**\n * Create a classifier for one app. Cheap to create; it caches per file and per package directory,\n * so build plugins and dev servers keep one for the life of a build or a session.\n */"
19910
20474
  },
20475
+ {
20476
+ "name": "crossSiteFormRefused",
20477
+ "kind": "const",
20478
+ "package": "@nifrajs/core",
20479
+ "signature": "export declare const crossSiteFormRefused: (source: RequestSource, formOrigins: FormOrigins | undefined) => boolean;",
20480
+ "doc": "/** Whether a request is a cross-site post that {@link readBodyFramed} would refuse, or one a page can\n * send the same way: a form media type, or no content type at all (`fetch` with `no-cors`). A request\n * with no content type that carries an `Authorization` header other than a browser-managed scheme\n * (Basic, Digest, Negotiate, NTLM) passes: script-set, it forced a preflight, so the app's CORS policy\n * has already judged its origin. It decides on the cheapest header first: a request without an\n * `Origin` (any non-browser client) costs one lookup, and a browser's own-origin post stops at\n * `Sec-Fetch-Site` before the URL is parsed. */"
20481
+ },
19911
20482
  {
19912
20483
  "name": "csrf",
19913
20484
  "kind": "function",
@@ -20042,7 +20613,7 @@
20042
20613
  "kind": "function",
20043
20614
  "package": "@nifrajs/core",
20044
20615
  "signature": "export declare function decodeTransportText(text: string, contentType: string | null, registry?: TransportCodecRegistry, options?: TransportDecodeOptions): unknown;",
20045
- "doc": "/**\n * Decode an ALREADY-READ transport body. The counterpart to {@link decodeTransportResponse} for a\n * caller that obtained the text through its own bounded read - notably the typed client's\n * in-process path, where the response body is same-process memory that was fully resident before\n * the read, so the native `Response.text()` is safe and the streaming byte-cap loop would protect\n * nothing while costing ~23x. The byte cap is still enforced here (identical error), just after\n * the read instead of during it.\n */"
20616
+ "doc": "/**\n * Decode an ALREADY-READ transport body. The counterpart to {@link decodeTransportResponse} for a\n * caller that obtained the text through its own bounded read - notably the typed client's\n * in-process path, which uses this to preserve lenient UTF-8 decoding after the shared byte-cap\n * reader has completed.\n */"
20046
20617
  },
20047
20618
  {
20048
20619
  "name": "defaultTransportCodecs",
@@ -20538,6 +21109,13 @@
20538
21109
  "signature": "export declare function durableCommand(options: DurableCommandOptions): IdentityPlugin;",
20539
21110
  "doc": "/**\n * Journal every capability effect on the routes below it, and declare the evidence that says so.\n *\n * A capability defined `idempotency: \"durable\"` requires `nifra.durable-command` evidence, and until\n * this adapter existed nothing in the framework produced it. The only way to satisfy the tier was to\n * write `assurance: [\"nifra.durable-command\"]` on the route - an assertion with nothing behind it,\n * wrong in both directions: a route that genuinely journals its effects but omits the string fails\n * `nifra check`, and a route that journals nothing but includes it passes.\n *\n * The evidence is a by-product here rather than a claim. Installing the adapter puts the journal on\n * the request, so `executeCapability` records intent before an effect runs and exactly one terminal\n * outcome after - which is what the tier is asking about. A call that passes its own `journal` still\n * uses that one.\n *\n * const commands = durableCommand({ journal: createDurableEffectJournal({ store }) })\n * const app = server().use(commands).post(\"/charge\", { capabilities: [\"billing.charge\"] }, …)\n *\n * `beforeHandle` is order-scoped, like the auth plugins: routes registered before `.use(...)` are not\n * covered, and the `subsequent` scope on the evidence says the same thing to `nifra check`.\n *\n * Note what this does NOT claim. Response replay (`schema.idempotency`) is a different guarantee and\n * deliberately never proves this one: replaying a stored response after a crash mid-effect does not\n * make the effect exactly-once, and the journal is what survives the crash.\n */"
20540
21111
  },
21112
+ {
21113
+ "name": "e2e",
21114
+ "kind": "function",
21115
+ "package": "@nifrajs/e2e",
21116
+ "signature": "export declare function e2e<App extends E2EApp>(app: App, options?: E2EOptions): Promise<E2ESession<App>>;",
21117
+ "doc": "/**\n * Serve `app` on an ephemeral port and drive it from a browser. The session is `AsyncDisposable`:\n * `await using t = await e2e(app)` closes the browser and the server at scope exit.\n */"
21118
+ },
20541
21119
  {
20542
21120
  "name": "e2eUrl",
20543
21121
  "kind": "function",
@@ -20607,6 +21185,13 @@
20607
21185
  "signature": "export declare function enableDraft(c: {\n readonly set: DraftCookieControls;\n}, secret: string, options?: EnableDraftOptions): Promise<void>;",
20608
21186
  "doc": "/**\n * Turn draft mode **on** for this client by setting a signed, HttpOnly `__nifra_draft` cookie. Call it\n * from a route you've already authorized. `secret` signs the cookie - pass the SAME secret to\n * `createWebApp({ draftSecret })` and `withISR({ draftSecret })` so the framework can verify it.\n */"
20609
21187
  },
21188
+ {
21189
+ "name": "enableNodeDirect",
21190
+ "kind": "const",
21191
+ "package": "@nifrajs/node",
21192
+ "signature": "export declare const enableNodeDirect: (app: object) => void;",
21193
+ "doc": "/** Install the app's node-direct hooks (a no-op for a plain `{ fetch }` handler or an already-served app). */"
21194
+ },
20610
21195
  {
20611
21196
  "name": "enableSwap",
20612
21197
  "kind": "function",
@@ -20716,6 +21301,20 @@
20716
21301
  "signature": "export declare function errorFromCoreLog(entry: CoreLogEntry): Error | undefined;",
20717
21302
  "doc": "/** The thrown error core's `unhandled request error` log line describes, rebuilt for a Diagnostic. */"
20718
21303
  },
21304
+ {
21305
+ "name": "errorReporterOf",
21306
+ "kind": "const",
21307
+ "package": "@nifrajs/node",
21308
+ "signature": "export declare const errorReporterOf: (app: object) => ((error: unknown) => void) | undefined;",
21309
+ "doc": "/** The app's own error log, when it has one. */"
21310
+ },
21311
+ {
21312
+ "name": "escapeRegExp",
21313
+ "kind": "function",
21314
+ "package": "@nifrajs/utils",
21315
+ "signature": "export declare function escapeRegExp(value: string): string;",
21316
+ "doc": "/** Escape every RegExp metacharacter so `value` matches literally inside a pattern. */"
21317
+ },
20719
21318
  {
20720
21319
  "name": "etag",
20721
21320
  "kind": "function",
@@ -20804,6 +21403,12 @@
20804
21403
  "signature": "export declare function expandOptionalParams(pattern: string): readonly string[];",
20805
21404
  "doc": "/**\n * The concrete patterns an optional-parameter pattern stands for, shortest first.\n *\n * A path may END in a run of whole-segment optional parameters, `:name?` or, with a constraint,\n * `:name{[0-9]+}?`. It is shorthand for one\n * route per prefix of that run: `/users/:id?` is `/users` and `/users/:id`, and `/a/:b?/:c?` is `/a`,\n * `/a/:b`, and `/a/:b/:c`. A later parameter is only present when every earlier one is, so a run of\n * `n` parameters is `n + 1` patterns, never `2^n`.\n *\n * Every other pattern comes back unchanged as the only element. That includes a `?` anywhere but the\n * trailing run (`/a/:b?/c`) or inside a mixed segment (`/files/:name.:ext?`): there it is literal\n * text, as it always was.\n *\n * Expansion happens before compilation, so each result is an ordinary pattern for\n * {@link compileRoutePattern} and a matcher never learns that a parameter was optional.\n */"
20806
21405
  },
21406
+ {
21407
+ "name": "expect",
21408
+ "kind": "function",
21409
+ "package": "@nifrajs/e2e",
21410
+ "signature": "export declare function expect(subject: UrlSource): UrlMatchers;"
21411
+ },
20807
21412
  {
20808
21413
  "name": "explainAutoReflectJsonSchema",
20809
21414
  "kind": "function",
@@ -20852,6 +21457,13 @@
20852
21457
  "signature": "export declare function extensionDescriptors(extensions: readonly ExtensionDescriptorSource[], options: ExtensionDescriptorOptions): Promise<readonly CapabilityDescriptor[]>;",
20853
21458
  "doc": "/** Project a set of extensions under a single trusted allowlist, preserving order. */"
20854
21459
  },
21460
+ {
21461
+ "name": "fakeEngine",
21462
+ "kind": "function",
21463
+ "package": "@nifrajs/e2e",
21464
+ "signature": "export declare function fakeEngine(options: FakeEngineOptions): {\n factory: EngineFactory;\n log: FakeLogEntry[];\n};",
21465
+ "doc": "/**\n * An in-memory engine for tests of code built on `@nifrajs/e2e`: no browser, same locator\n * semantics (case-insensitive substring unless `exact`). It does not wait; an `act` on a missing\n * element throws at once.\n */"
21466
+ },
20855
21467
  {
20856
21468
  "name": "fastly",
20857
21469
  "kind": "function",
@@ -20865,6 +21477,13 @@
20865
21477
  "signature": "export declare function fetchTransport(options?: FetchTransportOptions): ProxyTransport;",
20866
21478
  "doc": "/**\n * Create the portable `fetch`-backed {@link ProxyTransport} - the default off Node, and the fallback\n * everywhere the undici transport cannot be used. `redirect: \"manual\"` is not a preference: following\n * an upstream redirect would let the upstream choose the proxy's next destination, so it is pinned\n * here and a 3xx is relayed to the caller untouched.\n *\n * Pass it explicitly only to tune {@link FetchTransportOptions.bodyTimeoutMs} or to pin the choice\n * on Node; leaving `transport` unset picks the right one per runtime.\n */"
20867
21479
  },
21480
+ {
21481
+ "name": "fileCacheStore",
21482
+ "kind": "function",
21483
+ "package": "@nifrajs/e2e",
21484
+ "signature": "export declare function fileCacheStore(dir: string): CacheStore;",
21485
+ "doc": "/** Entries as files under `dir`, one JSON per key: small, diffable and meant to be committed. */"
21486
+ },
20868
21487
  {
20869
21488
  "name": "filePathToPattern",
20870
21489
  "kind": "function",
@@ -20927,6 +21546,12 @@
20927
21546
  "signature": "export declare const fixedBackoff: (ms: number) => Backoff;",
20928
21547
  "doc": "/** Fixed delay before every retry. */"
20929
21548
  },
21549
+ {
21550
+ "name": "flyAdapter",
21551
+ "kind": "const",
21552
+ "package": "@nifrajs/deploy-fly",
21553
+ "signature": "export declare const flyAdapter: DeploymentTargetAdapter;"
21554
+ },
20930
21555
  {
20931
21556
  "name": "fontFace",
20932
21557
  "kind": "function",
@@ -20989,6 +21614,12 @@
20989
21614
  "signature": "export declare function formatNodeBuiltinLeak(findings: ReadonlyArray<NodeBuiltinFinding>): string | undefined;",
20990
21615
  "doc": "/** The build-failing message for `node:` builtins that reached the client bundle. `undefined` ⇒ clean. */"
20991
21616
  },
21617
+ {
21618
+ "name": "formatReport",
21619
+ "kind": "function",
21620
+ "package": "@nifrajs/e2e",
21621
+ "signature": "export declare function formatReport(report: AgentReport): string;"
21622
+ },
20992
21623
  {
20993
21624
  "name": "formatServerOnlyLeak",
20994
21625
  "kind": "function",
@@ -21305,7 +21936,7 @@
21305
21936
  "kind": "function",
21306
21937
  "package": "@nifrajs/web",
21307
21938
  "signature": "export declare function hashQueryKey(key: unknown): string;",
21308
- "doc": "/**\n * Hash a query key to a stable cache string. Object keys are sorted (so `{a,b}` ≡ `{b,a}`); arrays\n * keep order. Keys must be serializable - a function/symbol in the key throws (it can't be a stable\n * identity). Mirrors TanStack Query's structural hashing.\n */"
21939
+ "doc": "/**\n * Hash a query key to a stable cache string. Object keys are sorted; arrays keep order. Keys must be\n * serializable - a function/symbol in the key throws. Query-key objects are cached by identity, so\n * treat them as immutable after hashing. Mirrors TanStack Query's structural hashing.\n */"
21309
21940
  },
21310
21941
  {
21311
21942
  "name": "healthcheck",
@@ -21321,6 +21952,13 @@
21321
21952
  "signature": "export declare function holeComponents(client: ComponentClientAdapter | undefined): void;",
21322
21953
  "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 */"
21323
21954
  },
21955
+ {
21956
+ "name": "hostPolicyOf",
21957
+ "kind": "const",
21958
+ "package": "@nifrajs/node",
21959
+ "signature": "export declare const hostPolicyOf: (options: HostPolicyOptions) => HostPolicy;",
21960
+ "doc": "/** Validate and normalize `allowedHosts` / `canonicalHost` / `normalizeTarget`; throws a `TypeError` on a malformed entry. */"
21961
+ },
21324
21962
  {
21325
21963
  "name": "hotUpdateNeedsReload",
21326
21964
  "kind": "const",
@@ -21806,6 +22444,13 @@
21806
22444
  "signature": "export declare function isProcessAlive(pid: number): boolean;",
21807
22445
  "doc": "/** Whether a process with `pid` exists (EPERM means it exists but is not ours). */"
21808
22446
  },
22447
+ {
22448
+ "name": "isRecord",
22449
+ "kind": "function",
22450
+ "package": "@nifrajs/utils",
22451
+ "signature": "export declare function isRecord(value: unknown): value is Record<string, unknown>;",
22452
+ "doc": "/** A non-null, non-array object; its prototype is not restricted. */"
22453
+ },
21809
22454
  {
21810
22455
  "name": "isRegistrableMethod",
21811
22456
  "kind": "function",
@@ -22028,6 +22673,13 @@
22028
22673
  "signature": "export declare function lastModifiedOf(version: FileVersion): number | undefined;",
22029
22674
  "doc": "/**\n * The time a file can be dated by in Last-Modified, or `undefined`: its mtime, only while that is\n * the time of its own last change. A copy or build that keeps or normalizes timestamps - `cp -p`,\n * `rsync -a`, tar, a container image layer, SOURCE_DATE_EPOCH, the Nix store's 1 s - gives a\n * same-size replacement the old file's date, so its files are left undated and their content tag\n * validates them alone.\n */"
22030
22675
  },
22676
+ {
22677
+ "name": "lifecycleOf",
22678
+ "kind": "const",
22679
+ "package": "@nifrajs/node",
22680
+ "signature": "export declare const lifecycleOf: (app: object) => (phase: \"stopping\" | \"stopped\") => Promise<void>;",
22681
+ "doc": "/** The app's `onStopping` / `onStop` hooks as one function; a no-op for a plain handler. */"
22682
+ },
22031
22683
  {
22032
22684
  "name": "lintPostgresStatement",
22033
22685
  "kind": "function",
@@ -22275,6 +22927,13 @@
22275
22927
  "signature": "export declare function memoryBus(): LiveBus;",
22276
22928
  "doc": "/**\n * The single-process bus: an in-memory clock, events delivered to every subscriber before `append`\n * resolves. Processes do not share it; run several behind a shared bus instead.\n */"
22277
22929
  },
22930
+ {
22931
+ "name": "memoryCacheStore",
22932
+ "kind": "function",
22933
+ "package": "@nifrajs/e2e",
22934
+ "signature": "export declare function memoryCacheStore(): CacheStore & {\n readonly entries: Map<string, CacheEntry>;\n};",
22935
+ "doc": "/** Entries in memory, for tests of code built on this package. */"
22936
+ },
22278
22937
  {
22279
22938
  "name": "memoryChannelHub",
22280
22939
  "kind": "function",
@@ -22537,6 +23196,13 @@
22537
23196
  "signature": "export declare function nodeDirect(): IdentityPlugin;",
22538
23197
  "doc": "/** Enable `app.resolveNode()` for direct callers. Applying it twice is a no-op (named plugin dedupe). */"
22539
23198
  },
23199
+ {
23200
+ "name": "nodeOutcomeRuntime",
23201
+ "kind": "const",
23202
+ "package": "@nifrajs/node",
23203
+ "signature": "export declare const nodeOutcomeRuntime: object;",
23204
+ "doc": "/** Handed to `app.resolveNodeSource(source, platform, runtime)`; opaque to the transport. */"
23205
+ },
22540
23206
  {
22541
23207
  "name": "noopArtifactPort",
22542
23208
  "kind": "function",
@@ -23292,6 +23958,13 @@
23292
23958
  "signature": "export declare function planStatic(mount: StaticMount, immutable: boolean, request: StaticRequest, file: StaticFileAccess): Promise<StaticPlan>;",
23293
23959
  "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 */"
23294
23960
  },
23961
+ {
23962
+ "name": "playwrightEngine",
23963
+ "kind": "function",
23964
+ "package": "@nifrajs/e2e",
23965
+ "signature": "export declare function playwrightEngine(options?: PlaywrightEngineOptions): EngineFactory;",
23966
+ "doc": "/** A browser engine over Playwright (`playwright` is an optional peer, loaded on first use). */"
23967
+ },
23295
23968
  {
23296
23969
  "name": "port",
23297
23970
  "kind": "function",
@@ -23397,8 +24070,7 @@
23397
24070
  "name": "prerenderRoutes",
23398
24071
  "kind": "function",
23399
24072
  "package": "@nifrajs/web",
23400
- "signature": "export declare function prerenderRoutes(options: PrerenderOptions): Promise<PrerenderResult>;",
23401
- "doc": "/**\n * Render every opted-in static route to a static `index.html` under `outDir`. Run AFTER `buildClient`\n * (so the app references the hashed client entry). Returns a report of what was emitted vs skipped -\n * the caller can use `prerendered` to wire a hybrid deploy (e.g. exclude those paths from the SSR\n * worker so the CDN serves the static file). Never throws on a per-route miss: a non-OK response or a\n * non-opted/dynamic route is recorded in `skipped` and the build continues.\n */"
24073
+ "signature": "export declare function prerenderRoutes(options: PrerenderOptions): Promise<PrerenderResult>;"
23402
24074
  },
23403
24075
  {
23404
24076
  "name": "prerenderedPageReader",
@@ -24239,6 +24911,20 @@
24239
24911
  "signature": "export declare function resolvePublicPath(root: string, pathname: string): string | undefined;",
24240
24912
  "doc": "/**\n * Resolve a URL pathname to an absolute path **confined** to `root`, or `undefined` if it escapes.\n *\n * This is a user-path-to-filesystem sink, which makes it the one part of this feature with a security\n * consequence. Decode first (`%2e%2e%2f` is `../`), then normalize, then verify the result is still\n * under `root` by prefix - checking the *resolved* path rather than scanning the input for `..`,\n * because a blocklist over encodings is exactly the kind of check that gets bypassed.\n */"
24241
24913
  },
24914
+ {
24915
+ "name": "resolveRequestHost",
24916
+ "kind": "const",
24917
+ "package": "@nifrajs/node",
24918
+ "signature": "export declare const resolveRequestHost: (host: string | null | undefined, policy: HostPolicy) => string | undefined;",
24919
+ "doc": "/** The authority a request is answered as, or `undefined` to refuse it with 400. `null` means Host repeated. */"
24920
+ },
24921
+ {
24922
+ "name": "resolveRequestTarget",
24923
+ "kind": "const",
24924
+ "package": "@nifrajs/node",
24925
+ "signature": "export declare const resolveRequestTarget: (target: string, normalizeTarget: boolean) => string;",
24926
+ "doc": "/** The origin-form target the app routes on: absolute-form unwrapped, dot segments resolved when asked. */"
24927
+ },
24242
24928
  {
24243
24929
  "name": "resolveRouteFile",
24244
24930
  "kind": "function",
@@ -24312,7 +24998,7 @@
24312
24998
  "kind": "function",
24313
24999
  "package": "@nifrajs/core",
24314
25000
  "signature": "export declare function responseFromStored(stored: StoredResponse, options?: {\n readonly maxBytes?: number;\n}): Response;",
24315
- "doc": "/** Rebuild a live response from storage, stamping the replay marker header. */"
25001
+ "doc": "/**\n * Rebuild a live response from storage, stamping the replay marker header. Unless a bound is\n * supplied, stored bodies larger than {@link DEFAULT_IDEMPOTENCY_MAX_RESPONSE_BYTES} are rejected.\n */"
24316
25002
  },
24317
25003
  {
24318
25004
  "name": "responseObserver",
@@ -24439,6 +25125,13 @@
24439
25125
  "signature": "export declare function routeClassification(responseSchema: unknown, fallback: DataClassification | undefined): ResponseClassification | undefined;",
24440
25126
  "doc": "/** Merge field metadata with an optional route-level sensitivity fallback. */"
24441
25127
  },
25128
+ {
25129
+ "name": "routeDataTransport",
25130
+ "kind": "const",
25131
+ "package": "@nifrajs/web",
25132
+ "signature": "export declare const routeDataTransport: (send: RouterFetch) => FetchRouteData;",
25133
+ "doc": "/**\n * The router's own route-data transport, over `send`: for a layer that wraps the data fetch (keep-alive\n * in a build with a `transport`) and has to leave the request going where the router would send it.\n */"
25134
+ },
24442
25135
  {
24443
25136
  "name": "routePatternOverlap",
24444
25137
  "kind": "function",
@@ -24870,7 +25563,7 @@
24870
25563
  "kind": "function",
24871
25564
  "package": "@nifrajs/core",
24872
25565
  "signature": "export declare function serializeResponse(response: Response, options?: {\n readonly maxBytes?: number;\n}): Promise<StoredResponse>;",
24873
- "doc": "/** Buffer a response into a storable form. Clones first so the live response body stays intact. */"
25566
+ "doc": "/**\n * Buffer a response into a storable form. Clones first so the live response body stays intact on\n * success. If the body exceeds the bound, both branches may be cancelled to stop the producer and\n * the caller must discard or replace the response. Unless a bound is supplied, at most\n * {@link DEFAULT_IDEMPOTENCY_MAX_RESPONSE_BYTES} are retained.\n */"
24874
25567
  },
24875
25568
  {
24876
25569
  "name": "serializeSearch",
@@ -24892,6 +25585,12 @@
24892
25585
  "package": "@nifrajs/node",
24893
25586
  "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<NodeServer>;"
24894
25587
  },
25588
+ {
25589
+ "name": "serve",
25590
+ "kind": "function",
25591
+ "package": "@nifrajs/node-uws",
25592
+ "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<UwsServer>;"
25593
+ },
24895
25594
  {
24896
25595
  "name": "serveDatabaseAsMcp",
24897
25596
  "kind": "function",
@@ -24987,6 +25686,13 @@
24987
25686
  "signature": "export declare function serverComponentsPlugin(options: ServerComponentsPluginOptions): Plugin & {\n readonly api: {\n readonly componentModules: ReadonlySet<string>;\n };\n};",
24988
25687
  "doc": "/** Compiler bridge. The ordinary build must continue rejecting arbitrary server imports. */"
24989
25688
  },
25689
+ {
25690
+ "name": "serverFetch",
25691
+ "kind": "function",
25692
+ "package": "@nifrajs/web",
25693
+ "signature": "export declare function serverFetch(options: ServerFetchOptions): ServerFetch;",
25694
+ "doc": "/**\n * A router `fetch` for an app whose pages ship inside a native shell and whose server lives\n * elsewhere. A path-absolute URL (`/todos`) is sent to `origin`, with the headers and credentials; a\n * URL on `origin` gets them too, and any other URL is sent as written without them, so a call to a third\n * party never carries the server's bearer token. Pass it as `createClientRouter({ fetch })`, or build with it as the `transport` module.\n */"
25695
+ },
24990
25696
  {
24991
25697
  "name": "serverFn",
24992
25698
  "kind": "function",
@@ -25005,7 +25711,7 @@
25005
25711
  "name": "serverFunctions",
25006
25712
  "kind": "function",
25007
25713
  "package": "@nifrajs/web",
25008
- "signature": "export declare function serverFunctions(namespace: string, module: ServerFnModule): IdentityPlugin;",
25714
+ "signature": "export declare function serverFunctions(namespace: string, module: ServerFnModule, options?: ServerFunctionsOptions): IdentityPlugin;",
25009
25715
  "doc": "/**\n * Mount a module's server functions under `namespace`, returning a plugin for `app.use(...)`.\n *\n * import * as todos from \"./actions/todos.fn\"\n * app.use(serverFunctions(\"todos\", todos)) // -> POST /_nifra/fn/todos/addTodo\n *\n * The namespace is explicit rather than derived from the file path: a path-derived one would put the\n * build machine's layout in a public URL, and this keeps the route readable in logs and greppable in\n * the codebase. The client build's stubs call the namespace named by the module's file (`todos.fn.ts`\n * calls `todos`), so pass that same word here.\n *\n * Exports that are not server functions are ignored, so `export type` and helpers can live alongside.\n */"
25010
25716
  },
25011
25717
  {
@@ -25104,6 +25810,13 @@
25104
25810
  "signature": "export declare function sha256Hex(bytes: Uint8Array): Promise<string>;",
25105
25811
  "doc": "/** SHA-256 of `bytes` as lowercase hex. Collision-resistant so a digest cannot be forged from content. */"
25106
25812
  },
25813
+ {
25814
+ "name": "sha256Hex",
25815
+ "kind": "function",
25816
+ "package": "@nifrajs/utils",
25817
+ "signature": "export declare function sha256Hex(input: string | Uint8Array): Promise<string>;",
25818
+ "doc": "/** SHA-256 of UTF-8 text or a stable copy of bytes, as lowercase hex. Collision-resistant so a digest cannot be forged from content. */"
25819
+ },
25107
25820
  {
25108
25821
  "name": "sha256HexOf",
25109
25822
  "kind": "function",
@@ -26070,6 +26783,12 @@
26070
26783
  "signature": "export declare function unexposedPlanRelation(planRows: readonly {\n readonly detail?: unknown;\n}[], exposed: (relation: string) => boolean): string | undefined;",
26071
26784
  "doc": "/**\n * The first relation an `EXPLAIN QUERY PLAN` result scans or searches that `exposed` rejects, as the\n * plan spells it, or `undefined` when every scanned relation is exposed. The plan names a scan by its\n * alias (`FROM habits h` plans as `SCAN h`, `users AS habits` as `SCAN habits`), so it cannot decide\n * on its own which tables a statement reads: the compiled program names them by root page.\n */"
26072
26785
  },
26786
+ {
26787
+ "name": "unique",
26788
+ "kind": "function",
26789
+ "package": "@nifrajs/e2e",
26790
+ "signature": "export declare function unique(value: string | number): Unique;"
26791
+ },
26073
26792
  {
26074
26793
  "name": "unsafeInlineScript",
26075
26794
  "kind": "function",