@nifrajs/cli 5.17.0 → 5.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/check-diagnostics.d.ts +7 -0
  3. package/dist/check-diagnostics.d.ts.map +1 -1
  4. package/dist/check-diagnostics.js +3 -0
  5. package/dist/check-diagnostics.js.map +1 -1
  6. package/dist/check-scan-sql.d.ts +95 -0
  7. package/dist/check-scan-sql.d.ts.map +1 -0
  8. package/dist/check-scan-sql.js +1190 -0
  9. package/dist/check-scan-sql.js.map +1 -0
  10. package/dist/check-scan.d.ts +5 -93
  11. package/dist/check-scan.d.ts.map +1 -1
  12. package/dist/check-scan.js +20 -1207
  13. package/dist/check-scan.js.map +1 -1
  14. package/dist/check.d.ts.map +1 -1
  15. package/dist/check.js +9 -0
  16. package/dist/check.js.map +1 -1
  17. package/dist/cli.d.ts +2 -6
  18. package/dist/cli.d.ts.map +1 -1
  19. package/dist/cli.js +249 -80
  20. package/dist/cli.js.map +1 -1
  21. package/dist/command-catalog.d.ts +3 -0
  22. package/dist/command-catalog.d.ts.map +1 -1
  23. package/dist/command-catalog.js +18 -4
  24. package/dist/command-catalog.js.map +1 -1
  25. package/dist/frontend-guidance.js +1 -1
  26. package/dist/frontend-guidance.js.map +1 -1
  27. package/dist/internal/a11y-element.d.ts +33 -0
  28. package/dist/internal/a11y-element.d.ts.map +1 -0
  29. package/dist/internal/a11y-element.js +124 -0
  30. package/dist/internal/a11y-element.js.map +1 -0
  31. package/dist/internal/a11y-jsx.d.ts +12 -0
  32. package/dist/internal/a11y-jsx.d.ts.map +1 -0
  33. package/dist/internal/a11y-jsx.js +42 -0
  34. package/dist/internal/a11y-jsx.js.map +1 -0
  35. package/dist/internal/a11y-template.d.ts +11 -0
  36. package/dist/internal/a11y-template.d.ts.map +1 -0
  37. package/dist/internal/a11y-template.js +56 -0
  38. package/dist/internal/a11y-template.js.map +1 -0
  39. package/dist/internal/aria-data.d.ts +23 -0
  40. package/dist/internal/aria-data.d.ts.map +1 -0
  41. package/dist/internal/aria-data.js +220 -0
  42. package/dist/internal/aria-data.js.map +1 -0
  43. package/dist/internal/edit-distance.d.ts +3 -0
  44. package/dist/internal/edit-distance.d.ts.map +1 -0
  45. package/dist/internal/edit-distance.js +12 -0
  46. package/dist/internal/edit-distance.js.map +1 -0
  47. package/dist/internal/imported-as.d.ts +10 -0
  48. package/dist/internal/imported-as.d.ts.map +1 -0
  49. package/dist/internal/imported-as.js +23 -0
  50. package/dist/internal/imported-as.js.map +1 -0
  51. package/dist/internal/source-facts.d.ts +3 -0
  52. package/dist/internal/source-facts.d.ts.map +1 -1
  53. package/dist/internal/source-facts.js +2 -0
  54. package/dist/internal/source-facts.js.map +1 -1
  55. package/dist/internal/template-markup.d.ts +58 -0
  56. package/dist/internal/template-markup.d.ts.map +1 -0
  57. package/dist/internal/template-markup.js +221 -0
  58. package/dist/internal/template-markup.js.map +1 -0
  59. package/dist/internal/typescript-import.d.ts.map +1 -1
  60. package/dist/internal/typescript-import.js +11 -0
  61. package/dist/internal/typescript-import.js.map +1 -1
  62. package/dist/mcp-exec.d.ts.map +1 -1
  63. package/dist/mcp-exec.js +37 -23
  64. package/dist/mcp-exec.js.map +1 -1
  65. package/dist/mcp-http.js +1 -1
  66. package/dist/mcp-io.d.ts.map +1 -1
  67. package/dist/mcp-io.js +5 -3
  68. package/dist/mcp-io.js.map +1 -1
  69. package/dist/mcp-root.js +1 -1
  70. package/dist/mcp-root.js.map +1 -1
  71. package/dist/mcp-ws.d.ts.map +1 -1
  72. package/dist/mcp-ws.js +3 -2
  73. package/dist/mcp-ws.js.map +1 -1
  74. package/dist/migrate-layout-config.d.ts +63 -0
  75. package/dist/migrate-layout-config.d.ts.map +1 -0
  76. package/dist/migrate-layout-config.js +507 -0
  77. package/dist/migrate-layout-config.js.map +1 -0
  78. package/dist/migrate-layout-split.d.ts +46 -0
  79. package/dist/migrate-layout-split.d.ts.map +1 -0
  80. package/dist/migrate-layout-split.js +687 -0
  81. package/dist/migrate-layout-split.js.map +1 -0
  82. package/dist/migrate-layout.d.ts +4 -24
  83. package/dist/migrate-layout.d.ts.map +1 -1
  84. package/dist/migrate-layout.js +8 -1183
  85. package/dist/migrate-layout.js.map +1 -1
  86. package/dist/output-schemas.d.ts.map +1 -1
  87. package/dist/output-schemas.js +78 -10
  88. package/dist/output-schemas.js.map +1 -1
  89. package/dist/recipes/5.18.0.d.ts +9 -0
  90. package/dist/recipes/5.18.0.d.ts.map +1 -0
  91. package/dist/recipes/5.18.0.js +56 -0
  92. package/dist/recipes/5.18.0.js.map +1 -0
  93. package/dist/recipes/index.d.ts.map +1 -1
  94. package/dist/recipes/index.js +2 -0
  95. package/dist/recipes/index.js.map +1 -1
  96. package/dist/review.d.ts.map +1 -1
  97. package/dist/review.js +6 -0
  98. package/dist/review.js.map +1 -1
  99. package/dist/rules/a11y.d.ts +5 -0
  100. package/dist/rules/a11y.d.ts.map +1 -0
  101. package/dist/rules/a11y.js +78 -0
  102. package/dist/rules/a11y.js.map +1 -0
  103. package/dist/rules/codes.d.ts +6 -0
  104. package/dist/rules/codes.d.ts.map +1 -1
  105. package/dist/rules/codes.js +6 -0
  106. package/dist/rules/codes.js.map +1 -1
  107. package/dist/rules/comment-markers.js +1 -1
  108. package/dist/rules/comment-markers.js.map +1 -1
  109. package/dist/rules/explanations.d.ts.map +1 -1
  110. package/dist/rules/explanations.js +30 -0
  111. package/dist/rules/explanations.js.map +1 -1
  112. package/dist/rules/host-exposure.d.ts +23 -0
  113. package/dist/rules/host-exposure.d.ts.map +1 -0
  114. package/dist/rules/host-exposure.js +380 -0
  115. package/dist/rules/host-exposure.js.map +1 -0
  116. package/dist/rules/internal-links.d.ts.map +1 -1
  117. package/dist/rules/internal-links.js +16 -141
  118. package/dist/rules/internal-links.js.map +1 -1
  119. package/dist/rules/islands.d.ts +54 -0
  120. package/dist/rules/islands.d.ts.map +1 -1
  121. package/dist/rules/islands.js +577 -80
  122. package/dist/rules/islands.js.map +1 -1
  123. package/dist/rules/security.d.ts +1 -0
  124. package/dist/rules/security.d.ts.map +1 -1
  125. package/dist/rules/security.js +34 -7
  126. package/dist/rules/security.js.map +1 -1
  127. package/dist/runtime-differences.js +3 -3
  128. package/dist/runtime-differences.js.map +1 -1
  129. package/dist/scaffold.d.ts +1 -1
  130. package/dist/scaffold.d.ts.map +1 -1
  131. package/dist/scaffold.js +2 -2
  132. package/dist/scaffold.js.map +1 -1
  133. package/dist/source-rewrites.d.ts.map +1 -1
  134. package/dist/source-rewrites.js +2 -19
  135. package/dist/source-rewrites.js.map +1 -1
  136. package/docs/examples.json +4 -4
  137. package/docs/llms-full.txt +422 -42
  138. package/docs/types.json +466 -56
  139. package/package.json +12 -12
  140. package/src/check-diagnostics.ts +11 -0
  141. package/src/check-scan-sql.ts +1746 -0
  142. package/src/check-scan.ts +34 -1754
  143. package/src/check.ts +10 -1
  144. package/src/cli.ts +258 -98
  145. package/src/command-catalog.ts +21 -4
  146. package/src/frontend-guidance.ts +1 -1
  147. package/src/internal/a11y-element.ts +227 -0
  148. package/src/internal/a11y-jsx.ts +54 -0
  149. package/src/internal/a11y-template.ts +74 -0
  150. package/src/internal/aria-data.ts +242 -0
  151. package/src/internal/edit-distance.ts +16 -0
  152. package/src/internal/imported-as.ts +30 -0
  153. package/src/internal/source-facts.ts +4 -0
  154. package/src/internal/template-markup.ts +270 -0
  155. package/src/internal/typescript-import.ts +15 -0
  156. package/src/mcp-exec.ts +43 -22
  157. package/src/mcp-http.ts +1 -1
  158. package/src/mcp-io.ts +5 -3
  159. package/src/mcp-root.ts +1 -1
  160. package/src/mcp-ws.ts +3 -2
  161. package/src/migrate-layout-config.ts +615 -0
  162. package/src/migrate-layout-split.ts +870 -0
  163. package/src/migrate-layout.ts +37 -1468
  164. package/src/output-schemas.ts +85 -17
  165. package/src/recipes/5.18.0.ts +63 -0
  166. package/src/recipes/index.ts +2 -0
  167. package/src/review.ts +6 -0
  168. package/src/rules/a11y.ts +119 -0
  169. package/src/rules/codes.ts +6 -0
  170. package/src/rules/comment-markers.ts +2 -2
  171. package/src/rules/explanations.ts +30 -0
  172. package/src/rules/host-exposure.ts +531 -0
  173. package/src/rules/internal-links.ts +21 -154
  174. package/src/rules/islands.ts +698 -86
  175. package/src/rules/security.ts +48 -7
  176. package/src/runtime-differences.ts +3 -3
  177. package/src/scaffold.ts +3 -3
  178. package/src/source-rewrites.ts +2 -15
package/docs/types.json CHANGED
@@ -2406,7 +2406,7 @@
2406
2406
  "name": "BuildServerViteOptions",
2407
2407
  "kind": "interface",
2408
2408
  "package": "@nifrajs/web",
2409
- "signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n readonly copyChunks?: Readonly<Record<string, string>> | undefined;\n /** Every file the build emitted, by request path - baked as `buildAssets` (see `buildServer`). */\n readonly buildAssets?: readonly string[] | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n /** Modules the build generated besides the entry and manifest (a target's adapter import). */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Node built-ins the runtime provides besides what `target` implies - mirrors `buildServer`. */\n readonly providedBuiltins?: readonly string[];\n}",
2409
+ "signature": "export interface BuildServerViteOptions extends Pick<BuildServerOptions, \"routesDir\" | \"serverEntry\" | \"outDir\" | \"styles\" | \"routeStyles\" | \"copyChunks\" | \"buildAssets\" | \"cssLoading\" | \"resolve\" | \"manifestFile\" | \"minify\" | \"generatedFiles\" | \"publicEnvPrefix\" | \"providedBuiltins\"> {\n /** The content-hashed client entry URL baked into the generated server manifest. */\n readonly clientEntry: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n /** The runtime the worker targets. `browser` selects the edge resolution conditions. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n}",
2410
2410
  "doc": "/** Options for {@link buildServerVite} - the same surface as `buildServer` minus Bun-plugin specifics. */"
2411
2411
  },
2412
2412
  {
@@ -3564,7 +3564,7 @@
3564
3564
  "name": "ClientRouterOptions",
3565
3565
  "kind": "interface",
3566
3566
  "package": "@nifrajs/web",
3567
- "signature": "export interface ClientRouterOptions {\n readonly patterns: readonly RoutePattern[];\n readonly initial: RouterState;\n /** Override the loader-data fetch (tests inject a stub; defaults to a same-origin JSON GET). */\n readonly fetchData?: FetchRouteData;\n /**\n * How the router reaches its server: the route-data GET, prefetches and action POSTs. Defaults to\n * the global `fetch` against this document's own origin; an app served from a native shell passes\n * {@link serverFetch}. Prerendered data files ship in the bundle and always load locally.\n */\n readonly fetch?: RouterFetch;\n /** Ensure a route's code chunk is loaded before rendering (code-splitting). Awaited in parallel\n * with the loader data, so `pending` covers both. Omit when the bundle isn't split. `path` is the URL\n * the route is about to render, for code loaded per URL (a production build's copy chunks). */\n readonly loadModule?: (routeId: string, path?: string) => Promise<void>;\n /** Terminal status → client route id. Generated entries populate this from `_404` and\n * `_<status>` files so soft navigation renders the same boundary as a hard request. */\n readonly statusRoutes?: Readonly<Record<number, string>>;\n /** Status route ids whose page renders inside layouts (all but `inLayouts = false`), filled in by the generated entry's\n * `loadModule`. A soft navigation that ends on one loads the URL as a document, as one ending on a\n * nested `_404` does: only the server runs those layouts' loaders. */\n readonly layoutStatusRoutes?: Readonly<Record<string, true>>;\n /** routeId → the route's client-only search keys (its `searchClientKeys` export). When a soft\n * navigation stays on the same route + pathname and changes ONLY these keys, `navigate` publishes the\n * new URL WITHOUT re-running the loader (re-render, not revalidate). Populated lazily by the generated\n * entry's `loadModule` (so a route's keys are present once it has been visited, which is exactly when a\n * same-route nav can consult them). Omit ⇒ every search change revalidates (the safe default). */\n readonly searchClientKeys?: Readonly<Record<string, readonly string[]>>;\n /** routeId → client-only loader/action hooks, populated by the generated route entry. */\n readonly routeHooks?: Readonly<Record<string, ClientRouteHooks | undefined>>;\n}"
3567
+ "signature": "export interface ClientRouterOptions {\n readonly patterns: readonly RoutePattern[];\n readonly initial: RouterState;\n /** Override the loader-data fetch (tests inject a stub; defaults to a same-origin JSON GET). */\n readonly fetchData?: FetchRouteData;\n /**\n * How the router reaches its server: the route-data GET, prefetches and action POSTs. Defaults to\n * the global `fetch` against this document's own origin; an app served from a native shell passes\n * {@link serverFetch}. Prerendered data files ship in the bundle and always load locally.\n */\n readonly fetch?: RouterFetch;\n /** Ensure a route's code chunk is loaded before rendering (code-splitting). Awaited in parallel\n * with the loader data, so `pending` covers both. Omit when the bundle isn't split. `path` is the URL\n * the route is about to render, for code loaded per URL (a production build's copy chunks). */\n readonly loadModule?: (routeId: string, path?: string) => Promise<void>;\n /** Routes whose compiled page has no clientLoader, so the server GET may start with the import. */\n readonly serverLoaderRoutes?: readonly string[];\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}"
3568
3568
  },
3569
3569
  {
3570
3570
  "name": "ClientServerFn",
@@ -3616,6 +3616,42 @@
3616
3616
  "package": "@nifrajs/web",
3617
3617
  "signature": "export interface CloudflareZoneOptions {\n /** The zone id (32 hex characters, on the zone's Overview page). */\n readonly zoneId: string;\n /** An API token scoped to Zone > Cache Purge for this zone. Keep it in an env binding. */\n readonly apiToken: string;\n readonly queue?: PurgeQueueOptions;\n /** The fetch purge calls go through; tests pass their own. */\n readonly fetch?: typeof fetch;\n}"
3618
3618
  },
3619
+ {
3620
+ "name": "ClusterOptions",
3621
+ "kind": "interface",
3622
+ "package": "@nifrajs/node-engine",
3623
+ "signature": "export interface ClusterOptions extends ServeOptions {\n /** Fixed port every worker binds with `SO_REUSEPORT` (or `0` when {@link sharedListener} is `true`). */\n readonly port: number;\n /** Share a single primary-bound listener socket across workers via IPC handle passing (supports `port: 0` and zero-drop rolling restarts). */\n readonly sharedListener?: boolean;\n /** Worker processes. Default: one per available core. */\n readonly workers?: number;\n /** Start a replacement when a worker dies while the cluster is running. Default `true`. */\n readonly respawn?: boolean;\n /** Told of every worker coming up and every worker going away; runs in the primary. */\n readonly onWorkerEvent?: (event: ClusterWorkerEvent) => void;\n}"
3624
+ },
3625
+ {
3626
+ "name": "ClusterPrimary",
3627
+ "kind": "interface",
3628
+ "package": "@nifrajs/node-engine",
3629
+ "signature": "export interface ClusterPrimary {\n readonly role: \"primary\";\n readonly port: number;\n /** The workers listening now. */\n workers(): readonly ClusterWorkerInfo[];\n /**\n * Stop every worker as `serve().stop()` stops one server - `onStopping` hooks, `delayMs`, a drain\n * of up to `drainMs` - then resolve once they have all exited. A worker still alive well past that\n * is killed.\n */\n stop(options?: NodeStopOptions): Promise<void>;\n /**\n * Replace every worker, one at a time: a new worker starts and is listening before the one it\n * replaces is stopped (with `drainMs` and `delayMs`, as `stop()`), so the port is always served and\n * capacity never drops. The new workers run whatever the entry file and its imports are on disk\n * now. Resolves when the last old worker has exited. Rejects, leaving the workers not yet replaced\n * running, when a new worker does not start within `startTimeoutMs` or the cluster stops meanwhile.\n * A call while one is under way returns that one.\n *\n * `SO_REUSEPORT` drops the connections waiting in a closing worker's accept queue, so a client may\n * see a reset on a connection it opened in that instant; clients that retry an idempotent request\n * never notice.\n */\n restart(options?: ClusterRestartOptions): Promise<void>;\n /**\n * `reloadTls()` in every worker, resolving when each has answered. Rejects naming the workers that\n * refused; the others have changed. The certificate must be given as PEM text or file names, since\n * it crosses a process boundary.\n */\n reloadTls(tls?: NonNullable<ServeOptions[\"tls\"]>): Promise<void>;\n [Symbol.asyncDispose](): Promise<void>;\n}"
3630
+ },
3631
+ {
3632
+ "name": "ClusterRestartOptions",
3633
+ "kind": "interface",
3634
+ "package": "@nifrajs/node-engine",
3635
+ "signature": "export interface ClusterRestartOptions extends NodeStopOptions {\n /** How long a new worker has to start listening before the restart gives up. Default 30 s. */\n readonly startTimeoutMs?: number;\n}"
3636
+ },
3637
+ {
3638
+ "name": "ClusterWorker",
3639
+ "kind": "interface",
3640
+ "package": "@nifrajs/node-engine",
3641
+ "signature": "export interface ClusterWorker {\n readonly role: \"worker\";\n readonly server: EngineServer;\n}"
3642
+ },
3643
+ {
3644
+ "name": "ClusterWorkerEvent",
3645
+ "kind": "type",
3646
+ "package": "@nifrajs/node-engine",
3647
+ "signature": "export type ClusterWorkerEvent = {\n readonly type: \"listening\";\n readonly id: number;\n readonly pid: number;\n} | {\n readonly type: \"exit\";\n readonly id: number;\n readonly pid: number;\n readonly code: number | null;\n readonly signal: string | null;\n /** A replacement follows. */\n readonly respawning: boolean;\n};"
3648
+ },
3649
+ {
3650
+ "name": "ClusterWorkerInfo",
3651
+ "kind": "interface",
3652
+ "package": "@nifrajs/node-engine",
3653
+ "signature": "export interface ClusterWorkerInfo {\n readonly id: number;\n readonly pid: number;\n}"
3654
+ },
3619
3655
  {
3620
3656
  "name": "Codeframe",
3621
3657
  "kind": "interface",
@@ -3853,6 +3889,13 @@
3853
3889
  "package": "@nifrajs/middleware",
3854
3890
  "signature": "export interface CompressionOptions {\n /** Don't compress bodies smaller than this many bytes. Default `1024`. Enforced by peeking the body\n * (see below) since runtimes rarely expose `Content-Length` on a constructed `Response`. */\n readonly threshold?: number;\n /** Decide whether a `Content-Type` is worth compressing. Default: text, JSON/+json, JS, XML/+xml,\n * NDJSON, wasm, SVG. Already-compressed media (images, video, archives) is skipped. */\n readonly compressible?: (contentType: string) => boolean;\n /** Gzip a buffered body of up to this many bytes on the calling thread, rather than handing it to a\n * worker pool. The default depends on the runtime: Bun on Linux gzips inline up to 64 KiB, Deno\n * always does, and Node never does. A pool hand-off pays when the process has idle cores to spend\n * on it; when every core already runs a process of its own (one per core, behind a cluster or\n * `reusePort`) it only adds cost, and an inline limit measured 1.5 to 4 times the throughput on\n * Node. `0` gzips nothing inline. Streamed bodies are unaffected. */\n readonly inlineMax?: number;\n}"
3855
3891
  },
3892
+ {
3893
+ "name": "CompressionOptions",
3894
+ "kind": "interface",
3895
+ "package": "@nifrajs/node-engine",
3896
+ "signature": "export interface CompressionOptions {\n /** Enable or disable compression. Default `true` when an options object is passed. */\n readonly enabled?: boolean;\n /** Allow Zstandard (`zstd`). Default `true`. */\n readonly zstd?: boolean;\n /** Allow Brotli (`br`). Default `true`. */\n readonly brotli?: boolean;\n /** Allow Gzip (`gzip`). Default `true`. */\n readonly gzip?: boolean;\n /** Allow Deflate (`deflate`). Default `true`. */\n readonly deflate?: boolean;\n /** Minimum uncompressed body length in bytes before compressing. Default `1024`. */\n readonly minBytes?: number;\n}",
3897
+ "doc": "/** Native HTTP response compression (`zstd`, `br`, `gzip`, `deflate`) negotiated via `Accept-Encoding`. */"
3898
+ },
3856
3899
  {
3857
3900
  "name": "Computed",
3858
3901
  "kind": "type",
@@ -3866,6 +3909,13 @@
3866
3909
  "package": "@nifrajs/middleware",
3867
3910
  "signature": "export interface ConditionalResponseOptions {\n /** Entity tag to attach and compare using HTTP weak comparison for GET/HEAD. */\n readonly etag?: string;\n /** Last-modified validator to attach and compare at one-second HTTP date precision. */\n readonly lastModified?: Date;\n}"
3868
3911
  },
3912
+ {
3913
+ "name": "ConnectHandler",
3914
+ "kind": "type",
3915
+ "package": "@nifrajs/node-engine",
3916
+ "signature": "export type ConnectHandler = (request: Request, socket: Duplex, head: Buffer) => undefined | Response | Promise<undefined | Response>;",
3917
+ "doc": "/** Handler invoked for HTTP/1.1 or HTTP/2 `CONNECT` tunnel requests. */"
3918
+ },
3869
3919
  {
3870
3920
  "name": "ConnectPostgresOptions",
3871
3921
  "kind": "interface",
@@ -3873,6 +3923,12 @@
3873
3923
  "signature": "export interface ConnectPostgresOptions {\n readonly timeoutMs: number;\n readonly allowHosts?: readonly string[];\n}",
3874
3924
  "doc": "/** Options for {@link connectPostgres}. */"
3875
3925
  },
3926
+ {
3927
+ "name": "ContainerSandboxProfile",
3928
+ "kind": "interface",
3929
+ "package": "@nifrajs/coding-agent",
3930
+ "signature": "export interface ContainerSandboxProfile {\n readonly kind: \"container\";\n /** Container runtime binary (`docker` or `podman`). Default `\"docker\"`. */\n readonly runtime?: \"docker\" | \"podman\";\n /** Container image containing the JS/TS runtime (e.g. `\"oven/bun:1.3-alpine\"`). */\n readonly image: string;\n /** Network mode. Defaults to `\"none\"` (no outbound or inbound network). */\n readonly network?: \"none\" | \"bridge\";\n /** Mount workspace read-only (`true`, default) or read-write (`false`). */\n readonly readOnlyWorkspace?: boolean;\n /** Memory cap passed to `--memory`. Default `\"256m\"`. */\n readonly memoryLimit?: string;\n /** CPU quota passed to `--cpus`. Default `\"1\"`. */\n readonly cpuLimit?: string;\n /** Process count cap passed to `--pids-limit`. Default `64`. */\n readonly pidsLimit?: number;\n /** Extra worker environment names. Launcher configuration and loader variables are reserved. */\n readonly allowEnv?: readonly string[];\n}"
3931
+ },
3876
3932
  {
3877
3933
  "name": "Content",
3878
3934
  "kind": "function",
@@ -3963,14 +4019,14 @@
3963
4019
  "name": "Context",
3964
4020
  "kind": "interface",
3965
4021
  "package": "@nifrajs/core",
3966
- "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}",
4022
+ "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 /**\n * HTTP trailers received after the request body (HTTP/1.1 chunked or HTTP/2 trailing HEADERS).\n * Empty when the client sent no trailers or before a streamed request body finishes.\n */\n readonly trailers: Readonly<Record<string, string>>;\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}",
3967
4023
  "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 */"
3968
4024
  },
3969
4025
  {
3970
4026
  "name": "Context",
3971
4027
  "kind": "interface",
3972
4028
  "package": "nifra",
3973
- "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}",
4029
+ "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 /**\n * HTTP trailers received after the request body (HTTP/1.1 chunked or HTTP/2 trailing HEADERS).\n * Empty when the client sent no trailers or before a streamed request body finishes.\n */\n readonly trailers: Readonly<Record<string, string>>;\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}",
3974
4030
  "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 */"
3975
4031
  },
3976
4032
  {
@@ -4545,6 +4601,12 @@
4545
4601
  "signature": "export interface CursorResyncRequired {\n readonly status: \"resync_required\";\n readonly reason: CursorResyncReason;\n readonly earliest: number;\n readonly latest: number;\n}",
4546
4602
  "doc": "/** The bounded window no longer contains the record after the cursor; a full resync is required. */"
4547
4603
  },
4604
+ {
4605
+ "name": "CustomSandboxProfile",
4606
+ "kind": "interface",
4607
+ "package": "@nifrajs/coding-agent",
4608
+ "signature": "export interface CustomSandboxProfile {\n readonly kind: \"custom\";\n /** Forward the full worker argv, including its transport flag, and preserve stdin and stdout. */\n readonly wrap: (context: {\n readonly argv: readonly string[];\n readonly cwd: string;\n readonly modulePath: string;\n readonly env: Readonly<Record<string, string>>;\n }) => readonly string[];\n}"
4609
+ },
4548
4610
  {
4549
4611
  "name": "DATA_CAPABILITIES",
4550
4612
  "kind": "const",
@@ -6092,6 +6154,26 @@
6092
6154
  "package": "@nifrajs/e2e",
6093
6155
  "signature": "export interface EngineInit {\n readonly baseUrl: string;\n readonly cookies: readonly {\n readonly name: string;\n readonly value: string;\n }[];\n readonly hydration: HydrationMode;\n}"
6094
6156
  },
6157
+ {
6158
+ "name": "EngineServer",
6159
+ "kind": "interface",
6160
+ "package": "@nifrajs/node-engine",
6161
+ "signature": "export interface EngineServer {\n /** The bound port (resolved when `port: 0` is requested, or `0` for Unix domain sockets). */\n readonly port: number;\n /** Bound Unix domain socket path when started with `ServeOptions.path`. */\n readonly path?: string;\n /**\n * Run the app's `onStopping` hooks, keep serving for `delayMs`, stop accepting connections, let\n * in-flight requests finish for up to `drainMs`, then close what is left and run `onStop`.\n */\n stop(options?: NodeStopOptions): Promise<void>;\n /**\n * Replace the certificate and key (and cipher policy) used for every handshake from now on, with no\n * restart; connections already open keep the one they handshook with. `tls` is the whole\n * {@link ServeOptions.tls} shape, not a diff. With none it reads the current one again, which is how\n * a rotation of certificate *files* is picked up. Session tickets carry over, so resumption survives\n * a new certificate. Throws, leaving the certificate in place, on material the engine refuses; also\n * when the server has no TLS or has stopped.\n */\n reloadTls(tls?: NonNullable<ServeOptions[\"tls\"]>): void;\n /** Add or replace an SNI certificate entry at runtime without restarting the listener. */\n addServerName(entry: TlsSniEntry): void;\n /** Remove an SNI certificate entry at runtime. Returns `true` if one was removed. */\n removeServerName(serverName: string): boolean;\n [Symbol.asyncDispose](): Promise<void>;\n}"
6162
+ },
6163
+ {
6164
+ "name": "EngineSocket",
6165
+ "kind": "interface",
6166
+ "package": "@nifrajs/node-engine",
6167
+ "signature": "export interface EngineSocket {\n readonly id: number;\n /** The handshake request's headers; names are lowercase. */\n headers(): Headers;\n /** The handshake request's query string, without the `?`. */\n query(): string;\n /** The peer's address, once the socket is open. */\n remoteAddress(): string | undefined;\n /** Queued outbound socket bytes currently waiting for the peer to read. */\n getBufferedAmount(): number;\n /** The mTLS client certificate presented on the underlying TLS connection, or `null`. */\n getPeerCertificate?(detailed?: boolean): PeerCertificateInfo | null;\n}",
6168
+ "doc": "/**\n * What `ws.raw` is on this transport: the engine keeps no socket object to hand out, so this is the\n * socket's id and what the engine still knows about its handshake.\n */"
6169
+ },
6170
+ {
6171
+ "name": "EngineTuning",
6172
+ "kind": "interface",
6173
+ "package": "@nifrajs/node-engine",
6174
+ "signature": "export interface EngineTuning {\n /** Idle connection budget in ms. Quiet WebSockets receive a Ping before closing. 0 disables. Default 30 s. */\n readonly idleTimeoutMs?: number;\n /** Budget in ms for a request head, and for a TLS handshake. 0 disables. Default 60 s. */\n readonly headersTimeoutMs?: number;\n /** Largest request head, 431 beyond it. Default 16 KiB, as `node:http`. */\n readonly maxHeaderBytes?: number;\n /** Stalled response budget in ms. Defaults to idleTimeoutMs. 0 disables. */\n readonly responseTimeoutMs?: number;\n /** Budget in ms for one complete request, from its first byte; does not reset on activity. 0 disables. */\n readonly requestTimeoutMs?: number;\n /** Most simultaneous connections; accepts beyond it are dropped. */\n readonly maxConnections?: number;\n /** TCP listen backlog passed to `listen(2)`. Default 4096. */\n readonly backlog?: number;\n /** Alias for maxHeaderBytes. maxHeaderBytes takes precedence. */\n readonly maxHeadSize?: number;\n /** Maximum number of headers allowed on a request before replying 431. */\n readonly maxHeaders?: number;\n /** Maximum length in bytes of the request target (URI + query) before replying 414. */\n readonly maxUriSize?: number;\n /** Maximum queued bytes per HTTP/1.1 connection waiting behind an earlier pipelined request. Default 8 MiB. */\n readonly maxPendingBytes?: number;\n /** Maximum queued outbound socket bytes before dropping a non-reading peer. Default 16 MiB. */\n readonly responseBackpressureLimit?: number;\n /** Streaming chunk buffer / buffered response threshold in bytes. Default 2 MiB. */\n readonly writeHighWaterMark?: number;\n /** Optional maximum lifetime in ms for any WebSocket connection. 0 disables. */\n readonly wsMaxLifetimeMs?: number;\n /** Per-socket queued outbound byte threshold at which `ws.send()` rejects backpressured sends (0 = unlimited). */\n readonly wsMaxBackpressure?: number;\n /** Close the WebSocket connection when queued bytes hit `wsMaxBackpressure`. */\n readonly wsCloseOnBackpressureLimit?: boolean;\n /** Stream HTTP/1.1 & HTTP/2 request bodies incrementally to `req.body` instead of buffering whole payloads. */\n readonly streamRequestBodies?: boolean;\n /** Inherit a pre-bound TCP listener descriptor (used by `serveCluster` with `sharedListener`). */\n readonly listenerFd?: number;\n /** Bind with `SO_REUSEPORT` so several processes share the port. Off by default; `serveCluster` sets it. */\n readonly reusePort?: boolean;\n}",
6175
+ "doc": "/** Engine limits and timeouts beyond the first-class options. */"
6176
+ },
6095
6177
  {
6096
6178
  "name": "EnqueueOptions",
6097
6179
  "kind": "interface",
@@ -6333,7 +6415,7 @@
6333
6415
  "name": "ExtensionHost",
6334
6416
  "kind": "class",
6335
6417
  "package": "@nifrajs/coding-agent",
6336
- "signature": "export declare class ExtensionHost {\n private readonly options;\n private active;\n private commands;\n private tools;\n private workflows;\n private subagents;\n private providers;\n private handlers;\n private revision;\n constructor(options: ExtensionHostOptions);\n get extensions(): readonly CodingAgentExtension[];\n get currentRevision(): string;\n get availableCommands(): readonly string[];\n get availableTools(): readonly ExtensionTool[];\n get availableWorkflows(): readonly string[];\n get availableSubagents(): readonly ExtensionSubagent[];\n get availableProviders(): readonly ExtensionProvider[];\n reload(): Promise<ExtensionReloadResult>;\n close(): Promise<void>;\n command(name: string): ExtensionCommand | undefined;\n tool(name: string): ExtensionTool | undefined;\n workflow(name: string): ExtensionWorkflow | undefined;\n subagent(name: string): ExtensionSubagent | undefined;\n provider(name: string): ExtensionProvider | undefined;\n runWorkflow(name: string, options?: WorkflowRunOptions): Promise<WorkflowResult>;\n emit(event: string, payload: unknown): Promise<void>;\n private loadOne;\n private context;\n}",
6418
+ "signature": "export declare class ExtensionHost {\n private readonly options;\n private active;\n private activations;\n private registrations;\n private lifecycle;\n private revision;\n constructor(options: ExtensionHostOptions);\n get extensions(): readonly CodingAgentExtension[];\n get currentRevision(): string;\n get availableCommands(): readonly string[];\n get availableTools(): readonly ExtensionTool[];\n get availableWorkflows(): readonly string[];\n get availableSubagents(): readonly ExtensionSubagent[];\n get availableProviders(): readonly ExtensionProvider[];\n reload(): Promise<ExtensionReloadResult>;\n private runLifecycle;\n private reloadOnce;\n close(): Promise<void>;\n command(name: string): ExtensionCommand | undefined;\n tool(name: string): ExtensionTool | undefined;\n workflow(name: string): ExtensionWorkflow | undefined;\n subagent(name: string): ExtensionSubagent | undefined;\n provider(name: string): ExtensionProvider | undefined;\n runWorkflow(name: string, options?: WorkflowRunOptions): Promise<WorkflowResult>;\n emit(event: string, payload: unknown): Promise<void>;\n private loadOne;\n private context;\n}",
6337
6419
  "doc": "/**\n * Transactional TypeScript extension loader for the Nifra-native backend.\n *\n * This loader only activates explicitly supplied files. It never scans a project implicitly and it\n * leaves the previous extension graph intact when a staged reload fails.\n */"
6338
6420
  },
6339
6421
  {
@@ -6360,6 +6442,12 @@
6360
6442
  "package": "@nifrajs/agent-app",
6361
6443
  "signature": "export interface ExtensionReloadedView extends EventViewBase {\n readonly kind: \"extension.reloaded\";\n readonly revision: string;\n readonly loadedCount: number;\n readonly disabledCount: number;\n readonly rolledBack: boolean;\n}"
6362
6444
  },
6445
+ {
6446
+ "name": "ExtensionSandboxProfile",
6447
+ "kind": "type",
6448
+ "package": "@nifrajs/coding-agent",
6449
+ "signature": "export type ExtensionSandboxProfile = ContainerSandboxProfile | MacOsSeatbeltSandboxProfile | CustomSandboxProfile;"
6450
+ },
6363
6451
  {
6364
6452
  "name": "ExtensionSubagent",
6365
6453
  "kind": "interface",
@@ -6616,6 +6704,13 @@
6616
6704
  "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: NodePlatform): Response | Promise<Response>;\n /** Nifra apps also expose this WS-upgrade seam; present → this adapter serves `app.ws()` routes via\n * the optional `ws` package (lazy-imported on the first upgrade). Absent (a plain `{ fetch }`\n * handler) → HTTP only, and an upgrade request gets a 404. */\n resolveWebSocketUpgrade?(request: Request, platform?: NodePlatform): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
6617
6705
  "doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
6618
6706
  },
6707
+ {
6708
+ "name": "FetchHandler",
6709
+ "kind": "interface",
6710
+ "package": "@nifrajs/node-engine",
6711
+ "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: {\n readonly clientIp?: string | undefined;\n }): Response | Promise<Response>;\n /** Present on every nifra app: the node-direct lane, which skips building a Web `Request`. */\n resolveNodeSource?(source: unknown, platform?: unknown, runtime?: object | undefined): NodeServeOutcome | Promise<NodeServeOutcome>;\n /** Present on every nifra app: serves `app.ws()` routes. Absent, a handshake is refused with 501. */\n resolveWebSocketUpgrade?(request: Request, platform?: {\n readonly clientIp?: string | undefined;\n }): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
6712
+ "doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
6713
+ },
6619
6714
  {
6620
6715
  "name": "FetchHandler",
6621
6716
  "kind": "interface",
@@ -6704,7 +6799,7 @@
6704
6799
  "name": "FileEvidenceStore",
6705
6800
  "kind": "class",
6706
6801
  "package": "@nifrajs/coding-agent",
6707
- "signature": "export declare class FileEvidenceStore implements EvidenceStore {\n private readonly accumulator;\n private readonly path;\n constructor(options: FileEvidenceStoreOptions);\n append(record: RunEvidence): Promise<void>;\n get count(): number;\n live(): readonly RunEvidence[];\n counters(): EvidenceCounters;\n completedNodeIds(): readonly string[];\n artifacts(): readonly ArtifactRef[];\n digest(): Promise<string>;\n}",
6802
+ "signature": "export declare class FileEvidenceStore extends MemoryEvidenceStore {\n private readonly path;\n constructor(options: FileEvidenceStoreOptions);\n append(record: RunEvidence): Promise<void>;\n}",
6708
6803
  "doc": "/**\n * A bounded store that also appends each parsed record as one canonical-JSON line to a file, in\n * deterministic append order. The record is normalized (and so a forbidden-content record is\n * rejected) BEFORE the line is written, so the file never receives a payload. The append uses the\n * `a` flag, so each record is one O_APPEND write.\n */"
6709
6804
  },
6710
6805
  {
@@ -6736,7 +6831,7 @@
6736
6831
  "name": "FileStorage",
6737
6832
  "kind": "class",
6738
6833
  "package": "@nifrajs/storage",
6739
- "signature": "export declare class FileStorage implements StorageAdapter {\n private root;\n private metadataRoot;\n private legacyMetadataRoot;\n private stagingRoot;\n private stateRoot;\n private statePrivate;\n /** Each key's latest write, so this instance publishes a key's body and sidecar one put at a time. */\n private readonly writes;\n /** The directory holding the root and its bookkeeping, by real path and identity, once resolved. */\n private anchor;\n constructor(root: string);\n private placeRoot;\n /**\n * Resolve the directory holding the root (or its nearest existing ancestor) once, then work beneath\n * that real path and prove before every operation that it is still the same directory. Swapping an\n * ancestor, for a symbolic link or by a rename from whoever can write above the root, then cannot\n * redirect a later read, write or delete into another tree: the operation fails closed instead.\n */\n private pinRoot;\n private movedError;\n /**\n * Move the pin down to the directory holding the root once it exists. Pinned at first use, the\n * anchor is the nearest existing ancestor; a directory a first write creates below it was never\n * checked again, so swapping it for a link redirected every later operation. Called right after\n * such a write creates directories, and before every operation.\n */\n private pinHolder;\n private resolveAnchor;\n private metadataPathFor;\n /** `<key>.json`, where earlier versions kept a sidecar: `a.json` there is also key `a.json`'s parent. */\n private legacyMetadataPathFor;\n private containedPath;\n /** Resolve `key` to an absolute path, asserting it stays inside `root` (defense-in-depth on top of `assertSafeKey`). */\n private pathFor;\n private symlinkError;\n private assertTrustedDirectory;\n /**\n * Prove that another local principal cannot rename any directory leading to `base` after validation.\n * A sticky shared parent (the ordinary `/tmp` case) is safe only while its child belongs to this uid.\n * Root-owned system directories are trusted; a directory owned by any other uid is not.\n */\n private assertTrustedAncestorChain;\n /** Reject existing symbolic links below `base`; missing suffixes are safe for later creation. */\n private assertNoSymlinkPath;\n /** {@link openContained} for an object: a directory under the root is a key prefix, not an object. */\n private openObject;\n /**\n * Open an existing file without following its final component, then prove the descriptor is the file\n * still reachable through a symlink-free path below the same root inode. Reads use the descriptor,\n * not the pathname checked earlier, closing their check/open race.\n */\n private openContained;\n private assertOpenedContained;\n /**\n * Write `data` whole or not at all: staged in a sibling directory, or next to `path` where a rename\n * from there would cross devices, then renamed over `path`, so a reader never sees a half-written\n * object and a failed write leaves the previous one. The renamed inode is then proven to be the\n * staged one, reachable beneath the same root.\n */\n private writeContained;\n private stageAndRename;\n /** A new, exclusively created file in `dir` holding `data`. */\n private stage;\n /**\n * Staged bytes and sidecars sit beside the root, where its own mode cannot cover them, so that tree\n * is the owner's alone. One an earlier version left open is closed once per instance.\n */\n private privateState;\n private closeState;\n /** Run `write` after this instance's earlier write of `key` settles. */\n private serialized;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n delete(key: string): Promise<void>;\n private readMetadata;\n private removeLegacyMetadata;\n exists(key: string): Promise<boolean>;\n /** Revalidate an opened inode immediately before unlinking its pathname. */\n private removeContained;\n list(options?: ListOptions): Promise<string[]>;\n /** The directory for key prefix `dirKey`, or `undefined` when no plain directory chain leads there. */\n private listingDirectory;\n private walk;\n private directoryEntries;\n}"
6834
+ "signature": "export declare class FileStorage implements StreamableStorageAdapter {\n private readonly maxReadBytes;\n private readonly maxMetadataBytes;\n private root;\n private metadataRoot;\n private legacyMetadataRoot;\n private stagingRoot;\n private stateRoot;\n private statePrivate;\n /** Each key's latest write, so this instance publishes a key's body and sidecar one put at a time. */\n private readonly writes;\n /** The directory holding the root and its bookkeeping, by real path and identity, once resolved. */\n private anchor;\n constructor(root: string, options?: {\n readonly maxReadBytes?: number;\n readonly maxMetadataBytes?: number;\n });\n private placeRoot;\n /**\n * Resolve the directory holding the root (or its nearest existing ancestor) once, then work beneath\n * that real path and prove before every operation that it is still the same directory. Swapping an\n * ancestor, for a symbolic link or by a rename from whoever can write above the root, then cannot\n * redirect a later read, write or delete into another tree: the operation fails closed instead.\n */\n private pinRoot;\n private movedError;\n /**\n * Move the pin down to the directory holding the root once it exists. Pinned at first use, the\n * anchor is the nearest existing ancestor; a directory a first write creates below it was never\n * checked again, so swapping it for a link redirected every later operation. Called right after\n * such a write creates directories, and before every operation.\n */\n private pinHolder;\n private resolveAnchor;\n private metadataPathFor;\n /** `<key>.json`, where earlier versions kept a sidecar: `a.json` there is also key `a.json`'s parent. */\n private legacyMetadataPathFor;\n private containedPath;\n /** Resolve `key` to an absolute path, asserting it stays inside `root` (defense-in-depth on top of `assertSafeKey`). */\n private pathFor;\n private symlinkError;\n private assertTrustedDirectory;\n /**\n * Prove that another local principal cannot rename any directory leading to `base` after validation.\n * A sticky shared parent (the ordinary `/tmp` case) is safe only while its child belongs to this uid.\n * Root-owned system directories are trusted; a directory owned by any other uid is not.\n */\n private assertTrustedAncestorChain;\n /** Reject existing symbolic links below `base`; missing suffixes are safe for later creation. */\n private assertNoSymlinkPath;\n /** {@link openContained} for an object: a directory under the root is a key prefix, not an object. */\n private openObject;\n private openKey;\n /**\n * Open an existing file without following its final component, then prove the descriptor is the file\n * still reachable through a symlink-free path below the same root inode. Reads use the descriptor,\n * not the pathname checked earlier, closing their check/open race.\n */\n private openContained;\n private assertOpenedContained;\n /**\n * Write `data` whole or not at all: staged in a sibling directory, or next to `path` where a rename\n * from there would cross devices, then renamed over `path`, so a reader never sees a half-written\n * object and a failed write leaves the previous one. The renamed inode is then proven to be the\n * staged one, reachable beneath the same root.\n */\n private writeContained;\n private stageAndRename;\n /** A new, exclusively created file in `dir` holding `data`. */\n private stage;\n /**\n * Staged bytes and sidecars sit beside the root, where its own mode cannot cover them, so that tree\n * is the owner's alone. One an earlier version left open is closed once per instance.\n */\n private privateState;\n private closeState;\n /** Run `write` after this instance's earlier write of `key` settles. */\n private serialized;\n private writeObjectAndMetadata;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n putStream(key: string, stream: ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;\n private resolveMetadata;\n /** Objects and their metadata each have a 16 MiB buffered-read limit by default.\n * Oversized reads throw a RangeError. */\n get(key: string): Promise<StorageObject | null>;\n head(key: string): Promise<StorageObjectMetadata | null>;\n getStream(key: string): Promise<StorageStreamObject | null>;\n delete(key: string): Promise<void>;\n private readMetadata;\n private removeLegacyMetadata;\n exists(key: string): Promise<boolean>;\n /** Revalidate an opened inode immediately before unlinking its pathname. */\n private removeContained;\n list(options?: ListOptions): Promise<string[]>;\n /** The directory for key prefix `dirKey`, or `undefined` when no plain directory chain leads there. */\n private listingDirectory;\n private walk;\n private directoryEntries;\n}"
6740
6835
  },
6741
6836
  {
6742
6837
  "name": "FileType",
@@ -6885,6 +6980,13 @@
6885
6980
  "package": "@nifrajs/i18n",
6886
6981
  "signature": "export interface FormatterOptions<M extends object = RegisteredMessages> {\n /** Catalogs to try, in order, for a key `messages` lacks: typically the base language's, then the\n * default locale's (`locales.chain(key)` gives that order). The formatter's locale still formats a\n * fallback message's numbers, dates and plurals. */\n readonly fallback?: readonly CatalogFor<M>[] | undefined;\n /** Called with a key no catalog has, once per key per formatter, before the key is returned. Pass a\n * stable function (module scope): formatters are cached per handler, so a new function on every\n * render builds a new formatter every render. */\n readonly onMissing?: ((key: string, locale: string) => void) | undefined;\n /** Default `timeZone` for `d()`. An invalid zone throws here, like `Intl.DateTimeFormat`. */\n readonly timeZone?: string | undefined;\n /** Default `numberingSystem` (`\"deva\"`, `\"arab\"`, ...) for `n()`, `d()` and plural `#`. */\n readonly numberingSystem?: string | undefined;\n}"
6887
6982
  },
6983
+ {
6984
+ "name": "FramedBodyArgs",
6985
+ "kind": "type",
6986
+ "package": "@nifrajs/core",
6987
+ "signature": "export type FramedBodyArgs<T> = [\n source: RequestSource,\n maxBodyBytes: number,\n protoPoisoning: ProtoPoisoning,\n onParsed: (parsed: unknown) => MaybePromise<T>,\n wrapResponse: (response: Response | ResponseResult) => T,\n onError: (err: unknown) => MaybePromise<T>,\n bodySchema?: object,\n formOrigins?: FormOrigins\n];",
6988
+ "doc": "/**\n * The arguments of {@link readBodyFramed}: the request, the byte cap and the prototype-poisoning\n * policy; the continuation for a parsed body, the wrapper for a refusal and the one for an error;\n * then the route's body schema and the origins a form may come from.\n */"
6989
+ },
6888
6990
  {
6889
6991
  "name": "Framework",
6890
6992
  "kind": "type",
@@ -6936,11 +7038,23 @@
6936
7038
  "signature": "export declare class Gauge {\n readonly name: string;\n readonly help: string;\n private readonly series;\n constructor(name: string, help: string);\n private at;\n inc(labels?: Labels, by?: number): void;\n dec(labels?: Labels, by?: number): void;\n set(labels: Labels, value: number): void;\n render(): string;\n}",
6937
7039
  "doc": "/** A value that can go up and down (in-flight requests, queue depth). */"
6938
7040
  },
7041
+ {
7042
+ "name": "GcsStorage",
7043
+ "kind": "class",
7044
+ "package": "@nifrajs/storage",
7045
+ "signature": "export declare class GcsStorage implements StreamableStorageAdapter, PagedStorageAdapter, MovableStorageAdapter {\n private readonly bucket;\n private readonly accessToken;\n private readonly origin;\n private readonly maxReadBytes;\n private readonly fetchImpl;\n constructor(options: GcsStorageOptions);\n private token;\n private objectUrl;\n private authedFetch;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n putStream(key: string, stream: ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;\n private upload;\n head(key: string): Promise<StorageObjectMetadata | null>;\n private objectVersion;\n exists(key: string): Promise<boolean>;\n get(key: string): Promise<StorageObject | null>;\n getStream(key: string): Promise<StorageStreamObject | null>;\n /**\n * Read one generation's metadata and bytes. An overwrite between the two retires that generation,\n * so a 404 re-reads the metadata: only a missing object there means the key is gone.\n */\n private download;\n delete(key: string): Promise<void>;\n list(options?: ListOptions): Promise<string[]>;\n listPage(options?: StorageListPageOptions): Promise<StorageListPage>;\n copy(sourceKey: string, destinationKey: string): Promise<void>;\n move(sourceKey: string, destinationKey: string): Promise<void>;\n}"
7046
+ },
7047
+ {
7048
+ "name": "GcsStorageOptions",
7049
+ "kind": "interface",
7050
+ "package": "@nifrajs/storage",
7051
+ "signature": "export interface GcsStorageOptions {\n readonly bucket: string;\n /** OAuth2 access token string or async provider returning a bearer token. */\n readonly accessToken: string | (() => string | Promise<string>);\n /** Custom API origin (e.g. local emulator). Defaults to `https://storage.googleapis.com`. */\n readonly endpoint?: string;\n /** Maximum bytes buffered by `get()`. Default 16 MiB. */\n readonly maxReadBytes?: number;\n /** Injectable fetch implementation (defaults to global `fetch`). */\n readonly fetch?: StorageFetch;\n}"
7052
+ },
6939
7053
  {
6940
7054
  "name": "GenerateClientEntryOptions",
6941
7055
  "kind": "interface",
6942
7056
  "package": "@nifrajs/web",
6943
- "signature": "export interface GenerateClientEntryOptions {\n /**\n * Module specifier for the adapter's client runtime, e.g. `\"@nifrajs/web-solid/client\"`.\n *\n * **Contract:** the module MUST export `mountRouter({ router, routes, container })`. The generated\n * bootstrap imports the specifier and calls it - so a self-executing entry that mounts on import\n * builds cleanly and then does nothing, which is the trap this contract exists to name. The type is\n * a bare `string` because a specifier is resolved by the bundler, not the type system, so the\n * requirement is enforced by the bootstrap instead: it throws immediately, naming this module and\n * the missing export, rather than failing later as `mountRouter is not a function`.\n */\n readonly clientModule: string;\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier. */\n readonly resolve: (file: string) => string;\n readonly serverComponents?: boolean;\n /** The build moved copy tables into per-locale chunks: the handover carries the chunk URLs, and a\n * navigation loads the copy of the URL it goes to beside the route's code. */\n readonly copyChunks?: boolean;\n /**\n * The server runs `createWebApp({ live })`: route loads go through its live load endpoint and the\n * entry keeps what is on screen fresh (`@nifrajs/web/live-client`). Absent, the entry is exactly the\n * non-live one.\n */\n readonly live?: LiveClientEntry | undefined;\n /**\n * A module whose default export is the `fetch` the router reaches its server through: for pages\n * that ship inside a native shell while the server lives elsewhere. An absolute path.\n */\n readonly transport?: string | undefined;\n}"
7057
+ "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 readonly serverLoaderRoutes?: readonly string[] | undefined;\n /** The build moved copy tables into per-locale chunks: the handover carries the chunk URLs, and a\n * navigation loads the copy of the URL it goes to beside the route's code. */\n readonly copyChunks?: boolean;\n /**\n * The server runs `createWebApp({ live })`: route loads go through its live load endpoint and the\n * entry keeps what is on screen fresh (`@nifrajs/web/live-client`). Absent, the entry is exactly the\n * non-live one.\n */\n readonly live?: LiveClientEntry | undefined;\n /**\n * A module whose default export is the `fetch` the router reaches its server through: for pages\n * that ship inside a native shell while the server lives elsewhere. An absolute path.\n */\n readonly transport?: string | undefined;\n}"
6944
7058
  },
6945
7059
  {
6946
7060
  "name": "GenerateRegressionTestOptions",
@@ -6986,7 +7100,7 @@
6986
7100
  "name": "GraphqlHttpOptions",
6987
7101
  "kind": "interface",
6988
7102
  "package": "@nifrajs/graphql",
6989
- "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 selections that fragments, named and inline, bring into the selection sets holding them,\n * summed over the document. Validation walks each one per selection set, so a long chain of\n * fragments that select almost nothing costs quadratic work within the depth and complexity limits.\n * Default 20,000.\n */\n readonly maxFragmentExpansion?: number;\n /**\n * Maximum fragment comparisons validation makes: in each selection set it compares every two\n * fragments spread there and, pair by pair, the fragments each reaches. Many fragments that select\n * few fields cost work in the square of their count within the other limits. The default admits a\n * binary tree of 255 fragments. Default 100,000.\n */\n readonly maxFragmentComparisons?: 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}"
7103
+ "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 selections that fragments, named and inline, bring into the selection sets holding them,\n * summed over the document. Validation walks each one per selection set, so a long chain of\n * fragments that select almost nothing costs quadratic work within the depth and complexity limits.\n * Default 20,000.\n */\n readonly maxFragmentExpansion?: number;\n /**\n * Maximum fragment comparisons validation makes: in each selection set it compares every two\n * fragments spread there and, pair by pair, the fragments each reaches. Many fragments that select\n * few fields cost work in the square of their count within the other limits. The default admits a\n * binary tree of 255 fragments. Default 100,000.\n */\n readonly maxFragmentComparisons?: 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. A throw\n * is logged and answers a `500`, masked by the default formatter; `formatError` receives a thrown `Error`\n * as `originalError`, and any other value as the `cause` of an `Error` there, and decides what it shows.\n * A thrown `Response` is sent as is, unlogged.\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}"
6990
7104
  },
6991
7105
  {
6992
7106
  "name": "GraphqlPubSub",
@@ -7396,6 +7510,13 @@
7396
7510
  "signature": "export type HtmlValue = string | number | bigint | boolean | null | undefined | Template | RawHtml | ReadonlyArray<HtmlValue>;",
7397
7511
  "doc": "/** What an interpolation may be: escaped primitives, nested templates/raw, arrays of the same.\n * `null`/`undefined`/`false` render as nothing (conditional rendering: `cond && html\\`…\\``). */"
7398
7512
  },
7513
+ {
7514
+ "name": "Http2Options",
7515
+ "kind": "interface",
7516
+ "package": "@nifrajs/node-engine",
7517
+ "signature": "export interface Http2Options {\n readonly maxConcurrentStreams?: number;\n /** Flow-control window of each request body, in bytes. Default 1 MiB. */\n readonly initialWindowSize?: number;\n /** Flow-control window of the whole connection, 65535 or more. Default 4 MiB. */\n readonly connectionWindowSize?: number;\n /** Largest frame accepted, 16384 to 16777215. Default 16384. */\n readonly maxFrameSize?: number;\n /** Bytes of each HPACK table, request and response side; 0 to 65536. Default 4096. */\n readonly headerTableSize?: number;\n /**\n * Queued response bytes per connection. At this limit the next buffered response with a body is\n * reset with `ENHANCE_YOUR_CALM`, and past it a streamed one is told to wait. Default 16 MiB.\n */\n readonly maxSendBuffer?: number;\n /**\n * Send a `PING` to a connection quiet for this long, and close it when no answer comes. A peer that\n * answers is not idle, so set this below `idleTimeoutMs` to keep a live one open. Timers are checked\n * once a second. Off by default (`0`).\n */\n readonly pingIntervalMs?: number;\n /** Budget in ms for that answer. Default 20 s. */\n readonly pingTimeoutMs?: number;\n}",
7518
+ "doc": "/** HTTP/2 settings the server advertises. */"
7519
+ },
7399
7520
  {
7400
7521
  "name": "HttpAgentTransport",
7401
7522
  "kind": "class",
@@ -7556,7 +7677,7 @@
7556
7677
  "name": "ISROptions",
7557
7678
  "kind": "interface",
7558
7679
  "package": "@nifrajs/web",
7559
- "signature": "export interface ISROptions {\n readonly store: CacheStore;\n /** Maximum UTF-8 bytes captured for one document. Larger pages stream without caching.\n * Default 2 MiB. */\n readonly maxEntryBytes?: number;\n /**\n * Signs every page written to `store` and checks the signature on every read, so whoever else can\n * write the store (another service on the same KV namespace, a leaked token) cannot hand visitors a\n * page this app did not render. Required for every store but a {@link MemoryCacheStore}, whose\n * pages never leave the process and stay unsigned. The same in every process, at least 32\n * characters, and random: generate it, such as 32 random bytes as hex, since a guessable secret\n * can be found from any signed page and then signs pages of its own. A page whose signature is\n * missing or wrong reads as a miss and renders again, so a new secret only empties the cache. It\n * cannot stop a store writer from deleting pages, or from putting back an older page this app\n * stored for the same key. That page keeps its age: still within its freshness window, it is a hit\n * until the window ends; past it, it serves stale and regenerates.\n */\n readonly storeSecret?: string;\n /** Default freshness window (**seconds**) for a cached page; older ⇒ stale (served, regenerated\n * behind). A route overrides it per-page via `export const revalidate` (surfaced as the\n * `x-nifra-isr-revalidate` response header). */\n readonly revalidate: number;\n /** Monotonic clock (ms) - injected for testability; production passes `() => Date.now()`. */\n readonly now: () => number;\n /** Cache key for a request. Default: `origin + pathname`, plus the query parameters `query` admits,\n * so host-routed apps do not share entries across tenants. Return `null` to bypass the cache for\n * this request (it goes straight to the app, uncached). Replaces `query` entirely. Under the default\n * key a request carrying `Authorization` or a cookie outside `anonymousCookies` never reads the\n * store; a custom key takes that decision over, so include whatever identifies the visitor in it.\n * An action's `revalidate(paths)` keys each path with the action request's own headers, so it purges\n * the variant that client reads; a variant keyed on another header value (another language) is not\n * reached - tag those pages and revalidate the tag. */\n readonly key?: (req: Request) => string | null;\n /**\n * Cookie names that never change the page, such as a consent or analytics cookie. Under the default\n * key a request carrying `Authorization` or any other cookie skips the stored page and renders fresh,\n * because a signed-in visitor's page can differ from the anonymous one; a request whose cookies are\n * all listed here is served from the cache like one with none. Default none.\n */\n readonly anonymousCookies?: readonly string[];\n /**\n * How the query string reaches the default key. Default `\"bypass\"`: a request carrying any query\n * parameter skips the cache - rendered fresh, never stored - so `?a=1`, `?a=2`, ... cannot each\n * store a full page. A list caches by those parameters only, in any order (`?b=2&a=1` and\n * `?a=1&b=2` share an entry); a request carrying any other parameter still bypasses, because a\n * loader that reads it would otherwise be served another request's page. `\"all\"` keys on the whole\n * query string, so every distinct query is a new entry.\n */\n readonly query?: ISRQuery;\n /** Draft/preview secret (the same one given to `createWebApp({ draftSecret })` + `enableDraft`). When\n * set, a request carrying a valid signed draft cookie **bypasses the cache** - editors always render\n * fresh, and a draft render is never written to the store (it can't poison the public cache). */\n readonly draftSecret?: string;\n /**\n * Called when a store call fails: it throws, rejects, or outlives {@link storeTimeoutMs}, or (op\n * `\"verify\"`) a page it returns fails its {@link storeSecret} signature check. The request is served\n * without the cache either way - a failed read is a miss, a failed write still returns the rendered\n * page, a failed regeneration keeps the stale entry - so a store outage never changes a status.\n * Default: one `console.error` line per operation per minute, never naming the cache key.\n */\n readonly onStoreError?: (error: unknown, info: {\n readonly op: ISRStoreOp;\n }) => void;\n /**\n * Longest a store call may take (ms) before it counts as failed. Default none, so a hung store holds\n * the request; set it when the store is a network service.\n */\n readonly storeTimeoutMs?: number;\n /**\n * Caches below the pages whose entries carry the same tags, such as a `@nifrajs/cache` holding loader\n * data. An action's `revalidate(paths, data, { tags })` invalidates them first, then this store, then\n * publishes to live pages, then purges `cdn`; a cache that fails stops the rest, so no client reloads\n * stale data.\n */\n readonly dataCaches?: readonly {\n invalidateTag(tag: string): unknown;\n }[];\n /** A CDN an action's invalidation purges last (a `@nifrajs/web/cdn` provider). */\n readonly cdn?: CdnPurgeTarget;\n /**\n * An action's invalidation that still failed after its retries; the action's own answer never\n * changes. Default: one `console.error` line naming the operation id and stage.\n */\n readonly onInvalidationError?: (report: InvalidationReport) => void;\n}"
7680
+ "signature": "export interface ISROptions {\n readonly store: CacheStore;\n /** Maximum UTF-8 bytes captured for one document. Larger pages stream without caching.\n * A store with purge fences can fill its cache while a cold document streams. Default 2 MiB. */\n readonly maxEntryBytes?: number;\n /**\n * Signs every page written to `store` and checks the signature on every read, so whoever else can\n * write the store (another service on the same KV namespace, a leaked token) cannot hand visitors a\n * page this app did not render. Required for every store but a {@link MemoryCacheStore}, whose\n * pages never leave the process and stay unsigned. The same in every process, at least 32\n * characters, and random: generate it, such as 32 random bytes as hex, since a guessable secret\n * can be found from any signed page and then signs pages of its own. A page whose signature is\n * missing or wrong reads as a miss and renders again, so a new secret only empties the cache. It\n * cannot stop a store writer from deleting pages, or from putting back an older page this app\n * stored for the same key. That page keeps its age: still within its freshness window, it is a hit\n * until the window ends; past it, it serves stale and regenerates.\n */\n readonly storeSecret?: string;\n /** Default freshness window (**seconds**) for a cached page; older ⇒ stale (served, regenerated\n * behind). A route overrides it per-page via `export const revalidate` (surfaced as the\n * `x-nifra-isr-revalidate` response header). */\n readonly revalidate: number;\n /** Monotonic clock (ms) - injected for testability; production passes `() => Date.now()`. */\n readonly now: () => number;\n /** Cache key for a request. Default: `origin + pathname`, plus the query parameters `query` admits,\n * so host-routed apps do not share entries across tenants. Return `null` to bypass the cache for\n * this request (it goes straight to the app, uncached). Replaces `query` entirely. Under the default\n * key a request carrying `Authorization` or a cookie outside `anonymousCookies` never reads the\n * store; a custom key takes that decision over, so include whatever identifies the visitor in it.\n * An action's `revalidate(paths)` keys each path with the action request's own headers, so it purges\n * the variant that client reads; a variant keyed on another header value (another language) is not\n * reached - tag those pages and revalidate the tag. */\n readonly key?: (req: Request) => string | null;\n /**\n * Cookie names that never change the page, such as a consent or analytics cookie. Under the default\n * key a request carrying `Authorization` or any other cookie skips the stored page and renders fresh,\n * because a signed-in visitor's page can differ from the anonymous one; a request whose cookies are\n * all listed here is served from the cache like one with none. Default none.\n */\n readonly anonymousCookies?: readonly string[];\n /**\n * How the query string reaches the default key. Default `\"bypass\"`: a request carrying any query\n * parameter skips the cache - rendered fresh, never stored - so `?a=1`, `?a=2`, ... cannot each\n * store a full page. A list caches by those parameters only, in any order (`?b=2&a=1` and\n * `?a=1&b=2` share an entry); a request carrying any other parameter still bypasses, because a\n * loader that reads it would otherwise be served another request's page. `\"all\"` keys on the whole\n * query string, so every distinct query is a new entry.\n */\n readonly query?: ISRQuery;\n /** Draft/preview secret (the same one given to `createWebApp({ draftSecret })` + `enableDraft`). When\n * set, a request carrying a valid signed draft cookie **bypasses the cache** - editors always render\n * fresh, and a draft render is never written to the store (it can't poison the public cache). */\n readonly draftSecret?: string;\n /**\n * Called when a store call fails: it throws, rejects, or outlives {@link storeTimeoutMs}, or (op\n * `\"verify\"`) a page it returns fails its {@link storeSecret} signature check. The request is served\n * without the cache either way - a failed read is a miss, a failed write still returns the rendered\n * page, a failed regeneration keeps the stale entry - so a store outage never changes a status.\n * Default: one `console.error` line per operation per minute, never naming the cache key.\n */\n readonly onStoreError?: (error: unknown, info: {\n readonly op: ISRStoreOp;\n }) => void;\n /**\n * Longest a store call may take (ms) before it counts as failed. Default none, so a hung store holds\n * the request; set it when the store is a network service.\n */\n readonly storeTimeoutMs?: number;\n /**\n * Caches below the pages whose entries carry the same tags, such as a `@nifrajs/cache` holding loader\n * data. An action's `revalidate(paths, data, { tags })` invalidates them first, then this store, then\n * publishes to live pages, then purges `cdn`; a cache that fails stops the rest, so no client reloads\n * stale data.\n */\n readonly dataCaches?: readonly {\n invalidateTag(tag: string): unknown;\n }[];\n /** A CDN an action's invalidation purges last (a `@nifrajs/web/cdn` provider). */\n readonly cdn?: CdnPurgeTarget;\n /**\n * An action's invalidation that still failed after its retries; the action's own answer never\n * changes. Default: one `console.error` line naming the operation id and stage.\n */\n readonly onInvalidationError?: (report: InvalidationReport) => void;\n}"
7560
7681
  },
7561
7682
  {
7562
7683
  "name": "ISRPlatform",
@@ -8258,15 +8379,15 @@
8258
8379
  "name": "IslandStrategy",
8259
8380
  "kind": "type",
8260
8381
  "package": "@nifrajs/island-trigger",
8261
- "signature": "export type IslandStrategy = \"load\" | \"idle\" | \"visible\" | {\n readonly media: string;\n};",
8262
- "doc": "/** When an island's enhancer runs. An object strategy is intentionally limited to media queries. */"
8382
+ "signature": "export type IslandStrategy = \"load\" | \"idle\" | \"visible\" | \"interaction\" | {\n readonly media: string;\n};",
8383
+ "doc": "/**\n * When an island's enhancer runs. `interaction` waits for the first hover, press, focus or click on\n * the island's own element. A click mounts during capture on the host. Listeners attached during\n * mount can receive the click at a descendant target or in the host's non-capture phase. An object\n * strategy is limited to media queries.\n */"
8263
8384
  },
8264
8385
  {
8265
8386
  "name": "IslandStrategy",
8266
8387
  "kind": "type",
8267
8388
  "package": "@nifrajs/web",
8268
- "signature": "export type IslandStrategy = \"load\" | \"idle\" | \"visible\" | {\n readonly media: string;\n};",
8269
- "doc": "/** When an island's enhancer runs. An object strategy is intentionally limited to media queries. */"
8389
+ "signature": "export type IslandStrategy = \"load\" | \"idle\" | \"visible\" | \"interaction\" | {\n readonly media: string;\n};",
8390
+ "doc": "/**\n * When an island's enhancer runs. `interaction` waits for the first hover, press, focus or click on\n * the island's own element. A click mounts during capture on the host. Listeners attached during\n * mount can receive the click at a descendant target or in the host's non-capture phase. An object\n * strategy is limited to media queries.\n */"
8270
8391
  },
8271
8392
  {
8272
8393
  "name": "IsolatedExtensionSnapshot",
@@ -8284,14 +8405,14 @@
8284
8405
  "name": "IsolatedExtensionWorker",
8285
8406
  "kind": "class",
8286
8407
  "package": "@nifrajs/coding-agent",
8287
- "signature": "export declare class IsolatedExtensionWorker {\n private readonly options;\n private process;\n private readonly pending;\n private readonly tools;\n private readonly commands;\n private readonly events;\n private buffer;\n private readonly token;\n private port;\n private started;\n private closed;\n private readyResolve;\n private readyReject;\n private readonly ready;\n constructor(options: IsolatedExtensionWorkerOptions);\n start(): Promise<IsolatedExtensionSnapshot>;\n get snapshot(): IsolatedExtensionSnapshot;\n invokeTool(name: string, input: unknown): Promise<unknown>;\n close(): Promise<void>;\n private sendInvoke;\n private readOutput;\n private readErrors;\n private consume;\n private handle;\n private fail;\n}",
8288
- "doc": "/**\n * Optional process-backed extension runner. A worker crash rejects callers instead of taking down\n * the host. It is intentionally not advertised as a hostile-code sandbox: use an OS sandbox and a\n * capability decision before loading code you do not trust.\n */"
8408
+ "signature": "export declare class IsolatedExtensionWorker {\n private readonly options;\n private process;\n private scratchDir;\n private queuedInputBytes;\n private stopCommand;\n private stopping;\n private failure;\n private readonly pending;\n private readonly tools;\n private readonly commands;\n private readonly events;\n private buffer;\n private readonly token;\n private port;\n private started;\n private closed;\n private readyResolve;\n private readyReject;\n private readonly ready;\n constructor(options: IsolatedExtensionWorkerOptions);\n start(): Promise<IsolatedExtensionSnapshot>;\n get snapshot(): IsolatedExtensionSnapshot;\n invokeTool(name: string, input: unknown): Promise<unknown>;\n close(): Promise<void>;\n /** End a worker that broke the protocol: nothing more it writes is read. */\n private abort;\n private forceKill;\n private removeContainer;\n private cleanupScratch;\n private tryCleanupScratch;\n private sendInvoke;\n private readOutput;\n private readErrors;\n private consume;\n private handle;\n private fail;\n}",
8409
+ "doc": "/**\n * Optional process-backed extension runner. A worker crash rejects callers instead of taking down\n * the host. Built-in container and macOS Seatbelt profiles apply an OS-level boundary.\n * With a custom profile, the caller supplies the boundary through its wrap callback.\n */"
8289
8410
  },
8290
8411
  {
8291
8412
  "name": "IsolatedExtensionWorkerOptions",
8292
8413
  "kind": "interface",
8293
8414
  "package": "@nifrajs/coding-agent",
8294
- "signature": "export interface IsolatedExtensionWorkerOptions {\n readonly modulePath: string;\n readonly cwd: string;\n /** How long one tool call may run. Default 30 s. */\n readonly timeoutMs?: number;\n /** How long `start()` waits for the module to load and register. Default 30 s. */\n readonly startTimeoutMs?: number;\n readonly maxMessageBytes?: number;\n /** Include bounded worker exception stacks for trusted local debugging. */\n readonly exposeErrorStacks?: boolean;\n readonly trustedCapabilities?: readonly string[];\n}"
8415
+ "signature": "export interface IsolatedExtensionWorkerOptions {\n readonly modulePath: string;\n readonly cwd: string;\n /** How long one tool call may run. Default 30 s. */\n readonly timeoutMs?: number;\n /** How long `start()` waits for the module to load and register. Default 30 s. */\n readonly startTimeoutMs?: number;\n readonly maxMessageBytes?: number;\n /** Include bounded worker exception stacks for trusted local debugging. */\n readonly exposeErrorStacks?: boolean;\n readonly trustedCapabilities?: readonly string[];\n /** Optional OS/container sandbox profile wrapping the worker process. */\n readonly sandbox?: ExtensionSandboxProfile;\n}"
8295
8416
  },
8296
8417
  {
8297
8418
  "name": "IsolationClass",
@@ -9494,6 +9615,12 @@
9494
9615
  "signature": "export declare const MODERN_PROTOCOL_VERSION = \"2026-07-28\";",
9495
9616
  "doc": "/** The stateless per-request revision (2026-07-28+). A request carrying its version in `_meta`\n * (`io.modelcontextprotocol/protocolVersion`) is served in modern mode; an `initialize` request stays\n * legacy. This server is dual-era: `handleRpc` answers both on the same dispatch, per request. */"
9496
9617
  },
9618
+ {
9619
+ "name": "MacOsSeatbeltSandboxProfile",
9620
+ "kind": "interface",
9621
+ "package": "@nifrajs/coding-agent",
9622
+ "signature": "export interface MacOsSeatbeltSandboxProfile {\n readonly kind: \"macos-seatbelt\";\n /** Allow network access. Default `false`. */\n readonly allowNetwork?: boolean;\n /** Allow writes inside `cwd`. Default `false` (read-only workspace). */\n readonly allowWorkspaceWrite?: boolean;\n /** Extra readable paths needed by the runtime (e.g. executable directory). */\n readonly allowReadPaths?: readonly string[];\n}"
9623
+ },
9497
9624
  {
9498
9625
  "name": "Manifest",
9499
9626
  "kind": "interface",
@@ -9843,7 +9970,7 @@
9843
9970
  "name": "MemoryEvidenceStore",
9844
9971
  "kind": "class",
9845
9972
  "package": "@nifrajs/coding-agent",
9846
- "signature": "export declare class MemoryEvidenceStore implements EvidenceStore {\n private readonly accumulator;\n constructor(options?: MemoryEvidenceStoreOptions);\n append(record: RunEvidence): Promise<void>;\n get count(): number;\n live(): readonly RunEvidence[];\n counters(): EvidenceCounters;\n completedNodeIds(): readonly string[];\n artifacts(): readonly ArtifactRef[];\n digest(): Promise<string>;\n}",
9973
+ "signature": "export declare class MemoryEvidenceStore implements EvidenceStore {\n protected readonly accumulator: EvidenceAccumulator;\n constructor(options?: MemoryEvidenceStoreOptions);\n append(record: RunEvidence): Promise<void>;\n get count(): number;\n live(): readonly RunEvidence[];\n counters(): EvidenceCounters;\n completedNodeIds(): readonly string[];\n artifacts(): readonly ArtifactRef[];\n digest(): Promise<string>;\n}",
9847
9974
  "doc": "/** A fully in-memory bounded store. Keeps a window plus aggregates; never the whole stream. */"
9848
9975
  },
9849
9976
  {
@@ -9951,13 +10078,13 @@
9951
10078
  "name": "MemoryStorage",
9952
10079
  "kind": "class",
9953
10080
  "package": "@nifrajs/storage",
9954
- "signature": "export declare class MemoryStorage implements StorageAdapter {\n private readonly objects;\n constructor();\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n list(options?: ListOptions): Promise<string[]>;\n}"
10081
+ "signature": "export declare class MemoryStorage implements StreamableStorageAdapter {\n private readonly objects;\n constructor();\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n putStream(key: string, stream: ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n head(key: string): Promise<StorageObjectMetadata | null>;\n getStream(key: string): Promise<StorageStreamObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n list(options?: ListOptions): Promise<string[]>;\n}"
9955
10082
  },
9956
10083
  {
9957
10084
  "name": "MemoryStore",
9958
10085
  "kind": "class",
9959
10086
  "package": "@nifrajs/middleware",
9960
- "signature": "export declare class MemoryStore implements RateLimitStore {\n private readonly windows;\n private scan;\n private sweepScan;\n private readonly maxKeys;\n private readonly sweepIntervalMs;\n private lastSweep;\n private evictionScans;\n /** Cumulative entries inspected by the eviction scan since construction - an eviction-pressure\n * gauge. The bounded scan keeps this ~O(1) per over-cap insert (≤ {@link MAX_EVICTION_SCAN}); a\n * regressed full O(n) sweep would make it ~maxKeys per insert (what the regression test asserts). */\n get evictionScanCount(): number;\n constructor(options?: MemoryStoreOptions);\n hit(key: string, windowMs: number): Promise<RateLimitResult>;\n private stepSweep;\n private reclaimExpired;\n}",
10087
+ "signature": "export declare class MemoryStore implements RateLimitStore {\n #private;\n private readonly windows;\n private scan;\n private sweepScan;\n private readonly maxKeys;\n private readonly sweepIntervalMs;\n private lastSweep;\n private evictionScans;\n /** Cumulative entries inspected by the eviction scan since construction - an eviction-pressure\n * gauge. The bounded scan keeps this ~O(1) per over-cap insert (≤ {@link MAX_EVICTION_SCAN}); a\n * regressed full O(n) sweep would make it ~maxKeys per insert (what the regression test asserts). */\n get evictionScanCount(): number;\n constructor(options?: MemoryStoreOptions);\n hit(key: string, windowMs: number): Promise<RateLimitResult>;\n private stepSweep;\n private reclaimExpired;\n}",
9961
10088
  "doc": "/**\n * In-process fixed-window store. Refuses to run in production unless explicitly allowed.\n *\n * Bounded against unbounded growth: expired windows are swept lazily (amortized, at most once per\n * `sweepIntervalMs`) and the key set is hard-capped at `maxKeys` (expired keys are evicted first,\n * then new keys are refused without resetting live quotas).\n * Without this, expired entries for keys never seen again - and the unbounded key space of a bot scan\n * - would accumulate in the map forever and OOM a single-instance deploy.\n */"
9962
10089
  },
9963
10090
  {
@@ -10291,13 +10418,13 @@
10291
10418
  "name": "MountAgUIOptions",
10292
10419
  "kind": "interface",
10293
10420
  "package": "@nifrajs/ag-ui",
10294
- "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}"
10421
+ "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 * Also runs on a `Last-Event-ID` reconnect, before anything is replayed, although no turn starts:\n * a budget or rate-limit charge made here is made again.\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}"
10295
10422
  },
10296
10423
  {
10297
10424
  "name": "MountAgentOptions",
10298
10425
  "kind": "interface",
10299
10426
  "package": "@nifrajs/agent",
10300
- "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}"
10427
+ "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 * Also runs on a `Last-Event-ID` reconnect, before anything is replayed, although no turn starts:\n * a budget or rate-limit charge made here is made again.\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}"
10301
10428
  },
10302
10429
  {
10303
10430
  "name": "MountFetchOptions",
@@ -10902,14 +11029,14 @@
10902
11029
  "name": "NifraWebSocket",
10903
11030
  "kind": "interface",
10904
11031
  "package": "@nifrajs/core",
10905
- "signature": "export interface NifraWebSocket<Data = unknown> {\n /** Send a text (`string`) or binary (`ArrayBuffer`/typed-array) frame. No-op once closed. */\n send(data: string | ArrayBufferView | ArrayBuffer): void;\n /** Close the connection, with a code an endpoint may send (1000-1003, 1007-1014, 3000-4999;\n * 1000 when none is given, on every runtime) and a reason of at most 123 UTF-8 bytes. Any other\n * close throws a `RangeError`, and the socket stays open. */\n close(code?: number, reason?: string): void;\n /** `WebSocket.readyState` (0 CONNECTING · 1 OPEN · 2 CLOSING · 3 CLOSED). */\n readonly readyState: number;\n /** Join a pub/sub topic - `app.publish(topic, data)` then reaches this connection. Idempotent. */\n subscribe(topic: string): void;\n /** Leave a pub/sub topic. Idempotent. (All topics are dropped automatically on close.) */\n unsubscribe(topic: string): void;\n /** Per-connection state - seeded by `upgrade()`, mutable for the connection's lifetime. */\n data: Data;\n /** Escape hatch to the runtime's native socket (Bun `ServerWebSocket`, Web `WebSocket`, `ws`). */\n readonly raw: unknown;\n}",
11032
+ "signature": "export interface NifraWebSocket<Data = unknown> {\n /** Send a text (`string`) or binary (`ArrayBuffer`/typed-array) frame. No-op once closed. */\n send(data: string | ArrayBufferView | ArrayBuffer): void;\n /** Close the connection, with a code an endpoint may send (1000-1003, 1007-1014, 3000-4999;\n * 1000 when none is given, on every runtime) and a reason of at most 123 UTF-8 bytes. Any other\n * close throws a `RangeError`, and the socket stays open. */\n close(code?: number, reason?: string): void;\n /** `WebSocket.readyState` (0 CONNECTING · 1 OPEN · 2 CLOSING · 3 CLOSED). */\n readonly readyState: number;\n /** Join a pub/sub topic - `app.publish(topic, data)` then reaches this connection. Idempotent. */\n subscribe(topic: string): void;\n /** Leave a pub/sub topic. Idempotent. (All topics are dropped automatically on close.) */\n unsubscribe(topic: string): void;\n /** Current queued outbound bytes on the underlying socket, when the transport reports backpressure. */\n getBufferedAmount?(): number;\n /** Batch multiple outbound operations (e.g. `send`) inside `callback` into a single flush. */\n cork?(callback: () => void): void;\n /** Per-connection state - seeded by `upgrade()`, mutable for the connection's lifetime. */\n data: Data;\n /** Escape hatch to the runtime's native socket (Bun `ServerWebSocket`, Web `WebSocket`, `ws`). */\n readonly raw: unknown;\n}",
10906
11033
  "doc": "/** The portable socket handed to WS lifecycle callbacks. Each adapter wraps its native socket. */"
10907
11034
  },
10908
11035
  {
10909
11036
  "name": "NifraWebSocket",
10910
11037
  "kind": "interface",
10911
11038
  "package": "nifra",
10912
- "signature": "export interface NifraWebSocket<Data = unknown> {\n /** Send a text (`string`) or binary (`ArrayBuffer`/typed-array) frame. No-op once closed. */\n send(data: string | ArrayBufferView | ArrayBuffer): void;\n /** Close the connection, with a code an endpoint may send (1000-1003, 1007-1014, 3000-4999;\n * 1000 when none is given, on every runtime) and a reason of at most 123 UTF-8 bytes. Any other\n * close throws a `RangeError`, and the socket stays open. */\n close(code?: number, reason?: string): void;\n /** `WebSocket.readyState` (0 CONNECTING · 1 OPEN · 2 CLOSING · 3 CLOSED). */\n readonly readyState: number;\n /** Join a pub/sub topic - `app.publish(topic, data)` then reaches this connection. Idempotent. */\n subscribe(topic: string): void;\n /** Leave a pub/sub topic. Idempotent. (All topics are dropped automatically on close.) */\n unsubscribe(topic: string): void;\n /** Per-connection state - seeded by `upgrade()`, mutable for the connection's lifetime. */\n data: Data;\n /** Escape hatch to the runtime's native socket (Bun `ServerWebSocket`, Web `WebSocket`, `ws`). */\n readonly raw: unknown;\n}",
11039
+ "signature": "export interface NifraWebSocket<Data = unknown> {\n /** Send a text (`string`) or binary (`ArrayBuffer`/typed-array) frame. No-op once closed. */\n send(data: string | ArrayBufferView | ArrayBuffer): void;\n /** Close the connection, with a code an endpoint may send (1000-1003, 1007-1014, 3000-4999;\n * 1000 when none is given, on every runtime) and a reason of at most 123 UTF-8 bytes. Any other\n * close throws a `RangeError`, and the socket stays open. */\n close(code?: number, reason?: string): void;\n /** `WebSocket.readyState` (0 CONNECTING · 1 OPEN · 2 CLOSING · 3 CLOSED). */\n readonly readyState: number;\n /** Join a pub/sub topic - `app.publish(topic, data)` then reaches this connection. Idempotent. */\n subscribe(topic: string): void;\n /** Leave a pub/sub topic. Idempotent. (All topics are dropped automatically on close.) */\n unsubscribe(topic: string): void;\n /** Current queued outbound bytes on the underlying socket, when the transport reports backpressure. */\n getBufferedAmount?(): number;\n /** Batch multiple outbound operations (e.g. `send`) inside `callback` into a single flush. */\n cork?(callback: () => void): void;\n /** Per-connection state - seeded by `upgrade()`, mutable for the connection's lifetime. */\n data: Data;\n /** Escape hatch to the runtime's native socket (Bun `ServerWebSocket`, Web `WebSocket`, `ws`). */\n readonly raw: unknown;\n}",
10913
11040
  "doc": "/** The portable socket handed to WS lifecycle callbacks. Each adapter wraps its native socket. */"
10914
11041
  },
10915
11042
  {
@@ -10919,6 +11046,12 @@
10919
11046
  "signature": "export interface NodeBuiltinFinding {\n readonly builtin: string;\n readonly chunk: string;\n /** The shortest import path from a user entry to the builtin, as a list of display labels:\n * `[entryFile, ...as-written specifiers along the way, builtin]`, e.g.\n * `[\"routes/article/[slug].tsx\", \"../data.ts\", \"../db/client.ts\", \"postgres\", \"node:tls\"]`. The\n * entry is its graph key (the route file); each hop is the import's *as-written* specifier; the tail\n * is the builtin. Empty only if the builtin module isn't reachable from any traced input (it always\n * is when flagged). */\n readonly chain: readonly string[];\n}",
10920
11047
  "doc": "/** One `node:`-builtin-in-the-client finding: the offending builtin, the emitted chunk it landed in,\n * and the shortest USER-module import chain that pulled it there (entry → … → builtin). */"
10921
11048
  },
11049
+ {
11050
+ "name": "NodeCompatPair",
11051
+ "kind": "interface",
11052
+ "package": "@nifrajs/node-engine",
11053
+ "signature": "export interface NodeCompatPair {\n readonly req: IncomingMessage;\n readonly res: ServerResponse;\n readonly socket: CompatSocket;\n readonly response: Promise<Response>;\n headersForResponse(): Headers;\n}"
11054
+ },
10922
11055
  {
10923
11056
  "name": "NodeEffectKey",
10924
11057
  "kind": "interface",
@@ -10933,6 +11066,18 @@
10933
11066
  "signature": "export interface NodeEffectKey {\n /** SHA-256 hex over the canonical effect material. 64 lowercase hex chars. */\n readonly digest: string;\n /** Non-secret structural coordinates, safe to log. */\n readonly planDigest: string;\n readonly nodeId: string;\n}",
10934
11067
  "doc": "/** The stable, content-free identity of one side-effecting node attempt-boundary. */"
10935
11068
  },
11069
+ {
11070
+ "name": "NodeMiddleware",
11071
+ "kind": "type",
11072
+ "package": "@nifrajs/node-engine",
11073
+ "signature": "export type NodeMiddleware = (req: IncomingMessage, res: ServerResponse, next: (error?: unknown) => void) => void;"
11074
+ },
11075
+ {
11076
+ "name": "NodeMiddlewareContextLike",
11077
+ "kind": "interface",
11078
+ "package": "@nifrajs/node-engine",
11079
+ "signature": "export interface NodeMiddlewareContextLike {\n readonly req: Request;\n readonly set?: {\n status?: number;\n readonly headers: Record<string, string>;\n /** @internal Raw Set-Cookie values consumed by the core response writer. */\n _cookies?: string[];\n };\n}"
11080
+ },
10936
11081
  {
10937
11082
  "name": "NodeNativeProxyRequest",
10938
11083
  "kind": "interface",
@@ -10975,6 +11120,12 @@
10975
11120
  "signature": "export type NodeRequestHook = (request: NodeRequestContext, platform?: Platform) => MaybePromise<Response | undefined>;",
10976
11121
  "doc": "/** Native equivalent of a paired `onRequest` hook. It may short-circuit, but cannot rewrite a request. */"
10977
11122
  },
11123
+ {
11124
+ "name": "NodeRequestListener",
11125
+ "kind": "type",
11126
+ "package": "@nifrajs/node-engine",
11127
+ "signature": "export type NodeRequestListener = (req: IncomingMessage, res: ServerResponse) => void;"
11128
+ },
10978
11129
  {
10979
11130
  "name": "NodeResponseBodyHook",
10980
11131
  "kind": "type",
@@ -11050,6 +11201,13 @@
11050
11201
  "signature": "export interface NodeStopOptions {\n /** How long in-flight requests get to finish before the stop forces them closed. Default 10_000. */\n readonly drainMs?: number;\n /**\n * How long the server keeps serving after `stop()` began, before it stops accepting connections:\n * the time a load balancer takes to see readiness fail. Default 0.\n */\n readonly delayMs?: number;\n}",
11051
11202
  "doc": "/** How `stop()` winds the server down; the same shape as nifra's Bun `stop()` takes. */"
11052
11203
  },
11204
+ {
11205
+ "name": "NodeStopOptions",
11206
+ "kind": "interface",
11207
+ "package": "@nifrajs/node-engine",
11208
+ "signature": "export interface NodeStopOptions {\n readonly drainMs?: number;\n readonly delayMs?: number;\n}",
11209
+ "doc": "/** How `stop()` winds the server down; the same shape `serve()` takes in `@nifrajs/node`. */"
11210
+ },
11053
11211
  {
11054
11212
  "name": "NodeStopOptions",
11055
11213
  "kind": "interface",
@@ -11667,6 +11825,13 @@
11667
11825
  "signature": "export type PathParams<P extends string> = P extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer Tail}` ? Name | PathParams<`/${Tail}`> : Rest : never;",
11668
11826
  "doc": "/** The `:name` segments of a route path. */"
11669
11827
  },
11828
+ {
11829
+ "name": "PeerCertificateInfo",
11830
+ "kind": "interface",
11831
+ "package": "@nifrajs/node-engine",
11832
+ "signature": "export interface PeerCertificateInfo {\n readonly subject: string;\n readonly issuer: string;\n readonly subjectAltName: string | undefined;\n readonly validFrom: string;\n readonly validTo: string;\n readonly serialNumber: string;\n readonly fingerprint: string;\n readonly fingerprint256: string;\n readonly fingerprint512: string;\n readonly raw: Buffer;\n readonly x509: X509Certificate;\n readonly issuerCertificate?: PeerCertificateInfo;\n}",
11833
+ "doc": "/** Parsed mTLS peer certificate information exposed by {@link getPeerCertificate}. */"
11834
+ },
11670
11835
  {
11671
11836
  "name": "PendingApprovalView",
11672
11837
  "kind": "interface",
@@ -12206,6 +12371,13 @@
12206
12371
  "signature": "export type PrincipalFor<User, RequireTenant extends boolean> = RequireTenant extends true ? Principal<User> & {\n readonly tenantId: string;\n} : Principal<User>;",
12207
12372
  "doc": "/**\n * The principal type for a given `requireTenant` flag: `tenantId` narrows to a required `string` when\n * `requireTenant` is `true`, otherwise stays optional (`string | undefined`). The flag is captured as a\n * literal `const` type parameter at the call sites so `{ requireTenant: true }` selects the narrowed branch.\n */"
12208
12373
  },
12374
+ {
12375
+ "name": "ProbeResult",
12376
+ "kind": "interface",
12377
+ "package": "@nifrajs/node-engine",
12378
+ "signature": "export interface ProbeResult {\n readonly ok: boolean;\n readonly version: string;\n readonly platform: string;\n readonly arch: string;\n readonly transport: string;\n readonly reason?: string;\n readonly capabilities: Readonly<Record<string, boolean>>;\n}",
12379
+ "doc": "/** Native engine probe result describing loaded platform, transport, and capability flags. */"
12380
+ },
12209
12381
  {
12210
12382
  "name": "ProblemDetailsOptions",
12211
12383
  "kind": "interface",
@@ -12627,7 +12799,7 @@
12627
12799
  "name": "R2BucketLike",
12628
12800
  "kind": "interface",
12629
12801
  "package": "@nifrajs/storage",
12630
- "signature": "export interface R2BucketLike {\n put(key: string, value: ArrayBuffer | ArrayBufferView, options?: {\n httpMetadata?: {\n contentType?: string;\n };\n customMetadata?: Record<string, string>;\n }): Promise<unknown>;\n get(key: string): Promise<(R2ObjectLike & {\n readonly body?: ReadableStream<Uint8Array>;\n arrayBuffer(): Promise<ArrayBuffer>;\n }) | null>;\n head(key: string): Promise<R2ObjectLike | null>;\n delete(key: string): Promise<void>;\n list(options?: {\n prefix?: string;\n limit?: number;\n cursor?: string;\n }): Promise<{\n objects: ReadonlyArray<{\n key: string;\n }>;\n truncated?: boolean;\n cursor?: string;\n }>;\n}",
12802
+ "signature": "export interface R2BucketLike {\n put(key: string, value: ArrayBuffer | ArrayBufferView | ReadableStream<Uint8Array>, options?: R2PutOptions): Promise<unknown>;\n get(key: string): Promise<(R2ObjectLike & {\n readonly body?: ReadableStream<Uint8Array>;\n arrayBuffer(): Promise<ArrayBuffer>;\n }) | null>;\n createMultipartUpload?(key: string, options?: R2PutOptions): Promise<R2MultipartUpload>;\n head(key: string): Promise<R2ObjectLike | null>;\n delete(key: string): Promise<void>;\n list(options?: {\n prefix?: string;\n limit?: number;\n cursor?: string;\n }): Promise<{\n objects: ReadonlyArray<{\n key: string;\n }>;\n truncated?: boolean;\n cursor?: string;\n }>;\n}",
12631
12803
  "doc": "/** The slice of the R2 bucket binding this adapter calls. `env.<BUCKET>` satisfies it. */"
12632
12804
  },
12633
12805
  {
@@ -12641,7 +12813,7 @@
12641
12813
  "name": "R2Storage",
12642
12814
  "kind": "class",
12643
12815
  "package": "@nifrajs/storage",
12644
- "signature": "export declare class R2Storage implements StorageAdapter {\n private readonly bucket;\n private readonly maxReadBytes;\n constructor(bucket: R2BucketLike, options?: {\n readonly maxReadBytes?: number;\n });\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n /** Read up to `maxReadBytes` (16 MiB by default). An oversized object throws a RangeError. */\n get(key: string): Promise<StorageObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n /** Every key (up to `limit`), following R2's cursor past the 1000 keys one call returns. */\n list(options?: ListOptions): Promise<string[]>;\n /** One page of at most 1000 keys, and the cursor for the next while there are more. */\n listPage(options?: StorageListPageOptions): Promise<StorageListPage>;\n}"
12816
+ "signature": "export declare class R2Storage implements StreamableStorageAdapter, PagedStorageAdapter {\n private readonly bucket;\n private readonly maxReadBytes;\n constructor(bucket: R2BucketLike, options?: {\n readonly maxReadBytes?: number;\n });\n private putOptions;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n putStream(key: string, stream: ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;\n private putMultipart;\n private objectMetadata;\n /** Read up to `maxReadBytes` (16 MiB by default). An oversized object throws a RangeError. */\n get(key: string): Promise<StorageObject | null>;\n private readBuffered;\n head(key: string): Promise<StorageObjectMetadata | null>;\n getStream(key: string): Promise<StorageStreamObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n /** Every key (up to `limit`), following R2's cursor past the 1000 keys one call returns. */\n list(options?: ListOptions): Promise<string[]>;\n /** One page of at most 1000 keys, and the cursor for the next while there are more. */\n listPage(options?: StorageListPageOptions): Promise<StorageListPage>;\n}"
12645
12817
  },
12646
12818
  {
12647
12819
  "name": "REDACTED_CELL",
@@ -13058,14 +13230,14 @@
13058
13230
  "kind": "interface",
13059
13231
  "package": "@nifrajs/core",
13060
13232
  "signature": "export interface RedactOptions {\n readonly keyParts?: readonly string[];\n readonly valuePatterns?: readonly RegExp[];\n readonly placeholder?: string;\n}",
13061
- "doc": "/**\n * Tunes redaction. Key-name redaction always runs; the rest is **opt-in**:\n * - `keyParts` - extra case-insensitive key fragments, added to the built-in denylist.\n * - `valuePatterns` - regexes matched against string **values** *and* the log message; each match is\n * replaced with the placeholder. This is the value-scanning hook for secrets that land in a value or\n * message (e.g. `err.message`), which key-name redaction can't catch. Off unless provided - the\n * default path does no value scanning, so it stays allocation-light. See {@link commonSecretPatterns}.\n * - `placeholder` - the replacement string (default `[REDACTED]`).\n */"
13233
+ "doc": "/**\n * Tunes redaction. Key-name redaction always runs.\n * - `keyParts` - extra case-insensitive key fragments, added to the built-in denylist.\n * - `valuePatterns` - regexes matched against string **values** *and* the log message; each match is\n * replaced with the placeholder. This is the value-scanning hook for secrets that land in a value or\n * message (e.g. `err.message`), which key-name redaction can't catch. Defaults to\n * {@link commonSecretPatterns} for `jsonLogger` and to no patterns for `redactLogFields`. Strings\n * over 8,192 UTF-16 code units are replaced entirely when scanning in `jsonLogger`.\n * - `placeholder` - the replacement string (default `[REDACTED]`).\n */"
13062
13234
  },
13063
13235
  {
13064
13236
  "name": "RedactOptions",
13065
13237
  "kind": "interface",
13066
13238
  "package": "nifra",
13067
13239
  "signature": "export interface RedactOptions {\n readonly keyParts?: readonly string[];\n readonly valuePatterns?: readonly RegExp[];\n readonly placeholder?: string;\n}",
13068
- "doc": "/**\n * Tunes redaction. Key-name redaction always runs; the rest is **opt-in**:\n * - `keyParts` - extra case-insensitive key fragments, added to the built-in denylist.\n * - `valuePatterns` - regexes matched against string **values** *and* the log message; each match is\n * replaced with the placeholder. This is the value-scanning hook for secrets that land in a value or\n * message (e.g. `err.message`), which key-name redaction can't catch. Off unless provided - the\n * default path does no value scanning, so it stays allocation-light. See {@link commonSecretPatterns}.\n * - `placeholder` - the replacement string (default `[REDACTED]`).\n */"
13240
+ "doc": "/**\n * Tunes redaction. Key-name redaction always runs.\n * - `keyParts` - extra case-insensitive key fragments, added to the built-in denylist.\n * - `valuePatterns` - regexes matched against string **values** *and* the log message; each match is\n * replaced with the placeholder. This is the value-scanning hook for secrets that land in a value or\n * message (e.g. `err.message`), which key-name redaction can't catch. Defaults to\n * {@link commonSecretPatterns} for `jsonLogger` and to no patterns for `redactLogFields`. Strings\n * over 8,192 UTF-16 code units are replaced entirely when scanning in `jsonLogger`.\n * - `placeholder` - the replacement string (default `[REDACTED]`).\n */"
13069
13241
  },
13070
13242
  {
13071
13243
  "name": "RedirectOptions",
@@ -13523,7 +13695,7 @@
13523
13695
  "name": "RequestSource",
13524
13696
  "kind": "interface",
13525
13697
  "package": "@nifrajs/core",
13526
- "signature": "export interface RequestSource {\n readonly method: string;\n readonly url: string;\n readonly headers: Headers;\n header?(name: string): string | null;\n /** Pre-split pathname/search, when the source already had the origin-form target (the Node lazy\n * sources do) - saves synthesizing an absolute URL only to scan it apart again. */\n readonly urlParts?: UrlParts;\n readonly body: ReadableStream<Uint8Array> | null;\n arrayBuffer(): Promise<ArrayBuffer>;\n json(): Promise<unknown>;\n /** Optional runtime-native exact-byte reader (Bun's Request.bytes, when available). */\n bytes?(): Promise<Uint8Array>;\n /** Present only when materializing a `Request` is non-trivial (the Node lazy source); for a real\n * `Request` passed as the source it's absent and {@link requestOf} returns the source itself. */\n readonly request?: Request;\n /** Optional pre-`Request` reader surface for the transport cap. A source that reads its own\n * transport bytes (the Node lazy source reads the socket) exposes them here so a capped direct\n * read (`c.req.json()`) buffers off the transport instead of routing through the deferred\n * `Request`. `body` must stay the live stream - the cap still guards a chunked body mid-flight. */\n rawBodyReaders?(): RawBodyReaders;\n}",
13698
+ "signature": "export interface RequestSource {\n readonly method: string;\n readonly url: string;\n readonly headers: Headers;\n /** Optional trailing headers received after the request body completes. */\n readonly trailers?: Readonly<Record<string, string>>;\n header?(name: string): string | null;\n /** Pre-split pathname/search, when the source already had the origin-form target (the Node lazy\n * sources do) - saves synthesizing an absolute URL only to scan it apart again. */\n readonly urlParts?: UrlParts;\n readonly body: ReadableStream<Uint8Array> | null;\n arrayBuffer(): Promise<ArrayBuffer>;\n json(): Promise<unknown>;\n /** Optional runtime-native exact-byte reader (Bun's Request.bytes, when available). */\n bytes?(): Promise<Uint8Array>;\n /** Present only when materializing a `Request` is non-trivial (the Node lazy source); for a real\n * `Request` passed as the source it's absent and {@link requestOf} returns the source itself. */\n readonly request?: Request;\n /** Optional pre-`Request` reader surface for the transport cap. A source that reads its own\n * transport bytes (the Node lazy source reads the socket) exposes them here so a capped direct\n * read (`c.req.json()`) buffers off the transport instead of routing through the deferred\n * `Request`. `body` must stay the live stream - the cap still guards a chunked body mid-flight. */\n rawBodyReaders?(): RawBodyReaders;\n}",
13527
13699
  "doc": "/**\n * Internal request view. A real Web `Request` already satisfies this shape, so Web/edge runtimes pass\n * their `Request` **directly** (zero wrapper allocation on the hot path - `request` is simply absent and\n * {@link requestOf} returns the source itself). Node's adapter passes a *lazy* source whose `request`\n * getter builds an undici `Request` only when user code reads `c.req`, an onRequest/onResponse hook\n * needs it, or a body helper consumes it - so the common Node request never pays for a `Request` build.\n */"
13528
13700
  },
13529
13701
  {
@@ -15084,6 +15256,18 @@
15084
15256
  "signature": "export interface RunningServer {\n readonly port: number;\n readonly hostname: string;\n readonly pendingRequests: number;\n stop(closeActiveConnections?: boolean): void;\n /** `await using server = app.listen(3000)`: the app's graceful `stop()` with default options, not Bun's raw one. Waits for a shutdown already under way. */\n [Symbol.asyncDispose](): Promise<void>;\n /** Bun's native topic broadcast, present on the Bun `Server` handle. `app.publish` delegates to it\n * in native-pubsub mode; absent on other runtimes' running-server views. */\n publish?(topic: string, data: string | ArrayBufferView | ArrayBuffer): number;\n}",
15085
15257
  "doc": "/**\n * The handle `listen()` returns - the slice of Bun's server nifra holds and exposes.\n * Declared explicitly (rather than `ReturnType<typeof Bun.serve>`) so the public type\n * surface doesn't leak the ambient `Bun` global into consumers' `.d.ts` resolution.\n */"
15086
15258
  },
15259
+ {
15260
+ "name": "S3Storage",
15261
+ "kind": "class",
15262
+ "package": "@nifrajs/storage",
15263
+ "signature": "export declare class S3Storage implements StreamableStorageAdapter, PagedStorageAdapter, MovableStorageAdapter, PresignableStorageAdapter {\n private readonly bucket;\n private readonly region;\n private readonly accessKeyId;\n private readonly secretAccessKey;\n private readonly sessionToken;\n private readonly endpoint;\n private readonly forcePathStyle;\n private readonly maxReadBytes;\n private readonly fetchImpl;\n private readonly now;\n constructor(options: S3StorageOptions);\n private buildUrl;\n private signedFetch;\n private putHeaders;\n put(key: string, data: StorageData, options?: PutOptions): Promise<void>;\n /** Use 5 MiB parts for streams, up to S3's 10,000-part limit. */\n putStream(key: string, stream: ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;\n get(key: string): Promise<StorageObject | null>;\n head(key: string): Promise<StorageObjectMetadata | null>;\n getStream(key: string): Promise<StorageStreamObject | null>;\n delete(key: string): Promise<void>;\n exists(key: string): Promise<boolean>;\n list(options?: ListOptions): Promise<string[]>;\n listPage(options?: StorageListPageOptions): Promise<StorageListPage>;\n copy(sourceKey: string, destinationKey: string): Promise<void>;\n move(sourceKey: string, destinationKey: string): Promise<void>;\n presign(key: string, operation: StoragePresignOperation, options?: StoragePresignOptions): Promise<StoragePresignedUrl>;\n}"
15264
+ },
15265
+ {
15266
+ "name": "S3StorageOptions",
15267
+ "kind": "interface",
15268
+ "package": "@nifrajs/storage",
15269
+ "signature": "export interface S3StorageOptions {\n readonly bucket: string;\n readonly region: string;\n readonly accessKeyId: string;\n readonly secretAccessKey: string;\n readonly sessionToken?: string;\n /** Custom S3-compatible endpoint (e.g. MinIO, R2 S3, Tigris). Defaults to AWS S3 regional URL. */\n readonly endpoint?: string;\n /**\n * Use path-style URLs (`<endpoint>/<bucket>/<key>`). Defaults to `true` when `endpoint` is set, or\n * when the bucket name has a dot, which AWS's wildcard certificate does not cover.\n * When `false`, the bucket is prefixed to the endpoint's host unless the host already starts with it.\n */\n readonly forcePathStyle?: boolean;\n /** Maximum bytes buffered by `get()`. Default 16 MiB. */\n readonly maxReadBytes?: number;\n /** Injectable fetch implementation (defaults to global `fetch`). */\n readonly fetch?: StorageFetch;\n /** Injectable clock for deterministic SigV4 signing in tests. */\n readonly now?: () => Date;\n}"
15270
+ },
15087
15271
  {
15088
15272
  "name": "SERVER_COMPONENT_FILE",
15089
15273
  "kind": "const",
@@ -15375,6 +15559,12 @@
15375
15559
  "package": "@nifrajs/core",
15376
15560
  "signature": "export interface SagaStore {\n readonly durability?: \"memory\" | \"durable\";\n create(record: SagaRecord): boolean | Promise<boolean>;\n get(sagaId: string): SagaRecord | undefined | Promise<SagaRecord | undefined>;\n /** Atomic version compare-and-set; this is the saga engine's crash/concurrency boundary. */\n compareAndSet(input: {\n readonly sagaId: string;\n readonly version: number;\n readonly record: SagaRecord;\n }): boolean | Promise<boolean>;\n /** Bounded operational scan. Transition-only stores do not need to implement reconciliation. */\n scan?(input: ReconciliationScanOptions<SagaState>): ReconciliationScanPage<SagaRecord> | Promise<ReconciliationScanPage<SagaRecord>>;\n /** @deprecated Compatibility fallback; production reconciliation should implement `scan`. */\n list?(): readonly SagaRecord[] | Promise<readonly SagaRecord[]>;\n}"
15377
15561
  },
15562
+ {
15563
+ "name": "SandboxedSpawnSpec",
15564
+ "kind": "interface",
15565
+ "package": "@nifrajs/coding-agent",
15566
+ "signature": "export interface SandboxedSpawnSpec {\n readonly command: readonly string[];\n readonly env: Readonly<Record<string, string>>;\n /** Force-removes what killing `command` can leave running. Set for container profiles. */\n readonly stop?: readonly string[];\n}"
15567
+ },
15378
15568
  {
15379
15569
  "name": "SanitizedHtml",
15380
15570
  "kind": "type",
@@ -15708,6 +15898,12 @@
15708
15898
  "package": "@nifrajs/node",
15709
15899
  "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * The default is `\"https\"` when {@link ServeOptions.tls} is set and `\"http\"` otherwise. Deployments\n * behind TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Serve HTTPS directly, with no proxy in front: `{ cert, key }` as PEM text or the files' bytes\n * (`readFileSync(\"cert.pem\")`), plus any other `node:tls` server option (`passphrase`, `ca`,\n * `requestCert` for client certificates, `minVersion`, `SNICallback`, ...). Unset, the server speaks\n * plain HTTP, which is what a proxy or platform that terminates TLS expects.\n */\n readonly tls?: TlsOptions;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Route a request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed URL,\n * so `/public/../admin` reaches the app as `/admin`; Node's `IncomingMessage.url` is the target as\n * sent. Off, Node routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path. Off by default; enable it when path guards, or a path-normalizing proxy, sit in front\n * of or inside the app. The same option as `server({ normalizeTarget })` on Deno.\n *\n * Off applies to requests the adapter serves from Node's own request object. A request the adapter\n * must hand over as a Web `Request` - one a `static` callback sees, and every WebSocket upgrade -\n * is built by the platform's URL parser, which resolves dot segments whatever this option says.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in, as\n * `server({ gracefulSignals })` is for Bun's `listen()`. The object form is passed to `stop()`.\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly gracefulSignals?: boolean | NodeStopOptions;\n /**\n * Sees every request before the app does, so a file it answers wins over any route at the same\n * path. It returns the file's response, or `undefined` to let the app route the request. No hook\n * of the app runs for a request it answers. The same option as Bun's `app.listen()` and\n * `@nifrajs/deno`'s `serve()`.\n *\n * {@link serveStatic} is the one to pass for files on disk: this adapter runs its mounts on Node's\n * own request, so a request they pass on keeps the app's direct lane. Any other function needs a\n * Web `Request` for every request, which roughly doubles the cost of a small route.\n */\n readonly static?: (request: Request) => Response | Promise<Response | undefined> | undefined;\n /**\n * Make a hand-rolled `return new Response(body)` ride the direct-write lane, by swapping\n * `globalThis.Response` for a stand-in that defers a *simple* construction (a string body, no\n * `statusText`, no headers or a plain header record) the way `c.text` / `c.json` already do.\n *\n * Off by default: prefer `c.text` / `c.json`, which get this without a global swap. Reach for the\n * flag only when handlers construct `Response` by hand on the hot path. It patches a process-global\n * builtin, so every `new Response(...)` anywhere in the process goes through the stand-in -\n * transparent (non-simple bodies build a real `Response`, and simple ones stay `instanceof\n * Response`), but a broad enough change to be opt-in.\n */\n readonly fastResponse?: boolean;\n}"
15710
15900
  },
15901
+ {
15902
+ "name": "ServeOptions",
15903
+ "kind": "interface",
15904
+ "package": "@nifrajs/node-engine",
15905
+ "signature": "export interface ServeOptions extends HostPolicyOptions {\n /** TCP port to bind (`0` for ephemeral). Omit for {@link path} or an inherited listener descriptor. */\n readonly port?: number;\n readonly hostname?: string;\n /** Unix domain socket path to listen on (mutually exclusive with a TCP `hostname`/`port` bind). */\n readonly path?: string;\n /** The scheme `Request.url` carries. `\"https\"` by default when {@link tls} is set, else `\"http\"`. */\n readonly protocol?: \"http\" | \"https\";\n /** In-process TLS, inline PEM or file names. */\n readonly tls?: TlsOptions;\n /** Static file handler (`serveStatic(...)`) or custom middleware consulted before routes on GET/HEAD. */\n readonly static?: (request: Request) => Response | undefined | Promise<Response | undefined>;\n /** Replace `globalThis.Response` with the lazy direct-write response wrapper to skip stream drains. */\n readonly fastResponse?: boolean;\n /** Native HTTP response compression (`zstd`, `br`, `gzip`, `deflate`) negotiated via `Accept-Encoding`. */\n readonly compression?: boolean | CompressionOptions;\n /** Fall back to `@nifrajs/node` (`node:http`/`node:https`) if the native addon binary cannot be loaded. Default `false`. */\n readonly fallback?: boolean;\n /**\n * Largest request body the engine accepts, 413 beyond it. The engine buffers a body whole before\n * the app runs, so this bounds the memory one request can hold. Default: 1 MiB, or the largest\n * `maxBodyBytes` among the app and its mounted apps when that is more. A route with its own larger\n * `bodyLimit` needs this set to match.\n */\n readonly maxBodySize?: number;\n /**\n * Bytes past {@link maxBodySize} the engine still buffers, so that a body only a little over the cap\n * is answered with the app's 413 body instead of the engine's empty one. A request can hold\n * `maxBodySize` plus this in memory. `0` turns it off: every body over the cap is refused natively\n * and the request path does no size check. Default 1 MiB.\n */\n readonly oversizeWindow?: number;\n /**\n * Check every request's `Host` before the app runs: a malformed one is refused with a 400, and\n * `req.url` is built from its normalized form. Off by default, as `validateHost` is on the Bun and\n * Deno server: the check costs an engine call per request, and a server behind a proxy that already\n * checks `Host` gains nothing from it. Off, a `Host` holding a path, query, fragment or userinfo\n * delimiter is still refused (and an empty one read as `localhost`), so `req.url` never names a\n * path the router did not see; anything else the URL parser refuses (an out-of-range port, say)\n * makes `req.url` throw when read. Turn it on for a server that clients reach directly.\n * `allowedHosts` and `canonicalHost` need every `Host` read, so setting either turns it on.\n */\n readonly validateHost?: boolean;\n /**\n * HTTP/2 beside HTTP/1.1 on the same port: negotiated by ALPN when {@link tls} is set, by prior\n * knowledge (a client opening with the HTTP/2 preface) when it is not. `true` takes the engine's\n * defaults; an object sets its settings.\n */\n readonly http2?: boolean | Http2Options;\n /**\n * Largest WebSocket message the engine accepts before it fails the connection with 1009. Defaults to\n * the largest `wsMaxPayloadBytes` among the app and the apps mounted in it that serve sockets (a\n * route whose app declares less is held to its own), else the engine's 16 MiB. The Node fallback\n * rejects this option at startup.\n */\n readonly wsMaxMessageSize?: number;\n /** Enable RFC 7692 WebSocket `permessage-deflate` compression (`true` for defaults, or options). */\n readonly wsDeflate?: boolean | WsDeflateOptions;\n /** Any other engine limit or timeout, passed through as given. */\n readonly engine?: EngineTuning;\n /** Optional handler for HTTP/1.1 and HTTP/2 `CONNECT` tunnel requests. */\n readonly onConnect?: ConnectHandler;\n /** SIGTERM/SIGINT call `stop()`; off by default, as in `@nifrajs/node`. */\n readonly gracefulSignals?: boolean | NodeStopOptions;\n}"
15906
+ },
15711
15907
  {
15712
15908
  "name": "ServeOptions",
15713
15909
  "kind": "interface",
@@ -15718,21 +15914,21 @@
15718
15914
  "name": "ServeStaticOptions",
15719
15915
  "kind": "interface",
15720
15916
  "package": "@nifrajs/core",
15721
- "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15917
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /** Build-provided immutable paths with a negotiated `.nifra-br` or `.nifra-gzip` sidecar. */\n readonly precompressed?: {\n readonly br: readonly string[];\n readonly gzip: readonly string[];\n };\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15722
15918
  "doc": "/**\n * One directory `serveStatic()` serves under a URL prefix: the same options on Bun\n * (`@nifrajs/core/serve-static`), `@nifrajs/node` and `@nifrajs/deno`. Each runtime reads the files\n * with its own fastest file API; which request a mount takes, and how it answers, is decided here.\n */"
15723
15919
  },
15724
15920
  {
15725
15921
  "name": "ServeStaticOptions",
15726
15922
  "kind": "interface",
15727
15923
  "package": "@nifrajs/deno",
15728
- "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15924
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /** Build-provided immutable paths with a negotiated `.nifra-br` or `.nifra-gzip` sidecar. */\n readonly precompressed?: {\n readonly br: readonly string[];\n readonly gzip: readonly string[];\n };\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15729
15925
  "doc": "/**\n * One directory `serveStatic()` serves under a URL prefix: the same options on Bun\n * (`@nifrajs/core/serve-static`), `@nifrajs/node` and `@nifrajs/deno`. Each runtime reads the files\n * with its own fastest file API; which request a mount takes, and how it answers, is decided here.\n */"
15730
15926
  },
15731
15927
  {
15732
15928
  "name": "ServeStaticOptions",
15733
15929
  "kind": "interface",
15734
15930
  "package": "@nifrajs/node",
15735
- "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15931
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * The content-hashed files, matched on the URL path as sent. When set, `immutable` applies only to\n * these, and any other file is sent with `cacheControl`, so a file that keeps its name across deploys\n * still revalidates. One of:\n *\n * - paths, such as a build manifest's `assets`;\n * - patterns, for files a pre-build step hashed that no manifest lists:\n * `[/^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/]`;\n * - a predicate, to combine the two: `(path) => assets.has(path) || FONT.test(path)`. It runs as\n * written, so a RegExp it tests should be neither global nor sticky.\n */\n readonly hashedFiles?: HashedFiles;\n /** Build-provided immutable paths with a negotiated `.nifra-br` or `.nifra-gzip` sidecar. */\n readonly precompressed?: {\n readonly br: readonly string[];\n readonly gzip: readonly string[];\n };\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host`. `false` passes the request on, without touching the filesystem, to the next mount and then\n * the app - the seam a host policy uses so a host's refused file meets the app's own refusal instead\n * of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered as a missing file is, so probing can't distinguish \"hidden\" from\n * \"absent\". `/.well-known` is public by definition (RFC 8615) and always served. The rule applies to\n * the requested path and again to the file it resolves to, so a visible name linking to `.env` is\n * denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n /**\n * What a path under `prefix` this mount cannot serve does: a missing or hidden file, a link out of\n * the directory, a malformed or traversing path. Default `false`: answered `404` (`400` malformed,\n * `403` traversing), so a missing asset is never rendered as a page. `true` passes it to the next\n * mount, then the app - for a mount at `\"/\"` beside the app's own routes.\n */\n readonly fallthrough?: boolean;\n}",
15736
15932
  "doc": "/**\n * One directory `serveStatic()` serves under a URL prefix: the same options on Bun\n * (`@nifrajs/core/serve-static`), `@nifrajs/node` and `@nifrajs/deno`. Each runtime reads the files\n * with its own fastest file API; which request a mount takes, and how it answers, is decided here.\n */"
15737
15933
  },
15738
15934
  {
@@ -15757,14 +15953,14 @@
15757
15953
  "name": "Server",
15758
15954
  "kind": "class",
15759
15955
  "package": "@nifrajs/core",
15760
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS adapter loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a custom topic adapter,\n * a validated-send route, or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly normalizeTarget;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private stopRun;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n /** The response hook whose `renderBody` fast path the owner carries: still first in line, or the\n * fast path would run ahead of a hook registered before it. */\n private renderBodyAnchor;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 5_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<void>;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n /** {@link fetchMatched} for an app whose `onRequest` hooks run before the route does: the hooks see\n * the request first, and the route Bun matched runs unless one of them replaced the request. */\n private fetchMatchedHooked;\n private fetchMatchedHookedInner;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body route's params → parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\n private buildFusedQueryWeb;\n /**\n * The stage chain a hook shape runs - derive, before, handler, after, respond - for the Web lane,\n * built once per server and shared by every route with the same number of hooks in each phase (none,\n * one or several). The chain reads a route's handler and hooks from its `FusedHooks` per request, so\n * a route's own closure (see {@link buildFusedLifecycleWeb}) holds only that record and its schemas,\n * and memory grows with the number of distinct shapes, not routes or hook functions.\n */\n private fusedWebStages;\n /**\n * Compile a fused lifecycle route's entry closure: parse (body) → validate → the shared stage chain\n * of its hook shape (derive → before → handler → after → respond, see {@link fusedWebStages}) in a\n * single frame, where the generic program walks staged hook loops. `selectRouteLanes` admits ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * request allocates no step closures.\n */\n /**\n * Keep the common one-derive/one-before shape bound to its hooks. Inline its synchronous path to\n * avoid stage calls; retain helper closures only for promise continuations.\n */\n private buildFusedLifecycleWebSingle;\n private buildFusedLifecycleWeb;\n /**\n * The Node-direct twin of {@link fusedWebStages}: the same chain, finalizing through the caller's\n * own `finalize`, shared by every route with the same hook shape. A terminal `finalize` throw (an\n * unstringifiable handler return on the Node lane) is caught as `finishLifecycleContract` catches it.\n */\n private fusedNodeStages;\n /**\n * The Node-direct twin of {@link buildFusedLifecycleWeb}: the same steps, finalizing through the\n * caller's own `finalize` (the Node outcome on the direct lane) instead of building a `Response`, so\n * the `!webFast` dispatcher runs these routes in one frame rather than the generic program. A\n * terminal `finalize` throw (an unstringifiable handler return on the Node lane) is caught as\n * `finishLifecycleContract` catches it; the body's 415/400 renders take `wrapResponse` directly.\n */\n private buildFusedLifecycleRunner;\n /** The thrown-value render of the Web fused lifecycle lanes for a route with no error hooks: a\n * `Response` is control flow, anything else is logged and answered with a plain 500. */\n private fusedWebFail;\n /** {@link fusedWebFail} for a fused route that may have error hooks. */\n private fusedWebRouteFail;\n /** The thrown-value render of a fused lifecycle route. A `Response` or `status(...)` is control flow\n * that no error hook sees, unless it cannot render, which is a fault like any other. Anything else\n * goes to the route's error hooks; with none it is logged and answered with a plain 500. */\n private fusedFail;\n /** {@link respondFused} for a fused lifecycle route, whose failures reach its error hooks. */\n private respondHooks;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Paths a composed mount or\n * a WebSocket handshake may reach stay with the portable dispatcher; provably disjoint HTTP routes\n * keep native matching. Request hooks run before the matched route and rewrites return to dispatch.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`, or hold those requests' connections alone with\n * `withIdleTimeout()` from `@nifrajs/core/idle-timeout`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n *\n * `static` sees every request before the app does, the ones Bun's route table serves included, so\n * a file it answers wins over any route at the same path. It returns the file's response, or\n * `undefined` to let the app route the request. No hook of the app runs for a request it answers.\n * `@nifrajs/web`'s Bun build serves its client bundle and public files this way.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n readonly static?: (request: Request) => MaybePromise<Response | undefined>;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop(options?: StopOptions): Promise<void>;\n private stopListener;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
15956
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS adapter loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a custom topic adapter,\n * a validated-send route, or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly normalizeTarget;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private stopRun;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n /** The response hook whose `renderBody` fast path the owner carries: still first in line, or the\n * fast path would run ahead of a hook registered before it. */\n private renderBodyAnchor;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 5_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<void>;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n private nativePub;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n /** {@link fetchMatched} for an app whose `onRequest` hooks run before the route does: the hooks see\n * the request first, and the route Bun matched runs unless one of them replaced the request. */\n private fetchMatchedHooked;\n private fetchMatchedHookedInner;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n private finishBunWebSocket;\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 private requestHookDeadline;\n private awaitRequestHook;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body route's params → parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\n private buildFusedQueryWeb;\n /**\n * The stage chain a hook shape runs - derive, before, handler, after, respond - for the Web lane,\n * built once per server and shared by every route with the same number of hooks in each phase (none,\n * one or several). The chain reads a route's handler and hooks from its `FusedHooks` per request, so\n * a route's own closure (see {@link buildFusedLifecycleWeb}) holds only that record and its schemas,\n * and memory grows with the number of distinct shapes, not routes or hook functions.\n */\n private fusedWebStages;\n /**\n * Compile a fused lifecycle route's entry closure: parse (body) → validate → the shared stage chain\n * of its hook shape (derive → before → handler → after → respond, see {@link fusedWebStages}) in a\n * single frame, where the generic program walks staged hook loops. `selectRouteLanes` admits ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * request allocates no step closures.\n */\n /**\n * Keep the common one-derive/one-before shape bound to its hooks. Inline its synchronous path to\n * avoid stage calls; retain helper closures only for promise continuations.\n */\n private buildFusedLifecycleWebSingle;\n private buildFusedLifecycleWeb;\n /**\n * The Node-direct twin of {@link fusedWebStages}: the same chain, finalizing through the caller's\n * own `finalize`, shared by every route with the same hook shape. A terminal `finalize` throw (an\n * unstringifiable handler return on the Node lane) is caught as `finishLifecycleContract` catches it.\n */\n private fusedNodeStages;\n /**\n * The Node-direct twin of {@link buildFusedLifecycleWeb}: the same steps, finalizing through the\n * caller's own `finalize` (the Node outcome on the direct lane) instead of building a `Response`, so\n * the `!webFast` dispatcher runs these routes in one frame rather than the generic program. A\n * terminal `finalize` throw (an unstringifiable handler return on the Node lane) is caught as\n * `finishLifecycleContract` catches it; the body's 415/400 renders take `wrapResponse` directly.\n */\n private buildFusedLifecycleRunner;\n /** The thrown-value render of the Web fused lifecycle lanes for a route with no error hooks: a\n * `Response` is control flow, anything else is logged and answered with a plain 500. */\n private fusedWebFail;\n /** {@link fusedWebFail} for a fused route that may have error hooks. */\n private fusedWebRouteFail;\n /** The thrown-value render of a fused lifecycle route. A `Response` or `status(...)` is control flow\n * that no error hook sees, unless it cannot render, which is a fault like any other. Anything else\n * goes to the route's error hooks; with none it is logged and answered with a plain 500. */\n private fusedFail;\n /** {@link respondFused} for a fused lifecycle route, whose failures reach its error hooks. */\n private respondHooks;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Paths a composed mount or\n * a WebSocket handshake may reach stay with the portable dispatcher; provably disjoint HTTP routes\n * keep native matching. Request hooks run before the matched route and rewrites return to dispatch.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`, or hold those requests' connections alone with\n * `withIdleTimeout()` from `@nifrajs/core/idle-timeout`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n *\n * `static` sees every request before the app does, the ones Bun's route table serves included, so\n * a file it answers wins over any route at the same path. It returns the file's response, or\n * `undefined` to let the app route the request. No hook of the app runs for a request it answers.\n * `@nifrajs/web`'s Bun build serves its client bundle and public files this way.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n readonly static?: (request: Request) => MaybePromise<Response | undefined>;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop(options?: StopOptions): Promise<void>;\n private stopListener;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
15761
15957
  "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 */"
15762
15958
  },
15763
15959
  {
15764
15960
  "name": "Server",
15765
15961
  "kind": "class",
15766
15962
  "package": "nifra",
15767
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS adapter loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a custom topic adapter,\n * a validated-send route, or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly normalizeTarget;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private stopRun;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n /** The response hook whose `renderBody` fast path the owner carries: still first in line, or the\n * fast path would run ahead of a hook registered before it. */\n private renderBodyAnchor;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 5_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<void>;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n /** {@link fetchMatched} for an app whose `onRequest` hooks run before the route does: the hooks see\n * the request first, and the route Bun matched runs unless one of them replaced the request. */\n private fetchMatchedHooked;\n private fetchMatchedHookedInner;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body route's params → parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\n private buildFusedQueryWeb;\n /**\n * The stage chain a hook shape runs - derive, before, handler, after, respond - for the Web lane,\n * built once per server and shared by every route with the same number of hooks in each phase (none,\n * one or several). The chain reads a route's handler and hooks from its `FusedHooks` per request, so\n * a route's own closure (see {@link buildFusedLifecycleWeb}) holds only that record and its schemas,\n * and memory grows with the number of distinct shapes, not routes or hook functions.\n */\n private fusedWebStages;\n /**\n * Compile a fused lifecycle route's entry closure: parse (body) → validate → the shared stage chain\n * of its hook shape (derive → before → handler → after → respond, see {@link fusedWebStages}) in a\n * single frame, where the generic program walks staged hook loops. `selectRouteLanes` admits ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * request allocates no step closures.\n */\n /**\n * Keep the common one-derive/one-before shape bound to its hooks. Inline its synchronous path to\n * avoid stage calls; retain helper closures only for promise continuations.\n */\n private buildFusedLifecycleWebSingle;\n private buildFusedLifecycleWeb;\n /**\n * The Node-direct twin of {@link fusedWebStages}: the same chain, finalizing through the caller's\n * own `finalize`, shared by every route with the same hook shape. A terminal `finalize` throw (an\n * unstringifiable handler return on the Node lane) is caught as `finishLifecycleContract` catches it.\n */\n private fusedNodeStages;\n /**\n * The Node-direct twin of {@link buildFusedLifecycleWeb}: the same steps, finalizing through the\n * caller's own `finalize` (the Node outcome on the direct lane) instead of building a `Response`, so\n * the `!webFast` dispatcher runs these routes in one frame rather than the generic program. A\n * terminal `finalize` throw (an unstringifiable handler return on the Node lane) is caught as\n * `finishLifecycleContract` catches it; the body's 415/400 renders take `wrapResponse` directly.\n */\n private buildFusedLifecycleRunner;\n /** The thrown-value render of the Web fused lifecycle lanes for a route with no error hooks: a\n * `Response` is control flow, anything else is logged and answered with a plain 500. */\n private fusedWebFail;\n /** {@link fusedWebFail} for a fused route that may have error hooks. */\n private fusedWebRouteFail;\n /** The thrown-value render of a fused lifecycle route. A `Response` or `status(...)` is control flow\n * that no error hook sees, unless it cannot render, which is a fault like any other. Anything else\n * goes to the route's error hooks; with none it is logged and answered with a plain 500. */\n private fusedFail;\n /** {@link respondFused} for a fused lifecycle route, whose failures reach its error hooks. */\n private respondHooks;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Paths a composed mount or\n * a WebSocket handshake may reach stay with the portable dispatcher; provably disjoint HTTP routes\n * keep native matching. Request hooks run before the matched route and rewrites return to dispatch.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`, or hold those requests' connections alone with\n * `withIdleTimeout()` from `@nifrajs/core/idle-timeout`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n *\n * `static` sees every request before the app does, the ones Bun's route table serves included, so\n * a file it answers wins over any route at the same path. It returns the file's response, or\n * `undefined` to let the app route the request. No hook of the app runs for a request it answers.\n * `@nifrajs/web`'s Bun build serves its client bundle and public files this way.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n readonly static?: (request: Request) => MaybePromise<Response | undefined>;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop(options?: StopOptions): Promise<void>;\n private stopListener;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
15963
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** Configured topic adapter, or the in-process default created by the first `app.ws()` route. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS adapter loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a custom topic adapter,\n * a validated-send route, or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly validateHost;\n private readonly normalizeTarget;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly stoppingHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private stopRun;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n /** The response hook whose `renderBody` fast path the owner carries: still first in line, or the\n * fast path would run ahead of a hook registered before it. */\n private renderBodyAnchor;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Register a callback awaited as soon as `stop()` begins, while the server still serves: readiness\n * should fail from here, and work that outlives a request (a poller, a queue consumer) should stop\n * taking more. Hung callbacks are bounded.\n */\n onStopping(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 5_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * Uses the configured {@link ServerOptions.topicAdapter}, or the in-process topic registry by\n * default. Await the result when a custom adapter publishes asynchronously.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void | Promise<void>;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n private nativePub;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n /** {@link fetchMatched} for an app whose `onRequest` hooks run before the route does: the hooks see\n * the request first, and the route Bun matched runs unless one of them replaced the request. */\n private fetchMatchedHooked;\n private fetchMatchedHookedInner;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n private finishBunWebSocket;\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 private requestHookDeadline;\n private awaitRequestHook;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body route's params → parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for routes with path params and/or a query schema: validate + handler + respond\n * in one closure, with no lifecycle promise when the validators and handler are sync. */\n private buildFusedQueryWeb;\n /**\n * The stage chain a hook shape runs - derive, before, handler, after, respond - for the Web lane,\n * built once per server and shared by every route with the same number of hooks in each phase (none,\n * one or several). The chain reads a route's handler and hooks from its `FusedHooks` per request, so\n * a route's own closure (see {@link buildFusedLifecycleWeb}) holds only that record and its schemas,\n * and memory grows with the number of distinct shapes, not routes or hook functions.\n */\n private fusedWebStages;\n /**\n * Compile a fused lifecycle route's entry closure: parse (body) → validate → the shared stage chain\n * of its hook shape (derive → before → handler → after → respond, see {@link fusedWebStages}) in a\n * single frame, where the generic program walks staged hook loops. `selectRouteLanes` admits ordinary\n * validation stages and derive/before/after/error hooks, while excluding auth-first ordering, custom\n * validation recovery, outer wrappers and response contracts. The shared input sequence preserves\n * the program's validation order around body parsing; the hook chain preserves thrown-value, `c.set`\n * and response-rendering semantics. The route's closure holds its `FusedHooks` and schemas, so a\n * request allocates no step closures.\n */\n /**\n * Keep the common one-derive/one-before shape bound to its hooks. Inline its synchronous path to\n * avoid stage calls; retain helper closures only for promise continuations.\n */\n private buildFusedLifecycleWebSingle;\n private buildFusedLifecycleWeb;\n /**\n * The Node-direct twin of {@link fusedWebStages}: the same chain, finalizing through the caller's\n * own `finalize`, shared by every route with the same hook shape. A terminal `finalize` throw (an\n * unstringifiable handler return on the Node lane) is caught as `finishLifecycleContract` catches it.\n */\n private fusedNodeStages;\n /**\n * The Node-direct twin of {@link buildFusedLifecycleWeb}: the same steps, finalizing through the\n * caller's own `finalize` (the Node outcome on the direct lane) instead of building a `Response`, so\n * the `!webFast` dispatcher runs these routes in one frame rather than the generic program. A\n * terminal `finalize` throw (an unstringifiable handler return on the Node lane) is caught as\n * `finishLifecycleContract` catches it; the body's 415/400 renders take `wrapResponse` directly.\n */\n private buildFusedLifecycleRunner;\n /** The thrown-value render of the Web fused lifecycle lanes for a route with no error hooks: a\n * `Response` is control flow, anything else is logged and answered with a plain 500. */\n private fusedWebFail;\n /** {@link fusedWebFail} for a fused route that may have error hooks. */\n private fusedWebRouteFail;\n /** The thrown-value render of a fused lifecycle route. A `Response` or `status(...)` is control flow\n * that no error hook sees, unless it cannot render, which is a fault like any other. Anything else\n * goes to the route's error hooks; with none it is logged and answered with a plain 500. */\n private fusedFail;\n /** {@link respondFused} for a fused lifecycle route, whose failures reach its error hooks. */\n private respondHooks;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Paths a composed mount or\n * a WebSocket handshake may reach stay with the portable dispatcher; provably disjoint HTTP routes\n * keep native matching. Request hooks run before the matched route and rewrites return to dispatch.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`, or hold those requests' connections alone with\n * `withIdleTimeout()` from `@nifrajs/core/idle-timeout`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n *\n * `static` sees every request before the app does, the ones Bun's route table serves included, so\n * a file it answers wins over any route at the same path. It returns the file's response, or\n * `undefined` to let the app route the request. No hook of the app runs for a request it answers.\n * `@nifrajs/web`'s Bun build serves its client bundle and public files this way.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n readonly static?: (request: Request) => MaybePromise<Response | undefined>;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; `delayMs` is the time a load balancer\n * gets to stop routing here first. The `onStopping` hooks run before that delay, the `onStop`\n * hooks after the drain. Open WebSockets get a 1001 close when the drain starts and the same\n * window to finish it; a socket opened after `stop()` began is closed at once.\n */\n stop(options?: StopOptions): Promise<void>;\n private stopListener;\n /**\n * @internal Run the `onStopping` or the `onStop` hooks, each bounded. A runtime adapter that drains\n * its own listener calls it on either side of the drain, as `stop()` does here.\n */\n [SERVER_LIFECYCLE](phase: \"stopping\" | \"stopped\"): Promise<void>;\n private installSignalHandlers;\n}",
15768
15964
  "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 */"
15769
15965
  },
15770
15966
  {
@@ -16031,13 +16227,13 @@
16031
16227
  "name": "ServerOptions",
16032
16228
  "kind": "interface",
16033
16229
  "package": "@nifrajs/core",
16034
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a route: exact origins, or a function that receives the\n * `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can send with the\n * visitor's cookies and no preflight, so one whose `Origin` names another site is refused with `403`\n * before it is read. A route without a body schema refuses the same sites' unsafe requests that carry\n * no content type too, which `fetch` with `no-cors` sends; one with a script-set `Authorization` header\n * passes, since a browser preflights it, but `Basic`, `Digest`, `Negotiate` and `NTLM` do not, because\n * a browser re-sends those from its auth cache without one. Same-origin posts and requests without an `Origin`, such as\n * server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n * The origins a `cors()` list or predicate and a `csrf({ origins })` list name are trusted as well,\n * so a frontend those already allow needs no second list here; `cors()` with `\"*\"` adds none. That\n * trust is for form posts to this server's own routes only: a mounted or grouped server keeps its own\n * policy, so a parent that must accept the same sites sets them in its own `formOrigins`, and a web\n * page action checks the origin against the backend's `allowedOrigins`, not this list.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` for Hosts the request target cannot safely be built on: one sent\n * twice, one with a space or byte past ASCII, a port past 65535, an IPv6 literal no URL parser\n * takes, a percent-encoded or sub-delimiter Host, or an authority that can change Deno's route.\n * Bun may leave `c.req.url` relative or build it on the first Host, so `new URL(c.req.url)` can\n * throw in a handler.\n *\n * Disabled by default: checking Host on every request measured about 6% of a bare route on Bun.\n * Deno builds `Request.url` from Host; without this check, a malformed Host can change the routed\n * path. Enable it when Deno receives requests with an untrusted Host header.\n */\n readonly validateHost?: boolean;\n /**\n * Route a Deno request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed\n * URL, so `/public/../admin` reaches the app as `/admin`; Deno hands over the target as sent. Off,\n * Deno routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path.\n *\n * Disabled by default: the check reads and scans the whole URL of every request, measured at about\n * 3% of a bare route on Deno. Enable it when path guards, or a path-normalizing proxy, sit in\n * front of or inside the app. Bun already delivers parsed targets and is unaffected; `@nifrajs/node`\n * has the same option on `serve()`.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default with a non-production `process.env`) - `name`, `detail` and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` (default in production or when env access is unavailable) - request metadata and a generic error name.\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. To opt back into detail with redaction, set `errorLogDetail: \"full\"` and pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis.\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}"
16230
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a route: exact origins, or a function that receives the\n * `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can send with the\n * visitor's cookies and no preflight, so one whose `Origin` names another site is refused with `403`\n * before it is read. A route without a body schema refuses the same sites' unsafe requests that carry\n * no content type too, which `fetch` with `no-cors` sends; one with a script-set `Authorization` header\n * passes, since a browser preflights it, but `Basic`, `Digest`, `Negotiate` and `NTLM` do not, because\n * a browser re-sends those from its auth cache without one. Same-origin posts and requests without an `Origin`, such as\n * server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n * The origins a `cors()` list or predicate and a `csrf({ origins })` list name are trusted as well,\n * so a frontend those already allow needs no second list here; `cors()` with `\"*\"` adds none. That\n * trust is for form posts to this server's own routes only: a mounted or grouped server keeps its own\n * policy, so a parent that must accept the same sites sets them in its own `formOrigins`, and a web\n * page action checks the origin against the backend's `allowedOrigins`, not this list.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` for Hosts the request target cannot safely be built on: one sent\n * twice, one with a space or byte past ASCII, a port past 65535, an IPv6 literal no URL parser\n * takes, a percent-encoded or sub-delimiter Host, or an authority that can change Deno's route.\n * Bun may leave `c.req.url` relative or build it on the first Host, so `new URL(c.req.url)` can\n * throw in a handler.\n *\n * Disabled by default: checking Host on every request measured about 6% of a bare route on Bun.\n * Deno builds `Request.url` from Host; without this check, a malformed Host can change the routed\n * path. Enable it when Deno receives requests with an untrusted Host header.\n */\n readonly validateHost?: boolean;\n /**\n * Route a Deno request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed\n * URL, so `/public/../admin` reaches the app as `/admin`; Deno hands over the target as sent. Off,\n * Deno routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path.\n *\n * Disabled by default: the check reads and scans the whole URL of every request, measured at about\n * 3% of a bare route on Deno. Enable it when path guards, or a path-normalizing proxy, sit in\n * front of or inside the app. Bun already delivers parsed targets and is unaffected; `@nifrajs/node`\n * has the same option on `serve()`.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\n /** Local timeout (ms) shared by request hooks and matched routes. Expiry aborts a Web hook's\n * `req.signal` and the route's `ctx.signal` if active. It returns 503, or 504 when a matched route\n * admitted an inbound deadline, even when the local timeout set the tighter cap. A hook cancels its\n * own work by passing `req.signal` itself: a clone or copy of `req` may not follow the deadline.\n * Default 0 (off). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default with a non-production `process.env`) - `name`, `detail` and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` (default in production or when env access is unavailable) - request metadata and a generic error name.\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. To opt back into detail with redaction, set `errorLogDetail: \"full\"` and pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis.\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}"
16035
16231
  },
16036
16232
  {
16037
16233
  "name": "ServerOptions",
16038
16234
  "kind": "interface",
16039
16235
  "package": "nifra",
16040
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a route: exact origins, or a function that receives the\n * `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can send with the\n * visitor's cookies and no preflight, so one whose `Origin` names another site is refused with `403`\n * before it is read. A route without a body schema refuses the same sites' unsafe requests that carry\n * no content type too, which `fetch` with `no-cors` sends; one with a script-set `Authorization` header\n * passes, since a browser preflights it, but `Basic`, `Digest`, `Negotiate` and `NTLM` do not, because\n * a browser re-sends those from its auth cache without one. Same-origin posts and requests without an `Origin`, such as\n * server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n * The origins a `cors()` list or predicate and a `csrf({ origins })` list name are trusted as well,\n * so a frontend those already allow needs no second list here; `cors()` with `\"*\"` adds none. That\n * trust is for form posts to this server's own routes only: a mounted or grouped server keeps its own\n * policy, so a parent that must accept the same sites sets them in its own `formOrigins`, and a web\n * page action checks the origin against the backend's `allowedOrigins`, not this list.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` for Hosts the request target cannot safely be built on: one sent\n * twice, one with a space or byte past ASCII, a port past 65535, an IPv6 literal no URL parser\n * takes, a percent-encoded or sub-delimiter Host, or an authority that can change Deno's route.\n * Bun may leave `c.req.url` relative or build it on the first Host, so `new URL(c.req.url)` can\n * throw in a handler.\n *\n * Disabled by default: checking Host on every request measured about 6% of a bare route on Bun.\n * Deno builds `Request.url` from Host; without this check, a malformed Host can change the routed\n * path. Enable it when Deno receives requests with an untrusted Host header.\n */\n readonly validateHost?: boolean;\n /**\n * Route a Deno request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed\n * URL, so `/public/../admin` reaches the app as `/admin`; Deno hands over the target as sent. Off,\n * Deno routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path.\n *\n * Disabled by default: the check reads and scans the whole URL of every request, measured at about\n * 3% of a bare route on Deno. Enable it when path guards, or a path-normalizing proxy, sit in\n * front of or inside the app. Bun already delivers parsed targets and is unaffected; `@nifrajs/node`\n * has the same option on `serve()`.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default with a non-production `process.env`) - `name`, `detail` and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` (default in production or when env access is unavailable) - request metadata and a generic error name.\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. To opt back into detail with redaction, set `errorLogDetail: \"full\"` and pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis.\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}"
16236
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a route: exact origins, or a function that receives the\n * `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can send with the\n * visitor's cookies and no preflight, so one whose `Origin` names another site is refused with `403`\n * before it is read. A route without a body schema refuses the same sites' unsafe requests that carry\n * no content type too, which `fetch` with `no-cors` sends; one with a script-set `Authorization` header\n * passes, since a browser preflights it, but `Basic`, `Digest`, `Negotiate` and `NTLM` do not, because\n * a browser re-sends those from its auth cache without one. Same-origin posts and requests without an `Origin`, such as\n * server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n * The origins a `cors()` list or predicate and a `csrf({ origins })` list name are trusted as well,\n * so a frontend those already allow needs no second list here; `cors()` with `\"*\"` adds none. That\n * trust is for form posts to this server's own routes only: a mounted or grouped server keeps its own\n * policy, so a parent that must accept the same sites sets them in its own `formOrigins`, and a web\n * page action checks the origin against the backend's `allowedOrigins`, not this list.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Answer `400 invalid_host` for Hosts the request target cannot safely be built on: one sent\n * twice, one with a space or byte past ASCII, a port past 65535, an IPv6 literal no URL parser\n * takes, a percent-encoded or sub-delimiter Host, or an authority that can change Deno's route.\n * Bun may leave `c.req.url` relative or build it on the first Host, so `new URL(c.req.url)` can\n * throw in a handler.\n *\n * Disabled by default: checking Host on every request measured about 6% of a bare route on Bun.\n * Deno builds `Request.url` from Host; without this check, a malformed Host can change the routed\n * path. Enable it when Deno receives requests with an untrusted Host header.\n */\n readonly validateHost?: boolean;\n /**\n * Route a Deno request on the path a WHATWG parser would give it. Bun and workerd deliver a parsed\n * URL, so `/public/../admin` reaches the app as `/admin`; Deno hands over the target as sent. Off,\n * Deno routes the text received, as most frameworks do: a guard on `/admin` does not see\n * `/public/../admin`, and a proxy that normalizes paths before forwarding disagrees with the app\n * about which route a request is for. On, dot segments (`.`, `..`, `%2e`), backslashes and the\n * characters a parser percent-encodes are resolved before routing, so every runtime routes the\n * same path.\n *\n * Disabled by default: the check reads and scans the whole URL of every request, measured at about\n * 3% of a bare route on Deno. Enable it when path guards, or a path-normalizing proxy, sit in\n * front of or inside the app. Bun already delivers parsed targets and is unaffected; `@nifrajs/node`\n * has the same option on `serve()`.\n */\n readonly normalizeTarget?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /**\n * Topic membership and broadcast implementation for WebSocket routes. By default, Nifra uses an\n * in-process `TopicRegistry`; pass an adapter to bridge subscriptions and publishes to a shared\n * fan-out service. `app.publish()` returns a promise when the adapter publishes asynchronously.\n */\n readonly topicAdapter?: TopicAdapter;\n /** Local timeout (ms) shared by request hooks and matched routes. Expiry aborts a Web hook's\n * `req.signal` and the route's `ctx.signal` if active. It returns 503, or 504 when a matched route\n * admitted an inbound deadline, even when the local timeout set the tighter cap. A hook cancels its\n * own work by passing `req.signal` itself: a clone or copy of `req` may not follow the deadline.\n * Default 0 (off). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * The object form is passed to `stop()`: see {@link StopOptions}.\n */\n readonly gracefulSignals?: boolean | StopOptions;\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default with a non-production `process.env`) - `name`, `detail` and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` (default in production or when env access is unavailable) - request metadata and a generic error name.\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. To opt back into detail with redaction, set `errorLogDetail: \"full\"` and pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis.\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}"
16041
16237
  },
16042
16238
  {
16043
16239
  "name": "ServerPrerenderedPage",
@@ -16161,7 +16357,7 @@
16161
16357
  "name": "SessionStore",
16162
16358
  "kind": "interface",
16163
16359
  "package": "@nifrajs/auth",
16164
- "signature": "export interface SessionStore {\n /** Read consistency. Omission asserts strong consistency for existing custom adapters. */\n readonly consistency?: \"strong\" | \"eventual\";\n /** The record for `id`, or `undefined` on a miss. */\n get(id: string): Promise<SessionRecord | undefined>;\n /** Store (or overwrite) the record for `id`. */\n set(id: string, record: SessionRecord): Promise<void>;\n /** Drop `id` (logout / regeneration). A no-op if absent. */\n delete(id: string): Promise<void>;\n /**\n * Overwrite `id` only while it still holds a record, resolving whether it wrote. The check and the\n * write must be one atomic step that also sets the new expiry, such as Redis\n * `SET key value XX PXAT <record.expiresAt>` (a bare `XX` drops the key's TTL) or a SQL\n * `UPDATE ... WHERE id = ?` that reports the rows it changed. Optional: when present, a loaded session renews through it instead\n * of `set`, so a logout that lands between the renewal's checks and its write wins even after the\n * logout's revocation marker is gone.\n */\n replace?(id: string, record: SessionRecord): Promise<boolean>;\n /**\n * Move the record at `previousId` to `nextId` only while it exists, is unrevoked and was not rotated\n * already, resolving whether it moved. One atomic step writes `marker` under `<previousId>.rotated`,\n * deletes `previousId` and stores `record` at `nextId`; it refuses when `<previousId>.revoked` or the\n * revocation marker of the original ID (the part before `~`) exists. Optional: without it, rotation\n * makes those writes one at a time and checks the revocation afterwards.\n */\n rotate?(previousId: string, nextId: string, record: SessionRecord, marker: SessionRecord): Promise<boolean>;\n}",
16360
+ "signature": "export interface SessionStore {\n /** Read consistency. Omission asserts strong consistency for existing custom adapters. */\n readonly consistency?: \"strong\" | \"eventual\";\n /** The record for `id`, or `undefined` on a miss. */\n get(id: string): Promise<SessionRecord | undefined>;\n /** Read records with the same consistency as `get`, in one batch. Return one entry per key in input\n * order, including `undefined` for each miss. */\n getMany?(ids: readonly string[]): Promise<readonly (SessionRecord | undefined)[]>;\n /** Store (or overwrite) the record for `id`. */\n set(id: string, record: SessionRecord): Promise<void>;\n /** Drop `id` (logout / regeneration). A no-op if absent. */\n delete(id: string): Promise<void>;\n /**\n * Overwrite `id` only while it still holds a record, resolving whether it wrote. The check and the\n * write must be one atomic step that also sets the new expiry, such as Redis\n * `SET key value XX PXAT <record.expiresAt>` (a bare `XX` drops the key's TTL) or a SQL\n * `UPDATE ... WHERE id = ?` that reports the rows it changed. Optional: when present, a loaded session renews through it instead\n * of `set`, so a logout that lands between the renewal's checks and its write wins even after the\n * logout's revocation marker is gone.\n */\n replace?(id: string, record: SessionRecord): Promise<boolean>;\n /**\n * Move the record at `previousId` to `nextId` only while it exists, is unrevoked and was not rotated\n * already, resolving whether it moved. One atomic step writes `marker` under `<previousId>.rotated`,\n * deletes `previousId` and stores `record` at `nextId`; it refuses when `<previousId>.revoked` or the\n * revocation marker of the original ID (the part before `~`) exists. Optional: without it, rotation\n * makes those writes one at a time and checks the revocation afterwards.\n */\n rotate?(previousId: string, nextId: string, record: SessionRecord, marker: SessionRecord): Promise<boolean>;\n}",
16165
16361
  "doc": "/**\n * Pluggable session backend (store mode). Reads must observe completed writes and deletes, including\n * revocation markers, across all instances. Eventual consistency cannot provide logout guarantees.\n * **Production needs a shared/durable store** so sessions hold across instances - {@link MemorySessionStore}\n * prod-guards against the per-instance footgun. Logout and rotation also write a revocation marker, an\n * empty record under `<id>.revoked`, and rotation one under `<id>.rotated`, so a store must accept those\n * keys like any other and keep each until its `expiresAt`. A dropped marker lets a request that loaded\n * the session before the logout write it back, unless the store implements `replace`; it also lets a\n * rotated generation outlive a logout made with an earlier generation's cookie.\n */"
16166
16362
  },
16167
16363
  {
@@ -16715,6 +16911,12 @@
16715
16911
  "signature": "export interface StaticCtx {\n readonly phase: \"build\";\n /** The deployment's origin, when the caller resolving static boundaries knows it. A request never\n * supplies it: the value is cached for every visitor, and a Host header is the client's to choose. */\n readonly origin?: string;\n}",
16716
16912
  "doc": "/** Build-safe inputs available to a static boundary. It intentionally has no request/session/params API. */"
16717
16913
  },
16914
+ {
16915
+ "name": "StaticEncoding",
16916
+ "kind": "type",
16917
+ "package": "@nifrajs/core",
16918
+ "signature": "export type StaticEncoding = \"br\" | \"gzip\";"
16919
+ },
16718
16920
  {
16719
16921
  "name": "StaticFileAccess",
16720
16922
  "kind": "interface",
@@ -16777,7 +16979,7 @@
16777
16979
  "name": "StaticMount",
16778
16980
  "kind": "interface",
16779
16981
  "package": "@nifrajs/core",
16780
- "signature": "export interface StaticMount {\n readonly root: string;\n /** `\"/\"`, or the prefix with one leading and no trailing slash. */\n readonly prefix: string;\n readonly isImmutable: (path: string) => boolean;\n readonly cacheControl: string | undefined;\n readonly files: ReadonlySet<string> | undefined;\n readonly allow: ((host: string, pathname: string) => boolean) | undefined;\n /** Lowercased names. */\n readonly headers: Readonly<Record<string, string>> | undefined;\n readonly denyDotfiles: boolean;\n readonly fallthrough: boolean;\n}",
16982
+ "signature": "export interface StaticMount {\n readonly root: string;\n /** `\"/\"`, or the prefix with one leading and no trailing slash. */\n readonly prefix: string;\n readonly isImmutable: (path: string) => boolean;\n readonly cacheControl: string | undefined;\n readonly files: ReadonlySet<string> | undefined;\n readonly precompressed: {\n readonly br: ReadonlySet<string>;\n readonly gzip: ReadonlySet<string>;\n } | undefined;\n readonly allow: ((host: string, pathname: string) => boolean) | undefined;\n /** Lowercased names. */\n readonly headers: Readonly<Record<string, string>> | undefined;\n readonly denyDotfiles: boolean;\n readonly fallthrough: boolean;\n}",
16781
16983
  "doc": "/** A {@link ServeStaticOptions} checked once, with its directory resolved by the runtime's reader. */"
16782
16984
  },
16783
16985
  {
@@ -16808,6 +17010,13 @@
16808
17010
  "signature": "export interface StaticRequest {\n readonly method: \"GET\" | \"HEAD\";\n readonly header: (name: string) => string | null;\n}",
16809
17011
  "doc": "/** A request's part of a static answer: its method and its headers by lowercase name. */"
16810
17012
  },
17013
+ {
17014
+ "name": "StaticRequestResolver",
17015
+ "kind": "type",
17016
+ "package": "@nifrajs/node",
17017
+ "signature": "export type StaticRequestResolver = (method: string, pathname: string, getHeader: (name: string) => string | null, buildRequest: () => Request, authority?: string) => NodeServeOutcome | Promise<NodeServeOutcome | undefined> | undefined;",
17018
+ "doc": "/** Resolver built by {@link createStaticResolver} for sibling HTTP adapters supporting `static`. */"
17019
+ },
16811
17020
  {
16812
17021
  "name": "StaticRoutes",
16813
17022
  "kind": "interface",
@@ -16976,9 +17185,16 @@
16976
17185
  "name": "StorageObject",
16977
17186
  "kind": "interface",
16978
17187
  "package": "@nifrajs/storage",
16979
- "signature": "export interface StorageObject {\n readonly body: Uint8Array;\n readonly size: number;\n readonly contentType?: string;\n readonly metadata?: Readonly<Record<string, string>>;\n}",
17188
+ "signature": "export interface StorageObject extends StorageObjectMetadata {\n readonly body: Uint8Array;\n}",
16980
17189
  "doc": "/** An object read back from storage. `body` is buffered (not streamed) - fine for typical uploads. */"
16981
17190
  },
17191
+ {
17192
+ "name": "StorageObjectMetadata",
17193
+ "kind": "interface",
17194
+ "package": "@nifrajs/storage",
17195
+ "signature": "export interface StorageObjectMetadata {\n readonly size: number;\n readonly contentType?: string;\n readonly metadata?: Readonly<Record<string, string>>;\n}",
17196
+ "doc": "/** Metadata for a stored object, without buffering its bytes. */"
17197
+ },
16982
17198
  {
16983
17199
  "name": "StoragePresignOperation",
16984
17200
  "kind": "type",
@@ -17000,6 +17216,13 @@
17000
17216
  "signature": "export interface StoragePresignedUrl {\n readonly url: string;\n readonly expiresAt?: Date;\n}",
17001
17217
  "doc": "/** A provider-minted URL and its known expiry. */"
17002
17218
  },
17219
+ {
17220
+ "name": "StorageStreamObject",
17221
+ "kind": "interface",
17222
+ "package": "@nifrajs/storage",
17223
+ "signature": "export interface StorageStreamObject extends StorageObjectMetadata {\n readonly body: ReadableStream<Uint8Array>;\n}",
17224
+ "doc": "/** A streamed object read back from storage without buffering the full payload in memory. */"
17225
+ },
17003
17226
  {
17004
17227
  "name": "StoredEntry",
17005
17228
  "kind": "interface",
@@ -17021,6 +17244,13 @@
17021
17244
  "signature": "export interface StoredResponse {\n readonly status: number;\n readonly headers: readonly (readonly [string, string])[];\n /** Base64-encoded response body; `\"\"` when the response had no body. */\n readonly body: string;\n}",
17022
17245
  "doc": "/** A serialized response held by a store. `body` is base64 so binary payloads round-trip intact. */"
17023
17246
  },
17247
+ {
17248
+ "name": "StreamableStorageAdapter",
17249
+ "kind": "interface",
17250
+ "package": "@nifrajs/storage",
17251
+ "signature": "export interface StreamableStorageAdapter extends StorageAdapter {\n /** Read object size and metadata without reading its bytes, or `null` if absent. */\n head(key: string): Promise<StorageObjectMetadata | null>;\n /** Read the object at `key` as a byte stream, or `null` if it doesn't exist. */\n getStream(key: string): Promise<StorageStreamObject | null>;\n /** Store a byte stream under `key`, overwriting any existing object. */\n putStream(key: string, stream: ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;\n}",
17252
+ "doc": "/** Optional streaming and metadata-only capability for large objects without full-body buffering. */"
17253
+ },
17024
17254
  {
17025
17255
  "name": "StripImageMetadataOptions",
17026
17256
  "kind": "interface",
@@ -17282,6 +17512,20 @@
17282
17512
  "package": "@nifrajs/middleware",
17283
17513
  "signature": "export interface TimingOptions {\n /** Name for the automatic total request metric. Default `\"total\"`; set `false` to disable. */\n readonly total?: string | false;\n /** Decimal places for durations. Default `1`. */\n readonly precision?: number;\n /** Only emit timing for matching requests. Default `true`. */\n readonly enabled?: boolean | ((request: Request) => boolean);\n}"
17284
17514
  },
17515
+ {
17516
+ "name": "TlsOptions",
17517
+ "kind": "interface",
17518
+ "package": "@nifrajs/node-engine",
17519
+ "signature": "export interface TlsOptions {\n readonly cert?: string | ArrayBuffer | Uint8Array;\n readonly key?: string | ArrayBuffer | Uint8Array;\n readonly cert_file_name?: string;\n readonly key_file_name?: string;\n /** Passphrase protecting an encrypted private key PEM (`key` or `key_file_name`). */\n readonly passphrase?: string;\n /** Trusted CA PEM certificates for verifying client certificates (mTLS). */\n readonly ca?: string | ArrayBuffer | Uint8Array | readonly (string | ArrayBuffer | Uint8Array)[];\n /** Path to a PEM bundle of trusted CA certificates for client certificate verification (mTLS). */\n readonly ca_file_name?: string;\n /** PEM Certificate Revocation List(s) checked during mTLS client authentication. */\n readonly crl?: string | ArrayBuffer | Uint8Array | readonly (string | ArrayBuffer | Uint8Array)[];\n /** Path to a PEM Certificate Revocation List file checked during mTLS client authentication. */\n readonly crl_file_name?: string;\n /** Request a client certificate during TLS handshake. */\n readonly requestCert?: boolean;\n /** Reject clients whose certificate fails verification or is absent when `requestCert` is true. Default `true` when `requestCert` is set. */\n readonly rejectUnauthorized?: boolean;\n /** Minimum TLS protocol version allowed (`\"TLSv1.2\"` or `\"TLSv1.3\"`). */\n readonly minVersion?: \"TLSv1.2\" | \"TLSv1.3\";\n /** Maximum TLS protocol version allowed (`\"TLSv1.2\"` or `\"TLSv1.3\"`). */\n readonly maxVersion?: \"TLSv1.2\" | \"TLSv1.3\";\n /** Colon/space-separated TLS cipher list (IANA or OpenSSL names, or `!EXCLUDED`). */\n readonly ciphers?: string;\n /** TLS 1.3 cipher suite list merged with {@link ciphers}. */\n readonly ciphersuites?: string;\n /** Colon-separated ECDH/KEM key exchange group list (e.g. `\"X25519:P-256:P-384\"`). */\n readonly ecdhCurve?: string;\n /** Additional SNI certificates keyed by hostname or single-level `*.domain` wildcard. */\n readonly serverNames?: readonly TlsSniEntry[];\n /**\n * Session-ticket keys: one or more 48-byte entries (16-byte name, 16-byte HMAC secret, 16-byte AES\n * key), newest first, so a rotation keeps resuming sessions. Share them across workers.\n */\n readonly ticketKeys?: string | ArrayBuffer | Uint8Array;\n}",
17520
+ "doc": "/** In-process TLS: inline PEM or file names, encrypted key passphrase, mTLS & TLS policy. */"
17521
+ },
17522
+ {
17523
+ "name": "TlsSniEntry",
17524
+ "kind": "interface",
17525
+ "package": "@nifrajs/node-engine",
17526
+ "signature": "export interface TlsSniEntry {\n readonly serverName: string;\n readonly cert?: string | ArrayBuffer | Uint8Array;\n readonly key?: string | ArrayBuffer | Uint8Array;\n readonly cert_file_name?: string;\n readonly key_file_name?: string;\n /** Passphrase protecting an encrypted private key PEM (`key` or `key_file_name`). */\n readonly passphrase?: string;\n}",
17527
+ "doc": "/** Per-hostname certificate entry for TLS Server Name Indication (SNI), matching exact or single-level wildcard (`*.example.com`). */"
17528
+ },
17285
17529
  {
17286
17530
  "name": "ToOpenAPIOptions",
17287
17531
  "kind": "interface",
@@ -17691,7 +17935,7 @@
17691
17935
  "name": "TriggerOptions",
17692
17936
  "kind": "interface",
17693
17937
  "package": "@nifrajs/island-trigger",
17694
- "signature": "export interface TriggerOptions {\n /** Target used by the `visible` strategy. Missing targets degrade to immediate activation. */\n readonly target?: object;\n}"
17938
+ "signature": "export interface TriggerOptions {\n /** Target used by the `visible` and `interaction` strategies. A missing target, or one that cannot\n * take listeners, degrades to immediate activation. */\n readonly target?: object;\n}"
17695
17939
  },
17696
17940
  {
17697
17941
  "name": "TrustedHtml",
@@ -18053,14 +18297,14 @@
18053
18297
  "name": "VERSION",
18054
18298
  "kind": "const",
18055
18299
  "package": "@nifrajs/core",
18056
- "signature": "export declare const VERSION: \"5.17.0\";",
18300
+ "signature": "export declare const VERSION: \"5.18.0\";",
18057
18301
  "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 */"
18058
18302
  },
18059
18303
  {
18060
18304
  "name": "VERSION",
18061
18305
  "kind": "const",
18062
18306
  "package": "nifra",
18063
- "signature": "export declare const VERSION: \"5.17.0\";",
18307
+ "signature": "export declare const VERSION: \"5.18.0\";",
18064
18308
  "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 */"
18065
18309
  },
18066
18310
  {
@@ -18299,14 +18543,14 @@
18299
18543
  "name": "WebSocketHandler",
18300
18544
  "kind": "interface",
18301
18545
  "package": "@nifrajs/core",
18302
- "signature": "export interface WebSocketHandler<Data = unknown, Env = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Extra = unknown> {\n /**\n * Cross-site WebSocket hijacking (CSWSH) guard - checked BEFORE `upgrade()`. A browser does not\n * apply CORS to WebSocket handshakes and DOES send the page's cookies, so without an Origin check\n * any site can open an authenticated socket to your app. Set this to lock the route to known\n * origins: a string allow-list (exact `Origin` header match) or a predicate. A request whose\n * `Origin` doesn't match (or is absent, for the allow-list form) is rejected with `403` before any\n * per-connection work.\n *\n * **When omitted, the default is same-origin:** a cross-origin BROWSER handshake (an `Origin` header\n * whose host differs from the request's) is rejected with `403`. Non-browser clients (no `Origin`) and\n * same-origin browsers pass. Set this to allow specific cross-origin clients, or `() => true` for a\n * genuinely public socket. Non-browser clients can spoof `Origin`, so this is a browser-CSWSH defense,\n * not authentication - pair it with auth in `upgrade()`.\n */\n allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * The capability ids this socket's code may reach, exactly as an HTTP route's `capabilities`.\n * `nifra capabilities check` compares them with the effects reachable from the module that\n * registers the socket. The handshake context carries the guard, so a runtime beacon in `upgrade()`\n * (or one that keeps `c`) fails closed on an undeclared capability.\n */\n capabilities?: readonly string[];\n /**\n * Runs in the HTTP request context **before** the upgrade, last in the chain an HTTP `GET` to the\n * same path runs: after {@link allowedOrigins}, then the `authenticate()` stages, `derive`s and\n * `beforeHandle`s registered before this route, any of which can refuse the handshake. `c` carries\n * what they derived. Return the initial per-connection `data` (→ `ws.data`), or a `Response` or\n * `status(...)` to **reject** the upgrade (the client never connects). Omit to accept with\n * `data: undefined`. A thrown `Response` rejects with it; any other throw goes to the route's\n * `onError` hooks, then a flat 500.\n */\n upgrade?(c: WebSocketContext<Env> & Extra): MaybePromise<Data | Response | StatusResponse>;\n /**\n * Contract-first messages: a Standard Schema (`t`, zod, valibot, …) validating each **inbound** frame.\n * Text frames are parsed as JSON first. When set, `message` receives the validated, typed value; a\n * non-JSON or schema-invalid frame is routed to `onInvalidMessage` (or dropped if that's omitted).\n */\n messageSchema?: Schema;\n /**\n * The **outbound** frame contract (server → client), a Standard Schema. Purely type-level: it types\n * the frames the typed client's `.ws()` handle receives, and documents what this route pushes. The\n * server does NOT runtime-validate its own sends by default - the inbound `messageSchema` guards the\n * trust boundary; outbound honesty is the handler author's code. Set {@link validateSend} to opt into\n * a synchronous runtime check of JSON text/UTF-8 binary frames.\n */\n sendSchema?: Send;\n /**\n * Opt-in runtime enforcement for {@link sendSchema}. Invalid JSON, schema failures, and async\n * validators are dropped before the native socket's `send()` runs and reported to `error()` when it\n * exists. This is a development/contract check for the server's own output, not an inbound security\n * boundary. It is off by default and requires `sendSchema` at registration.\n */\n validateSend?: boolean;\n /** Decode versioned transport frames before inbound schema validation. Omit for legacy JSON. */\n transport?: {\n readonly registry: TransportCodecRegistry;\n readonly maxBytes?: number;\n /** Whether an inbound frame may decode to a value holding a `RegExp`. Default `false`: a\n * client-supplied pattern is code (catastrophic backtracking stalls the event loop), so such a\n * frame is treated as invalid. */\n readonly acceptRegExp?: boolean;\n };\n open?(ws: NifraWebSocket<Data>): MaybePromise<void>;\n message?(ws: NifraWebSocket<Data>, data: WsMessageInput<Schema>): MaybePromise<void>;\n /** Inbound frame that failed JSON parse or `messageSchema` validation (only fires when a schema is\n * set). `raw` is the original frame; `issues` are the Standard Schema issues (one synthetic issue for\n * a JSON parse failure). Omit to silently drop invalid frames. */\n onInvalidMessage?(ws: NifraWebSocket<Data>, issues: ReadonlyArray<StandardIssue>, raw: WebSocketData): MaybePromise<void>;\n /** The connection closed. `code` and `reason` are the server's own close when it closed first\n * (`ws.close()`, or 1009 for a message over the cap), the peer's when the peer did, and 1006 when\n * the connection dropped without a close frame. */\n close?(ws: NifraWebSocket<Data>, code: number, reason: string): MaybePromise<void>;\n error?(ws: NifraWebSocket<Data>, error: unknown): MaybePromise<void>;\n}",
18546
+ "signature": "export interface WebSocketHandler<Data = unknown, Env = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Extra = unknown> {\n /**\n * Cross-site WebSocket hijacking (CSWSH) guard - checked BEFORE `upgrade()`. A browser does not\n * apply CORS to WebSocket handshakes and DOES send the page's cookies, so without an Origin check\n * any site can open an authenticated socket to your app. Set this to lock the route to known\n * origins: a string allow-list (exact `Origin` header match) or a predicate. A request whose\n * `Origin` doesn't match (or is absent, for the allow-list form) is rejected with `403` before any\n * per-connection work.\n *\n * **When omitted, the default is same-origin:** a cross-origin BROWSER handshake (an `Origin` header\n * whose host differs from the request's) is rejected with `403`. Non-browser clients (no `Origin`) and\n * same-origin browsers pass. Set this to allow specific cross-origin clients, or `() => true` for a\n * genuinely public socket. Non-browser clients can spoof `Origin`, so this is a browser-CSWSH defense,\n * not authentication - pair it with auth in `upgrade()`.\n */\n allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * The capability ids this socket's code may reach, exactly as an HTTP route's `capabilities`.\n * `nifra capabilities check` compares them with the effects reachable from the module that\n * registers the socket. The handshake context carries the guard, so a runtime beacon in `upgrade()`\n * (or one that keeps `c`) fails closed on an undeclared capability.\n */\n capabilities?: readonly string[];\n /**\n * Runs in the HTTP request context **before** the upgrade, last in the chain an HTTP `GET` to the\n * same path runs: after {@link allowedOrigins}, then the `authenticate()` stages, `derive`s and\n * `beforeHandle`s registered before this route, any of which can refuse the handshake. `c` carries\n * what they derived. Return the initial per-connection `data` (→ `ws.data`), or a `Response` or\n * `status(...)` to **reject** the upgrade (the client never connects). Omit to accept with\n * `data: undefined`. A thrown `Response` rejects with it; any other throw goes to the route's\n * `onError` hooks, then a flat 500.\n */\n upgrade?(c: WebSocketContext<Env> & Extra): MaybePromise<Data | Response | StatusResponse>;\n /**\n * Contract-first messages: a Standard Schema (`t`, zod, valibot, …) validating each **inbound** frame.\n * Text frames are parsed as JSON first. When set, `message` receives the validated, typed value; a\n * non-JSON or schema-invalid frame is routed to `onInvalidMessage` (or dropped if that's omitted).\n */\n messageSchema?: Schema;\n /**\n * The **outbound** frame contract (server → client), a Standard Schema. Purely type-level: it types\n * the frames the typed client's `.ws()` handle receives, and documents what this route pushes. The\n * server does NOT runtime-validate its own sends by default - the inbound `messageSchema` guards the\n * trust boundary; outbound honesty is the handler author's code. Set {@link validateSend} to opt into\n * a synchronous runtime check of JSON text/UTF-8 binary frames.\n */\n sendSchema?: Send;\n /**\n * Opt-in runtime enforcement for {@link sendSchema}. Invalid JSON, schema failures, and async\n * validators are dropped before the native socket's `send()` runs and reported to `error()` when it\n * exists. This is a development/contract check for the server's own output, not an inbound security\n * boundary. It is off by default and requires `sendSchema` at registration.\n */\n validateSend?: boolean;\n /** Decode versioned transport frames before inbound schema validation. Omit for legacy JSON. */\n transport?: {\n readonly registry: TransportCodecRegistry;\n readonly maxBytes?: number;\n /** Whether an inbound frame may decode to a value holding a `RegExp`. Default `false`: a\n * client-supplied pattern is code (catastrophic backtracking stalls the event loop), so such a\n * frame is treated as invalid. */\n readonly acceptRegExp?: boolean;\n };\n open?(ws: NifraWebSocket<Data>): MaybePromise<void>;\n message?(ws: NifraWebSocket<Data>, data: WsMessageInput<Schema>): MaybePromise<void>;\n /** Inbound frame that failed JSON parse or `messageSchema` validation (only fires when a schema is\n * set). `raw` is the original frame; `issues` are the Standard Schema issues (one synthetic issue for\n * a JSON parse failure). Omit to silently drop invalid frames. */\n onInvalidMessage?(ws: NifraWebSocket<Data>, issues: ReadonlyArray<StandardIssue>, raw: WebSocketData): MaybePromise<void>;\n /** The connection closed. `code` and `reason` are the server's own close when it closed first\n * (`ws.close()`, or 1009 for a message over the cap), the peer's when the peer did, and 1006 when\n * the connection dropped without a close frame. */\n close?(ws: NifraWebSocket<Data>, code: number, reason: string): MaybePromise<void>;\n /** Fires when a backpressured socket becomes writable again (native transports that track queued bytes). */\n drain?(ws: NifraWebSocket<Data>): MaybePromise<void>;\n error?(ws: NifraWebSocket<Data>, error: unknown): MaybePromise<void>;\n /** Per-route RFC 7692 `permessage-deflate` override on native transports that support it. */\n deflate?: boolean | {\n readonly serverNoContextTakeover?: boolean;\n readonly clientNoContextTakeover?: boolean;\n readonly serverMaxWindowBits?: number;\n readonly clientMaxWindowBits?: number;\n readonly threshold?: number;\n readonly maxDecompressedSize?: number;\n readonly level?: number;\n readonly sharedCompressor?: boolean;\n };\n}",
18303
18547
  "doc": "/** A WebSocket route's lifecycle. All callbacks optional; only `message` is needed for an echo. */"
18304
18548
  },
18305
18549
  {
18306
18550
  "name": "WebSocketHandler",
18307
18551
  "kind": "interface",
18308
18552
  "package": "nifra",
18309
- "signature": "export interface WebSocketHandler<Data = unknown, Env = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Extra = unknown> {\n /**\n * Cross-site WebSocket hijacking (CSWSH) guard - checked BEFORE `upgrade()`. A browser does not\n * apply CORS to WebSocket handshakes and DOES send the page's cookies, so without an Origin check\n * any site can open an authenticated socket to your app. Set this to lock the route to known\n * origins: a string allow-list (exact `Origin` header match) or a predicate. A request whose\n * `Origin` doesn't match (or is absent, for the allow-list form) is rejected with `403` before any\n * per-connection work.\n *\n * **When omitted, the default is same-origin:** a cross-origin BROWSER handshake (an `Origin` header\n * whose host differs from the request's) is rejected with `403`. Non-browser clients (no `Origin`) and\n * same-origin browsers pass. Set this to allow specific cross-origin clients, or `() => true` for a\n * genuinely public socket. Non-browser clients can spoof `Origin`, so this is a browser-CSWSH defense,\n * not authentication - pair it with auth in `upgrade()`.\n */\n allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * The capability ids this socket's code may reach, exactly as an HTTP route's `capabilities`.\n * `nifra capabilities check` compares them with the effects reachable from the module that\n * registers the socket. The handshake context carries the guard, so a runtime beacon in `upgrade()`\n * (or one that keeps `c`) fails closed on an undeclared capability.\n */\n capabilities?: readonly string[];\n /**\n * Runs in the HTTP request context **before** the upgrade, last in the chain an HTTP `GET` to the\n * same path runs: after {@link allowedOrigins}, then the `authenticate()` stages, `derive`s and\n * `beforeHandle`s registered before this route, any of which can refuse the handshake. `c` carries\n * what they derived. Return the initial per-connection `data` (→ `ws.data`), or a `Response` or\n * `status(...)` to **reject** the upgrade (the client never connects). Omit to accept with\n * `data: undefined`. A thrown `Response` rejects with it; any other throw goes to the route's\n * `onError` hooks, then a flat 500.\n */\n upgrade?(c: WebSocketContext<Env> & Extra): MaybePromise<Data | Response | StatusResponse>;\n /**\n * Contract-first messages: a Standard Schema (`t`, zod, valibot, …) validating each **inbound** frame.\n * Text frames are parsed as JSON first. When set, `message` receives the validated, typed value; a\n * non-JSON or schema-invalid frame is routed to `onInvalidMessage` (or dropped if that's omitted).\n */\n messageSchema?: Schema;\n /**\n * The **outbound** frame contract (server → client), a Standard Schema. Purely type-level: it types\n * the frames the typed client's `.ws()` handle receives, and documents what this route pushes. The\n * server does NOT runtime-validate its own sends by default - the inbound `messageSchema` guards the\n * trust boundary; outbound honesty is the handler author's code. Set {@link validateSend} to opt into\n * a synchronous runtime check of JSON text/UTF-8 binary frames.\n */\n sendSchema?: Send;\n /**\n * Opt-in runtime enforcement for {@link sendSchema}. Invalid JSON, schema failures, and async\n * validators are dropped before the native socket's `send()` runs and reported to `error()` when it\n * exists. This is a development/contract check for the server's own output, not an inbound security\n * boundary. It is off by default and requires `sendSchema` at registration.\n */\n validateSend?: boolean;\n /** Decode versioned transport frames before inbound schema validation. Omit for legacy JSON. */\n transport?: {\n readonly registry: TransportCodecRegistry;\n readonly maxBytes?: number;\n /** Whether an inbound frame may decode to a value holding a `RegExp`. Default `false`: a\n * client-supplied pattern is code (catastrophic backtracking stalls the event loop), so such a\n * frame is treated as invalid. */\n readonly acceptRegExp?: boolean;\n };\n open?(ws: NifraWebSocket<Data>): MaybePromise<void>;\n message?(ws: NifraWebSocket<Data>, data: WsMessageInput<Schema>): MaybePromise<void>;\n /** Inbound frame that failed JSON parse or `messageSchema` validation (only fires when a schema is\n * set). `raw` is the original frame; `issues` are the Standard Schema issues (one synthetic issue for\n * a JSON parse failure). Omit to silently drop invalid frames. */\n onInvalidMessage?(ws: NifraWebSocket<Data>, issues: ReadonlyArray<StandardIssue>, raw: WebSocketData): MaybePromise<void>;\n /** The connection closed. `code` and `reason` are the server's own close when it closed first\n * (`ws.close()`, or 1009 for a message over the cap), the peer's when the peer did, and 1006 when\n * the connection dropped without a close frame. */\n close?(ws: NifraWebSocket<Data>, code: number, reason: string): MaybePromise<void>;\n error?(ws: NifraWebSocket<Data>, error: unknown): MaybePromise<void>;\n}",
18553
+ "signature": "export interface WebSocketHandler<Data = unknown, Env = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Extra = unknown> {\n /**\n * Cross-site WebSocket hijacking (CSWSH) guard - checked BEFORE `upgrade()`. A browser does not\n * apply CORS to WebSocket handshakes and DOES send the page's cookies, so without an Origin check\n * any site can open an authenticated socket to your app. Set this to lock the route to known\n * origins: a string allow-list (exact `Origin` header match) or a predicate. A request whose\n * `Origin` doesn't match (or is absent, for the allow-list form) is rejected with `403` before any\n * per-connection work.\n *\n * **When omitted, the default is same-origin:** a cross-origin BROWSER handshake (an `Origin` header\n * whose host differs from the request's) is rejected with `403`. Non-browser clients (no `Origin`) and\n * same-origin browsers pass. Set this to allow specific cross-origin clients, or `() => true` for a\n * genuinely public socket. Non-browser clients can spoof `Origin`, so this is a browser-CSWSH defense,\n * not authentication - pair it with auth in `upgrade()`.\n */\n allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * The capability ids this socket's code may reach, exactly as an HTTP route's `capabilities`.\n * `nifra capabilities check` compares them with the effects reachable from the module that\n * registers the socket. The handshake context carries the guard, so a runtime beacon in `upgrade()`\n * (or one that keeps `c`) fails closed on an undeclared capability.\n */\n capabilities?: readonly string[];\n /**\n * Runs in the HTTP request context **before** the upgrade, last in the chain an HTTP `GET` to the\n * same path runs: after {@link allowedOrigins}, then the `authenticate()` stages, `derive`s and\n * `beforeHandle`s registered before this route, any of which can refuse the handshake. `c` carries\n * what they derived. Return the initial per-connection `data` (→ `ws.data`), or a `Response` or\n * `status(...)` to **reject** the upgrade (the client never connects). Omit to accept with\n * `data: undefined`. A thrown `Response` rejects with it; any other throw goes to the route's\n * `onError` hooks, then a flat 500.\n */\n upgrade?(c: WebSocketContext<Env> & Extra): MaybePromise<Data | Response | StatusResponse>;\n /**\n * Contract-first messages: a Standard Schema (`t`, zod, valibot, …) validating each **inbound** frame.\n * Text frames are parsed as JSON first. When set, `message` receives the validated, typed value; a\n * non-JSON or schema-invalid frame is routed to `onInvalidMessage` (or dropped if that's omitted).\n */\n messageSchema?: Schema;\n /**\n * The **outbound** frame contract (server → client), a Standard Schema. Purely type-level: it types\n * the frames the typed client's `.ws()` handle receives, and documents what this route pushes. The\n * server does NOT runtime-validate its own sends by default - the inbound `messageSchema` guards the\n * trust boundary; outbound honesty is the handler author's code. Set {@link validateSend} to opt into\n * a synchronous runtime check of JSON text/UTF-8 binary frames.\n */\n sendSchema?: Send;\n /**\n * Opt-in runtime enforcement for {@link sendSchema}. Invalid JSON, schema failures, and async\n * validators are dropped before the native socket's `send()` runs and reported to `error()` when it\n * exists. This is a development/contract check for the server's own output, not an inbound security\n * boundary. It is off by default and requires `sendSchema` at registration.\n */\n validateSend?: boolean;\n /** Decode versioned transport frames before inbound schema validation. Omit for legacy JSON. */\n transport?: {\n readonly registry: TransportCodecRegistry;\n readonly maxBytes?: number;\n /** Whether an inbound frame may decode to a value holding a `RegExp`. Default `false`: a\n * client-supplied pattern is code (catastrophic backtracking stalls the event loop), so such a\n * frame is treated as invalid. */\n readonly acceptRegExp?: boolean;\n };\n open?(ws: NifraWebSocket<Data>): MaybePromise<void>;\n message?(ws: NifraWebSocket<Data>, data: WsMessageInput<Schema>): MaybePromise<void>;\n /** Inbound frame that failed JSON parse or `messageSchema` validation (only fires when a schema is\n * set). `raw` is the original frame; `issues` are the Standard Schema issues (one synthetic issue for\n * a JSON parse failure). Omit to silently drop invalid frames. */\n onInvalidMessage?(ws: NifraWebSocket<Data>, issues: ReadonlyArray<StandardIssue>, raw: WebSocketData): MaybePromise<void>;\n /** The connection closed. `code` and `reason` are the server's own close when it closed first\n * (`ws.close()`, or 1009 for a message over the cap), the peer's when the peer did, and 1006 when\n * the connection dropped without a close frame. */\n close?(ws: NifraWebSocket<Data>, code: number, reason: string): MaybePromise<void>;\n /** Fires when a backpressured socket becomes writable again (native transports that track queued bytes). */\n drain?(ws: NifraWebSocket<Data>): MaybePromise<void>;\n error?(ws: NifraWebSocket<Data>, error: unknown): MaybePromise<void>;\n /** Per-route RFC 7692 `permessage-deflate` override on native transports that support it. */\n deflate?: boolean | {\n readonly serverNoContextTakeover?: boolean;\n readonly clientNoContextTakeover?: boolean;\n readonly serverMaxWindowBits?: number;\n readonly clientMaxWindowBits?: number;\n readonly threshold?: number;\n readonly maxDecompressedSize?: number;\n readonly level?: number;\n readonly sharedCompressor?: boolean;\n };\n}",
18310
18554
  "doc": "/** A WebSocket route's lifecycle. All callbacks optional; only `message` is needed for an echo. */"
18311
18555
  },
18312
18556
  {
@@ -18515,6 +18759,13 @@
18515
18759
  "signature": "export interface WsCallOptions<Out = unknown> {\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), and frames `validateReceive` refuses. */\n onError?: (error: unknown) => void;\n /** Maximum pending incoming messages per iterator and per validation queue, including the frame\n * being validated. Default 256. An overrun ends that iterator or closes the socket if validation\n * fell behind. Both report through `onError`. */\n maxPendingMessages?: number;\n /**\n * Check every received frame against this schema - the route's `sendSchema`, imported from the\n * module that declares it (the typed client carries the contract's types, not its schemas). A frame\n * that fails is not delivered: `onError` gets a `TypeError` naming the issues, with the frame as its\n * `cause`. Frames are still delivered in the order they arrived, an async schema included.\n */\n validateReceive?: StandardSchemaV1<unknown, Out>;\n}",
18516
18760
  "doc": "/** `Out` is what the handle delivers: a `validateReceive` schema must produce that type. */"
18517
18761
  },
18762
+ {
18763
+ "name": "WsDeflateOptions",
18764
+ "kind": "interface",
18765
+ "package": "@nifrajs/node-engine",
18766
+ "signature": "export interface WsDeflateOptions {\n /** Disallow server LZ77 context reuse across messages (`server_no_context_takeover`). */\n readonly serverNoContextTakeover?: boolean;\n /** Request client to reset its LZ77 window per message (`client_no_context_takeover`). */\n readonly clientNoContextTakeover?: boolean;\n /** Server deflate LZ77 window bits (9..15; 8 is rejected on server config and declined if offered by client). Default 15. */\n readonly serverMaxWindowBits?: number;\n /** Client deflate LZ77 window bits (8..15). Default 15. */\n readonly clientMaxWindowBits?: number;\n /** Minimum outgoing payload bytes before compressing (`0` compresses all frames). Default 0. */\n readonly threshold?: number;\n /** Upper limit in bytes on decompressed incoming message size (zip-bomb defense). Defaults to `wsMaxMessageSize`. */\n readonly maxDecompressedSize?: number;\n /** Compression level 1..9. Default 6. */\n readonly level?: number;\n /** Reuse a single stateless compressor instead of allocating one per open WebSocket. */\n readonly sharedCompressor?: boolean;\n}",
18767
+ "doc": "/** RFC 7692 WebSocket `permessage-deflate` negotiation and compression settings. */"
18768
+ },
18518
18769
  {
18519
18770
  "name": "WsHandle",
18520
18771
  "kind": "interface",
@@ -19002,6 +19253,13 @@
19002
19253
  "signature": "export declare function bindList<T, E extends ListNode = HTMLElement>(source: () => readonly T[], container: ListContainer<NoInfer<E>>, options: BindListOptions<T, E>): () => void;",
19003
19254
  "doc": "/**\n * Render a list signal (or any getter) into `container` with keyed reconciliation. A surviving item\n * keeps its node, so focus, selection and input state survive a reorder. A render with no earlier\n * nodes replaces the container's children; later renders move only the nodes outside the longest\n * run already in order. `key`, `create` and `update` run untracked: a signal they read does not\n * re-render the list. Returns the disposer; inside an island the binding also stops on unmount.\n */"
19004
19255
  },
19256
+ {
19257
+ "name": "bodyCeiling",
19258
+ "kind": "function",
19259
+ "package": "@nifrajs/node-engine",
19260
+ "signature": "export declare function bodyCeiling(app: object): number | undefined;",
19261
+ "doc": "/**\n * The largest `maxBodyBytes` among the app and the apps mounted under it, or `undefined` when none\n * is declared. The engine buffers a body before the app sees it, so a cap below what the app accepts\n * would refuse bodies the app allows, with an empty 413 and no way for the app to answer.\n */"
19262
+ },
19005
19263
  {
19006
19264
  "name": "bodyLimit",
19007
19265
  "kind": "function",
@@ -19190,6 +19448,20 @@
19190
19448
  "signature": "export declare function buildRouteManifest(manifest: Manifest, options?: {\n readonly target?: string;\n readonly prerendered?: Readonly<Record<string, readonly string[]>>;\n /** Runtime capabilities supplied outside generated entries (for example an explicit `withISR`). */\n readonly capabilities?: readonly RouteCapability[];\n}): Promise<RouteManifest>;",
19191
19449
  "doc": "/**\n * Build the route manifest for a discovered app, optionally resolved against a deploy target.\n *\n * `prerendered` maps a route id to the concrete paths the build actually emitted for it - pass what\n * `prerenderRoutes` produced. Without it, dynamic routes are reported by their declaration alone, which\n * is the right answer before a build has run and the wrong one after.\n */"
19192
19450
  },
19451
+ {
19452
+ "name": "buildSandboxedSpawn",
19453
+ "kind": "function",
19454
+ "package": "@nifrajs/coding-agent",
19455
+ "signature": "export declare function buildSandboxedSpawn(profile: ExtensionSandboxProfile, input: {\n readonly argv: readonly string[];\n readonly cwd: string;\n readonly modulePath: string;\n readonly env: Readonly<Record<string, string>>;\n readonly scratchDir?: string | undefined;\n}): SandboxedSpawnSpec;",
19456
+ "doc": "/** Build the hardened command vector and filtered environment for a sandboxed extension worker. */"
19457
+ },
19458
+ {
19459
+ "name": "buildSeatbeltProfile",
19460
+ "kind": "function",
19461
+ "package": "@nifrajs/coding-agent",
19462
+ "signature": "export declare function buildSeatbeltProfile(options: MacOsSeatbeltSandboxProfile, cwd: string, scratchDir?: string): string;",
19463
+ "doc": "/** Generate a restrictive macOS Seatbelt (SBPL) profile for running an extension worker. */"
19464
+ },
19193
19465
  {
19194
19466
  "name": "buildServer",
19195
19467
  "kind": "function",
@@ -19289,7 +19561,7 @@
19289
19561
  "kind": "function",
19290
19562
  "package": "@nifrajs/middleware",
19291
19563
  "signature": "export declare function cache(options: CacheOptions): Middleware;",
19292
- "doc": "/**\n * Full response cache for small, cacheable responses. Use a shared `store` in production. The\n * middleware honors `Cache-Control` by default, avoids `Set-Cookie`, caps stored bytes, emits `Age`,\n * and keeps `Vary` headers aligned with the cache key.\n */"
19564
+ "doc": "/**\n * Full response cache for small, cacheable responses. Use a shared `store` in production. The\n * middleware honors `Cache-Control` by default, avoids `Set-Cookie`, caps stored bytes, emits `Age`,\n * and keeps `Vary` headers aligned with the cache key. A body with a pending read when the\n * zero-delay capture timer fires passes through as a stream and is stored once it has been read to its\n * end within the byte cap; its `MISS` status is set before that, and a failed store write is ignored.\n */"
19293
19565
  },
19294
19566
  {
19295
19567
  "name": "cacheControl",
@@ -19653,14 +19925,14 @@
19653
19925
  "kind": "const",
19654
19926
  "package": "@nifrajs/core",
19655
19927
  "signature": "export declare const commonSecretPatterns: ReadonlyArray<RegExp>;",
19656
- "doc": "/**\n * A conservative, high-signal set of patterns for {@link RedactOptions.valuePatterns} - opt in by\n * passing it (or a subset) to `jsonLogger`/`redactLogFields`. Covers bearer tokens, JWTs, emails, and a\n * few well-known key formats (Stripe, GitHub, AWS access-key ids). Chosen to minimize false positives;\n * add your own (e.g. internal id formats) as needed. Every pattern is global so all matches are scrubbed.\n */"
19928
+ "doc": "/**\n * A conservative, high-signal set of patterns for {@link RedactOptions.valuePatterns}.\n * Covers bearer tokens, JWTs, emails, and a\n * few well-known key formats (Stripe, GitHub, AWS access-key ids). Chosen to minimize false positives;\n * add your own (e.g. internal id formats) as needed. Every pattern is global so all matches are scrubbed.\n */"
19657
19929
  },
19658
19930
  {
19659
19931
  "name": "commonSecretPatterns",
19660
19932
  "kind": "const",
19661
19933
  "package": "nifra",
19662
19934
  "signature": "export declare const commonSecretPatterns: ReadonlyArray<RegExp>;",
19663
- "doc": "/**\n * A conservative, high-signal set of patterns for {@link RedactOptions.valuePatterns} - opt in by\n * passing it (or a subset) to `jsonLogger`/`redactLogFields`. Covers bearer tokens, JWTs, emails, and a\n * few well-known key formats (Stripe, GitHub, AWS access-key ids). Chosen to minimize false positives;\n * add your own (e.g. internal id formats) as needed. Every pattern is global so all matches are scrubbed.\n */"
19935
+ "doc": "/**\n * A conservative, high-signal set of patterns for {@link RedactOptions.valuePatterns}.\n * Covers bearer tokens, JWTs, emails, and a\n * few well-known key formats (Stripe, GitHub, AWS access-key ids). Chosen to minimize false positives;\n * add your own (e.g. internal id formats) as needed. Every pattern is global so all matches are scrubbed.\n */"
19664
19936
  },
19665
19937
  {
19666
19938
  "name": "compareAgentEvalBaseline",
@@ -20364,6 +20636,13 @@
20364
20636
  "signature": "export declare function createNifraTools(options: NifraContextOptions & Pick<VerificationOptions, \"command\">): readonly NifraAgentTool[];",
20365
20637
  "doc": "/** Optional first-party tool descriptors. The Pi adapter can register these through an extension. */"
20366
20638
  },
20639
+ {
20640
+ "name": "createNodeCompat",
20641
+ "kind": "function",
20642
+ "package": "@nifrajs/node-engine",
20643
+ "signature": "export declare function createNodeCompat(request: Request): NodeCompatPair;",
20644
+ "doc": "/**\n * Create a genuine Node `IncomingMessage` and `ServerResponse` pair wired to a Web `Request` (and\n * underlying `@nifrajs/node-engine` request metadata when served by `serve()`).\n */"
20645
+ },
20367
20646
  {
20368
20647
  "name": "createNonceResolver",
20369
20648
  "kind": "function",
@@ -20525,6 +20804,13 @@
20525
20804
  "signature": "export declare function createSlotParking(): SlotParking;",
20526
20805
  "doc": "/** One per mounted view. */"
20527
20806
  },
20807
+ {
20808
+ "name": "createStaticResolver",
20809
+ "kind": "const",
20810
+ "package": "@nifrajs/node",
20811
+ "signature": "export declare const createStaticResolver: (staticOption: unknown) => StaticRequestResolver;",
20812
+ "doc": "/** Compile a `static` option (`serveStatic(...)` or fallback handler) into a zero-alloc request resolver. */"
20813
+ },
20528
20814
  {
20529
20815
  "name": "createStepCatalog",
20530
20816
  "kind": "function",
@@ -20619,7 +20905,7 @@
20619
20905
  "kind": "const",
20620
20906
  "package": "@nifrajs/core",
20621
20907
  "signature": "export declare const crossSiteFormRefused: (source: RequestSource, formOrigins: FormOrigins | undefined) => boolean;",
20622
- "doc": "/** Whether a request is a cross-site post that {@link readBodyFramed} would refuse, or one a page can\n * send the same way: a form media type, or no content type at all (`fetch` with `no-cors`). A request\n * with no content type that carries an `Authorization` header other than a browser-managed scheme\n * (Basic, Digest, Negotiate, NTLM) passes: script-set, it forced a preflight, so the app's CORS policy\n * has already judged its origin. It decides on the cheapest header first: a request without an\n * `Origin` (any non-browser client) costs one lookup, and a browser's own-origin post stops at\n * `Sec-Fetch-Site` before the URL is parsed. */"
20908
+ "doc": "/** Whether a request is a cross-site post that {@link readBodyFramed} would refuse, or one a page can\n * send the same way: a form media type, or no content type at all (`fetch` with `no-cors`). A request\n * with no content type that carries an `Authorization` header other than a browser-managed scheme\n * (Basic, Digest, Negotiate, NTLM) passes: script-set, it forced a preflight, so the app's CORS policy\n * has already judged its origin. Fetch Metadata can reject a browser request without an `Origin`;\n * callers that send neither header still pass. */"
20623
20909
  },
20624
20910
  {
20625
20911
  "name": "csrf",
@@ -21825,6 +22111,20 @@
21825
22111
  "signature": "export declare function fromBakedJoin<Left extends Record<string, unknown>, Right extends Record<string, unknown>, On extends SharedKey<Left, Right>, Cardinality extends JoinCardinality>(baked: BakedCollectionJoin<Left, Right, On, Cardinality>): IndexedJoin<Left, Right, On, Cardinality>;",
21826
22112
  "doc": "/** Rehydrate a deterministic join artifact. */"
21827
22113
  },
22114
+ {
22115
+ "name": "fromNodeHandler",
22116
+ "kind": "function",
22117
+ "package": "@nifrajs/node-engine",
22118
+ "signature": "export declare function fromNodeHandler(handler: NodeRequestListener): FetchHandler & ((request: Request) => Promise<Response>);",
22119
+ "doc": "/**\n * Wrap a Node `http.RequestListener` — including an entire Express application (`express()`) —\n * into a Web `FetchHandler` + fetch function that runs directly inside `@nifrajs/node-engine` `serve()`.\n */"
22120
+ },
22121
+ {
22122
+ "name": "fromNodeMiddleware",
22123
+ "kind": "function",
22124
+ "package": "@nifrajs/node-engine",
22125
+ "signature": "export declare function fromNodeMiddleware(...middlewares: readonly NodeMiddleware[]): (target: Request | NodeMiddlewareContextLike) => Promise<Response | undefined>;",
22126
+ "doc": "/**\n * Run one or more Node/Express-style `(req, res, next)` middlewares inside either a Nifra hook\n * (`app.onRequest(...)` / route handler) or a plain Fetch pipeline. Short-circuits with a `Response`\n * when middleware ends `res`, propagates headers/status to `c.set` when calling `next()`, and rejects\n * when `next(err)` is invoked.\n */"
22127
+ },
21828
22128
  {
21829
22129
  "name": "fromPrecompiled",
21830
22130
  "kind": "function",
@@ -21884,7 +22184,7 @@
21884
22184
  "name": "generateServerEntry",
21885
22185
  "kind": "function",
21886
22186
  "package": "@nifrajs/web",
21887
- "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Vercel-only runtime selection; Edge remains the default. */\n readonly vercelRuntime?: VercelRuntime;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options to import by name, each mapped to the specifier of the edge-safe module\n * that exports it. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n /** URL paths of the content-hashed client outputs (the build manifest's `assets`). When given, a\n * self-hosted entry caches only these immutably; otherwise every file under `/assets/` is. */\n readonly hashedFiles?: readonly string[];\n /** Trust the edge platform's client-address header for `c.clientIp`. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** How a self-hosted server stops and keeps idle connections. See {@link ServerEntrySelfHost}. */\n readonly selfHost?: ServerEntrySelfHost;\n /** The server manifest exports `copyChunks` (the client build split copy tables by locale). */\n readonly copyChunks?: boolean;\n /** `bun` / `node` only: the pages the build prerendered into `_prerendered/`, by request path, which\n * the app answers from their file (see `createWebApp`'s `prerenderedPages`). */\n readonly prerenderedPages?: Readonly<Record<string, ServerPrerenderedPage>>;\n}): string;",
22187
+ "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Vercel-only runtime selection; Edge remains the default. */\n readonly vercelRuntime?: VercelRuntime;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options to import by name, each mapped to the specifier of the edge-safe module\n * that exports it. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n /** URL paths of the content-hashed client outputs (the build manifest's `assets`). When given, a\n * self-hosted entry caches only these immutably; otherwise every file under `/assets/` is. */\n readonly hashedFiles?: readonly string[];\n readonly precompressedAssets?: {\n readonly br: readonly string[];\n readonly gzip: readonly string[];\n };\n /** Trust the edge platform's client-address header for `c.clientIp`. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** How a self-hosted server stops and keeps idle connections. See {@link ServerEntrySelfHost}. */\n readonly selfHost?: ServerEntrySelfHost;\n /** The server manifest exports `copyChunks` (the client build split copy tables by locale). */\n readonly copyChunks?: boolean;\n /** `bun` / `node` only: the pages the build prerendered into `_prerendered/`, by request path, which\n * the app answers from their file (see `createWebApp`'s `prerenderedPages`). */\n readonly prerenderedPages?: Readonly<Record<string, ServerPrerenderedPage>>;\n}): string;",
21888
22188
  "doc": "/**\n * Codegen the per-target **server entry** module (source text) for `buildServer` to bundle. It imports\n * the app's `adapter` (from `framework.ts`), the optional `backend` (from `backend.ts`), and the\n * generated `{ manifest, clientEntry }` (from `./server-manifest`), builds `createWebApp`, then wires\n * the right host:\n * - `cloudflare` / `vercel`: `export default` the fetch handler (the platform serves /assets/* itself).\n * - `deno`: a `@nifrajs/deno` server that serves the client bundle with Deno's file API.\n * - `bun` / `node`: a self-hosting server that ALSO serves the client bundle from disk (those\n * runtimes have a filesystem; the static `/assets/*` sit next to the entry).\n * `adapterImport`/`backendImport` are the specifiers the entry uses (relative to where it's written) -\n * `buildServer` writes the entry next to `serverEntry`, so they're resolved from there. Pure (string in,\n * string out) so the generation is unit-testable without a real build.\n */"
21889
22189
  },
21890
22190
  {
@@ -21940,6 +22240,13 @@
21940
22240
  "package": "@nifrajs/cli",
21941
22241
  "signature": "export declare function getFixRecipe(id: string): FixRecipe | undefined;"
21942
22242
  },
22243
+ {
22244
+ "name": "getPeerCertificate",
22245
+ "kind": "function",
22246
+ "package": "@nifrajs/node-engine",
22247
+ "signature": "export declare function getPeerCertificate(request: Request, detailed?: boolean): PeerCertificateInfo | null;",
22248
+ "doc": "/**\n * Return the client certificate presented on an mTLS connection for `request`, or `null` when\n * the request did not arrive over TLS with a client certificate.\n */"
22249
+ },
21943
22250
  {
21944
22251
  "name": "getRouteSlotRuntime",
21945
22252
  "kind": "function",
@@ -22394,6 +22701,13 @@
22394
22701
  "signature": "export declare function installComponentTrustedTypesPolicy(): void;",
22395
22702
  "doc": "/** Explicit opt-in for native framework HTML sinks. Every accepted string is tokenized first. */"
22396
22703
  },
22704
+ {
22705
+ "name": "installFastResponse",
22706
+ "kind": "const",
22707
+ "package": "@nifrajs/node",
22708
+ "signature": "export declare const installFastResponse: () => void;",
22709
+ "doc": "/** Swap `globalThis.Response` for the lazy direct-write `DeferringResponse` (`fastResponse: true`). */"
22710
+ },
22397
22711
  {
22398
22712
  "name": "installForms",
22399
22713
  "kind": "function",
@@ -22587,6 +22901,13 @@
22587
22901
  "package": "@nifrajs/agent",
22588
22902
  "signature": "export declare function isModelGatewayErrorCode(value: unknown): value is ModelGatewayErrorCode;"
22589
22903
  },
22904
+ {
22905
+ "name": "isNativeAvailable",
22906
+ "kind": "function",
22907
+ "package": "@nifrajs/node-engine",
22908
+ "signature": "export declare function isNativeAvailable(): boolean;",
22909
+ "doc": "/** Whether the native Rust engine addon can be loaded in this process. */"
22910
+ },
22590
22911
  {
22591
22912
  "name": "isNativeServerView",
22592
22913
  "kind": "function",
@@ -22632,14 +22953,14 @@
22632
22953
  "name": "isSameOriginForm",
22633
22954
  "kind": "function",
22634
22955
  "package": "@nifrajs/core",
22635
- "signature": "export declare function isSameOriginForm(origin: string, secFetchSite: string | null, request: {\n readonly url: string;\n}): boolean;",
22956
+ "signature": "export declare function isSameOriginForm(origin: string | null, secFetchSite: string | null, request: {\n readonly url: string;\n}): boolean;",
22636
22957
  "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 */"
22637
22958
  },
22638
22959
  {
22639
22960
  "name": "isSameOriginForm",
22640
22961
  "kind": "function",
22641
22962
  "package": "nifra",
22642
- "signature": "export declare function isSameOriginForm(origin: string, secFetchSite: string | null, request: {\n readonly url: string;\n}): boolean;",
22963
+ "signature": "export declare function isSameOriginForm(origin: string | null, secFetchSite: string | null, request: {\n readonly url: string;\n}): boolean;",
22643
22964
  "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 */"
22644
22965
  },
22645
22966
  {
@@ -22749,7 +23070,7 @@
22749
23070
  "name": "joinCollections",
22750
23071
  "kind": "function",
22751
23072
  "package": "@nifrajs/content",
22752
- "signature": "export declare function joinCollections<Left extends Record<string, unknown>, Right extends Record<string, unknown>, LeftBy extends ContentFieldKey<Left>, RightBy extends ContentFieldKey<Right>, On extends SharedKey<Left, Right>>(left: IndexedCollection<Left, LeftBy>, right: IndexedCollection<Right, RightBy>, on: On, options: {\n readonly cardinality: \"one-to-one\";\n}): IndexedJoin<Left, Right, On, \"one-to-one\">;"
23073
+ "signature": "export declare function joinCollections<Left extends Record<string, unknown>, Right extends Record<string, unknown>, LeftBy extends ContentFieldKey<Left>, RightBy extends ContentFieldKey<Right>, On extends SharedKey<Left, Right>>(...args: JoinArguments<[\n options: {\n readonly cardinality: \"one-to-one\";\n }\n], Left, Right, LeftBy, RightBy, On>): IndexedJoin<Left, Right, On, \"one-to-one\">;"
22753
23074
  },
22754
23075
  {
22755
23076
  "name": "jsonLd",
@@ -22763,14 +23084,14 @@
22763
23084
  "kind": "function",
22764
23085
  "package": "@nifrajs/core",
22765
23086
  "signature": "export declare function jsonLogger(write?: (line: string) => void, options?: RedactOptions): Logger;",
22766
- "doc": "/**\n * The default logger: one redacted JSON object per line. `write` is injectable for tests or\n * alternative sinks (defaults to stderr). `options` tunes redaction - pass `valuePatterns` (e.g.\n * {@link commonSecretPatterns}) to also scrub secrets embedded in values + the message. Framework keys\n * (`level`, `message`, `time`) always win over user fields of the same name.\n */"
23087
+ "doc": "/**\n * The default logger: one redacted JSON object per line. `write` is injectable for tests or\n * alternative sinks (defaults to stderr). `commonSecretPatterns` scrubs values and the log message\n * by default. Pass `valuePatterns` to replace those patterns. Framework keys\n * (`level`, `message`, `time`) always win over user fields of the same name.\n */"
22767
23088
  },
22768
23089
  {
22769
23090
  "name": "jsonLogger",
22770
23091
  "kind": "function",
22771
23092
  "package": "nifra",
22772
23093
  "signature": "export declare function jsonLogger(write?: (line: string) => void, options?: RedactOptions): Logger;",
22773
- "doc": "/**\n * The default logger: one redacted JSON object per line. `write` is injectable for tests or\n * alternative sinks (defaults to stderr). `options` tunes redaction - pass `valuePatterns` (e.g.\n * {@link commonSecretPatterns}) to also scrub secrets embedded in values + the message. Framework keys\n * (`level`, `message`, `time`) always win over user fields of the same name.\n */"
23094
+ "doc": "/**\n * The default logger: one redacted JSON object per line. `write` is injectable for tests or\n * alternative sinks (defaults to stderr). `commonSecretPatterns` scrubs values and the log message\n * by default. Pass `valuePatterns` to replace those patterns. Framework keys\n * (`level`, `message`, `time`) always win over user fields of the same name.\n */"
22774
23095
  },
22775
23096
  {
22776
23097
  "name": "jsonResponse",
@@ -23028,6 +23349,13 @@
23028
23349
  "signature": "export declare function maxClassification(values: Iterable<DataClassification>): DataClassification;",
23029
23350
  "doc": "/** The most sensitive classification among the inputs; `\"public\"` when none are given. */"
23030
23351
  },
23352
+ {
23353
+ "name": "mayServeSockets",
23354
+ "kind": "function",
23355
+ "package": "@nifrajs/node-engine",
23356
+ "signature": "export declare function mayServeSockets(app: object): boolean;",
23357
+ "doc": "/**\n * Whether a handshake could be taken by this app or an app mounted in it. `false` only when that is\n * certain: an app with no socket route and mounts that each say, through the same `wsRuntime` seam\n * `listen()` asks, that nothing in them can take an upgrade. Anything the adapter cannot read counts as\n * able, so a handshake is only skipped when it would have been answered as a plain GET anyway.\n */"
23358
+ },
23031
23359
  {
23032
23360
  "name": "mcp",
23033
23361
  "kind": "function",
@@ -23076,6 +23404,13 @@
23076
23404
  "signature": "export declare function mdxBunPlugin(options?: MdxPluginOptions): BunPlugin;",
23077
23405
  "doc": "/**\n * Build a `Bun.build` plugin that loads `.mdx` files as compiled components. The compiled module's\n * default export is the MDX content component; `.mdx` files may `import` and use components inline and\n * `export const meta = …` like any route module.\n */"
23078
23406
  },
23407
+ {
23408
+ "name": "memoizeSearchSchema",
23409
+ "kind": "function",
23410
+ "package": "@nifrajs/web",
23411
+ "signature": "export declare function memoizeSearchSchema<S extends StandardSchemaV1>(schema: S): S;",
23412
+ "doc": "/** Reuse a deterministic search schema's validation within one server request. Opt in for validators\n * that depend only on the input, leave it unchanged, and return plain search data. Every schema on a\n * route's chain must be wrapped, or none of the chain is reused. Each reader gets its own copy. Use\n * the same schema in the client to keep search and hydration identical. */"
23413
+ },
23079
23414
  {
23080
23415
  "name": "memoryArtifactPort",
23081
23416
  "kind": "function",
@@ -23289,6 +23624,13 @@
23289
23624
  "signature": "export declare function nativeServerView(component: unknown, islands?: Readonly<Record<string, IslandInstance>>, ranges?: Readonly<Record<string, ComponentRecord>>): NativeServerView;",
23290
23625
  "doc": "/** Server-only native view rendered by the selected framework's own renderer. */"
23291
23626
  },
23627
+ {
23628
+ "name": "needsRequestScope",
23629
+ "kind": "const",
23630
+ "package": "@nifrajs/node",
23631
+ "signature": "export declare const needsRequestScope: () => boolean;",
23632
+ "doc": "/** Whether `enterWith()` outlives the scope it ran in, so each request needs its own `AsyncResource`. */"
23633
+ },
23292
23634
  {
23293
23635
  "name": "negotiateContentType",
23294
23636
  "kind": "function",
@@ -24067,6 +24409,13 @@
24067
24409
  "package": "nifra",
24068
24410
  "signature": "export declare function pathnameOf(url: string): string;"
24069
24411
  },
24412
+ {
24413
+ "name": "payloadCeiling",
24414
+ "kind": "function",
24415
+ "package": "@nifrajs/node-engine",
24416
+ "signature": "export declare function payloadCeiling(app: object): number | undefined;",
24417
+ "doc": "/**\n * The largest `wsMaxPayloadBytes` among the app and the apps mounted under it that serve sockets, or\n * `undefined` when none is declared. The engine takes one limit per listener, so it has to admit every\n * mounted app's cap; a route whose app declares less is held to it by the hub. Reads each server's own\n * mount table by reflection, so a plain handler or an app with no socket routes names no cap.\n */"
24418
+ },
24070
24419
  {
24071
24420
  "name": "pickLanguage",
24072
24421
  "kind": "function",
@@ -24125,7 +24474,7 @@
24125
24474
  "name": "planStatic",
24126
24475
  "kind": "function",
24127
24476
  "package": "@nifrajs/core",
24128
- "signature": "export declare function planStatic(mount: StaticMount, immutable: boolean, request: StaticRequest, file: StaticFileAccess): Promise<StaticPlan>;",
24477
+ "signature": "export declare function planStatic(mount: StaticMount, immutable: boolean, request: StaticRequest, file: StaticFileAccess, encoding?: StaticEncoding | null): Promise<StaticPlan>;",
24129
24478
  "doc": "/**\n * The answer for an opened file, the one sequence every runtime's reader runs: the mount's headers\n * (a caller's own `cache-control`, `last-modified` or `etag` kept), a strong tag from the snapshot\n * served for a file up to {@link CONTENT_SNAPSHOT_MAX} bytes, a `304` for a current copy, then one\n * byte range or the whole file. A larger file streams with no tag, and its date is weak: an\n * `If-Range` gets the whole file rather than a range spliced from two versions.\n */"
24130
24479
  },
24131
24480
  {
@@ -24277,6 +24626,13 @@
24277
24626
  "signature": "export declare function privateEnvReason(reads: readonly string[], publicPrefix: string): string;",
24278
24627
  "doc": "/** The denial reason for a file's private environment reads. */"
24279
24628
  },
24629
+ {
24630
+ "name": "probe",
24631
+ "kind": "function",
24632
+ "package": "@nifrajs/node-engine",
24633
+ "signature": "export declare function probe(): ProbeResult;",
24634
+ "doc": "/** Probe whether a native addon binary is available on this host and report its transport/capabilities. */"
24635
+ },
24280
24636
  {
24281
24637
  "name": "problemDetails",
24282
24638
  "kind": "function",
@@ -24498,7 +24854,7 @@
24498
24854
  "name": "readBodyFramed",
24499
24855
  "kind": "function",
24500
24856
  "package": "@nifrajs/core",
24501
- "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>;",
24857
+ "signature": "export declare function readBodyFramed<T>(...args: FramedBodyArgs<T>): Promise<T>;",
24502
24858
  "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 */"
24503
24859
  },
24504
24860
  {
@@ -25768,12 +26124,25 @@
25768
26124
  "package": "@nifrajs/node",
25769
26125
  "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<NodeServer>;"
25770
26126
  },
26127
+ {
26128
+ "name": "serve",
26129
+ "kind": "function",
26130
+ "package": "@nifrajs/node-engine",
26131
+ "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<EngineServer>;"
26132
+ },
25771
26133
  {
25772
26134
  "name": "serve",
25773
26135
  "kind": "function",
25774
26136
  "package": "@nifrajs/node-uws",
25775
26137
  "signature": "export declare function serve(app: FetchHandler, options: ServeOptions): Promise<UwsServer>;"
25776
26138
  },
26139
+ {
26140
+ "name": "serveCluster",
26141
+ "kind": "function",
26142
+ "package": "@nifrajs/node-engine",
26143
+ "signature": "export declare function serveCluster(app: () => FetchHandler | Promise<FetchHandler>, options: ClusterOptions): Promise<ClusterPrimary | ClusterWorker>;",
26144
+ "doc": "/**\n * Run `app` on every core. The primary returns once every worker is listening; a worker returns once\n * its server is. Rejects in the primary when a worker cannot start, after stopping the others.\n */"
26145
+ },
25777
26146
  {
25778
26147
  "name": "serveDatabaseAsMcp",
25779
26148
  "kind": "function",
@@ -25802,6 +26171,13 @@
25802
26171
  "signature": "export declare function serveStatic(mounts: ServeStaticOptions | readonly ServeStaticOptions[]): (request: Request) => Promise<Response | undefined> | undefined;",
25803
26172
  "doc": "/**\n * The `static` handler for files on disk: each mount serves a directory under a URL prefix, and the\n * first mount whose prefix (and `files`, when set) takes a GET or HEAD path answers it. Passed to\n * {@link serve}, the mounts run on Node's own request, so a request none of them takes reaches the\n * app on its direct lane. Called with a Web `Request`, it answers the same way. Bun's\n * `@nifrajs/core/serve-static` and `@nifrajs/deno` take the same mounts.\n *\n * @example\n * ```ts\n * await serve(app, { port: 3000, static: serveStatic({ dir: new URL(\"./assets/\", import.meta.url) }) })\n * ```\n */"
25804
26173
  },
26174
+ {
26175
+ "name": "serveStatic",
26176
+ "kind": "function",
26177
+ "package": "@nifrajs/node-engine",
26178
+ "signature": "export declare function serveStatic(mounts: ServeStaticOptions | readonly ServeStaticOptions[]): (request: Request) => Promise<Response | undefined> | undefined;",
26179
+ "doc": "/**\n * The `static` handler for files on disk: each mount serves a directory under a URL prefix, and the\n * first mount whose prefix (and `files`, when set) takes a GET or HEAD path answers it. Passed to\n * {@link serve}, the mounts run on Node's own request, so a request none of them takes reaches the\n * app on its direct lane. Called with a Web `Request`, it answers the same way. Bun's\n * `@nifrajs/core/serve-static` and `@nifrajs/deno` take the same mounts.\n *\n * @example\n * ```ts\n * await serve(app, { port: 3000, static: serveStatic({ dir: new URL(\"./assets/\", import.meta.url) }) })\n * ```\n */"
26180
+ },
25805
26181
  {
25806
26182
  "name": "serveStdio",
25807
26183
  "kind": "function",
@@ -25959,6 +26335,13 @@
25959
26335
  "signature": "export declare function setMountedRouter(router: ClientRouter | undefined): void;",
25960
26336
  "doc": "/** Register (or clear) the router that owns fetchers - called by `mountRouter`. Not for app use. */"
25961
26337
  },
26338
+ {
26339
+ "name": "setResponseTrailers",
26340
+ "kind": "function",
26341
+ "package": "@nifrajs/node-engine",
26342
+ "signature": "export declare function setResponseTrailers(request: Request, trailers: Readonly<Record<string, string>>): boolean;",
26343
+ "doc": "/**\n * HTTP/2 only: set the fields the response to `request` ends with, replacing any set before. Call it\n * before the body ends, with the `Request` the engine made (`c.req` in a nifra route), not a copy.\n * `false`, and nothing is set, on HTTP/1.1, once the response is complete, or when a name or value\n * cannot be a trailer.\n */"
26344
+ },
25962
26345
  {
25963
26346
  "name": "setRouteSlot",
25964
26347
  "kind": "function",
@@ -26323,6 +26706,19 @@
26323
26706
  "signature": "export declare function staticComponentPipeline(source: string, file: string): unknown;",
26324
26707
  "doc": "/** The `componentPipeline` a config module exports as a plain literal, read without running the\n * module, or `undefined` when it exports none or one that is not a literal. */"
26325
26708
  },
26709
+ {
26710
+ "name": "staticEncoding",
26711
+ "kind": "function",
26712
+ "package": "@nifrajs/core",
26713
+ "signature": "export declare function staticEncoding(mount: StaticMount, path: string, immutable: boolean, header: (name: string) => string | null): StaticEncoding | null | undefined;",
26714
+ "doc": "/** Undefined for a plain file, null for the identity variant of a negotiated file. */"
26715
+ },
26716
+ {
26717
+ "name": "staticEncodingSuffix",
26718
+ "kind": "const",
26719
+ "package": "@nifrajs/core",
26720
+ "signature": "export declare const staticEncodingSuffix: (encoding: StaticEncoding) => string;"
26721
+ },
26326
26722
  {
26327
26723
  "name": "staticMountOf",
26328
26724
  "kind": "function",
@@ -27957,6 +28353,20 @@
27957
28353
  "signature": "export declare function writeDevServerRecord(root: string, record: DevServerRecord): void;",
27958
28354
  "doc": "/** Write the record atomically (temp file + rename) and owner-only. */"
27959
28355
  },
28356
+ {
28357
+ "name": "writeEarlyHints",
28358
+ "kind": "function",
28359
+ "package": "@nifrajs/node-engine",
28360
+ "signature": "export declare function writeEarlyHints(request: Request, hints: Readonly<Record<string, string | readonly string[]>>): boolean;",
28361
+ "doc": "/**\n * Send a `103 Early Hints` informational response before the final response for `request`.\n */"
28362
+ },
28363
+ {
28364
+ "name": "writeInformational",
28365
+ "kind": "function",
28366
+ "package": "@nifrajs/node-engine",
28367
+ "signature": "export declare function writeInformational(request: Request, status: number, headers?: Readonly<Record<string, string | readonly string[]>>): boolean;",
28368
+ "doc": "/**\n * Send an HTTP `1xx` informational response (such as `103 Early Hints`) before the final response\n * is sent for `request`. Supports HTTP/1.1 (including pipelining) and HTTP/2.\n */"
28369
+ },
27960
28370
  {
27961
28371
  "name": "writeRouteTypes",
27962
28372
  "kind": "function",