@nifrajs/cli 5.0.0 → 5.2.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 (296) hide show
  1. package/CHANGELOG.md +3211 -0
  2. package/README.md +10 -2
  3. package/dist/agent-files.d.ts +19 -11
  4. package/dist/agent-files.d.ts.map +1 -1
  5. package/dist/agent-files.js +26 -18
  6. package/dist/agent-files.js.map +1 -1
  7. package/dist/assure-hydration.d.ts.map +1 -1
  8. package/dist/assure-hydration.js +5 -2
  9. package/dist/assure-hydration.js.map +1 -1
  10. package/dist/assure.d.ts +12 -2
  11. package/dist/assure.d.ts.map +1 -1
  12. package/dist/assure.js +73 -9
  13. package/dist/assure.js.map +1 -1
  14. package/dist/capabilities-tool.d.ts.map +1 -1
  15. package/dist/capabilities-tool.js +152 -49
  16. package/dist/capabilities-tool.js.map +1 -1
  17. package/dist/check-diagnostics.d.ts +7 -0
  18. package/dist/check-diagnostics.d.ts.map +1 -1
  19. package/dist/check-diagnostics.js +3 -0
  20. package/dist/check-diagnostics.js.map +1 -1
  21. package/dist/check-scan.d.ts +8 -2
  22. package/dist/check-scan.d.ts.map +1 -1
  23. package/dist/check-scan.js +49 -13
  24. package/dist/check-scan.js.map +1 -1
  25. package/dist/check.d.ts.map +1 -1
  26. package/dist/check.js +91 -45
  27. package/dist/check.js.map +1 -1
  28. package/dist/cli.d.ts +2 -0
  29. package/dist/cli.d.ts.map +1 -1
  30. package/dist/cli.js +128 -59
  31. package/dist/cli.js.map +1 -1
  32. package/dist/client-module.d.ts +5 -3
  33. package/dist/client-module.d.ts.map +1 -1
  34. package/dist/client-module.js +34 -10
  35. package/dist/client-module.js.map +1 -1
  36. package/dist/command-catalog.d.ts +9 -1
  37. package/dist/command-catalog.d.ts.map +1 -1
  38. package/dist/command-catalog.js +75 -26
  39. package/dist/command-catalog.js.map +1 -1
  40. package/dist/dev-bun-config.d.ts +6 -3
  41. package/dist/dev-bun-config.d.ts.map +1 -1
  42. package/dist/dev-bun-config.js +13 -10
  43. package/dist/dev-bun-config.js.map +1 -1
  44. package/dist/dev-feed-tool.d.ts +19 -1
  45. package/dist/dev-feed-tool.d.ts.map +1 -1
  46. package/dist/dev-feed-tool.js +114 -0
  47. package/dist/dev-feed-tool.js.map +1 -1
  48. package/dist/doctor.d.ts +15 -1
  49. package/dist/doctor.d.ts.map +1 -1
  50. package/dist/doctor.js +79 -61
  51. package/dist/doctor.js.map +1 -1
  52. package/dist/fix-recipes.d.ts +2 -0
  53. package/dist/fix-recipes.d.ts.map +1 -1
  54. package/dist/fix-recipes.js +93 -12
  55. package/dist/fix-recipes.js.map +1 -1
  56. package/dist/i18n-check.d.ts +11 -1
  57. package/dist/i18n-check.d.ts.map +1 -1
  58. package/dist/i18n-check.js +170 -17
  59. package/dist/i18n-check.js.map +1 -1
  60. package/dist/init-agents.d.ts +60 -4
  61. package/dist/init-agents.d.ts.map +1 -1
  62. package/dist/init-agents.js +196 -33
  63. package/dist/init-agents.js.map +1 -1
  64. package/dist/internal/config-paths.d.ts +16 -0
  65. package/dist/internal/config-paths.d.ts.map +1 -0
  66. package/dist/internal/config-paths.js +124 -0
  67. package/dist/internal/config-paths.js.map +1 -0
  68. package/dist/internal/installed-package.d.ts +4 -0
  69. package/dist/internal/installed-package.d.ts.map +1 -0
  70. package/dist/internal/installed-package.js +17 -0
  71. package/dist/internal/installed-package.js.map +1 -0
  72. package/dist/internal/project-specifiers.d.ts +14 -1
  73. package/dist/internal/project-specifiers.d.ts.map +1 -1
  74. package/dist/internal/project-specifiers.js +63 -16
  75. package/dist/internal/project-specifiers.js.map +1 -1
  76. package/dist/internal/source-facts.d.ts +12 -1
  77. package/dist/internal/source-facts.d.ts.map +1 -1
  78. package/dist/internal/source-facts.js +117 -5
  79. package/dist/internal/source-facts.js.map +1 -1
  80. package/dist/internal/typescript-import.d.ts.map +1 -1
  81. package/dist/internal/typescript-import.js +5 -3
  82. package/dist/internal/typescript-import.js.map +1 -1
  83. package/dist/internal/workspace-packages.d.ts +22 -0
  84. package/dist/internal/workspace-packages.d.ts.map +1 -0
  85. package/dist/internal/workspace-packages.js +215 -0
  86. package/dist/internal/workspace-packages.js.map +1 -0
  87. package/dist/introspect.d.ts +9 -0
  88. package/dist/introspect.d.ts.map +1 -1
  89. package/dist/introspect.js +32 -1
  90. package/dist/introspect.js.map +1 -1
  91. package/dist/levels-tool.d.ts.map +1 -1
  92. package/dist/levels-tool.js +5 -8
  93. package/dist/levels-tool.js.map +1 -1
  94. package/dist/load.d.ts +9 -4
  95. package/dist/load.d.ts.map +1 -1
  96. package/dist/load.js +32 -3
  97. package/dist/load.js.map +1 -1
  98. package/dist/lock-links.d.ts +42 -0
  99. package/dist/lock-links.d.ts.map +1 -0
  100. package/dist/lock-links.js +144 -0
  101. package/dist/lock-links.js.map +1 -0
  102. package/dist/mcp-context.d.ts.map +1 -1
  103. package/dist/mcp-context.js +6 -21
  104. package/dist/mcp-context.js.map +1 -1
  105. package/dist/mcp-delegate.d.ts +2 -2
  106. package/dist/mcp-delegate.d.ts.map +1 -1
  107. package/dist/mcp-delegate.js +19 -7
  108. package/dist/mcp-delegate.js.map +1 -1
  109. package/dist/mcp-exec.d.ts +1 -0
  110. package/dist/mcp-exec.d.ts.map +1 -1
  111. package/dist/mcp-exec.js +13 -5
  112. package/dist/mcp-exec.js.map +1 -1
  113. package/dist/mcp-http.js +1 -1
  114. package/dist/mcp-io.d.ts +13 -0
  115. package/dist/mcp-io.d.ts.map +1 -1
  116. package/dist/mcp-io.js +23 -0
  117. package/dist/mcp-io.js.map +1 -1
  118. package/dist/mcp-path.d.ts +2 -1
  119. package/dist/mcp-path.d.ts.map +1 -1
  120. package/dist/mcp-path.js +9 -24
  121. package/dist/mcp-path.js.map +1 -1
  122. package/dist/mcp-root.d.ts +6 -4
  123. package/dist/mcp-root.d.ts.map +1 -1
  124. package/dist/mcp-root.js +12 -8
  125. package/dist/mcp-root.js.map +1 -1
  126. package/dist/mcp.d.ts.map +1 -1
  127. package/dist/mcp.js +40 -17
  128. package/dist/mcp.js.map +1 -1
  129. package/dist/migrate-layout.d.ts +41 -1
  130. package/dist/migrate-layout.d.ts.map +1 -1
  131. package/dist/migrate-layout.js +1729 -236
  132. package/dist/migrate-layout.js.map +1 -1
  133. package/dist/output-schemas.d.ts +34 -0
  134. package/dist/output-schemas.d.ts.map +1 -1
  135. package/dist/output-schemas.js +132 -21
  136. package/dist/output-schemas.js.map +1 -1
  137. package/dist/project-path.d.ts +6 -0
  138. package/dist/project-path.d.ts.map +1 -1
  139. package/dist/project-path.js +48 -14
  140. package/dist/project-path.js.map +1 -1
  141. package/dist/project-site.d.ts +7 -0
  142. package/dist/project-site.d.ts.map +1 -0
  143. package/dist/project-site.js +19 -0
  144. package/dist/project-site.js.map +1 -0
  145. package/dist/recipes/4.0.0.d.ts.map +1 -1
  146. package/dist/recipes/4.0.0.js +2 -0
  147. package/dist/recipes/4.0.0.js.map +1 -1
  148. package/dist/recipes/5.1.0.d.ts +9 -0
  149. package/dist/recipes/5.1.0.d.ts.map +1 -0
  150. package/dist/recipes/5.1.0.js +22 -0
  151. package/dist/recipes/5.1.0.js.map +1 -0
  152. package/dist/recipes/5.2.0.d.ts +10 -0
  153. package/dist/recipes/5.2.0.d.ts.map +1 -0
  154. package/dist/recipes/5.2.0.js +32 -0
  155. package/dist/recipes/5.2.0.js.map +1 -0
  156. package/dist/recipes/index.d.ts +3 -0
  157. package/dist/recipes/index.d.ts.map +1 -1
  158. package/dist/recipes/index.js +7 -0
  159. package/dist/recipes/index.js.map +1 -1
  160. package/dist/release-verification.d.ts +5 -0
  161. package/dist/release-verification.d.ts.map +1 -1
  162. package/dist/release-verification.js +14 -0
  163. package/dist/release-verification.js.map +1 -1
  164. package/dist/review.d.ts.map +1 -1
  165. package/dist/review.js +7 -0
  166. package/dist/review.js.map +1 -1
  167. package/dist/rule-explain.d.ts +26 -0
  168. package/dist/rule-explain.d.ts.map +1 -0
  169. package/dist/rule-explain.js +49 -0
  170. package/dist/rule-explain.js.map +1 -0
  171. package/dist/rules/codes.d.ts +5 -1
  172. package/dist/rules/codes.d.ts.map +1 -1
  173. package/dist/rules/codes.js +5 -1
  174. package/dist/rules/codes.js.map +1 -1
  175. package/dist/rules/contract-visibility.d.ts.map +1 -1
  176. package/dist/rules/contract-visibility.js +93 -21
  177. package/dist/rules/contract-visibility.js.map +1 -1
  178. package/dist/rules/data-guard.d.ts +6 -0
  179. package/dist/rules/data-guard.d.ts.map +1 -1
  180. package/dist/rules/data-guard.js +37 -0
  181. package/dist/rules/data-guard.js.map +1 -1
  182. package/dist/rules/explanations.d.ts +14 -0
  183. package/dist/rules/explanations.d.ts.map +1 -0
  184. package/dist/rules/explanations.js +316 -0
  185. package/dist/rules/explanations.js.map +1 -0
  186. package/dist/rules/legacy.d.ts.map +1 -1
  187. package/dist/rules/legacy.js +44 -2
  188. package/dist/rules/legacy.js.map +1 -1
  189. package/dist/rules/merge-auth.d.ts +12 -0
  190. package/dist/rules/merge-auth.d.ts.map +1 -0
  191. package/dist/rules/merge-auth.js +52 -0
  192. package/dist/rules/merge-auth.js.map +1 -0
  193. package/dist/rules/pages.d.ts +56 -3
  194. package/dist/rules/pages.d.ts.map +1 -1
  195. package/dist/rules/pages.js +412 -23
  196. package/dist/rules/pages.js.map +1 -1
  197. package/dist/rules/routes.d.ts +3 -2
  198. package/dist/rules/routes.d.ts.map +1 -1
  199. package/dist/rules/routes.js +4 -3
  200. package/dist/rules/routes.js.map +1 -1
  201. package/dist/rules/security.d.ts +3 -2
  202. package/dist/rules/security.d.ts.map +1 -1
  203. package/dist/rules/security.js +42 -11
  204. package/dist/rules/security.js.map +1 -1
  205. package/dist/rules/zones.d.ts.map +1 -1
  206. package/dist/rules/zones.js +34 -11
  207. package/dist/rules/zones.js.map +1 -1
  208. package/dist/stylex-migrate.d.ts.map +1 -1
  209. package/dist/stylex-migrate.js +127 -17
  210. package/dist/stylex-migrate.js.map +1 -1
  211. package/dist/test-tool.d.ts.map +1 -1
  212. package/dist/test-tool.js +3 -9
  213. package/dist/test-tool.js.map +1 -1
  214. package/dist/typecheck-coverage.d.ts +11 -0
  215. package/dist/typecheck-coverage.d.ts.map +1 -1
  216. package/dist/typecheck-coverage.js +50 -7
  217. package/dist/typecheck-coverage.js.map +1 -1
  218. package/dist/upgrade.d.ts +57 -6
  219. package/dist/upgrade.d.ts.map +1 -1
  220. package/dist/upgrade.js +247 -19
  221. package/dist/upgrade.js.map +1 -1
  222. package/dist/verification-plan.d.ts.map +1 -1
  223. package/dist/verification-plan.js +7 -2
  224. package/dist/verification-plan.js.map +1 -1
  225. package/dist/version-drift.d.ts.map +1 -1
  226. package/dist/version-drift.js +66 -3
  227. package/dist/version-drift.js.map +1 -1
  228. package/dist/web-app-options.d.ts +1 -1
  229. package/dist/web-app-options.d.ts.map +1 -1
  230. package/dist/web-app-options.js.map +1 -1
  231. package/docs/examples.json +21 -3
  232. package/docs/llms-full.txt +1083 -168
  233. package/docs/types.json +535 -112
  234. package/package.json +13 -12
  235. package/src/agent-files.ts +27 -17
  236. package/src/assure-hydration.ts +5 -1
  237. package/src/assure.ts +99 -11
  238. package/src/capabilities-tool.ts +188 -53
  239. package/src/check-diagnostics.ts +10 -0
  240. package/src/check-scan.ts +65 -12
  241. package/src/check.ts +122 -51
  242. package/src/cli.ts +127 -45
  243. package/src/client-module.ts +45 -9
  244. package/src/command-catalog.ts +92 -28
  245. package/src/dev-bun-config.ts +13 -9
  246. package/src/dev-feed-tool.ts +146 -1
  247. package/src/doctor.ts +102 -66
  248. package/src/fix-recipes.ts +101 -10
  249. package/src/i18n-check.ts +254 -18
  250. package/src/init-agents.ts +225 -44
  251. package/src/internal/config-paths.ts +154 -0
  252. package/src/internal/installed-package.ts +15 -0
  253. package/src/internal/project-specifiers.ts +78 -17
  254. package/src/internal/source-facts.ts +147 -5
  255. package/src/internal/typescript-import.ts +5 -3
  256. package/src/internal/workspace-packages.ts +218 -0
  257. package/src/introspect.ts +39 -1
  258. package/src/levels-tool.ts +7 -9
  259. package/src/load.ts +46 -4
  260. package/src/lock-links.ts +173 -0
  261. package/src/mcp-context.ts +5 -18
  262. package/src/mcp-delegate.ts +22 -10
  263. package/src/mcp-exec.ts +14 -4
  264. package/src/mcp-http.ts +1 -1
  265. package/src/mcp-io.ts +33 -0
  266. package/src/mcp-path.ts +8 -22
  267. package/src/mcp-root.ts +14 -8
  268. package/src/mcp.ts +48 -19
  269. package/src/migrate-layout.ts +1968 -245
  270. package/src/output-schemas.ts +179 -23
  271. package/src/project-path.ts +44 -13
  272. package/src/project-site.ts +18 -0
  273. package/src/recipes/4.0.0.ts +2 -0
  274. package/src/recipes/5.1.0.ts +23 -0
  275. package/src/recipes/5.2.0.ts +33 -0
  276. package/src/recipes/index.ts +7 -0
  277. package/src/release-verification.ts +20 -0
  278. package/src/review.ts +7 -0
  279. package/src/rule-explain.ts +75 -0
  280. package/src/rules/codes.ts +5 -1
  281. package/src/rules/contract-visibility.ts +118 -20
  282. package/src/rules/data-guard.ts +40 -0
  283. package/src/rules/explanations.ts +329 -0
  284. package/src/rules/legacy.ts +46 -2
  285. package/src/rules/merge-auth.ts +55 -0
  286. package/src/rules/pages.ts +486 -25
  287. package/src/rules/routes.ts +4 -3
  288. package/src/rules/security.ts +49 -11
  289. package/src/rules/zones.ts +33 -9
  290. package/src/stylex-migrate.ts +117 -17
  291. package/src/test-tool.ts +3 -9
  292. package/src/typecheck-coverage.ts +51 -6
  293. package/src/upgrade.ts +312 -19
  294. package/src/verification-plan.ts +15 -2
  295. package/src/version-drift.ts +68 -2
  296. package/src/web-app-options.ts +9 -1
package/docs/types.json CHANGED
@@ -117,6 +117,13 @@
117
117
  "signature": "export declare const AGENT_PROTOCOL_VERSION: 1;",
118
118
  "doc": "/**\n * Backend-neutral protocol for local coding-agent hosts.\n *\n * This package deliberately has no runtime dependencies. A Pi adapter, a Nifra-native backend,\n * the CLI, and the Workbench can all implement or consume these contracts without pulling any\n * framework, model provider, or UI code into an application.\n */"
119
119
  },
120
+ {
121
+ "name": "APPROVAL_NEVER_EXPIRES_AT",
122
+ "kind": "const",
123
+ "package": "@nifrajs/coding-agent",
124
+ "signature": "export declare const APPROVAL_NEVER_EXPIRES_AT = 8640000000000000;",
125
+ "doc": "/**\n * The `expiresAt` of an approval that never times out: the largest epoch-ms a `Date` holds\n * (+275760-09-13). It survives JSON, unlike `Infinity`, and `new Date(expiresAt)` stays valid.\n */"
126
+ },
120
127
  {
121
128
  "name": "AcpBackend",
122
129
  "kind": "class",
@@ -718,7 +725,7 @@
718
725
  "name": "AgentPorts",
719
726
  "kind": "interface",
720
727
  "package": "@nifrajs/agent",
721
- "signature": "export interface AgentPorts {\n readonly model: AgentModelPort;\n readonly capabilities: readonly string[];\n readonly budget?: ToolBudget;\n /** Wall-clock budget shared with the parent request. Distinct from `budget`, which is cost. */\n readonly deadline?: RequestBudget;\n readonly idempotency?: ToolIdempotencyStore;\n readonly state?: AgentStateStore;\n readonly approval?: AgentApprovalPort;\n /**\n * Who decides a step that suspended for approval when the run resumes. `\"caller\"` (the default)\n * takes `resume.approval` as the decision. `\"port\"` asks `approval` again and hands it the caller's\n * decision as `callerDecision`; set it when the resuming caller is the party asking for the tool,\n * as under A2A or a public AG-UI route, so it cannot approve its own call.\n */\n readonly resumeApproval?: \"caller\" | \"port\";\n readonly telemetry?: AgentTelemetryPort;\n /** Receives model deltas when the model port streams. Transient - nothing here is persisted. */\n readonly deltas?: AgentDeltaSink;\n readonly clock?: () => number;\n /** Adapter used to satisfy execution policies declared by tool contracts. */\n readonly executionPolicy?: ExecutionPolicyAdapter;\n /** Injectable token generator for deterministic replay and tests. */\n readonly idFactory?: () => string;\n readonly signal?: AbortSignal;\n /** Replay mode skips every tool executor and marks the call dry-run. */\n readonly dryRun?: boolean;\n}"
728
+ "signature": "export interface AgentPorts {\n readonly model: AgentModelPort;\n readonly capabilities: readonly string[];\n readonly budget?: ToolBudget;\n /** Wall-clock budget shared with the parent request. Distinct from `budget`, which is cost. */\n readonly deadline?: RequestBudget;\n readonly idempotency?: ToolIdempotencyStore;\n readonly state?: AgentStateStore;\n readonly approval?: AgentApprovalPort;\n /**\n * Who decides a step that suspended for approval when the run resumes. `\"caller\"` (the default)\n * takes `resume.approval` as the decision. `\"port\"` asks `approval` again and hands it the caller's\n * decision as `callerDecision`; set it when the resuming caller is the party asking for the tool,\n * as on a public AG-UI route, so it cannot approve its own call. `mountA2A` defaults to `\"port\"`.\n */\n readonly resumeApproval?: \"caller\" | \"port\";\n readonly telemetry?: AgentTelemetryPort;\n /** Receives model deltas when the model port streams. Transient - nothing here is persisted. */\n readonly deltas?: AgentDeltaSink;\n readonly clock?: () => number;\n /** Adapter used to satisfy execution policies declared by tool contracts. */\n readonly executionPolicy?: ExecutionPolicyAdapter;\n /** Injectable token generator for deterministic replay and tests. */\n readonly idFactory?: () => string;\n readonly signal?: AbortSignal;\n /** Replay mode skips every tool executor and marks the call dry-run. */\n readonly dryRun?: boolean;\n}"
722
729
  },
723
730
  {
724
731
  "name": "AgentPreset",
@@ -1186,14 +1193,14 @@
1186
1193
  "name": "ApprovalManager",
1187
1194
  "kind": "class",
1188
1195
  "package": "@nifrajs/coding-agent",
1189
- "signature": "export declare class ApprovalManager {\n private readonly options;\n private readonly pendingApprovals;\n constructor(options?: ApprovalManagerOptions);\n get pending(): readonly ApprovalRequest[];\n /** Convert a streamed backend approval event into a resolvable pending request. */\n observe(event: AgentApprovalRequiredEvent): Promise<ApprovalRequest | undefined>;\n /**\n * Publish a pending approval without waiting for its decision (useful for transports). Returns\n * `undefined` when the broker is full or an approval with the same id is still pending.\n */\n offer(input: Omit<ApprovalRequest, \"createdAt\" | \"expiresAt\">): Promise<ApprovalRequest | undefined>;\n /**\n * Create a host-owned approval that can be awaited by a workflow or extension. Resolves `false`\n * when the broker is full or an approval with the same id is still pending.\n */\n request(input: Omit<ApprovalRequest, \"createdAt\" | \"expiresAt\">): Promise<boolean>;\n /**\n * Resolve an approval that was opened with a {@link DecisionCoordinate}, admitting the decision only\n * when it matches the live boundary and is still fresh. Every failure is content-free and fails\n * closed: an unknown id, a coordinate-less approval, a mismatched or superseded coordinate, or an\n * expired boundary resumes no work. This adds a typed path alongside the untyped {@link resolve}; it\n * never loosens it.\n */\n resolveMatched(coordinate: DecisionCoordinate, approved: boolean, now?: number): ApprovalMatchResult;\n /**\n * Settle a pending approval by id. An approval opened with a coordinate is approved only through\n * {@link resolveMatched}; this untyped path can still deny it, and returns `undefined` for an\n * approve.\n */\n resolve(approvalId: string, approved: boolean, reason?: string): ApprovalDecision | undefined;\n close(): void;\n private settle;\n private create;\n}",
1196
+ "signature": "export declare class ApprovalManager {\n private readonly options;\n private readonly pendingApprovals;\n constructor(options?: ApprovalManagerOptions);\n /** The configured timeout, for {@link approvalRequestFromEvent}. */\n get timeoutMs(): ApprovalTimeout;\n get pending(): readonly ApprovalRequest[];\n /** Convert a streamed backend approval event into a resolvable pending request. */\n observe(event: AgentApprovalRequiredEvent): Promise<ApprovalRequest | undefined>;\n /**\n * Publish a pending approval without waiting for its decision (useful for transports). Returns\n * `undefined` when the broker is full or an approval with the same id is still pending.\n */\n offer(input: Omit<ApprovalRequest, \"createdAt\" | \"expiresAt\">): Promise<ApprovalRequest | undefined>;\n /**\n * Create a host-owned approval that can be awaited by a workflow or extension. Resolves `false`\n * when the broker is full or an approval with the same id is still pending.\n */\n request(input: Omit<ApprovalRequest, \"createdAt\" | \"expiresAt\">): Promise<boolean>;\n /**\n * Resolve an approval that was opened with a {@link DecisionCoordinate}, admitting the decision only\n * when it matches the live boundary and is still fresh. Every failure is content-free and fails\n * closed: an unknown id, a coordinate-less approval, a mismatched or superseded coordinate, or an\n * expired boundary resumes no work. This adds a typed path alongside the untyped {@link resolve}; it\n * never loosens it.\n */\n resolveMatched(coordinate: DecisionCoordinate, approved: boolean, now?: number): ApprovalMatchResult;\n /**\n * Settle a pending approval by id. An approval opened with a coordinate is approved only through\n * {@link resolveMatched}; this untyped path can still deny it, and returns `undefined` for an\n * approve.\n */\n resolve(approvalId: string, approved: boolean, reason?: string): ApprovalDecision | undefined;\n close(): void;\n private settle;\n private create;\n}",
1190
1197
  "doc": "/**\n * Small approval broker shared by RPC, Workbench, and workflow extensions.\n *\n * Approval state is deliberately bounded and expires closed (denied) by default. It is a policy\n * seam, not a security boundary: filesystem/process isolation still belongs to the host or OS.\n */"
1191
1198
  },
1192
1199
  {
1193
1200
  "name": "ApprovalManagerOptions",
1194
1201
  "kind": "interface",
1195
1202
  "package": "@nifrajs/coding-agent",
1196
- "signature": "export interface ApprovalManagerOptions {\n readonly maxPending?: number;\n readonly timeoutMs?: number;\n readonly onRequired?: (request: ApprovalRequest) => void | PromiseLike<void>;\n readonly onResolved?: (decision: ApprovalDecision) => void | PromiseLike<void>;\n}"
1203
+ "signature": "export interface ApprovalManagerOptions {\n readonly maxPending?: number;\n /**\n * How long an approval waits before it is denied as timed out (default 5 minutes, at most 24 h).\n * `\"never\"` removes the timer; `maxPending` still bounds how many approvals can wait.\n */\n readonly timeoutMs?: ApprovalTimeout;\n readonly onRequired?: (request: ApprovalRequest) => void | PromiseLike<void>;\n readonly onResolved?: (decision: ApprovalDecision) => void | PromiseLike<void>;\n}"
1197
1204
  },
1198
1205
  {
1199
1206
  "name": "ApprovalMatchRejection",
@@ -1224,7 +1231,7 @@
1224
1231
  "name": "ApprovalRequest",
1225
1232
  "kind": "interface",
1226
1233
  "package": "@nifrajs/coding-agent",
1227
- "signature": "export interface ApprovalRequest {\n readonly id: string;\n readonly sessionId: string;\n readonly turnId?: string;\n readonly action: string;\n readonly capability: string;\n readonly reason?: string;\n /**\n * Optional decision-boundary coordinate. When present, {@link ApprovalManager.resolveMatched}\n * admits a decision only if it names this exact run, node, capability, request id, and vector, and\n * arrives before expiry. Coordinate-less approvals keep their original untyped {@link resolve} path.\n */\n readonly coordinate?: DecisionCoordinate;\n readonly createdAt: number;\n readonly expiresAt: number;\n}"
1234
+ "signature": "export interface ApprovalRequest {\n readonly id: string;\n readonly sessionId: string;\n readonly turnId?: string;\n readonly action: string;\n readonly capability: string;\n readonly reason?: string;\n /**\n * Optional decision-boundary coordinate. When present, {@link ApprovalManager.resolveMatched}\n * admits a decision only if it names this exact run, node, capability, request id, and vector, and\n * arrives before expiry. Coordinate-less approvals keep their original untyped {@link resolve} path.\n */\n readonly coordinate?: DecisionCoordinate;\n readonly createdAt: number;\n /**\n * Absolute epoch-ms after which the approval is denied as timed out. An approval opened with a\n * `\"never\"` timeout reports {@link APPROVAL_NEVER_EXPIRES_AT}, so `now < expiresAt` keeps treating\n * it as live.\n */\n readonly expiresAt: number;\n}"
1228
1235
  },
1229
1236
  {
1230
1237
  "name": "ApprovalRequiredError",
@@ -1256,6 +1263,13 @@
1256
1263
  "package": "@nifrajs/core",
1257
1264
  "signature": "export interface ApprovalStore {\n readonly durability?: \"memory\" | \"durable\";\n create(record: ApprovalRecord): boolean | Promise<boolean>;\n get(approvalId: string): ApprovalRecord | undefined | Promise<ApprovalRecord | undefined>;\n decide(input: {\n readonly approvalId: string;\n readonly tenantId: string;\n readonly decision: \"approved\" | \"denied\";\n readonly decidedBy: string;\n readonly now: number;\n }): boolean | Promise<boolean>;\n /**\n * Atomically validate binding/token/state and change `approved` to `consumed`. Two concurrent\n * callers with one token must yield exactly one `consumed` and one `replay` result.\n */\n consume(input: {\n readonly approvalId: string;\n readonly tenantId: string;\n readonly principalId: string;\n readonly capability: string;\n readonly target?: string;\n readonly digest?: string;\n readonly tokenHash: string;\n readonly now: number;\n }): ApprovalConsumeResult | Promise<ApprovalConsumeResult>;\n}"
1258
1265
  },
1266
+ {
1267
+ "name": "ApprovalTimeout",
1268
+ "kind": "type",
1269
+ "package": "@nifrajs/coding-agent",
1270
+ "signature": "export type ApprovalTimeout = number | \"never\";",
1271
+ "doc": "/**\n * How long an approval may wait: whole milliseconds from 1 ms to 24 h, or `\"never\"` for no timer. A\n * `\"never\"` approval still settles on an answer, a cancel, the end of its turn, and close.\n */"
1272
+ },
1259
1273
  {
1260
1274
  "name": "ApprovalTokenExpiredError",
1261
1275
  "kind": "class",
@@ -1385,7 +1399,7 @@
1385
1399
  "name": "AssurancePolicy",
1386
1400
  "kind": "interface",
1387
1401
  "package": "@nifrajs/core",
1388
- "signature": "export interface AssurancePolicy {\n /** First matching rule owns a route. Put exceptions before broad defaults. */\n readonly rules: readonly AssuranceRule[];\n /** Default `error`: an unclassified route fails closed. */\n readonly unmatched?: \"error\" | \"ignore\";\n /** Default false: reject an empty reflected source so a wrong import cannot pass CI silently. */\n readonly allowEmpty?: boolean;\n /**\n * Default false. When true, a route matched by a **pure-classification** rule (no `require`, no `forbid`)\n * that carries NO enforcement evidence is reported (`classified-no-evidence`). This surfaces the gap the\n * feedback flagged: a classification-only policy silently degrades \"proof\" to a \"label\". Opt-in, because\n * a genuinely public route legitimately carries no evidence; enable it once your guards emit evidence\n * (inline `schema.assurance` or a `withRouteAssurance` middleware) to keep classification honest.\n */\n readonly flagClassifiedWithoutEvidence?: boolean;\n}"
1402
+ "signature": "export interface AssurancePolicy {\n /** First matching rule owns a route. Put exceptions before broad defaults. */\n readonly rules: readonly AssuranceRule[];\n /**\n * Rules checked on EVERY route they match, in addition to the first-match rule that owns it - for a\n * requirement that holds across classes (\"every route declaring a response enforces it\"), which\n * first-match-wins would otherwise make you repeat in each rule. A baseline rule does not classify a\n * route: one no `rules` entry matches is still unclassified. Names share one namespace with `rules`.\n */\n readonly baseline?: readonly AssuranceRule[];\n /** Default `error`: an unclassified route fails closed. */\n readonly unmatched?: \"error\" | \"ignore\";\n /** Default false: reject an empty reflected source so a wrong import cannot pass CI silently. */\n readonly allowEmpty?: boolean;\n /**\n * Default false. When true, a route matched by a **pure-classification** rule (no `require`, no `forbid`)\n * that carries NO enforcement evidence is reported (`classified-no-evidence`). This surfaces the gap the\n * feedback flagged: a classification-only policy silently degrades \"proof\" to a \"label\". Opt-in, because\n * a genuinely public route legitimately carries no evidence; enable it once your guards emit evidence\n * (inline `schema.assurance` or a `withRouteAssurance` middleware) to keep classification honest.\n */\n readonly flagClassifiedWithoutEvidence?: boolean;\n}"
1389
1403
  },
1390
1404
  {
1391
1405
  "name": "AssuranceReport",
@@ -1397,7 +1411,7 @@
1397
1411
  "name": "AssuranceRouteSelector",
1398
1412
  "kind": "interface",
1399
1413
  "package": "@nifrajs/core",
1400
- "signature": "export interface AssuranceRouteSelector {\n /** Omit for every method. `\"WS\"` selects WebSocket routes. */\n readonly methods?: readonly (Method | \"WS\")[];\n /**\n * Skip routes under these methods; `\"WS\"` skips WebSocket routes. Every other method matches, a\n * custom one such as `PURGE` included, so `[\"GET\", \"HEAD\", \"OPTIONS\", \"WS\"]` selects every route\n * that can change state.\n */\n readonly exceptMethods?: readonly (Method | \"WS\")[];\n /** Absolute route globs. `*` matches one segment; final `**` matches zero or more. */\n readonly paths?: readonly string[];\n /** Restrict the rule to MCP tool routes (`true`) or non-tool routes (`false`). */\n readonly tools?: boolean;\n /**\n * Match routes declaring ANY of these capability tokens.\n *\n * Lets a policy be written about what a route DOES rather than where it lives: \"anything that writes\n * to the database must be authenticated\" survives a route being moved or renamed, which a path glob\n * does not. Reflection already carries the declared tokens, so this reads what the route said about\n * itself.\n *\n * Naming exact tokens is precise but closed: a rule listing `db.write` does not cover `storage.write`,\n * and a capability added next year escapes it in silence. Prefer `access`/`zone` for a rule that is\n * meant to hold for a CLASS of effect.\n */\n readonly capabilities?: readonly string[];\n /**\n * Match routes declaring any capability whose definition has this access.\n *\n * This is the selector to reach for when the rule is \"anything that writes must prove who asked\":\n * it is keyed on what the capability IS rather than what it is called, so a token introduced later\n * is covered the day it is declared instead of the day someone remembers to widen the rule.\n *\n * Requires capability definitions. A policy using it without them is refused rather than quietly\n * matching nothing - a selector that matches nothing lets the route fall through to a laxer rule.\n */\n readonly access?: CapabilityAccess;\n /**\n * Match routes declaring any capability in this zone. Combined with `access`, both must hold for the\n * SAME capability, so `{ access: \"write\", zone: \"domain\" }` is \"writes business state\" and does not\n * match a route that only writes an audit log.\n */\n readonly zone?: CapabilityZone;\n /** Match routes whose response classification is at least this sensitivity. */\n readonly classificationAtLeast?: DataClassification;\n /**\n * Match routes by whether they declare a request-body schema. `true` selects routes that parse a\n * body (the buffered-read surface F-001 is about); `false` selects bodyless routes. Reflection\n * already carries `schema.body`, so this reads what the route declared, not where it lives.\n */\n readonly hasBody?: boolean;\n /**\n * Match routes by their effective transport body policy. `\"unlimited\"` is the explicit\n * streaming/upload exemption; `\"bounded\"` is any finite cap (an explicit number or the inherited\n * server default); `\"unset\"` is a route that declared no `bodyLimit` at all. Lets a baseline say\n * \"a body-schema route may never be unlimited\" as a first-class, movable invariant rather than a\n * path list. A route with no schema reports `\"unset\"` unless it names a limit.\n */\n readonly bodyLimit?: \"bounded\" | \"unlimited\" | \"unset\";\n}"
1414
+ "signature": "export interface AssuranceRouteSelector {\n /** Omit for every method. `\"WS\"` selects WebSocket routes. */\n readonly methods?: readonly (Method | \"WS\")[];\n /**\n * Skip routes under these methods; `\"WS\"` skips WebSocket routes. Every other method matches, a\n * custom one such as `PURGE` included, so `[\"GET\", \"HEAD\", \"OPTIONS\", \"WS\"]` selects every route\n * that can change state.\n */\n readonly exceptMethods?: readonly (Method | \"WS\")[];\n /** Absolute route globs. `*` matches one segment; final `**` matches zero or more. */\n readonly paths?: readonly string[];\n /** Restrict the rule to MCP tool routes (`true`) or non-tool routes (`false`). */\n readonly tools?: boolean;\n /**\n * Match routes declaring ANY of these capability tokens.\n *\n * Lets a policy be written about what a route DOES rather than where it lives: \"anything that writes\n * to the database must be authenticated\" survives a route being moved or renamed, which a path glob\n * does not. Reflection already carries the declared tokens, so this reads what the route said about\n * itself.\n *\n * Naming exact tokens is precise but closed: a rule listing `db.write` does not cover `storage.write`,\n * and a capability added next year escapes it in silence. Prefer `access`/`zone` for a rule that is\n * meant to hold for a CLASS of effect.\n */\n readonly capabilities?: readonly string[];\n /**\n * Match routes declaring any capability whose definition has this access.\n *\n * This is the selector to reach for when the rule is \"anything that writes must prove who asked\":\n * it is keyed on what the capability IS rather than what it is called, so a token introduced later\n * is covered the day it is declared instead of the day someone remembers to widen the rule.\n *\n * Requires capability definitions. A policy using it without them is refused rather than quietly\n * matching nothing - a selector that matches nothing lets the route fall through to a laxer rule.\n */\n readonly access?: CapabilityAccess;\n /**\n * Match routes declaring any capability in this zone. Combined with `access`, both must hold for the\n * SAME capability, so `{ access: \"write\", zone: \"domain\" }` is \"writes business state\" and does not\n * match a route that only writes an audit log.\n */\n readonly zone?: CapabilityZone;\n /** Match routes whose response classification is at least this sensitivity. */\n readonly classificationAtLeast?: DataClassification;\n /**\n * Match routes by whether they declare a request-body schema. `true` selects routes that parse a\n * body (the buffered-read surface F-001 is about); `false` selects bodyless routes. Reflection\n * already carries `schema.body`, so this reads what the route declared, not where it lives.\n */\n readonly hasBody?: boolean;\n /**\n * Match routes by whether they declare a success `response` schema - the routes a response contract\n * can hold to anything. Pair it with `require: [\"nifra.response-contract\"]` to say \"every route\n * that declares a response enforces it\" without listing the routes that declare none.\n */\n readonly hasResponse?: boolean;\n /**\n * Match routes by their effective transport body policy. `\"unlimited\"` is the explicit\n * streaming/upload exemption; `\"bounded\"` is any finite cap (an explicit number or the inherited\n * server default); `\"unset\"` is a route that declared no `bodyLimit` at all. Lets a baseline say\n * \"a body-schema route may never be unlimited\" as a first-class, movable invariant rather than a\n * path list. A route with no schema reports `\"unset\"` unless it names a limit.\n */\n readonly bodyLimit?: \"bounded\" | \"unlimited\" | \"unset\";\n}"
1401
1415
  },
1402
1416
  {
1403
1417
  "name": "AssuranceRule",
@@ -2242,7 +2256,7 @@
2242
2256
  "name": "BuildClientOptions",
2243
2257
  "kind": "interface",
2244
2258
  "package": "@nifrajs/web",
2245
- "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}"
2259
+ "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}"
2246
2260
  },
2247
2261
  {
2248
2262
  "name": "BuildClientViteOptions",
@@ -2267,7 +2281,7 @@
2267
2281
  "name": "BuildManifest",
2268
2282
  "kind": "interface",
2269
2283
  "package": "@nifrajs/web",
2270
- "signature": "export interface BuildManifest {\n /** URL of the client entry module (content-hashed). */\n readonly entry: string;\n /** URLs of every emitted asset (entry + chunks) - for serving + preloading. */\n readonly assets: readonly string[];\n /** `routeId → [layout chunk URLs…, own chunk URL]` - the chunks a route needs, for `createWebApp`'s\n * `routePreload` (`<link rel=\"modulepreload\">` the matched route alongside the entry). Each route +\n * layout is also a build entrypoint, so it gets a named chunk the bootstrap's lazy import dedupes to. */\n readonly routes: Readonly<Record<string, readonly string[]>>;\n /** URL paths copied from `publicDir`, sorted. Lets the server entry serve them without scanning a\n * directory per request, and lets an adapter that needs a file list (CDN upload, platform static\n * assets) consume one. Omitted when there is no `public/`. */\n readonly publicFiles?: readonly string[];\n /** The app's bundled, content-hashed stylesheet(s) - the bootstrap's **aggregate** CSS (every\n * `import './x.css'` reachable from the app). The complete stylesheet regardless of which file\n * imported the CSS; the always-safe fallback `createWebApp` links when a route has no per-route entry\n * in {@link routeStyles}. Omitted when the app imports no CSS. */\n readonly css?: readonly string[];\n /** Whether the Vite client build kept CSS split by entry/chunk. Absent for the native Bun build. */\n readonly cssCodeSplit?: boolean;\n /** How framework-owned SSR stylesheet links should become active. Defaults to `blocking`. */\n readonly cssLoading?: CssLoadingMode;\n /** `routeId → [chain CSS URLs]` - only the stylesheets the matched route's layout chain + own file\n * actually use (Bun emits a per-entrypoint CSS bundle per route/layout, with shared-component CSS\n * inlined into each consumer). `createWebApp` links these instead of the aggregate, so a page ships\n * only its own CSS. A route is omitted (→ aggregate fallback) when its `[name]` collides with another\n * route's basename (ambiguous CSS↔route) or the build emitted orphan shared-chunk CSS - correctness\n * over minimality. Absent entirely when the app imports no CSS. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n}"
2284
+ "signature": "export interface BuildManifest {\n /** URL of the client entry module (content-hashed). */\n readonly entry: string;\n /** URLs of every emitted asset (entry + chunks) - for serving + preloading. */\n readonly assets: readonly string[];\n /** `routeId → [layout chunk URLs…, own chunk URL]` - the chunks a route needs, for `createWebApp`'s\n * `routePreload` (`<link rel=\"modulepreload\">` the matched route alongside the entry). Each route +\n * layout is also a build entrypoint, so it gets a named chunk the bootstrap's lazy import dedupes to. */\n readonly routes: Readonly<Record<string, readonly string[]>>;\n /** URL paths copied from `publicDir`, sorted. Lets the server entry serve them without scanning a\n * directory per request, and lets an adapter that needs a file list (CDN upload, platform static\n * assets) consume one. Omitted when there is no `public/`. */\n readonly publicFiles?: readonly string[];\n /** The app's bundled, content-hashed stylesheet(s) - the bootstrap's **aggregate** CSS (every\n * `import './x.css'` reachable from the app). The complete stylesheet regardless of which file\n * imported the CSS; the always-safe fallback `createWebApp` links when a route has no per-route entry\n * in {@link routeStyles}. Omitted when the app imports no CSS. */\n readonly css?: readonly string[];\n /** Whether the Vite client build kept CSS split by entry/chunk. Absent for the native Bun build. */\n readonly cssCodeSplit?: boolean;\n /** How framework-owned SSR stylesheet links should become active. Defaults to `blocking`. */\n readonly cssLoading?: CssLoadingMode;\n /** `routeId → [chain CSS URLs]` - only the stylesheets the matched route's layout chain + own file\n * actually use (Bun emits a per-entrypoint CSS bundle per route/layout, with shared-component CSS\n * inlined into each consumer). `createWebApp` links these instead of the aggregate, so a page ships\n * only its own CSS. A route is omitted (→ aggregate fallback) when its `[name]` collides with another\n * route's basename (ambiguous CSS↔route) or the build emitted orphan shared-chunk CSS - correctness\n * over minimality. Absent entirely when the app imports no CSS. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> URL of the chunk holding that locale's copy (`@nifrajs/i18n/copy`), when the build\n * moved copy tables out of the bundle. The server entry passes it to `createWebApp`. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n}"
2271
2285
  },
2272
2286
  {
2273
2287
  "name": "BuildNifraManifestInput",
@@ -2279,13 +2293,13 @@
2279
2293
  "name": "BuildServerOptions",
2280
2294
  "kind": "interface",
2281
2295
  "package": "@nifrajs/web",
2282
- "signature": "export interface BuildServerOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** The worker entry module (absolute path) - your `worker.ts`. It imports `{ manifest, clientEntry }`\n * from the generated `./server-manifest`, builds `createWebApp`, and `export default toFetchHandler(app)`. */\n readonly serverEntry: string;\n /** Output directory for the bundled worker (absolute path). */\n readonly outDir: string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest) - **baked** into the generated\n * server manifest, since a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked into the generated\n * manifest so the server entry hands them to `createWebApp` (→ `<link rel=\"stylesheet\">`). Omit ⇒ no CSS\n * link (the built SSR page would otherwise render unstyled). */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked alongside `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n /** Route/layout file → import specifier in the generated manifest (default: a relative path from the\n * manifest's location - written next to `serverEntry` - to `routesDir`). */\n readonly resolve?: (file: string) => string;\n /** Filename for the generated server-manifest module, written next to `serverEntry` (default\n * `\"server-manifest.ts\"`); your `serverEntry` imports it as `./server-manifest`. */\n readonly manifestFile?: string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"ssr\")` - Solid routes need their SSR transform at\n * build time; React's JSX is Bun-native and needs none). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` resolution conditions (default `[\"workerd\", \"edge-light\", \"browser\"]`) - selects each\n * dependency's edge build. */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (default `{ \"process.env.NODE_ENV\": '\"production\"' }` → production\n * React/Solid on the edge). Pass an explicit object to override (e.g. `{}` to opt out). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** `Bun.build` target (default `\"browser\"` - the right shape for edge runtimes: Cloudflare Workers,\n * Vercel Edge, Deno, Deno Deploy). Use `\"node\"` for a `@nifrajs/node` server (so `node:*` built-ins\n * stay external), or `\"bun\"` for a Bun server. The default `conditions` + the edge resolve shims\n * only apply to the `\"browser\"` target; `\"node\"`/`\"bun\"` resolve their own renderer builds via the\n * matching condition. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** **Lazy/code-split routes** (default `false`): emit `() => import(route)` loaders + bundle with\n * `splitting`, so each route is its own chunk loaded on first request (smaller cold-start parse)\n * instead of all parsed at boot. The output becomes the worker entry **+ chunk files** in `outDir`\n * - on Cloudflare, ship them with wrangler's `no_bundle` + `find_additional_modules` + an ESModule\n * `rule` (Node/Deno import the chunks natively). Eager (one self-contained file) stays the default. */\n readonly lazy?: boolean;\n /** The app root the zone rules classify against (default: the directory holding `routesDir`). */\n readonly root?: string;\n /** Modules a build tool wrote or names as an entry (the adapter module a generated entry imports).\n * Like `serverEntry` and the generated manifest, they may import both halves of a route. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix the app's browser code may read (default `\"PUBLIC_\"`). Shared code in\n * the server bundle is held to it too. */\n readonly publicEnvPrefix?: string;\n}"
2296
+ "signature": "export interface BuildServerOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** The worker entry module (absolute path) - your `worker.ts`. It imports `{ manifest, clientEntry }`\n * from the generated `./server-manifest`, builds `createWebApp`, and `export default toFetchHandler(app)`. */\n readonly serverEntry: string;\n /** Output directory for the bundled worker (absolute path). */\n readonly outDir: string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest) - **baked** into the generated\n * server manifest, since a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked into the generated\n * manifest so the server entry hands them to `createWebApp` (→ `<link rel=\"stylesheet\">`). Omit ⇒ no CSS\n * link (the built SSR page would otherwise render unstyled). */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked alongside `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** Copy chunk URLs by locale (`buildClient`'s `BuildManifest.copyChunks`) - baked as `copyChunks`. */\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n /** Route/layout file → import specifier in the generated manifest (default: a relative path from the\n * manifest's location - written next to `serverEntry` - to `routesDir`). */\n readonly resolve?: (file: string) => string;\n /** Filename for the generated server-manifest module, written next to `serverEntry` (default\n * `\"server-manifest.ts\"`); your `serverEntry` imports it as `./server-manifest`. */\n readonly manifestFile?: string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"ssr\")` - Solid routes need their SSR transform at\n * build time; React's JSX is Bun-native and needs none). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` resolution conditions (default `[\"workerd\", \"edge-light\", \"browser\"]`) - selects each\n * dependency's edge build. */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (default `{ \"process.env.NODE_ENV\": '\"production\"' }` → production\n * React/Solid on the edge). Pass an explicit object to override (e.g. `{}` to opt out). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** `Bun.build` target (default `\"browser\"` - the right shape for edge runtimes: Cloudflare Workers,\n * Vercel Edge, Deno, Deno Deploy). Use `\"node\"` for a `@nifrajs/node` server (so `node:*` built-ins\n * stay external), or `\"bun\"` for a Bun server. The default `conditions` + the edge resolve shims\n * only apply to the `\"browser\"` target; `\"node\"`/`\"bun\"` resolve their own renderer builds via the\n * matching condition. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** **Lazy/code-split routes** (default `false`): emit `() => import(route)` loaders + bundle with\n * `splitting`, so each route is its own chunk loaded on first request (smaller cold-start parse)\n * instead of all parsed at boot. The output becomes the worker entry **+ chunk files** in `outDir`\n * - on Cloudflare, ship them with wrangler's `no_bundle` + `find_additional_modules` + an ESModule\n * `rule` (Node/Deno import the chunks natively). Eager (one self-contained file) stays the default. */\n readonly lazy?: boolean;\n /** The app root the zone rules classify against (default: the directory holding `routesDir`). */\n readonly root?: string;\n /** Modules a build tool wrote or names as an entry (the adapter module a generated entry imports).\n * Like `serverEntry` and the generated manifest, they may import both halves of a route. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix the app's browser code may read (default `\"PUBLIC_\"`). Shared code in\n * the server bundle is held to it too. */\n readonly publicEnvPrefix?: string;\n}"
2283
2297
  },
2284
2298
  {
2285
2299
  "name": "BuildServerViteOptions",
2286
2300
  "kind": "interface",
2287
2301
  "package": "@nifrajs/web",
2288
- "signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n /** Modules the build generated besides the entry and manifest (a target's adapter import). */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n}",
2302
+ "signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n /** Modules the build generated besides the entry and manifest (a target's adapter import). */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n}",
2289
2303
  "doc": "/** Options for {@link buildServerVite} - the same surface as `buildServer` minus Bun-plugin specifics. */"
2290
2304
  },
2291
2305
  {
@@ -2317,7 +2331,7 @@
2317
2331
  "name": "Bundler",
2318
2332
  "kind": "interface",
2319
2333
  "package": "@nifrajs/web",
2320
- "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 }): 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 readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n /** Modules the zone rules treat as generated: the adapter module the generated entry imports. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n }): Promise<ServerBuild>;\n}",
2334
+ "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 }): 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 readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n /** Modules the zone rules treat as generated: the adapter module the generated entry imports. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n }): Promise<ServerBuild>;\n}",
2321
2335
  "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 */"
2322
2336
  },
2323
2337
  {
@@ -2414,6 +2428,13 @@
2414
2428
  "package": "create-nifra",
2415
2429
  "signature": "export declare const COPILOT_INSTRUCTIONS_PATH = \".github/copilot-instructions.md\";"
2416
2430
  },
2431
+ {
2432
+ "name": "COPY_CHUNKS_GLOBAL",
2433
+ "kind": "const",
2434
+ "package": "@nifrajs/i18n",
2435
+ "signature": "export declare const COPY_CHUNKS_GLOBAL = \"__NIFRA_COPY__\";",
2436
+ "doc": "/** Locale key -> chunk URL, from the server's page handover in a production client build. */"
2437
+ },
2417
2438
  {
2418
2439
  "name": "CURSOR_BEFORE_ALL",
2419
2440
  "kind": "const",
@@ -2862,13 +2883,13 @@
2862
2883
  "name": "CatalogCheckCode",
2863
2884
  "kind": "type",
2864
2885
  "package": "@nifrajs/i18n",
2865
- "signature": "export type CatalogCheckCode = \"missing-catalog\" | \"unknown-locale\" | \"invalid-catalog\" | \"shape\" | \"invalid-message\" | \"missing-key\" | \"unused-key\" | \"placeholder\" | \"tag\" | \"missing-other\" | \"plural-categories\" | \"script\" | \"untranslated\";"
2886
+ "signature": "export type CatalogCheckCode = \"missing-catalog\" | \"unknown-locale\" | \"invalid-catalog\" | \"shape\" | \"invalid-message\" | \"missing-key\" | \"unused-key\" | \"placeholder\" | \"tag\" | \"missing-other\" | \"plural-categories\" | \"script\" | \"untranslated\"\n/** A copy table `nifra i18n check` cannot read statically, so it checks nothing in it. */\n | \"copy-table\"\n/** Two copy tables, or a table and a catalog key, under one id. */\n | \"copy-id\"\n/** Mostly Latin words in a locale that does not write in Latin: English left in a translation. */\n | \"latin-share\"\n/** A translation far shorter than the default's message: a summary, not a translation. */\n | \"volume\"\n/** A finding of one of the app's {@link CatalogCheckOptions.rules}. */\n | `custom:${string}`;"
2866
2887
  },
2867
2888
  {
2868
2889
  "name": "CatalogCheckOptions",
2869
2890
  "kind": "interface",
2870
2891
  "package": "@nifrajs/i18n",
2871
- "signature": "export interface CatalogCheckOptions<K extends string = string> {\n readonly locales: Locales<K>;\n /** Each locale's catalog, by registry key. */\n readonly catalogs: {\n readonly [P in K]?: MessageTree | undefined;\n };\n /** Keys a check skips, by finding code: an exact key, a prefix ending in `.*` (`\"languages.*\"`), or\n * `\"*\"` for every key. */\n readonly ignore?: {\n readonly [C in CatalogCheckCode]?: readonly string[] | undefined;\n } | undefined;\n}"
2892
+ "signature": "export interface CatalogCheckOptions<K extends string = string> {\n readonly locales: Locales<K>;\n /** Each locale's catalog, by registry key. */\n readonly catalogs: {\n readonly [P in K]?: MessageTree | undefined;\n };\n /** Keys a check skips, by finding code: an exact key, a prefix ending in `.*` (`\"languages.*\"`), or\n * `\"*\"` for every key. */\n readonly ignore?: {\n readonly [C in CatalogCheckCode]?: readonly string[] | undefined;\n } | undefined;\n /** Latin-script words a locale that does not write in Latin may keep (brand names, `PDF`, `OK`):\n * `latin-share` does not count them. An entry with spaces allows each of its words. */\n readonly latinWords?: readonly string[] | undefined;\n /** `latin-share` skips a message of fewer words, and leaves it out of the locale's share. Default 6. */\n readonly minWords?: number | undefined;\n /** `latin-share` reports a message whose share of Latin words is above this. Default 0.6. */\n readonly maxLatinShare?: number | undefined;\n /** `latin-share` warns about a locale whose {@link LocaleCoverage.latinShare} is above this.\n * Default 0.1. */\n readonly maxLocaleLatinShare?: number | undefined;\n /** `volume` reads default messages at least this many graphemes long. Default 80. */\n readonly minVolumeGraphemes?: number | undefined;\n /** `volume` reports a translation shorter than this share of the default's graphemes. Default 0.32. */\n readonly minVolumeRatio?: number | undefined;\n /** The app's own checks, run on every message of every locale after the built-in ones. */\n readonly rules?: readonly CatalogRule[] | undefined;\n}"
2872
2893
  },
2873
2894
  {
2874
2895
  "name": "CatalogCheckResult",
@@ -2895,6 +2916,27 @@
2895
2916
  "package": "@nifrajs/i18n",
2896
2917
  "signature": "export interface CatalogFinding {\n readonly severity: CatalogCheckSeverity;\n readonly code: CatalogCheckCode;\n readonly locale: string;\n /** The dotted key, when the finding is about one message. */\n readonly key?: string;\n readonly message: string;\n}"
2897
2918
  },
2919
+ {
2920
+ "name": "CatalogRule",
2921
+ "kind": "type",
2922
+ "package": "@nifrajs/i18n",
2923
+ "signature": "export type CatalogRule = (context: CatalogRuleContext) => CatalogRuleFinding | readonly CatalogRuleFinding[] | undefined;",
2924
+ "doc": "/** An app's own check, run on every message of every locale. */"
2925
+ },
2926
+ {
2927
+ "name": "CatalogRuleContext",
2928
+ "kind": "interface",
2929
+ "package": "@nifrajs/i18n",
2930
+ "signature": "export interface CatalogRuleContext {\n readonly locale: string;\n /** The dotted key. */\n readonly key: string;\n readonly message: string;\n /** The default locale's message under the key, the same as `message` in the default locale;\n * `undefined` when the default catalog has none. */\n readonly defaultMessage: string | undefined;\n readonly info: LocaleInfo;\n}",
2931
+ "doc": "/** What a {@link CatalogRule} is given: one message of one locale. */"
2932
+ },
2933
+ {
2934
+ "name": "CatalogRuleFinding",
2935
+ "kind": "interface",
2936
+ "package": "@nifrajs/i18n",
2937
+ "signature": "export interface CatalogRuleFinding {\n /** Reported as `custom:<code>`, which `ignore` takes. */\n readonly code: string;\n readonly message: string;\n /** Default `\"error\"`. */\n readonly severity?: CatalogCheckSeverity | undefined;\n}",
2938
+ "doc": "/** A finding a {@link CatalogRule} returns. */"
2939
+ },
2898
2940
  {
2899
2941
  "name": "CatalogStep",
2900
2942
  "kind": "interface",
@@ -3238,7 +3280,7 @@
3238
3280
  "name": "Classification",
3239
3281
  "kind": "type",
3240
3282
  "package": "@nifrajs/web",
3241
- "signature": "export type Classification = {\n readonly zone: Zone;\n /** The package a `library` file belongs to. */\n readonly packageName?: string;\n /** A `library` package's own declaration, when it made one. */\n readonly declared?: PackageEnvironment;\n /** A third-party file's path inside `node_modules`: `drizzle-orm/node-postgres/index.js`. */\n readonly modulePath?: string;\n} | {\n readonly zone: \"error\";\n readonly reason: string;\n /** The undeclared package this error is about: every file in it shares the one fix. */\n readonly package?: string;\n};"
3283
+ "signature": "export type Classification = {\n readonly zone: Zone;\n /** The package a `library` file belongs to. */\n readonly packageName?: string;\n /** A `library` package's own declaration, when it made one. */\n readonly declared?: PackageEnvironment;\n /** A third-party file's path inside `node_modules`: `drizzle-orm/node-postgres/index.js`. */\n readonly modulePath?: string;\n /** The export subpath (`\"./react\"`) whose own declared side decided this import. */\n readonly entry?: string;\n} | {\n readonly zone: \"error\";\n readonly reason: string;\n /** The undeclared package this error is about: every file in it shares the one fix. */\n readonly package?: string;\n /** The export subpath the import named, when the package's map gives it no side. */\n readonly entry?: string;\n};"
3242
3284
  },
3243
3285
  {
3244
3286
  "name": "ClassifiedSchema",
@@ -3325,7 +3367,7 @@
3325
3367
  "name": "ClientRouterOptions",
3326
3368
  "kind": "interface",
3327
3369
  "package": "@nifrajs/web",
3328
- "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. */\n readonly loadModule?: (routeId: 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}"
3370
+ "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}"
3329
3371
  },
3330
3372
  {
3331
3373
  "name": "ClientServerFn",
@@ -3414,7 +3456,7 @@
3414
3456
  "name": "CodingAgentRpcServerOptions",
3415
3457
  "kind": "interface",
3416
3458
  "package": "@nifrajs/coding-agent",
3417
- "signature": "export interface CodingAgentRpcServerOptions {\n readonly backend: AgentBackend;\n readonly cwd: string;\n readonly hostname?: string;\n /** Remote binding is opt-in; the default only permits loopback hosts. */\n readonly allowRemote?: boolean;\n readonly port?: number;\n /** A random token is generated when omitted. Use an explicit token only for managed local launchers. */\n readonly authToken?: string;\n /** Include bounded exception stacks in RPC failures only for trusted loopback debugging. */\n readonly exposeErrorStacks?: boolean;\n readonly maxBodyBytes?: number;\n /** Maximum UTF-8 bytes in one non-streaming JSON response. Defaults to 4 MiB. */\n readonly maxResponseBytes?: number;\n readonly sessionStore?: SessionStore;\n readonly contextWindow?: ContextWindowOptions;\n readonly extensions?: ExtensionHost;\n readonly ui?: UiExtensionHost;\n readonly verifyAfterTurn?: readonly (\"check\" | \"assure\" | \"test\")[];\n readonly maxRepairAttempts?: number;\n readonly verification?: CodingAgentHostOptions[\"verification\"];\n readonly extensionEvents?: CodingAgentHostOptions[\"extensionEvents\"];\n /**\n * Keep a `turn.send` running when its client disconnects, and let a client that comes back read\n * what it missed with `turn.attach` (an `afterSeq` cursor, or `Last-Event-ID`). The newest\n * `replayEvents` frames, up to `replayBytes`, are held (defaults 1024 and 8 MiB); a turn no client\n * has followed for `detachedTimeoutMs` (default 2 minutes) is cancelled. A client that stops reading\n * is dropped once it falls `replayBytes` behind what is held, and can attach again from its cursor.\n */\n readonly resumableTurns?: boolean | {\n readonly replayEvents?: number;\n readonly replayBytes?: number;\n readonly detachedTimeoutMs?: number;\n };\n}"
3459
+ "signature": "export interface CodingAgentRpcServerOptions {\n readonly backend: AgentBackend;\n readonly cwd: string;\n readonly hostname?: string;\n /** Remote binding is opt-in; the default only permits loopback hosts. */\n readonly allowRemote?: boolean;\n readonly port?: number;\n /** A random token is generated when omitted. Use an explicit token only for managed local launchers. */\n readonly authToken?: string;\n /** Include bounded exception stacks in RPC failures only for trusted loopback debugging. */\n readonly exposeErrorStacks?: boolean;\n readonly maxBodyBytes?: number;\n /** Maximum UTF-8 bytes in one non-streaming JSON response. Defaults to 4 MiB. */\n readonly maxResponseBytes?: number;\n readonly sessionStore?: SessionStore;\n readonly contextWindow?: ContextWindowOptions;\n readonly extensions?: ExtensionHost;\n readonly ui?: UiExtensionHost;\n readonly verifyAfterTurn?: readonly (\"check\" | \"assure\" | \"test\")[];\n readonly maxRepairAttempts?: number;\n readonly verification?: CodingAgentHostOptions[\"verification\"];\n readonly extensionEvents?: CodingAgentHostOptions[\"extensionEvents\"];\n /**\n * The host's approval broker: how long an approval or a tool's question waits for its answer\n * (`timeoutMs`, default 5 minutes, or `\"never\"`), how many may wait (`maxPending`, default 32),\n * and its `onRequired`/`onResolved` hooks.\n */\n readonly approvals?: CodingAgentHostOptions[\"approvals\"];\n /**\n * Keep a `turn.send` running when its client disconnects, and let a client that comes back read\n * what it missed with `turn.attach` (an `afterSeq` cursor, or `Last-Event-ID`). The newest\n * `replayEvents` frames, up to `replayBytes`, are held (defaults 1024 and 8 MiB); a turn no client\n * has followed for `detachedTimeoutMs` (default 2 minutes) is cancelled. A client that stops reading\n * is dropped once it falls `replayBytes` behind what is held, and can attach again from its cursor.\n */\n readonly resumableTurns?: boolean | {\n readonly replayEvents?: number;\n readonly replayBytes?: number;\n readonly detachedTimeoutMs?: number;\n };\n}"
3418
3460
  },
3419
3461
  {
3420
3462
  "name": "Collection",
@@ -3680,14 +3722,14 @@
3680
3722
  "name": "Context",
3681
3723
  "kind": "interface",
3682
3724
  "package": "@nifrajs/core",
3683
- "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n /** Lower-case request headers, validated/coerced when `schema.headers` is declared. */\n readonly headers: HeadersOf<S>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached; validated/coerced when `schema.cookies` is declared. Signed cookies arrive\n * as `value.signature` - verify with `unsignValue`. */\n readonly cookies: CookiesOf<S>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
3725
+ "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n /** Request headers, names lower-cased; when `schema.headers` is declared, its validated output. */\n readonly headers: HeadersOf<S>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached; validated/coerced when `schema.cookies` is declared. Signed cookies arrive\n * as `value.signature` - verify with `unsignValue`. */\n readonly cookies: CookiesOf<S>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
3684
3726
  "doc": "/**\n * Handler context. `params` are inferred from the path; `body` and `query` are\n * the validated outputs of their schemas when declared (else `undefined` /\n * raw `URLSearchParams`).\n */"
3685
3727
  },
3686
3728
  {
3687
3729
  "name": "Context",
3688
3730
  "kind": "interface",
3689
3731
  "package": "nifra",
3690
- "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n /** Lower-case request headers, validated/coerced when `schema.headers` is declared. */\n readonly headers: HeadersOf<S>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached; validated/coerced when `schema.cookies` is declared. Signed cookies arrive\n * as `value.signature` - verify with `unsignValue`. */\n readonly cookies: CookiesOf<S>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
3732
+ "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n /** Request headers, names lower-cased; when `schema.headers` is declared, its validated output. */\n readonly headers: HeadersOf<S>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached; validated/coerced when `schema.cookies` is declared. Signed cookies arrive\n * as `value.signature` - verify with `unsignValue`. */\n readonly cookies: CookiesOf<S>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
3691
3733
  "doc": "/**\n * Handler context. `params` are inferred from the path; `body` and `query` are\n * the validated outputs of their schemas when declared (else `undefined` /\n * raw `URLSearchParams`).\n */"
3692
3734
  },
3693
3735
  {
@@ -3960,6 +4002,101 @@
3960
4002
  "signature": "export type CookieSecret = string | readonly string[];",
3961
4003
  "doc": "/**\n * A signing secret, or a rotation list of them. With a list, **the first secret signs** and\n * verification accepts **any** entry - so rotation is: prepend the new secret, keep the old one\n * until every cookie signed by it has expired, then drop it. An empty list throws.\n */"
3962
4004
  },
4005
+ {
4006
+ "name": "Copy",
4007
+ "kind": "interface",
4008
+ "package": "@nifrajs/i18n",
4009
+ "signature": "export interface Copy<K extends string = string, D extends K = K> {\n /** A table: the default locale's value is required, every other declared locale's is optional. */\n <const V extends CopyInput>(entries: CopyEntries<K, D, V>): CopyTable<CopyShape<V>>;\n /** A table with an explicit id, which `nifra i18n check` and {@link CopyOptions.onMissing} report\n * instead of its `file:line`. Ids are unique per app. */\n id<const V extends CopyInput>(id: string, entries: CopyEntries<K, D, V>): CopyTable<CopyShape<V>>;\n /** The table's value in `locale`, or in the first locale of `locales.chain(locale)` that has one. */\n pick<V>(table: CopyTable<V>, locale: K): V;\n /** Format a message table in `locale` with ICU `vars` (`{n, plural, ...}`), as `t()` does. */\n format(table: CopyTable<string>, locale: K, vars?: Readonly<Record<string, unknown>>): string;\n /**\n * Load a locale's copy in a production client build, where each locale's copy is its own chunk:\n * for a page that reads a locale other than the one it renders in (a \"read this in Hindi\" banner).\n * Without `locale`, the locale the current page renders in. Resolves at once on the server, in dev,\n * and once the locale is loaded.\n */\n load(locale?: K): Promise<void>;\n /** The registry the tables are typed against. */\n readonly locales: Locales<K, D>;\n}",
4010
+ "doc": "/** The copy function {@link defineCopy} returns. */"
4011
+ },
4012
+ {
4013
+ "name": "CopyChunk",
4014
+ "kind": "interface",
4015
+ "package": "@nifrajs/i18n",
4016
+ "signature": "export interface CopyChunk {\n readonly v: Readonly<Record<string, CopyValue>>;\n readonly f?: Readonly<Record<string, readonly [string, string]>>;\n}",
4017
+ "doc": "/** One locale's chunk of a client build: values by chunk id, and for each table that had no value of\n * its own, its readable id and the locale whose value it carries. */"
4018
+ },
4019
+ {
4020
+ "name": "CopyDefinition",
4021
+ "kind": "interface",
4022
+ "package": "@nifrajs/i18n",
4023
+ "signature": "export interface CopyDefinition extends CopyDefinitionRef {\n readonly line: number;\n /** The registry the definition's tables are typed against, read statically. */\n readonly locales?: Locales;\n /** Why {@link locales} could not be read. */\n readonly unreadable?: string;\n}"
4024
+ },
4025
+ {
4026
+ "name": "CopyDefinitionRef",
4027
+ "kind": "interface",
4028
+ "package": "@nifrajs/i18n",
4029
+ "signature": "export interface CopyDefinitionRef {\n /** Relative to the root. */\n readonly file: string;\n readonly name: string;\n}",
4030
+ "doc": "/** A `defineCopy` definition: the module and binding it is declared with. */"
4031
+ },
4032
+ {
4033
+ "name": "CopyEntries",
4034
+ "kind": "type",
4035
+ "package": "@nifrajs/i18n",
4036
+ "signature": "export type CopyEntries<K extends string, D extends K, V> = {\n readonly [P in D]: V;\n} & {\n readonly [P in Exclude<K, D>]?: NoInfer<CopyShape<V>>;\n};",
4037
+ "doc": "/** What a table takes: the default locale's value, and the other declared locales' values, each\n * optional and shaped like the default's. An undeclared locale key is a type error. */"
4038
+ },
4039
+ {
4040
+ "name": "CopyMissing",
4041
+ "kind": "interface",
4042
+ "package": "@nifrajs/i18n",
4043
+ "signature": "export interface CopyMissing<K extends string = string> {\n /** The locale the table was read in. */\n readonly locale: K;\n /** The locale whose value was used instead: the next in `locales.chain(locale)` with one. */\n readonly fallback: K;\n /** The table's id: the one passed to {@link Copy.id}, or the `file:line` a production client build\n * assigns. `undefined` for an unnamed table outside such a build. */\n readonly id: string | undefined;\n}",
4044
+ "doc": "/** A locale a table had no value for, reported to {@link CopyOptions.onMissing}. */"
4045
+ },
4046
+ {
4047
+ "name": "CopyOptions",
4048
+ "kind": "interface",
4049
+ "package": "@nifrajs/i18n",
4050
+ "signature": "export interface CopyOptions<K extends string = string> {\n /** Called once per table and locale when a table has no value for the locale it is read in. Pass a\n * stable function: it is kept for the life of the copy definition. */\n readonly onMissing?: ((missing: CopyMissing<K>) => void) | undefined;\n /**\n * The locale a URL renders in, so a production client build loads that locale's copy before it\n * renders the page, and before a client navigation renders the next one. Default: the URL's first\n * path segment when it is a served locale, else the default locale; the first page also loads the\n * locale its `<html lang>` names. Pass it when the locale comes from elsewhere (a cookie, a\n * subdomain), for example `(url) => urls.localeOf(url.pathname)`.\n */\n readonly localeOf?: ((url: URL) => K | undefined) | undefined;\n}"
4051
+ },
4052
+ {
4053
+ "name": "CopyScanner",
4054
+ "kind": "interface",
4055
+ "package": "@nifrajs/i18n",
4056
+ "signature": "export interface CopyScanner {\n /** The copy tables a module holds, in source order. */\n tables(file: string): readonly CopyTableSite[];\n /** A definition and its registry. */\n definition(ref: CopyDefinitionRef): CopyDefinition | undefined;\n /** The definition a module's export names, following re-exports. */\n exportedDefinition(file: string, name: string): CopyDefinitionRef | undefined;\n /**\n * The module with each table a client build can split replaced by its chunk id\n * (`copyRef(\"<id>\")`), and the copy loaded before the first statement that holds one, or `undefined`\n * when it has none. Line breaks are kept, so the module's line numbers do not move.\n */\n rewrite(file: string): string | undefined;\n}"
4057
+ },
4058
+ {
4059
+ "name": "CopyShape",
4060
+ "kind": "type",
4061
+ "package": "@nifrajs/i18n",
4062
+ "signature": "export type CopyShape<V> = V extends string ? string : V extends readonly unknown[] ? {\n readonly [I in keyof V]: CopyShape<V[I]>;\n} : {\n readonly [P in keyof V]: CopyShape<V[P]>;\n};",
4063
+ "doc": "/** The shape every locale's value must have, given the default locale's value `V`: the same lists\n * (of the same length) and blocks (with the same keys), with any message where `V` has one. */"
4064
+ },
4065
+ {
4066
+ "name": "CopySourceHost",
4067
+ "kind": "interface",
4068
+ "package": "@nifrajs/i18n",
4069
+ "signature": "export interface CopySourceHost {\n /** The project root: result files are relative to it. */\n readonly root: string;\n /** A file's text, or `undefined` when there is none. */\n read(file: string): string | undefined;\n /** Resolve a bare specifier (a workspace package) the scanner's own resolution cannot: relative\n * paths and the root tsconfig's `paths` are handled already. */\n resolve?(specifier: string, from: string): string | undefined;\n}",
4070
+ "doc": "/** Where the scanner reads source. Paths are absolute, `/`-separated. */"
4071
+ },
4072
+ {
4073
+ "name": "CopyTable",
4074
+ "kind": "interface",
4075
+ "package": "@nifrajs/i18n",
4076
+ "signature": "export interface CopyTable<V = CopyValue> {\n readonly [VALUE]?: V;\n}",
4077
+ "doc": "/** A table {@link Copy} made. Opaque: read it with {@link Copy.pick} or {@link Copy.format}. */"
4078
+ },
4079
+ {
4080
+ "name": "CopyTableEntry",
4081
+ "kind": "interface",
4082
+ "package": "@nifrajs/i18n",
4083
+ "signature": "export interface CopyTableEntry {\n readonly id: string;\n readonly values: Readonly<Record<string, MessageValue>>;\n}",
4084
+ "doc": "/** A copy table, as {@link tablesToCatalogs} takes it: its id and its values by locale key. */"
4085
+ },
4086
+ {
4087
+ "name": "CopyTableSite",
4088
+ "kind": "interface",
4089
+ "package": "@nifrajs/i18n",
4090
+ "signature": "export interface CopyTableSite {\n /** The `copy.id()` id, or `file:line` (`file:line:column` when a line holds two tables). */\n readonly id: string;\n readonly explicit: boolean;\n /** Relative to the root. */\n readonly file: string;\n readonly line: number;\n readonly column: number;\n /** The call's range in the module text. */\n readonly start: number;\n readonly end: number;\n readonly definition: CopyDefinitionRef;\n /** The expression the module reaches the copy function by (`copy`, `i18n.copy`). */\n readonly callee: string;\n /** The values by locale key; absent when {@link unreadable}. */\n readonly values?: Readonly<Record<string, CopyValue>>;\n /** Why the values could not be read statically. */\n readonly unreadable?: string;\n}",
4091
+ "doc": "/** One table: a call of a copy function. */"
4092
+ },
4093
+ {
4094
+ "name": "CopyValue",
4095
+ "kind": "type",
4096
+ "package": "@nifrajs/i18n",
4097
+ "signature": "export type CopyValue = string | readonly CopyValue[] | {\n readonly [key: string]: CopyValue;\n};",
4098
+ "doc": "/** A copy value: a message, a list, or a nested block of either. Never a function: a message that\n * takes values is an ICU message read with {@link Copy.format}. */"
4099
+ },
3963
4100
  {
3964
4101
  "name": "CoreLogEntry",
3965
4102
  "kind": "interface",
@@ -3989,7 +4126,7 @@
3989
4126
  "name": "CreateMcpServerOptions",
3990
4127
  "kind": "interface",
3991
4128
  "package": "@nifrajs/mcp",
3992
- "signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets - their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n /** Max serialized JSON-RPC response or SSE frame size (default 1 MB). */\n readonly maxResponseBytes?: number;\n /** Max bytes an SSE stream queues for a client that is not reading (default 4 MiB). */\n readonly maxPendingBytes?: number;\n /** Natural-language guidance for LLMs, surfaced in the modern `server/discover` result (2026-07-28). */\n readonly instructions?: string;\n /** Explicitly allow browser clients from any origin. Omit for the secure same-origin default. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. Set it to permit exact cross-origin clients. */\n readonly allowedOrigins?: readonly string[];\n /** Host allowlist; set it for a server on localhost or a private network. See {@link McpHttpOptions}. */\n readonly allowedHosts?: readonly string[];\n /** Shared state for one authenticated MCP session; prefer `resolveState` for multi-session hosts. */\n readonly state?: McpProtocolState;\n /** Resolve a session-scoped request registry after per-message authorization. */\n readonly resolveState?: McpHttpOptions[\"resolveState\"];\n /**\n * Per-message authorization, applied after the message parses and before any tool runs. Return\n * `false` to answer 403 with a JSON-RPC `unauthorized` error (`MCP_ERROR.UNAUTHORIZED`) and no result.\n *\n * This is the seam for \"this caller may list tools but may not call the write ones\" - the HTTP\n * layer above only sees one opaque POST, so a route guard cannot make that distinction.\n * `fetch(request, { authorizeMessage })` overrides it per request when the decision depends on\n * something the surrounding handler resolved (a session, a tenant).\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
4129
+ "signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets - their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n /** Max serialized JSON-RPC response or SSE frame size (default 1 MB). */\n readonly maxResponseBytes?: number;\n /** Max bytes an SSE stream queues for a client that is not reading (default 4 MiB). */\n readonly maxPendingBytes?: number;\n /** Natural-language guidance for LLMs, surfaced in the modern `server/discover` result (2026-07-28). */\n readonly instructions?: string;\n /** Explicitly allow browser clients from any origin. Omit for the secure same-origin default. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. Set it to permit exact cross-origin clients. */\n readonly allowedOrigins?: readonly string[];\n /** Host allowlist; set it for a server on localhost or a private network. See {@link McpHttpOptions}. */\n readonly allowedHosts?: readonly string[];\n /** Shared state for one authenticated MCP session; prefer `resolveState` for multi-session hosts. */\n readonly state?: McpProtocolState;\n /** Resolve a session-scoped request registry after per-message authorization. */\n readonly resolveState?: McpHttpOptions[\"resolveState\"];\n /**\n * Per-message authorization, applied after the message parses and before any tool runs. Return\n * `false` to answer 403 with a JSON-RPC `unauthorized` error (`MCP_ERROR.UNAUTHORIZED`) and no result.\n *\n * This is the seam for \"this caller may list tools but may not call the write ones\" - the HTTP\n * layer above only sees one opaque POST, so a route guard cannot make that distinction.\n * `fetch(request, { authorizeMessage })` overrides it per request when the decision depends on\n * something the surrounding handler resolved (a session, a tenant). With it set, a GET for the\n * server-message stream is answered `405`, since that stream has no message to authorize.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
3993
4130
  },
3994
4131
  {
3995
4132
  "name": "CreateNonceResolverOptions",
@@ -4044,7 +4181,7 @@
4044
4181
  "name": "CreateWebAppOptions",
4045
4182
  "kind": "interface",
4046
4183
  "package": "@nifrajs/web",
4047
- "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. The resolver does not declare a CSP header because the\n * policy's allowed sources are app-specific.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /**\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 /** 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 /**\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. 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 /** 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` (default `true`): the page routes, and the backend routes\n * when the backend is mounted over HTTP at {@link apiPrefix}. `false` registers neither path. */\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}"
4184
+ "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. The resolver does not declare a CSP header because the\n * policy's allowed sources are app-specific.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /**\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 /** 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. 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 /** 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}"
4048
4185
  },
4049
4186
  {
4050
4187
  "name": "CronError",
@@ -4058,7 +4195,7 @@
4058
4195
  "kind": "interface",
4059
4196
  "package": "@nifrajs/cron",
4060
4197
  "signature": "export interface CronFields {\n readonly minute: ReadonlySet<number>;\n readonly hour: ReadonlySet<number>;\n readonly dom: ReadonlySet<number>;\n readonly month: ReadonlySet<number>;\n readonly dow: ReadonlySet<number>;\n readonly domRestricted: boolean;\n readonly dowRestricted: boolean;\n}",
4061
- "doc": "/** A parsed expression: one allowed-values Set per field, + whether dom/dow were restricted (for\n * the standard OR rule). */"
4198
+ "doc": "/** A parsed expression: one allowed-values Set per field, + whether dom/dow were restricted (for\n * the standard OR rule). A field led by a star, a star-step included, is not restricted. */"
4062
4199
  },
4063
4200
  {
4064
4201
  "name": "CronHandler",
@@ -5120,6 +5257,13 @@
5120
5257
  "package": "@nifrajs/coding-agent",
5121
5258
  "signature": "export interface DispatchWriteResult {\n readonly ok: boolean;\n readonly code: DispatchResultCode;\n}"
5122
5259
  },
5260
+ {
5261
+ "name": "DocumentParts",
5262
+ "kind": "interface",
5263
+ "package": "@nifrajs/web",
5264
+ "signature": "export interface DocumentParts {\n /** Placed at the end of `<head>`. Svelte's `<svelte:head>` lands here. */\n head: string;\n /** Placed first in `<body>`, before the app root. Vue's `<Teleport to=\"body\">` lands here. */\n body: string;\n}",
5265
+ "doc": "/**\n * Markup a render produced for outside the app root, which an adapter that sets\n * {@link RenderAdapter.documentParts} appends to. Each part must be complete before the render\n * settles: `renderToString` resolving, or `renderToStream` returning its stream.\n */"
5266
+ },
5123
5267
  {
5124
5268
  "name": "DraftCookieControls",
5125
5269
  "kind": "interface",
@@ -5323,7 +5467,7 @@
5323
5467
  "name": "EdgeOptions",
5324
5468
  "kind": "interface",
5325
5469
  "package": "@nifrajs/edge",
5326
- "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 /** 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}",
5470
+ "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}",
5327
5471
  "doc": "/** Construction-time options. The defaults mirror `@nifrajs/core`'s `ServerOptions`. */"
5328
5472
  },
5329
5473
  {
@@ -6154,7 +6298,7 @@
6154
6298
  "name": "FixRecipe",
6155
6299
  "kind": "interface",
6156
6300
  "package": "@nifrajs/cli",
6157
- "signature": "export interface FixRecipe {\n readonly id: string;\n readonly description: string;\n apply(root: string, diagnostic: Diagnostic): Promise<readonly string[]>;\n readonly verify: string;\n}"
6301
+ "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}"
6158
6302
  },
6159
6303
  {
6160
6304
  "name": "FontAsset",
@@ -6219,6 +6363,13 @@
6219
6363
  "signature": "export interface FormOptions extends MultipartLimits {\n /** Accept fields the form does not declare. Defaults to `false`: an undeclared field fails validation. */\n readonly additionalProperties?: boolean;\n readonly title?: string;\n readonly description?: string;\n}",
6220
6364
  "doc": "/**\n * The multipart limits (`maxFields`, `maxFiles`, `maxFieldBytes`, `maxFileBytes`) bound what the body\n * may carry before any of it is validated; a request over one is answered `413`.\n */"
6221
6365
  },
6366
+ {
6367
+ "name": "FormOrigins",
6368
+ "kind": "type",
6369
+ "package": "@nifrajs/core",
6370
+ "signature": "export type FormOrigins = ReadonlyArray<string> | ((origin: string) => boolean);",
6371
+ "doc": "/**\n * Origins besides the request's own whose HTML forms may post a body: exact origins, or a function\n * that receives the request's `Origin`.\n */"
6372
+ },
6222
6373
  {
6223
6374
  "name": "Formatter",
6224
6375
  "kind": "interface",
@@ -6267,7 +6418,7 @@
6267
6418
  "name": "GateResult",
6268
6419
  "kind": "interface",
6269
6420
  "package": "@nifrajs/cli",
6270
- "signature": "export interface GateResult {\n readonly gate: \"check\" | \"doctor\" | \"render\" | \"hydration\" | \"contracts\" | \"size\" | \"tests\" | string;\n readonly status: \"pass\" | \"fail\" | \"skip\";\n readonly skipReason?: string;\n readonly durationMs: number;\n readonly diagnostics: readonly Diagnostic[];\n readonly replay?: string;\n}"
6421
+ "signature": "export interface GateResult {\n readonly gate: \"check\" | \"assurance\" | \"doctor\" | \"render\" | \"hydration\" | \"contracts\" | \"size\" | \"tests\" | string;\n readonly status: \"pass\" | \"fail\" | \"skip\";\n readonly skipReason?: string;\n readonly durationMs: number;\n readonly diagnostics: readonly Diagnostic[];\n readonly replay?: string;\n}"
6271
6422
  },
6272
6423
  {
6273
6424
  "name": "Gauge",
@@ -6280,7 +6431,7 @@
6280
6431
  "name": "GenerateClientEntryOptions",
6281
6432
  "kind": "interface",
6282
6433
  "package": "@nifrajs/web",
6283
- "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}"
6434
+ "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}"
6284
6435
  },
6285
6436
  {
6286
6437
  "name": "GenerateRegressionTestOptions",
@@ -6298,7 +6449,7 @@
6298
6449
  "name": "GenerateServerManifestOptions",
6299
6450
  "kind": "interface",
6300
6451
  "package": "@nifrajs/web",
6301
- "signature": "export interface GenerateServerManifestOptions {\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier -\n * same contract as `generateClientEntry`'s `resolve`. */\n readonly resolve: (file: string) => string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest), **baked** into the emitted\n * module - a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked as\n * `export const styles` so the server entry can hand them to `createWebApp` (→ `<link rel=\"stylesheet\">`\n * in `<head>`). Without this the built SSR page ships no CSS link and renders unstyled. */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked as\n * `export const routeStyles` so a page links only the CSS its route chain uses. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before the generated client mounts. */\n readonly cssLoading?: CssLoadingMode;\n /** Emit **lazy** per-route loaders (`() => import(\"./routes/x\")`, a static specifier) instead of\n * eager `import * as`, so a bundler with code-splitting emits one chunk per route - loaded on the\n * first request to it, not all at boot (smaller cold-start parse). Default `false` (eager). Both\n * modes are fs-free with statically-analyzable specifiers; only the *when* differs. */\n readonly lazy?: boolean;\n}"
6452
+ "signature": "export interface GenerateServerManifestOptions {\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier -\n * same contract as `generateClientEntry`'s `resolve`. */\n readonly resolve: (file: string) => string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest), **baked** into the emitted\n * module - a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked as\n * `export const styles` so the server entry can hand them to `createWebApp` (→ `<link rel=\"stylesheet\">`\n * in `<head>`). Without this the built SSR page ships no CSS link and renders unstyled. */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked as\n * `export const routeStyles` so a page links only the CSS its route chain uses. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before the generated client mounts. */\n readonly cssLoading?: CssLoadingMode;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`) - baked as\n * `export const copyChunks` when the client build split copy tables, for `createWebApp`. */\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /** Emit **lazy** per-route loaders (`() => import(\"./routes/x\")`, a static specifier) instead of\n * eager `import * as`, so a bundler with code-splitting emits one chunk per route - loaded on the\n * first request to it, not all at boot (smaller cold-start parse). Default `false` (eager). Both\n * modes are fs-free with statically-analyzable specifiers; only the *when* differs. */\n readonly lazy?: boolean;\n}"
6302
6453
  },
6303
6454
  {
6304
6455
  "name": "GetStaticPaths",
@@ -6332,7 +6483,7 @@
6332
6483
  "name": "GraphqlHttpOptions",
6333
6484
  "kind": "interface",
6334
6485
  "package": "@nifrajs/graphql",
6335
- "signature": "export interface GraphqlHttpOptions<Context = unknown, Env = unknown> {\n /** The executable schema (types + resolvers), e.g. from `graphql`'s `buildSchema` or a schema builder. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the request (and nifra context when mounted). */\n readonly context?: GraphqlContextBuilder<Context, Env>;\n /** The nifra route context, when the caller has one (supplied by `mountGraphql`). */\n readonly nifra?: NifraContextLike<Env>;\n /** Maximum request body size in bytes. Default 1 MB. Rejected bodies answer 413. */\n readonly maxBodyBytes?: number;\n /** Maximum UTF-8 query size. Default 64 KiB, applied to POST and GET. */\n readonly maxQueryBytes?: number;\n /** Maximum UTF-8 serialized variables size. Default 256 KiB. */\n readonly maxVariablesBytes?: number;\n /** Maximum expanded field depth. Default 20. */\n readonly maxDepth?: number;\n /** Maximum aliases in one document. Default 100. */\n readonly maxAliases?: number;\n /** Maximum simple field complexity in one document. Default 1,000. */\n readonly maxComplexity?: number;\n /** Maximum operation definitions in one document. Default 10. */\n readonly maxOperations?: number;\n /**\n * Maximum pairs of fields sharing a response name in one selection set, counted through fragments.\n * Validation compares every such pair, so this bounds its cost. Default 2,000.\n */\n readonly maxFieldOverlaps?: number;\n /**\n * Maximum asynchronous resolver execution time. Default 10 seconds. The execution's abort signal,\n * which a resolver reads through `info.getAbortSignal()`, is aborted at this deadline and when the\n * request itself is aborted.\n */\n readonly executionTimeoutMs?: number;\n /** Prototype-pollution policy for the parsed JSON body. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Optional root value passed to the executor. */\n readonly rootValue?: unknown;\n /**\n * Origin allowlist for the CORS `access-control-allow-origin` header. Omit to reflect any origin\n * (`*`) - correct for a public API; set it to lock the browser callers down.\n */\n readonly allowedOrigins?: readonly string[];\n /**\n * Per-request authorization, run after the origin check and before the body is read or parsed; a\n * CORS preflight (`OPTIONS`) skips it. Return `false` to answer `401` with a GraphQL error envelope.\n */\n readonly authorize?: (request: Request) => boolean | Promise<boolean>;\n /** Emit the legacy always-200 `application/json` response shape instead of `application/graphql-response+json`. */\n readonly legacyJsonResponse?: boolean;\n /** Format request/execution errors. The default masks resolver messages and preserves request errors. */\n readonly formatError?: (error: GraphQLError, phase: \"request\" | \"execution\") => unknown;\n}"
6486
+ "signature": "export interface GraphqlHttpOptions<Context = unknown, Env = unknown> {\n /** The executable schema (types + resolvers), e.g. from `graphql`'s `buildSchema` or a schema builder. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the request (and nifra context when mounted). */\n readonly context?: GraphqlContextBuilder<Context, Env>;\n /** The nifra route context, when the caller has one (supplied by `mountGraphql`). */\n readonly nifra?: NifraContextLike<Env>;\n /** Maximum request body size in bytes. Default 1 MB. Rejected bodies answer 413. */\n readonly maxBodyBytes?: number;\n /** Maximum UTF-8 query size. Default 64 KiB, applied to POST and GET. */\n readonly maxQueryBytes?: number;\n /** Maximum UTF-8 serialized variables size. Default 256 KiB. */\n readonly maxVariablesBytes?: number;\n /** Maximum expanded field depth. Default 20. */\n readonly maxDepth?: number;\n /** Maximum aliases in one document. Default 100. */\n readonly maxAliases?: number;\n /** Maximum simple field complexity in one document. Default 1,000. */\n readonly maxComplexity?: number;\n /** Maximum operation definitions in one document. Default 10. */\n readonly maxOperations?: number;\n /**\n * Maximum pairs of fields sharing a response name in one selection set, counted through fragments.\n * Validation compares every such pair, so this bounds its cost. Default 2,000.\n */\n readonly maxFieldOverlaps?: number;\n /**\n * Maximum asynchronous resolver execution time. Default 10 seconds. The execution's abort signal,\n * which a resolver reads through `info.getAbortSignal()`, is aborted at this deadline and when the\n * request itself is aborted.\n */\n readonly executionTimeoutMs?: number;\n /** Prototype-pollution policy for the parsed JSON body. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /**\n * Answer introspection queries (`__schema`, `__type`). Default `true`. Set `false` to refuse them\n * as a validation error (400); `__typename` still resolves. Shared with `subscriptions`.\n */\n readonly introspection?: boolean;\n /** Optional root value passed to the executor. */\n readonly rootValue?: unknown;\n /**\n * Origin allowlist for the CORS `access-control-allow-origin` header. Omit to reflect any origin\n * (`*`) - correct for a public API; set it to lock the browser callers down.\n */\n readonly allowedOrigins?: readonly string[];\n /**\n * Per-request authorization, run after the origin check and before the body is read or parsed; a\n * CORS preflight (`OPTIONS`) skips it. Return `false` to answer `401` with a GraphQL error envelope.\n */\n readonly authorize?: (request: Request) => boolean | Promise<boolean>;\n /** Emit the legacy always-200 `application/json` response shape instead of `application/graphql-response+json`. */\n readonly legacyJsonResponse?: boolean;\n /** Format request/execution errors. The default masks resolver messages and preserves request errors. */\n readonly formatError?: (error: GraphQLError, phase: \"request\" | \"execution\") => unknown;\n}"
6336
6487
  },
6337
6488
  {
6338
6489
  "name": "GraphqlPubSub",
@@ -6357,7 +6508,7 @@
6357
6508
  "name": "GraphqlWsOptions",
6358
6509
  "kind": "interface",
6359
6510
  "package": "@nifrajs/graphql",
6360
- "signature": "export interface GraphqlWsOptions<Context extends Record<string, unknown> = Record<string, unknown>> {\n /** The executable schema. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the upgrade request. Shared with the HTTP transport. */\n readonly context?: GraphqlContextBuilder<Context>;\n /**\n * Admit a socket from its upgrade request, before {@link onConnect}; return `false` (or throw) to\n * reject the connection. `mountGraphql({ subscriptions: true })` passes its HTTP `authorize` here.\n */\n readonly authorize?: (request: Request) => boolean | Promise<boolean>;\n /**\n * Called once per connection with the client's `connection_init` payload; return `false` (or throw)\n * to reject the connection. The seam for authenticating a socket from an init token.\n */\n readonly onConnect?: (payload: ConnectionInitMessage[\"payload\"], request: Request) => boolean | Promise<boolean>;\n /** Additional raw `graphql-ws` server options merged last (advanced escape hatch). */\n readonly serverOptions?: Partial<ServerOptions>;\n /** Same query/complexity limits as the HTTP transport. */\n readonly maxQueryBytes?: number;\n readonly maxVariablesBytes?: number;\n readonly maxDepth?: number;\n readonly maxAliases?: number;\n readonly maxComplexity?: number;\n readonly maxOperations?: number;\n readonly maxFieldOverlaps?: number;\n /** Maximum concurrent subscription operation ids per connection. Default 20. */\n readonly maxSubscriptions?: number;\n /**\n * Maximum time for initial execute/subscribe setup. Default 10 seconds. Each operation's abort\n * signal, which a resolver reads through `info.getAbortSignal()`, is aborted at this deadline, when\n * the client completes the operation, and when the socket closes.\n */\n readonly executionTimeoutMs?: number;\n}"
6511
+ "signature": "export interface GraphqlWsOptions<Context extends Record<string, unknown> = Record<string, unknown>> {\n /** The executable schema. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the upgrade request. Shared with the HTTP transport. */\n readonly context?: GraphqlContextBuilder<Context>;\n /**\n * Admit a socket from its upgrade request, before {@link onConnect}; return `false` (or throw) to\n * reject the connection. `mountGraphql({ subscriptions: true })` passes its HTTP `authorize` here.\n */\n readonly authorize?: (request: Request) => boolean | Promise<boolean>;\n /**\n * Called once per connection with the client's `connection_init` payload; return `false` (or throw)\n * to reject the connection. The seam for authenticating a socket from an init token.\n */\n readonly onConnect?: (payload: ConnectionInitMessage[\"payload\"], request: Request) => boolean | Promise<boolean>;\n /** Additional raw `graphql-ws` server options merged last (advanced escape hatch). */\n readonly serverOptions?: Partial<ServerOptions>;\n /** Same query/complexity limits as the HTTP transport. */\n readonly maxQueryBytes?: number;\n readonly maxVariablesBytes?: number;\n readonly maxDepth?: number;\n readonly maxAliases?: number;\n readonly maxComplexity?: number;\n readonly maxOperations?: number;\n readonly maxFieldOverlaps?: number;\n /** Maximum concurrent subscription operation ids per connection. Default 20. */\n readonly maxSubscriptions?: number;\n /**\n * Answer introspection (`__schema`, `__type`). Default `true`. Set `false` to refuse such an\n * operation with an `error` frame; `__typename` still resolves.\n */\n readonly introspection?: boolean;\n /**\n * Maximum time for initial execute/subscribe setup. Default 10 seconds. Each operation's abort\n * signal, which a resolver reads through `info.getAbortSignal()`, is aborted at this deadline, when\n * the client completes the operation, and when the socket closes.\n */\n readonly executionTimeoutMs?: number;\n}"
6361
6512
  },
6362
6513
  {
6363
6514
  "name": "GuardOptions",
@@ -6497,7 +6648,7 @@
6497
6648
  "name": "HookKind",
6498
6649
  "kind": "type",
6499
6650
  "package": "@nifrajs/core",
6500
- "signature": "export type HookKind = \"onRequest\" | \"around\" | \"authenticate\" | \"derive\" | \"beforeHandle\" | \"afterHandle\" | \"onError\" | \"onResponse\" | \"responseHeaders\" | \"onResponseFinalized\";",
6651
+ "signature": "export type HookKind = \"onRequest\" | \"around\" | \"authenticate\" | \"derive\" | \"beforeHandle\" | \"afterHandle\" | \"onError\" | \"onResponse\" | \"responseHeaders\" | \"onResponseFinalized\" | \"effectLedger\" | \"idempotency\" | \"responseContract\";",
6501
6652
  "doc": "/**\n * Where each registered hook came from, for `reflectHooks` (`nifra routes --hooks`). Development-only:\n * every write sits behind the inline `process.env.NODE_ENV !== \"production\"` guard at its call site in\n * `server.ts`, so a production define folds the writes away and this module drops out of the bundle.\n * Reads happen only from reflection, never on the request path.\n */"
6502
6653
  },
6503
6654
  {
@@ -6607,39 +6758,39 @@
6607
6758
  "name": "I18nProvider",
6608
6759
  "kind": "const",
6609
6760
  "package": "@nifrajs/web-vue",
6610
- "signature": "export declare const I18nProvider: import(\"vue\").DefineComponent<import(\"vue\").ExtractPropTypes<{\n locale: {\n type: StringConstructor;\n required: true;\n };\n messages: {\n type: PropType<Translation>;\n required: true;\n };\n fallback: {\n type: PropType<NonNullable<FormatterOptions[\"fallback\"]>>;\n };\n onMissing: {\n type: PropType<NonNullable<FormatterOptions[\"onMissing\"]>>;\n };\n timeZone: {\n type: StringConstructor;\n };\n numberingSystem: {\n type: StringConstructor;\n };\n}>, () => import(\"vue\").VNode<import(\"vue\").RendererNode, import(\"vue\").RendererElement, {\n [key: string]: any;\n}>[] | undefined, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, string, import(\"vue\").PublicProps, Readonly<import(\"vue\").ExtractPropTypes<{\n locale: {\n type: StringConstructor;\n required: true;\n };\n messages: {\n type: PropType<Translation>;\n required: true;\n };\n fallback: {\n type: PropType<NonNullable<FormatterOptions[\"fallback\"]>>;\n };\n onMissing: {\n type: PropType<NonNullable<FormatterOptions[\"onMissing\"]>>;\n };\n timeZone: {\n type: StringConstructor;\n };\n numberingSystem: {\n type: StringConstructor;\n };\n}>> & Readonly<{}>, {}, {}, {}, {}, string, import(\"vue\").ComponentProvideOptions, true, {}, any>;",
6761
+ "signature": "export declare const I18nProvider: import(\"vue\").DefineComponent<import(\"vue\").ExtractPropTypes<{\n /** The locale to format in. Default: the page's locale tag, in an app that registers its locale\n * routing. */\n locale: {\n type: StringConstructor;\n };\n messages: {\n type: PropType<Translation>;\n required: true;\n };\n fallback: {\n type: PropType<NonNullable<FormatterOptions[\"fallback\"]>>;\n };\n onMissing: {\n type: PropType<NonNullable<FormatterOptions[\"onMissing\"]>>;\n };\n timeZone: {\n type: StringConstructor;\n };\n numberingSystem: {\n type: StringConstructor;\n };\n}>, () => import(\"vue\").VNode<import(\"vue\").RendererNode, import(\"vue\").RendererElement, {\n [key: string]: any;\n}>[] | undefined, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, string, import(\"vue\").PublicProps, Readonly<import(\"vue\").ExtractPropTypes<{\n /** The locale to format in. Default: the page's locale tag, in an app that registers its locale\n * routing. */\n locale: {\n type: StringConstructor;\n };\n messages: {\n type: PropType<Translation>;\n required: true;\n };\n fallback: {\n type: PropType<NonNullable<FormatterOptions[\"fallback\"]>>;\n };\n onMissing: {\n type: PropType<NonNullable<FormatterOptions[\"onMissing\"]>>;\n };\n timeZone: {\n type: StringConstructor;\n };\n numberingSystem: {\n type: StringConstructor;\n };\n}>> & Readonly<{}>, {}, {}, {}, {}, string, import(\"vue\").ComponentProvideOptions, true, {}, any>;",
6611
6762
  "doc": "/** Provide a {@link Formatter} (built from `locale` + `messages`, with the optional `fallback`,\n * `onMissing`, `timeZone` and `numberingSystem` of `createFormatter`) to the subtree. Recomputes\n * when any of them changes, so a locale switch re-renders consumers. Renders its default slot. */"
6612
6763
  },
6613
6764
  {
6614
6765
  "name": "I18nProviderProps",
6615
6766
  "kind": "interface",
6616
6767
  "package": "@nifrajs/web-preact",
6617
- "signature": "export interface I18nProviderProps extends FormatterOptions {\n readonly locale: string;\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n readonly messages: Translation;\n readonly children?: ComponentChildren;\n}"
6768
+ "signature": "export interface I18nProviderProps extends FormatterOptions {\n /** The locale to format in. Default: the page's locale tag, in an app that registers its locale\n * routing. */\n readonly locale?: string;\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n readonly messages: Translation;\n readonly children?: ComponentChildren;\n}"
6618
6769
  },
6619
6770
  {
6620
6771
  "name": "I18nProviderProps",
6621
6772
  "kind": "interface",
6622
6773
  "package": "@nifrajs/web-react",
6623
- "signature": "export interface I18nProviderProps extends FormatterOptions {\n readonly locale: string;\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n readonly messages: Translation;\n readonly children?: ReactNode;\n}"
6774
+ "signature": "export interface I18nProviderProps extends FormatterOptions {\n /** The locale to format in. Default: the page's locale tag, in an app that registers its locale\n * routing. */\n readonly locale?: string;\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n readonly messages: Translation;\n readonly children?: ReactNode;\n}"
6624
6775
  },
6625
6776
  {
6626
6777
  "name": "I18nProviderProps",
6627
6778
  "kind": "interface",
6628
6779
  "package": "@nifrajs/web-solid",
6629
- "signature": "export interface I18nProviderProps extends FormatterOptions {\n readonly locale: string;\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n readonly messages: Translation;\n readonly children?: JSX.Element;\n}"
6780
+ "signature": "export interface I18nProviderProps extends FormatterOptions {\n /** The locale to format in. Default: the page's locale tag, in an app that registers its locale\n * routing. */\n readonly locale?: string;\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n readonly messages: Translation;\n readonly children?: JSX.Element;\n}"
6630
6781
  },
6631
6782
  {
6632
6783
  "name": "I18nProviderProps",
6633
6784
  "kind": "interface",
6634
6785
  "package": "@nifrajs/web-svelte",
6635
- "signature": "export interface I18nProviderProps extends FormatterOptions {\n /** The active locale (e.g. `\"en\"`, `\"fr-CA\"`). */\n locale: string\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n messages: Translation\n /** The subtree that reads the formatter via `useT()`. */\n children?: Snippet\n}",
6786
+ "signature": "export interface I18nProviderProps extends FormatterOptions {\n /** The active locale (e.g. `\"en\"`, `\"fr-CA\"`). Default: the page's locale tag, in an app that\n * registers its locale routing. */\n locale?: string\n /** The catalog for `locale`, checked against the registered catalog type when one is declared. */\n messages: Translation\n /** The subtree that reads the formatter via `useT()`. */\n children?: Snippet\n}",
6636
6787
  "doc": "/** Hand-written types for `I18nProvider.svelte` (consumers resolve these via the `./i18n` re-export). */"
6637
6788
  },
6638
6789
  {
6639
6790
  "name": "I18nRoutingOptions",
6640
6791
  "kind": "interface",
6641
6792
  "package": "@nifrajs/i18n",
6642
- "signature": "export interface I18nRoutingOptions {\n /** Prefix the default locale too (`/en/about` instead of `/about`). Default `false`. */\n readonly prefixDefaultLocale?: boolean;\n}"
6793
+ "signature": "export interface I18nRoutingOptions<K extends string = string> {\n /** Prefix the default locale too (`/en/about` instead of `/about`). Default `false`. */\n readonly prefixDefaultLocale?: boolean;\n /**\n * The locales a page exists in, by its pathname without the locale prefix, query or hash\n * (`/learn/x`); `undefined` for every served locale. It must be pure: every page of one cluster\n * has to answer the same set, or the alternates stop being reciprocal. A draft locale it names is\n * left out; a key the registry does not declare throws.\n *\n * ```ts\n * pageLocales: (pathname) => (pathname.startsWith(\"/learn/\") ? [\"en\", \"hi\"] : undefined)\n * ```\n */\n readonly pageLocales?: (pathname: string) => readonly K[] | undefined;\n}"
6643
6794
  },
6644
6795
  {
6645
6796
  "name": "IDEMPOTENT_REPLAY_HEADER",
@@ -6797,7 +6948,7 @@
6797
6948
  "name": "IdempotencyRecord",
6798
6949
  "kind": "interface",
6799
6950
  "package": "@nifrajs/middleware",
6800
- "signature": "export interface IdempotencyRecord {\n readonly status: number;\n /** Response headers, **excluding `Set-Cookie`** (cookies are session-specific - see {@link idempotency}). */\n readonly headers: ReadonlyArray<readonly [string, string]>;\n /** Response body, base64-encoded. */\n readonly body: string;\n}",
6951
+ "signature": "export interface IdempotencyRecord {\n readonly status: number;\n /** Response headers, **excluding `Set-Cookie`** (cookies are session-specific - see {@link idempotency}). */\n readonly headers: ReadonlyArray<readonly [string, string]>;\n /** Response body, base64-encoded. */\n readonly body: string;\n /**\n * The response came from a route this middleware's `beforeHandle` covers, so a retry is replayed\n * from there - after the route's authentication, validation and earlier guards accept it again. A\n * record without it (a route declared before `.use(idempotency())`) is replayed in `onRequest`.\n */\n readonly recheck?: boolean;\n}",
6801
6952
  "doc": "/** A captured response, replayed verbatim on a retry. Body is base64 (binary-safe + JSON-serializable). */"
6802
6953
  },
6803
6954
  {
@@ -7387,7 +7538,7 @@
7387
7538
  "name": "JobDefinition",
7388
7539
  "kind": "interface",
7389
7540
  "package": "@nifrajs/jobs",
7390
- "signature": "export interface JobDefinition<Payload> {\n readonly handler: JobHandler<Payload>;\n /** Optional Standard Schema - validates the payload at `enqueue` (the trust boundary); a failure throws. */\n readonly input?: StandardSchemaV1<Payload>;\n /** `number` is shorthand for `{ attempts }`. */\n readonly retries?: number | RetryPolicy;\n /**\n * Fail an attempt that has not settled after this many ms: it is retried or dead-lettered like a\n * throw, its worker slot frees, and `ctx.signal` aborts. A handler that ignores the signal keeps\n * running unobserved. Keep it below the worker's `leaseMs`, after which the job can be leased again.\n */\n readonly timeoutMs?: number;\n}",
7541
+ "signature": "export interface JobDefinition<Payload> {\n readonly handler: JobHandler<Payload>;\n /** Optional Standard Schema - validates the payload at `enqueue` (the trust boundary); a failure throws. */\n readonly input?: StandardSchemaV1<Payload>;\n /** `number` is shorthand for `{ attempts }`. */\n readonly retries?: number | RetryPolicy;\n /**\n * Fail an attempt that has not settled after this many ms: it is retried or dead-lettered like a\n * throw, its worker slot frees, and `ctx.signal` aborts. A handler that ignores the signal keeps\n * running unobserved. It must be below the worker's `leaseMs`: `start()` throws otherwise.\n */\n readonly timeoutMs?: number;\n}",
7391
7542
  "doc": "/** A job definition registered on a queue. */"
7392
7543
  },
7393
7544
  {
@@ -7436,7 +7587,7 @@
7436
7587
  "name": "JobStore",
7437
7588
  "kind": "interface",
7438
7589
  "package": "@nifrajs/jobs",
7439
- "signature": "export interface JobStore {\n /** Persist a new job; return its id. Hand `traceparent` back on {@link StoredJob} when present. */\n enqueue(job: {\n name: string;\n payload: unknown;\n runAt: number;\n maxAttempts: number;\n traceparent?: string;\n }): string | Promise<string>;\n /** Atomically claim up to `limit` jobs due at/before `now`, hiding them for `leaseMs`. */\n lease(now: number, limit: number, leaseMs: number): StoredJob[] | Promise<StoredJob[]>;\n /** A job finished successfully - remove it. */\n complete(id: string): void | Promise<void>;\n /** A job failed but has attempts left - bump its attempt count and reschedule for `runAt`. */\n retry(id: string, runAt: number): void | Promise<void>;\n /** A job exhausted its attempts - move it to the dead-letter set with the last error. */\n deadLetter(id: string, error: string): void | Promise<void>;\n /** Snapshot counts (observability + tests). */\n counts(): JobCounts | Promise<JobCounts>;\n}",
7590
+ "signature": "export interface JobStore {\n /** Persist a new job; return its id. Hand `traceparent` back on {@link StoredJob} when present. */\n enqueue(job: {\n name: string;\n payload: unknown;\n runAt: number;\n maxAttempts: number;\n traceparent?: string;\n }): string | Promise<string>;\n /** Atomically claim up to `limit` jobs due at/before `now`, hiding them for `leaseMs`. */\n lease(now: number, limit: number, leaseMs: number): StoredJob[] | Promise<StoredJob[]>;\n /** A job finished successfully - remove it. `lease` is the {@link StoredJob.lease} it ran under:\n * a store that issues tokens ignores a call whose token is no longer the job's current one. */\n complete(id: string, lease?: string): void | Promise<void>;\n /** A job failed but has attempts left - bump its attempt count and reschedule for `runAt`. */\n retry(id: string, runAt: number, lease?: string): void | Promise<void>;\n /** A job exhausted its attempts - move it to the dead-letter set with the last error. */\n deadLetter(id: string, error: string, lease?: string): void | Promise<void>;\n /**\n * Optional: keep a leased job hidden until `until`. The queue calls it about three times per\n * `leaseMs` while the handler runs, so a long job is not leased again mid-run. Without it a job\n * that outruns `leaseMs` can be delivered to another worker while the first still runs.\n */\n renew?(id: string, until: number, lease?: string): void | Promise<void>;\n /** Snapshot counts (observability + tests). */\n counts(): JobCounts | Promise<JobCounts>;\n}",
7440
7591
  "doc": "/**\n * Persistence + leasing for the queue. The default {@link MemoryJobStore} is single-process (dev / a\n * single long-running server); implement this over Redis/Postgres/etc. for durability or multiple\n * workers. All methods may be sync or async - the queue awaits them.\n */"
7441
7592
  },
7442
7593
  {
@@ -7561,7 +7712,7 @@
7561
7712
  "name": "JwksOptions",
7562
7713
  "kind": "interface",
7563
7714
  "package": "@nifrajs/middleware",
7564
- "signature": "export interface JwksOptions {\n readonly url: string | URL;\n readonly fetch?: typeof fetch;\n readonly cacheMs?: number;\n /**\n * Extra time to keep using the last successful key set past `cacheMs`. Inside it a request is\n * answered from that set at once while one refresh runs behind it, so a slow or failing identity\n * provider holds no request. Defaults to one cache window; set `0` to wait for every refresh and\n * fail closed on refresh errors.\n */\n readonly staleMs?: number;\n readonly timeoutMs?: number;\n readonly maxBytes?: number;\n /**\n * Least time (ms) between the refreshes a token with a `kid` the cached set lacks may start, so a\n * newly rotated key is picked up without made-up `kid`s turning every request into a fetch.\n * Default 30 s.\n */\n readonly cooldownMs?: number;\n}"
7715
+ "signature": "export interface JwksOptions {\n readonly url: string | URL;\n readonly fetch?: typeof fetch;\n readonly cacheMs?: number;\n /**\n * Extra time to keep using the last successful key set past `cacheMs`. Inside it a request is\n * answered from that set at once while one refresh runs behind it, so a slow or failing identity\n * provider holds no request. Defaults to one cache window; set `0` to wait for every refresh and\n * fail closed on refresh errors.\n */\n readonly staleMs?: number;\n readonly timeoutMs?: number;\n readonly maxBytes?: number;\n /**\n * Least time (ms) between the refreshes a token with a `kid` the cached set lacks may start, so a\n * newly rotated key is picked up without made-up `kid`s turning every request into a fetch.\n * Default 30 s.\n */\n readonly cooldownMs?: number;\n /**\n * Least time (ms) between fetches after one that failed or returned no keys. Inside it a request\n * that needs the set gets that outcome again at once (the same error, or no key) instead of\n * waiting up to `timeoutMs` on a fetch of its own, so an identity provider outage does not hold\n * every request. Default 5 s; `0` fetches again for every such request.\n */\n readonly failureCooldownMs?: number;\n}"
7565
7716
  },
7566
7717
  {
7567
7718
  "name": "JwtAlgorithm",
@@ -7653,6 +7804,13 @@
7653
7804
  "signature": "export declare const LAYOUT_DATA_GLOBAL = \"__NIFRA_LAYOUT_DATA__\";",
7654
7805
  "doc": "/** Per-layout loader data for hydration. */"
7655
7806
  },
7807
+ {
7808
+ "name": "LOCALES_GLOBAL",
7809
+ "kind": "const",
7810
+ "package": "@nifrajs/web",
7811
+ "signature": "export declare const LOCALES_GLOBAL = \"__NIFRA_LOCALES__\";",
7812
+ "doc": "/** The handover global carrying {@link PageLocales}. */"
7813
+ },
7656
7814
  {
7657
7815
  "name": "LOCAL_PROCESS_LIMITATION",
7658
7816
  "kind": "const",
@@ -7790,7 +7948,7 @@
7790
7948
  "name": "LeakGuardPlugin",
7791
7949
  "kind": "interface",
7792
7950
  "package": "@nifrajs/web",
7793
- "signature": "export interface LeakGuardPlugin {\n readonly name: string;\n /**\n * The finding that failed the build, or `undefined` when the bundle was clean.\n *\n * Recorded as well as thrown because the throw does not reliably survive. A plugin error is handed to\n * the bundler, which builds its own error to report it, and on some Bun + rolldown combinations that\n * construction itself fails (`Error.captureStackTrace` rejecting a non-Error) - so what surfaces is an\n * internal complaint naming neither the leaked module nor its import chain. A caller that owns the\n * build can read this afterwards and raise the real message from its own code, where nothing can\n * rewrite it. A leak is the one failure that must stay legible: the whole point is naming what\n * reached the browser.\n */\n leak?: string;\n generateBundle(this: RollupPluginContext, options: unknown, bundle: RollupBundleLike): void;\n}",
7951
+ "signature": "export interface LeakGuardPlugin {\n readonly name: string;\n /**\n * The finding that failed the build, or `undefined` when the bundle was clean.\n *\n * Recorded as well as thrown because the throw does not reliably survive. A plugin error is handed to\n * the bundler, which builds its own error to report it, and on some Bun + rolldown combinations that\n * construction itself fails (`Error.captureStackTrace` rejecting a non-Error) - so what surfaces is an\n * internal complaint naming neither the leaked module nor its import chain. A caller that owns the\n * build can read this afterwards and raise the real message from its own code, where nothing can\n * rewrite it. A leak is the one failure that must stay legible: the whole point is naming what\n * reached the browser.\n */\n leak?: string;\n buildStart(): void;\n /** Ordered first: the bundler's own resolver answers before a plugin listed after it is asked. */\n readonly resolveId: {\n readonly order: \"pre\";\n handler(this: ResolveContext, source: string, importer: string | undefined, options?: Readonly<Record<string, unknown>>): Promise<null>;\n };\n generateBundle(this: RollupPluginContext, options: unknown, bundle: RollupBundleLike): void;\n}",
7794
7952
  "doc": "/** The minimal Rollup plugin shape this returns - `generateBundle` bound to the plugin context. */"
7795
7953
  },
7796
7954
  {
@@ -7982,7 +8140,7 @@
7982
8140
  "name": "LocaleCoverage",
7983
8141
  "kind": "interface",
7984
8142
  "package": "@nifrajs/i18n",
7985
- "signature": "export interface LocaleCoverage {\n readonly locale: string;\n readonly default: boolean;\n readonly draft: boolean;\n /** Messages in the default locale's catalog. */\n readonly total: number;\n /** Of those, how many this locale's own catalog has. */\n readonly own: number;\n /** Of those, how many render in this locale's language: its own, or from a catalog earlier in its\n * `chain()` than the default. */\n readonly translated: number;\n /** `translated / total`, from 0 to 1; 1 for the default locale. */\n readonly coverage: number;\n}"
8143
+ "signature": "export interface LocaleCoverage {\n readonly locale: string;\n readonly default: boolean;\n readonly draft: boolean;\n /** Messages in the default locale's catalog. */\n readonly total: number;\n /** Of those, how many this locale's own catalog has. */\n readonly own: number;\n /** Of those, how many render in this locale's language: its own, or from a catalog earlier in its\n * `chain()` than the default. */\n readonly translated: number;\n /** `translated / total`, from 0 to 1; 1 for the default locale. */\n readonly coverage: number;\n /** For a locale that does not write in Latin: the share of the words in its messages of at least\n * `minWords` words that are Latin-script and not in `latinWords`, from 0 to 1. */\n readonly latinShare?: number;\n}"
7986
8144
  },
7987
8145
  {
7988
8146
  "name": "LocaleDetectorOptions",
@@ -8022,21 +8180,27 @@
8022
8180
  "name": "Locales",
8023
8181
  "kind": "interface",
8024
8182
  "package": "@nifrajs/i18n",
8025
- "signature": "export interface Locales<K extends string = string> {\n readonly default: K;\n /** Every declared locale, in declaration order. */\n readonly all: readonly K[];\n /** The non-draft locales, in declaration order. */\n readonly served: readonly K[];\n /** Every resolved field of a declared locale. Throws for an undeclared key. */\n get(key: K): LocaleInfo<K>;\n /** Whether `value` is a served locale's key, exactly as declared. */\n isServed(value: string): value is K;\n /** The catalog fallback order for `key`: itself, then the declared locale of its base language\n * (`fr-CA` → `fr`), then the default, without repeats. */\n chain(key: K): readonly K[];\n /** `{ lang, dir }` for a route's `meta`, so `<html lang>` and `<html dir>` follow the locale. */\n documentMeta(key: K): {\n readonly lang: string;\n readonly dir: \"ltr\" | \"rtl\";\n };\n}",
8026
- "doc": "/** The registry {@link defineLocales} returns. */"
8183
+ "signature": "export interface Locales<K extends string = string, D extends K = K> {\n readonly default: D;\n /** Every declared locale, in declaration order. */\n readonly all: readonly K[];\n /** The non-draft locales, in declaration order. */\n readonly served: readonly K[];\n /** Every resolved field of a declared locale. Throws for an undeclared key. */\n get(key: K): LocaleInfo<K>;\n /** Whether `value` is a served locale's key, exactly as declared. */\n isServed(value: string): value is K;\n /** The catalog fallback order for `key`: itself, then the declared locale of its base language\n * (`fr-CA` → `fr`), then the default, without repeats. */\n chain(key: K): readonly K[];\n /** `{ lang, dir }` for a route's `meta`, so `<html lang>` and `<html dir>` follow the locale. */\n documentMeta(key: K): {\n readonly lang: string;\n readonly dir: \"ltr\" | \"rtl\";\n };\n}",
8184
+ "doc": "/** The registry {@link defineLocales} returns. `D` is the default locale's key. */"
8027
8185
  },
8028
8186
  {
8029
8187
  "name": "LocalesConfig",
8030
8188
  "kind": "interface",
8031
8189
  "package": "@nifrajs/i18n",
8032
- "signature": "export interface LocalesConfig<K extends string> {\n /** The default locale: served, and the last step of every fallback chain. */\n readonly default: NoInfer<K>;\n /** Every locale, keyed by URL segment, in the order alternates and switchers list them. */\n readonly locales: {\n readonly [P in K]: LocaleSpec;\n };\n}",
8190
+ "signature": "export interface LocalesConfig<K extends string, D extends K = K> {\n /** The default locale: served, and the last step of every fallback chain. */\n readonly default: D;\n /** Every locale, keyed by URL segment, in the order alternates and switchers list them. */\n readonly locales: {\n readonly [P in K]: LocaleSpec;\n };\n}",
8033
8191
  "doc": "/** What {@link defineLocales} takes. */"
8034
8192
  },
8193
+ {
8194
+ "name": "LocalizeOptions",
8195
+ "kind": "interface",
8196
+ "package": "@nifrajs/i18n",
8197
+ "signature": "export interface LocalizeOptions {\n /** `\"default\"`: when the page does not exist in the locale (`pageLocales`), return the default\n * locale's path instead, for a menu that mixes translated pages with untranslated ones. */\n readonly fallback?: \"default\";\n}"
8198
+ },
8035
8199
  {
8036
8200
  "name": "LocalizedRouter",
8037
8201
  "kind": "interface",
8038
8202
  "package": "@nifrajs/i18n",
8039
- "signature": "export interface LocalizedRouter<K extends string = string> {\n /** The registry this router reads. */\n readonly locales: Locales<K>;\n /** Prefix `path` with `locale` (`/about` → `/fr/about`), unless it is the unprefixed default.\n * The query and trailing slash ride along, the hash too; an already-prefixed path is re-prefixed.\n * A locale that is not served throws. */\n localizePathname(path: string, locale: K): string;\n /** Strip a served locale prefix (`/fr/about` → `{ locale: \"fr\", pathname: \"/about\" }`). Anything\n * else - `/frank`, a draft's prefix - returns `{ locale: undefined }` with the path unchanged. */\n unlocalizePathname(path: string): UnlocalizedPath<K>;\n /** The served locale a path's first segment names, or `undefined` when unprefixed. */\n getPathLocale(path: string): K | undefined;\n /** The locale a path is in: its prefix, or the default for an unprefixed path. */\n localeOf(path: string): K;\n /** The page's canonical URL and its `hreflang` alternates. `path` may carry any served prefix or\n * none (it decides the canonical's locale); its query is kept and its hash dropped. */\n alternates(path: string, options?: AlternatesOptions<K>): Alternates;\n /**\n * Check the value of a `[lang]` / `[[lang]]` route segment that is the path's first segment.\n * `pathname` is the request's path (query allowed), used to build a redirect.\n *\n * ```ts\n * // routes/[lang]/_layout.backend.ts\n * import { notFound, type RouteMiddleware, redirect } from \"@nifrajs/web\"\n * import { urls } from \"../../shared/i18n\"\n *\n * export const middleware: RouteMiddleware = (ctx) => {\n * const { pathname, search } = new URL(ctx.request.url)\n * const match = urls.matchSegment(ctx.params.lang, pathname + search)\n * if (match.kind === \"not-found\") notFound()\n * if (match.kind === \"redirect\") return redirect(match.location, { status: 308 })\n * }\n * ```\n */\n matchSegment(value: string | undefined, pathname: string): SegmentMatch<K>;\n}"
8203
+ "signature": "export interface LocalizedRouter<K extends string = string> {\n /** The registry this router reads. */\n readonly locales: Locales<K>;\n /** Prefix `path` with `locale` (`/about` → `/fr/about`), unless it is the unprefixed default.\n * The query and trailing slash ride along, the hash too; an already-prefixed path is re-prefixed.\n * A locale that is not served throws. */\n localizePathname(path: string, locale: K, options?: LocalizeOptions): string;\n /** Strip a served locale prefix (`/fr/about` → `{ locale: \"fr\", pathname: \"/about\" }`). Anything\n * else - `/frank`, a draft's prefix - returns `{ locale: undefined }` with the path unchanged. */\n unlocalizePathname(path: string): UnlocalizedPath<K>;\n /** The served locale a path's first segment names, or `undefined` when unprefixed. */\n getPathLocale(path: string): K | undefined;\n /** The locale a path is in: its prefix, or the default for an unprefixed path. */\n localeOf(path: string): K;\n /** The served locales the page at `path` exists in (any prefix, or none), in registry order: what\n * `pageLocales` says, or every served locale. Also a prerender's static paths. */\n localesOf(path: string): readonly K[];\n /** The page's canonical URL and its `hreflang` alternates, one per locale the page exists in\n * (`pageLocales`, unless `options.locales` names them). `path` may carry any served prefix or none\n * (it decides the canonical's locale); its query is kept and its hash dropped. A page in one locale\n * only, or in none, has no alternates. */\n alternates(path: string, options?: AlternatesOptions<K>): Alternates;\n /**\n * Check the value of a `[lang]` / `[[lang]]` route segment that is the path's first segment.\n * `pathname` is the request's path (query allowed), used to build a redirect. A page that does not\n * exist in the locale (`pageLocales`) is not found.\n *\n * ```ts\n * // routes/[lang]/_layout.backend.ts\n * import { notFound, type RouteMiddleware, redirect } from \"@nifrajs/web\"\n * import { urls } from \"../../shared/i18n\"\n *\n * export const middleware: RouteMiddleware = (ctx) => {\n * const { pathname, search } = new URL(ctx.request.url)\n * const match = urls.matchSegment(ctx.params.lang, pathname + search)\n * if (match.kind === \"not-found\") notFound()\n * if (match.kind === \"redirect\") return redirect(match.location, { status: 308 })\n * }\n * ```\n */\n matchSegment(value: string | undefined, pathname: string): SegmentMatch<K>;\n}"
8040
8204
  },
8041
8205
  {
8042
8206
  "name": "Location",
@@ -8142,14 +8306,14 @@
8142
8306
  "kind": "const",
8143
8307
  "package": "create-nifra",
8144
8308
  "signature": "export declare const MCP_CLI_VERSION: string;",
8145
- "doc": "/**\n * The `@nifrajs/cli` version the launch command pins to - DERIVED at load time from this package's own\n * `version`, never hardcoded. `fixed` changeset versioning ([[\"@nifrajs/*\", \"create-nifra\", \"nifra\"]] in\n * `.changeset/config.json`) bumps `create-nifra` and `@nifrajs/cli` in lockstep, so `create-nifra@x`\n * always means `@nifrajs/cli@x`. Deriving it here means a release bump has nothing to forget to update -\n * there is no stale literal to drift (the 1.0.0 cut shipped a beta pin exactly this way). `check:publish`\n * still asserts it equals `@nifrajs/cli`'s version as a belt-and-suspenders guard on the `fixed` link.\n *\n * Resolves correctly under BOTH export conditions: the `bun` export runs `src/agent-files.ts`\n * (`../package.json` → the package root) and the tsc `default` export runs `dist/agent-files.js`\n * (`../package.json` → the same root, since `dist/` sits beside the manifest). npm always ships a\n * package's own `package.json`, so the read can't miss at install time.\n *\n * Why pin at all instead of `bunx @nifrajs/cli mcp`: `bunx` keys its cache on the exact version spec.\n * An UNPINNED spec resolves to the `latest` tag once, then `bunx` reuses that cached copy on every\n * later spawn WITHOUT re-checking the registry - so an editor that once launched an older `@nifrajs/cli`\n * keeps respawning the stale binary even after a newer one is published (the MCP server silently runs\n * old code). Pinning the exact version makes the version part of the cache key, so each release fetches\n * fresh and a stale cache can never shadow it. The cost: an already-scaffolded app's `.mcp.json` freezes\n * at its scaffold-time version until `nifra init-agents --sync-mcp` re-pins it to the nifra the project\n * installs - an acceptable, deterministic trade.\n */"
8309
+ "doc": "/**\n * The `@nifrajs/cli` version the launch command pins to - DERIVED at load time from this package's own\n * `version`, never hardcoded. `fixed` changeset versioning ([[\"@nifrajs/*\", \"create-nifra\", \"nifra\"]] in\n * `.changeset/config.json`) bumps `create-nifra` and `@nifrajs/cli` in lockstep, so `create-nifra@x`\n * always means `@nifrajs/cli@x`. Deriving it here means a release bump has nothing to forget to update -\n * there is no stale literal to drift (the 1.0.0 cut shipped a beta pin exactly this way). `check:publish`\n * still asserts it equals `@nifrajs/cli`'s version as a belt-and-suspenders guard on the `fixed` link.\n *\n * Resolves correctly under BOTH export conditions: the `bun` export runs `src/agent-files.ts`\n * (`../package.json` → the package root) and the tsc `default` export runs `dist/agent-files.js`\n * (`../package.json` → the same root, since `dist/` sits beside the manifest). npm always ships a\n * package's own `package.json`, so the read can't miss at install time.\n *\n * Two launch forms. A project that declares `@nifrajs/cli` gets the unpinned\n * `bunx @nifrajs/cli mcp` ({@link MCP_SERVER_ARGS_INSTALLED}): `bunx` runs the copy the project installs\n * (its `node_modules`, or an ancestor's) whenever there is one, so an upgrade moves the server with it\n * and nothing needs re-pinning. A pinned spec never does that, not even at the installed version: it\n * always runs a registry copy. Every scaffold declares the CLI, so every scaffold is unpinned.\n *\n * A project that does not declare it keeps the pin ({@link MCP_SERVER_ARGS}): with no local install an\n * unpinned spec resolves `latest` once and `bunx` reuses that cached copy on every later spawn without\n * re-checking the registry, so the server would silently run old code. The exact version is part of the\n * cache key, so each release fetches fresh; `nifra init-agents --sync-mcp` moves it to the installed\n * nifra, or unpins it once the project declares the CLI.\n */"
8146
8310
  },
8147
8311
  {
8148
8312
  "name": "MCP_CONFIG",
8149
8313
  "kind": "const",
8150
8314
  "package": "create-nifra",
8151
8315
  "signature": "export declare const MCP_CONFIG: McpConfig;",
8152
- "doc": "/** The one canonical MCP config object both registries serialize - the anti-drift seam. */"
8316
+ "doc": "/** The config a scaffold writes: every scaffold declares the CLI, so its launch is unpinned. */"
8153
8317
  },
8154
8318
  {
8155
8319
  "name": "MCP_ERROR",
@@ -8171,6 +8335,13 @@
8171
8335
  "package": "create-nifra",
8172
8336
  "signature": "export declare const MCP_SERVER_ARGS: readonly [`@nifrajs/cli@${string}`, \"mcp\"];"
8173
8337
  },
8338
+ {
8339
+ "name": "MCP_SERVER_ARGS_INSTALLED",
8340
+ "kind": "const",
8341
+ "package": "create-nifra",
8342
+ "signature": "export declare const MCP_SERVER_ARGS_INSTALLED: readonly [\"@nifrajs/cli\", \"mcp\"];",
8343
+ "doc": "/** The launch args for a project that declares `@nifrajs/cli`: unpinned, so `bunx` runs its install. */"
8344
+ },
8174
8345
  {
8175
8346
  "name": "MCP_SERVER_COMMAND",
8176
8347
  "kind": "const",
@@ -8320,13 +8491,13 @@
8320
8491
  "name": "McpHttpOptions",
8321
8492
  "kind": "interface",
8322
8493
  "package": "@nifrajs/cli",
8323
- "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Maximum serialized JSON-RPC response or SSE frame size. Default 1 MB. */\n readonly maxResponseBytes?: number;\n /**\n * Maximum bytes an SSE stream queues for a client that is not reading. Past it the stream is\n * dropped and the tool call it carries is cancelled. Default 4 MiB.\n */\n readonly maxPendingBytes?: number | undefined;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /** Explicitly expose a secret-free, unauthenticated server to browser clients from any origin. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. When set, only exact origins are accepted. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Host allowlist - the DNS-rebinding guard for a server on localhost or a private network. A rebound\n * page reaches the server under the attacker's hostname with a matching Origin, so the Origin check\n * alone cannot stop it. Entries are `host[:port]`; without a port they match any port. Every request,\n * with or without an Origin, whose Host is not listed gets 403. Example: `[\"localhost\", \"127.0.0.1\"]`.\n */\n readonly allowedHosts?: readonly string[];\n /**\n * Shared request registry for one authenticated MCP session. Pass the same state to the\n * request that starts a tool call and its `notifications/cancelled` request. Do not share one\n * state across unrelated callers unless the surrounding authorization boundary makes their\n * request-id namespace exclusive.\n */\n readonly state?: McpProtocolState;\n /**\n * Resolve a session-scoped request registry after authorization. This is the preferred seam for\n * multi-user HTTP hosts: bind the returned state to the authenticated caller/session and return\n * `undefined` for stateless requests. A resolver failure fails closed with a generic denial.\n */\n readonly resolveState?: (request: Request, message: JsonRpcRequest) => McpProtocolState | undefined | Promise<McpProtocolState | undefined>;\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
8494
+ "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Maximum serialized JSON-RPC response or SSE frame size. Default 1 MB. */\n readonly maxResponseBytes?: number;\n /**\n * Maximum bytes an SSE stream queues for a client that is not reading. Past it the stream is\n * dropped and the tool call it carries is cancelled. Default 4 MiB.\n */\n readonly maxPendingBytes?: number | undefined;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /** Explicitly expose a secret-free, unauthenticated server to browser clients from any origin. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. When set, only exact origins are accepted. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Host allowlist - the DNS-rebinding guard for a server on localhost or a private network. A rebound\n * page reaches the server under the attacker's hostname with a matching Origin, so the Origin check\n * alone cannot stop it. Entries are `host[:port]`; without a port they match any port. Every request,\n * with or without an Origin, whose Host is not listed gets 403. Example: `[\"localhost\", \"127.0.0.1\"]`.\n */\n readonly allowedHosts?: readonly string[];\n /**\n * Shared request registry for one authenticated MCP session. Pass the same state to the\n * request that starts a tool call and its `notifications/cancelled` request. Do not share one\n * state across unrelated callers unless the surrounding authorization boundary makes their\n * request-id namespace exclusive.\n */\n readonly state?: McpProtocolState;\n /**\n * Resolve a session-scoped request registry after authorization. This is the preferred seam for\n * multi-user HTTP hosts: bind the returned state to the authenticated caller/session and return\n * `undefined` for stateless requests. A resolver failure fails closed with a generic denial.\n */\n readonly resolveState?: (request: Request, message: JsonRpcRequest) => McpProtocolState | undefined | Promise<McpProtocolState | undefined>;\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n * A GET for the server-message stream carries no message to authorize, so with this set it is\n * answered `405` (no stream offered) instead.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
8324
8495
  },
8325
8496
  {
8326
8497
  "name": "McpHttpOptions",
8327
8498
  "kind": "interface",
8328
8499
  "package": "@nifrajs/mcp",
8329
- "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Maximum serialized JSON-RPC response or SSE frame size. Default 1 MB. */\n readonly maxResponseBytes?: number;\n /**\n * Maximum bytes an SSE stream queues for a client that is not reading. Past it the stream is\n * dropped and the tool call it carries is cancelled. Default 4 MiB.\n */\n readonly maxPendingBytes?: number | undefined;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /** Explicitly expose a secret-free, unauthenticated server to browser clients from any origin. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. When set, only exact origins are accepted. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Host allowlist - the DNS-rebinding guard for a server on localhost or a private network. A rebound\n * page reaches the server under the attacker's hostname with a matching Origin, so the Origin check\n * alone cannot stop it. Entries are `host[:port]`; without a port they match any port. Every request,\n * with or without an Origin, whose Host is not listed gets 403. Example: `[\"localhost\", \"127.0.0.1\"]`.\n */\n readonly allowedHosts?: readonly string[];\n /**\n * Shared request registry for one authenticated MCP session. Pass the same state to the\n * request that starts a tool call and its `notifications/cancelled` request. Do not share one\n * state across unrelated callers unless the surrounding authorization boundary makes their\n * request-id namespace exclusive.\n */\n readonly state?: McpProtocolState;\n /**\n * Resolve a session-scoped request registry after authorization. This is the preferred seam for\n * multi-user HTTP hosts: bind the returned state to the authenticated caller/session and return\n * `undefined` for stateless requests. A resolver failure fails closed with a generic denial.\n */\n readonly resolveState?: (request: Request, message: JsonRpcRequest) => McpProtocolState | undefined | Promise<McpProtocolState | undefined>;\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
8500
+ "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Maximum serialized JSON-RPC response or SSE frame size. Default 1 MB. */\n readonly maxResponseBytes?: number;\n /**\n * Maximum bytes an SSE stream queues for a client that is not reading. Past it the stream is\n * dropped and the tool call it carries is cancelled. Default 4 MiB.\n */\n readonly maxPendingBytes?: number | undefined;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /** Explicitly expose a secret-free, unauthenticated server to browser clients from any origin. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. When set, only exact origins are accepted. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Host allowlist - the DNS-rebinding guard for a server on localhost or a private network. A rebound\n * page reaches the server under the attacker's hostname with a matching Origin, so the Origin check\n * alone cannot stop it. Entries are `host[:port]`; without a port they match any port. Every request,\n * with or without an Origin, whose Host is not listed gets 403. Example: `[\"localhost\", \"127.0.0.1\"]`.\n */\n readonly allowedHosts?: readonly string[];\n /**\n * Shared request registry for one authenticated MCP session. Pass the same state to the\n * request that starts a tool call and its `notifications/cancelled` request. Do not share one\n * state across unrelated callers unless the surrounding authorization boundary makes their\n * request-id namespace exclusive.\n */\n readonly state?: McpProtocolState;\n /**\n * Resolve a session-scoped request registry after authorization. This is the preferred seam for\n * multi-user HTTP hosts: bind the returned state to the authenticated caller/session and return\n * `undefined` for stateless requests. A resolver failure fails closed with a generic denial.\n */\n readonly resolveState?: (request: Request, message: JsonRpcRequest) => McpProtocolState | undefined | Promise<McpProtocolState | undefined>;\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n * A GET for the server-message stream carries no message to authorize, so with this set it is\n * answered `405` (no stream offered) instead.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
8330
8501
  },
8331
8502
  {
8332
8503
  "name": "McpPrompt",
@@ -8601,7 +8772,7 @@
8601
8772
  "name": "MemoryJobStore",
8602
8773
  "kind": "class",
8603
8774
  "package": "@nifrajs/jobs",
8604
- "signature": "export declare class MemoryJobStore implements JobStore {\n private readonly jobs;\n private readonly dead;\n private seq;\n private readonly idFor;\n constructor(options?: {\n idFor?: () => string;\n });\n enqueue(job: {\n name: string;\n payload: unknown;\n runAt: number;\n maxAttempts: number;\n traceparent?: string;\n }): string;\n lease(now: number, limit: number, leaseMs: number): StoredJob[];\n complete(id: string): void;\n retry(id: string, runAt: number): void;\n deadLetter(id: string, error: string): void;\n counts(now?: number): JobCounts;\n /** The dead-letter queue - inspect/requeue failed jobs (not part of the {@link JobStore} contract). */\n deadLetters(): DeadRecord[];\n}",
8775
+ "signature": "export declare class MemoryJobStore implements JobStore {\n private readonly jobs;\n private readonly dead;\n private seq;\n private leaseSeq;\n private readonly idFor;\n constructor(options?: {\n idFor?: () => string;\n });\n enqueue(job: {\n name: string;\n payload: unknown;\n runAt: number;\n maxAttempts: number;\n traceparent?: string;\n }): string;\n lease(now: number, limit: number, leaseMs: number): StoredJob[];\n /** The job, when a call made under `lease` may still act on it (no token: any caller may). */\n private held;\n complete(id: string, lease?: string): void;\n retry(id: string, runAt: number, lease?: string): void;\n deadLetter(id: string, error: string, lease?: string): void;\n renew(id: string, until: number, lease?: string): void;\n counts(now?: number): JobCounts;\n /** The dead-letter queue - inspect/requeue failed jobs (not part of the {@link JobStore} contract). */\n deadLetters(): DeadRecord[];\n}",
8605
8776
  "doc": "/** Construct an in-memory job store. `idFor` is injectable for deterministic tests. */"
8606
8777
  },
8607
8778
  {
@@ -8997,13 +9168,13 @@
8997
9168
  "name": "MountAgUIOptions",
8998
9169
  "kind": "interface",
8999
9170
  "package": "@nifrajs/ag-ui",
9000
- "signature": "export interface MountAgUIOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n /** Endpoint path. Default `/agui`. */\n readonly path?: string;\n /** Bounded run length passed to the runner. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Maximum total UTF-8 bytes emitted by one SSE response. Default 4 MiB. */\n readonly maxOutputBytes?: number;\n /**\n * Build the ports for one request - the model, durable state store, approval transport,\n * capabilities, and budgets. Receives the route context so the caller can scope every port to\n * the request subject, and the run context carrying the turn id and the shared UI state channel.\n */\n readonly ports: (c: AgUIRouteContext, run: AgUIRunContext) => AgentPorts | Promise<AgentPorts>;\n /**\n * Evidence log making the SSE stream resumable via `Last-Event-ID`. The in-memory reference\n * (`createMemoryAgentEvidenceLog`) is single-process; a durable log is an adapter concern.\n */\n readonly evidenceLog?: AgentEvidenceLog;\n /**\n * Who a turn's recorded events belong to - the caller's user or tenant id. Turns are recorded and\n * replayed under it, so a reconnect or a reused run id from another caller finds nothing of this\n * caller's turns. It runs before a replay is served; throw to refuse the request.\n */\n readonly evidenceOwner?: (c: AgUIRouteContext) => string | Promise<string>;\n /**\n * Emit a `MESSAGES_SNAPSHOT` (the request's `messages` plus the assistant output message)\n * before `RUN_FINISHED` on a successful completion. Default `false`: the snapshot echoes\n * client-sent message payloads, and terminal events are persisted to the evidence log when one\n * is configured - leave it off unless the client relies on an authoritative snapshot.\n */\n readonly emitMessagesSnapshot?: boolean;\n}"
9171
+ "signature": "export interface MountAgUIOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n /** Endpoint path. Default `/agui`. */\n readonly path?: string;\n /** Bounded run length passed to the runner. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Maximum total UTF-8 bytes emitted by one SSE response. Default 4 MiB. */\n readonly maxOutputBytes?: number;\n /**\n * Build the ports for one request - the model, durable state store, approval transport,\n * capabilities, and budgets. Receives the route context so the caller can scope every port to\n * the request subject, and the run context carrying the turn id and the shared UI state channel.\n * Throw a `Response` (a 401 with its challenge, a 403) to answer the request with it; any other\n * throw is a fault and reaches the app's error handling.\n */\n readonly ports: (c: AgUIRouteContext, run: AgUIRunContext) => AgentPorts | Promise<AgentPorts>;\n /**\n * Evidence log making the SSE stream resumable via `Last-Event-ID`. The in-memory reference\n * (`createMemoryAgentEvidenceLog`) is single-process; a durable log is an adapter concern.\n */\n readonly evidenceLog?: AgentEvidenceLog;\n /**\n * Who a turn's recorded events belong to - the caller's user or tenant id. Turns are recorded and\n * replayed under it, so a reconnect or a reused run id from another caller finds nothing of this\n * caller's turns. It runs before a replay is served; throw to refuse the request with\n * `403 { error: \"forbidden\" }`, or throw a `Response` to answer with it instead.\n */\n readonly evidenceOwner?: (c: AgUIRouteContext) => string | Promise<string>;\n /**\n * Emit a `MESSAGES_SNAPSHOT` (the request's `messages` plus the assistant output message)\n * before `RUN_FINISHED` on a successful completion. Default `false`: the snapshot echoes\n * client-sent message payloads, and terminal events are persisted to the evidence log when one\n * is configured - leave it off unless the client relies on an authoritative snapshot.\n */\n readonly emitMessagesSnapshot?: boolean;\n}"
9001
9172
  },
9002
9173
  {
9003
9174
  "name": "MountAgentOptions",
9004
9175
  "kind": "interface",
9005
9176
  "package": "@nifrajs/agent",
9006
- "signature": "export interface MountAgentOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n /** Endpoint path. Default `/agent`. */\n readonly path?: string;\n /** Bounded run length passed to {@link runAgent}. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /**\n * Maximum total UTF-8 bytes one SSE response emits. Default 4 MiB. Past it the response ends with an\n * `error` frame (`output_limit`); with an `evidenceLog` the run keeps recording and a reconnect with\n * `Last-Event-ID` reads on from where this response stopped, otherwise the run is cancelled.\n */\n readonly maxOutputBytes?: number;\n /**\n * Build the ports for one request - the model, durable state store, approval transport, capabilities,\n * and budgets. Receives the route context so the caller can scope every port to the request subject.\n */\n readonly ports: (c: AgentRouteContext) => AgentPorts | Promise<AgentPorts>;\n /**\n * Evidence log making the SSE stream resumable via `Last-Event-ID`. The in-memory reference\n * (`createMemoryAgentEvidenceLog`) is single-process; a durable log is an adapter concern.\n */\n readonly evidenceLog?: AgentEvidenceLog;\n /**\n * Who a turn's recorded evidence belongs to - the caller's user or tenant id. Turns are recorded and\n * replayed under it, so a reconnect or a reused `turnId` from another caller finds nothing of this\n * caller's turns. It runs before a replay is served; throw to refuse the request.\n */\n readonly evidenceOwner?: (c: AgentRouteContext) => string | Promise<string>;\n}"
9177
+ "signature": "export interface MountAgentOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n /** Endpoint path. Default `/agent`. */\n readonly path?: string;\n /** Bounded run length passed to {@link runAgent}. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /**\n * Maximum total UTF-8 bytes one SSE response emits. Default 4 MiB. Past it the response ends with an\n * `error` frame (`output_limit`); with an `evidenceLog` the run keeps recording and a reconnect with\n * `Last-Event-ID` reads on from where this response stopped, otherwise the run is cancelled.\n */\n readonly maxOutputBytes?: number;\n /**\n * Build the ports for one request - the model, durable state store, approval transport, capabilities,\n * and budgets. Receives the route context so the caller can scope every port to the request subject.\n * Throw a `Response` (a 401 with its challenge, a 403) to answer the request with it; any other throw\n * is a fault and reaches the app's error handling.\n */\n readonly ports: (c: AgentRouteContext) => AgentPorts | Promise<AgentPorts>;\n /**\n * Evidence log making the SSE stream resumable via `Last-Event-ID`. The in-memory reference\n * (`createMemoryAgentEvidenceLog`) is single-process; a durable log is an adapter concern.\n */\n readonly evidenceLog?: AgentEvidenceLog;\n /**\n * Who a turn's recorded evidence belongs to - the caller's user or tenant id. Turns are recorded and\n * replayed under it, so a reconnect or a reused `turnId` from another caller finds nothing of this\n * caller's turns. It runs before a replay is served; throw to refuse the request with\n * `403 { error: \"forbidden\" }`, or throw a `Response` to answer with it instead.\n */\n readonly evidenceOwner?: (c: AgentRouteContext) => string | Promise<string>;\n}"
9007
9178
  },
9008
9179
  {
9009
9180
  "name": "MountFetchOptions",
@@ -9471,7 +9642,7 @@
9471
9642
  "name": "NifraBackendOptions",
9472
9643
  "kind": "interface",
9473
9644
  "package": "@nifrajs/coding-agent",
9474
- "signature": "export interface NifraBackendOptions {\n readonly model: NativeModelPort;\n readonly tools?: readonly NativeTool[];\n readonly approval?: NativeApprovalPort;\n /** Maximum time a protocol-visible native approval may remain unresolved. */\n readonly approvalTimeoutMs?: number;\n readonly maxSteps?: number;\n /** Longest message `send` accepts (default 64 KiB). */\n readonly maxMessageChars?: number;\n /**\n * Longest reply the model may give in one turn (default 1 MiB); past it the reply is cut with\n * a marker. A reply longer than one event's text travels as consecutive `assistant.message`\n * events, and the model's history keeps it whole.\n */\n readonly maxReplyChars?: number;\n /**\n * Character budget for the conversation a session sends to the model (default 1 MiB). Past it,\n * whole earlier turns are dropped, oldest first; the current turn is always sent in full.\n */\n readonly maxHistoryChars?: number;\n readonly now?: () => number;\n}"
9645
+ "signature": "export interface NifraBackendOptions {\n readonly model: NativeModelPort;\n readonly tools?: readonly NativeTool[];\n readonly approval?: NativeApprovalPort;\n /**\n * Maximum time a protocol-visible native approval may remain unresolved (default 5 minutes, at\n * most 24 h). `\"never\"` removes the timer: the approval waits for an answer, a cancel, the end of\n * its turn, or session close.\n */\n readonly approvalTimeoutMs?: ApprovalTimeout;\n readonly maxSteps?: number;\n /** Longest message `send` accepts (default 64 KiB). */\n readonly maxMessageChars?: number;\n /**\n * Longest reply the model may give in one turn (default 1 MiB); past it the reply is cut with\n * a marker. A reply longer than one event's text travels as consecutive `assistant.message`\n * events, and the model's history keeps it whole.\n */\n readonly maxReplyChars?: number;\n /**\n * Character budget for the conversation a session sends to the model (default 1 MiB). Past it,\n * whole earlier turns are dropped, oldest first; the current turn is always sent in full.\n */\n readonly maxHistoryChars?: number;\n readonly now?: () => number;\n}"
9475
9646
  },
9476
9647
  {
9477
9648
  "name": "NifraContextLike",
@@ -9968,7 +10139,7 @@
9968
10139
  "name": "OpenApiUiOptions",
9969
10140
  "kind": "interface",
9970
10141
  "package": "@nifrajs/middleware",
9971
- "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 /** The Scalar script URL (loaded from a CDN). Default jsDelivr's `@scalar/api-reference`. */\n readonly cdn?: string;\n}",
10142
+ "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}",
9972
10143
  "doc": "/** Scalar API-reference UI options. */"
9973
10144
  },
9974
10145
  {
@@ -10175,6 +10346,20 @@
10175
10346
  "signature": "export interface Page<Item> {\n readonly items: Item[];\n readonly nextCursor: string | null;\n}",
10176
10347
  "doc": "/** A cursor-pagination page - matches the shape of `t.paginated(item)`. */"
10177
10348
  },
10349
+ {
10350
+ "name": "PageLocale",
10351
+ "kind": "interface",
10352
+ "package": "@nifrajs/web",
10353
+ "signature": "export interface PageLocale {\n /** The registry key, which is also the URL segment (`ur`). */\n readonly key: string;\n /** The BCP-47 tag `<html lang>` and `Content-Language` carry (`ur-PK`). */\n readonly lang: string;\n readonly dir: \"ltr\" | \"rtl\";\n}",
10354
+ "doc": "/** A served locale as a page renders in it: from the app's locale registry. */"
10355
+ },
10356
+ {
10357
+ "name": "PageLocales",
10358
+ "kind": "interface",
10359
+ "package": "@nifrajs/web",
10360
+ "signature": "export interface PageLocales {\n /** The default locale's key. */\n readonly default: string;\n /** Every served locale, in registry order. */\n readonly locales: readonly PageLocale[];\n}",
10361
+ "doc": "/** The served locales, handed to the client so it names a page's locale from its path the way the\n * server does. */"
10362
+ },
10178
10363
  {
10179
10364
  "name": "PagedStorageAdapter",
10180
10365
  "kind": "interface",
@@ -11073,7 +11258,7 @@
11073
11258
  "name": "QueueOptions",
11074
11259
  "kind": "interface",
11075
11260
  "package": "@nifrajs/jobs",
11076
- "signature": "export interface QueueOptions {\n /** Persistence. Default: a fresh {@link MemoryJobStore} (single-process). */\n readonly store?: JobStore;\n /** Called when a handler throws (before retry/dead-letter). Default: `console.error`. A throwing handler here is swallowed. */\n readonly onError?: (error: unknown, jobName: string) => void;\n /** Injectable clock (tests). Default `() => Date.now()`. */\n readonly now?: () => number;\n /** Default attempts for jobs that don't set `retries`. Default 3. */\n readonly defaultAttempts?: number;\n /** Default backoff for jobs that don't set one. Default {@link exponentialBackoff}. */\n readonly backoff?: Backoff;\n /**\n * Make `enqueue` produce capability evidence:\n *\n * import { useCapability } from \"@nifrajs/core/capabilities\"\n * const queue = createQueue({ beacon: useCapability })\n * await indexNote.for(c).enqueue({ id })\n */\n readonly beacon?: CapabilityBeacon;\n /** Override the announced token. Default `jobs.enqueue`. */\n readonly capabilities?: {\n readonly enqueue?: string;\n };\n /**\n * Around-hooks for each enqueue and each attempt - pass `jobTracing()` from `@nifrajs/otel/jobs` for a\n * `send <job>` producer span and a `process <job>` consumer span per attempt.\n */\n readonly instrument?: QueueInstrument;\n}"
11261
+ "signature": "export interface QueueOptions {\n /** Persistence. Default: a fresh {@link MemoryJobStore} (single-process). */\n readonly store?: JobStore;\n /** Called when a handler throws (before retry/dead-letter). Default: `console.error`. A throwing handler here is swallowed. */\n readonly onError?: (error: unknown, jobName: string) => void;\n /** Injectable clock (tests). Default `() => Date.now()`. */\n readonly now?: () => number;\n /** Default attempts for jobs that don't set `retries`: a whole number (below 1 counts as 1).\n * Default 3. `createQueue` throws a `RangeError` on anything else. */\n readonly defaultAttempts?: number;\n /** Default backoff for jobs that don't set one. Default {@link exponentialBackoff}. */\n readonly backoff?: Backoff;\n /**\n * Make `enqueue` produce capability evidence:\n *\n * import { useCapability } from \"@nifrajs/core/capabilities\"\n * const queue = createQueue({ beacon: useCapability })\n * await indexNote.for(c).enqueue({ id })\n */\n readonly beacon?: CapabilityBeacon;\n /** Override the announced token. Default `jobs.enqueue`. */\n readonly capabilities?: {\n readonly enqueue?: string;\n };\n /**\n * Around-hooks for each enqueue and each attempt - pass `jobTracing()` from `@nifrajs/otel/jobs` for a\n * `send <job>` producer span and a `process <job>` consumer span per attempt.\n */\n readonly instrument?: QueueInstrument;\n}"
11077
11262
  },
11078
11263
  {
11079
11264
  "name": "R2BucketLike",
@@ -11136,6 +11321,13 @@
11136
11321
  "signature": "export declare const RESERVED_VERB_KEYS: readonly [\"get\", \"post\", \"put\", \"patch\", \"delete\", \"head\", \"options\"];",
11137
11322
  "doc": "/** Intercepted case-insensitively: `/api/Delete` collides just as `/api/delete` does. */"
11138
11323
  },
11324
+ {
11325
+ "name": "RESPONSE_CONTRACT_BASELINE_HINT",
11326
+ "kind": "const",
11327
+ "package": "@nifrajs/cli",
11328
+ "signature": "export declare const RESPONSE_CONTRACT_BASELINE_HINT = \"to fail route assurance on these, add baseline: [{ name: \\\"response-contract\\\", match: { hasResponse: true }, require: [\\\"nifra.response-contract\\\"] }] to the policy\";",
11329
+ "doc": "/** The policy line that turns an unenforced contract into a route-assurance failure. */"
11330
+ },
11139
11331
  {
11140
11332
  "name": "RETAIN_HEADER",
11141
11333
  "kind": "const",
@@ -11457,7 +11649,7 @@
11457
11649
  "name": "ReflectedHook",
11458
11650
  "kind": "interface",
11459
11651
  "package": "@nifrajs/core",
11460
- "signature": "export interface ReflectedHook {\n readonly kind: HookKind;\n /** The plugin that registered it, else the function's own name, else `(anonymous)`. */\n readonly name: string;\n /** Where it was registered: `app`, `group /api`, `merge #1`, `mount /auth`, or `unknown`. */\n readonly site: string;\n /** The header names a static `responseHeaders()` declaration sets. */\n readonly headers?: readonly string[];\n}",
11652
+ "signature": "export interface ReflectedHook {\n readonly kind: HookKind;\n /** The plugin that registered it, else the function's own name, else `(anonymous)`. */\n readonly name: string;\n /** Where it was registered: `app`, `group /api`, `merge #1`, `mount /auth`, or `unknown`; `route`\n * for a runtime the route resolved at registration (`responseContract`, `effectLedger`,\n * `idempotency`), whose `name` is the contract mode or the runtime. */\n readonly site: string;\n /** The header names a static `responseHeaders()` declaration sets. */\n readonly headers?: readonly string[];\n}",
11461
11653
  "doc": "/** One hook that runs for a route or an unmatched path: what it is, who added it, and where. */"
11462
11654
  },
11463
11655
  {
@@ -11466,6 +11658,13 @@
11466
11658
  "package": "@nifrajs/core",
11467
11659
  "signature": "export interface ReflectedHookReport {\n /**\n * False when a hook has no recorded origin and is listed with site `unknown`. Origins are recorded\n * only outside production builds, so reflect a development load of the app.\n */\n readonly complete: boolean;\n readonly routes: readonly ReflectedRouteHooks[];\n readonly unmatched: readonly ReflectedUnmatchedHooks[];\n}"
11468
11660
  },
11661
+ {
11662
+ "name": "ReflectedMergeAuthGap",
11663
+ "kind": "type",
11664
+ "package": "@nifrajs/core",
11665
+ "signature": "export type ReflectedMergeAuthGap = MergeAuthGapTag;",
11666
+ "doc": "/** A `merge()` that authenticates none of its routes under a parent that authenticates its own. */"
11667
+ },
11469
11668
  {
11470
11669
  "name": "ReflectedMount",
11471
11670
  "kind": "interface",
@@ -11624,7 +11823,7 @@
11624
11823
  "name": "RenderAdapter",
11625
11824
  "kind": "interface",
11626
11825
  "package": "@nifrajs/web",
11627
- "signature": "export interface RenderAdapter {\n /**\n * Render a route's layout `chain` (outermost layout → page) to a Web stream of HTML bytes,\n * including the framework's hydration markers. When `options.nonce` is set, every executable\n * `<script>` the framework streams (out-of-order Suspense runtimes, serialized resources) must\n * carry it, or a nonce-based Content-Security-Policy blocks it and the boundary never resolves.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /** Render the chain to a complete HTML string when no content is deferred. */\n renderToString?(chain: readonly unknown[], props: RenderProps): string | Promise<string>;\n /** Per-document bootstrap markup injected into `<head>` for client hydration. */\n hydrationHead(nonce?: string): string;\n}",
11826
+ "signature": "export interface RenderAdapter {\n /**\n * Render a route's layout `chain` (outermost layout → page) to a Web stream of HTML bytes,\n * including the framework's hydration markers. When `options.nonce` is set, every executable\n * `<script>` the framework streams (out-of-order Suspense runtimes, serialized resources) must\n * carry it, or a nonce-based Content-Security-Policy blocks it and the boundary never resolves.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /**\n * Render the chain to a complete HTML string when no content is deferred. `options.nonce` is the\n * document's CSP nonce, for any inline script the renderer emits (Solid's hydration data).\n */\n renderToString?(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): string | Promise<string>;\n /** Per-document bootstrap markup injected into `<head>` for client hydration. */\n hydrationHead(nonce?: string): string;\n /**\n * Set when a render can produce markup that belongs outside the app root. Every render is then\n * passed `options.parts` to fill; an adapter without it never is, and pays nothing for the seam.\n */\n readonly documentParts?: boolean;\n}",
11628
11827
  "doc": "/**\n * The seam every render adapter implements. New adapters should prove these invariants with\n * `assertRenderAdapterConformance`; framework-specific behavior remains locally tested.\n */"
11629
11828
  },
11630
11829
  {
@@ -11645,7 +11844,7 @@
11645
11844
  "name": "RenderAssemblyCache",
11646
11845
  "kind": "interface",
11647
11846
  "package": "@nifrajs/web",
11648
- "signature": "export interface RenderAssemblyCache {\n /** Shell up to (not including) the deferred-runtime insertion point. */\n shellPre?: string;\n /** Shell from after the deferred-runtime insertion point through the open `#root` container. */\n shellPost?: string;\n /** Tail opener: the handover script open tag + the data member's key. */\n tailPre?: string;\n /** Tail from after the per-request handover members (the route id, prerendered paths, the handover\n * close) through `</html>`. */\n tailPost?: string;\n}",
11847
+ "signature": "export interface RenderAssemblyCache {\n /** Shell up to (not including) the deferred-runtime insertion point. */\n shellPre?: string;\n /** Shell from after the deferred-runtime insertion point through `<body>`. */\n shellPost?: string;\n /** The open `#root` container. */\n rootOpen?: string;\n /** Tail opener: the handover script open tag + the data member's key. */\n tailPre?: string;\n /** Tail from after the per-request handover members (the route id, prerendered paths, the handover\n * close) through `</html>`. */\n tailPost?: string;\n}",
11649
11848
  "doc": "/** The mutable per-route slot {@link RenderPageOptions.assemblyCache} fills. Opaque - create as `{}`. */"
11650
11849
  },
11651
11850
  {
@@ -11666,13 +11865,13 @@
11666
11865
  "name": "RenderPageOptions",
11667
11866
  "kind": "interface",
11668
11867
  "package": "@nifrajs/web",
11669
- "signature": "export interface RenderPageOptions {\n readonly serverComponents?: import(\"../server-components/types.js\").ComponentState;\n readonly adapter: RenderAdapter;\n /** The layout chain to render - outermost layout → page (opaque; the adapter renders it). */\n readonly chain: readonly unknown[];\n /** The loader output for this request. */\n readonly data: unknown;\n /** An action's data return (POST only) - surfaced to the page as `actionData` + serialized\n * for the client so post-POST hydration matches. Omit on GETs. */\n readonly actionData?: unknown;\n /**\n * URL of the built client entry (loaded as a module script).\n *\n * Optional ONLY on a `hydrate: false` page, where there is no client takeover to feed and this value\n * reaches no output at all. The union below is what enforces that: omitting it on a hydrating page\n * stays a compile error rather than rendering `src=\"\"`.\n */\n readonly clientEntry?: string;\n /** Chunk URLs for the **matched** route (its layout chain + own chunk) to `modulepreload` in the\n * shell - so the route code downloads in parallel with the entry instead of after it\n * (`buildClient`'s per-route map). Empty/omitted ⇒ only the entry is preloaded (unchanged). */\n readonly preload?: readonly string[];\n /** Stylesheet URLs for the **matched** route (its layout chain + own CSS, from `buildClient`'s\n * `BuildManifest.css`) - injected as `<link rel=\"stylesheet\">` in `<head>` so styles arrive with the\n * first paint (no FOUC). Rendered even on non-hydrated pages. Empty/omitted ⇒ none (unchanged). */\n readonly styles?: readonly string[];\n /**\n * Activation policy for these framework-owned stylesheet links (default `\"blocking\"`). In\n * `\"deferred\"` mode, hydrating pages fetch with `media=\"print\"` and the generated client promotes\n * them to `media=\"all\"` after load/error/timeout. Non-hydrated pages remain blocking so JS-off pages\n * and terminal documents are styled.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set, serialized to `window.__NIFRA_PRERENDERED__` so the client fetches\n * a static `_data.json` on soft-nav into a prerendered route. Empty/omitted ⇒ not injected. */\n readonly prerenderedPaths?: readonly string[];\n /** SSG: the URL of a JSON array of the prerendered paths, handed over in place of\n * {@link prerenderedPaths} so a large set is fetched once instead of riding in every page. */\n readonly prerenderedListUrl?: string;\n /** ISR: route freshness in seconds, emitted as the `x-nifra-isr-revalidate` header for a `withISR`\n * wrapper to read. Omit ⇒ no header (the wrapper's default TTL applies). */\n readonly revalidate?: number;\n /** ISR invalidation tags emitted as a bounded `x-nifra-isr-tags` header. */\n readonly revalidateTags?: readonly string[];\n /** Matched route id; written to `window.__NIFRA_ROUTE__` so the client hydrates this chain. */\n readonly routeId?: string;\n /** The matched route's decoded path params - surfaced to the page as `params` (via {@link RenderProps})\n * so an adapter's `useParams` is SSR-correct. Omit ⇒ `{}` (a route with no dynamic segments, or an\n * error/404 render). */\n readonly params?: Readonly<Record<string, string>>;\n /** The request's `pathname + search` - surfaced as `path` (via {@link RenderProps}) so an adapter's\n * `useLocation`/`useSearchParams` render the right URL server-side and hydrate without drift. Omit ⇒\n * `\"\"`. */\n readonly path?: string;\n /** The route's validated search (`searchOf(mod.searchSchema, url.search)`, the same value handed to\n * the loader as `ctx.search`), surfaced as `search` (via {@link RenderProps}) so an adapter's\n * `useSearch` is SSR-correct. Omit ⇒ `{}` (a render with no search context). */\n readonly search?: Record<string, unknown>;\n /** Per-layout loader data, forwarded to the adapter as `RenderProps.layoutData`. Aligned with the\n * chain's layout prefix; omitted when no layout in the chain has a loader. */\n readonly layoutData?: readonly unknown[];\n /** Dynamic-boundary states, forwarded to the adapter and serialized for hydration when present. */\n readonly boundaries?: BoundaryStates;\n /** The chain's ids and `handle` exports, forwarded as `RenderProps.matchChain` for `useMatches`. */\n readonly matchChain?: MatchChain;\n /** HTTP status for the response (default 200; e.g. 404 for a not-found page). */\n readonly status?: number;\n /** Extra response headers - e.g. the `cache-control` a terminal status page wants. `content-type`\n * is ignored (the document is always HTML) and the ISR freshness header is applied after these,\n * so neither can be overridden from here. */\n readonly headers?: HeadersLike;\n /** Document title (fallback when `head.title` is unset). */\n readonly title?: string;\n /** Resolved route head - `title` overrides `title` above; `meta`/`link` render as managed\n * (`data-nifra`) tags the client updates on navigation.\n *\n * **Head contract (the layout chain contributes).** `createWebApp` resolves this via\n * {@link mergeHeads}: a route's head is its **layout chain's** `meta`/`head` exports merged with the\n * page's. A `_layout.tsx` may `export const meta` (or `export function meta(args)`) - its tags land\n * on every page below it (the home for `hreflang`, `preconnect`, a section-default `<title>`). The\n * merge is **nearest-wins for scalars** (the page's `title` overrides an inner layout's, which\n * overrides an outer one; an undefined page title keeps the layout's) and **concatenated for the\n * `meta`/`link` arrays** (outermost layout first, page last). `<meta>`/`<link>` attributes pass a\n * shared tag-specific allowlist (including inert `data-*` metadata) and values are escaped. */\n readonly head?: Meta;\n /** Id of the container wrapping the app markup (default `\"root\"`). A non-default id also gets\n * {@link ROOT_ATTRIBUTE}, which is how the generated client entry finds the container to hydrate -\n * the entry is built once and cannot know what a given render chose. */\n readonly rootId?: string;\n /** When `false`, emit a complete but **non-hydrated** document - no client entry script, data\n * globals, or modulepreloads. Used for server-rendered `_error` pages: a terminal state that needs no\n * client takeover, and it sidesteps an SSR/hydrate mismatch (the server rendered the boundary, not\n * the page the client manifest maps this route id to). Default `true`. */\n readonly hydrate?: boolean;\n /** Island client bundles (`@nifrajs/web/islands`) to load as `<script type=\"module\">` in the document\n * tail - emitted **regardless of `hydrate`**, so a static (`hydrate: false`) page can still mount\n * no-framework islands. URLs are attribute-escaped. Empty/omitted ⇒ none (unchanged output). */\n readonly islandScripts?: readonly string[];\n /** CSP nonce applied to every framework-owned executable script in this document. Nonce-bearing\n * documents are marked `private, no-store` so a request-specific nonce is never replayed. */\n readonly nonce?: string;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`. The document then carries `nonce`\n * only when it needs one (it defers a value, or a head tag names the nonce); otherwise it renders\n * nonce-free and cacheable. The policy's header is set on the response either way.\n */\n readonly csp?: CspPolicy;\n /**\n * Advanced: a per-route slot the renderer fills with the request-invariant document pieces (shell\n * prefix/suffix, tail statics) on the first render and reuses afterwards, skipping their re-assembly.\n *\n * Only pass a cache when every shell-shaping input is IDENTICAL across the requests sharing it:\n * same `head` content (a static meta chain - never a `meta(data)` function), `title`, `styles`,\n * `cssLoading`, `preload`, `islandScripts`, `clientEntry`, `rootId`, `hydrate`, and `prerenderedPaths`.\n * Per-request\n * values (`data`, `params`, `search`, `actionData`, `layoutData`, deferred state) are always assembled\n * fresh and safe. A per-request `nonce` disables the cache automatically. `createWebApp` wires this\n * per route, gated on the route + layout metas being static.\n */\n readonly assemblyCache?: RenderAssemblyCache;\n}"
11868
+ "signature": "export interface RenderPageOptions {\n readonly serverComponents?: import(\"../server-components/types.js\").ComponentState;\n readonly adapter: RenderAdapter;\n /** The layout chain to render - outermost layout → page (opaque; the adapter renders it). */\n readonly chain: readonly unknown[];\n /** The loader output for this request. */\n readonly data: unknown;\n /** An action's data return (POST only) - surfaced to the page as `actionData` + serialized\n * for the client so post-POST hydration matches. Omit on GETs. */\n readonly actionData?: unknown;\n /**\n * URL of the built client entry (loaded as a module script).\n *\n * Optional ONLY on a `hydrate: false` page, where there is no client takeover to feed and this value\n * reaches no output at all. The union below is what enforces that: omitting it on a hydrating page\n * stays a compile error rather than rendering `src=\"\"`.\n */\n readonly clientEntry?: string;\n /** Chunk URLs for the **matched** route (its layout chain + own chunk) to `modulepreload` in the\n * shell - so the route code downloads in parallel with the entry instead of after it\n * (`buildClient`'s per-route map). Empty/omitted ⇒ only the entry is preloaded (unchanged). */\n readonly preload?: readonly string[];\n /** Stylesheet URLs for the **matched** route (its layout chain + own CSS, from `buildClient`'s\n * `BuildManifest.css`) - injected as `<link rel=\"stylesheet\">` in `<head>` so styles arrive with the\n * first paint (no FOUC). Rendered even on non-hydrated pages. Empty/omitted ⇒ none (unchanged). */\n readonly styles?: readonly string[];\n /**\n * Activation policy for these framework-owned stylesheet links (default `\"blocking\"`). In\n * `\"deferred\"` mode, hydrating pages fetch with `media=\"print\"` and the generated client promotes\n * them to `media=\"all\"` after load/error/timeout. Non-hydrated pages remain blocking so JS-off pages\n * and terminal documents are styled.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set, serialized to `window.__NIFRA_PRERENDERED__` so the client fetches\n * a static `_data.json` on soft-nav into a prerendered route. Empty/omitted ⇒ not injected. */\n readonly prerenderedPaths?: readonly string[];\n /** SSG: the URL of a JSON array of the prerendered paths, handed over in place of\n * {@link prerenderedPaths} so a large set is fetched once instead of riding in every page. */\n readonly prerenderedListUrl?: string;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`), handed over to the\n * client; the chunks this page reads its copy from are preloaded. Omit ⇒ none. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** The page's locale from the app's locale routing: `<html lang dir>` default to it unless `head`\n * sets `lang`, the response carries `Content-Language`, and the adapter reads it as\n * `RenderProps.locale`. Omit ⇒ none of these. */\n readonly locale?: PageLocale;\n /** The served locales, handed to the client so it names each page's locale on navigation. */\n readonly locales?: PageLocales;\n /** ISR: route freshness in seconds, emitted as the `x-nifra-isr-revalidate` header for a `withISR`\n * wrapper to read. Omit ⇒ no header (the wrapper's default TTL applies). */\n readonly revalidate?: number;\n /** ISR invalidation tags emitted as a bounded `x-nifra-isr-tags` header. */\n readonly revalidateTags?: readonly string[];\n /** Matched route id; written to `window.__NIFRA_ROUTE__` so the client hydrates this chain. */\n readonly routeId?: string;\n /** The matched route's decoded path params - surfaced to the page as `params` (via {@link RenderProps})\n * so an adapter's `useParams` is SSR-correct. Omit ⇒ `{}` (a route with no dynamic segments, or an\n * error/404 render). */\n readonly params?: Readonly<Record<string, string>>;\n /** The request's `pathname + search` - surfaced as `path` (via {@link RenderProps}) so an adapter's\n * `useLocation`/`useSearchParams` render the right URL server-side and hydrate without drift. Omit ⇒\n * `\"\"`. */\n readonly path?: string;\n /** The route's validated search (`searchOf(mod.searchSchema, url.search)`, the same value handed to\n * the loader as `ctx.search`), surfaced as `search` (via {@link RenderProps}) so an adapter's\n * `useSearch` is SSR-correct. Omit ⇒ `{}` (a render with no search context). */\n readonly search?: Record<string, unknown>;\n /** Per-layout loader data, forwarded to the adapter as `RenderProps.layoutData`. Aligned with the\n * chain's layout prefix; omitted when no layout in the chain has a loader. */\n readonly layoutData?: readonly unknown[];\n /** Dynamic-boundary states, forwarded to the adapter and serialized for hydration when present. */\n readonly boundaries?: BoundaryStates;\n /** The chain's ids and `handle` exports, forwarded as `RenderProps.matchChain` for `useMatches`. */\n readonly matchChain?: MatchChain;\n /** HTTP status for the response (default 200; e.g. 404 for a not-found page). */\n readonly status?: number;\n /** Extra response headers - e.g. the `cache-control` a terminal status page wants. `content-type`\n * is ignored (the document is always HTML) and the ISR freshness header is applied after these,\n * so neither can be overridden from here. */\n readonly headers?: HeadersLike;\n /** Document title (fallback when `head.title` is unset). */\n readonly title?: string;\n /** Resolved route head - `title` overrides `title` above; `meta`/`link` render as managed\n * (`data-nifra`) tags the client updates on navigation.\n *\n * **Head contract (the layout chain contributes).** `createWebApp` resolves this via\n * {@link mergeHeads}: a route's head is its **layout chain's** `meta`/`head` exports merged with the\n * page's. A `_layout.tsx` may `export const meta` (or `export function meta(args)`) - its tags land\n * on every page below it (the home for `hreflang`, `preconnect`, a section-default `<title>`). The\n * merge is **nearest-wins for scalars** (the page's `title` overrides an inner layout's, which\n * overrides an outer one; an undefined page title keeps the layout's) and **concatenated for the\n * `meta`/`link` arrays** (outermost layout first, page last). `<meta>`/`<link>` attributes pass a\n * shared tag-specific allowlist (including inert `data-*` metadata) and values are escaped. */\n readonly head?: Meta;\n /** Id of the container wrapping the app markup (default `\"root\"`). A non-default id also gets\n * {@link ROOT_ATTRIBUTE}, which is how the generated client entry finds the container to hydrate -\n * the entry is built once and cannot know what a given render chose. */\n readonly rootId?: string;\n /** When `false`, emit a complete but **non-hydrated** document - no client entry script, data\n * globals, or modulepreloads. Used for server-rendered `_error` pages: a terminal state that needs no\n * client takeover, and it sidesteps an SSR/hydrate mismatch (the server rendered the boundary, not\n * the page the client manifest maps this route id to). Default `true`. */\n readonly hydrate?: boolean;\n /** Island client bundles (`@nifrajs/web/islands`) to load as `<script type=\"module\">` in the document\n * tail - emitted **regardless of `hydrate`**, so a static (`hydrate: false`) page can still mount\n * no-framework islands. URLs are attribute-escaped. Empty/omitted ⇒ none (unchanged output). */\n readonly islandScripts?: readonly string[];\n /** CSP nonce applied to every framework-owned executable script in this document. Nonce-bearing\n * documents are marked `private, no-store` so a request-specific nonce is never replayed. */\n readonly nonce?: string;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`. The document then carries `nonce`\n * only when it needs one (it defers a value, or a head tag names the nonce); otherwise it renders\n * nonce-free and cacheable. The policy's header is set on the response either way.\n */\n readonly csp?: CspPolicy;\n /**\n * Advanced: a per-route slot the renderer fills with the request-invariant document pieces (shell\n * prefix/suffix, tail statics) on the first render and reuses afterwards, skipping their re-assembly.\n *\n * Only pass a cache when every shell-shaping input is IDENTICAL across the requests sharing it:\n * same `head` content (a static meta chain - never a `meta(data)` function), `locale`, `title`, `styles`,\n * `cssLoading`, `preload`, `islandScripts`, `clientEntry`, `rootId`, `hydrate`, and `prerenderedPaths`.\n * Per-request\n * values (`data`, `params`, `search`, `actionData`, `layoutData`, deferred state) are always assembled\n * fresh and safe. A per-request `nonce` disables the cache automatically. `createWebApp` wires this\n * per route, gated on the route + layout metas being static.\n */\n readonly assemblyCache?: RenderAssemblyCache;\n}"
11670
11869
  },
11671
11870
  {
11672
11871
  "name": "RenderProps",
11673
11872
  "kind": "interface",
11674
11873
  "package": "@nifrajs/web",
11675
- "signature": "export interface RenderProps {\n readonly serverComponents?: import(\"./server-components/types.js\").ComponentState;\n readonly data: unknown;\n /** Per-layout loader data, aligned index-for-index with the layout prefix of `chain`. */\n readonly layoutData?: readonly unknown[];\n readonly actionData?: unknown;\n /** True while a client navigation or submit is in flight (client-only; absent/false on SSR). */\n readonly pending?: boolean;\n /** The path a client navigation is transitioning TO while `pending` (client-only; absent on SSR). */\n readonly pendingPath?: string;\n /** The in-flight client submit, for optimistic UI (client-only; absent on SSR). */\n readonly submission?: Submission;\n /** The matched route's decoded path params. */\n readonly params?: Readonly<Record<string, string>>;\n /** The current URL's `pathname + search` (no hash). */\n readonly path?: string;\n /** The route's typed, validated search params. */\n readonly search?: Record<string, unknown>;\n /** Neutral named-boundary states; adapters choose how each boundary's `render` UI is mounted. */\n readonly boundaries?: BoundaryStates;\n /** The rendered chain's module ids and `handle` exports, for the adapter's `useMatches`. */\n readonly matchChain?: MatchChain;\n}",
11874
+ "signature": "export interface RenderProps {\n readonly serverComponents?: import(\"./server-components/types.js\").ComponentState;\n readonly data: unknown;\n /** Per-layout loader data, aligned index-for-index with the layout prefix of `chain`. */\n readonly layoutData?: readonly unknown[];\n readonly actionData?: unknown;\n /** True while a client navigation or submit is in flight (client-only; absent/false on SSR). */\n readonly pending?: boolean;\n /** The path a client navigation is transitioning TO while `pending` (client-only; absent on SSR). */\n readonly pendingPath?: string;\n /** The in-flight client submit, for optimistic UI (client-only; absent on SSR). */\n readonly submission?: Submission;\n /** The matched route's decoded path params. */\n readonly params?: Readonly<Record<string, string>>;\n /** The current URL's `pathname + search` (no hash). */\n readonly path?: string;\n /** The route's typed, validated search params. */\n readonly search?: Record<string, unknown>;\n /** Neutral named-boundary states; adapters choose how each boundary's `render` UI is mounted. */\n readonly boundaries?: BoundaryStates;\n /** The rendered chain's module ids and `handle` exports, for the adapter's `useMatches`. */\n readonly matchChain?: MatchChain;\n /** The page's locale, when the app registers its locale routing (`createWebApp`'s `i18n`). Set on\n * SSR only; the client names it from `path` (see {@link localeOfProps}). */\n readonly locale?: PageLocale;\n}",
11676
11875
  "doc": "/** The data handed to a route component. */"
11677
11876
  },
11678
11877
  {
@@ -11698,7 +11897,7 @@
11698
11897
  "name": "RenderStreamOptions",
11699
11898
  "kind": "interface",
11700
11899
  "package": "@nifrajs/web",
11701
- "signature": "export interface RenderStreamOptions {\n /** The document's CSP nonce, for every executable `<script>` the framework streams. */\n readonly nonce?: string;\n}",
11900
+ "signature": "export interface RenderStreamOptions {\n /** The document's CSP nonce, for every executable `<script>` the framework streams. */\n readonly nonce?: string;\n /** Present only for an adapter that sets {@link RenderAdapter.documentParts}. */\n readonly parts?: DocumentParts;\n}",
11702
11901
  "doc": "/** Per-document options for {@link RenderAdapter.renderToStream}. */"
11703
11902
  },
11704
11903
  {
@@ -11956,6 +12155,13 @@
11956
12155
  "signature": "export interface ResponseContractDefinition {\n readonly response?: StandardSchemaV1;\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n}",
11957
12156
  "doc": "/** Success and status-specific error schemas captured by one route at registration time. */"
11958
12157
  },
12158
+ {
12159
+ "name": "ResponseContractGaps",
12160
+ "kind": "interface",
12161
+ "package": "@nifrajs/cli",
12162
+ "signature": "export interface ResponseContractGaps {\n readonly typedOnly: readonly string[];\n readonly warnOnly: readonly string[];\n readonly typedOnlyReason: string | undefined;\n readonly warnOnlyReason: string | undefined;\n}",
12163
+ "doc": "/** Why declared response/error schemas go unenforced, phrased for the server that has to change. */"
12164
+ },
11959
12165
  {
11960
12166
  "name": "ResponseContractMode",
11961
12167
  "kind": "type",
@@ -11963,18 +12169,31 @@
11963
12169
  "signature": "export type ResponseContractMode = \"warn\" | \"enforce\";",
11964
12170
  "doc": "/**\n * How hard a declared `response` schema is held.\n *\n * - `warn` - check and log; the response is sent UNCHANGED, so enabling it cannot break anything.\n * - `enforce` - serialize the validated value, so undeclared data cannot reach the wire.\n *\n * There is no `off`: not installing the plugin IS off, and that is what keeps this module out of an\n * app's bundle entirely rather than shipping a disabled branch to everyone.\n */"
11965
12171
  },
12172
+ {
12173
+ "name": "ResponseContractOptions",
12174
+ "kind": "interface",
12175
+ "package": "@nifrajs/core",
12176
+ "signature": "export interface ResponseContractOptions {\n /**\n * Fields the schema does not declare. `\"reject\"` (the default) leaves them to the validator: a\n * closed `t.object` reports them, so an enforced response becomes a 500 and the log names them.\n * `\"strip\"` drops them first, for any schema exposing its JSON Schema as `jsonSchema` (every\n * `@nifrajs/schema` `t` schema) - nested objects, arrays and records included. A union is projected\n * when an object value can meet only one of its branches: a single object branch, or object\n * branches that all require one key holding literals no two branches share (`ok: true` /\n * `ok: false`, `kind: \"a\"` / `kind: \"b\"`). Schemas without `jsonSchema` (zod, valibot) are\n * unaffected: they already strip or reject by their own rules.\n */\n readonly extra?: \"reject\" | \"strip\";\n /**\n * `enforce` only: log the names of the fields that never reached the wire - dropped by `extra:\n * \"strip\"` or by a validator that strips on its own - so a field the contract does not declare\n * (a new column) shows up in the log instead of vanishing. Logged as a `warn` named \"response\n * contract\", once per route for each distinct set of names, at most 32 sets per route. Values are\n * never logged. Each response is compared with what was sent, so it costs a walk of the payload.\n */\n readonly logStripped?: boolean;\n /**\n * Called for every response the contract has something to say about, for a metric or an alert, where\n * the log speaks once per route. `violation`: enforce mode, the payload failed and a 500 went out in\n * its place. `warn`: warn mode, the payload failed or carried undeclared top-level keys (`fields`)\n * and was sent anyway. `stripped`: enforce mode, the payload was sent without `fields`. The message is\n * the text the log line carries; values are never passed. Called before the response is sent; a hook\n * that throws, rejects or is not a function is logged once and changes nothing. In enforce mode it costs the payload walk\n * `logStripped` does.\n */\n readonly onReport?: (report: ResponseContractReport) => void;\n}"
12177
+ },
11966
12178
  {
11967
12179
  "name": "ResponseContractOutcome",
11968
12180
  "kind": "type",
11969
12181
  "package": "@nifrajs/core",
11970
- "signature": "export type ResponseContractOutcome = \n/** Nothing to report. `value` is what should be serialized (the original result, or the cleaned one). */\n{\n readonly kind: \"ok\";\n readonly value: unknown;\n}\n/** `warn` only: the payload differed from the contract. The ORIGINAL result is still served. */\n | {\n readonly kind: \"warn\";\n readonly value: unknown;\n readonly message: string;\n}\n/** `enforce` only: the payload cannot be reconciled with the contract, so it must not be sent. */\n | {\n readonly kind: \"violation\";\n readonly message: string;\n};",
12182
+ "signature": "export type ResponseContractOutcome = \n/** Nothing to report. `value` is what should be serialized (the original result, or the cleaned one). */\n{\n readonly kind: \"ok\";\n readonly value: unknown;\n}\n/** Logged, then `value` is served: in `warn` the ORIGINAL result, in `enforce` (with\n * `logStripped`) the cleaned one. `fields`: in `warn`, the undeclared keys when they are the reason. */\n | {\n readonly kind: \"warn\";\n readonly value: unknown;\n readonly message: string;\n readonly fields?: readonly string[];\n}\n/** `enforce` only: the payload cannot be reconciled with the contract, so it must not be sent. */\n | {\n readonly kind: \"violation\";\n readonly message: string;\n};",
11971
12183
  "doc": "/** The outcome of checking one handler result against its declared response schema. */"
11972
12184
  },
12185
+ {
12186
+ "name": "ResponseContractReport",
12187
+ "kind": "interface",
12188
+ "package": "@nifrajs/core",
12189
+ "signature": "export interface ResponseContractReport {\n readonly kind: \"violation\" | \"warn\" | \"stripped\";\n /** The route's method as registered, e.g. `GET`. */\n readonly method: string;\n /** The route's path as registered, e.g. `/users/:id`, so a metric keyed by it stays bounded. */\n readonly route: string;\n /** `stripped`: each field that never reached the wire (`user.passwordHash`, `items[].cost`), sorted.\n * `warn`: the undeclared top-level keys that were sent, when they are the reason. */\n readonly fields?: readonly string[] | undefined;\n readonly message: string;\n}",
12190
+ "doc": "/** One response the contract reported on, passed to {@link ResponseContractOptions.onReport}. */"
12191
+ },
11973
12192
  {
11974
12193
  "name": "ResponseContractRuntime",
11975
12194
  "kind": "interface",
11976
12195
  "package": "@nifrajs/core",
11977
- "signature": "export interface ResponseContractRuntime {\n readonly mode: ResponseContractMode;\n check(definition: ResponseContractDefinition, result: unknown, context?: {\n readonly jsonReply?: Response | undefined;\n readonly jsonBody?: unknown;\n }): ResponseContractOutcome | Promise<ResponseContractOutcome>;\n}",
12196
+ "signature": "export interface ResponseContractRuntime {\n readonly mode: ResponseContractMode;\n check(definition: ResponseContractDefinition, result: unknown, context?: {\n readonly req?: Request;\n readonly jsonReply?: Response | undefined;\n readonly jsonBody?: unknown;\n }): ResponseContractOutcome | Promise<ResponseContractOutcome>;\n}",
11978
12197
  "doc": "/**\n * What the server holds when the plugin is installed. The kernel calls `check` through this object and\n * never imports the implementation, so an app that does not install the plugin does not carry it.\n */"
11979
12198
  },
11980
12199
  {
@@ -12142,7 +12361,7 @@
12142
12361
  "name": "RetryPolicy",
12143
12362
  "kind": "interface",
12144
12363
  "package": "@nifrajs/jobs",
12145
- "signature": "export interface RetryPolicy {\n /** Total attempts before dead-lettering (incl. the first). Default 3. `1` = no retries. */\n readonly attempts: number;\n /** Delay before each retry. Default {@link exponentialBackoff}. */\n readonly backoff?: Backoff;\n}"
12364
+ "signature": "export interface RetryPolicy {\n /** Total attempts before dead-lettering (incl. the first): a whole number, below 1 counting as 1.\n * Default 3. `1` = no retries. `define` throws a `RangeError` on `NaN`, `Infinity` or a fraction. */\n readonly attempts: number;\n /** Delay before each retry. Default {@link exponentialBackoff}. */\n readonly backoff?: Backoff;\n}"
12146
12365
  },
12147
12366
  {
12148
12367
  "name": "RevalidateEndpointOptions",
@@ -12473,7 +12692,7 @@
12473
12692
  "name": "RouteCapabilityEvidence",
12474
12693
  "kind": "interface",
12475
12694
  "package": "@nifrajs/core",
12476
- "signature": "export interface RouteCapabilityEvidence {\n readonly method: string;\n readonly path: string;\n /** True only when the route's reachable module graph was actually scanned. */\n readonly covered: boolean;\n readonly evidence: readonly CapabilityEvidence[];\n}"
12695
+ "signature": "export interface RouteCapabilityEvidence {\n readonly method: string;\n readonly path: string;\n /** True only when the route's reachable module graph was actually scanned. */\n readonly covered: boolean;\n readonly evidence: readonly CapabilityEvidence[];\n /** The probable cause of an uncovered route, when the collector can tell. */\n readonly uncoveredReason?: string;\n}"
12477
12696
  },
12478
12697
  {
12479
12698
  "name": "RouteChange",
@@ -12639,7 +12858,7 @@
12639
12858
  "name": "RouteModule",
12640
12859
  "kind": "interface",
12641
12860
  "package": "@nifrajs/web",
12642
- "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /** Layout loader that must run before actions and is not retained across the action's render. */\n readonly gate?: boolean;\n readonly action?: Action;\n /**\n * Backend half only: 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 /** 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 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}",
12861
+ "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /** Layout loader that must run before actions and is not retained across the action's render. */\n readonly gate?: boolean;\n readonly action?: Action;\n /**\n * Backend half only: which browser origins may POST to {@link action}. When omitted, a request\n * whose `Origin` is another site's is refused with 403 before middleware, gates or the action run;\n * requests without an `Origin` (non-browser clients) pass. An array allows exactly those origins\n * (and refuses a request without one); a function decides, receiving `null` when there is none.\n * Use it for a callback a third party posts to, such as an identity provider's `form_post`.\n * `Origin` is browser-enforced, not authentication: keep the action's own auth checks.\n */\n readonly allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * Backend half only: the schema of what {@link loader} sends to the browser. Required whenever the\n * loader returns data. Keys it does not declare are dropped before the page renders; a declared\n * field of the wrong shape fails the request with a 500 naming the field's path.\n */\n readonly loaderOutput?: StandardSchemaV1;\n /** Backend half only: the schema of what {@link action} sends back, held to the same rule. */\n readonly actionOutput?: StandardSchemaV1;\n /** 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 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}",
12643
12862
  "doc": "/** A route module - the default component + optional loader / action / meta. */"
12644
12863
  },
12645
12864
  {
@@ -12684,14 +12903,14 @@
12684
12903
  "name": "RouteSchema",
12685
12904
  "kind": "interface",
12686
12905
  "package": "@nifrajs/core",
12687
- "signature": "export interface RouteSchema {\n /** Explicit external-protocol mode. The handler owns raw `c.req` parsing/streaming; no JSON body\n * parser or schema-driven 422 path is installed. A finite transport cap still applies by default. */\n readonly wire?: \"raw\";\n /**\n * Choose trust-boundary order for sensitive routes. Public routes validate first by default;\n * routes with `authenticate()` default to auth first. `validate-before-auth` is an explicit\n * compatibility escape hatch, while `auth-before-validation` can reject without parsing the body.\n */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability.\n *\n * 'unlimited' is legal only for schema-less streaming/upload routes. It is rejected with `body` or\n * `idempotency`, because those lanes buffer the body before user code can apply a protocol-specific\n * bound. Read an unlimited route from `c.req.body` as a stream and bound it by the protocol it speaks;\n * `nifra.body-bounded` is deliberately NOT published for an unlimited route. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema. Header names are normalized to lower-case and the validated\n * output is exposed as `c.headers`; use lower-case keys because HTTP header names are\n * case-insensitive. */\n readonly headers?: StandardSchemaV1;\n /** Optional request-cookie schema. It validates the cookies parsed from the `Cookie` header -\n * names as sent, values URL-decoded strings, the first of a repeated name - before the handler\n * runs, and the validated output is `c.cookies`. A failure is a `422`, like `headers`. A browser\n * sends every cookie the site has set, so declare the ones the route reads with an open schema\n * (`t.cookies`, `t.looseObject`) rather than rejecting the rest. */\n readonly cookies?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`cookies`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\" | \"cookies\") => Response | unknown | Promise<Response | unknown>;\n}",
12906
+ "signature": "export interface RouteSchema {\n /** Explicit external-protocol mode. The handler owns raw `c.req` parsing/streaming; no JSON body\n * parser or schema-driven 422 path is installed. A finite transport cap still applies by default. */\n readonly wire?: \"raw\";\n /**\n * Choose trust-boundary order for sensitive routes. Public routes validate first by default;\n * routes with `authenticate()` default to auth first. `validate-before-auth` is an explicit\n * compatibility escape hatch, while `auth-before-validation` can reject without parsing the body.\n */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability.\n *\n * 'unlimited' is legal only for schema-less streaming/upload routes. It is rejected with `body` or\n * `idempotency`, because those lanes buffer the body before user code can apply a protocol-specific\n * bound. Read an unlimited route from `c.req.body` as a stream and bound it by the protocol it speaks;\n * `nifra.body-bounded` is deliberately NOT published for an unlimited route. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema; the validated output is `c.headers` and a failure is a `422`.\n * Every client sends headers a route never declares (`host`, `user-agent`, `accept`), so a closed\n * object schema (`t.object`) validates only the names it declares, each read case-insensitively and\n * keyed as declared. `t.headers` is the open form: it receives every header, names lower-cased,\n * and coerces values like `t.query`. A schema that does not expose its JSON Schema (a zod\n * `.strict()` or valibot `strictObject`) receives every header, so declare it open. */\n readonly headers?: StandardSchemaV1;\n /** Optional request-cookie schema. It validates the cookies parsed from the `Cookie` header -\n * names as sent, values URL-decoded strings, the first of a repeated name - before the handler\n * runs, and the validated output is `c.cookies`. A failure is a `422`, like `headers`. A browser\n * sends every cookie the site has set, so declare the ones the route reads with an open schema\n * (`t.cookies`, `t.looseObject`) rather than rejecting the rest. */\n readonly cookies?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`cookies`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\" | \"cookies\") => Response | unknown | Promise<Response | unknown>;\n}",
12688
12907
  "doc": "/** Per-route input schemas. Each is any Standard Schema (zod/valibot/arktype/…). */"
12689
12908
  },
12690
12909
  {
12691
12910
  "name": "RouteSchema",
12692
12911
  "kind": "interface",
12693
12912
  "package": "nifra",
12694
- "signature": "export interface RouteSchema {\n /** Explicit external-protocol mode. The handler owns raw `c.req` parsing/streaming; no JSON body\n * parser or schema-driven 422 path is installed. A finite transport cap still applies by default. */\n readonly wire?: \"raw\";\n /**\n * Choose trust-boundary order for sensitive routes. Public routes validate first by default;\n * routes with `authenticate()` default to auth first. `validate-before-auth` is an explicit\n * compatibility escape hatch, while `auth-before-validation` can reject without parsing the body.\n */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability.\n *\n * 'unlimited' is legal only for schema-less streaming/upload routes. It is rejected with `body` or\n * `idempotency`, because those lanes buffer the body before user code can apply a protocol-specific\n * bound. Read an unlimited route from `c.req.body` as a stream and bound it by the protocol it speaks;\n * `nifra.body-bounded` is deliberately NOT published for an unlimited route. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema. Header names are normalized to lower-case and the validated\n * output is exposed as `c.headers`; use lower-case keys because HTTP header names are\n * case-insensitive. */\n readonly headers?: StandardSchemaV1;\n /** Optional request-cookie schema. It validates the cookies parsed from the `Cookie` header -\n * names as sent, values URL-decoded strings, the first of a repeated name - before the handler\n * runs, and the validated output is `c.cookies`. A failure is a `422`, like `headers`. A browser\n * sends every cookie the site has set, so declare the ones the route reads with an open schema\n * (`t.cookies`, `t.looseObject`) rather than rejecting the rest. */\n readonly cookies?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`cookies`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\" | \"cookies\") => Response | unknown | Promise<Response | unknown>;\n}",
12913
+ "signature": "export interface RouteSchema {\n /** Explicit external-protocol mode. The handler owns raw `c.req` parsing/streaming; no JSON body\n * parser or schema-driven 422 path is installed. A finite transport cap still applies by default. */\n readonly wire?: \"raw\";\n /**\n * Choose trust-boundary order for sensitive routes. Public routes validate first by default;\n * routes with `authenticate()` default to auth first. `validate-before-auth` is an explicit\n * compatibility escape hatch, while `auth-before-validation` can reject without parsing the body.\n */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability.\n *\n * 'unlimited' is legal only for schema-less streaming/upload routes. It is rejected with `body` or\n * `idempotency`, because those lanes buffer the body before user code can apply a protocol-specific\n * bound. Read an unlimited route from `c.req.body` as a stream and bound it by the protocol it speaks;\n * `nifra.body-bounded` is deliberately NOT published for an unlimited route. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema; the validated output is `c.headers` and a failure is a `422`.\n * Every client sends headers a route never declares (`host`, `user-agent`, `accept`), so a closed\n * object schema (`t.object`) validates only the names it declares, each read case-insensitively and\n * keyed as declared. `t.headers` is the open form: it receives every header, names lower-cased,\n * and coerces values like `t.query`. A schema that does not expose its JSON Schema (a zod\n * `.strict()` or valibot `strictObject`) receives every header, so declare it open. */\n readonly headers?: StandardSchemaV1;\n /** Optional request-cookie schema. It validates the cookies parsed from the `Cookie` header -\n * names as sent, values URL-decoded strings, the first of a repeated name - before the handler\n * runs, and the validated output is `c.cookies`. A failure is a `422`, like `headers`. A browser\n * sends every cookie the site has set, so declare the ones the route reads with an open schema\n * (`t.cookies`, `t.looseObject`) rather than rejecting the rest. */\n readonly cookies?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`cookies`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\" | \"cookies\") => Response | unknown | Promise<Response | unknown>;\n}",
12695
12914
  "doc": "/** Per-route input schemas. Each is any Standard Schema (zod/valibot/arktype/…). */"
12696
12915
  },
12697
12916
  {
@@ -13211,7 +13430,7 @@
13211
13430
  "name": "SERVER_ENTRY_OPTIONS",
13212
13431
  "kind": "const",
13213
13432
  "package": "@nifrajs/web",
13214
- "signature": "export declare const SERVER_ENTRY_OPTIONS: readonly [\"apiPrefix\", \"apiStrip\", \"mounts\", \"csp\", \"nonce\"];",
13433
+ "signature": "export declare const SERVER_ENTRY_OPTIONS: readonly [\"apiPrefix\", \"apiStrip\", \"mounts\", \"csp\", \"nonce\", \"i18n\"];",
13215
13434
  "doc": "/** The `createWebApp` options a generated server entry can import from the app's framework module. */"
13216
13435
  },
13217
13436
  {
@@ -13794,14 +14013,14 @@
13794
14013
  "name": "Server",
13795
14014
  "kind": "class",
13796
14015
  "package": "@nifrajs/core",
13797
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\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 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 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 * 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.\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.\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 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.\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).\n * Order-scoped: captured by routes declared *after* this call, none before; one added after the last\n * route reaches nothing (see {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n */\n 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. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** 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 private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
14016
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly 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 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 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 * 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.\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.\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.\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 nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** 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 private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
13798
14017
  "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 */"
13799
14018
  },
13800
14019
  {
13801
14020
  "name": "Server",
13802
14021
  "kind": "class",
13803
14022
  "package": "nifra",
13804
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\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 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 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 * 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.\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.\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 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.\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).\n * Order-scoped: captured by routes declared *after* this call, none before; one added after the last\n * route reaches nothing (see {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n */\n 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. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** 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 private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
14023
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly 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 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 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 * 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.\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.\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.\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 nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** 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 private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
13805
14024
  "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 */"
13806
14025
  },
13807
14026
  {
@@ -14042,13 +14261,13 @@
14042
14261
  "name": "ServerOptions",
14043
14262
  "kind": "interface",
14044
14263
  "package": "@nifrajs/core",
14045
- "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). Clean payloads\n * pay a substring pre-scan only - the deep walk runs solely on suspect text.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\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 /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\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`/`beforeHandle`/`around`/`aroundCapability`/\n * `afterHandle`/`onError`/`decorate`) covers no route because it was added after the last route was\n * registered. `register()` snapshots the current chain into each route as it is declared, so a hook\n * appended after every route reaches nothing and is silently dead. `\"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}"
14264
+ "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 * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`. Default: `maxBodyBytes` (1 MB). Bun and Node stop buffering at the cap,\n * so a huge frame is never held in memory; on Bun a mounted app's smaller cap, and on Deno and\n * Workers every cap, is checked after the runtime has buffered the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\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}"
14046
14265
  },
14047
14266
  {
14048
14267
  "name": "ServerOptions",
14049
14268
  "kind": "interface",
14050
14269
  "package": "nifra",
14051
- "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). Clean payloads\n * pay a substring pre-scan only - the deep walk runs solely on suspect text.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\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 /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\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`/`beforeHandle`/`around`/`aroundCapability`/\n * `afterHandle`/`onError`/`decorate`) covers no route because it was added after the last route was\n * registered. `register()` snapshots the current chain into each route as it is declared, so a hook\n * appended after every route reaches nothing and is silently dead. `\"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}"
14270
+ "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 * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`. Default: `maxBodyBytes` (1 MB). Bun and Node stop buffering at the cap,\n * so a huge frame is never held in memory; on Bun a mounted app's smaller cap, and on Deno and\n * Workers every cap, is checked after the runtime has buffered the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\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}"
14052
14271
  },
14053
14272
  {
14054
14273
  "name": "ServerZoneGuardOptions",
@@ -14146,7 +14365,7 @@
14146
14365
  "name": "SessionOptions",
14147
14366
  "kind": "interface",
14148
14367
  "package": "@nifrajs/auth",
14149
- "signature": "export interface SessionOptions {\n /** Signing secret (≥ 32 bytes), or a rotation list: the **first** secret signs new cookies and\n * any listed secret verifies, so rotating without invalidating live sessions is: prepend the new\n * secret, drop the old one after `maxAge` has elapsed. A bare secret swap (no list) invalidates\n * all existing sessions. */\n readonly secret: string | readonly string[];\n /** Provide a store for **store mode**; omit for **cookie mode** (stateless). */\n readonly store?: SessionStore;\n /** Cookie name. Default `nifra_session`. */\n readonly cookieName?: string;\n /** Session lifetime in **seconds**. Default 7 days. */\n readonly maxAge?: number;\n /** Slide the expiry forward on every commit (default `true`); `false` = fixed absolute expiry. */\n readonly rolling?: boolean;\n /** Extra cookie attributes (the session cookie is always HttpOnly; `Secure`/`SameSite=Lax`/`Path=/`\n * default via `c.set.cookie`). Pass `{ secure: false }` for local http dev. */\n readonly cookie?: SessionCookieOptions;\n /** Clock (ms) - injected for testability; production passes `() => Date.now()` (the default). */\n readonly now?: () => number;\n}"
14368
+ "signature": "export interface SessionOptions {\n /** Signing secret (≥ 32 bytes), or a rotation list: the **first** secret signs new cookies and\n * any listed secret verifies, so rotating without invalidating live sessions is: prepend the new\n * secret, drop the old one after `maxAge` has elapsed. A bare secret swap (no list) invalidates\n * all existing sessions. */\n readonly secret: string | readonly string[];\n /** Provide a store for **store mode**; omit for **cookie mode** (stateless). */\n readonly store?: SessionStore;\n /** Cookie name. Default `nifra_session`. */\n readonly cookieName?: string;\n /** Session lifetime in **seconds**. Default 7 days. */\n readonly maxAge?: number;\n /** Slide the expiry forward on every commit (default `true`); `false` = fixed absolute expiry. */\n readonly rolling?: boolean;\n /** Extra cookie attributes (the session cookie is always HttpOnly; `Secure`/`SameSite=Lax`/`Path=/`\n * default via `c.set.cookie`). Pass `{ secure: false }` for local http dev. */\n readonly cookie?: SessionCookieOptions;\n /** Clock (ms) - injected for testability; production passes `() => Date.now()` (the default). */\n readonly now?: () => number;\n /**\n * Also accept a session cookie signed by `@nifrajs/auth` before 5.0, whose signature does not cover\n * the cookie name, so upgrading from 4.x signs no one out. Off by default: while it is on, any\n * value the app signs with this secret through `@nifrajs/core`'s `signValue` (a signed preference\n * cookie, say) and that parses as a session reads as one. Turn it on for one `maxAge` after the\n * upgrade, then remove it; each such session is re-signed in the current form on its next commit.\n */\n readonly acceptLegacyCookies?: boolean;\n}"
14150
14369
  },
14151
14370
  {
14152
14371
  "name": "SessionRecord",
@@ -14393,6 +14612,13 @@
14393
14612
  "signature": "export type SourceReader = (file: string) => string | undefined;",
14394
14613
  "doc": "/** Reads a source file's text, or returns undefined if it cannot (missing, binary, permission). */"
14395
14614
  },
14615
+ {
14616
+ "name": "SourceTransform",
14617
+ "kind": "type",
14618
+ "package": "@nifrajs/web",
14619
+ "signature": "export type SourceTransform = (path: string, source: string) => string | undefined;",
14620
+ "doc": "/** A rewrite of a source file's text before any plugin compiles it; `undefined` leaves the text as is. */"
14621
+ },
14396
14622
  {
14397
14623
  "name": "SpanKind",
14398
14624
  "kind": "type",
@@ -14407,6 +14633,13 @@
14407
14633
  "signature": "export type SpanStatus = \"unset\" | \"ok\" | \"error\";",
14408
14634
  "doc": "/**\n * The span model + exporter seam. Attribute names follow OpenTelemetry HTTP semantic conventions\n * (`http.request.method`, `url.path`, `http.response.status_code`, …) so a span maps cleanly onto an\n * OTel `Span` when bridged - but nothing here depends on the OTel SDK. You supply an\n * {@link ObservationAdapter}\n * (a ~10-line adapter to `@opentelemetry/api`, or the bundled {@link consoleSpanExporter}).\n */"
14409
14635
  },
14636
+ {
14637
+ "name": "SplitTable",
14638
+ "kind": "interface",
14639
+ "package": "@nifrajs/i18n",
14640
+ "signature": "export interface SplitTable {\n readonly id: string;\n readonly values: Readonly<Record<string, CopyValue>>;\n readonly locales: Locales;\n}",
14641
+ "doc": "/** A table a client build split, with the registry its definition reads. */"
14642
+ },
14410
14643
  {
14411
14644
  "name": "SqliteDatabaseLike",
14412
14645
  "kind": "interface",
@@ -14823,7 +15056,7 @@
14823
15056
  "name": "StoredJob",
14824
15057
  "kind": "interface",
14825
15058
  "package": "@nifrajs/jobs",
14826
- "signature": "export interface StoredJob {\n readonly id: string;\n readonly name: string;\n readonly payload: unknown;\n readonly attempt: number;\n readonly maxAttempts: number;\n /**\n * The producer's W3C `traceparent`, as given to {@link JobStore.enqueue}. A store that does not\n * persist it still runs every job; only the link between the producer's and the run's spans is lost.\n */\n readonly traceparent?: string;\n}",
15059
+ "signature": "export interface StoredJob {\n readonly id: string;\n readonly name: string;\n readonly payload: unknown;\n readonly attempt: number;\n readonly maxAttempts: number;\n /**\n * The producer's W3C `traceparent`, as given to {@link JobStore.enqueue}. A store that does not\n * persist it still runs every job; only the link between the producer's and the run's spans is lost.\n */\n readonly traceparent?: string;\n /**\n * This lease's token, new on every `lease`. The queue hands it back to `complete`, `retry`,\n * `deadLetter` and `renew`, so a store can ignore a call from a worker whose lease ran out and\n * was taken by another. A store without tokens leaves it unset.\n */\n readonly lease?: string;\n}",
14827
15060
  "doc": "/** A job as handed back by {@link JobStore.lease}. `attempt` is the count of PRIOR attempts (0 the first time). */"
14828
15061
  },
14829
15062
  {
@@ -14983,6 +15216,13 @@
14983
15216
  "package": "@nifrajs/web",
14984
15217
  "signature": "export interface SvgToJsxOptions {\n /** The JSX prop name for `class`. `\"className\"` for React/Preact; `\"class\"` for Solid. */\n readonly classProp?: string;\n}"
14985
15218
  },
15219
+ {
15220
+ "name": "TableCatalogs",
15221
+ "kind": "interface",
15222
+ "package": "@nifrajs/i18n",
15223
+ "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}",
15224
+ "doc": "/** Copy tables as one catalog per locale, for {@link checkCatalogs}. */"
15225
+ },
14986
15226
  {
14987
15227
  "name": "Template",
14988
15228
  "kind": "class",
@@ -15688,14 +15928,14 @@
15688
15928
  "name": "VERSION",
15689
15929
  "kind": "const",
15690
15930
  "package": "@nifrajs/core",
15691
- "signature": "export declare const VERSION: \"5.0.0\";",
15931
+ "signature": "export declare const VERSION: \"5.2.0\";",
15692
15932
  "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 */"
15693
15933
  },
15694
15934
  {
15695
15935
  "name": "VERSION",
15696
15936
  "kind": "const",
15697
15937
  "package": "nifra",
15698
- "signature": "export declare const VERSION: \"5.0.0\";",
15938
+ "signature": "export declare const VERSION: \"5.2.0\";",
15699
15939
  "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 */"
15700
15940
  },
15701
15941
  {
@@ -15827,6 +16067,13 @@
15827
16067
  "signature": "export interface WasmImageCodecs {\n /** Decode any supported encoded image → RGBA. Throw on undecodable input. */\n decode(bytes: Uint8Array): Promise<DecodedImage> | DecodedImage;\n /**\n * Whether `decode` already applies a JPEG's EXIF orientation. Left unset, the backend turns the\n * pixels itself unless a quarter-turn image visibly decoded to its displayed size; a square image\n * cannot show that, so it is always turned. jSquash's JPEG decoder does not orient.\n */\n readonly orientsJpeg?: boolean;\n /** Resize RGBA to the target dimensions (the handler keeps the aspect ratio). */\n resize(image: DecodedImage, width: number, height: number): Promise<DecodedImage> | DecodedImage;\n /** Encode RGBA → the target format's bytes. */\n encode(image: DecodedImage, format: OutputFormat, quality: number): Promise<Uint8Array> | Uint8Array;\n}",
15828
16068
  "doc": "/**\n * Pluggable WASM codec set - decode/resize/encode. Declared structurally so `@nifrajs/image` depends on no\n * WASM library; wire your own (jSquash is the common pure-WASM, edge-safe choice). The handler probes\n * dimensions from the source header (bomb-safe), so `decode` runs only inside `transform`.\n */"
15829
16069
  },
16070
+ {
16071
+ "name": "WebAppI18n",
16072
+ "kind": "interface",
16073
+ "package": "@nifrajs/web",
16074
+ "signature": "export interface WebAppI18n {\n readonly locales: {\n readonly default: string;\n /** Served locale keys, in registry order. */\n readonly served: readonly string[];\n documentMeta(key: string): {\n readonly lang: string;\n readonly dir: \"ltr\" | \"rtl\";\n };\n };\n localeOf(path: string): string;\n matchSegment(value: string | undefined, pathname: string): {\n readonly kind: \"ok\" | \"not-found\";\n } | {\n readonly kind: \"redirect\";\n readonly location: string;\n };\n}",
16075
+ "doc": "/** An app's locale routing as `createWebApp` reads it: what `defineI18nRouting()` from\n * `@nifrajs/i18n/routing` returns. */"
16076
+ },
15830
16077
  {
15831
16078
  "name": "WebMcpExecuteContext",
15832
16079
  "kind": "interface",
@@ -15922,7 +16169,7 @@
15922
16169
  "name": "WebSocketHubApp",
15923
16170
  "kind": "interface",
15924
16171
  "package": "@nifrajs/workers",
15925
- "signature": "export interface WebSocketHubApp<Env = unknown> {\n resolveWebSocketUpgrade(request: Request, platform?: {\n readonly env: Env;\n readonly waitUntil: (promise: Promise<unknown>) => void;\n }): WebSocketUpgradeOutcome | Promise<WebSocketUpgradeOutcome>;\n}",
16172
+ "signature": "export interface WebSocketHubApp<Env = unknown> {\n resolveWebSocketUpgrade(request: Request, platform?: {\n readonly env: Env;\n readonly waitUntil: (promise: Promise<unknown>) => void;\n }): WebSocketUpgradeOutcome | Promise<WebSocketUpgradeOutcome>;\n /** Answers an upgrade request for a path with no WebSocket route, as `fetch` does on every other\n * runtime. An app without it gets `426`. */\n fetch?(request: Request, platform?: {\n readonly env: Env;\n readonly waitUntil: (promise: Promise<unknown>) => void;\n }): Response | Promise<Response>;\n}",
15926
16173
  "doc": "/** The nifra-app surface the hub needs - every `server()` app satisfies it. */"
15927
16174
  },
15928
16175
  {
@@ -15936,14 +16183,14 @@
15936
16183
  "name": "WebSocketUpgradeOutcome",
15937
16184
  "kind": "type",
15938
16185
  "package": "@nifrajs/core",
15939
- "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n readonly maxPayloadBytes?: number;\n};",
16186
+ "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n readonly maxPayloadBytes?: number;\n /** Builds `ws.send` over an adapter's native send, enforcing the route's {@link\n * WebSocketHandler.validateSend}. Set on every outcome a nifra app produces; an adapter that\n * wires its own sockets instead of calling `attach` (Node, Deno) builds `send` with it. */\n readonly sender?: WsSender;\n};",
15940
16187
  "doc": "/**\n * The outcome of `app.resolveWebSocketUpgrade(req)` - for serving adapters:\n * - `pass` - not a WS upgrade for a registered WS route; handle as a normal HTTP request.\n * - `reject` - a WS route matched but `upgrade()` rejected (or the path was malformed); return `response`.\n * - `upgrade` - perform the runtime upgrade, then dispatch the native socket's events to `handler`,\n * seeding `ws.data` with `data`.\n */"
15941
16188
  },
15942
16189
  {
15943
16190
  "name": "WebSocketUpgradeOutcome",
15944
16191
  "kind": "type",
15945
16192
  "package": "nifra",
15946
- "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n readonly maxPayloadBytes?: number;\n};",
16193
+ "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n readonly maxPayloadBytes?: number;\n /** Builds `ws.send` over an adapter's native send, enforcing the route's {@link\n * WebSocketHandler.validateSend}. Set on every outcome a nifra app produces; an adapter that\n * wires its own sockets instead of calling `attach` (Node, Deno) builds `send` with it. */\n readonly sender?: WsSender;\n};",
15947
16194
  "doc": "/**\n * The outcome of `app.resolveWebSocketUpgrade(req)` - for serving adapters:\n * - `pass` - not a WS upgrade for a registered WS route; handle as a normal HTTP request.\n * - `reject` - a WS route matched but `upgrade()` rejected (or the path was malformed); return `response`.\n * - `upgrade` - perform the runtime upgrade, then dispatch the native socket's events to `handler`,\n * seeding `ws.data` with `data`.\n */"
15948
16195
  },
15949
16196
  {
@@ -15990,7 +16237,7 @@
15990
16237
  "name": "WireDecodeLimits",
15991
16238
  "kind": "interface",
15992
16239
  "package": "@nifrajs/core",
15993
- "signature": "export interface WireDecodeLimits {\n /** Maximum number of interned nodes. Default 10,000. */\n readonly maxNodes?: number;\n /** Maximum nesting depth across containers and references. Default 256. */\n readonly maxDepth?: number;\n /** Maximum total object/array/map/set entries visited. Default 100,000. */\n readonly maxCollectionEntries?: number;\n /** Maximum UTF-8 string plus decoded binary bytes materialized. Default 16 MiB. */\n readonly maxDecodedBytes?: number;\n}",
16240
+ "signature": "export interface WireDecodeLimits {\n /** Maximum number of interned nodes. Default 10,000. */\n readonly maxNodes?: number;\n /** Maximum nesting depth across containers and references. Default 256. */\n readonly maxDepth?: number;\n /** Maximum total object/array/map/set entries visited. Default 100,000. */\n readonly maxCollectionEntries?: number;\n /** Maximum UTF-8 string plus decoded binary bytes materialized. Default 16 MiB. */\n readonly maxDecodedBytes?: number;\n /**\n * Maximum decimal digits in one `bigint`. Default 4,096 (past 8192-bit integers). Parsing grows\n * faster than the digit count, so one long token would cost seconds of CPU under the byte limit.\n */\n readonly maxBigIntDigits?: number;\n}",
15994
16241
  "doc": "/** Resource limits applied while reconstructing transport-controlled wire data. */"
15995
16242
  },
15996
16243
  {
@@ -16059,7 +16306,7 @@
16059
16306
  "name": "WorkerOptions",
16060
16307
  "kind": "interface",
16061
16308
  "package": "@nifrajs/jobs",
16062
- "signature": "export interface WorkerOptions {\n /** Max jobs in flight at once. Default 1. A slot frees as soon as its job settles, and the next poll fills it. */\n readonly concurrency?: number;\n /** How often to poll the store for due jobs (ms). Default 250. */\n readonly pollIntervalMs?: number;\n /** How long a leased job is hidden before it's considered abandoned and re-leased (ms). Default 30_000. */\n readonly leaseMs?: number;\n /** Called when a poll round fails (the store's `lease` threw); polling continues on the next tick.\n * Default: `console.error`. A throwing handler here is swallowed. */\n readonly onPollError?: (error: unknown) => void;\n}"
16309
+ "signature": "export interface WorkerOptions {\n /** Max jobs in flight at once. Default 1. A slot frees as soon as its job settles, and the next poll fills it. */\n readonly concurrency?: number;\n /** How often to poll the store for due jobs (ms). Default 250. */\n readonly pollIntervalMs?: number;\n /** How long a leased job is hidden before it's considered abandoned and re-leased (ms). Default\n * 30_000. A store with `renew` keeps a running job's lease alive; every job's `timeoutMs` must be\n * below it. */\n readonly leaseMs?: number;\n /** Called when a poll round fails (the store's `lease` threw) or a lease renewal fails; polling\n * continues on the next tick. Default: `console.error`. A throwing handler here is swallowed. */\n readonly onPollError?: (error: unknown) => void;\n}"
16063
16310
  },
16064
16311
  {
16065
16312
  "name": "WorkersCacheLike",
@@ -16121,7 +16368,7 @@
16121
16368
  "name": "WsCallOptions",
16122
16369
  "kind": "interface",
16123
16370
  "package": "@nifrajs/client",
16124
- "signature": "export interface WsCallOptions {\n query?: Record<string, string | number | boolean>;\n /** WebSocket subprotocols. A browser handshake cannot carry custom headers - authenticate via\n * `upgrade()` reading cookies/query/subprotocol, not an Authorization header. */\n protocols?: string | string[];\n /** Abort to close the socket (same effect as calling `close()`). */\n signal?: AbortSignal;\n /** Socket-level failures (connection refused, abnormal close). */\n onError?: (error: unknown) => void;\n}"
16371
+ "signature": "export interface WsCallOptions {\n /** Sent on the handshake URL as an HTTP call sends it: an array repeats its key once per item,\n * and an `undefined` value is left out. */\n query?: Record<string, string | number | boolean | readonly (string | number | boolean)[] | undefined>;\n /** WebSocket subprotocols. A browser handshake cannot carry custom headers - authenticate via\n * `upgrade()` reading cookies/query/subprotocol, not an Authorization header. */\n protocols?: string | string[];\n /** Abort to close the socket (same effect as calling `close()`). */\n signal?: AbortSignal;\n /** Socket-level failures (connection refused, abnormal close). */\n onError?: (error: unknown) => void;\n}"
16125
16372
  },
16126
16373
  {
16127
16374
  "name": "WsHandle",
@@ -16140,7 +16387,7 @@
16140
16387
  "name": "ZoneClassifier",
16141
16388
  "kind": "interface",
16142
16389
  "package": "@nifrajs/web",
16143
- "signature": "export interface ZoneClassifier {\n readonly appRoot: string;\n /** Classify a file by its absolute (or appRoot-relative) path. Results are cached per path. */\n classify(file: string): Classification;\n}"
16390
+ "signature": "export interface ZoneClassifier {\n readonly appRoot: string;\n /**\n * Classify a file by its absolute (or appRoot-relative) path. Results are cached per path.\n *\n * With `specifier`, the import as written that resolved to `file`: when it names a package that\n * gives each export entry its own side (`\"nifra\": { \"environment\": { \".\": \"backend\", \"./react\":\n * \"frontend\" } }`), the entry it names decides, since two entries may share one file. A specifier\n * naming an entry the map leaves out is an error. The resolved file must belong to that entry, as\n * the package's own imports reach it; one only other entries reach is judged by its path.\n */\n classify(file: string, specifier?: string): Classification;\n}"
16144
16391
  },
16145
16392
  {
16146
16393
  "name": "ZoneClassifierOptions",
@@ -16152,7 +16399,7 @@
16152
16399
  "name": "ZoneConfig",
16153
16400
  "kind": "interface",
16154
16401
  "package": "@nifrajs/web",
16155
- "signature": "export interface ZoneConfig {\n /**\n * The side of a package that does not declare one in its own package.json, by name: exact\n * (`\"@shop/db\"`) or a trailing-`*` prefix (`\"@shop/*\"`). The exact name wins over a prefix, the\n * longest prefix over a shorter one, and a package's own declaration over all of them.\n */\n readonly packages?: Readonly<Record<string, PackageEnvironment>>;\n /** App-relative folders holding backend code, beside `backend/` (`\"migrations\"`). */\n readonly backend?: readonly string[];\n /** App-relative folders holding frontend code, beside `frontend/`. */\n readonly frontend?: readonly string[];\n /** App-relative folders holding code both sides import, beside `shared/`. */\n readonly shared?: readonly string[];\n}",
16402
+ "signature": "export interface ZoneConfig {\n /**\n * The side of a package that does not declare one in its own package.json, by name: exact\n * (`\"@shop/db\"`) or a trailing-`*` prefix (`\"@shop/*\"`). The exact name wins over a prefix, the\n * longest prefix over a shorter one, and a package's own declaration over all of them.\n */\n readonly packages?: Readonly<Record<string, PackageEnvironment>>;\n /**\n * App-relative folders or files holding backend code, beside `backend/` (`\"migrations\"`). A path\n * listed inside another one's folder overrides it: the most specific entry wins.\n */\n readonly backend?: readonly string[];\n /** App-relative folders or files holding frontend code, beside `frontend/`. */\n readonly frontend?: readonly string[];\n /** App-relative folders or files holding code both sides import, beside `shared/`. */\n readonly shared?: readonly string[];\n}",
16156
16403
  "doc": "/**\n * App-side zone settings, read from `\"nifra\": { \"zones\": ... }` in the app's package.json so every\n * build, dev server, `nifra check` and the editor plugin see the same ones without running app code.\n */"
16157
16404
  },
16158
16405
  {
@@ -16162,6 +16409,13 @@
16162
16409
  "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}",
16163
16410
  "doc": "/** A `\"nifra\": { \"zones\": ... }` setting that cannot be applied. Thrown when a classifier is created. */"
16164
16411
  },
16412
+ {
16413
+ "name": "addSourceTransform",
16414
+ "kind": "function",
16415
+ "package": "@nifrajs/web",
16416
+ "signature": "export declare function addSourceTransform(build: PluginBuilder, transform: SourceTransform): void;",
16417
+ "doc": "/**\n * Register a source rewrite for one build. Bun runs only the first `onLoad` that returns contents, so\n * a plugin that claims a file and reads it off disk would compile it without the rewrite: such a plugin\n * reads through {@link readSource} instead. Stored on the build's config, which every plugin of one\n * `Bun.build` shares.\n */"
16418
+ },
16165
16419
  {
16166
16420
  "name": "admitCapability",
16167
16421
  "kind": "function",
@@ -16207,7 +16461,7 @@
16207
16461
  "name": "agentsMcpSection",
16208
16462
  "kind": "function",
16209
16463
  "package": "create-nifra",
16210
- "signature": "export declare function agentsMcpSection(): string;",
16464
+ "signature": "export declare function agentsMcpSection(pin?: string): string;",
16211
16465
  "doc": "/**\n * The \"## MCP server\" section appended to a scaffolded (or retrofitted) `AGENTS.md`, so non-Claude\n * agents (Cursor, and anything that reads `AGENTS.md`) also learn the MCP exists and what to prefer.\n * Mirrors the CLAUDE.md preamble's guidance without the Claude-specific `@import`.\n */"
16212
16466
  },
16213
16467
  {
@@ -16260,7 +16514,7 @@
16260
16514
  "name": "applyHead",
16261
16515
  "kind": "function",
16262
16516
  "package": "@nifrajs/web",
16263
- "signature": "export declare function applyHead(head: Meta): void;",
16517
+ "signature": "export declare function applyHead(head: Meta, path?: string): void;",
16264
16518
  "doc": "/**\n * Sync the document head to a route's resolved {@link Meta} on client navigation. Sets the title\n * (when provided) and replaces the **managed** (`data-nifra`) `<meta>`/`<link>` tags - static head\n * content (charset, hand-written tags) is never touched. SSR injects the same `data-nifra` tags, so\n * the first navigation cleanly takes over from the server-rendered head.\n */"
16265
16519
  },
16266
16520
  {
@@ -16274,7 +16528,8 @@
16274
16528
  "name": "approvalRequestFromEvent",
16275
16529
  "kind": "function",
16276
16530
  "package": "@nifrajs/coding-agent",
16277
- "signature": "export declare function approvalRequestFromEvent(event: AgentApprovalRequiredEvent): ApprovalRequest;"
16531
+ "signature": "export declare function approvalRequestFromEvent(event: AgentApprovalRequiredEvent, timeoutMs?: ApprovalTimeout): ApprovalRequest;",
16532
+ "doc": "/**\n * Project a backend approval event into a request. Pass the broker's timeout\n * (`ApprovalManager.timeoutMs`) so `expiresAt` matches when it will actually be denied; the default\n * is the broker's default of 5 minutes.\n */"
16278
16533
  },
16279
16534
  {
16280
16535
  "name": "approvalResolvedEvent",
@@ -16956,14 +17211,14 @@
16956
17211
  "name": "checkResponseContract",
16957
17212
  "kind": "function",
16958
17213
  "package": "@nifrajs/core",
16959
- "signature": "export declare function checkResponseContract(schema: StandardSchemaV1, result: unknown, mode: \"warn\" | \"enforce\"): ResponseContractOutcome | Promise<ResponseContractOutcome>;",
17214
+ "signature": "export declare function checkResponseContract(schema: StandardSchemaV1, result: unknown, mode: \"warn\" | \"enforce\", options?: ResponseContractOptions): ResponseContractOutcome | Promise<ResponseContractOutcome>;",
16960
17215
  "doc": "/**\n * Check one result against the route's declared response schema.\n *\n * Returns synchronously when the schema does (the common case), so an app that opts in does not pay a\n * microtask per response for a check that had no work to do.\n */"
16961
17216
  },
16962
17217
  {
16963
17218
  "name": "checkRouteResponseContract",
16964
17219
  "kind": "function",
16965
17220
  "package": "@nifrajs/core",
16966
- "signature": "export declare function checkRouteResponseContract(definition: ResponseContractDefinition, result: unknown, mode: \"warn\" | \"enforce\", jsonReply?: {\n readonly body: unknown;\n}): ResponseContractOutcome | Promise<ResponseContractOutcome>;",
17221
+ "signature": "export declare function checkRouteResponseContract(definition: ResponseContractDefinition, result: unknown, mode: \"warn\" | \"enforce\", jsonReply?: {\n readonly body: unknown;\n}, options?: ResponseContractOptions): ResponseContractOutcome | Promise<ResponseContractOutcome>;",
16967
17222
  "doc": "/**\n * Check a route's success or status-specific error payload. Plain `status()` results retain their\n * status while enforcement replaces only the body with the validator's output. A `c.json(...)`\n * reply is held to the contract through the value it was built from (`jsonReply`). Any other raw\n * `Response` remains an explicit transport escape hatch because inspecting it would consume\n * streams or alter redirects; assurance/static checks must govern that path separately.\n */"
16968
17223
  },
16969
17224
  {
@@ -17384,6 +17639,20 @@
17384
17639
  "signature": "export declare function copilotInstructions(): string;",
17385
17640
  "doc": "/** `.github/copilot-instructions.md`: Copilot has no import syntax, so this names the file. */"
17386
17641
  },
17642
+ {
17643
+ "name": "copyChunkId",
17644
+ "kind": "function",
17645
+ "package": "@nifrajs/i18n",
17646
+ "signature": "export declare function copyChunkId(id: string): string;",
17647
+ "doc": "/**\n * A short, stable id for a table in a client build's chunks: 40 bits of FNV-1a over its readable id,\n * in base 36. The build and the chunks it writes must agree, so both call this.\n */"
17648
+ },
17649
+ {
17650
+ "name": "copyChunks",
17651
+ "kind": "function",
17652
+ "package": "@nifrajs/i18n",
17653
+ "signature": "export declare function copyChunks(tables: Iterable<SplitTable>): Map<string, CopyChunk>;",
17654
+ "doc": "/**\n * The chunk each locale of a client build loads: every table's value in that locale, or, where it has\n * none, the value `locales.chain()` falls back to, so a page needs no other locale's chunk.\n */"
17655
+ },
17387
17656
  {
17388
17657
  "name": "copyPublicDir",
17389
17658
  "kind": "function",
@@ -17391,6 +17660,13 @@
17391
17660
  "signature": "export declare function copyPublicDir(from: string, to: string): Promise<string[]>;",
17392
17661
  "doc": "/**\n * Copy `from` into `to`, returning the URL paths copied (sorted).\n *\n * Lives here, not beside `servePublicDir`, because it is BUILD-time: it reaches for `Bun.Glob` and\n * `node:fs`, and `public-dir.ts` is reachable from the client bundle graph through the package\n * entry - a dynamic `import(\"bun\")` there fails the browser build outright.\n */"
17393
17662
  },
17663
+ {
17664
+ "name": "copyRef",
17665
+ "kind": "function",
17666
+ "package": "@nifrajs/i18n",
17667
+ "signature": "export declare function copyRef(id: string): CopyTable;",
17668
+ "doc": "/**\n * The table id a production client build emits in place of a table's values. Build output only:\n * apps write {@link Copy} calls.\n */"
17669
+ },
17394
17670
  {
17395
17671
  "name": "cors",
17396
17672
  "kind": "function",
@@ -17476,6 +17752,13 @@
17476
17752
  "package": "@nifrajs/web",
17477
17753
  "signature": "export declare function createClientRouter(options: ClientRouterOptions): ClientRouter;"
17478
17754
  },
17755
+ {
17756
+ "name": "createCopyScanner",
17757
+ "kind": "function",
17758
+ "package": "@nifrajs/i18n",
17759
+ "signature": "export declare function createCopyScanner(ts: typeof TS, host: CopySourceHost): CopyScanner;",
17760
+ "doc": "/**\n * Scan a project's copy tables. Modules are parsed once each, on first use.\n *\n * ```ts\n * const scanner = createCopyScanner(ts, { root, read: (file) => readFileSync(file, \"utf8\") })\n * for (const table of scanner.tables(`${root}/routes/index.tsx`)) console.log(table.id, table.values)\n * ```\n */"
17761
+ },
17479
17762
  {
17480
17763
  "name": "createCspPolicy",
17481
17764
  "kind": "function",
@@ -17560,7 +17843,7 @@
17560
17843
  "kind": "function",
17561
17844
  "package": "@nifrajs/middleware",
17562
17845
  "signature": "export declare function createEventLoopLagSampler(resolutionMs?: number, monitor?: LoopDelayMonitor): () => number;",
17563
- "doc": "/**\n * Event-loop-lag sampler. By default it measures timer drift using only Web/JS runtime primitives, so\n * it works under Node ESM, Bun, Deno, and workers without a hidden CommonJS `require` fallback. An\n * injected histogram remains available for deterministic tests or a runtime-native monitor. Each read\n * returns recent mean lag and resets the sampling window.\n */"
17846
+ "doc": "/**\n * Event-loop-lag sampler. By default it measures timer drift using only Web/JS runtime primitives, so\n * it works under Node ESM, Bun, Deno, and workers without a hidden CommonJS `require` fallback. An\n * injected histogram remains available for deterministic tests or a runtime-native monitor. A read\n * returns the mean lag of the samples taken since the previous read and starts a new window; a read\n * with no new sample since then returns the same value again, so every request that arrives between\n * two samples of a lagging loop sees the lag.\n */"
17564
17847
  },
17565
17848
  {
17566
17849
  "name": "createEventRegistry",
@@ -18038,6 +18321,20 @@
18038
18321
  "signature": "export declare function declaredCapabilities(context: object): readonly string[];",
18039
18322
  "doc": "/**\n * Read the route's token-only declaration for admission plugins. This intentionally exposes neither\n * the request nor runtime evidence; it is the stable public seam for private entitlement policy.\n */"
18040
18323
  },
18324
+ {
18325
+ "name": "declaredHeaderNames",
18326
+ "kind": "function",
18327
+ "package": "@nifrajs/core",
18328
+ "signature": "export declare function declaredHeaderNames(schema: object): readonly string[] | undefined;",
18329
+ "doc": "/**\n * The names a closed header schema declares, or `undefined` when it is open or lists no names.\n * Every client sends headers no route declares (`host`, `user-agent`, `accept`), so a closed schema\n * fed the whole record would refuse all real traffic; it is fed the names it declares instead,\n * which is also how OpenAPI publishes it. A name that is not a valid header token is never sent.\n */"
18330
+ },
18331
+ {
18332
+ "name": "declaredSide",
18333
+ "kind": "function",
18334
+ "package": "@nifrajs/web",
18335
+ "signature": "export declare function declaredSide(environment: unknown, specifier: string): PackageEnvironment | undefined;",
18336
+ "doc": "/**\n * The side a package's `\"nifra\": { \"environment\": ... }` value gives the bare import `specifier` of it:\n * the package-wide string, or the side of the entry it names - the map's exact subpath, else its most\n * specific `*` pattern. `undefined` when it gives none, as a map that leaves the entry out does.\n */"
18337
+ },
18041
18338
  {
18042
18339
  "name": "decode",
18043
18340
  "kind": "function",
@@ -18193,6 +18490,13 @@
18193
18490
  "signature": "export declare function defineContract<const C extends ContractShape>(contract: C): C;",
18194
18491
  "doc": "/**\n * Define a standalone, versionable contract. Identity at runtime (it returns the\n * contract for type inference via the `const` type parameter, which preserves the\n * path/method literals) plus boot-time (L2) validation: each operation must use a\n * known method, a path starting with `/`, and no two operations may share a\n * `(method, path)`. Deeper path validation (param names, wildcard position) runs\n * when the contract is `implement`ed.\n */"
18195
18492
  },
18493
+ {
18494
+ "name": "defineCopy",
18495
+ "kind": "function",
18496
+ "package": "@nifrajs/i18n",
18497
+ "signature": "export declare function defineCopy<K extends string, D extends K>(locales: Locales<K, D>, options?: CopyOptions<K>): Copy<K, D>;",
18498
+ "doc": "/**\n * Bind copy tables to a locale registry.\n *\n * ```ts\n * // shared/i18n.ts\n * import { defineLocales } from \"@nifrajs/i18n\"\n * import { defineCopy } from \"@nifrajs/i18n/copy\"\n *\n * export const locales = defineLocales({ default: \"en\", locales: { en: {}, hi: {}, ur: { tag: \"ur-PK\" } } })\n * export const copy = defineCopy(locales)\n *\n * // routes/[[lang]]/index.tsx\n * const TITLE = copy({ en: \"Bicycle\", hi: \"साइकिल\", ur: \"سائیکل\" })\n * const FOUND = copy({ en: \"{n, plural, one {# result} other {# results}}\", hi: \"{n} परिणाम\" })\n * copy.pick(TITLE, locale)\n * copy.format(FOUND, locale, { n: 3 })\n * ```\n */"
18499
+ },
18196
18500
  {
18197
18501
  "name": "defineDataContract",
18198
18502
  "kind": "function",
@@ -18205,7 +18509,7 @@
18205
18509
  "kind": "function",
18206
18510
  "package": "@nifrajs/env",
18207
18511
  "signature": "export declare function defineEnv<S extends EnvShape>(shape: S, options?: DefineEnvOptions): EnvResult<S>;",
18208
- "doc": "/**\n * Validate the environment against a schema and return a **frozen, typed** object - or throw at\n * startup listing **every** problem at once (not just the first), so a misconfigured deploy fails\n * loud and immediately instead of erroring on the first request that touches a bad var. This is the\n * boot-time half of nifra's \"validate at every boundary\" rule, for config.\n *\n * ```ts\n * // env.ts - imported once at startup\n * import { defineEnv, env } from \"@nifrajs/env\"\n * export const ENV = defineEnv({\n * DATABASE_URL: env.url(),\n * PORT: env.port({ default: 3000 }),\n * NODE_ENV: env.enum([\"development\", \"production\", \"test\"], { default: \"development\" }),\n * STRIPE_SECRET: env.string(),\n * DEBUG: env.boolean({ default: false }),\n * })\n * // ENV.PORT: number, ENV.NODE_ENV: \"development\" | \"production\" | \"test\", … all validated.\n * ```\n *\n * Errors name the offending variable and the reason - never its value (it may be a secret); a BYO\n * validator's message that quotes the value gets `<redacted>` in its place. BYO\n * validators (`t`, zod, valibot) work too; only the `env.*` helpers coerce from strings, so a plain\n * `t.number()` would see the raw string - use `env.number()` for coercion.\n */"
18512
+ "doc": "/**\n * Validate the environment against a schema and return a **frozen, typed** object - or throw at\n * startup listing **every** problem at once (not just the first), so a misconfigured deploy fails\n * loud and immediately instead of erroring on the first request that touches a bad var. This is the\n * boot-time half of nifra's \"validate at every boundary\" rule, for config.\n *\n * ```ts\n * // env.ts - imported once at startup\n * import { defineEnv, env } from \"@nifrajs/env\"\n * export const ENV = defineEnv({\n * DATABASE_URL: env.url(),\n * PORT: env.port({ default: 3000 }),\n * NODE_ENV: env.enum([\"development\", \"production\", \"test\"], { default: \"development\" }),\n * STRIPE_SECRET: env.string(),\n * DEBUG: env.boolean({ default: false }),\n * })\n * // ENV.PORT: number, ENV.NODE_ENV: \"development\" | \"production\" | \"test\", … all validated.\n * ```\n *\n * Errors name the offending variable and the reason - never its value (it may be a secret). BYO\n * validators (`t`, zod, valibot) work too, but their messages may quote the value, so a set value\n * they refuse is reported as invalid without their words; an unset one shows their message. Only the\n * `env.*` helpers coerce from strings, so a plain `t.number()` would see the raw string - use\n * `env.number()` for coercion.\n */"
18209
18513
  },
18210
18514
  {
18211
18515
  "name": "defineEventContract",
@@ -18231,7 +18535,7 @@
18231
18535
  "name": "defineI18nRouting",
18232
18536
  "kind": "function",
18233
18537
  "package": "@nifrajs/i18n",
18234
- "signature": "export declare function defineI18nRouting<K extends string>(locales: Locales<K>, options?: I18nRoutingOptions): LocalizedRouter<K>;",
18538
+ "signature": "export declare function defineI18nRouting<K extends string>(locales: Locales<K>, options?: I18nRoutingOptions<K>): LocalizedRouter<K>;",
18235
18539
  "doc": "/**\n * Bind the app's locale-prefixed URL scheme to a {@link Locales} registry.\n *\n * ```ts\n * import { defineLocales } from \"@nifrajs/i18n\"\n * import { defineI18nRouting } from \"@nifrajs/i18n/routing\"\n *\n * const locales = defineLocales({ default: \"en\", locales: { en: {}, fr: {} } })\n * export const urls = defineI18nRouting(locales)\n * urls.localizePathname(\"/about\", \"fr\") // \"/fr/about\"\n * urls.alternates(\"/fr/about\", { origin: \"https://example.com\" }).canonical // \"https://example.com/fr/about\"\n * ```\n */"
18236
18540
  },
18237
18541
  {
@@ -18259,7 +18563,7 @@
18259
18563
  "name": "defineLocales",
18260
18564
  "kind": "function",
18261
18565
  "package": "@nifrajs/i18n",
18262
- "signature": "export declare function defineLocales<const K extends string>(config: LocalesConfig<K>): Locales<K>;",
18566
+ "signature": "export declare function defineLocales<const K extends string, const D extends K>(config: LocalesConfig<K, D>): Locales<K, D>;",
18263
18567
  "doc": "/**\n * Declare the app's locales once.\n *\n * ```ts\n * import { defineLocales } from \"@nifrajs/i18n\"\n *\n * export const locales = defineLocales({\n * default: \"en\",\n * locales: {\n * en: { hreflang: \"en-IN\" },\n * hi: { hreflang: \"hi-IN\" },\n * ur: { tag: \"ur-PK\", hreflang: \"ur\" }, // dir: \"rtl\", derived\n * gu: { draft: true }, // catalogs in progress, not served\n * },\n * })\n * ```\n */"
18264
18568
  },
18265
18569
  {
@@ -18753,7 +19057,7 @@
18753
19057
  "kind": "function",
18754
19058
  "package": "@nifrajs/core",
18755
19059
  "signature": "export declare function evaluateRouteAssurance(source: unknown, policyInput: AssurancePolicy, options?: AssuranceEvaluationOptions): AssuranceReport;",
18756
- "doc": "/** Evaluate reflected route evidence against the first matching policy rule. */"
19060
+ "doc": "/** Evaluate reflected route evidence against the first matching policy rule, plus every matching\n * baseline rule. */"
18757
19061
  },
18758
19062
  {
18759
19063
  "name": "eventDeliveryCertificationProfile",
@@ -19096,7 +19400,7 @@
19096
19400
  "name": "generateServerEntry",
19097
19401
  "kind": "function",
19098
19402
  "package": "@nifrajs/web",
19099
- "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options to import by name, each mapped to the specifier of the edge-safe module\n * that exports it. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n /** URL paths of the content-hashed client outputs (the build manifest's `assets`). When given, a\n * self-hosted entry caches only these immutably; otherwise every file under `/assets/` is. */\n readonly hashedFiles?: readonly string[];\n /** Trust the edge platform's client-address header for `c.clientIp`. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n}): string;",
19403
+ "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options to import by name, each mapped to the specifier of the edge-safe module\n * that exports it. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n /** URL paths of the content-hashed client outputs (the build manifest's `assets`). When given, a\n * self-hosted entry caches only these immutably; otherwise every file under `/assets/` is. */\n readonly hashedFiles?: readonly string[];\n /** Trust the edge platform's client-address header for `c.clientIp`. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** The server manifest exports `copyChunks` (the client build split copy tables by locale). */\n readonly copyChunks?: boolean;\n}): string;",
19100
19404
  "doc": "/**\n * Codegen the per-target **server entry** module (source text) for `buildServer` to bundle. It imports\n * the app's `adapter` (from `framework.ts`), the optional `backend` (from `backend.ts`), and the\n * generated `{ manifest, clientEntry }` (from `./server-manifest`), builds `createWebApp`, then wires\n * the right host:\n * - `cloudflare` / `vercel`: `export default` the fetch handler (the platform serves /assets/* itself).\n * - `deno`: same fetch-handler default, plus `Deno.serve` self-host when run directly.\n * - `bun` / `node`: a self-hosting server that ALSO serves the client bundle from disk (those\n * runtimes have a filesystem; the static `/assets/*` sit next to the entry).\n * `adapterImport`/`backendImport` are the specifiers the entry uses (relative to where it's written) -\n * `buildServer` writes the entry next to `serverEntry`, so they're resolved from there. Pure (string in,\n * string out) so the generation is unit-testable without a real build.\n */"
19101
19405
  },
19102
19406
  {
@@ -19299,7 +19603,7 @@
19299
19603
  "kind": "function",
19300
19604
  "package": "@nifrajs/web",
19301
19605
  "signature": "export declare function htmlFileFor(pattern: string): string;",
19302
- "doc": "/** Map a route path to its output file: `/` → `index.html`, `/a/b` → `a/b/index.html`. */"
19606
+ "doc": "/**\n * Map a route path to its output file: `/` → `index.html`, `/a/b` → `a/b/index.html`. Segments are\n * written decoded (`/caf%C3%A9` → `café/index.html`) because a static host decodes the request path\n * before it looks for a file; a segment with no such file name stays as written.\n */"
19303
19607
  },
19304
19608
  {
19305
19609
  "name": "httpToolAdapter",
@@ -19409,6 +19713,13 @@
19409
19713
  "signature": "export declare function importAllowed(from: Zone, to: Zone): boolean;",
19410
19714
  "doc": "/** Whether a module in `from` may import (with a value import) a module in `to`. */"
19411
19715
  },
19716
+ {
19717
+ "name": "importGlobPlugin",
19718
+ "kind": "function",
19719
+ "package": "@nifrajs/web",
19720
+ "signature": "export declare function importGlobPlugin(options: {\n readonly root: string;\n}): BunPlugin;",
19721
+ "doc": "/**\n * Expand `import.meta.glob` in the app's own modules, for `Bun.build`. `root` is the app root, which a\n * pattern starting with `/` is read from. Installed packages are left as published. Register it after\n * every plugin that loads app modules itself (a server-function stub must win over it); a module such\n * a plugin loads keeps its call, which {@link assertNoImportGlob} then refuses in the output. Register\n * it before a plugin that rewrites source through `addSourceTransform`: it reads through that rewrite.\n */"
19722
+ },
19412
19723
  {
19413
19724
  "name": "importOpenAPI",
19414
19725
  "kind": "function",
@@ -19486,7 +19797,8 @@
19486
19797
  "name": "installForms",
19487
19798
  "kind": "function",
19488
19799
  "package": "@nifrajs/web",
19489
- "signature": "export declare function installForms(router: ClientRouter): () => void;"
19800
+ "signature": "export declare function installForms(router: ClientRouter): () => void;",
19801
+ "doc": "/**\n * Intercept submissions of same-origin `<form method=\"post\">` whose action targets an app route:\n * submit via the router (no full reload - POST the action, then revalidate the active loader). On\n * failure it falls back to a native submit, so the form still works. Returns a teardown function.\n */"
19490
19802
  },
19491
19803
  {
19492
19804
  "name": "installHistory",
@@ -19673,6 +19985,20 @@
19673
19985
  "signature": "export declare function isSafeReviewDiff(value: unknown): value is string;",
19674
19986
  "doc": "/** Validate the only repository selector exposed by the host review RPC. */"
19675
19987
  },
19988
+ {
19989
+ "name": "isSameOriginForm",
19990
+ "kind": "function",
19991
+ "package": "@nifrajs/core",
19992
+ "signature": "export declare function isSameOriginForm(origin: string, secFetchSite: string | null, request: {\n readonly url: string;\n}): boolean;",
19993
+ "doc": "/**\n * {@link isSameOriginRequest} for a browser form submission. Under `Referrer-Policy: no-referrer` a\n * browser sends a same-origin form POST with `Origin: null`; that one passes on its\n * `Sec-Fetch-Site: same-origin`, a header page script cannot set.\n */"
19994
+ },
19995
+ {
19996
+ "name": "isSameOriginForm",
19997
+ "kind": "function",
19998
+ "package": "nifra",
19999
+ "signature": "export declare function isSameOriginForm(origin: string, secFetchSite: string | null, request: {\n readonly url: string;\n}): boolean;",
20000
+ "doc": "/**\n * {@link isSameOriginRequest} for a browser form submission. Under `Referrer-Policy: no-referrer` a\n * browser sends a same-origin form POST with `Origin: null`; that one passes on its\n * `Sec-Fetch-Site: same-origin`, a header page script cannot set.\n */"
20001
+ },
19676
20002
  {
19677
20003
  "name": "isSameOriginPath",
19678
20004
  "kind": "function",
@@ -19691,14 +20017,14 @@
19691
20017
  "name": "isSameOriginRequest",
19692
20018
  "kind": "function",
19693
20019
  "package": "@nifrajs/core",
19694
- "signature": "export declare function isSameOriginRequest(origin: string, request: Request): boolean;",
20020
+ "signature": "export declare function isSameOriginRequest(origin: string, request: {\n readonly url: string;\n}): boolean;",
19695
20021
  "doc": "/**\n * True when `origin` is the request's own origin, as observed from inside a possibly-proxied server.\n *\n * The host must match exactly. The scheme must be equal or STRONGER on the Origin side, never weaker:\n *\n * - `https://app` page → `http://app` request URL: accepted. This is what every TLS-terminating\n * proxy looks like from the origin server - Cloudflare, a tunnel, an ingress. The socket is plain\n * HTTP, so `request.url` says `http:` while the browser correctly reports an `https:` page.\n * - `http://app` page → `https://app` request URL: rejected. Nifra terminated TLS itself here, so a\n * plaintext page on the same host is the downgrade an attacker would need and buys nothing real.\n *\n * Comparing full origins instead is not the stricter option, it is an outage: measured, it rejects\n * every server-function POST behind a terminating proxy, while the cross-origin attacker it aims at\n * was already rejected by the host comparison. Nifra deliberately does not read `X-Forwarded-Proto` -\n * a forwarded header is attacker-controlled unless something upstream is proven to overwrite it - so\n * the scheme in `request.url` is the socket's, not the browser's, and this asymmetry is how the two\n * are reconciled without trusting a header.\n *\n * An unparseable Origin is not same-origin.\n */"
19696
20022
  },
19697
20023
  {
19698
20024
  "name": "isSameOriginRequest",
19699
20025
  "kind": "function",
19700
20026
  "package": "nifra",
19701
- "signature": "export declare function isSameOriginRequest(origin: string, request: Request): boolean;",
20027
+ "signature": "export declare function isSameOriginRequest(origin: string, request: {\n readonly url: string;\n}): boolean;",
19702
20028
  "doc": "/**\n * True when `origin` is the request's own origin, as observed from inside a possibly-proxied server.\n *\n * The host must match exactly. The scheme must be equal or STRONGER on the Origin side, never weaker:\n *\n * - `https://app` page → `http://app` request URL: accepted. This is what every TLS-terminating\n * proxy looks like from the origin server - Cloudflare, a tunnel, an ingress. The socket is plain\n * HTTP, so `request.url` says `http:` while the browser correctly reports an `https:` page.\n * - `http://app` page → `https://app` request URL: rejected. Nifra terminated TLS itself here, so a\n * plaintext page on the same host is the downgrade an attacker would need and buys nothing real.\n *\n * Comparing full origins instead is not the stricter option, it is an outage: measured, it rejects\n * every server-function POST behind a terminating proxy, while the cross-origin attacker it aims at\n * was already rejected by the host comparison. Nifra deliberately does not read `X-Forwarded-Proto` -\n * a forwarded header is attacker-controlled unless something upstream is proven to overwrite it - so\n * the scheme in `request.url` is the socket's, not the browser's, and this asymmetry is how the two\n * are reconciled without trusting a header.\n *\n * An unparseable Origin is not same-origin.\n */"
19703
20029
  },
19704
20030
  {
@@ -19894,6 +20220,13 @@
19894
20220
  "signature": "export declare function localeDirection(tag: string): \"ltr\" | \"rtl\";",
19895
20221
  "doc": "/**\n * The writing direction of a BCP-47 tag: an explicit script subtag decides (`pa-Arab` is rtl,\n * `sd-Deva` ltr), then the language (`ur`, `ar`, `he`, ...), then the script the runtime's likely-\n * subtags data gives for a rarer language. `ltr` when none of those says rtl, including for a tag\n * the runtime cannot parse.\n */"
19896
20222
  },
20223
+ {
20224
+ "name": "localeOfProps",
20225
+ "kind": "function",
20226
+ "package": "@nifrajs/web",
20227
+ "signature": "export declare function localeOfProps(props: RenderProps | undefined): PageLocale | undefined;",
20228
+ "doc": "/** The locale of the page `props` render: the server's answer on SSR, else the one the client names\n * from `props.path`. What every adapter's `useLocale` reads. */"
20229
+ },
19897
20230
  {
19898
20231
  "name": "logger",
19899
20232
  "kind": "function",
@@ -19948,7 +20281,7 @@
19948
20281
  "kind": "function",
19949
20282
  "package": "@nifrajs/cron",
19950
20283
  "signature": "export declare function matches(fields: CronFields, date: Date): boolean;",
19951
- "doc": "/**\n * Does `date` (in its LOCAL time - cron is local-time by convention) match the fields, to the\n * minute? Day-of-month and day-of-week follow the standard OR rule: when BOTH are restricted, a\n * match on EITHER is a match; when only one is restricted, only that one must match.\n */"
20284
+ "doc": "/**\n * Does `date` (in its LOCAL time - cron is local-time by convention) match the fields, to the\n * minute? Day-of-month and day-of-week follow the standard OR rule: when BOTH are restricted, a\n * match on EITHER is a match; otherwise both must match (a bare `*` matches every day).\n */"
19952
20285
  },
19953
20286
  {
19954
20287
  "name": "matchesAssuranceSelector",
@@ -19977,11 +20310,18 @@
19977
20310
  "signature": "export declare function mcp(): IdentityPlugin;",
19978
20311
  "doc": "/**\n * Enable MCP declarations on a server: `.use(mcp())` turns on `.tool()`, `.resource()`, and\n * `.prompt()`. Applying it twice is a no-op (named plugin dedupe).\n */"
19979
20312
  },
20313
+ {
20314
+ "name": "mcpConfig",
20315
+ "kind": "function",
20316
+ "package": "create-nifra",
20317
+ "signature": "export declare function mcpConfig(pin?: string): McpConfig;",
20318
+ "doc": "/** The one canonical MCP config both registries serialize - the anti-drift seam. `pin` is the\n * `@nifrajs/cli` version to pin; without one the launch follows the project's install. */"
20319
+ },
19980
20320
  {
19981
20321
  "name": "mcpJson",
19982
20322
  "kind": "function",
19983
20323
  "package": "create-nifra",
19984
- "signature": "export declare function mcpJson(): string;",
20324
+ "signature": "export declare function mcpJson(pin?: string): string;",
19985
20325
  "doc": "/** Serialize the canonical MCP config as the JSON written to `.mcp.json` and `.cursor/mcp.json`.\n * Trailing newline so the file is POSIX-clean and diffs don't flag a missing EOL. */"
19986
20326
  },
19987
20327
  {
@@ -20320,7 +20660,7 @@
20320
20660
  "kind": "function",
20321
20661
  "package": "@nifrajs/web",
20322
20662
  "signature": "export declare function normalizeRolldownPlugins(plugins: readonly unknown[], isRolldown: boolean): readonly unknown[];",
20323
- "doc": "/**\n * Strip `optimizeDeps.rollupOptions.jsx` from a plugin's `config` hook output when running under\n * rolldown-vite - the source of the scary, harmless `Warning: Invalid input options … \"jsx\" Invalid\n * key: Expected never but received \"jsx\"` on `nifra dev`.\n *\n * Why it happens: `@vitejs/plugin-react@4.x` (and peers) target an *older* rolldown-vite optimizeDeps\n * API - they inject `optimizeDeps.rollupOptions.jsx` to tell the dep pre-bundler to transform JSX. Vite\n * 8's rolldown dep-optimizer renamed that surface to `optimizeDeps.rolldownOptions` (and moved jsx under\n * `transform.jsx`), so the stale `rollupOptions.jsx` is an unrecognized input option → the warning. It's\n * a version-skew artifact, not a real misconfig: the route source JSX transform runs through the\n * plugin's own `transform` hook (untouched here), and node_modules deps that get pre-bundled almost\n * never contain raw JSX - so dropping the dead key changes no behavior and keeps HMR/Fast Refresh\n * intact. We *strip* (rather than translate to `rolldownOptions`) so the fix is version-agnostic: a\n * plugin already emitting the correct `rolldownOptions` is left untouched, and a future plugin bump that\n * stops emitting `rollupOptions.jsx` makes this a no-op.\n *\n * Scoped narrowly: only the `optimizeDeps.rollupOptions.jsx` key is removed, only under rolldown-vite,\n * and only from the value a plugin's `config` hook returns. Non-rolldown Vite is passed through verbatim.\n *\n * FLATTEN FIRST: a Vite plugin factory may return an ARRAY of plugins - `@vitejs/plugin-react`'s `react()`\n * returns `[vite:react-babel, vite:react-refresh]`, and it's `react:react-babel`'s `config` hook that emits\n * the offending `optimizeDeps.rollupOptions.jsx`. `nifra.config.ts` writes `vitePlugins = [react()]`, so the\n * plugin list arrives NESTED (`[[babel, refresh]]`). Without flattening, `.map` sees the inner array (which\n * has no `config`), leaves it untouched, and Vite - which flattens plugin arrays itself before running them\n * - then executes the un-stripped babel hook, so the warning survives. Flattening here (Vite accepts a flat\n * list identically) is what lets the strip reach every real plugin.\n */"
20663
+ "doc": "/**\n * Move a plugin's `optimizeDeps.rollupOptions` to `optimizeDeps.rolldownOptions` under rolldown-vite and\n * drop its `jsx` key, so Vite 8 warns about neither on `nifra dev` or a Vite build.\n *\n * Both are version-skew artifacts of plugins such as `@vitejs/plugin-react@4.x`, which still emit\n * `optimizeDeps.rollupOptions.jsx`:\n *\n * - Vite 8 renamed the dep optimizer's options to `rolldownOptions` and moved jsx under `transform.jsx`,\n * so a stale `jsx` key prints `Invalid input options … \"jsx\" Invalid key`. The route JSX transform runs\n * through the plugin's own `transform` hook and pre-bundled deps almost never hold raw JSX, so the key\n * is dead and dropping it changes no behavior.\n * - Vite 8 reads `rollupOptions` there only as a deprecated alias of `rolldownOptions` and warns on every\n * resolve, even for `{}`. The remaining keys move to `rolldownOptions`; when the same object already\n * sets `rolldownOptions`, Vite ignores the alias, so it is dropped. `ssr.optimizeDeps` gets the same.\n *\n * Only a plugin's `config` hook output is rewritten, never mutated, and only under rolldown-vite.\n * Non-rolldown Vite is passed through verbatim.\n *\n * FLATTEN FIRST: a Vite plugin factory may return an ARRAY of plugins - `@vitejs/plugin-react`'s `react()`\n * returns `[vite:react-babel, vite:react-refresh]`, and it's `react:react-babel`'s `config` hook that emits\n * the offending `optimizeDeps.rollupOptions.jsx`. `nifra.config.ts` writes `vitePlugins = [react()]`, so the\n * plugin list arrives NESTED (`[[babel, refresh]]`). Without flattening, `.map` sees the inner array (which\n * has no `config`), leaves it untouched, and Vite - which flattens plugin arrays itself before running them\n * - then executes the un-stripped babel hook, so the warning survives. Flattening here (Vite accepts a flat\n * list identically) is what lets the strip reach every real plugin.\n */"
20324
20664
  },
20325
20665
  {
20326
20666
  "name": "normalizeSeverity",
@@ -20389,7 +20729,7 @@
20389
20729
  "kind": "function",
20390
20730
  "package": "@nifrajs/middleware",
20391
20731
  "signature": "export declare function openapi(options?: OpenApiOptions): IdentityPlugin;",
20392
- "doc": "/**\n * Serve an OpenAPI 3.1 document (a structural subset - see {@link buildOpenApiDocument}) at\n * `options.path` (default `/openapi.json`), generated from the app's registered routes. Generation is\n * **lazy + memoized**: it reads `app.routes()` on the first request, by which point every route is\n * registered - so the plugin's own position in the chain doesn't matter.\n *\n * Pass `ui: true` (or `ui: { path, title, cdn }`) to also serve a Scalar API-reference page (default\n * `/reference`) that renders the spec. The page loads Scalar from a CDN; pin/self-host via `ui.cdn`,\n * and remember to allow that origin if you ship a `script-src` Content-Security-Policy.\n *\n * ```ts\n * app.use(openapi({ info: { title: \"My API\", version: \"1.0.0\" }, ui: true }))\n * ```\n */"
20732
+ "doc": "/**\n * Serve an OpenAPI 3.1 document (a structural subset - see {@link buildOpenApiDocument}) at\n * `options.path` (default `/openapi.json`), generated from the app's registered routes. Generation is\n * **lazy + memoized**: it reads `app.routes()` on the first request, by which point every route is\n * registered - so the plugin's own position in the chain doesn't matter.\n *\n * Pass `ui: true` (or `ui: { path, title, cdn, integrity }`) to also serve a Scalar API-reference page\n * (default `/reference`) that renders the spec. By default the page loads an exact Scalar version from\n * jsDelivr with a Subresource Integrity hash, so a changed file is refused rather than run on your\n * origin. Self-host it via `ui.cdn` (with your copy's `ui.integrity`), and allow the script's origin if\n * you ship a `script-src` Content-Security-Policy.\n *\n * ```ts\n * app.use(openapi({ info: { title: \"My API\", version: \"1.0.0\" }, ui: true }))\n * ```\n */"
20393
20733
  },
20394
20734
  {
20395
20735
  "name": "orchestrationTelemetry",
@@ -20418,6 +20758,13 @@
20418
20758
  "signature": "export declare function ownComponentPortal(source: Element, target: Element, cleanup: () => void | Promise<void>): () => Promise<void>;",
20419
20759
  "doc": "/** Native portal actions register cleanup with the island that owns their target. */"
20420
20760
  },
20761
+ {
20762
+ "name": "pageLocaleIn",
20763
+ "kind": "function",
20764
+ "package": "@nifrajs/web",
20765
+ "signature": "export declare function pageLocaleIn(config: PageLocales, path: string): PageLocale | undefined;",
20766
+ "doc": "/**\n * The locale a path is in, by the rule `@nifrajs/i18n/routing`'s `localeOf` follows: a first path\n * segment that names a served locale, ignoring ASCII case, or else the default.\n */"
20767
+ },
20421
20768
  {
20422
20769
  "name": "paginate",
20423
20770
  "kind": "function",
@@ -20632,6 +20979,13 @@
20632
20979
  "signature": "export declare function parseManifestClientEntry(source: string): string | undefined;",
20633
20980
  "doc": "/** The baked `clientEntry` URL in a committed server-manifest, or `undefined` if absent. Pure. */"
20634
20981
  },
20982
+ {
20983
+ "name": "parseManifestCopyChunks",
20984
+ "kind": "function",
20985
+ "package": "@nifrajs/web",
20986
+ "signature": "export declare function parseManifestCopyChunks(source: string): Record<string, string> | undefined;",
20987
+ "doc": "/** The baked `copyChunks` map in a committed server-manifest, or `undefined` when it has none. Pure. */"
20988
+ },
20635
20989
  {
20636
20990
  "name": "parseManifestCssLoading",
20637
20991
  "kind": "function",
@@ -20821,7 +21175,7 @@
20821
21175
  "kind": "function",
20822
21176
  "package": "@nifrajs/web",
20823
21177
  "signature": "export declare function parseZoneConfig(value: unknown, source: string): ZoneConfig;",
20824
- "doc": "/**\n * Validate a `zones` setting. `source` names where it came from in the error. Folders are plain\n * app-relative paths (a trailing `/**` is accepted and dropped); any other glob is refused, so a\n * pattern can never match less than its author meant without saying so.\n */"
21178
+ "doc": "/**\n * Validate a `zones` setting. `source` names where it came from in the error. Folders and files are\n * plain app-relative paths (a trailing `/**` is accepted and dropped); any other glob is refused, so\n * a pattern can never match less than its author meant without saying so. One path under two sides\n * is refused; a path nested in another's folder is not, since the most specific one decides.\n */"
20825
21179
  },
20826
21180
  {
20827
21181
  "name": "pathTag",
@@ -21184,8 +21538,8 @@
21184
21538
  "name": "readBodyFramed",
21185
21539
  "kind": "function",
21186
21540
  "package": "@nifrajs/core",
21187
- "signature": "export declare function readBodyFramed<T>(source: RequestSource, maxBodyBytes: number, protoPoisoning: ProtoPoisoning, onParsed: (parsed: unknown) => MaybePromise<T>, wrapResponse: (response: Response | ResponseResult) => T, onError: (err: unknown) => MaybePromise<T>, bodySchema?: object): Promise<T>;",
21188
- "doc": "/**\n * The shared content-type dispatcher around the JSON and urlencoded lanes. A `bodySchema` branded\n * with {@link SCHEMA_BODY_READER} takes every other media type; JSON and urlencoded bodies keep\n * their lanes whatever the schema carries.\n */"
21541
+ "signature": "export declare function readBodyFramed<T>(source: RequestSource, maxBodyBytes: number, protoPoisoning: ProtoPoisoning, onParsed: (parsed: unknown) => MaybePromise<T>, wrapResponse: (response: Response | ResponseResult) => T, onError: (err: unknown) => MaybePromise<T>, bodySchema?: object, formOrigins?: FormOrigins): Promise<T>;",
21542
+ "doc": "/**\n * The shared content-type dispatcher around the JSON and urlencoded lanes. A `bodySchema` branded\n * with {@link SCHEMA_BODY_READER} takes every other media type; JSON and urlencoded bodies keep\n * their lanes whatever the schema carries. A form media type whose `Origin` is another site's, and\n * not one of `formOrigins`, is refused with `403` before the body is read.\n */"
21189
21543
  },
21190
21544
  {
21191
21545
  "name": "readBoundedBytes",
@@ -21284,6 +21638,13 @@
21284
21638
  "signature": "export declare function readSingleCopyStrict(cwd: string): boolean;",
21285
21639
  "doc": "/** Whether the declaration's object form asks for strict mode (`\"strict\": true`). */"
21286
21640
  },
21641
+ {
21642
+ "name": "readSource",
21643
+ "kind": "function",
21644
+ "package": "@nifrajs/web",
21645
+ "signature": "export declare function readSource(build: PluginBuilder, path: string): Promise<string>;",
21646
+ "doc": "/** A source file's text as this build compiles it: off disk, through each {@link addSourceTransform}. */"
21647
+ },
21287
21648
  {
21288
21649
  "name": "readSqliteSchema",
21289
21650
  "kind": "function",
@@ -21391,6 +21752,13 @@
21391
21752
  "signature": "export declare function reflectHooks(source: unknown): ReflectedHookReport;",
21392
21753
  "doc": "/**\n * Every hook that actually runs for each route, and for each prefix's unmatched paths, with the plugin\n * that registered it and where: the app, a `group()`, a `merge()`d server, or a `mount()`ed one. It\n * follows the same scope rules the server applies - a group's hooks cover its prefix, a merged server's\n * request hooks cover only its own routes, a mount runs its child's whole lifecycle inside the app's\n * global hooks - and reads the provenance a development load records, so reflect the app outside\n * production. A mount of a server already on the path (a self-mount) is reported once, as that\n * prefix's unmatched entry. Anything that is not a nifra server yields an empty report.\n */"
21393
21754
  },
21755
+ {
21756
+ "name": "reflectMergeAuthGaps",
21757
+ "kind": "function",
21758
+ "package": "@nifrajs/core",
21759
+ "signature": "export declare function reflectMergeAuthGaps(source: unknown): readonly ReflectedMergeAuthGap[];",
21760
+ "doc": "/**\n * Every `merge()` in the app, its merged servers included, whose server authenticates none of its\n * routes while the parent's order-scoped auth - an `authenticate()` stage, or `authenticated` evidence\n * scoped to subsequent routes - covers the parent's own: that auth never runs for a merged route.\n * Recorded by a development load only (the same provenance {@link reflectHooks} reads), so reflect the\n * app outside production. `nifra check` reports each one (NF-C043).\n */"
21761
+ },
21394
21762
  {
21395
21763
  "name": "reflectMounts",
21396
21764
  "kind": "function",
@@ -21398,6 +21766,13 @@
21398
21766
  "signature": "export declare function reflectMounts(source: unknown): readonly ReflectedMount[];",
21399
21767
  "doc": "/**\n * The mounts on an app that route reflection cannot see into, sorted by path. A mount whose app\n * publishes composed evidence (the API `createWebApp` mounts) is left out: its routes reach\n * reflection through that evidence. Anything that is not a nifra server yields an empty list.\n */"
21400
21768
  },
21769
+ {
21770
+ "name": "reflectRouteSites",
21771
+ "kind": "function",
21772
+ "package": "@nifrajs/core",
21773
+ "signature": "export declare function reflectRouteSites(source: unknown): ReadonlyMap<string, string>;",
21774
+ "doc": "/**\n * Where each route was registered: `METHOD /path` (`WS` for a socket) mapped to the `file:line:col` of\n * the call outside nifra's core that registered it, through every `group()` and `merge()`. Recorded only\n * by a development load with `NIFRA_ROUTE_SITES=1` (the CLI sets it while it loads `nifra.assurance.ts`),\n * so the map is empty otherwise. The paths are absolute, which is why they stay out of\n * {@link reflectRoutes}, whose output is written into artifacts.\n */"
21775
+ },
21401
21776
  {
21402
21777
  "name": "reflectRoutes",
21403
21778
  "kind": "function",
@@ -21759,7 +22134,7 @@
21759
22134
  "kind": "function",
21760
22135
  "package": "@nifrajs/mcp",
21761
22136
  "signature": "export declare function respondMcpHttp(request: Request, tools: McpTool[], serverInfo: {\n name: string;\n version: string;\n}, options?: McpHttpOptions): Promise<Response>;",
21762
- "doc": "/**\n * Handle one MCP request over HTTP against the given `tools`/`features`. POST a JSON-RPC body → a JSON-RPC\n * response, or an SSE stream carrying progress notifications and the final response when the client\n * accepts `text/event-stream`; GET → a health page or a cancellable SSE stream; OPTIONS → CORS preflight.\n * Never throws - a bad body becomes a JSON-RPC parse error. Dual-era: a modern (2026-07-28) POST that\n * mirrors its method/name/version into headers is validated against the body before dispatch and gets spec\n * HTTP statuses; legacy requests are served unchanged. The dispatch is the shared, transport-agnostic\n * {@link handleRpc}.\n */"
22137
+ "doc": "/**\n * Handle one MCP request over HTTP against the given `tools`/`features`. POST a JSON-RPC body → a JSON-RPC\n * response, or an SSE stream carrying progress notifications and the final response when the client\n * accepts `text/event-stream`; GET → a health page or a keep-alive SSE stream that closes after five minutes\n * (`405` when `authorizeMessage` is set); OPTIONS → CORS preflight.\n * Never throws - a bad body becomes a JSON-RPC parse error. Dual-era: a modern (2026-07-28) POST that\n * mirrors its method/name/version into headers is validated against the body before dispatch and gets spec\n * HTTP statuses; legacy requests are served unchanged. The dispatch is the shared, transport-agnostic\n * {@link handleRpc}.\n */"
21763
22138
  },
21764
22139
  {
21765
22140
  "name": "responseCache",
@@ -21771,8 +22146,14 @@
21771
22146
  "name": "responseContract",
21772
22147
  "kind": "function",
21773
22148
  "package": "@nifrajs/core",
21774
- "signature": "export declare function responseContract(mode?: ResponseContractMode): IdentityPlugin;",
21775
- "doc": "/**\n * Hold every route's declared `response` schema to what the handler actually returned.\n *\n * app.use(responseContract(\"enforce\"))\n *\n * Install it before the routes it should cover - like `idempotency()`, the decision is made per route\n * at registration, so routes registered earlier are not retroactively covered.\n *\n * The check itself is cheap - with a compiled validator it measures in the ~100ns-per-response\n * range, within benchmark noise of an uncontracted route on any route that carries middleware or a\n * derive. What a contracted route does give up is the bare-route fused lane (the check needs the\n * handler's value before it becomes bytes), which only a route with NO other lifecycle steps was\n * taking anyway. Opt-in because not installing the plugin keeps the lane out of the bundle, not\n * because enforcement is expensive.\n */"
22149
+ "signature": "export declare function responseContract(mode?: ResponseContractMode, options?: ResponseContractOptions): IdentityPlugin;",
22150
+ "doc": "/**\n * Hold every route's declared `response` schema to what the handler actually returned.\n *\n * app.use(responseContract(\"enforce\")) // a closed t.object -> 500 on extras\n * app.use(responseContract(\"enforce\", { extra: \"strip\" })) // extras dropped, declared fields sent\n *\n * Install it before the routes it should cover - like `idempotency()`, the decision is made per route\n * at registration, so routes registered earlier are not retroactively covered. It covers routes on\n * the server it is installed on, its `group()`s, and servers `merge()`d into it afterwards.\n *\n * The check itself is cheap - with a compiled validator it measures in the ~100ns-per-response\n * range, within benchmark noise of an uncontracted route on any route that carries middleware or a\n * derive. What a contracted route does give up is the bare-route fused lane (the check needs the\n * handler's value before it becomes bytes), which only a route with NO other lifecycle steps was\n * taking anyway. Opt-in because not installing the plugin keeps the lane out of the bundle, not\n * because enforcement is expensive.\n */"
22151
+ },
22152
+ {
22153
+ "name": "responseContractGaps",
22154
+ "kind": "function",
22155
+ "package": "@nifrajs/cli",
22156
+ "signature": "export declare function responseContractGaps(routes: readonly AssuredRoute[]): ResponseContractGaps;"
21776
22157
  },
21777
22158
  {
21778
22159
  "name": "responseFromStored",
@@ -21821,7 +22202,7 @@
21821
22202
  "kind": "function",
21822
22203
  "package": "@nifrajs/web",
21823
22204
  "signature": "export declare function revalidateEndpoint(options: RevalidateEndpointOptions): (req: Request, platform?: ISRPlatform) => Promise<Response>;",
21824
- "doc": "/**\n * An **on-demand revalidation** (purge) endpoint - a `fetch` handler that drops cached pages by path\n * or invalidates every entry carrying a tag. `POST` with the secret in the token header and either\n * `?path=/blog/x`, `?tag=products`, a JSON `{ \"path\": \"/blog/x\" }` / `{ \"tag\": \"products\" }` body, or a\n * batch `{ \"paths\": [...], \"tags\": [...] }` of at most 100 paths and 32 tags.\n * The token is checked in **constant time** (wrong/missing → `401`); malformed targets → `400`;\n * non-POST → `405`. A store without tag support returns `501` for tag requests. Mount it on a nifra route, e.g.\n * `app.post(\"/__nifra/revalidate\", (c) => handler(c.req))`.\n */"
22205
+ "doc": "/**\n * An **on-demand revalidation** (purge) endpoint - a `fetch` handler that drops cached pages by path\n * or invalidates every entry carrying a tag. `POST` with the secret in the token header and either\n * `?path=/blog/x`, `?tag=products`, a JSON `{ \"path\": \"/blog/x\" }` / `{ \"tag\": \"products\" }` body, or a\n * batch `{ \"paths\": [...], \"tags\": [...] }` of at most 100 paths and 32 tags.\n * The token is checked in **constant time** (wrong/missing → `401`); malformed targets → `400`;\n * a JSON body over 1 MiB → `413`; non-POST → `405`. A store without tag support returns `501` for tag requests. Mount it on a nifra route, e.g.\n * `app.post(\"/__nifra/revalidate\", (c) => handler(c.req))`.\n */"
21825
22206
  },
21826
22207
  {
21827
22208
  "name": "rewriteSsrImports",
@@ -22985,9 +23366,16 @@
22985
23366
  "name": "t",
22986
23367
  "kind": "const",
22987
23368
  "package": "@nifrajs/schema",
22988
- "signature": "export declare const t: {\n readonly string: (options?: StringOptions) => NifraSchema<import(\"@sinclair/typebox\").TString>;\n readonly number: (options?: NumberOptions) => NifraSchema<import(\"@sinclair/typebox\").TNumber>;\n readonly integer: (options?: IntegerOptions) => NifraSchema<import(\"@sinclair/typebox\").TInteger>;\n readonly boolean: () => NifraSchema<import(\"@sinclair/typebox\").TBoolean>;\n readonly null: () => NifraSchema<import(\"@sinclair/typebox\").TNull>;\n readonly literal: <const L extends TLiteralValue>(value: L) => NifraSchema<import(\"@sinclair/typebox\").TLiteral<L>>;\n readonly object: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** Like `t.object` but ACCEPTS (and passes through) unknown fields - the explicit opt-out of the\n * strict default. Prefer `t.object` unless you genuinely need an open object. */\n readonly looseObject: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A list. A list of `t.file()` (from `@nifrajs/schema/form`) honors `minItems` / `maxItems` and is\n * used inside `t.form`.\n */\n readonly array: <T extends TSchema>(item: NifraSchema<T>, options?: ArrayOptions) => NifraSchema<TArray<T>>;\n /** Marks a property optional inside `t.object` / `t.form`; standalone it is `T | undefined`. */\n readonly optional: <T extends TSchema>(schema: NifraSchema<T>) => NifraSchema<T extends import(\"@sinclair/typebox\").TOptional<infer S extends TSchema> ? import(\"@sinclair/typebox\").TOptional<S> : import(\"@sinclair/typebox\").Ensure<import(\"@sinclair/typebox\").TOptional<T>>>;\n readonly union: <const S extends readonly NifraSchema[]>(schemas: S) => NifraSchema<TUnion<{ -readonly [K in keyof S]: S[K][\"jsonSchema\"]; }>>;\n readonly record: <T extends TSchema>(value: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TRecord<import(\"@sinclair/typebox\").TString, T>>;\n /** A cursor-pagination response envelope: `{ items: T[]; nextCursor: string | null }` (`null` = last page). */\n readonly paginated: <T extends TSchema>(item: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n items: TArray<T>;\n nextCursor: TUnion<[import(\"@sinclair/typebox\").TString, import(\"@sinclair/typebox\").TNull]>;\n }>>;\n /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`\n * caps `limit` - a larger value fails validation (a 422), so a client can't request an unbounded page.\n * `coerce` is on because query values arrive as strings (`?limit=20` → `\"20\"`); it's what makes `limit`\n * a real `number` in the handler (`c.query.limit`), not a string. */\n readonly pageQuery: (options?: {\n maxLimit?: number;\n }) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n cursor: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TString>;\n limit: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TInteger>;\n }>>;\n /** A request-query schema with string->scalar COERCION on. Query values always arrive as strings\n * (`?limit=20` -> `\"20\"`), so a plain `t.object({ limit: t.integer() })` in a `query` slot fails to\n * validate; use `t.query` and `t.integer()`/`t.number()`/`t.boolean()` fields become real numbers/\n * booleans in `c.query`. **Open by default** (unknown query fields pass through - `additionalProperties:\n * true`): query params are read by name, not spread into a DB write, so unknown params (UTM tracking,\n * `fbclid`, etc.) passing through is safe, and rejecting them is a production-only footgun (ad/social\n * traffic appends params your schema never declares, causing 422s that never appear in dev/CI). Pass\n * `{ additionalProperties: false }` to enforce a strict allowlist. This is the query-slot constructor;\n * `t.object` stays the constructor for body slots (no coercion, a JSON body is already typed). */\n readonly query: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-cookie schema for the `cookies` route slot, with the same string->scalar COERCION as\n * `t.query` (cookie values always arrive as strings). **Open by default**: a browser sends every\n * cookie the site has set - analytics, consent, other routes' sessions - so a strict allowlist\n * would 422 real traffic. Declare the cookies the route reads; the rest pass through. */\n readonly cookies: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A loader value marked with `defer()`, streamed in after the shell. `inner` describes what the\n * promise resolves to; `@nifrajs/web` projects and validates the resolved value by it before it\n * streams, so a deferred value is held to the same output contract as the rest of the data.\n */\n readonly deferred: <T extends TSchema>(inner: NifraSchema<T>) => NifraSchema<TUnsafe<DeferredValue<Static<T>>>>;\n /**\n * Any JSON value: strings, finite numbers, booleans, `null`, and arrays and plain objects of them, at\n * any depth. A function, a class instance, `NaN` or a cycle fails. The output guard cannot see inside\n * it, so `nifra check` and the sensitive-field rule do not either: prefer a declared shape for\n * anything that might hold a credential.\n */\n readonly json: () => NifraSchema<TUnsafe<JsonValue>>;\n /**\n * A `Date` for page data: `loaderOutput`, `actionOutput` and a server function's `output`. The\n * loader may return a `Date` or an ISO 8601 string; the page receives a `Date`, on the server render\n * and in the browser alike. A request body or a `backend/app.ts` response is plain JSON, which has\n * no dates: use `t.string({ format: \"date-time\" })` there.\n */\n readonly date: () => NifraSchema<TUnsafe<Date>>;\n /**\n * Allow a field with a sensitive name (`token`, `password`, `apiKey`, ...) in an output schema.\n * An output schema that declares one without this fails at route load; `reason` records why this\n * value may reach the browser, for the reviewer who finds it later.\n */\n readonly declassified: <T extends TSchema>(reason: string, schema: NifraSchema<T>) => NifraSchema<T>;\n};",
23369
+ "signature": "export declare const t: {\n readonly string: (options?: StringOptions) => NifraSchema<import(\"@sinclair/typebox\").TString>;\n readonly number: (options?: NumberOptions) => NifraSchema<import(\"@sinclair/typebox\").TNumber>;\n readonly integer: (options?: IntegerOptions) => NifraSchema<import(\"@sinclair/typebox\").TInteger>;\n readonly boolean: () => NifraSchema<import(\"@sinclair/typebox\").TBoolean>;\n readonly null: () => NifraSchema<import(\"@sinclair/typebox\").TNull>;\n readonly literal: <const L extends TLiteralValue>(value: L) => NifraSchema<import(\"@sinclair/typebox\").TLiteral<L>>;\n readonly object: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** Like `t.object` but ACCEPTS (and passes through) unknown fields - the explicit opt-out of the\n * strict default. Prefer `t.object` unless you genuinely need an open object. */\n readonly looseObject: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A list. A list of `t.file()` (from `@nifrajs/schema/form`) honors `minItems` / `maxItems` and is\n * used inside `t.form`.\n */\n readonly array: <T extends TSchema>(item: NifraSchema<T>, options?: ArrayOptions) => NifraSchema<TArray<T>>;\n /** Marks a property optional inside `t.object` / `t.form`; standalone it is `T | undefined`. */\n readonly optional: <T extends TSchema>(schema: NifraSchema<T>) => NifraSchema<T extends import(\"@sinclair/typebox\").TOptional<infer S extends TSchema> ? import(\"@sinclair/typebox\").TOptional<S> : import(\"@sinclair/typebox\").Ensure<import(\"@sinclair/typebox\").TOptional<T>>>;\n readonly union: <const S extends readonly NifraSchema[]>(schemas: S) => NifraSchema<TUnion<{ -readonly [K in keyof S]: S[K][\"jsonSchema\"]; }>>;\n readonly record: <T extends TSchema>(value: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TRecord<import(\"@sinclair/typebox\").TString, T>>;\n /** A cursor-pagination response envelope: `{ items: T[]; nextCursor: string | null }` (`null` = last page). */\n readonly paginated: <T extends TSchema>(item: NifraSchema<T>, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n items: TArray<T>;\n nextCursor: TUnion<[import(\"@sinclair/typebox\").TString, import(\"@sinclair/typebox\").TNull]>;\n }>>;\n /** A request query schema for cursor pagination: `{ cursor?: string; limit?: number }`. `maxLimit`\n * caps `limit` - a larger value fails validation (a 422), so a client can't request an unbounded page.\n * `coerce` is on because query values arrive as strings (`?limit=20` → `\"20\"`); it's what makes `limit`\n * a real `number` in the handler (`c.query.limit`), not a string. */\n readonly pageQuery: (options?: {\n maxLimit?: number;\n }) => NifraSchema<import(\"@sinclair/typebox\").TObject<{\n cursor: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TString>;\n limit: import(\"@sinclair/typebox\").TOptional<import(\"@sinclair/typebox\").TInteger>;\n }>>;\n /** A request-query schema with string->scalar COERCION on. Query values always arrive as strings\n * (`?limit=20` -> `\"20\"`), so a plain `t.object({ limit: t.integer() })` in a `query` slot fails to\n * validate; use `t.query` and `t.integer()`/`t.number()`/`t.boolean()` fields become real numbers/\n * booleans in `c.query`. **Open by default** (unknown query fields pass through - `additionalProperties:\n * true`): query params are read by name, not spread into a DB write, so unknown params (UTM tracking,\n * `fbclid`, etc.) passing through is safe, and rejecting them is a production-only footgun (ad/social\n * traffic appends params your schema never declares, causing 422s that never appear in dev/CI). Pass\n * `{ additionalProperties: false }` to enforce a strict allowlist. This is the query-slot constructor;\n * `t.object` stays the constructor for body slots (no coercion, a JSON body is already typed). */\n readonly query: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-cookie schema for the `cookies` route slot, with the same string->scalar COERCION as\n * `t.query` (cookie values always arrive as strings). **Open by default**: a browser sends every\n * cookie the site has set - analytics, consent, other routes' sessions - so a strict allowlist\n * would 422 real traffic. Declare the cookies the route reads; the rest pass through. */\n readonly cookies: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /** A request-header schema for the `headers` route slot, with the same string->scalar COERCION as\n * `t.query` (header values always arrive as strings). **Open**: it receives every header the client\n * sent, names lower-cased, so the declared names must be lower-case too. A closed `t.object` in the\n * slot also works, but validates only the names it declares and does not coerce. */\n readonly headers: <P extends Props>(props: P, options?: ObjectOptions) => NifraSchema<import(\"@sinclair/typebox\").TObject<{ [K in keyof P]: P[K][\"jsonSchema\"]; }>>;\n /**\n * A loader value marked with `defer()`, streamed in after the shell. `inner` describes what the\n * promise resolves to; `@nifrajs/web` projects and validates the resolved value by it before it\n * streams, so a deferred value is held to the same output contract as the rest of the data.\n */\n readonly deferred: <T extends TSchema>(inner: NifraSchema<T>) => NifraSchema<TUnsafe<DeferredValue<Static<T>>>>;\n /**\n * Any JSON value: strings, finite numbers, booleans, `null`, and arrays and plain objects of them, at\n * any depth. A function, a class instance, `NaN` or a cycle fails. The output guard cannot see inside\n * it, so `nifra check` and the sensitive-field rule do not either: prefer a declared shape for\n * anything that might hold a credential.\n */\n readonly json: () => NifraSchema<TUnsafe<JsonValue>>;\n /**\n * A `Date` for page data: `loaderOutput`, `actionOutput` and a server function's `output`. The\n * loader may return a `Date` or an ISO 8601 string; the page receives a `Date`, on the server render\n * and in the browser alike. A request body or a `backend/app.ts` response is plain JSON, which has\n * no dates: use `t.string({ format: \"date-time\" })` there.\n */\n readonly date: () => NifraSchema<TUnsafe<Date>>;\n /**\n * Allow a field with a sensitive name (`token`, `password`, `apiKey`, ...) in an output schema.\n * An output schema that declares one without this fails at route load; `reason` records why this\n * value may reach the browser, for the reviewer who finds it later.\n */\n readonly declassified: <T extends TSchema>(reason: string, schema: NifraSchema<T>) => NifraSchema<T>;\n};",
22989
23370
  "doc": "/**\n * The built-in schema builder. Each constructor returns a `NifraSchema` - a\n * Standard Schema whose validated output type flows into `c.body`/`c.query`, and\n * whose `jsonSchema` powers `toOpenAPI`. Options (min/max, length, pattern, …)\n * pass straight through to TypeBox and so become JSON Schema constraints.\n *\n * Composite constructors are generic over the *inner* TypeBox schema `T extends\n * TSchema` (not over `NifraSchema`): reading `.jsonSchema` off a value typed only as\n * `NifraSchema` would erase to the `TSchema` constraint and collapse the output type\n * to `unknown`. Capturing `T` keeps `Static<T>` precise (`string[]`, not\n * `unknown[]`).\n */"
22990
23371
  },
23372
+ {
23373
+ "name": "tablesToCatalogs",
23374
+ "kind": "function",
23375
+ "package": "@nifrajs/i18n",
23376
+ "signature": "export declare function tablesToCatalogs(tables: Iterable<CopyTableEntry>, locales?: Locales): TableCatalogs;",
23377
+ "doc": "/**\n * Transpose copy tables (`@nifrajs/i18n/copy`) into per-locale catalogs, so every check here runs on\n * copy written next to the code as it does on a catalog per locale. Pure.\n *\n * ```ts\n * const { catalogs } = tablesToCatalogs(tables, locales)\n * checkCatalogs({ locales, catalogs })\n * ```\n */"
23378
+ },
22991
23379
  {
22992
23380
  "name": "testClient",
22993
23381
  "kind": "function",
@@ -23519,6 +23907,41 @@
23519
23907
  "signature": "export declare function useInfiniteQuery<T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: UseInfiniteQueryOptions<T, P>): UseInfiniteQueryResult<T, P>;",
23520
23908
  "doc": "/**\n * Subscribe to a paged (infinite-scroll) query. Returns the accumulated `data.pages` plus\n * `fetchNextPage`/`fetchPreviousPage`/`hasNextPage`/`hasPreviousPage`. Fetches the first page on mount.\n * SSR-idle unless a `QueryClientProvider` supplies a hydrated client.\n */"
23521
23909
  },
23910
+ {
23911
+ "name": "useLocale",
23912
+ "kind": "function",
23913
+ "package": "@nifrajs/web-preact",
23914
+ "signature": "export declare function useLocale(): string;",
23915
+ "doc": "/**\n * The page's locale key (`ur`, the URL segment), in an app that registers its locale routing (`i18n`\n * in `backend/framework.ts`): from the request on the server, from the URL after each navigation.\n * Without one, the nearest `<I18nProvider>`'s locale; with neither, it throws.\n */"
23916
+ },
23917
+ {
23918
+ "name": "useLocale",
23919
+ "kind": "function",
23920
+ "package": "@nifrajs/web-react",
23921
+ "signature": "export declare function useLocale(): string;",
23922
+ "doc": "/**\n * The page's locale key (`ur`, the URL segment), in an app that registers its locale routing (`i18n`\n * in `backend/framework.ts`): from the request on the server, from the URL after each navigation.\n * Without one, the nearest `<I18nProvider>`'s locale; with neither, it throws.\n */"
23923
+ },
23924
+ {
23925
+ "name": "useLocale",
23926
+ "kind": "function",
23927
+ "package": "@nifrajs/web-solid",
23928
+ "signature": "export declare function useLocale(): Accessor<string>;",
23929
+ "doc": "/**\n * The page's locale key (`ur`, the URL segment), in an app that registers its locale routing (`i18n`\n * in `backend/framework.ts`): from the request on the server, from the URL after each navigation.\n * Without one, the nearest `<I18nProvider>`'s locale; with neither, reading it throws.\n */"
23930
+ },
23931
+ {
23932
+ "name": "useLocale",
23933
+ "kind": "function",
23934
+ "package": "@nifrajs/web-svelte",
23935
+ "signature": "export declare function useLocale(): () => string;",
23936
+ "doc": "/**\n * The page's locale key (`ur`, the URL segment) as an accessor, in an app that registers its locale\n * routing (`i18n` in `backend/framework.ts`): from the request on the server, from the URL after each\n * navigation. Without one, the nearest `<I18nProvider>`'s locale; with neither, calling it throws.\n * Call `useLocale()` during a component's initialization.\n */"
23937
+ },
23938
+ {
23939
+ "name": "useLocale",
23940
+ "kind": "function",
23941
+ "package": "@nifrajs/web-vue",
23942
+ "signature": "export declare function useLocale(): ComputedRef<string>;",
23943
+ "doc": "/**\n * The page's locale key (`ur`, the URL segment) as a computed ref, in an app that registers its locale\n * routing (`i18n` in `backend/framework.ts`): from the request on the server, from the URL after each\n * navigation. Without one, the nearest `<I18nProvider>`'s locale; with neither, reading it throws.\n */"
23944
+ },
23522
23945
  {
23523
23946
  "name": "useLocation",
23524
23947
  "kind": "function",