@nifrajs/cli 5.5.1 → 5.6.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 (138) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/dist/cdn-check.d.ts +7 -6
  3. package/dist/cdn-check.d.ts.map +1 -1
  4. package/dist/cdn-check.js +13 -1
  5. package/dist/cdn-check.js.map +1 -1
  6. package/dist/check-diagnostics.d.ts.map +1 -1
  7. package/dist/check-diagnostics.js +5 -3
  8. package/dist/check-diagnostics.js.map +1 -1
  9. package/dist/check-scan.d.ts.map +1 -1
  10. package/dist/check-scan.js +29 -2
  11. package/dist/check-scan.js.map +1 -1
  12. package/dist/cli.d.ts.map +1 -1
  13. package/dist/cli.js +14 -5
  14. package/dist/cli.js.map +1 -1
  15. package/dist/command-catalog.d.ts +14 -1
  16. package/dist/command-catalog.d.ts.map +1 -1
  17. package/dist/command-catalog.js +93 -0
  18. package/dist/command-catalog.js.map +1 -1
  19. package/dist/doctor.d.ts +9 -1
  20. package/dist/doctor.d.ts.map +1 -1
  21. package/dist/doctor.js +52 -0
  22. package/dist/doctor.js.map +1 -1
  23. package/dist/fix-recipes.d.ts.map +1 -1
  24. package/dist/fix-recipes.js +27 -0
  25. package/dist/fix-recipes.js.map +1 -1
  26. package/dist/frontend-guidance.d.ts +1 -1
  27. package/dist/frontend-guidance.d.ts.map +1 -1
  28. package/dist/frontend-guidance.js +17 -8
  29. package/dist/frontend-guidance.js.map +1 -1
  30. package/dist/introspect.js +1 -1
  31. package/dist/introspect.js.map +1 -1
  32. package/dist/load.d.ts +4 -1
  33. package/dist/load.d.ts.map +1 -1
  34. package/dist/load.js +8 -0
  35. package/dist/load.js.map +1 -1
  36. package/dist/mcp-exec.d.ts.map +1 -1
  37. package/dist/mcp-exec.js +57 -3
  38. package/dist/mcp-exec.js.map +1 -1
  39. package/dist/mcp-http.d.ts +2 -1
  40. package/dist/mcp-http.d.ts.map +1 -1
  41. package/dist/mcp-http.js +3 -2
  42. package/dist/mcp-http.js.map +1 -1
  43. package/dist/mcp-tool-meta.d.ts +21 -0
  44. package/dist/mcp-tool-meta.d.ts.map +1 -0
  45. package/dist/mcp-tool-meta.js +246 -0
  46. package/dist/mcp-tool-meta.js.map +1 -0
  47. package/dist/mcp.d.ts +3 -2
  48. package/dist/mcp.d.ts.map +1 -1
  49. package/dist/mcp.js +36 -98
  50. package/dist/mcp.js.map +1 -1
  51. package/dist/output-schemas.d.ts +8 -0
  52. package/dist/output-schemas.d.ts.map +1 -1
  53. package/dist/output-schemas.js +14 -0
  54. package/dist/output-schemas.js.map +1 -1
  55. package/dist/ppr-read-fix.d.ts +8 -0
  56. package/dist/ppr-read-fix.d.ts.map +1 -0
  57. package/dist/ppr-read-fix.js +356 -0
  58. package/dist/ppr-read-fix.js.map +1 -0
  59. package/dist/recipes/5.6.0.d.ts +10 -0
  60. package/dist/recipes/5.6.0.d.ts.map +1 -0
  61. package/dist/recipes/5.6.0.js +68 -0
  62. package/dist/recipes/5.6.0.js.map +1 -0
  63. package/dist/recipes/index.d.ts.map +1 -1
  64. package/dist/recipes/index.js +2 -0
  65. package/dist/recipes/index.js.map +1 -1
  66. package/dist/review.d.ts.map +1 -1
  67. package/dist/review.js +7 -2
  68. package/dist/review.js.map +1 -1
  69. package/dist/rules/codes.d.ts +8 -3
  70. package/dist/rules/codes.d.ts.map +1 -1
  71. package/dist/rules/codes.js +9 -4
  72. package/dist/rules/codes.js.map +1 -1
  73. package/dist/rules/explanations.d.ts.map +1 -1
  74. package/dist/rules/explanations.js +39 -13
  75. package/dist/rules/explanations.js.map +1 -1
  76. package/dist/rules/islands.d.ts +91 -0
  77. package/dist/rules/islands.d.ts.map +1 -1
  78. package/dist/rules/islands.js +757 -3
  79. package/dist/rules/islands.js.map +1 -1
  80. package/dist/rules/ppr.d.ts +16 -0
  81. package/dist/rules/ppr.d.ts.map +1 -0
  82. package/dist/rules/ppr.js +114 -0
  83. package/dist/rules/ppr.js.map +1 -0
  84. package/dist/rules/swap.d.ts +7 -0
  85. package/dist/rules/swap.d.ts.map +1 -0
  86. package/dist/rules/swap.js +338 -0
  87. package/dist/rules/swap.js.map +1 -0
  88. package/dist/scaffold-hole.d.ts +105 -0
  89. package/dist/scaffold-hole.d.ts.map +1 -0
  90. package/dist/scaffold-hole.js +688 -0
  91. package/dist/scaffold-hole.js.map +1 -0
  92. package/dist/scaffold.d.ts +5 -3
  93. package/dist/scaffold.d.ts.map +1 -1
  94. package/dist/scaffold.js +56 -46
  95. package/dist/scaffold.js.map +1 -1
  96. package/dist/verification-plan.d.ts.map +1 -1
  97. package/dist/verification-plan.js +12 -1
  98. package/dist/verification-plan.js.map +1 -1
  99. package/dist/web-app-options.d.ts +1 -1
  100. package/dist/web-app-options.d.ts.map +1 -1
  101. package/dist/web-app-options.js.map +1 -1
  102. package/docs/examples.json +63 -9
  103. package/docs/llms-full.txt +2060 -430
  104. package/docs/types.json +1300 -270
  105. package/package.json +11 -11
  106. package/src/cdn-check.ts +21 -7
  107. package/src/check-diagnostics.ts +5 -3
  108. package/src/check-scan.ts +34 -3
  109. package/src/cli.ts +14 -5
  110. package/src/command-catalog.ts +126 -0
  111. package/src/doctor.ts +44 -1
  112. package/src/fix-recipes.ts +28 -0
  113. package/src/frontend-guidance.ts +20 -8
  114. package/src/introspect.ts +1 -1
  115. package/src/load.ts +13 -0
  116. package/src/mcp-exec.ts +74 -3
  117. package/src/mcp-http.ts +3 -2
  118. package/src/mcp-tool-meta.ts +268 -0
  119. package/src/mcp.ts +35 -99
  120. package/src/output-schemas.ts +28 -0
  121. package/src/ppr-read-fix.ts +426 -0
  122. package/src/recipes/5.6.0.ts +69 -0
  123. package/src/recipes/index.ts +2 -0
  124. package/src/review.ts +7 -2
  125. package/src/rules/codes.ts +9 -4
  126. package/src/rules/explanations.ts +39 -13
  127. package/src/rules/islands.ts +875 -3
  128. package/src/rules/ppr.ts +143 -0
  129. package/src/rules/swap.ts +402 -0
  130. package/src/scaffold-hole.ts +880 -0
  131. package/src/scaffold.ts +60 -49
  132. package/src/verification-plan.ts +20 -1
  133. package/src/web-app-options.ts +1 -0
  134. package/dist/rules/nano.d.ts +0 -6
  135. package/dist/rules/nano.d.ts.map +0 -1
  136. package/dist/rules/nano.js +0 -273
  137. package/dist/rules/nano.js.map +0 -1
  138. package/src/rules/nano.ts +0 -307
package/docs/types.json CHANGED
@@ -117,6 +117,20 @@
117
117
  "signature": "export declare const AGENT_PROTOCOL_VERSION: 1;",
118
118
  "doc": "/**\n * Backend-neutral protocol for local coding-agent hosts.\n *\n * This package deliberately has no runtime dependencies. A Pi adapter, a Nifra-native backend,\n * the CLI, and the Workbench can all implement or consume these contracts without pulling any\n * framework, model provider, or UI code into an application.\n */"
119
119
  },
120
+ {
121
+ "name": "ALARM_GAP_MS",
122
+ "kind": "const",
123
+ "package": "@nifrajs/web",
124
+ "signature": "export declare const ALARM_GAP_MS = 30000;",
125
+ "doc": "/** Alarms come no closer together than this: expiry is checked again before every frame anyway. */"
126
+ },
127
+ {
128
+ "name": "APPEND_SCRIPT",
129
+ "kind": "const",
130
+ "package": "@nifrajs/web",
131
+ "signature": "export declare const APPEND_SCRIPT = \"local t = redis.call('TIME')\\nlocal now = tonumber(t[1]) * 1000000 + tonumber(t[2])\\nlocal last = tonumber(redis.call('HGET', KEYS[2], 'seq') or '0')\\nlocal seq = math.max(last + 1, now)\\nlocal id = string.format('%.0f', seq)\\nlocal n = redis.call('HINCRBY', KEYS[2], 'n', 1)\\nredis.call('HSET', KEYS[2], 'seq', id)\\nredis.call('XADD', KEYS[1], 'MAXLEN', '~', ARGV[2], id .. '-0', 'n', n, 'e', ARGV[1])\\nreturn id\";",
132
+ "doc": "/**\n * KEYS[1] the stream, KEYS[2] the clock hash; ARGV[1] the event JSON, ARGV[2] the trim length.\n * Lua numbers are doubles: a microsecond clock stays exact below 2^53 (the year 2255).\n */"
133
+ },
120
134
  {
121
135
  "name": "APPROVAL_NEVER_EXPIRES_AT",
122
136
  "kind": "const",
@@ -1928,31 +1942,18 @@
1928
1942
  "doc": "/** A `Response` a route declared as binary. `Jsonify` maps this to `Blob`. */"
1929
1943
  },
1930
1944
  {
1931
- "name": "BindListOptions",
1945
+ "name": "BindIslandContext",
1932
1946
  "kind": "interface",
1933
1947
  "package": "@nifrajs/web",
1934
- "signature": "export interface BindListOptions<T> {\n key(item: T): string | number;\n create(item: T): HTMLElement;\n update?(el: HTMLElement, item: T): void;\n}",
1935
- "doc": "/** How a `bindList` turns items into keyed DOM. `key` MUST be stable and unique per item (never the\n * array index) - it is what lets add/remove/reorder touch only the changed rows. */"
1948
+ "signature": "export interface BindIslandContext<P> {\n /** The island's host element. */\n readonly root: HTMLElement;\n /** The parsed `data-island-props`, or `undefined` when absent or malformed. */\n readonly props: P | undefined;\n /**\n * The signal the markup binds as `key`, seeded from `props[key]` when present, else `fallback`.\n * Each key returns the same signal across calls.\n */\n state<T>(key: string, fallback: T): Signal<T>;\n /**\n * Run `fn` when the island unmounts - for timers, requests and listeners the setup starts. Called\n * after the island unmounted (say, once an awaited request settles), it runs `fn` at once.\n */\n onDispose(fn: () => void): void;\n}",
1949
+ "doc": "/** What a `bindIsland` setup receives. */"
1936
1950
  },
1937
1951
  {
1938
- "name": "BindResourceHandlers",
1952
+ "name": "BindListOptions",
1939
1953
  "kind": "interface",
1940
1954
  "package": "@nifrajs/web",
1941
- "signature": "export interface BindResourceHandlers<T> {\n ready(el: HTMLElement, value: T): void;\n pending?(el: HTMLElement): void;\n error?(el: HTMLElement, error: unknown): void;\n}",
1942
- "doc": "/** How a `bindResource` maps each async state to the DOM. `ready` is required (there is always a\n * success shape to render); `pending`/`error` are optional. Every branch is explicit - no hidden\n * \"still loading\" state can slip through as a rendered `undefined`. */"
1943
- },
1944
- {
1945
- "name": "BindableElement",
1946
- "kind": "interface",
1947
- "package": "@nifrajs/islets",
1948
- "signature": "export interface BindableElement {\n getAttribute(name: string): string | null;\n setAttribute(name: string, value: string): void;\n removeAttribute(name: string): void;\n textContent: string | null;\n hidden: boolean;\n value?: string;\n readonly classList: {\n toggle(name: string, force?: boolean): unknown;\n };\n addEventListener(type: string, listener: (event: Event) => void): void;\n removeEventListener(type: string, listener: (event: Event) => void): void;\n}",
1949
- "doc": "/** The element surface the walker needs - structural, so tests can drive it without a real DOM. */"
1950
- },
1951
- {
1952
- "name": "BindableRoot",
1953
- "kind": "interface",
1954
- "package": "@nifrajs/islets",
1955
- "signature": "export interface BindableRoot {\n querySelectorAll(selector: string): Iterable<BindableElement>;\n}"
1955
+ "signature": "export interface BindListOptions<T, E extends ListNode = HTMLElement> {\n /** Stable and unique per item - never the array index, or a removal reuses the wrong node. */\n key(item: T): string | number;\n create(item: T): E;\n /** Brings a node in line with its item: runs after `create` and on every later change. */\n update?(el: E, item: T): void;\n}",
1956
+ "doc": "/** How `bindList` turns items into keyed DOM. */"
1956
1957
  },
1957
1958
  {
1958
1959
  "name": "Blocker",
@@ -2124,7 +2125,7 @@
2124
2125
  "name": "Boundary",
2125
2126
  "kind": "type",
2126
2127
  "package": "@nifrajs/web",
2127
- "signature": "export type Boundary<Data, UI> = StaticBoundary<Data, UI> | DynamicBoundary<Data, UI> | InterceptBoundary<Data, UI>;",
2128
+ "signature": "export type Boundary<Data, UI> = StaticBoundary<Data, UI> | DynamicBoundary<Data, UI> | SharedBoundary<Data, UI> | InterceptBoundary<Data, UI>;",
2128
2129
  "doc": "/** A discriminated union: the `mode` selects the context type accepted by `load`. */"
2129
2130
  },
2130
2131
  {
@@ -2167,11 +2168,25 @@
2167
2168
  "signature": "export type BoundaryKind = \"approval\" | \"handoff\";",
2168
2169
  "doc": "/** The two boundary families a host pauses on. */"
2169
2170
  },
2171
+ {
2172
+ "name": "BoundaryLoaderEntry",
2173
+ "kind": "interface",
2174
+ "package": "@nifrajs/web",
2175
+ "signature": "export interface BoundaryLoaderEntry {\n readonly load: NonNullable<BoundaryRegistration[\"load\"]>;\n /** The boundary data's output schema. Required whenever `load` returns data. */\n readonly output?: StandardSchemaV1;\n /**\n * A `shared` boundary's freshness in seconds, required for one and refused for any other: an older\n * entry is served while one rebuild runs. Write the entry inline, so the build can find it.\n */\n readonly revalidate?: number;\n /** A `shared` boundary's tags, as a route's `revalidateTags`: purging one drops its entries. */\n readonly revalidateTags?: RevalidateTags;\n}",
2176
+ "doc": "/** A boundary's server loader, declared in the route's backend half under `boundaryLoaders`. */"
2177
+ },
2178
+ {
2179
+ "name": "BoundaryLoadersOf",
2180
+ "kind": "type",
2181
+ "package": "@nifrajs/web",
2182
+ "signature": "export type BoundaryLoadersOf<Frontend, Backend> = unknown extends Frontend ? Readonly<Record<string, BoundaryLoaderEntry>> : string extends BoundaryNameOf<DeclaredBoundaryOf<Frontend>> ? Readonly<Record<string, BoundaryLoaderEntry>> : {\n readonly [Declared in DeclaredBoundaryOf<Frontend> as BoundaryNameOf<Declared>]?: LoaderEntryOf<Declared>;\n} & (Backend extends {\n readonly shellLoader: unknown;\n} ? {\n readonly [Declared in DeclaredBoundaryOf<Frontend> as HoleNameOf<Declared>]: LoaderEntryOf<Declared>;\n} : unknown);",
2183
+ "doc": "/**\n * The `boundaryLoaders` a backend half may export, from the module types of both halves: an entry\n * names a boundary the page declares, and a route with a `shellLoader` needs one for each hole.\n * Unchecked when TypeScript cannot read the page (`.svelte`, `.vue`) or its boundary names are not\n * literal types, which `as const` on each boundary gives.\n */"
2184
+ },
2170
2185
  {
2171
2186
  "name": "BoundaryMode",
2172
2187
  "kind": "type",
2173
2188
  "package": "@nifrajs/web",
2174
- "signature": "export type BoundaryMode = \"static\" | \"dynamic\" | {\n readonly intercept: string;\n};"
2189
+ "signature": "export type BoundaryMode = \"static\" | \"dynamic\" | \"shared\" | {\n readonly intercept: string;\n};"
2175
2190
  },
2176
2191
  {
2177
2192
  "name": "BoundaryOp",
@@ -2184,7 +2199,7 @@
2184
2199
  "name": "BoundaryRegistration",
2185
2200
  "kind": "type",
2186
2201
  "package": "@nifrajs/web",
2187
- "signature": "export type BoundaryRegistration = (ErasedBoundaryBase & {\n readonly mode: \"static\";\n readonly load?: (ctx: StaticCtx) => unknown | Promise<unknown>;\n}) | (ErasedBoundaryBase & {\n readonly mode: \"dynamic\";\n readonly load?: (ctx: BoundaryRequestCtx) => unknown | Promise<unknown>;\n}) | (ErasedBoundaryBase & {\n readonly mode: {\n readonly intercept: string;\n };\n readonly load?: (ctx: BoundaryRequestCtx) => unknown | Promise<unknown>;\n});"
2202
+ "signature": "export type BoundaryRegistration = (ErasedBoundaryBase & {\n readonly mode: \"static\";\n readonly load?: (ctx: StaticCtx) => unknown | Promise<unknown>;\n}) | (ErasedBoundaryBase & {\n readonly mode: \"dynamic\";\n readonly load?: (ctx: BoundaryRequestCtx) => unknown | Promise<unknown>;\n}) | (ErasedBoundaryBase & {\n readonly mode: \"shared\";\n readonly load?: (ctx: SharedHoleCtx) => unknown | Promise<unknown>;\n}) | (ErasedBoundaryBase & {\n readonly mode: {\n readonly intercept: string;\n };\n readonly load?: (ctx: BoundaryRequestCtx) => unknown | Promise<unknown>;\n});"
2188
2203
  },
2189
2204
  {
2190
2205
  "name": "BoundaryRejection",
@@ -2197,14 +2212,14 @@
2197
2212
  "name": "BoundaryRequestCtx",
2198
2213
  "kind": "interface",
2199
2214
  "package": "@nifrajs/web",
2200
- "signature": "export interface BoundaryRequestCtx {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly api: unknown;\n readonly env: unknown;\n readonly draft: boolean;\n readonly search: Readonly<Record<string, unknown>>;\n readonly signal: AbortSignal;\n}",
2215
+ "signature": "export interface BoundaryRequestCtx {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly api: unknown;\n readonly env: unknown;\n readonly draft: boolean;\n readonly search: Readonly<Record<string, unknown>>;\n readonly signal: AbortSignal;\n /**\n * Declare what this hole's data depends on, as keys in the cache-tag charset. In a live load of a\n * partially prerendered page the hole reloads when one of them changes; elsewhere it does nothing.\n */\n readonly live: (...keys: string[]) => void;\n}",
2201
2216
  "doc": "/** Request-scoped inputs available to dynamic and intercepting boundaries. */"
2202
2217
  },
2203
2218
  {
2204
2219
  "name": "BoundaryState",
2205
2220
  "kind": "interface",
2206
2221
  "package": "@nifrajs/web",
2207
- "signature": "export interface BoundaryState {\n readonly name: string;\n readonly mode: BoundaryMode;\n readonly status: BoundaryStatus;\n readonly data?: unknown;\n readonly error?: BoundaryError;\n readonly errorId?: string;\n}",
2222
+ "signature": "export interface BoundaryState {\n readonly name: string;\n readonly mode: BoundaryMode;\n readonly status: BoundaryStatus;\n readonly data?: unknown;\n readonly error?: BoundaryError;\n readonly errorId?: string;\n /** While an intercept boundary holds a target: the result of the last action posted to that target,\n * which the page's own `actionData` never sees. Only on a `\"ready\"` state. */\n readonly actionData?: unknown;\n /** Set on a hole of a partially prerendered shell: the adapter renders an opaque host the PPR\n * runtime fills, not the boundary's content. */\n readonly ppr?: true;\n /** On a hole the client reloads as a host: its frame, the server's HTML plus props when it\n * hydrates, usually deferred. */\n readonly fill?: unknown;\n /** A live load kept this hole: the client shows the copy it holds. */\n readonly kept?: true;\n /** Opaque: which live load the target's data came from (`@nifrajs/web/live-client`). */\n readonly live?: unknown;\n}",
2208
2223
  "doc": "/** Serializable boundary state passed to the adapter's render seam. */"
2209
2224
  },
2210
2225
  {
@@ -2230,7 +2245,7 @@
2230
2245
  "name": "BoundedSubagentRunner",
2231
2246
  "kind": "class",
2232
2247
  "package": "@nifrajs/coding-agent",
2233
- "signature": "export declare class BoundedSubagentRunner {\n private readonly executor;\n private readonly options;\n private children;\n private readonly ledger;\n constructor(executor: SubagentExecutor, options?: SubagentRunnerOptions);\n /** Executors this runner's ledger holds as abandoned and still running. */\n get abandoned(): number;\n run(spec: SubagentSpec): Promise<SubagentResult>;\n runMany(specs: readonly SubagentSpec[], maxConcurrency?: number): Promise<readonly SubagentResult[]>;\n}",
2248
+ "signature": "export declare class BoundedSubagentRunner {\n private readonly executor;\n private readonly options;\n private readonly started;\n private readonly ledger;\n constructor(executor: SubagentExecutor, options?: SubagentRunnerOptions);\n /** Executors this runner's ledger holds as abandoned and still running. */\n get abandoned(): number;\n run(spec: SubagentSpec): Promise<SubagentResult>;\n runMany(specs: readonly SubagentSpec[], maxConcurrency?: number): Promise<readonly SubagentResult[]>;\n}",
2234
2249
  "doc": "/** Explicitly bounded child execution. Recursive fan-out is impossible without a caller budget. */"
2235
2250
  },
2236
2251
  {
@@ -2270,7 +2285,7 @@
2270
2285
  "name": "BuildClientOptions",
2271
2286
  "kind": "interface",
2272
2287
  "package": "@nifrajs/web",
2273
- "signature": "export interface BuildClientOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the bundle + `manifest.json` (absolute path). */\n readonly outDir: string;\n /** The adapter's client runtime (exports `mountRouter`), e.g. `\"@nifrajs/web-solid/client\"`. */\n readonly clientModule: string;\n /** Route/layout file → import specifier (default: `${routesDir}/${file}`). */\n readonly resolve?: (file: string) => string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"dom\")`). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` export conditions (e.g. `[\"bun\", \"solid\", \"browser\"]`). */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (e.g. `{ \"process.env.NODE_ENV\": '\"production\"' }`). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** URL prefix the assets are served under (default `\"/assets/\"`); also Bun's chunk `publicPath`. */\n readonly publicPath?: string;\n /**\n * Directory of user-authored static files copied into the build and served at the root (default\n * `\"public\"`). Absent directory ⇒ nothing copied, no error.\n *\n * NOT the same thing as {@link publicPath}, despite the names: that is the URL prefix for\n * content-hashed bundle chunks and never covers files an author put on disk. The collision is a\n * real source of confusion, which is why both are spelled out here.\n */\n readonly publicDir?: string | false;\n /**\n * Prefix that opts an environment variable into the **client** bundle (Vite/Next convention; default\n * `\"PUBLIC_\"`). Every var in the build environment whose name starts with this prefix is baked into\n * the client `define` as `\"process.env.NAME\": JSON.stringify(value)`, so `process.env.PUBLIC_API_URL`\n * compiles to its literal value in the browser. Vars WITHOUT the prefix are never exposed - the bare\n * `process.env` define resolves them to `undefined`, so server secrets can't leak into the client\n * bundle. Set to `\"\"` to disable auto-exposure entirely (no var is baked in). `options.define` still\n * wins over an auto-exposed var (it's layered last). Sourced from `Bun.env` (falls back to\n * `process.env`) at build time. */\n readonly publicEnvPrefix?: string;\n /**\n * Reviewed false positives of the secret scan, which fails the build when a bundle, source map or\n * `public/` file carries what looks like a credential or the value of a non-public environment\n * variable. Each names its rule, its file (or, for an environment value, its variable) and a reason.\n */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Move copy tables (`@nifrajs/i18n/copy`) into one chunk per locale, so a page's JavaScript carries\n * only the copy of the locale it renders in (default: on when minifying). The server bundle keeps\n * every table whole; the server entry passes the manifest's `copyChunks` to `createWebApp`.\n */\n readonly copySplit?: boolean;\n}"
2288
+ "signature": "export interface BuildClientOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the bundle + `manifest.json` (absolute path). */\n readonly outDir: string;\n /** The adapter's client runtime (exports `mountRouter`), e.g. `\"@nifrajs/web-solid/client\"`. */\n readonly clientModule: string;\n /** Route/layout file → import specifier (default: `${routesDir}/${file}`). */\n readonly resolve?: (file: string) => string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"dom\")`). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` export conditions (e.g. `[\"bun\", \"solid\", \"browser\"]`). */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (e.g. `{ \"process.env.NODE_ENV\": '\"production\"' }`). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** URL prefix the assets are served under (default `\"/assets/\"`); also Bun's chunk `publicPath`. */\n readonly publicPath?: string;\n /**\n * Directory of user-authored static files copied into the build and served at the root (default\n * `\"public\"`). Absent directory ⇒ nothing copied, no error.\n *\n * NOT the same thing as {@link publicPath}, despite the names: that is the URL prefix for\n * content-hashed bundle chunks and never covers files an author put on disk. The collision is a\n * real source of confusion, which is why both are spelled out here.\n */\n readonly publicDir?: string | false;\n /**\n * Prefix that opts an environment variable into the **client** bundle (Vite/Next convention; default\n * `\"PUBLIC_\"`). Every var in the build environment whose name starts with this prefix is baked into\n * the client `define` as `\"process.env.NAME\": JSON.stringify(value)`, so `process.env.PUBLIC_API_URL`\n * compiles to its literal value in the browser. Vars WITHOUT the prefix are never exposed - the bare\n * `process.env` define resolves them to `undefined`, so server secrets can't leak into the client\n * bundle. Set to `\"\"` to disable auto-exposure entirely (no var is baked in). `options.define` still\n * wins over an auto-exposed var (it's layered last). Sourced from `Bun.env` (falls back to\n * `process.env`) at build time. */\n readonly publicEnvPrefix?: string;\n /**\n * Reviewed false positives of the secret scan, which fails the build when a bundle, source map or\n * `public/` file carries what looks like a credential or the value of a non-public environment\n * variable. Each names its rule, its file (or, for an environment value, its variable) and a reason.\n */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Move copy tables (`@nifrajs/i18n/copy`) into one chunk per locale, so a page's JavaScript carries\n * only the copy of the locale it renders in (default: on when minifying). The server bundle keeps\n * every table whole; the server entry passes the manifest's `copyChunks` to `createWebApp`.\n */\n readonly copySplit?: boolean;\n /**\n * The server runs `createWebApp({ live })`: the client entry sends route loads through its live load\n * endpoint and keeps what is on screen fresh: the runtime's `clientEntry`.\n */\n readonly live?: LiveClientEntry | undefined;\n}"
2274
2289
  },
2275
2290
  {
2276
2291
  "name": "BuildClientViteOptions",
@@ -2326,7 +2341,7 @@
2326
2341
  "name": "BuildTargetOptions",
2327
2342
  "kind": "interface",
2328
2343
  "package": "@nifrajs/web",
2329
- "signature": "export interface BuildTargetOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the assembled deploy dir (absolute path). Cleared and recreated, so the\n * build refuses one that is a filesystem root or is or contains the routes directory, the public\n * directory, an absolute entry module, or the working directory. */\n readonly outDir: string;\n /** A scratch directory for intermediate codegen (the generated server entry + manifest) and the\n * server bundle, cleaned up after. Absolute path. Checked the same way as `outDir`. */\n readonly workDir: string;\n /** The adapter's client runtime module (exports `mountRouter`), e.g. `\"@nifrajs/web-react/client\"`. */\n readonly clientModule: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `adapter`. */\n readonly adapterImport: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `backend`, or `undefined`. */\n readonly backendImport?: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `use` (app-level middleware\n * applied before page routes are declared), or `undefined`. Must resolve to the same edge-safe\n * module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options the server entry imports by name (`apiPrefix`, `mounts`, `csp`, ...), each\n * mapped to the specifier (resolvable from `workDir`) of the same edge-safe module as `adapterImport`. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Factory that builds the app for `static` prerendering, GIVEN the client build's manifest - so the\n * emitted hydration `<script src>` uses the REAL content-hashed entry (`client.entry`) plus the same\n * styles/route-preload the server targets use. A pre-built instance can't work here: the hash isn't known\n * until `buildClient` runs inside `buildTarget`, so a hardcoded entry 404s → pages render but never\n * hydrate. Required for `target: \"static\"` (SSG drives `app.fetch`). For `bun` and `node` it is\n * optional: given, the opted-in routes are prerendered into `_prerendered/` and the server answers\n * them from their file; the other targets ignore it. */\n readonly prerenderApp?: (client: BuildManifest) => PrerenderAppLike | Promise<PrerenderAppLike>;\n /** Client-build plugins (e.g. the MDX/Vue/Solid Bun plugins). */\n readonly clientPlugins?: readonly BunPlugin[];\n /** Server-build plugins (e.g. the SSR variants). */\n readonly serverPlugins?: readonly BunPlugin[];\n /** Extra Bun.build resolve conditions for the CLIENT build. */\n readonly conditions?: readonly string[];\n /** Compile-time `define` replacements layered onto both builds. */\n readonly define?: Readonly<Record<string, string>>;\n /** Project-root static directory copied to deploy root. `false` disables it. */\n readonly publicDir?: string | false;\n /** Prefix of environment variables allowed into the client bundle (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Reviewed false positives of the secret scan over the bundle, `public/` and prerendered pages. */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Vite-only CSS output policy. `false` emits one aggregate stylesheet. The native Bun build does not\n * support this switch and fails closed if it is supplied instead of silently ignoring it.\n */\n readonly cssCodeSplit?: boolean;\n /**\n * Activation policy for framework-owned SSR stylesheet links. Defaults to `\"blocking\"`; `\"deferred\"`\n * fetches with `media=\"print\"` and promotes before hydration. With Vite, pair it with\n * `cssCodeSplit: false`; the native Bun build supports the activation policy but keeps its existing\n * CSS output strategy.\n */\n readonly cssLoading?: CssLoadingMode;\n /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n /** Trust the edge platform's client-address header for `c.clientIp` (`cloudflare`, `vercel`). Off by\n * default, leaving an edge app with no caller address. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n}"
2344
+ "signature": "export interface BuildTargetOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** Output directory for the assembled deploy dir (absolute path). Cleared and recreated, so the\n * build refuses one that is a filesystem root or is or contains the routes directory, the public\n * directory, an absolute entry module, or the working directory. */\n readonly outDir: string;\n /** A scratch directory for intermediate codegen (the generated server entry + manifest) and the\n * server bundle, cleaned up after. Absolute path. Checked the same way as `outDir`. */\n readonly workDir: string;\n /** The adapter's client runtime module (exports `mountRouter`), e.g. `\"@nifrajs/web-react/client\"`. */\n readonly clientModule: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `adapter`. */\n readonly adapterImport: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `backend`, or `undefined`. */\n readonly backendImport?: string;\n /** Import specifier (resolvable from `workDir`) of the module exporting `use` (app-level middleware\n * applied before page routes are declared), or `undefined`. Must resolve to the same edge-safe\n * module as `adapterImport`. */\n readonly useImport?: string;\n /** `createWebApp` options the server entry imports by name (`apiPrefix`, `mounts`, `csp`, ...), each\n * mapped to the specifier (resolvable from `workDir`) of the same edge-safe module as `adapterImport`. */\n readonly optionImports?: ServerEntryOptionImports;\n /** Factory that builds the app for `static` prerendering, GIVEN the client build's manifest - so the\n * emitted hydration `<script src>` uses the REAL content-hashed entry (`client.entry`) plus the same\n * styles/route-preload the server targets use. A pre-built instance can't work here: the hash isn't known\n * until `buildClient` runs inside `buildTarget`, so a hardcoded entry 404s → pages render but never\n * hydrate. Required for `target: \"static\"` (SSG drives `app.fetch`). For `bun` and `node` it is\n * optional: given, the opted-in routes are prerendered into `_prerendered/` and the server answers\n * them from their file; the other targets ignore it. */\n readonly prerenderApp?: (client: BuildManifest) => PrerenderAppLike | Promise<PrerenderAppLike>;\n /** Client-build plugins (e.g. the MDX/Vue/Solid Bun plugins). */\n readonly clientPlugins?: readonly BunPlugin[];\n /** Server-build plugins (e.g. the SSR variants). */\n readonly serverPlugins?: readonly BunPlugin[];\n /** Extra Bun.build resolve conditions for the CLIENT build. */\n readonly conditions?: readonly string[];\n /** Compile-time `define` replacements layered onto both builds. */\n readonly define?: Readonly<Record<string, string>>;\n /** Project-root static directory copied to deploy root. `false` disables it. */\n readonly publicDir?: string | false;\n /** Prefix of environment variables allowed into the client bundle (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n /** Reviewed false positives of the secret scan over the bundle, `public/` and prerendered pages. */\n readonly secretExemptions?: readonly SecretExemption[];\n /**\n * Vite-only CSS output policy. `false` emits one aggregate stylesheet. The native Bun build does not\n * support this switch and fails closed if it is supplied instead of silently ignoring it.\n */\n readonly cssCodeSplit?: boolean;\n /**\n * Activation policy for framework-owned SSR stylesheet links. Defaults to `\"blocking\"`; `\"deferred\"`\n * fetches with `media=\"print\"` and promotes before hydration. With Vite, pair it with\n * `cssCodeSplit: false`; the native Bun build supports the activation policy but keeps its existing\n * CSS output strategy.\n */\n readonly cssLoading?: CssLoadingMode;\n /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n /** Trust the edge platform's client-address header for `c.clientIp` (`cloudflare`, `vercel`). Off by\n * default, leaving an edge app with no caller address. See {@link ServerEntryClientIp}. */\n readonly clientIp?: ServerEntryClientIp;\n /** The client entry for a server built with `optionImports.live`: that runtime's `clientEntry`. */\n readonly live?: LiveClientEntry | undefined;\n}"
2330
2345
  },
2331
2346
  {
2332
2347
  "name": "BuildTargetPlan",
@@ -2341,11 +2356,17 @@
2341
2356
  "signature": "export interface BuildTargetResult {\n /** The deploy target that was built. */\n readonly target: BuildTarget;\n /** The assembled output directory. */\n readonly outDir: string;\n /** The client build's manifest (entry URL, assets, per-route chunks/styles). */\n readonly client: BuildManifest;\n /** A human-readable note on how to run/deploy the output. */\n readonly run: string;\n /** Per-chunk size report over the emitted client (+ server) outputs. Always computed; the CLI prints\n * it only with `--report`. */\n readonly size: SizeReport;\n}",
2342
2357
  "doc": "/** The result of a target build - the deploy dir + the client manifest + an optional size report. */"
2343
2358
  },
2359
+ {
2360
+ "name": "BundleReactWidgetOptions",
2361
+ "kind": "interface",
2362
+ "package": "@nifrajs/mcp",
2363
+ "signature": "export interface BundleReactWidgetOptions {\n /** Absolute path to a `.tsx`/`.jsx` module whose DEFAULT export is a React component. It receives the\n * tool's `structuredContent` as props. */\n readonly component: string;\n /** Minify the client bundle (default true). */\n readonly minify?: boolean;\n}"
2364
+ },
2344
2365
  {
2345
2366
  "name": "Bundler",
2346
2367
  "kind": "interface",
2347
2368
  "package": "@nifrajs/web",
2348
- "signature": "export interface Bundler {\n /** Build the client bundle → the shared {@link BuildManifest}. */\n buildClient(input: {\n readonly routesDir: string;\n readonly outDir: string;\n readonly clientModule: string;\n readonly plugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly publicDir?: string | false;\n readonly publicEnvPrefix?: string;\n /** Vite CSS splitting policy; the Bun strategy rejects `false` and otherwise preserves its native behavior. */\n readonly cssCodeSplit?: boolean;\n /** Framework-owned stylesheet activation policy; supported by both server strategies. */\n readonly cssLoading?: CssLoadingMode;\n /** Project root (Vite needs it; the Bun strategy ignores it). */\n readonly root?: string;\n /** Reviewed false positives of the secret scan. */\n readonly secretExemptions?: readonly SecretExemption[];\n }): Promise<BuildManifest>;\n /** Build the server worker → the shared {@link ServerBuild}. */\n buildServer(input: {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly target: \"browser\" | \"node\" | \"bun\";\n /** The client build's aggregate stylesheet URLs to bake into the server manifest. */\n readonly styles?: readonly string[];\n /** The client build's per-route stylesheet map to bake into the server manifest. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** The client build's copy chunk URLs by locale to bake into the server manifest. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** Every file the build emitted, by request path, to bake into the server manifest. */\n readonly buildAssets?: readonly string[];\n readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n /** Modules the zone rules treat as generated: the adapter module the generated entry imports. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n }): Promise<ServerBuild>;\n}",
2369
+ "signature": "export interface Bundler {\n /** Build the client bundle → the shared {@link BuildManifest}. */\n buildClient(input: {\n readonly routesDir: string;\n readonly outDir: string;\n readonly clientModule: string;\n readonly plugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly publicDir?: string | false;\n readonly publicEnvPrefix?: string;\n /** Vite CSS splitting policy; the Bun strategy rejects `false` and otherwise preserves its native behavior. */\n readonly cssCodeSplit?: boolean;\n /** Framework-owned stylesheet activation policy; supported by both server strategies. */\n readonly cssLoading?: CssLoadingMode;\n /** Project root (Vite needs it; the Bun strategy ignores it). */\n readonly root?: string;\n /** Reviewed false positives of the secret scan. */\n readonly secretExemptions?: readonly SecretExemption[];\n /** The client entry for a live server (`BuildClientOptions.live`). */\n readonly live?: LiveClientEntry | undefined;\n }): Promise<BuildManifest>;\n /** Build the server worker → the shared {@link ServerBuild}. */\n buildServer(input: {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly target: \"browser\" | \"node\" | \"bun\";\n /** The client build's aggregate stylesheet URLs to bake into the server manifest. */\n readonly styles?: readonly string[];\n /** The client build's per-route stylesheet map to bake into the server manifest. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** The client build's copy chunk URLs by locale to bake into the server manifest. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** Every file the build emitted, by request path, to bake into the server manifest. */\n readonly buildAssets?: readonly string[];\n readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n /** Modules the zone rules treat as generated: the adapter module the generated entry imports. */\n readonly generatedFiles?: readonly string[];\n /** The public-env prefix browser code may read (default `\"PUBLIC_\"`). */\n readonly publicEnvPrefix?: string;\n }): Promise<ServerBuild>;\n}",
2349
2370
  "doc": "/**\n * A build-tool STRATEGY for {@link buildTargetWith} - the two bundling steps, and nothing else. Everything\n * around them (server-entry codegen, deploy assembly, prerender, size report) is bundler-agnostic and\n * lives in `buildTargetWith`, so a second bundler (Vite) is this interface, not a second orchestrator.\n *\n * Plugin lists are `readonly unknown[]` because a Bun plugin and a Vite plugin are different types; each\n * strategy casts to its own. `buildTargetWith` only forwards them.\n */"
2350
2371
  },
2351
2372
  {
@@ -2566,7 +2587,7 @@
2566
2587
  "name": "CacheStore",
2567
2588
  "kind": "interface",
2568
2589
  "package": "@nifrajs/web",
2569
- "signature": "export interface CacheStore {\n /** The cached entry for `key`, or `undefined` on a miss. */\n get(key: string): Promise<CachedResponse | undefined>;\n /** Store (or overwrite) the entry for `key`. */\n set(key: string, value: CachedResponse): Promise<void>;\n /** Drop `key` (on-demand revalidation / purge). A no-op if absent. */\n delete(key: string): Promise<void>;\n /** Drop every cached response carrying `tag`, when the backend supports tag invalidation. */\n readonly invalidateTag?: (tag: string) => Promise<void>;\n /**\n * The current point in this store's purge order. `withISR` takes one before each render and hands it\n * back as {@link CachedResponse.fence}, and `set` skips that entry when its key or one of its tags\n * was purged after the point. Without it, a purge that lands while a page renders is undone when the\n * render stores the page it built from data read before the purge.\n */\n readonly fence?: () => number | Promise<number>;\n}",
2590
+ "signature": "export interface CacheStore {\n /** The cached entry for `key`, or `undefined` on a miss. */\n get(key: string): Promise<CachedResponse | undefined>;\n /** Store (or overwrite) the entry for `key`. */\n set(key: string, value: CachedResponse): Promise<void>;\n /** Drop `key` (on-demand revalidation / purge). A no-op if absent. */\n delete(key: string): Promise<void>;\n /** Drop every cached response carrying `tag`, when the backend supports tag invalidation. */\n readonly invalidateTag?: (tag: string) => Promise<void>;\n /**\n * The current point in this store's purge order. `withISR` takes one before each render and hands it\n * back as {@link CachedResponse.fence}, and `set` skips that entry when its key or one of its tags\n * was purged after the point. Without it, a purge that lands while a page renders is undone when the\n * render stores the page it built from data read before the purge. A store whose purges reach other\n * instances late must also check on read, as {@link KVCacheStore} does: `set` there cannot see a\n * purge that has not arrived yet.\n */\n readonly fence?: () => number | Promise<number>;\n}",
2570
2591
  "doc": "/**\n * Pluggable ISR cache backend. **Production deploys MUST use a shared/durable store** (Workers KV,\n * Redis, the platform Cache API) so cached pages *and* revalidation hold across instances;\n * {@link MemoryCacheStore} is dev / single-instance only. Implementations are async so a network store\n * (KV/Redis) fits the same interface.\n */"
2571
2592
  },
2572
2593
  {
@@ -2609,6 +2630,13 @@
2609
2630
  "signature": "export interface CachedResponse {\n /** The rendered document (UTF-8 HTML, fully buffered). */\n readonly body: string;\n readonly status: number;\n /** Response headers to replay (e.g. `content-type`). */\n readonly headers: Readonly<Record<string, string>>;\n /** When this entry was stored, via the injected clock (ms epoch). */\n readonly storedAt: number;\n /** Freshness window (ms): `now - storedAt >= revalidate` ⇒ stale (serve it, regenerate behind it). */\n readonly revalidate: number;\n /** Public, bounded invalidation labels. A tag purge makes matching entries miss immediately. */\n readonly tags?: readonly string[];\n /** The store's {@link CacheStore.fence} as the render behind this entry began. A store that keeps\n * purge order skips the write when this key or one of its tags was purged after it. */\n readonly fence?: number | undefined;\n}",
2610
2631
  "doc": "/** A cached SSR response - the bytes + metadata a {@link CacheStore} persists. */"
2611
2632
  },
2633
+ {
2634
+ "name": "CanaryCarrier",
2635
+ "kind": "type",
2636
+ "package": "@nifrajs/web",
2637
+ "signature": "export type CanaryCarrier = \"cookie\" | \"authorization\" | \"header\" | \"query\";",
2638
+ "doc": "/** Where a canary value went into the request whose shell carried it. */"
2639
+ },
2612
2640
  {
2613
2641
  "name": "CapabilityAccess",
2614
2642
  "kind": "type",
@@ -3291,6 +3319,12 @@
3291
3319
  "package": "@nifrajs/cli",
3292
3320
  "signature": "export interface CheckRule {\n readonly code: string;\n readonly title: string;\n scan(ctx: RuleContext): Promise<readonly Diagnostic[]>;\n}"
3293
3321
  },
3322
+ {
3323
+ "name": "ChildProcessEnvInput",
3324
+ "kind": "interface",
3325
+ "package": "@nifrajs/agent-protocol",
3326
+ "signature": "export interface ChildProcessEnvInput {\n /** The host's environment, usually `process.env`. */\n readonly env: Readonly<Record<string, string | undefined>>;\n /** The host's platform, usually `process.platform`. */\n readonly platform: string;\n /** Names read from `env` besides the base set. */\n readonly names?: readonly string[];\n /** Values that win over `env`. A name set to `undefined` here is left out. */\n readonly values?: Readonly<Record<string, string | undefined>> | undefined;\n}"
3327
+ },
3294
3328
  {
3295
3329
  "name": "ChildVectorTracker",
3296
3330
  "kind": "class",
@@ -3323,6 +3357,13 @@
3323
3357
  "package": "@nifrajs/core",
3324
3358
  "signature": "export type ClassifiedSchema<S extends object> = S & {\n readonly [CLASSIFICATION]: DataClassification;\n};"
3325
3359
  },
3360
+ {
3361
+ "name": "CliToolContract",
3362
+ "kind": "type",
3363
+ "package": "@nifrajs/core",
3364
+ "signature": "export type CliToolContract = ToolContract<any, any>;",
3365
+ "doc": "/** A heterogeneous tool list. Each contract still validates its own input at execution. */"
3366
+ },
3326
3367
  {
3327
3368
  "name": "ClientAction",
3328
3369
  "kind": "type",
@@ -3388,14 +3429,14 @@
3388
3429
  "name": "ClientRouteHooks",
3389
3430
  "kind": "interface",
3390
3431
  "package": "@nifrajs/web",
3391
- "signature": "export interface ClientRouteHooks {\n readonly clientLoader?: ClientLoader;\n readonly clientAction?: ClientAction;\n /** Neutral boundary descriptors needed for soft-navigation interception. A boundary's loader lives in\n * the route's backend half, so the browser never learns whether one exists. */\n readonly boundaries?: ReadonlyArray<Omit<BoundaryDescriptor, \"hasLoad\">>;\n}",
3432
+ "signature": "export interface ClientRouteHooks {\n readonly clientLoader?: ClientLoader;\n readonly clientAction?: ClientAction;\n /** The page's `shareData` export: `false` gives every reload of it fresh data. */\n readonly shareData?: boolean;\n /** The page's `keepAlive` export: the page stays mounted after a visitor leaves it. */\n readonly keepAlive?: true | KeepAliveOptions;\n /** Neutral boundary descriptors needed for soft-navigation interception. A boundary's loader lives in\n * the route's backend half, so the browser never learns whether one exists. */\n readonly boundaries?: ReadonlyArray<Omit<BoundaryDescriptor, \"hasLoad\">>;\n}",
3392
3433
  "doc": "/** Client hooks populated by the generated route entry after a route chunk loads. */"
3393
3434
  },
3394
3435
  {
3395
3436
  "name": "ClientRouter",
3396
3437
  "kind": "interface",
3397
3438
  "package": "@nifrajs/web",
3398
- "signature": "export interface ClientRouter {\n /** Current state; stable reference between transitions (so `useSyncExternalStore` can bail). */\n snapshot: () => RouterState;\n /** Subscribe to transitions; returns an unsubscribe fn. */\n subscribe: (listener: () => void) => () => void;\n /**\n * Navigate to a path: match → fetch loader data → publish. No-op for an unmatched path. A loader\n * redirect to another route is followed; one that leaves the app (another origin, a `#fragment`, no\n * route) rejects with its target as `redirectTo`.\n */\n navigate: (path: string) => Promise<void>;\n /**\n * Submit an action (POST `body` to `action` in data mode): a redirect becomes a client\n * navigation; otherwise the data return is published as `actionData` and the active route's\n * loader is revalidated so the mutation is reflected. Pass `{ revalidate: false }` to SKIP that\n * revalidation - keep the current `data` and just publish the action's `actionData` (useful when\n * the action already returned everything that changed, saving the extra round-trip). A redirect\n * always loads its target regardless. Rejects on failure (caller falls back); once the server has\n * answered, at any status, the rejection's `redirectTo` names the page to load instead of posting\n * again.\n */\n submit: (action: string, body: NonNullable<RequestInit[\"body\"]>, opts?: SubmitOptions) => Promise<void>;\n /** Run the initial route's client loader after the adapter has hydrated the SSR markup. */\n hydrate: () => Promise<void>;\n /**\n * Mark cached route data stale and refresh the active view. With `paths`, target exactly those\n * (e.g. the routes a mutation changed); without, invalidate the whole cache. The active route\n * refreshes immediately - refetched + republished - whenever it's in scope (an explicit list that\n * includes it, or an invalidate-all); other stale entries refetch lazily when next read (a\n * fetcher, or the next navigation/access). Rejects if the active refetch fails (like `navigate`).\n * The keyed substrate for targeted revalidation (the `X-Nifra-Revalidate` header) and fetchers.\n */\n invalidate: (paths?: readonly string[]) => Promise<void>;\n /**\n * Warm a path's chunk + loader data into a bounded one-shot cache without publishing state -\n * a later `navigate` to it transitions with no network round-trip. Best-effort: failures and\n * unmatched paths are no-ops. Wired to link hover/focus by `installHistory`.\n */\n prefetch: (path: string) => Promise<void>;\n /**\n * Get (lazily creating) the stable {@link Fetcher} for `key` - an independent, concurrent\n * load/submit state machine for row-level mutations or side-channel loads that must not disturb\n * the active view. The same `key` always returns the same fetcher (so a binding can subscribe to a\n * stable store). Keys are app-chosen and typically stable (e.g. a row id).\n */\n fetcher: (key: string) => Fetcher;\n /** All live fetchers - for a global busy view (e.g. a `useFetchers` binding). */\n fetchers: () => readonly Fetcher[];\n /** Subscribe to any-fetcher-changed (a transition on any fetcher, or a new one created) - backs a\n * `useFetchers` binding; returns an unsubscribe fn. */\n subscribeFetchers: (listener: () => void) => () => void;\n /** Match a path against the manifest patterns (exposed for history/link wiring). */\n match: (path: string) => RouteMatch | null;\n}",
3439
+ "signature": "export interface ClientRouter {\n /** Current state; stable reference between transitions (so `useSyncExternalStore` can bail). */\n snapshot: () => RouterState;\n /** Subscribe to transitions; returns an unsubscribe fn. */\n subscribe: (listener: () => void) => () => void;\n /**\n * Navigate to a path: match → fetch loader data → publish. No-op for an unmatched path. A loader\n * redirect to another route is followed; one that leaves the app (another origin, a `#fragment`, no\n * route) rejects with its target as `redirectTo`.\n */\n navigate: (path: string) => Promise<void>;\n /**\n * Submit an action (POST `body` to `action` in data mode): a redirect becomes a client\n * navigation; otherwise the data return is published as `actionData` and the active route's\n * loader is revalidated so the mutation is reflected. Pass `{ revalidate: false }` to SKIP that\n * revalidation - keep the current `data` and just publish the action's `actionData` (useful when\n * the action already returned everything that changed, saving the extra round-trip). A redirect\n * always loads its target regardless. Rejects on failure (caller falls back); once the server has\n * answered, at any status, the rejection's `redirectTo` names the page to load instead of posting\n * again. A revalidation answered with a terminal status renders that status route in the page's\n * place.\n */\n submit: (action: string, body: NonNullable<RequestInit[\"body\"]>, opts?: SubmitOptions) => Promise<void>;\n /** Run the initial route's client loader after the adapter has hydrated the SSR markup. */\n hydrate: () => Promise<void>;\n /**\n * Mark cached route data stale and refresh the active view. With `paths`, target exactly those\n * (e.g. the routes a mutation changed); without, invalidate the whole cache. The active route\n * refreshes immediately - refetched + republished - whenever it's in scope (an explicit list that\n * includes it, or an invalidate-all); other stale entries refetch lazily when next read (a\n * fetcher, or the next navigation/access). Rejects if the active refetch fails (like `navigate`).\n * A refetch answered with a terminal status renders that status route in the page's place; one\n * whose status page renders inside layouts rejects, so the caller can load the page as a document.\n * The keyed substrate for targeted revalidation (the `X-Nifra-Revalidate` header) and fetchers.\n */\n invalidate: (paths?: readonly string[]) => Promise<void>;\n /**\n * Warm a path's chunk + loader data into a bounded one-shot cache without publishing state -\n * a later `navigate` to it transitions with no network round-trip. Best-effort: failures and\n * unmatched paths are no-ops. Wired to link hover/focus by `installHistory`.\n */\n prefetch: (path: string) => Promise<void>;\n /**\n * Get (lazily creating) the stable {@link Fetcher} for `key` - an independent, concurrent\n * load/submit state machine for row-level mutations or side-channel loads that must not disturb\n * the active view. The same `key` always returns the same fetcher (so a binding can subscribe to a\n * stable store). Keys are app-chosen and typically stable (e.g. a row id).\n */\n fetcher: (key: string) => Fetcher;\n /** All live fetchers - for a global busy view (e.g. a `useFetchers` binding). */\n fetchers: () => readonly Fetcher[];\n /** Subscribe to any-fetcher-changed (a transition on any fetcher, or a new one created) - backs a\n * `useFetchers` binding; returns an unsubscribe fn. */\n subscribeFetchers: (listener: () => void) => () => void;\n /** Match a path against the manifest patterns (exposed for history/link wiring). */\n match: (path: string) => RouteMatch | null;\n}",
3399
3440
  "doc": "/** The agnostic router store consumed by per-adapter Router bindings. */"
3400
3441
  },
3401
3442
  {
@@ -3549,7 +3590,7 @@
3549
3590
  "name": "CompileOptions",
3550
3591
  "kind": "interface",
3551
3592
  "package": "@nifrajs/coding-agent",
3552
- "signature": "export interface CompileOptions {\n readonly catalog: StepCatalog;\n readonly planDigest: string;\n readonly artifactPort: ArtifactPort;\n readonly limits?: OrchestrationLimits;\n /** Called once a node's content-free effect key is derived (idempotent steps only). */\n onNodeEffect?(nodeId: string, key: NodeEffectKey): void;\n /** Called for each artifact ref a node produces through its port. */\n collectArtifact?(nodeId: string, ref: ArtifactRef): void;\n /** Called when a subagent node's run returns while its executor, which ignored the abort, keeps running. */\n onSubagentAbandoned?(nodeId: string, abandonment: SubagentAbandonment): void;\n /** Where abandoned subagent executors are counted for `maxAbandonedSubagents`. Default: one per compile. */\n readonly subagentAbandonment?: SubagentAbandonmentLedger;\n}",
3593
+ "signature": "export interface CompileOptions {\n readonly catalog: StepCatalog;\n readonly planDigest: string;\n readonly artifactPort: ArtifactPort;\n readonly limits?: OrchestrationLimits;\n /** Called once a node's content-free effect key is derived (idempotent steps only). */\n onNodeEffect?(nodeId: string, key: NodeEffectKey): void;\n /** Called for each artifact ref a node produces through its port. */\n collectArtifact?(nodeId: string, ref: ArtifactRef): void;\n /** Called when a subagent node's run returns while its executor, which ignored the abort, keeps running. */\n onSubagentAbandoned?(nodeId: string, abandonment: SubagentAbandonment): void;\n /** Where abandoned subagent executors are counted for `maxAbandonedSubagents`. Default: one per compile. */\n readonly subagentAbandonment?: SubagentAbandonmentLedger;\n /** Where started subagents are counted for `maxChildren`. Default: one per compile. */\n readonly subagentChildren?: SubagentChildLedger;\n}",
3553
3594
  "doc": "/** Wiring the compiler injects into every node closure. */"
3554
3595
  },
3555
3596
  {
@@ -3558,6 +3599,12 @@
3558
3599
  "package": "@nifrajs/schema",
3559
3600
  "signature": "export interface CompileSchemaOptions {\n /** Type-only import of the source schema, relative to the generated module. */\n readonly source: string;\n readonly exportName: string;\n}"
3560
3601
  },
3602
+ {
3603
+ "name": "CompileShellsOptions",
3604
+ "kind": "interface",
3605
+ "package": "@nifrajs/web",
3606
+ "signature": "export interface CompileShellsOptions {\n readonly routesDir: string;\n readonly manifest: Manifest;\n /** The deployment the record is for: the server refuses a record made for another one. */\n readonly deployment: string;\n /** True for a module (absolute path, `/` separators) whose code reads the visitor's request. */\n readonly requestScoped: (moduleId: string) => boolean;\n /** Called for each route that fails; the route is left out of the record. Default: rethrow. */\n readonly onFailure?: (routeId: string, error: unknown) => void;\n /** Bun plugins the server build uses for route files, such as `svelteBunPlugin(\"ssr\")`. */\n readonly plugins?: readonly import(\"bun\").BunPlugin[];\n}"
3607
+ },
3561
3608
  {
3562
3609
  "name": "CompiledComponentModule",
3563
3610
  "kind": "interface",
@@ -3587,7 +3634,7 @@
3587
3634
  "name": "ComponentController",
3588
3635
  "kind": "class",
3589
3636
  "package": "@nifrajs/web",
3590
- "signature": "export declare class ComponentController {\n #private;\n get state(): ComponentState;\n reportError(code: string): void;\n constructor(options: ComponentControllerOptions);\n mount(host: Element, instance: string, fresh?: boolean): Promise<void>;\n whenReady(instance: string): Promise<void>;\n refresh(instance: string, ownerUrl?: string): Promise<boolean>;\n /** Abort networking immediately while retaining the tree until verified navigation arrives. */\n cancelPending(): void;\n adopt(state: ComponentState, ownerUrl?: string): Promise<void>;\n unmount(instance: string): Promise<void>;\n invalidateScope(): Promise<void>;\n navigate(): Promise<void>;\n dispose(): Promise<void>;\n}"
3637
+ "signature": "export declare class ComponentController {\n #private;\n get state(): ComponentState;\n reportError(code: string): void;\n constructor(options: ComponentControllerOptions);\n mount(host: Element, instance: string, fresh?: boolean): Promise<void>;\n whenReady(instance: string): Promise<void>;\n refresh(instance: string, ownerUrl?: string): Promise<boolean>;\n /** Abort networking immediately while retaining the tree until verified navigation arrives. */\n cancelPending(): void;\n /**\n * Set aside the components inside `page`, a `keepAlive` page the router hides: their pending work is\n * cancelled, and navigation neither updates nor unmounts them until `unpark` takes them back.\n * `bindComponentRouter` calls it on the page events.\n */\n park(page: Node): void;\n /** Take back the components `park` set aside inside `page`, which is shown again. */\n unpark(page: Node): void;\n /**\n * Whether `instance` at `host` is parked with its hidden page. An outlet whose framework cleans up a\n * hidden page's effects (React's `<Activity>`) leaves it parked: the page takes it back when shown\n * again, and releases it when dropped.\n */\n isParked(instance: string, host: Element): boolean;\n adopt(state: ComponentState, ownerUrl?: string): Promise<void>;\n /** Unmount `instance`; an outlet passes its `host`, which tells a parked page's instance apart. */\n unmount(instance: string, host?: Element): Promise<void>;\n invalidateScope(): Promise<void>;\n navigate(): Promise<void>;\n dispose(): Promise<void>;\n}"
3591
3638
  },
3592
3639
  {
3593
3640
  "name": "ComponentControllerOptions",
@@ -3676,7 +3723,7 @@
3676
3723
  {
3677
3724
  "name": "Computed",
3678
3725
  "kind": "type",
3679
- "package": "@nifrajs/islets",
3726
+ "package": "@nifrajs/web",
3680
3727
  "signature": "export type Computed<T> = {\n (): T;\n dispose(): void;\n};",
3681
3728
  "doc": "/** A derived value: call it to read (tracking), `.dispose()` to stop recomputing it. */"
3682
3729
  },
@@ -4242,7 +4289,7 @@
4242
4289
  "name": "CreateWebAppOptions",
4243
4290
  "kind": "interface",
4244
4291
  "package": "@nifrajs/web",
4245
- "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** Cache production module imports and layout preparation, never request data. Defaults to NODE_ENV === \"production\"; disable for a mutable manifest. */\n readonly cacheRouteModules?: boolean;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. The resolver does not declare a CSP header because the\n * policy's allowed sources are app-specific.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /**\n * Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and\n * the rest of {@link ServerOptions}.\n *\n * Needed because the `Server` is constructed in here, so a caller has no other way to reach its\n * constructor: a page app could set no request timeout and no capacity gate, which are exactly the\n * two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -\n * a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that\n * exhausts the pod.\n *\n * Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate\n * sits at the fetch entry, ahead of the request hooks those are dispatched from.\n */\n readonly server?: ServerOptions;\n /**\n * Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,\n * `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.\n *\n * ```ts\n * createWebApp({\n * …,\n * use: (app) => {\n * app.use(securityHeaders())\n * app.use(requestId())\n * },\n * })\n * ```\n *\n * A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,\n * `ContextPlugin` - and only the real call site instantiates the right overload. The return value\n * is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the\n * returned app, where they get their types).\n *\n * **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and\n * `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every\n * page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards would\n * bind them to no page, and outside production it throws (`HOOK_AFTER_PAGES`). `requestId()` is\n * exactly that case: it is a `derive`, so applied late it would leave every page without\n * `c.requestId`. A `group()` is its own scope and stays allowed. Route assurance evidence is order-scoped the same\n * way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`\n * even though it does still set it.\n *\n * `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at\n * request time, so those alone DO work when added late. Using this seam for everything avoids\n * having to remember which is which.\n *\n * Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards\n * a mounted auth handler too.\n *\n * A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of\n * this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are\n * idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the\n * plugin a second time.\n */\n readonly use?: (app: ReturnType<typeof server<Env>>) => void;\n /** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed\n * per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.\n *\n * **Auto-mount.** Every `inProcessClient(backend)` exposes the symbol-keyed platform-aware backend\n * mount interface from `@nifrajs/core/mount`; given an {@link apiPrefix}, `createWebApp` also serves\n * that backend over HTTP there: a request whose pathname starts with the prefix is dispatched before\n * page routing with the same `env`/`waitUntil` platform context, and the backend's `Response` is\n * returned untouched. The mount runs in `nifra dev` too. Without `apiPrefix` the backend is\n * loader-only.\n *\n * **Request-scoped loader calls.** While a page renders, its loaders, actions and boundaries get a\n * `ctx.api` bound to that request's platform identity: a backend handler reached through it sees the\n * visitor's `c.clientIp` (derived under this app's `server.clientIp` trust declaration), `c.env` and\n * `c.waitUntil`, so a per-caller rate limit or audit field keys on the real visitor. `c.clientIp` is\n * the supported way to read the caller - identity travels in the platform, so rebuilding a `Request`\n * does not lose it. Headers do NOT travel: the page request's `cookie` and `authorization` are never\n * copied, so a loader call is anonymous unless the loader passes headers on the call itself. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is mounted at, such as `\"/api\"`. A request whose\n * pathname is exactly the prefix or starts with `prefix + \"/\"` is dispatched to the backend before\n * page routing; the backend therefore defines its routes at the **full** path (`server().post(\"/api/\n * sync\", …)`), matching the in-process `inProcessClient` call sites. Unset or `\"\"`, nothing is\n * mounted: the app serves pages only and `api` stays a loader-only `ctx.api`. Mounting is also a\n * no-op when `api` does not expose the symbol mount.\n *\n * A page file under the prefix (`routes/api/report.tsx`) could never render - the backend answers\n * first and its 404 is final - so `createWebApp` throws, naming the file. The same holds for every\n * other pre-route mount. */\n readonly apiPrefix?: string;\n /**\n * Strip {@link apiPrefix} from the pathname before dispatching to `api` (default `false`).\n *\n * The default suits a backend that declares FULL paths (`server().post(\"/api/sync\", …)`), which is\n * right when it is only ever mounted here. Set this when the backend declares its routes WITHOUT the\n * prefix because it also runs standalone behind its own shell, so its paths cannot carry a prefix that\n * only exists when it is mounted. Without it every request 404s inside the backend, and the workaround\n * is a `Proxy` that rewrites each URL.\n */\n readonly apiStrip?: boolean;\n /**\n * Sub-apps mounted ahead of page routing - an auth handler, a webhook receiver, a stack's routes.\n *\n * Structural on purpose: anything with `{ path, app: { fetch } }` fits, so a library that exposes its\n * routes as such a list mounts as `mounts: theirRoutes` without `@nifrajs/web` taking a dependency on\n * it. `better-auth` is the motivating case - it is not a `backend` route, so `/api/auth/*` used to 404\n * silently.\n *\n * Tried longest-path-first and BEFORE the `api` mount, so a mount at `/api/auth` wins over a backend\n * at `/api` no matter which was declared first. `stripPrefix` is the per-mount form of {@link apiStrip}:\n * leave it off to pass the full path through. `opaque` states why a mount whose routes nifra cannot\n * read (better-auth's handler) is outside assurance; it is then listed as a known gap, with any\n * routes it declares reported as declared.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: MountableApp<Env>;\n readonly stripPrefix?: boolean;\n readonly priority?: number;\n readonly fallbackOn?: 404;\n readonly opaque?: MountOptions<Env>[\"opaque\"];\n }>;\n /** Secret for **draft / preview mode** (see `enableDraft`). When set, a request carrying a valid\n * signed `__nifra_draft` cookie gets `ctx.draft === true` in loaders/actions (else always `false`).\n * Pair with `withISR({ draftSecret })` so editors bypass the cache. Omit to disable draft mode. */\n readonly draftSecret?: string;\n /** Per-route chunk URLs (`buildClient`'s `BuildManifest.routes`) - `routeId → [layout chunks…, own\n * chunk]`. When present, each page `modulepreload`s its matched route's chunks alongside the entry,\n * so the route code downloads in parallel (no entry→route-chunk waterfall). Omit ⇒ entry-only. */\n readonly routePreload?: Readonly<Record<string, readonly string[]>>;\n /** The app's bundled stylesheet URLs (`buildClient`'s `BuildManifest.css`) - the aggregate, injected\n * as `<link rel=\"stylesheet\">` in a page's `<head>`. Used as the fallback for any route absent from\n * {@link routeStyles}. Omit ⇒ no links (dev, where Vite injects CSS, or a CSS-free app). */\n readonly styles?: readonly string[];\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - `routeId → [chain CSS]`.\n * When a matched route has an entry here, only those (its layout chain + own CSS) are linked instead\n * of the aggregate `styles`, so a page ships only the CSS it uses. An empty array ⇒ no `<link>` (the\n * page imports no CSS). Routes absent here fall back to `styles`. Omit ⇒ always use `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`, the server manifest's\n * `copyChunks`). A production client build moves copy tables (`@nifrajs/i18n/copy`) into one chunk per\n * locale; each page lists them for the browser and preloads its own. Omit ⇒ tables keep their values. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /**\n * The app's locale routing, `defineI18nRouting()` from `@nifrajs/i18n/routing`, registered once:\n * export it as `i18n` from `backend/framework.ts`. Every document then takes its locale from the\n * URL: `<html lang dir>` from the registry unless the route's meta sets `lang`, a `Content-Language`\n * header, and the locale each adapter's `useLocale()` and `<I18nProvider>` read. A route under a\n * `[lang]` or `[[lang]]` directory is checked with its `matchSegment()` before any middleware: an\n * unserved locale, or a page missing from it, is a 404, and a non-canonical prefix (`/en/x` when the\n * default is unprefixed) redirects with a 308.\n */\n readonly i18n?: WebAppI18n;\n /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Handed over as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav\n * into a prerendered route fetches its static `_data.json` instead of hitting the worker, unless the\n * target carries a query string, which renders on demand as a hard request does. A set over\n * 4 KB of JSON is served once from `/__nifra/prerendered.json?v=<version>`, cacheable for good, and\n * pages hand over only that URL; `prerenderRoutes` writes the file into a static output. */\n readonly prerenderedPaths?: readonly string[];\n /**\n * Pages a self-hosted build prerendered, answered from their file instead of rendered. `nifra build\n * --target bun|node` wires this from its prerender pass. The page is served from the page route,\n * so `use` middleware and every request hook run first; a request with a query string, a navigation\n * data or component request, or a draft-mode visitor renders on demand as before. Ignored with\n * {@link nonce}, whose documents need a nonce minted for their request.\n */\n readonly prerenderedPages?: PrerenderedPages;\n /**\n * Which pages and files each host serves, from `createHostPolicy()`. Evaluated before everything\n * else the app answers (prerendered pages, mounts, the API, every page) and, in a `nifra build`\n * server entry, before its static files too. A refused path answers the policy's refusal.\n */\n readonly hostPolicy?: HostPolicy;\n /**\n * The files the build emitted, by request path: `buildAssets` from the generated server manifest.\n * A {@link hostPolicy} rule's `buildAssets` token matches exactly these. `nifra dev` serves the\n * client bundle and `public/` ahead of the app, so the app's own check never sees them there.\n */\n readonly buildAssets?: BuildAssetSet;\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** Serve `/llms.txt` and `/llms-full.txt`: the page routes, and the backend routes when the backend\n * is mounted over HTTP at {@link apiPrefix}, with their request and response schemas in the full\n * text. **Off by default**: both are public and unauthenticated, and they list every route, admin\n * and internal ones included. Turn it on for an app whose whole surface you would publish. */\n readonly llmsTxt?: boolean;\n /** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or\n * the build's `prerendered.json`). A route mapped to `\"404\"` rejects any path NOT in\n * `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `\"ssr\"` (the\n * default for unmapped routes) renders unlisted paths on-demand. */\n readonly staticFallbacks?: Readonly<Record<string, \"ssr\" | \"404\">>;\n /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow. A failure a boundary answers is also written to the\n * server's `logger` (under its `errorLogDetail`) whether or not this is set, exactly as an unhandled\n * error is. Observation only; its own throws are swallowed so a faulty reporter can't break\n * rendering. (`beforeLoader` is intentionally omitted - the core HTTP hooks already cover\n * pre-request work.) */\n readonly onLoaderError?: (error: unknown, ctx: {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly route: string;\n }) => void;\n}"
4292
+ "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly serverComponents?: import(\"../server-components/types.js\").ServerComponentRuntime;\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** Cache production module imports and layout preparation, never request data. Defaults to NODE_ENV === \"production\"; disable for a mutable manifest. */\n readonly cacheRouteModules?: boolean;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. The resolver does not declare a CSP header because the\n * policy's allowed sources are app-specific.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`, instead of `nonce`. A document then\n * carries a nonce only when it needs one (it `defer()`s a value, or `meta` names the nonce in\n * `unsafeInlineScript`); every other page is nonce-free, gets the same CSP header on every request,\n * and stays cacheable by `withISR` or a CDN. `meta` still receives a nonce to name.\n */\n readonly csp?: CspPolicy;\n /** Experimental and unstable: features whose API may change in any release. */\n readonly experimental?: {\n /**\n * Partial prerendering, from `partialPrerendering()` in `@nifrajs/web/ppr`. A route whose backend\n * half exports `shellLoader` streams a shell shared by every visitor, then each `dynamic` boundary\n * as it settles. Needs `csp` (hashes), not `nonce`.\n */\n readonly ppr?: PprSetup;\n };\n /**\n * Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and\n * the rest of {@link ServerOptions}.\n *\n * Needed because the `Server` is constructed in here, so a caller has no other way to reach its\n * constructor: a page app could set no request timeout and no capacity gate, which are exactly the\n * two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -\n * a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that\n * exhausts the pod.\n *\n * Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate\n * sits at the fetch entry, ahead of the request hooks those are dispatched from.\n */\n readonly server?: ServerOptions;\n /**\n * Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,\n * `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.\n *\n * ```ts\n * createWebApp({\n * …,\n * use: (app) => {\n * app.use(securityHeaders())\n * app.use(requestId())\n * },\n * })\n * ```\n *\n * A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,\n * `ContextPlugin` - and only the real call site instantiates the right overload. The return value\n * is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the\n * returned app, where they get their types).\n *\n * **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and\n * `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every\n * page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards would\n * bind them to no page, and outside production it throws (`HOOK_AFTER_PAGES`). `requestId()` is\n * exactly that case: it is a `derive`, so applied late it would leave every page without\n * `c.requestId`. A `group()` is its own scope and stays allowed. Route assurance evidence is order-scoped the same\n * way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`\n * even though it does still set it.\n *\n * `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at\n * request time, so those alone DO work when added late. Using this seam for everything avoids\n * having to remember which is which.\n *\n * Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards\n * a mounted auth handler too.\n *\n * A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of\n * this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are\n * idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the\n * plugin a second time.\n */\n readonly use?: (app: ReturnType<typeof server<Env>>) => void;\n /** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed\n * per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.\n *\n * **Auto-mount.** Every `inProcessClient(backend)` exposes the symbol-keyed platform-aware backend\n * mount interface from `@nifrajs/core/mount`; given an {@link apiPrefix}, `createWebApp` also serves\n * that backend over HTTP there: a request whose pathname starts with the prefix is dispatched before\n * page routing with the same `env`/`waitUntil` platform context, and the backend's `Response` is\n * returned untouched. The mount runs in `nifra dev` too. Without `apiPrefix` the backend is\n * loader-only.\n *\n * **Request-scoped loader calls.** While a page renders, its loaders, actions and boundaries get a\n * `ctx.api` bound to that request's platform identity: a backend handler reached through it sees the\n * visitor's `c.clientIp` (derived under this app's `server.clientIp` trust declaration), `c.env` and\n * `c.waitUntil`, so a per-caller rate limit or audit field keys on the real visitor. `c.clientIp` is\n * the supported way to read the caller - identity travels in the platform, so rebuilding a `Request`\n * does not lose it. Headers do NOT travel: the page request's `cookie` and `authorization` are never\n * copied, so a loader call is anonymous unless the loader passes headers on the call itself. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is mounted at, such as `\"/api\"`. A request whose\n * pathname is exactly the prefix or starts with `prefix + \"/\"` is dispatched to the backend before\n * page routing; the backend therefore defines its routes at the **full** path (`server().post(\"/api/\n * sync\", …)`), matching the in-process `inProcessClient` call sites. Unset or `\"\"`, nothing is\n * mounted: the app serves pages only and `api` stays a loader-only `ctx.api`. Mounting is also a\n * no-op when `api` does not expose the symbol mount.\n *\n * A page file under the prefix (`routes/api/report.tsx`) could never render - the backend answers\n * first and its 404 is final - so `createWebApp` throws, naming the file. The same holds for every\n * other pre-route mount. */\n readonly apiPrefix?: string;\n /**\n * Strip {@link apiPrefix} from the pathname before dispatching to `api` (default `false`).\n *\n * The default suits a backend that declares FULL paths (`server().post(\"/api/sync\", …)`), which is\n * right when it is only ever mounted here. Set this when the backend declares its routes WITHOUT the\n * prefix because it also runs standalone behind its own shell, so its paths cannot carry a prefix that\n * only exists when it is mounted. Without it every request 404s inside the backend, and the workaround\n * is a `Proxy` that rewrites each URL.\n */\n readonly apiStrip?: boolean;\n /**\n * Sub-apps mounted ahead of page routing - an auth handler, a webhook receiver, a stack's routes.\n *\n * Structural on purpose: anything with `{ path, app: { fetch } }` fits, so a library that exposes its\n * routes as such a list mounts as `mounts: theirRoutes` without `@nifrajs/web` taking a dependency on\n * it. `better-auth` is the motivating case - it is not a `backend` route, so `/api/auth/*` used to 404\n * silently.\n *\n * Tried longest-path-first and BEFORE the `api` mount, so a mount at `/api/auth` wins over a backend\n * at `/api` no matter which was declared first. `stripPrefix` is the per-mount form of {@link apiStrip}:\n * leave it off to pass the full path through. `opaque` states why a mount whose routes nifra cannot\n * read (better-auth's handler) is outside assurance; it is then listed as a known gap, with any\n * routes it declares reported as declared.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: MountableApp<Env>;\n readonly stripPrefix?: boolean;\n readonly priority?: number;\n readonly fallbackOn?: 404;\n readonly opaque?: MountOptions<Env>[\"opaque\"];\n }>;\n /** Secret for **draft / preview mode** (see `enableDraft`). When set, a request carrying a valid\n * signed `__nifra_draft` cookie gets `ctx.draft === true` in loaders/actions (else always `false`).\n * Pair with `withISR({ draftSecret })` so editors bypass the cache. Omit to disable draft mode. */\n readonly draftSecret?: string;\n /**\n * Live data refresh, from `live()` in `@nifrajs/web/live`. Loaders declare keys with `ctx.live()`;\n * the app answers live loads at the runtime's load endpoint. Omit and nothing live is loaded.\n */\n readonly live?: LiveRuntimeHandle;\n /** Per-route chunk URLs (`buildClient`'s `BuildManifest.routes`) - `routeId → [layout chunks…, own\n * chunk]`. When present, each page `modulepreload`s its matched route's chunks alongside the entry,\n * so the route code downloads in parallel (no entry→route-chunk waterfall). Omit ⇒ entry-only. */\n readonly routePreload?: Readonly<Record<string, readonly string[]>>;\n /** The app's bundled stylesheet URLs (`buildClient`'s `BuildManifest.css`) - the aggregate, injected\n * as `<link rel=\"stylesheet\">` in a page's `<head>`. Used as the fallback for any route absent from\n * {@link routeStyles}. Omit ⇒ no links (dev, where Vite injects CSS, or a CSS-free app). */\n readonly styles?: readonly string[];\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - `routeId → [chain CSS]`.\n * When a matched route has an entry here, only those (its layout chain + own CSS) are linked instead\n * of the aggregate `styles`, so a page ships only the CSS it uses. An empty array ⇒ no `<link>` (the\n * page imports no CSS). Routes absent here fall back to `styles`. Omit ⇒ always use `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`, the server manifest's\n * `copyChunks`). A production client build moves copy tables (`@nifrajs/i18n/copy`) into one chunk per\n * locale; each page lists them for the browser and preloads its own. Omit ⇒ tables keep their values. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /**\n * The app's locale routing, `defineI18nRouting()` from `@nifrajs/i18n/routing`, registered once:\n * export it as `i18n` from `backend/framework.ts`. Every document then takes its locale from the\n * URL: `<html lang dir>` from the registry unless the route's meta sets `lang`, a `Content-Language`\n * header, and the locale each adapter's `useLocale()` and `<I18nProvider>` read. A route under a\n * `[lang]` or `[[lang]]` directory is checked with its `matchSegment()` before any middleware: an\n * unserved locale, or a page missing from it, is a 404, and a non-canonical prefix (`/en/x` when the\n * default is unprefixed) redirects with a 308.\n */\n readonly i18n?: WebAppI18n;\n /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Handed over as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav\n * into a prerendered route fetches its static `_data.json` instead of hitting the worker, unless the\n * target carries a query string, which renders on demand as a hard request does. A set over\n * 4 KB of JSON is served once from `/__nifra/prerendered.json?v=<version>`, cacheable for good, and\n * pages hand over only that URL; `prerenderRoutes` writes the file into a static output. */\n readonly prerenderedPaths?: readonly string[];\n /**\n * Pages a self-hosted build prerendered, answered from their file instead of rendered. `nifra build\n * --target bun|node` wires this from its prerender pass. The page is served from the page route,\n * so `use` middleware and every request hook run first; a request with a query string, a navigation\n * data or component request, or a draft-mode visitor renders on demand as before. Ignored with\n * {@link nonce}, whose documents need a nonce minted for their request.\n */\n readonly prerenderedPages?: PrerenderedPages;\n /**\n * Which pages and files each host serves, from `createHostPolicy()`. Evaluated before everything\n * else the app answers (prerendered pages, mounts, the API, every page) and, in a `nifra build`\n * server entry, before its static files too. A refused path answers the policy's refusal.\n */\n readonly hostPolicy?: HostPolicy;\n /**\n * Which cookies say who is signed in, for an app with a `keepAlive` route. A response that changes\n * or deletes one rotates the readable identity epoch cookie, and every tab drops the pages it kept\n * for the previous visitor. The session cookies of `@nifrajs/auth`, Better Auth and Auth.js count\n * under their default names; name any other in `identityCookies`. Development reports, once per\n * name, an `HttpOnly` cookie that changes and is in neither list (`NIFRA_KEEPALIVE_IDENTITY_COOKIE`).\n */\n readonly keepAlive?: KeepAliveServerOptions;\n /**\n * The files the build emitted, by request path: `buildAssets` from the generated server manifest.\n * A {@link hostPolicy} rule's `buildAssets` token matches exactly these. `nifra dev` serves the\n * client bundle and `public/` ahead of the app, so the app's own check never sees them there.\n */\n readonly buildAssets?: BuildAssetSet;\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** Serve `/llms.txt` and `/llms-full.txt`: the page routes, and the backend routes when the backend\n * is mounted over HTTP at {@link apiPrefix}, with their request and response schemas in the full\n * text. **Off by default**: both are public and unauthenticated, and they list every route, admin\n * and internal ones included. Turn it on for an app whose whole surface you would publish. */\n readonly llmsTxt?: boolean;\n /** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or\n * the build's `prerendered.json`). A route mapped to `\"404\"` rejects any path NOT in\n * `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `\"ssr\"` (the\n * default for unmapped routes) renders unlisted paths on-demand. */\n readonly staticFallbacks?: Readonly<Record<string, \"ssr\" | \"404\">>;\n /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow. A failure a boundary answers is also written to the\n * server's `logger` (under its `errorLogDetail`) whether or not this is set, exactly as an unhandled\n * error is. Observation only; its own throws are swallowed so a faulty reporter can't break\n * rendering. (`beforeLoader` is intentionally omitted - the core HTTP hooks already cover\n * pre-request work.) */\n readonly onLoaderError?: (error: unknown, ctx: {\n readonly request: Request;\n readonly params: Readonly<Record<string, string>>;\n readonly route: string;\n }) => void;\n}"
4246
4293
  },
4247
4294
  {
4248
4295
  "name": "CronError",
@@ -4398,6 +4445,20 @@
4398
4445
  "signature": "export declare const DEFAULT_DEV_PORT = 4321;",
4399
4446
  "doc": "/**\n * The single default port for the dev server (`@nifrajs/web/dev`, `@nifrajs/web/vite`) **and**\n * `nifra start`. Deliberately uncommon: `3000`/`5173`/`8080` collide with whatever else is running\n * (Next, Vite, a stray Node API). `4321` rarely is - and being the *same* constant across `nifra dev`\n * and `nifra start` means a project's URL doesn't change between commands. Override per-run with\n * `--port <n>` or the `PORT` env var. */"
4400
4447
  },
4448
+ {
4449
+ "name": "DEFAULT_HUB_MEMBERSHIPS",
4450
+ "kind": "const",
4451
+ "package": "@nifrajs/web",
4452
+ "signature": "export declare const DEFAULT_HUB_MEMBERSHIPS = 150000;",
4453
+ "doc": "/**\n * About 440 bytes of heap each when no two sockets share a tag, the worst case; far less when they do.\n * 150,000 of them stay near 66 MB, inside the 128 MB a Durable Object's isolate may use.\n */"
4454
+ },
4455
+ {
4456
+ "name": "DEFAULT_HUB_SOCKETS",
4457
+ "kind": "const",
4458
+ "package": "@nifrajs/web",
4459
+ "signature": "export declare const DEFAULT_HUB_SOCKETS = 5000;",
4460
+ "doc": "/** The most sockets one hub was verified to hold, with every publish reaching them all well under 200 ms. */"
4461
+ },
4401
4462
  {
4402
4463
  "name": "DEFAULT_IDEMPOTENCY_HEADER",
4403
4464
  "kind": "const",
@@ -4448,7 +4509,7 @@
4448
4509
  {
4449
4510
  "name": "DETECTABLE_MIME_TYPES",
4450
4511
  "kind": "const",
4451
- "package": "@nifrajs/uploads",
4512
+ "package": "@nifrajs/core",
4452
4513
  "signature": "export declare const DETECTABLE_MIME_TYPES: readonly string[];",
4453
4514
  "doc": "/**\n * Every MIME type {@link detectFileType} can return. An allow-list entry outside this set (and\n * outside a `type/*` wildcard that covers one of them) can never match, so check a configured\n * allow-list against it up front instead of rejecting every upload at request time.\n */"
4454
4515
  },
@@ -4709,6 +4770,13 @@
4709
4770
  "signature": "export type DataScope = RlsScope;",
4710
4771
  "doc": "/** Backward-compatible name for the request scope carried by every data operation. */"
4711
4772
  },
4773
+ {
4774
+ "name": "DataText",
4775
+ "kind": "interface",
4776
+ "package": "@nifrajs/web",
4777
+ "signature": "export interface DataText {\n readonly previous: string | undefined;\n text?: string;\n}",
4778
+ "doc": "/**\n * What the router knows about the response text a path's data on screen was read from. The router's\n * own transport resolves a reload answering that same text to this object itself, and the router keeps\n * the data on screen without parsing it; for any other plain JSON response it records the text in\n * `text`. A response with deferred parts sets neither, and a custom transport may ignore it.\n */"
4779
+ },
4712
4780
  {
4713
4781
  "name": "DbPlan",
4714
4782
  "kind": "interface",
@@ -5448,7 +5516,7 @@
5448
5516
  "name": "DynamicBoundary",
5449
5517
  "kind": "type",
5450
5518
  "package": "@nifrajs/web",
5451
- "signature": "export type DynamicBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: \"dynamic\";\n readonly load?: (ctx: BoundaryRequestCtx) => Data | Promise<Data>;\n};"
5519
+ "signature": "export type DynamicBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: \"dynamic\";\n readonly load?: (ctx: BoundaryRequestCtx) => Data | Promise<Data>;\n /** Experimental, partial prerendering: the hole ships its props and hydrates. Default `false`. */\n readonly interactive?: boolean;\n /** Experimental, partial prerendering: the hole's deadline in milliseconds. Default 5000. */\n readonly timeout?: number;\n};"
5452
5520
  },
5453
5521
  {
5454
5522
  "name": "DynamicBoundaryBatch",
@@ -5483,6 +5551,13 @@
5483
5551
  "package": "@nifrajs/core",
5484
5552
  "signature": "export declare const EMPTY_RESPONSE_CONTROLS: CtxSet;"
5485
5553
  },
5554
+ {
5555
+ "name": "EPOCH_COOKIE",
5556
+ "kind": "const",
5557
+ "package": "@nifrajs/web",
5558
+ "signature": "export declare const EPOCH_COOKIE = \"__Host-nifra-epoch\";",
5559
+ "doc": "/** The readable cookie holding the epoch on an `https:` origin. */"
5560
+ },
5486
5561
  {
5487
5562
  "name": "ETagOptions",
5488
5563
  "kind": "interface",
@@ -5724,7 +5799,7 @@
5724
5799
  "name": "Entry",
5725
5800
  "kind": "interface",
5726
5801
  "package": "@nifrajs/content",
5727
- "signature": "export interface Entry<Frontmatter> {\n /** Identifier (e.g. the filename without extension). */\n readonly slug: string;\n /** Frontmatter, validated + typed by the collection's schema. */\n readonly frontmatter: Frontmatter;\n /** The body rendered to HTML (Markdown → HTML). */\n readonly html: string;\n /** The raw Markdown body, with the frontmatter block stripped. */\n readonly body: string;\n}",
5802
+ "signature": "export interface Entry<Frontmatter> {\n /** Identifier (e.g. the filename without extension). */\n readonly slug: string;\n /** Frontmatter, validated + typed by the collection's schema. */\n readonly frontmatter: Frontmatter;\n /**\n * The body rendered to HTML (Markdown → HTML), unsanitized: raw HTML and `javascript:` links in the\n * Markdown pass through. Render it as-is only for content you author, with\n * `<Content html={trustHtml(entry.html)} />`; run anything contributors or a CMS write through\n * `sanitizeHtml(entry.html, yourSanitizer)` (both from `@nifrajs/web`).\n */\n readonly html: string;\n /** The raw Markdown body, with the frontmatter block stripped. */\n readonly body: string;\n}",
5728
5803
  "doc": "/** A parsed content entry: its slug, validated frontmatter, rendered HTML, and the raw Markdown body. */"
5729
5804
  },
5730
5805
  {
@@ -6004,7 +6079,7 @@
6004
6079
  {
6005
6080
  "name": "FILE_TYPE_PREFIX_BYTES",
6006
6081
  "kind": "const",
6007
- "package": "@nifrajs/uploads",
6082
+ "package": "@nifrajs/core",
6008
6083
  "signature": "export declare const FILE_TYPE_PREFIX_BYTES = 32;",
6009
6084
  "doc": "/**\n * How many leading bytes {@link detectFileType} looks at. Reading this many from the start of a file\n * (`file.slice(0, FILE_TYPE_PREFIX_BYTES)`) is enough for every type it knows: it reaches the first four\n * compatible brands of an ISO-BMFF `ftyp` box, where an AVIF with the generic `mif1` brand says `avif`.\n */"
6010
6085
  },
@@ -6211,8 +6286,8 @@
6211
6286
  "name": "FetchRouteData",
6212
6287
  "kind": "type",
6213
6288
  "package": "@nifrajs/web",
6214
- "signature": "export type FetchRouteData = (path: string, match: RouteMatch, signal?: AbortSignal, navigation?: {\n readonly from: string;\n readonly retain: readonly number[];\n}) => Promise<unknown>;",
6215
- "doc": "/** How a router fetches a route's loader data on navigation. `signal` aborts a superseded fetch\n * (and its deferred stream). */"
6289
+ "signature": "export type FetchRouteData = (path: string, match: RouteMatch, signal?: AbortSignal, navigation?: {\n readonly from: string;\n readonly retain: readonly number[];\n}, purpose?: \"prefetch\", hosts?: readonly string[], read?: DataText) => Promise<unknown>;",
6290
+ "doc": "/** How a router fetches a route's loader data on navigation. `signal` aborts a superseded fetch\n * (and its deferred stream). `purpose` is `\"prefetch\"` when no navigation is waiting on the result.\n * `hosts` names the holes of the page on screen whose hosts reload in place\n * ({@link HOLE_FILL_HEADER}). `read` is the {@link DataText} of the data on screen, which a custom\n * transport may ignore. */"
6216
6291
  },
6217
6292
  {
6218
6293
  "name": "FetchTransportOptions",
@@ -6320,14 +6395,14 @@
6320
6395
  "name": "FileStorage",
6321
6396
  "kind": "class",
6322
6397
  "package": "@nifrajs/storage",
6323
- "signature": "export declare class FileStorage implements StorageAdapter {\n private root;\n private metadataRoot;\n private legacyMetadataRoot;\n private stagingRoot;\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, then renamed over `path`, so a\n * reader never sees a half-written object and a failed write leaves the previous one. The renamed\n * inode is then proven to be the staged one, reachable beneath the same root.\n */\n private writeContained;\n /** A new, exclusively created file in the staging directory holding `data`. */\n private stage;\n /**\n * Create parents and open without truncating. The opened inode is validated against the current,\n * fully resolved path before any caller data is written, closing the check/open symlink race.\n */\n private writeInPlace;\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}"
6398
+ "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}"
6324
6399
  },
6325
6400
  {
6326
6401
  "name": "FileType",
6327
6402
  "kind": "interface",
6328
- "package": "@nifrajs/uploads",
6403
+ "package": "@nifrajs/core",
6329
6404
  "signature": "export interface FileType {\n /** Detected MIME type, e.g. `\"image/png\"`. */\n readonly mime: string;\n /** Canonical extension (no dot), e.g. `\"png\"`. */\n readonly ext: string;\n}",
6330
- "doc": "/**\n * Magic-byte file-type detection - trust the bytes, not the `Content-Type` header (which a client\n * sets freely). Reads only the leading bytes; dependency-free + edge-safe. Covers the common upload\n * types; returns `null` for anything unrecognized (incl. text formats like SVG/CSV that have no magic\n * number - handle those explicitly if you accept them).\n */"
6405
+ "doc": "/**\n * Magic-byte file-type detection - trust the bytes, not the `Content-Type` header (which a client\n * sets freely). Reads only the leading bytes; imports nothing, so it is edge-safe. Covers the common\n * upload types; returns `null` for anything unrecognized (incl. text formats like SVG/CSV that have no\n * magic number - handle those explicitly if you accept them).\n *\n * The shared owner for every type-by-bytes check: `@nifrajs/schema/form`'s `t.file({ accept })` and\n * `@nifrajs/uploads`'s `validateUpload` must give one file one verdict, so both read this module.\n */"
6331
6406
  },
6332
6407
  {
6333
6408
  "name": "FileVersion",
@@ -6450,6 +6525,12 @@
6450
6525
  "package": "@nifrajs/i18n",
6451
6526
  "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}"
6452
6527
  },
6528
+ {
6529
+ "name": "Framework",
6530
+ "kind": "type",
6531
+ "package": "create-nifra",
6532
+ "signature": "export type Framework = (typeof FRAMEWORKS)[number];"
6533
+ },
6453
6534
  {
6454
6535
  "name": "FrameworkError",
6455
6536
  "kind": "class",
@@ -6499,7 +6580,7 @@
6499
6580
  "name": "GenerateClientEntryOptions",
6500
6581
  "kind": "interface",
6501
6582
  "package": "@nifrajs/web",
6502
- "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}"
6583
+ "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}"
6503
6584
  },
6504
6585
  {
6505
6586
  "name": "GenerateRegressionTestOptions",
@@ -6712,6 +6793,107 @@
6712
6793
  "signature": "export declare class Histogram {\n readonly name: string;\n readonly help: string;\n private readonly series;\n private readonly buckets;\n constructor(name: string, help: string, buckets: readonly number[]);\n observe(value: number, labels?: Labels): void;\n render(): string;\n}",
6713
6794
  "doc": "/** Latency-style distribution over fixed buckets (seconds). Renders Prometheus cumulative buckets. */"
6714
6795
  },
6796
+ {
6797
+ "name": "Hole",
6798
+ "kind": "function",
6799
+ "package": "@nifrajs/web-preact",
6800
+ "signature": "export declare function Hole<Data>(props: HoleProps<Data>): ComponentChildren;",
6801
+ "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Preact never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own root from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive root re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6802
+ },
6803
+ {
6804
+ "name": "Hole",
6805
+ "kind": "function",
6806
+ "package": "@nifrajs/web-react",
6807
+ "signature": "export declare function Hole<Data>(props: HoleProps<Data>): ReactNode;",
6808
+ "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host React never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own root from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive root re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6809
+ },
6810
+ {
6811
+ "name": "Hole",
6812
+ "kind": "function",
6813
+ "package": "@nifrajs/web-solid",
6814
+ "signature": "export declare function Hole<Data>(props: HoleProps<Data>): JSX.Element;",
6815
+ "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Solid never fills: the PPR runtime puts the server's\n * HTML into it, and an interactive hole then hydrates as its own root from the frame's props. When the\n * page reloads, after an action or a live change, the same host takes the new fill in place: an\n * interactive root gets the new props through its store and keeps its state. After a client\n * navigation the hole renders like any streamed boundary.\n */"
6816
+ },
6817
+ {
6818
+ "name": "Hole",
6819
+ "kind": "const",
6820
+ "package": "@nifrajs/web-vue",
6821
+ "signature": "export declare const Hole: new <Data>(props: HoleProps<Data> & {} & import(\"vue\").VNodeProps & import(\"vue\").AllowedComponentProps & import(\"vue\").ComponentCustomProps) => import(\"vue\").CreateComponentPublicInstanceWithMixins<HoleProps<Data> & {}, {}, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, import(\"vue\").PublicProps, {}, false, {}, HoleSlots, {}, {}, string, {}, any, import(\"vue\").ComponentProvideOptions, {\n P: {};\n B: {};\n D: {};\n C: {};\n M: {};\n Defaults: {};\n}, HoleProps<Data> & {}, {}, {}, {}, {}, {}>;",
6822
+ "doc": "/**\n * Experimental: one `dynamic` or `shared` boundary of a partially prerendered page.\n *\n * In a shared shell the hole is an empty host Vue never fills or diffs: the PPR runtime puts the\n * server's HTML into it, and an interactive hole then hydrates as its own app from the frame's props.\n * When the page reloads, after an action or a live change, the host takes the new fill in place: an\n * interactive app re-renders with the new props and keeps its state. After a client navigation the\n * hole renders like any streamed boundary.\n */"
6823
+ },
6824
+ {
6825
+ "name": "HoleDefinition",
6826
+ "kind": "interface",
6827
+ "package": "@nifrajs/web-preact",
6828
+ "signature": "export interface HoleDefinition<Data> {\n readonly name: string;\n readonly render: (data: Data) => ComponentChildren;\n readonly fallback?: ComponentChildren;\n readonly interactive?: boolean;\n}",
6829
+ "doc": "/** The fields of a route's boundary declaration a hole renders from. */"
6830
+ },
6831
+ {
6832
+ "name": "HoleDefinition",
6833
+ "kind": "interface",
6834
+ "package": "@nifrajs/web-react",
6835
+ "signature": "export interface HoleDefinition<Data> {\n readonly name: string;\n readonly render: (data: Data) => ReactNode;\n readonly fallback?: ReactNode;\n readonly interactive?: boolean;\n}",
6836
+ "doc": "/** The fields of a route's boundary declaration a hole renders from. */"
6837
+ },
6838
+ {
6839
+ "name": "HoleDefinition",
6840
+ "kind": "interface",
6841
+ "package": "@nifrajs/web-solid",
6842
+ "signature": "export interface HoleDefinition<Data> {\n readonly name: string;\n readonly render: (data: Data) => JSX.Element;\n readonly fallback?: () => JSX.Element;\n readonly interactive?: boolean;\n}",
6843
+ "doc": "/**\n * The fields of a route's boundary declaration a hole renders from. `fallback` is a function: JSX\n * evaluated at import is one DOM node, so every place that shows it would take it from the last.\n */"
6844
+ },
6845
+ {
6846
+ "name": "HoleDefinition",
6847
+ "kind": "interface",
6848
+ "package": "@nifrajs/web-svelte",
6849
+ "signature": "export interface HoleDefinition<Data> {\n readonly name: string\n readonly render: (data: Data) => SvelteUI\n readonly fallback?: SvelteUI\n readonly interactive?: boolean\n}",
6850
+ "doc": "/** The fields of a route's boundary declaration a hole renders from. */"
6851
+ },
6852
+ {
6853
+ "name": "HoleDefinition",
6854
+ "kind": "interface",
6855
+ "package": "@nifrajs/web-vue",
6856
+ "signature": "export interface HoleDefinition<Data> {\n readonly name: string;\n render(data: Data): VNodeChild;\n readonly fallback?: VNodeChild;\n readonly interactive?: boolean;\n}",
6857
+ "doc": "/**\n * The fields of a route's boundary declaration a hole renders from: `h()` output, not templates.\n * `render` is a method so a definition fits `h(Hole, ...)`, which cannot carry its data type.\n */"
6858
+ },
6859
+ {
6860
+ "name": "HoleProps",
6861
+ "kind": "interface",
6862
+ "package": "@nifrajs/web-preact",
6863
+ "signature": "export interface HoleProps<Data> {\n readonly of: HoleDefinition<Data>;\n readonly state: HoleState | undefined;\n /** Shown when the hole's loader failed. Default: nothing. */\n readonly error?: ComponentChildren;\n}"
6864
+ },
6865
+ {
6866
+ "name": "HoleProps",
6867
+ "kind": "interface",
6868
+ "package": "@nifrajs/web-react",
6869
+ "signature": "export interface HoleProps<Data> {\n readonly of: HoleDefinition<Data>;\n readonly state: HoleState | undefined;\n /** Shown when the hole's loader failed. Default: nothing. */\n readonly error?: ReactNode;\n}"
6870
+ },
6871
+ {
6872
+ "name": "HoleProps",
6873
+ "kind": "interface",
6874
+ "package": "@nifrajs/web-solid",
6875
+ "signature": "export interface HoleProps<Data> {\n readonly of: HoleDefinition<Data>;\n readonly state: HoleState | undefined;\n /** Shown when the hole's loader failed. Default: nothing. */\n readonly error?: JSX.Element;\n}"
6876
+ },
6877
+ {
6878
+ "name": "HoleProps",
6879
+ "kind": "interface",
6880
+ "package": "@nifrajs/web-svelte",
6881
+ "signature": "export interface HoleProps<Data> {\n of: HoleDefinition<Data>\n state: HoleState | undefined\n /** Shown when the hole's loader failed. Default: nothing. */\n error?: Snippet\n}",
6882
+ "doc": "/** Hand-written types for `Hole.svelte`, as for `Await.svelte`. */"
6883
+ },
6884
+ {
6885
+ "name": "HoleProps",
6886
+ "kind": "interface",
6887
+ "package": "@nifrajs/web-vue",
6888
+ "signature": "export interface HoleProps<Data> {\n readonly of: HoleDefinition<Data>;\n readonly state: HoleState | undefined;\n}"
6889
+ },
6890
+ {
6891
+ "name": "HoleState",
6892
+ "kind": "interface",
6893
+ "package": "@nifrajs/web-svelte",
6894
+ "signature": "export interface HoleState {\n readonly status: \"unresolved\" | \"pending\" | \"ready\" | \"error\"\n readonly data?: unknown\n readonly ppr?: true\n readonly fill?: unknown\n}",
6895
+ "doc": "/** The slice of a boundary state a hole reads: `ppr` marks a hole the shared shell left open, and\n * `fill` that host's refill when the page reloads. */"
6896
+ },
6715
6897
  {
6716
6898
  "name": "HookKind",
6717
6899
  "kind": "type",
@@ -6905,6 +7087,13 @@
6905
7087
  "signature": "export declare const IDEMPOTENT_REPLAY_HEADER = \"x-nifra-idempotent-replay\";",
6906
7088
  "doc": "/** Header stamped on a replayed response so clients/proxies can tell a replay from a fresh run. */"
6907
7089
  },
7090
+ {
7091
+ "name": "IDENTITY_CHANNEL",
7092
+ "kind": "const",
7093
+ "package": "@nifrajs/web",
7094
+ "signature": "export declare const IDENTITY_CHANNEL = \"nifra-identity-v1\";",
7095
+ "doc": "/** The channel every tab of an origin hears a sign-in or sign-out on. */"
7096
+ },
6908
7097
  {
6909
7098
  "name": "IDENTITY_SENSITIVE_PACKAGES",
6910
7099
  "kind": "const",
@@ -6930,7 +7119,7 @@
6930
7119
  "name": "ISROptions",
6931
7120
  "kind": "interface",
6932
7121
  "package": "@nifrajs/web",
6933
- "signature": "export interface ISROptions {\n readonly store: CacheStore;\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 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}. The request\n * is served without the cache either way - a failed read is a miss, a failed write still returns the\n * rendered page, a failed regeneration keeps the stale entry - so a store outage never changes a\n * status. 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}"
7122
+ "signature": "export interface ISROptions {\n readonly store: CacheStore;\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}"
6934
7123
  },
6935
7124
  {
6936
7125
  "name": "ISRPlatform",
@@ -6950,7 +7139,7 @@
6950
7139
  "name": "ISRStoreOp",
6951
7140
  "kind": "type",
6952
7141
  "package": "@nifrajs/web",
6953
- "signature": "export type ISRStoreOp = \"get\" | \"set\" | \"delete\" | \"fence\";",
7142
+ "signature": "export type ISRStoreOp = \"get\" | \"set\" | \"delete\" | \"fence\" | \"verify\";",
6954
7143
  "doc": "/** The store operation an {@link ISROptions.onStoreError} report is about. */"
6955
7144
  },
6956
7145
  {
@@ -7029,7 +7218,7 @@
7029
7218
  "name": "IdempotencyOptions",
7030
7219
  "kind": "interface",
7031
7220
  "package": "@nifrajs/middleware",
7032
- "signature": "export interface IdempotencyOptions {\n /** Where claims + cached responses live. `MemoryIdempotencyStore` for dev; a shared store in production. */\n readonly store: IdempotencyStore;\n /** Header carrying the key. Default `\"idempotency-key\"`. */\n readonly header?: string;\n /** Methods the guard applies to. Default `[\"POST\", \"PUT\", \"PATCH\", \"DELETE\"]` (unsafe methods). */\n readonly methods?: readonly string[];\n /** How long a completed response is replayable, in ms. Default 24h. */\n readonly ttlMs?: number;\n /** How long the in-flight lock survives a crashed handler, in ms. Default 60s. */\n readonly lockTtlMs?: number;\n /** Max response bytes to cache. A larger response is returned but **not** stored. Default 1 MiB. */\n readonly maxBytes?: number;\n /**\n * Whether a response should be cached for replay. Default: any status below 500 except 401, 403,\n * 408, 409, 425, and 429, and the request rejections 400, 404, 405, 413, 414, 415, 422 and 431.\n * Like a transient 5xx, those say the operation did not run: replaying one would refuse every\n * retry under that key until it expired, and storing a rejection lets a caller fill the store\n * with keys sent to a route that does not exist. A handler that answers 400 or 422 after a side\n * effect should supply its own predicate.\n */\n readonly shouldCache?: (response: Response) => boolean;\n /**\n * Derive the store key from the request. Default: the `header` value scoped by method + path **and\n * by a digest of the caller's credentials** (see `principalHeaders`), so neither a different\n * endpoint nor a different caller can collide on one key. Return `null`/`\"\"` to skip dedupe for\n * this request.\n *\n * Supplying your own replaces that scoping entirely - a custom key MUST fold in the principal\n * itself (e.g. `` `${userId}:${req.headers.get(\"idempotency-key\")}` ``), or one user can replay\n * another's stored response by guessing their key.\n */\n readonly key?: (req: Request, header: string) => string | null | Promise<string | null>;\n /**\n * Headers whose values identify the caller. Their digest scopes the default key, so the same\n * `Idempotency-Key` from two callers addresses two entries and neither can read the other's cached\n * response. Defaults to Authorization, Cookie, and x-api-key. Only a digest is stored - a raw\n * credential must never become a store key, which would put it in front of every Redis `KEYS` dump\n * and slow-log line. Ignored when `key` is supplied.\n *\n * The digest covers the header value verbatim, so anything that varies between two requests from the\n * same caller - a rotated bearer token, an analytics cookie appended mid-session - lands on a fresh\n * key and the retry executes again. Narrow the list (or supply `key`) when the app has a stable\n * principal id to scope by; that is strictly better than digesting a whole `Cookie` header.\n *\n * A request that carries none of these headers is keyed as anonymous. If an authentication stage\n * then accepts it (a credential in another header), its response is not stored: under the\n * anonymous key any caller presenting the same `Idempotency-Key` would be replayed it. Add that\n * header here to dedupe such requests.\n */\n readonly principalHeaders?: readonly string[];\n}"
7221
+ "signature": "export interface IdempotencyOptions {\n /** Where claims + cached responses live. `MemoryIdempotencyStore` for dev; a shared store in production. */\n readonly store: IdempotencyStore;\n /** Header carrying the key. Default `\"idempotency-key\"`. */\n readonly header?: string;\n /** Methods the guard applies to. Default `[\"POST\", \"PUT\", \"PATCH\", \"DELETE\"]` (unsafe methods). */\n readonly methods?: readonly string[];\n /** How long a completed response is replayable, in ms. Default 24h. */\n readonly ttlMs?: number;\n /** Pending lease, renewed while work runs (for up to `ttlMs`) when the store supports `renew`.\n * Default 60s. Stores without renewal reserve for at least `ttlMs` instead. */\n readonly lockTtlMs?: number;\n /** Max response bytes to capture. Larger cacheable responses retain a fixed terminal replay error so a\n * retry cannot repeat their effects. That small control record is independent of this cap. Default 1 MiB. */\n readonly maxBytes?: number;\n /**\n * Whether a response should be cached for replay. Default: any status below 500 except 401, 403,\n * 408, 409, 425, and 429, and the request rejections 400, 404, 405, 413, 414, 415, 422 and 431.\n * Like a transient 5xx, those say the operation did not run: replaying one would refuse every\n * retry under that key until it expired, and storing a rejection lets a caller fill the store\n * with keys sent to a route that does not exist. A handler that answers 400 or 422 after a side\n * effect should supply its own predicate.\n */\n readonly shouldCache?: (response: Response) => boolean;\n /**\n * Derive the store key from the request. Default: the `header` value scoped by method + path **and\n * by a digest of the caller's credentials** (see `principalHeaders`), so neither a different\n * endpoint nor a different caller can collide on one key. Return `null`/`\"\"` to skip dedupe for\n * this request.\n *\n * Supplying your own replaces that scoping entirely - a custom key MUST fold in the principal\n * itself (e.g. `` `${userId}:${req.headers.get(\"idempotency-key\")}` ``), or one user can replay\n * another's stored response by guessing their key.\n */\n readonly key?: (req: Request, header: string) => string | null | Promise<string | null>;\n /**\n * Headers whose values identify the caller. Their digest scopes the default key, so the same\n * `Idempotency-Key` from two callers addresses two entries and neither can read the other's cached\n * response. Defaults to Authorization, Cookie, and x-api-key. Only a digest is stored - a raw\n * credential must never become a store key, which would put it in front of every Redis `KEYS` dump\n * and slow-log line. Ignored when `key` is supplied.\n *\n * The digest covers the header value verbatim, so anything that varies between two requests from the\n * same caller - a rotated bearer token, an analytics cookie appended mid-session - lands on a fresh\n * key and the retry executes again. Narrow the list (or supply `key`) when the app has a stable\n * principal id to scope by; that is strictly better than digesting a whole `Cookie` header.\n *\n * A request that carries none of these headers is keyed as anonymous. If an authentication stage\n * then accepts it (a credential in another header), its response is not stored: under the\n * anonymous key any caller presenting the same `Idempotency-Key` would be replayed it. Add that\n * header here to dedupe such requests.\n */\n readonly principalHeaders?: readonly string[];\n}"
7033
7222
  },
7034
7223
  {
7035
7224
  "name": "IdempotencyPluginOptions",
@@ -7054,7 +7243,7 @@
7054
7243
  "name": "IdempotencyRecord",
7055
7244
  "kind": "interface",
7056
7245
  "package": "@nifrajs/middleware",
7057
- "signature": "export interface IdempotencyRecord {\n readonly status: number;\n /** Response headers, **excluding `Set-Cookie`** (cookies are session-specific - see {@link idempotency}). */\n readonly headers: ReadonlyArray<readonly [string, string]>;\n /** Response body, base64-encoded. */\n readonly body: string;\n /**\n * The response came from a route this middleware's `beforeHandle` covers, so a retry is replayed\n * from there - after the route's authentication, validation and earlier guards accept it again. A\n * record without it (a route declared before `.use(idempotency())`) is replayed in `onRequest`.\n */\n readonly recheck?: boolean;\n}",
7246
+ "signature": "export interface IdempotencyRecord {\n readonly status: number;\n /** Response headers, **excluding `Set-Cookie`** (cookies are session-specific - see {@link idempotency}). */\n readonly headers: ReadonlyArray<readonly [string, string]>;\n /** Response body, base64-encoded. */\n readonly body: string;\n /**\n * Set on every record this middleware writes: the response came from a covered route, so a retry is\n * replayed just before that route's handler, after its authentication, validation and guards accept\n * it again. A record without it is refused: its original route admission cannot be established.\n */\n readonly recheck?: boolean;\n}",
7058
7247
  "doc": "/** A captured response, replayed verbatim on a retry. Body is base64 (binary-safe + JSON-serializable). */"
7059
7248
  },
7060
7249
  {
@@ -7087,7 +7276,7 @@
7087
7276
  "name": "IdempotencyStore",
7088
7277
  "kind": "interface",
7089
7278
  "package": "@nifrajs/middleware",
7090
- "signature": "export interface IdempotencyStore {\n /**\n * Atomically claim `key`: `\"replay\"` if a completed response is stored, `\"in_flight\"` if another\n * request holds the lock, else `\"new\"` (the caller now owns the lock and must `complete`/`release`).\n * The in-flight lock expires after `lockTtlMs` so a crashed handler can't wedge the key forever.\n */\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n /** Store the completed response only when `reservation` still owns the lock (kept for `ttlMs`). */\n complete(key: string, reservation: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;\n /** Release only the lock owned by `reservation` (handler errored / response not cacheable). */\n release(key: string, reservation: string): Promise<boolean>;\n}",
7279
+ "signature": "export interface IdempotencyStore {\n /**\n * Atomically claim `key`: `\"replay\"` if a completed response is stored, `\"in_flight\"` if another\n * request holds the lock, else `\"new\"` (the caller now owns the lock and must `complete`/`release`).\n * The in-flight lock expires after `lockTtlMs` so a crashed handler can't wedge the key forever.\n */\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n /** Store the completed response only when `reservation` still owns the lock (kept for `ttlMs`). */\n complete(key: string, reservation: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;\n /** Release only the lock owned by `reservation` (handler errored / response not cacheable). */\n release(key: string, reservation: string): Promise<boolean>;\n /** Extend a still-owned pending lease atomically; false means ownership was lost.\n * Without this, pending reservations use at least the replay retention TTL. */\n renew?(key: string, reservation: string, lockTtlMs: number): Promise<boolean>;\n}",
7091
7280
  "doc": "/**\n * Store backing the idempotency guarantee. Production deploys MUST use a shared store so the key holds\n * across instances; `begin` MUST be **atomic** (e.g. Redis `SET key NX PX lockTtlMs`) or two concurrent\n * retries can both see `\"new\"`. {@link MemoryIdempotencyStore} is for dev / single-instance only.\n */"
7092
7281
  },
7093
7282
  {
@@ -7096,6 +7285,13 @@
7096
7285
  "package": "@nifrajs/core",
7097
7286
  "signature": "export interface IdempotencyWorkload {\n readonly name: string;\n readonly run: () => Promise<SealedEffectLedger> | SealedEffectLedger;\n}"
7098
7287
  },
7288
+ {
7289
+ "name": "IdentityEpochContext",
7290
+ "kind": "interface",
7291
+ "package": "@nifrajs/web",
7292
+ "signature": "export interface IdentityEpochContext {\n readonly request: Request;\n readonly set: {\n cookie(name: string, value: string, options?: CookieOptions): void;\n };\n}",
7293
+ "doc": "/** The response-cookie surface {@link rotateIdentityEpoch} needs: nifra's handler context. */"
7294
+ },
7099
7295
  {
7100
7296
  "name": "IdentityPlugin",
7101
7297
  "kind": "type",
@@ -7449,6 +7645,13 @@
7449
7645
  "package": "@nifrajs/web",
7450
7646
  "signature": "export type InterceptBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: {\n readonly intercept: string;\n };\n readonly load?: (ctx: BoundaryRequestCtx) => Data | Promise<Data>;\n};"
7451
7647
  },
7648
+ {
7649
+ "name": "Intercepted",
7650
+ "kind": "interface",
7651
+ "package": "@nifrajs/web",
7652
+ "signature": "export interface Intercepted {\n readonly boundary: string;\n readonly pagePath: string;\n}",
7653
+ "doc": "/** Which intercept boundary is open, and the page underneath it. */"
7654
+ },
7452
7655
  {
7453
7656
  "name": "InvalidateResult",
7454
7657
  "kind": "interface",
@@ -7513,7 +7716,7 @@
7513
7716
  "kind": "function",
7514
7717
  "package": "@nifrajs/web-react",
7515
7718
  "signature": "export declare function Island({ id, props, strategy, children }: IslandProps): ReactNode;",
7516
- "doc": "/** Render a `<nifra-island>` marker around server-rendered `children`. The client enhancer mounts the\n * interactivity (see `mountIslands`). Props are JSON-encoded into `data-props`; React escapes the\n * attribute value and the client reads the decoded `dataset.props`. */"
7719
+ "doc": "/** Render a `<nifra-island>` marker around server-rendered `children`. The client enhancer mounts the\n * interactivity (see `mountIslands`). Props are JSON-encoded into `data-island-props`; React escapes\n * the attribute value and the client reads the decoded `dataset.islandProps`. */"
7517
7720
  },
7518
7721
  {
7519
7722
  "name": "IslandBusUnsubscribe",
@@ -7529,12 +7732,6 @@
7529
7732
  "signature": "export type IslandCleanup = () => void;",
7530
7733
  "doc": "/** Optional teardown an enhancer returns (remove listeners/observers); run on `dispose()`. */"
7531
7734
  },
7532
- {
7533
- "name": "IslandContext",
7534
- "kind": "interface",
7535
- "package": "@nifrajs/islets",
7536
- "signature": "export interface IslandContext {\n /** The island's host element. */\n readonly root: BindableElement & BindableRoot;\n /**\n * A named signal, seeded from `data-island-state`'s value for `key` when present, else\n * `fallback`. Each key returns the SAME signal across calls - bindings and setup share state.\n */\n state<T>(key: string, fallback: T): Signal<T>;\n}"
7537
- },
7538
7735
  {
7539
7736
  "name": "IslandEnhancer",
7540
7737
  "kind": "type",
@@ -7542,13 +7739,6 @@
7542
7739
  "signature": "export type IslandEnhancer<P = unknown> = (el: HTMLElement, props: P) => IslandCleanup | void;",
7543
7740
  "doc": "/**\n * Enhances one island element with its (typed) props. Return a cleanup function to tear down on\n * `dispose()` (listeners, observers) - optional; an enhancer with nothing to clean up returns nothing.\n * The `void` member is the no-cleanup case, the same shape as React's `EffectCallback`.\n */"
7544
7741
  },
7545
- {
7546
- "name": "IslandHost",
7547
- "kind": "interface",
7548
- "package": "@nifrajs/islets",
7549
- "signature": "export interface IslandHost extends BindableElement, BindableRoot {\n setAttribute(name: string, value: string): void;\n}",
7550
- "doc": "/** The host-element surface `mountIslands` needs beyond bindings. */"
7551
- },
7552
7742
  {
7553
7743
  "name": "IslandInstance",
7554
7744
  "kind": "interface",
@@ -7559,20 +7749,7 @@
7559
7749
  "name": "IslandProps",
7560
7750
  "kind": "interface",
7561
7751
  "package": "@nifrajs/web-react",
7562
- "signature": "export interface IslandProps {\n /** Stable id matching the key in the client's `mountIslands({ <id>: enhancer })`. */\n readonly id: string;\n /** Serializable props handed to the enhancer (JSON-encoded inline in `data-props`; no closures). */\n readonly props?: unknown;\n /** When the enhancer runs (default `load`). `visible` (IntersectionObserver) wins TTI on long pages. */\n readonly strategy?: IslandStrategy;\n /** The island's server-rendered content - real HTML, present with JS off. */\n readonly children?: ReactNode;\n}"
7563
- },
7564
- {
7565
- "name": "IslandScope",
7566
- "kind": "type",
7567
- "package": "@nifrajs/islets",
7568
- "signature": "export type IslandScope = {\n readonly signals: Readonly<Record<string, Signal<unknown>>>;\n readonly handlers: Readonly<Record<string, (event: Event) => void>>;\n};"
7569
- },
7570
- {
7571
- "name": "IslandSetup",
7572
- "kind": "type",
7573
- "package": "@nifrajs/islets",
7574
- "signature": "export type IslandSetup = (ctx: IslandContext) => Record<string, (event: Event) => void> | undefined;",
7575
- "doc": "/** An island's setup function: read/seed state, return the event handlers the markup names. */"
7752
+ "signature": "export interface IslandProps {\n /** Stable id matching the key in the client's `mountIslands({ <id>: enhancer })`. */\n readonly id: string;\n /** Serializable props handed to the enhancer (JSON-encoded inline in `data-island-props`; no closures). */\n readonly props?: unknown;\n /** When the enhancer runs (default `load`). `visible` (IntersectionObserver) wins TTI on long pages. */\n readonly strategy?: IslandStrategy;\n /** The island's server-rendered content - real HTML, present with JS off. */\n readonly children?: ReactNode;\n}"
7576
7753
  },
7577
7754
  {
7578
7755
  "name": "IslandStrategy",
@@ -7581,13 +7758,6 @@
7581
7758
  "signature": "export type IslandStrategy = \"load\" | \"idle\" | \"visible\" | {\n readonly media: string;\n};",
7582
7759
  "doc": "/** When an island's enhancer runs. An object strategy is intentionally limited to media queries. */"
7583
7760
  },
7584
- {
7585
- "name": "IslandStrategy",
7586
- "kind": "type",
7587
- "package": "@nifrajs/islets",
7588
- "signature": "export type IslandStrategy = \"load\" | \"idle\" | \"visible\" | {\n readonly media: string;\n};",
7589
- "doc": "/** When an island's enhancer runs. An object strategy is intentionally limited to media queries. */"
7590
- },
7591
7761
  {
7592
7762
  "name": "IslandStrategy",
7593
7763
  "kind": "type",
@@ -7869,12 +8039,33 @@
7869
8039
  "package": "@nifrajs/middleware",
7870
8040
  "signature": "export type JwtVerificationKey = string | Uint8Array | CryptoKey | JwkKey;"
7871
8041
  },
8042
+ {
8043
+ "name": "KEEP_ALIVE_MAX",
8044
+ "kind": "const",
8045
+ "package": "@nifrajs/web",
8046
+ "signature": "export declare const KEEP_ALIVE_MAX = 3;",
8047
+ "doc": "/** Most pages kept per tab. */"
8048
+ },
8049
+ {
8050
+ "name": "KEEP_ALIVE_MAX_AGE_MS",
8051
+ "kind": "const",
8052
+ "package": "@nifrajs/web",
8053
+ "signature": "export declare const KEEP_ALIVE_MAX_AGE_MS: number;",
8054
+ "doc": "/** Longest a page stays hidden unless its route sets `keepAlive: { maxAge }`, in milliseconds. */"
8055
+ },
8056
+ {
8057
+ "name": "KEPT_PAGES_GLOBAL",
8058
+ "kind": "const",
8059
+ "package": "@nifrajs/web",
8060
+ "signature": "export declare const KEPT_PAGES_GLOBAL = \"__nifraKeepAlive\";",
8061
+ "doc": "/** Where a development build lists its kept pages, for `@nifrajs/devtools`. */"
8062
+ },
7872
8063
  {
7873
8064
  "name": "KVCacheStore",
7874
8065
  "kind": "class",
7875
8066
  "package": "@nifrajs/web",
7876
- "signature": "export declare class KVCacheStore implements CacheStore {\n private readonly kv;\n private readonly putOptions;\n constructor(kv: KVNamespaceLike, options?: KVCacheStoreOptions);\n get(key: string): Promise<CachedResponse | undefined>;\n /** Wall-clock time, so purges on any instance order against it. KV is eventually consistent, so the\n * fence holds only for purges this location has already seen. */\n fence(): number;\n set(key: string, value: CachedResponse): Promise<void>;\n /** Leaves a marker rather than removing the key, so `set` can refuse a render that began before\n * the purge. The marker reads as a miss. */\n delete(key: string): Promise<void>;\n invalidateTag(tag: string): Promise<void>;\n private tagKey;\n}",
7877
- "doc": "/**\n * A {@link CacheStore} backed by a **Cloudflare Workers KV** namespace (or any {@link KVNamespaceLike}\n * binding) - the production-grade shared/durable store ISR wants: cached pages and on-demand purges\n * hold *across* worker instances (unlike the per-instance {@link MemoryCacheStore}). Entries serialize\n * to JSON; every read is validated before it's trusted (a malformed/version-skewed entry is treated as\n * a miss). Construct it in your Workers `fetch` from the binding: `new KVCacheStore(env.ISR_CACHE)`.\n *\n * Cloudflare is the default, not a requirement: {@link KVNamespaceLike} is three structural methods,\n * so a Redis, Deno KV, or Upstash binding satisfies it (pass `minExpirationTtl` for their TTL floor).\n * A backend that *can* enumerate keys deserves its own {@link CacheStore} rather than this one - the\n * epoch indirection in {@link KVCacheStore.invalidateTag} exists only because KV cannot list by tag.\n */"
8067
+ "signature": "export declare class KVCacheStore implements CacheStore {\n private readonly kv;\n private readonly putOptions;\n private readonly pathEpochOptions;\n constructor(kv: KVNamespaceLike, options?: KVCacheStoreOptions);\n get(key: string): Promise<CachedResponse | undefined>;\n /** Wall-clock time, so purges on any instance order against it. KV is eventually consistent, so\n * `set` refuses only purges this location has already seen; a page stored before a purge reached\n * its location keeps the older epoch and reads as a miss once the purge arrives. */\n fence(): number;\n set(key: string, value: CachedResponse): Promise<void>;\n /** Moves the path's epoch and leaves the page: a page stored under the old epoch reads as a miss,\n * even one another location stored before this purge reached it, and `set` refuses a render begun\n * before the purge. */\n delete(key: string): Promise<void>;\n invalidateTag(tag: string): Promise<void>;\n private tagKey;\n /** The page key under a prefix, or its digest when that would pass KV's key limit. */\n private pathKey;\n private pathEpoch;\n}",
8068
+ "doc": "/**\n * A {@link CacheStore} backed by a **Cloudflare Workers KV** namespace (or any {@link KVNamespaceLike}\n * binding) - the production-grade shared/durable store ISR wants: cached pages and on-demand purges\n * hold *across* worker instances (unlike the per-instance {@link MemoryCacheStore}). Entries serialize\n * to JSON; every read is validated before it's trusted (a malformed/version-skewed entry is treated as\n * a miss). Construct it in your Workers `fetch` from the binding: `new KVCacheStore(env.ISR_CACHE)`,\n * and give `withISR` the `storeSecret` it signs these pages with.\n *\n * Cloudflare is the default, not a requirement: {@link KVNamespaceLike} is three structural methods,\n * so a Redis, Deno KV, or Upstash binding satisfies it (pass `minExpirationTtl` for their TTL floor).\n * A backend that *can* enumerate keys deserves its own {@link CacheStore} rather than this one - the\n * epoch indirection in {@link KVCacheStore.invalidateTag} exists only because KV cannot list by tag.\n */"
7878
8069
  },
7879
8070
  {
7880
8071
  "name": "KVCacheStoreOptions",
@@ -7903,6 +8094,117 @@
7903
8094
  "signature": "export declare class KVSessionStore implements SessionStore {\n readonly consistency = \"eventual\";\n private readonly kv;\n private readonly now;\n constructor(kv: KVNamespaceLike, options?: {\n readonly now?: () => number;\n });\n get(id: string): Promise<SessionRecord | undefined>;\n set(id: string, record: SessionRecord): Promise<void>;\n delete(id: string): Promise<void>;\n}",
7904
8095
  "doc": "/**\n * Legacy Cloudflare Workers KV persistence, retained for reading and migrating existing records.\n * `createSessions` rejects this adapter: cached records and missing revocation markers can resurrect\n * a logged-out session. Use a strongly consistent {@link SessionStore} for authenticated sessions.\n * Records serialize to JSON; the entry's KV `expiration` is set from the record's `expiresAt` so KV\n * auto-evicts the session (a GC backstop - the manager still authoritatively checks expiry on read).\n * Every read is validated, so a corrupt/skewed entry reads as no session.\n * @deprecated Workers KV is eventually consistent and cannot enforce session revocation.\n */"
7905
8096
  },
8097
+ {
8098
+ "name": "KeepAliveClient",
8099
+ "kind": "interface",
8100
+ "package": "@nifrajs/web",
8101
+ "signature": "export interface KeepAliveClient {\n /** Pass as `createClientRouter({ fetchData })`, so a restored page's reload keeps what it showed. */\n readonly fetchData: FetchRouteData;\n /** Layer keep-alive over the router built with {@link fetchData}. Call once, before\n * `installHistory`. */\n attach(router: ClientRouter): KeepAliveRouter;\n}",
8102
+ "doc": "/** What {@link keepAliveClient} returns: the transport to build the router with, then the layer. */"
8103
+ },
8104
+ {
8105
+ "name": "KeepAliveClientOptions",
8106
+ "kind": "interface",
8107
+ "package": "@nifrajs/web",
8108
+ "signature": "export interface KeepAliveClientOptions {\n /** Where the slot wrappers go (generated from the route table). */\n readonly table: KeepAliveTable;\n /** Route id → its client hooks, filled in as route modules load. A page is kept only while its\n * module exports `keepAlive`. */\n readonly routeHooks: Readonly<Record<string, ClientRouteHooks | undefined>>;\n /** Route id → its layout ids then its own id, filled in as route modules load. */\n readonly matchChains: Readonly<Record<string, MatchChain | undefined>>;\n /** The transport to layer over (a live app's); the router's own by default. */\n readonly fetchData?: FetchRouteData;\n /** Most pages kept (default {@link KEEP_ALIVE_MAX}). */\n readonly max?: number;\n /** Called with the instances each drop removed. */\n readonly onDrop?: (reason: KeepAliveDropReason, instances: readonly string[]) => void;\n}"
8109
+ },
8110
+ {
8111
+ "name": "KeepAliveDropReason",
8112
+ "kind": "type",
8113
+ "package": "@nifrajs/web",
8114
+ "signature": "export type KeepAliveDropReason = \n/** The visitor signed in or out (the epoch cookie changed, or another tab said so). */\n\"identity\"\n/** The document entered the browser's own back/forward cache. */\n | \"pagehide\"\n/** A push cut off the history entries they belonged to. */\n | \"forward\"\n/** A fourth page was kept; the least recently shown went. */\n | \"lru\"\n/** Hidden longer than its route's `maxAge`. */\n | \"expired\"\n/** Its chain leaves the page on screen at a layout rendered without slot wrappers. */\n | \"layout\"\n/** A route module was replaced by a hot update. */\n | \"hot-update\"\n/** `dropKept` was called. */\n | \"manual\";",
8115
+ "doc": "/** Why kept pages were dropped. */"
8116
+ },
8117
+ {
8118
+ "name": "KeepAliveMount",
8119
+ "kind": "interface",
8120
+ "package": "@nifrajs/web-svelte",
8121
+ "signature": "export interface KeepAliveMount {\n readonly tree: (state: RouterState, previous: readonly SlotNode[] | undefined) => readonly SlotNode[];\n readonly propsOf: (state: RouterState) => RenderProps;\n readonly chainOf: (state: RouterState) => readonly unknown[];\n readonly entry: (key: string) => (element: Element | null) => void;\n readonly page: (key: string) => (element: Element | null) => void;\n readonly after: (tree: readonly SlotNode[]) => void;\n}",
8122
+ "doc": "/** What `KeepAlive.svelte` and `Slot.svelte` render with: one per mount, on the server or the client. */"
8123
+ },
8124
+ {
8125
+ "name": "KeepAliveMountOptions",
8126
+ "kind": "interface",
8127
+ "package": "@nifrajs/web-preact",
8128
+ "signature": "export interface KeepAliveMountOptions extends MountRouterOptions {\n readonly router: KeepAliveRouter;\n readonly keepAlive: KeepAliveTable;\n}",
8129
+ "doc": "/** `mountRouter`'s options in a keep-alive app: the generated entry adds where the wrappers go. */"
8130
+ },
8131
+ {
8132
+ "name": "KeepAliveMountOptions",
8133
+ "kind": "interface",
8134
+ "package": "@nifrajs/web-react",
8135
+ "signature": "export interface KeepAliveMountOptions extends MountRouterOptions {\n readonly router: KeepAliveRouter;\n readonly keepAlive: KeepAliveTable;\n}",
8136
+ "doc": "/** `mountRouter`'s options in a keep-alive app: the generated entry adds where the wrappers go. */"
8137
+ },
8138
+ {
8139
+ "name": "KeepAliveMountOptions",
8140
+ "kind": "interface",
8141
+ "package": "@nifrajs/web-solid",
8142
+ "signature": "export interface KeepAliveMountOptions extends MountRouterOptions {\n readonly router: KeepAliveRouter;\n readonly keepAlive: KeepAliveTable;\n}",
8143
+ "doc": "/** `mountRouter`'s options in a keep-alive app: the generated entry adds where the wrappers go. */"
8144
+ },
8145
+ {
8146
+ "name": "KeepAliveMountOptions",
8147
+ "kind": "interface",
8148
+ "package": "@nifrajs/web-svelte",
8149
+ "signature": "export interface KeepAliveMountOptions extends MountRouterOptions {\n readonly router: KeepAliveRouter;\n readonly keepAlive: KeepAliveTable;\n}",
8150
+ "doc": "/** `mountRouter`'s options in a keep-alive app: the generated entry adds where the wrappers go. */"
8151
+ },
8152
+ {
8153
+ "name": "KeepAliveMountOptions",
8154
+ "kind": "interface",
8155
+ "package": "@nifrajs/web-vue",
8156
+ "signature": "export interface KeepAliveMountOptions extends MountRouterOptions {\n readonly router: KeepAliveRouter;\n readonly keepAlive: KeepAliveTable;\n}",
8157
+ "doc": "/** `mountRouter`'s options in a keep-alive app: the generated entry adds which slots are kept. */"
8158
+ },
8159
+ {
8160
+ "name": "KeepAliveNavigateOptions",
8161
+ "kind": "interface",
8162
+ "package": "@nifrajs/web",
8163
+ "signature": "export interface KeepAliveNavigateOptions {\n /** The instance of the history entry a back/forward lands on. Read from `history.state` when absent. */\n readonly traverse?: string;\n}",
8164
+ "doc": "/** Per-navigation options of {@link KeepAliveRouter.navigate}. */"
8165
+ },
8166
+ {
8167
+ "name": "KeepAliveOptions",
8168
+ "kind": "interface",
8169
+ "package": "@nifrajs/web",
8170
+ "signature": "export interface KeepAliveOptions {\n /** Reload the page's data when it is shown again (default `true`). A page marked stale while it was\n * hidden reloads anyway. */\n readonly revalidate?: boolean;\n /** Longest the page may stay hidden before it is dropped, in milliseconds (default 10 minutes). */\n readonly maxAge?: number;\n}",
8171
+ "doc": "/** A page's `keepAlive` export as an object. */"
8172
+ },
8173
+ {
8174
+ "name": "KeepAliveRouter",
8175
+ "kind": "interface",
8176
+ "package": "@nifrajs/web",
8177
+ "signature": "export interface KeepAliveRouter extends ClientRouter {\n navigate: (path: string, options?: KeepAliveNavigateOptions) => Promise<void>;\n /** Drop every kept page. */\n dropKept: (reason?: KeepAliveDropReason) => void;\n /** Run `listener` with each state before it is published: the DOM half reads what the next render\n * hides or shows again while the page being left is still laid out. Returns its removal. */\n beforePublish: (listener: (next: RouterState) => void) => () => void;\n}",
8178
+ "doc": "/** The router as {@link keepAliveClient} hands it to the history layer and the adapter. */"
8179
+ },
8180
+ {
8181
+ "name": "KeepAliveServerOptions",
8182
+ "kind": "interface",
8183
+ "package": "@nifrajs/web",
8184
+ "signature": "export interface KeepAliveServerOptions {\n /**\n * Cookies whose change means a different visitor, on top of the session cookies of\n * `@nifrajs/auth`, Better Auth and Auth.js under their default names. Name a custom session cookie\n * here, or kept pages survive a sign-in or sign-out through it.\n */\n readonly identityCookies?: readonly string[];\n /** `HttpOnly` cookies that say nothing about who is signed in; development stops asking about them. */\n readonly ignoreCookies?: readonly string[];\n}",
8185
+ "doc": "/** `createWebApp`'s `keepAlive` option: which cookies say who is signed in. */"
8186
+ },
8187
+ {
8188
+ "name": "KeepAliveTable",
8189
+ "kind": "interface",
8190
+ "package": "@nifrajs/web",
8191
+ "signature": "export interface KeepAliveTable {\n /** Routes whose page renders inside the slot wrappers: the build found a `keepAlive` export. */\n readonly routes: readonly string[];\n /** Layouts rendered inside the slot wrappers, because another chain the browser can render shares\n * the layouts above one of them and not that one: a kept page then sits there beside the page on\n * screen. A layout every chain shares is never wrapped. */\n readonly layouts: readonly string[];\n}",
8192
+ "doc": "/** What the server and the browser both read to place the slot wrappers. */"
8193
+ },
8194
+ {
8195
+ "name": "KeptPage",
8196
+ "kind": "interface",
8197
+ "package": "@nifrajs/web",
8198
+ "signature": "export interface KeptPage {\n readonly instance: string;\n /** Its last settled state, which it renders from while hidden. */\n readonly state: RouterState;\n}",
8199
+ "doc": "/** A page kept mounted while its history entry is not the one on screen. */"
8200
+ },
8201
+ {
8202
+ "name": "KeptPageInfo",
8203
+ "kind": "interface",
8204
+ "package": "@nifrajs/web",
8205
+ "signature": "export interface KeptPageInfo {\n readonly instance: string;\n readonly path: string;\n readonly routeId: string;\n /** How long it has been hidden, in milliseconds. */\n readonly hiddenFor: number;\n /** The elements it renders, while its view has them. */\n readonly nodes: number | undefined;\n}",
8206
+ "doc": "/** One kept page, as the devtools panel lists it. */"
8207
+ },
7906
8208
  {
7907
8209
  "name": "LAST_ERROR_PATH",
7908
8210
  "kind": "const",
@@ -8112,6 +8414,20 @@
8112
8414
  "signature": "export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n /** Same-origin destination path (e.g. `/users/7?tab=posts`). Rendered as the `<a href>`. */\n readonly to: string;\n /** Replace the current history entry instead of pushing. */\n readonly replace?: boolean;\n /** When the link warms its route ahead of a click - rendered as `data-nifra-prefetch`. Unset, the\n * nearest ancestor's `data-nifra-prefetch` decides, else `intent` (hover or focus). */\n readonly prefetch?: PrefetchMode;\n}",
8113
8415
  "doc": "/** {@link Link} props: every `<a>` attribute except `href` (set from `to`), plus `to`, `replace` and\n * `prefetch`. */"
8114
8416
  },
8417
+ {
8418
+ "name": "ListContainer",
8419
+ "kind": "interface",
8420
+ "package": "@nifrajs/web",
8421
+ "signature": "export interface ListContainer<E extends ListNode> {\n replaceChildren(...nodes: E[]): void;\n insertBefore(node: E, before: E | null): unknown;\n}",
8422
+ "doc": "/** The container surface `bindList` uses; an `Element` has it. */"
8423
+ },
8424
+ {
8425
+ "name": "ListNode",
8426
+ "kind": "interface",
8427
+ "package": "@nifrajs/web",
8428
+ "signature": "export interface ListNode {\n remove(): void;\n}",
8429
+ "doc": "/** The node surface `bindList` uses; an `Element` has it. */"
8430
+ },
8115
8431
  {
8116
8432
  "name": "ListOptions",
8117
8433
  "kind": "interface",
@@ -8133,36 +8449,144 @@
8133
8449
  "doc": "/**\n * TLS for `listen()`: serve HTTPS from Bun itself, with no proxy in front. `cert` and `key` are PEM,\n * as text or as the file's bytes (`readFileSync(\"cert.pem\")`); `passphrase` unlocks an encrypted key.\n */"
8134
8450
  },
8135
8451
  {
8136
- "name": "LoadGoogleFontIO",
8452
+ "name": "Live",
8137
8453
  "kind": "interface",
8138
8454
  "package": "@nifrajs/web",
8139
- "signature": "export interface LoadGoogleFontIO {\n /** Directory to write the hashed `.woff2` files into (created if missing). */\n readonly outDir: string;\n /** URL prefix the files are served under. Defaults to `\"/fonts\"`. */\n readonly publicPath?: string;\n /** Injectable `fetch` (defaults to the global). Tests pass a canned implementation. */\n readonly fetch?: typeof fetch;\n /** Injectable writer (defaults to `node:fs`). Tests pass an in-memory sink. */\n readonly writeFile?: (path: string, bytes: Uint8Array) => Promise<void>;\n /** Per-file download cap in bytes. Defaults to 5 MB (real woff2 are well under 1 MB). */\n readonly maxBytesPerFile?: number;\n}"
8455
+ "signature": "export interface Live extends LiveRuntimeHandle {\n /** Resolves once the secrets are derived and the bus is read; rejects on a duplicate secret id. */\n readonly ready: Promise<void>;\n /**\n * `keys` changed: every open page watching one reloads it. Call it after the write is visible to\n * loaders; resolves once this process has applied it, or 2 s after the bus took it if this process\n * has not read it back by then.\n */\n publish(...keys: string[]): Promise<void>;\n /** Refuse every grant issued to `subject` before now, and close its sockets. */\n revoke(subject: string): Promise<void>;\n /** Refuse every grant issued before now, and close every socket. */\n revokeAll(): Promise<void>;\n /**\n * Access to `key` was removed (for everyone, or for one subject): every watcher gets one last change\n * for it and stops watching it, and no grant issued before now keeps or re-signs it, so the next load\n * runs that owner's loader, which decides again.\n */\n revokeKey(key: string, subject?: string): Promise<void>;\n}",
8456
+ "doc": "/** A live runtime: pass it to `createWebApp({ live })`. */"
8140
8457
  },
8141
8458
  {
8142
- "name": "LoadGoogleFontResult",
8459
+ "name": "LiveBus",
8143
8460
  "kind": "interface",
8144
8461
  "package": "@nifrajs/web",
8145
- "signature": "export interface LoadGoogleFontResult {\n readonly family: string;\n /** A self-hosted `@font-face` stylesheet (one rule per written file). Import it from your app. */\n readonly css: string;\n /** Every file written to `outDir`. */\n readonly assets: readonly FontAsset[];\n /** `fontPreload()` link-attribute sets - spread the ones you want into a layout's `meta.link`.\n * Preloading *every* weight/subset is wasteful; usually preload just the primary subset + weight. */\n readonly preloads: readonly LinkDescriptor[];\n}"
8462
+ "signature": "export interface LiveBus {\n /** Append one event; resolves with its seq. */\n append(input: LiveBusInput): Promise<number>;\n /** Deliver every event after the returned head to `listener`, in seq order. */\n subscribe(listener: LiveBusListener): Promise<LiveBusSubscription>;\n}"
8146
8463
  },
8147
8464
  {
8148
- "name": "Loader",
8465
+ "name": "LiveBusEvent",
8149
8466
  "kind": "type",
8150
8467
  "package": "@nifrajs/web",
8151
- "signature": "export type Loader = (ctx: LoaderContext) => unknown | Promise<unknown>;",
8152
- "doc": "/** A route's optional data loader: params/request in, data out. */"
8468
+ "signature": "export type LiveBusEvent = LiveBusInput & {\n readonly seq: number;\n};"
8153
8469
  },
8154
8470
  {
8155
- "name": "LoaderArgs",
8156
- "kind": "interface",
8157
- "package": "@nifrajs/client",
8158
- "signature": "export interface LoaderArgs<Api, Env = unknown, Search = undefined> {\n readonly params: Record<string, string>;\n readonly request: Request;\n /** Alias of {@link request} - the same `Request`. Mirrors a route handler's `c.req`, so the same name\n * works in loaders/actions and routes (no `ctx.request` vs `c.req` mismatch). */\n readonly req: Request;\n readonly api: ApiProxy<Api>;\n /**\n * Platform bindings (Workers `env` - KV/D1/secrets), forwarded from the request `c.env`.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape via the second type argument -\n * `LoaderArgs<typeof app, Env>` (the same `Env` the backend's `server<Env>()` uses) - to read it\n * typed; otherwise `unknown`. Validate at the trust boundary before use.\n */\n readonly env: Env;\n /** `true` when the request carries a valid draft/preview cookie (when the app sets a `draftSecret`;\n * otherwise always `false`). Branch on it to load unpublished content for editors - see `enableDraft`. */\n readonly draft: boolean;\n /** The URL search params, validated server-side (fails closed to the schema's defaults, so it is safe\n * to use directly). Declare a route `searchSchema` and pass its type as the third argument -\n * `LoaderArgs<typeof app, Env, typeof searchSchema>` - to read it typed; otherwise a raw\n * `Record<string, unknown>` of the parsed query. */\n readonly search: Search extends StandardSchemaV1 ? InferOutput<Search> extends Record<string, unknown> ? InferOutput<Search> : never : Record<string, unknown>;\n /** Response headers and cookies for this page request: `ctx.set.headers[\"cache-control\"] = ...`,\n * `ctx.set.cookie(\"theme\", \"dark\")`. */\n readonly set: LoaderResponseControls;\n}",
8159
- "doc": "/**\n * Context a route `loader` receives: the route params, the request, a typed in-process `api` (an\n * {@link ApiProxy} for the app contract `Api`), and the platform `env`. Pair with `inProcessClient`.\n */"
8471
+ "name": "LiveBusInput",
8472
+ "kind": "type",
8473
+ "package": "@nifrajs/web",
8474
+ "signature": "export type LiveBusInput = LiveChange | LiveRevocation;"
8475
+ },
8476
+ {
8477
+ "name": "LiveBusListener",
8478
+ "kind": "interface",
8479
+ "package": "@nifrajs/web",
8480
+ "signature": "export interface LiveBusListener {\n /** The next event, in seq order. */\n event(event: LiveBusEvent): void;\n /**\n * Events up to `head` may be lost (a trimmed stream, a reconnect): what happened before `head` is\n * unknown, and delivery resumes with the events after it.\n */\n gap(head: number): void;\n /** The bus is unreachable; the next {@link gap} reports where delivery resumes. */\n down(): void;\n}"
8481
+ },
8482
+ {
8483
+ "name": "LiveBusSubscription",
8484
+ "kind": "interface",
8485
+ "package": "@nifrajs/web",
8486
+ "signature": "export interface LiveBusSubscription {\n /** The seq of the last event before delivery starts. */\n readonly head: number;\n close(): void;\n}"
8487
+ },
8488
+ {
8489
+ "name": "LiveChange",
8490
+ "kind": "interface",
8491
+ "package": "@nifrajs/web",
8492
+ "signature": "export interface LiveChange {\n readonly type: \"change\";\n readonly keys: readonly string[];\n}",
8493
+ "doc": "/** Something a loader declared with `ctx.live` changed. */"
8494
+ },
8495
+ {
8496
+ "name": "LiveClient",
8497
+ "kind": "interface",
8498
+ "package": "@nifrajs/web",
8499
+ "signature": "export interface LiveClient {\n /** Pass as `createClientRouter({ fetchData })`: every route load goes through the live load endpoint. */\n readonly fetchData: FetchRouteData;\n /** Keep what `router` shows fresh. Returns a function that stops and closes the socket. */\n attach(router: ClientRouter): () => void;\n}"
8500
+ },
8501
+ {
8502
+ "name": "LiveClientEntry",
8503
+ "kind": "interface",
8504
+ "package": "@nifrajs/web",
8505
+ "signature": "export interface LiveClientEntry {\n readonly path?: string;\n readonly loadPath?: string;\n}",
8506
+ "doc": "/** A client entry for a live server: `{}`, or the endpoints when the runtime moves them. */"
8507
+ },
8508
+ {
8509
+ "name": "LiveClientOptions",
8510
+ "kind": "interface",
8511
+ "package": "@nifrajs/web",
8512
+ "signature": "export interface LiveClientOptions {\n /** The live socket, as `live({ path })` serves it. Default `/_nifra/live`. */\n readonly path?: string;\n /** The live load endpoint, as `live({ loadPath })` serves it. Default `/_nifra/live/load`. */\n readonly loadPath?: string;\n /**\n * Sends every live load. Give one that adds an `Authorization` header when the app authenticates\n * that way; cookies are sent by default.\n */\n readonly fetch?: (input: string, init: RequestInit) => Promise<Response>;\n /** Route id to its layout ids, outermost first. The generated client entry passes its own table. */\n readonly layoutIdsOf?: Readonly<Record<string, readonly string[]>>;\n}"
8513
+ },
8514
+ {
8515
+ "name": "LiveHubObject",
8516
+ "kind": "class",
8517
+ "package": "@nifrajs/web",
8518
+ "signature": "export declare class LiveHubObject implements HubStore {\n private readonly state;\n private readonly ready;\n private readonly settings;\n private readonly sockets;\n private readonly topics;\n private readonly hash;\n private core;\n /** The last seq handed out, stored before its event is applied. */\n private seq;\n /** The last seq applied: a load's watermark. */\n private applied;\n /** The stored revocation floor. */\n private floor;\n /** Appends run one at a time, so history is recorded in seq order. */\n private chain;\n private alarmAt;\n private mismatchLogged;\n constructor(state: LiveHubState, options: LiveHubOptions);\n fetch(req: Request): Promise<Response>;\n webSocketMessage(raw: LiveHubWebSocket, message: string | ArrayBuffer): Promise<void>;\n webSocketClose(raw: LiveHubWebSocket): Promise<void>;\n webSocketError(raw: LiveHubWebSocket): Promise<void>;\n alarm(): Promise<void>;\n saved(ws: NifraWebSocket<LiveSocket>, socket: StoredSocket): void;\n removed(ws: NifraWebSocket<LiveSocket>): void;\n lastBeat(ws: NifraWebSocket<LiveSocket>): number;\n /** Everything the hub knows comes back from storage and the runtime's sockets; history does not. */\n private wake;\n private accept;\n private append;\n private applyNext;\n /** One frame to every socket on the topic whose grants are still valid. */\n private deliver;\n private left;\n /** Drop revocations every grant they could refuse has outlived. Returns the next one's deadline. */\n private pruneRevocations;\n private schedule;\n}"
8519
+ },
8520
+ {
8521
+ "name": "LiveHubOptions",
8522
+ "kind": "interface",
8523
+ "package": "@nifrajs/web",
8524
+ "signature": "export interface LiveHubOptions {\n /** The app's `live()` secret, or its rotation list. */\n readonly secret: string | readonly string[];\n /** The app's `live()` `appId`. Default `\"nifra\"`. */\n readonly appId?: string | undefined;\n /** The app's `live()` `grantTtl`, at most 3600. Default 600. */\n readonly grantTtl?: number | undefined;\n /** Origins besides the app's own that may open the socket. */\n readonly trustedOrigins?: readonly string[] | undefined;\n /** Sockets this hub holds; past it a socket is closed with 1013. Default {@link DEFAULT_HUB_SOCKETS}. */\n readonly maxSockets?: number | undefined;\n /**\n * Socket-tag subscriptions this hub holds in all; past it a watch is refused with 1013. The default,\n * {@link DEFAULT_HUB_MEMBERSHIPS}, keeps the hub's heap well inside a Durable Object's memory.\n */\n readonly maxMemberships?: number | undefined;\n /** Live loads per second the deployment absorbs after one change, for spreading reloads. Default 500. */\n readonly reloadRate?: number | undefined;\n /** The least time, in ms, clients spread their reloads over. Default 0. */\n readonly spreadFloor?: number | undefined;\n}"
8525
+ },
8526
+ {
8527
+ "name": "LiveHubState",
8528
+ "kind": "interface",
8529
+ "package": "@nifrajs/web",
8530
+ "signature": "export interface LiveHubState {\n readonly storage: LiveHubStorage;\n blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;\n acceptWebSocket(ws: LiveHubWebSocket): void;\n getWebSockets(): LiveHubWebSocket[];\n setWebSocketAutoResponse(pair?: unknown): void;\n getWebSocketAutoResponseTimestamp(ws: LiveHubWebSocket): Date | null;\n}",
8531
+ "doc": "/** The part of a Durable Object's state the hub uses (no Cloudflare types dependency). */"
8532
+ },
8533
+ {
8534
+ "name": "LiveHubStorage",
8535
+ "kind": "interface",
8536
+ "package": "@nifrajs/web",
8537
+ "signature": "export interface LiveHubStorage {\n get(keys: string[]): Promise<Map<string, unknown>>;\n put(entries: Record<string, unknown>): Promise<void>;\n delete(keys: string[]): Promise<number>;\n list(options: {\n prefix: string;\n end?: string;\n limit?: number;\n }): Promise<Map<string, unknown>>;\n getAlarm(): Promise<number | null>;\n setAlarm(scheduledTime: number): Promise<void>;\n}"
8538
+ },
8539
+ {
8540
+ "name": "LiveHubWebSocket",
8541
+ "kind": "interface",
8542
+ "package": "@nifrajs/web",
8543
+ "signature": "export interface LiveHubWebSocket {\n send(message: string | ArrayBuffer | ArrayBufferView): void;\n close(code?: number, reason?: string): void;\n readonly readyState: number;\n serializeAttachment(value: unknown): void;\n deserializeAttachment(): unknown;\n}",
8544
+ "doc": "/** A hibernatable server socket, as far as the hub uses one. */"
8545
+ },
8546
+ {
8547
+ "name": "LiveOptions",
8548
+ "kind": "interface",
8549
+ "package": "@nifrajs/web",
8550
+ "signature": "export interface LiveOptions {\n /**\n * The grant secret, or a rotation list with the newest first (at most 3, each at least 32 bytes).\n * Required in production; development falls back to a random per-process secret.\n */\n readonly secret?: string | readonly string[] | undefined;\n /**\n * Who the viewer is: a stable id, or `null` for an anonymous viewer. Called once per live load,\n * after middleware. A grant is only honored for the subject it was issued to.\n */\n readonly subject: (ctx: LoaderContext) => string | null | Promise<string | null>;\n /** Separates this app's tags from another app's that shares a secret. Default `\"nifra\"`. */\n readonly appId?: string;\n /** Grant lifetime in seconds, at most 3600. Default 600. */\n readonly grantTtl?: number;\n /** The live load endpoint. Default `/_nifra/live/load`. */\n readonly loadPath?: string;\n /** The live socket. Default `/_nifra/live`. */\n readonly path?: string;\n /** Origins besides the app's own that may call the load endpoint and open the socket. */\n readonly trustedOrigins?: readonly string[];\n /** Live loads running at once in this process; past it the endpoint answers 503. Default 64. */\n readonly maxConcurrentLoads?: number;\n /** Live sockets in this process; past it a socket is closed with 1013. Default 10,000. */\n readonly maxSockets?: number;\n /** Refuse new sockets while the process's resident memory is above this many bytes. */\n readonly maxRssBytes?: number;\n /**\n * The ordered log every process serving the app shares. Default: an in-process bus, right for one\n * process only.\n */\n readonly bus?: LiveBus;\n /**\n * Cloudflare Workers: the Durable Object namespace of the app's live hub (`liveHub()` from\n * `@nifrajs/web/live-hub`). The hub owns the log and holds the sockets; this isolate forwards the\n * socket handshake to it, asks it for the seq and the revocations each load needs, and publishes\n * through it. Exclusive with `bus`.\n */\n readonly hub?: LiveHubNamespace;\n /** Processes serving the app, for spreading reloads. Default 1. */\n readonly instances?: number;\n /** Live loads per second the deployment absorbs after one change, for spreading reloads. Default 500. */\n readonly reloadRate?: number;\n /** The least time, in ms, clients spread their reloads over. Default 0. */\n readonly spreadFloor?: number;\n /**\n * Re-check the keys of owners a load keeps without running their loaders. With it, `renew`\n * re-signs a grant without loaders (every third renewal still runs them all, so a lost change is\n * found within about 27 minutes); without it, `renew` runs a full load. `false` issues no grant.\n */\n readonly authorize?: (keys: readonly string[], ctx: LoaderContext) => boolean | Promise<boolean>;\n /**\n * Resolves once a committed write is readable by every loader, such as a read replica catching up.\n * `publish` waits for it, so no client reloads before its data can show the change. Replica-backed\n * reads need it; without it a publish goes out as soon as it is called.\n */\n readonly visible?: () => void | Promise<void>;\n /**\n * Let query hooks refetch on the keys a page's loaders grant (`useQuery(key, fn, { live })`). Each\n * live load then carries a salted digest of every key it grants: page code can confirm a guess at\n * one of them, so leave it off when key names hold anything the viewer should not see.\n */\n readonly queryKeys?: boolean;\n}"
8551
+ },
8552
+ {
8553
+ "name": "LiveRevocation",
8554
+ "kind": "interface",
8555
+ "package": "@nifrajs/web",
8556
+ "signature": "export interface LiveRevocation {\n readonly type: \"revoke\";\n readonly sub: string | null;\n readonly key: string | null;\n}",
8557
+ "doc": "/**\n * Grants issued before this event stop working: every grant (`sub` and `key` null), one subject's\n * (`key` null), or, with `key`, any grant holding that key (for everyone, or for `sub`).\n */"
8558
+ },
8559
+ {
8560
+ "name": "LoadGoogleFontIO",
8561
+ "kind": "interface",
8562
+ "package": "@nifrajs/web",
8563
+ "signature": "export interface LoadGoogleFontIO {\n /** Directory to write the hashed `.woff2` files into (created if missing). */\n readonly outDir: string;\n /** URL prefix the files are served under. Defaults to `\"/fonts\"`. */\n readonly publicPath?: string;\n /** Injectable `fetch` (defaults to the global). Tests pass a canned implementation. */\n readonly fetch?: typeof fetch;\n /** Injectable writer (defaults to `node:fs`). Tests pass an in-memory sink. */\n readonly writeFile?: (path: string, bytes: Uint8Array) => Promise<void>;\n /** Per-file download cap in bytes. Defaults to 5 MB (real woff2 are well under 1 MB). */\n readonly maxBytesPerFile?: number;\n}"
8564
+ },
8565
+ {
8566
+ "name": "LoadGoogleFontResult",
8567
+ "kind": "interface",
8568
+ "package": "@nifrajs/web",
8569
+ "signature": "export interface LoadGoogleFontResult {\n readonly family: string;\n /** A self-hosted `@font-face` stylesheet (one rule per written file). Import it from your app. */\n readonly css: string;\n /** Every file written to `outDir`. */\n readonly assets: readonly FontAsset[];\n /** `fontPreload()` link-attribute sets - spread the ones you want into a layout's `meta.link`.\n * Preloading *every* weight/subset is wasteful; usually preload just the primary subset + weight. */\n readonly preloads: readonly LinkDescriptor[];\n}"
8570
+ },
8571
+ {
8572
+ "name": "Loader",
8573
+ "kind": "type",
8574
+ "package": "@nifrajs/web",
8575
+ "signature": "export type Loader = (ctx: LoaderContext) => unknown | Promise<unknown>;",
8576
+ "doc": "/** A route's optional data loader: params/request in, data out. */"
8577
+ },
8578
+ {
8579
+ "name": "LoaderArgs",
8580
+ "kind": "interface",
8581
+ "package": "@nifrajs/client",
8582
+ "signature": "export interface LoaderArgs<Api, Env = unknown, Search = undefined> {\n readonly params: Record<string, string>;\n readonly request: Request;\n /** Alias of {@link request} - the same `Request`. Mirrors a route handler's `c.req`, so the same name\n * works in loaders/actions and routes (no `ctx.request` vs `c.req` mismatch). */\n readonly req: Request;\n readonly api: ApiProxy<Api>;\n /**\n * Platform bindings (Workers `env` - KV/D1/secrets), forwarded from the request `c.env`.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape via the second type argument -\n * `LoaderArgs<typeof app, Env>` (the same `Env` the backend's `server<Env>()` uses) - to read it\n * typed; otherwise `unknown`. Validate at the trust boundary before use.\n */\n readonly env: Env;\n /** `true` when the request carries a valid draft/preview cookie (when the app sets a `draftSecret`;\n * otherwise always `false`). Branch on it to load unpublished content for editors - see `enableDraft`. */\n readonly draft: boolean;\n /** The URL search params, validated server-side (fails closed to the schema's defaults, so it is safe\n * to use directly). Declare a route `searchSchema` and pass its type as the third argument -\n * `LoaderArgs<typeof app, Env, typeof searchSchema>` - to read it typed; otherwise a raw\n * `Record<string, unknown>` of the parsed query. */\n readonly search: Search extends StandardSchemaV1 ? InferOutput<Search> extends Record<string, unknown> ? InferOutput<Search> : never : Record<string, unknown>;\n /** Response headers and cookies for this page request: `ctx.set.headers[\"cache-control\"] = ...`,\n * `ctx.set.cookie(\"theme\", \"dark\")`. */\n readonly set: LoaderResponseControls;\n /** Declare what this loader's data depends on (`ctx.live(\"post:42\")`), so a live page reloads it\n * when one of those keys changes. Does nothing unless the app configures `live`. */\n readonly live: (...keys: string[]) => void;\n}",
8583
+ "doc": "/**\n * Context a route `loader` receives: the route params, the request, a typed in-process `api` (an\n * {@link ApiProxy} for the app contract `Api`), and the platform `env`. Pair with `inProcessClient`.\n */"
8160
8584
  },
8161
8585
  {
8162
8586
  "name": "LoaderContext",
8163
8587
  "kind": "interface",
8164
8588
  "package": "@nifrajs/web",
8165
- "signature": "export interface LoaderContext {\n readonly params: Record<string, string>;\n readonly request: Request;\n /** Alias of {@link request} - mirrors a route handler's `c.req` so the same name works in both. */\n readonly req: Request;\n readonly api: unknown;\n /** Platform bindings forwarded from the request `c.env` (Workers env/KV/D1). Opaque here. */\n readonly env: unknown;\n /** `true` when the request carries a valid draft/preview cookie (only when `createWebApp` is given a\n * `draftSecret`; otherwise always `false`). Branch on it to load unpublished content for editors. */\n readonly draft: boolean;\n /** The URL search params, validated against the route's `searchSchema` (a Standard Schema) when it\n * declares one - failing closed to the schema's defaults - else the raw parsed query. Typed per-route\n * via `@nifrajs/client`'s `LoaderArgs<Api, Env, Search>`. */\n readonly search: Record<string, unknown>;\n /** Response headers and cookies for this page request. */\n readonly set: LoaderResponseControls;\n}",
8589
+ "signature": "export interface LoaderContext {\n readonly params: Record<string, string>;\n readonly request: Request;\n /** Alias of {@link request} - mirrors a route handler's `c.req` so the same name works in both. */\n readonly req: Request;\n readonly api: unknown;\n /** Platform bindings forwarded from the request `c.env` (Workers env/KV/D1). Opaque here. */\n readonly env: unknown;\n /** `true` when the request carries a valid draft/preview cookie (only when `createWebApp` is given a\n * `draftSecret`; otherwise always `false`). Branch on it to load unpublished content for editors. */\n readonly draft: boolean;\n /** The URL search params, validated against the route's `searchSchema` (a Standard Schema) when it\n * declares one - failing closed to the schema's defaults - else the raw parsed query. Typed per-route\n * via `@nifrajs/client`'s `LoaderArgs<Api, Env, Search>`. */\n readonly search: Record<string, unknown>;\n /** Response headers and cookies for this page request. */\n readonly set: LoaderResponseControls;\n /**\n * Declare what this loader's data depends on, as keys in the cache-tag charset. In a live load\n * (`createWebApp({ live })`) the page reloads this data when one of them changes; elsewhere it does\n * nothing. Keys count only when the loader resolves, and must be declared before it does.\n */\n readonly live: (...keys: string[]) => void;\n}",
8166
8590
  "doc": "/** Context passed to a route `loader`. The `api` + `env` are injected by `createWebApp` and typed\n * per-route via `@nifrajs/client`'s `LoaderArgs<Api, Env>` (here they are opaque to the agnostic core). */"
8167
8591
  },
8168
8592
  {
@@ -8374,6 +8798,13 @@
8374
8798
  "signature": "export type LoopDelayMonitor = (resolutionMs: number) => LoopDelayHistogram | undefined;",
8375
8799
  "doc": "/**\n * Acquires a loop-delay histogram for a resolution, or `undefined` when the runtime has none. This is\n * an optional test/runtime seam; the default sampler is a portable timer-drift monitor.\n */"
8376
8800
  },
8801
+ {
8802
+ "name": "MAX_ATTACHMENT_BYTES",
8803
+ "kind": "const",
8804
+ "package": "@nifrajs/web",
8805
+ "signature": "export declare const MAX_ATTACHMENT_BYTES = 512;",
8806
+ "doc": "/** Per-socket limits the platform sets; the hub stays well under both (see the tests). */"
8807
+ },
8377
8808
  {
8378
8809
  "name": "MAX_COST_AXES",
8379
8810
  "kind": "const",
@@ -8407,6 +8838,19 @@
8407
8838
  "signature": "export declare const MAX_MEDIA_QUERY_LENGTH = 256;",
8408
8839
  "doc": "/** The maximum media-query length accepted from an HTML data attribute. */"
8409
8840
  },
8841
+ {
8842
+ "name": "MAX_SOCKET_RECORD_BYTES",
8843
+ "kind": "const",
8844
+ "package": "@nifrajs/web",
8845
+ "signature": "export declare const MAX_SOCKET_RECORD_BYTES = 30720;"
8846
+ },
8847
+ {
8848
+ "name": "MAX_STDIO_MESSAGE_BYTES",
8849
+ "kind": "const",
8850
+ "package": "@nifrajs/mcp",
8851
+ "signature": "export declare const MAX_STDIO_MESSAGE_BYTES: number;",
8852
+ "doc": "/** Default cap on one message, in either direction, in UTF-8 bytes. */"
8853
+ },
8410
8854
  {
8411
8855
  "name": "MAX_TRANSPORT_BYTES",
8412
8856
  "kind": "const",
@@ -8674,7 +9118,7 @@
8674
9118
  "name": "McpServer",
8675
9119
  "kind": "interface",
8676
9120
  "package": "@nifrajs/mcp",
8677
- "signature": "export interface McpServer {\n readonly tools: McpTool[];\n readonly features: McpServerFeatures;\n readonly serverInfo: {\n name: string;\n version: string;\n };\n /** Web `fetch` handler - mount at `POST /mcp` (GET is a health page, OPTIONS the CORS preflight). */\n fetch(request: Request, overrides?: Pick<McpHttpOptions, \"authorizeMessage\" | \"state\" | \"resolveState\">): Promise<Response>;\n /** Dispatch one JSON-RPC message directly (no HTTP) - for headless verification and unit tests. */\n handle(message: JsonRpcRequest): Promise<JsonRpcResponse | null>;\n /**\n * Release server-owned resources, when the implementation has any (for example a database worker).\n * Calling it more than once is safe. The base MCP server has nothing to release and omits this hook.\n */\n readonly close?: () => Promise<void>;\n}"
9121
+ "signature": "export interface McpServer {\n readonly tools: McpTool[];\n readonly features: McpServerFeatures;\n readonly serverInfo: {\n name: string;\n version: string;\n };\n /** Web `fetch` handler - mount for `POST`, `GET` and `OPTIONS` at `/mcp` (GET is a health page,\n * OPTIONS the CORS preflight). */\n fetch(request: Request, overrides?: Pick<McpHttpOptions, \"authorizeMessage\" | \"state\" | \"resolveState\">): Promise<Response>;\n /** Dispatch one JSON-RPC message directly (no HTTP) - for headless verification and unit tests. */\n handle(message: JsonRpcRequest): Promise<JsonRpcResponse | null>;\n /**\n * Release server-owned resources, when the implementation has any (for example a database worker).\n * Calling it more than once is safe. The base MCP server has nothing to release and omits this hook.\n */\n readonly close?: () => Promise<void>;\n}"
8678
9122
  },
8679
9123
  {
8680
9124
  "name": "McpServerConfig",
@@ -8866,7 +9310,7 @@
8866
9310
  "name": "MemoryIdempotencyStore",
8867
9311
  "kind": "class",
8868
9312
  "package": "@nifrajs/middleware",
8869
- "signature": "export declare class MemoryIdempotencyStore implements IdempotencyStore {\n private readonly entries;\n private readonly maxEntries;\n private readonly maxKeyBytes;\n constructor(options?: MemoryIdempotencyStoreOptions);\n private validateKey;\n private maintain;\n private reserve;\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n complete(key: string, reservation: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;\n release(key: string, reservation: string): Promise<boolean>;\n}",
9313
+ "signature": "export declare class MemoryIdempotencyStore implements IdempotencyStore {\n private readonly entries;\n private readonly maxEntries;\n private readonly maxKeyBytes;\n constructor(options?: MemoryIdempotencyStoreOptions);\n private validateKey;\n private maintain;\n private reserve;\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n complete(key: string, reservation: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;\n release(key: string, reservation: string): Promise<boolean>;\n renew(key: string, reservation: string, lockTtlMs: number): Promise<boolean>;\n}",
8870
9314
  "doc": "/** In-process store. Refuses to run in production unless explicitly allowed (per-instance ⇒ no cross-instance dedupe). */"
8871
9315
  },
8872
9316
  {
@@ -8953,14 +9397,14 @@
8953
9397
  "name": "MemoryStore",
8954
9398
  "kind": "class",
8955
9399
  "package": "@nifrajs/middleware",
8956
- "signature": "export declare class MemoryStore implements RateLimitStore {\n private readonly windows;\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 sweepExpired;\n private enforceMaxKeys;\n}",
8957
- "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 oldest active keys).\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 */"
9400
+ "signature": "export declare class MemoryStore implements RateLimitStore {\n private readonly windows;\n private scan;\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 sweepExpired;\n private reclaimExpired;\n}",
9401
+ "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 */"
8958
9402
  },
8959
9403
  {
8960
9404
  "name": "MemoryStoreOptions",
8961
9405
  "kind": "interface",
8962
9406
  "package": "@nifrajs/middleware",
8963
- "signature": "export interface MemoryStoreOptions {\n /** Allow the in-memory store in production. Off by default - a per-instance limiter is unsafe across instances. */\n readonly allowInProduction?: boolean;\n /** Hard cap on tracked client keys; expired keys are evicted first, then oldest active keys. Default `100_000`.\n * Bounds memory against an unbounded key space (bot scans, per-IP buckets). */\n readonly maxKeys?: number;\n /** Minimum interval (ms) between amortized sweeps of expired windows. Default `30_000`. */\n readonly sweepIntervalMs?: number;\n}"
9407
+ "signature": "export interface MemoryStoreOptions {\n /** Allow the in-memory store in production. Off by default - a per-instance limiter is unsafe across instances. */\n readonly allowInProduction?: boolean;\n /** Hard cap on tracked client keys; expired keys are reclaimed, and new keys fail closed at capacity. Default `100_000`.\n * Bounds memory against an unbounded key space (bot scans, per-IP buckets). */\n readonly maxKeys?: number;\n /** Minimum interval (ms) between amortized sweeps of expired windows. Default `30_000`. */\n readonly sweepIntervalMs?: number;\n}"
8964
9408
  },
8965
9409
  {
8966
9410
  "name": "MemoryToolIdempotencyStore",
@@ -9309,12 +9753,6 @@
9309
9753
  "package": "@nifrajs/graphql",
9310
9754
  "signature": "export interface MountGraphqlOptions<Context = unknown, Env = unknown> extends Omit<GraphqlHttpOptions<Context, Env>, \"nifra\"> {\n /** Endpoint path. Default `/graphql`. */\n readonly path?: string;\n /** Enable `GET /graphql` (queries only). Default `true`. */\n readonly enableGet?: boolean;\n /**\n * Enable `graphql-transport-ws` subscriptions on the same path. Pass `true` to reuse `schema`,\n * `context`, `authorize` (run on the upgrade request) and the query limits, or pass the WS options.\n * With `authorize` set, WS options must bring their own `authorize` or `onConnect`; the mount throws\n * otherwise, since every socket would be admitted. Requires `.use(websocket())` and `graphql-ws`.\n */\n readonly subscriptions?: boolean | GraphqlWsOptions<Record<string, unknown>>;\n}"
9311
9755
  },
9312
- {
9313
- "name": "MountIslandOptions",
9314
- "kind": "interface",
9315
- "package": "@nifrajs/islets",
9316
- "signature": "export interface MountIslandOptions {\n readonly root?: BindableRoot;\n}"
9317
- },
9318
9756
  {
9319
9757
  "name": "MountOptions",
9320
9758
  "kind": "interface",
@@ -9877,14 +10315,14 @@
9877
10315
  "name": "NifraWebSocket",
9878
10316
  "kind": "interface",
9879
10317
  "package": "@nifrajs/core",
9880
- "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 (optional code 1000-4999 + short reason). */\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}",
10318
+ "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}",
9881
10319
  "doc": "/** The portable socket handed to WS lifecycle callbacks. Each adapter wraps its native socket. */"
9882
10320
  },
9883
10321
  {
9884
10322
  "name": "NifraWebSocket",
9885
10323
  "kind": "interface",
9886
10324
  "package": "nifra",
9887
- "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 (optional code 1000-4999 + short reason). */\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}",
10325
+ "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}",
9888
10326
  "doc": "/** The portable socket handed to WS lifecycle callbacks. Each adapter wraps its native socket. */"
9889
10327
  },
9890
10328
  {
@@ -10205,7 +10643,7 @@
10205
10643
  "kind": "interface",
10206
10644
  "package": "@nifrajs/schema",
10207
10645
  "signature": "export interface OpenAPIInfo {\n readonly title: string;\n readonly version: string;\n readonly description?: string;\n}",
10208
- "doc": "/**\n * OpenAPI 3.1 generation. We model a practical slice of the spec - enough to feed Swagger UI / codegen\n * and to validate structurally: paths, parameters, request bodies, responses (incl. non-200 and\n * non-JSON), tags, security, servers, and `$ref` reuse via `components.schemas`.\n *\n * Schemas carry full detail only for `t`/TypeBox inputs (they expose a JSON Schema); a BYO Standard\n * Schema validates at runtime but exposes no JSON Schema, so its route is emitted without body/response\n * detail. A **contract** is richest - its operations carry `response`, `tags`, `security`, additional\n * `responses`, etc.; an **app** emits request shapes + a generic `200` (an inline handler has no\n * response *schema* to serialize), enrichable via `options.operations`.\n *\n * A typed SSE route (`app.sse()`) answers `text/event-stream`, and its event payload becomes a named\n * component (`<OperationId>Event`, or one named after the path) so a client generator emits a type\n * for it. With `openapiVersion: \"3.2.0\"` the media type carries the standard `itemSchema` describing\n * each event; a 3.1 document has no field for that, so it carries the same schema as `x-itemSchema`.\n */"
10646
+ "doc": "/**\n * OpenAPI 3.1 generation. We model a practical slice of the spec - enough to feed Swagger UI / codegen\n * and to validate structurally: paths, parameters, request bodies, responses (incl. non-200 and\n * non-JSON), tags, security, servers, and `$ref` reuse via `components.schemas`.\n *\n * Schemas carry full detail for `t`/TypeBox schemas and for a Standard Schema that also implements\n * Standard JSON Schema (`~standard.jsonSchema`, as zod 4 does): requests are described by its input\n * side, responses by its output side. One that exposes neither validates at runtime but is emitted\n * without body/response detail. A **contract** is richest - its operations carry `response`, `tags`,\n * `security`, additional `responses`, etc.; an **app** emits request shapes + a generic `200` (an\n * inline handler has no response *schema* to serialize), enrichable via `options.operations`.\n *\n * Every operation also lists the errors the framework answers before its handler runs, as the shared\n * `NifraError` / `NifraValidationError` components: 400, 413 and 415 for a body, 422 for any request\n * schema (left out when an `onValidationError` hook writes that body). A declared response wins.\n * A union whose members all pin one required property to distinct values becomes a `oneOf` with a\n * `discriminator`, so a generator can emit a tagged union instead of trying each member in turn.\n *\n * A typed SSE route (`app.sse()`) answers `text/event-stream`, and its event payload becomes a named\n * component (`<OperationId>Event`, or one named after the path) so a client generator emits a type\n * for it. With `openapiVersion: \"3.2.0\"` the media type carries the standard `itemSchema` describing\n * each event; a 3.1 document has no field for that, so it carries the same schema as `x-itemSchema`.\n */"
10209
10647
  },
10210
10648
  {
10211
10649
  "name": "OpenAPIServer",
@@ -10293,13 +10731,13 @@
10293
10731
  "name": "OrchestrationHostOptions",
10294
10732
  "kind": "interface",
10295
10733
  "package": "@nifrajs/coding-agent",
10296
- "signature": "export interface OrchestrationHostOptions {\n readonly catalog: StepCatalog;\n readonly limits?: OrchestrationLimits;\n /** Kernel step ceiling per layer. Generous by default so a full 256-node layer runs. */\n readonly maxSteps?: number;\n readonly maxDepth?: number;\n /**\n * Authoritative admission policy. When set, {@link OrchestrationHost.admit} refuses any capability\n * descriptor that asks to run outside the policy's kinds, capability allowlist, isolation floor, or\n * approval requirement. A descriptor, plan, model, or extension cannot override it.\n */\n readonly policy?: HostPolicy;\n /**\n * Called when a subagent node's run returns while its executor, which ignored the abort, keeps\n * running. `limits.maxAbandonedSubagents` bounds how many may run at once across all runs.\n */\n onSubagentAbandoned?(runId: string, nodeId: string, abandonment: SubagentAbandonment): void;\n /**\n * Called when a node fails, with what it threw or why a verify gate refused. Evidence and\n * {@link RunResult} stay content-free, so this is the only place the text goes: mask anything\n * sensitive before keeping it. A throw here is ignored.\n */\n onStepFailed?(runId: string, nodeId: string, failure: StepFailure): void;\n}"
10734
+ "signature": "export interface OrchestrationHostOptions {\n readonly catalog: StepCatalog;\n readonly limits?: OrchestrationLimits;\n /** Kernel step ceiling per layer. Generous by default so a full 256-node layer runs. */\n readonly maxSteps?: number;\n readonly maxDepth?: number;\n /**\n * Authoritative admission policy. When set, {@link OrchestrationHost.admit} refuses any capability\n * descriptor that asks to run outside the policy's kinds, capability allowlist, isolation floor, or\n * approval requirement, and its capability allowlist bounds every catalog step a submitted plan\n * resolves to, under any narrower `limits.allowedCapabilities`. A descriptor, plan, model, or\n * extension cannot override it.\n */\n readonly policy?: HostPolicy;\n /**\n * Called when a subagent node's run returns while its executor, which ignored the abort, keeps\n * running. `limits.maxAbandonedSubagents` bounds how many may run at once across all runs.\n */\n onSubagentAbandoned?(runId: string, nodeId: string, abandonment: SubagentAbandonment): void;\n /**\n * Called when a node fails, with what it threw or why a verify gate refused. Evidence and\n * {@link RunResult} stay content-free, so this is the only place the text goes: mask anything\n * sensitive before keeping it. A throw here is ignored.\n */\n onStepFailed?(runId: string, nodeId: string, failure: StepFailure): void;\n}"
10297
10735
  },
10298
10736
  {
10299
10737
  "name": "OrchestrationLimits",
10300
10738
  "kind": "interface",
10301
10739
  "package": "@nifrajs/coding-agent",
10302
- "signature": "export interface OrchestrationLimits {\n /** Total nodes in the whole tree. Default 256. */\n readonly maxNodes?: number;\n /** Maximum structural nesting depth. Default 8. */\n readonly maxDepth?: number;\n /** Host concurrency ceiling for any parallel layer or node. Default: the child count. */\n readonly maxParallel?: number;\n /** Bounded-subagent child ceiling. Default 4. */\n readonly maxChildren?: number;\n /** Capability authority ceiling. `undefined` grants all; otherwise a step's needs must be a subset. */\n readonly allowedCapabilities?: readonly string[];\n /** Refuse a subagent node while this many abandoned subagent executors still run. Default: no bound. */\n readonly maxAbandonedSubagents?: number;\n}",
10740
+ "signature": "export interface OrchestrationLimits {\n /** Total nodes in the whole tree. Default 256. */\n readonly maxNodes?: number;\n /** Maximum structural nesting depth. Default 8. */\n readonly maxDepth?: number;\n /** Host concurrency ceiling for any parallel layer or node. Default: the child count. */\n readonly maxParallel?: number;\n /** Subagents one run may start, a retry's attempts included. Default 4. */\n readonly maxChildren?: number;\n /** Capability authority ceiling. `undefined` grants all; otherwise a step's needs must be a subset. */\n readonly allowedCapabilities?: readonly string[];\n /** Refuse a subagent node while this many abandoned subagent executors still run. Default: no bound. */\n readonly maxAbandonedSubagents?: number;\n}",
10303
10741
  "doc": "/** Host-owned ceilings. A plan can only tighten, never widen, these. */"
10304
10742
  },
10305
10743
  {
@@ -10433,12 +10871,39 @@
10433
10871
  "package": "@nifrajs/core",
10434
10872
  "signature": "export interface OwnedEffectTransitions<T> {\n intent?(context: OwnedEffectContext): void | PromiseLike<void>;\n executing?(context: OwnedEffectContext): void | PromiseLike<void>;\n committed?(context: OwnedEffectContext, result: T): void | PromiseLike<void>;\n failed?(context: OwnedEffectContext, input: {\n readonly began: boolean;\n readonly errorCode: string;\n readonly error: unknown;\n }): void | PromiseLike<void>;\n}"
10435
10873
  },
10874
+ {
10875
+ "name": "PAGE_HIDE_EVENT",
10876
+ "kind": "const",
10877
+ "package": "@nifrajs/web",
10878
+ "signature": "export declare const PAGE_HIDE_EVENT = \"nifra:pagehide\";",
10879
+ "doc": "/** Dispatched on a kept page's element as the router hides it (`keepAlive`), while it is still in the\n * document and before the router's subscribers see the state that hides it. */"
10880
+ },
10881
+ {
10882
+ "name": "PAGE_SHOW_EVENT",
10883
+ "kind": "const",
10884
+ "package": "@nifrajs/web",
10885
+ "signature": "export declare const PAGE_SHOW_EVENT = \"nifra:pageshow\";",
10886
+ "doc": "/** Dispatched on a kept page's element once it is shown again. */"
10887
+ },
10888
+ {
10889
+ "name": "PPR_DEFAULTS",
10890
+ "kind": "const",
10891
+ "package": "@nifrajs/web",
10892
+ "signature": "export declare const PPR_DEFAULTS: ResolvedPprOptions;"
10893
+ },
10436
10894
  {
10437
10895
  "name": "PREDICTION_LAB_SEED",
10438
10896
  "kind": "const",
10439
10897
  "package": "@nifrajs/testing",
10440
10898
  "signature": "export declare const PREDICTION_LAB_SEED = 1347568964;"
10441
10899
  },
10900
+ {
10901
+ "name": "PREFETCH_HEADER",
10902
+ "kind": "const",
10903
+ "package": "@nifrajs/web",
10904
+ "signature": "export declare const PREFETCH_HEADER = \"x-nifra-prefetch\";",
10905
+ "doc": "/**\n * Sent beside {@link DATA_HEADER} by a prefetch. A partially prerendered route answers it with its\n * shell data and starts no hole: nothing could cancel that work if the link is never followed.\n */"
10906
+ },
10442
10907
  {
10443
10908
  "name": "PRE_HYDRATION_GUARD",
10444
10909
  "kind": "const",
@@ -10480,6 +10945,13 @@
10480
10945
  "signature": "export interface PageLocales {\n /** The default locale's key. */\n readonly default: string;\n /** Every served locale, in registry order. */\n readonly locales: readonly PageLocale[];\n}",
10481
10946
  "doc": "/** The served locales, handed to the client so it names a page's locale from its path the way the\n * server does. */"
10482
10947
  },
10948
+ {
10949
+ "name": "PageView",
10950
+ "kind": "interface",
10951
+ "package": "@nifrajs/web",
10952
+ "signature": "export interface PageView {\n /** Put back the inner scroll offsets and the focus, once the page is in the document again. */\n restore(): void;\n}",
10953
+ "doc": "/** What a page showed as it was hidden, put back by {@link PageView.restore}. */"
10954
+ },
10483
10955
  {
10484
10956
  "name": "PagedStorageAdapter",
10485
10957
  "kind": "interface",
@@ -10814,6 +11286,40 @@
10814
11286
  "package": "@nifrajs/middleware",
10815
11287
  "signature": "export interface PoweredByOptions {\n /** Header name. Default `\"x-powered-by\"`. */\n readonly header?: string;\n /** Header value. Default `\"Nifra\"`. */\n readonly value?: string;\n /** Do not overwrite an existing header by default. */\n readonly respectExisting?: boolean;\n}"
10816
11288
  },
11289
+ {
11290
+ "name": "PprConfig",
11291
+ "kind": "interface",
11292
+ "package": "@nifrajs/web",
11293
+ "signature": "export interface PprConfig {\n /** From `compileShells` for this deployment; `\"unchecked-development\"` is refused in production. */\n readonly shellChecks: ShellCheckRecord | \"unchecked-development\";\n /** Overrides for the defaults in `PPR_DEFAULTS`. */\n readonly options?: PprOptions;\n /**\n * The deployment's public origin, such as `https://shop.example`, given to `shellLoader` and to the\n * shell's `meta` as `origin`. Without it both get `\"\"`: a shell is shared, so no visitor's Host\n * header may supply it.\n */\n readonly origin?: string;\n /**\n * A store the app's processes share, such as `new KVCacheStore(env.SHELLS)`, behind each process's\n * own shells and shared hole frames: a process that has not built one reads it from here. Needs\n * `storeSecret` and checked shells. A route whose tags the store cannot drop keeps its entries\n * in-process.\n */\n readonly store?: CacheStore;\n /**\n * Signs every entry written to `store`, so a store other services can write cannot hand visitors\n * a page this app did not build. At least 32 characters, the same in every process.\n */\n readonly storeSecret?: string;\n /**\n * The platform's name for this deployment, such as a commit or a version id. Shells are already\n * kept apart by the client build and by each route's checked shell code; this adds to that.\n */\n readonly deployment?: string;\n}"
11294
+ },
11295
+ {
11296
+ "name": "PprOptions",
11297
+ "kind": "interface",
11298
+ "package": "@nifrajs/web",
11299
+ "signature": "export interface PprOptions {\n /** A hole's deadline when its boundary sets no `timeout`. */\n readonly holeTimeoutMs?: number;\n /** The largest `timeout` a boundary may set, and the cap on a route's total deadline. */\n readonly maxHoleTimeoutMs?: number;\n /** Added to the largest hole timeout to give the route's total deadline. */\n readonly totalDeadlineSlackMs?: number;\n /** Dynamic plus shared boundaries one PPR route may declare. */\n readonly maxHolesPerRoute?: number;\n /** Shell entries one route may keep in the memory store. */\n readonly shellEntriesPerRoute?: number;\n /**\n * Bytes every shell entry in the memory store may hold together: its document, an estimate of the\n * heap its loader data holds, and its key. An entry over the whole budget is served but not kept.\n */\n readonly shellStoreBytes?: number;\n /** How long a `notFound()` shell is cached. */\n readonly notFoundTtlSeconds?: number;\n /** Shell builds one route may run at once; requests over it get the blocking render. */\n readonly shellBuildConcurrency?: number;\n /**\n * Once the store is full, requests one shell key must see before its shell is built and may push\n * an older one out. The ones before stream the page whole, each hole as it settles, so a path\n * visited once cannot evict a popular one. While the store has room, every key builds at once.\n */\n readonly shellAfterRequests?: number;\n /** A failing rebuild keeps serving the stale shell for `revalidate` times this... */\n readonly staleOnErrorFactor?: number;\n /** ...but never longer than this. */\n readonly maxStaleOnErrorSeconds?: number;\n /** Requests that get the blocking render instead of a stream: a user-agent pattern or a predicate. */\n readonly blockingFor?: RegExp | ((request: Request) => boolean);\n /** Abandoned invocations at which one boundary stops being admitted. */\n readonly boundaryAbandonedTrip?: number;\n /** Abandoned invocations per process at which boundaries holding any stop being admitted. */\n readonly processAbandonedTrip?: number;\n /** Abandoned invocations per process at which no hole is admitted. */\n readonly admissionStop?: number;\n /** How long after its abort a still-pending invocation counts as abandoned. */\n readonly abandonGraceMs?: number;\n /** PPR responses per process with hole loaders still running. */\n readonly maxHoleWork?: number;\n /** How long after the total deadline an undrained stream is kept before it is aborted. */\n readonly writeGraceMs?: number;\n /** Unsent bytes one response may queue. */\n readonly maxUnsentBytesPerResponse?: number;\n /** Unsent bytes every PPR response in the process may queue together. */\n readonly maxUnsentBytes?: number;\n /** Serialized size of one hole frame. */\n readonly frameBytes?: number;\n /** The shell is padded to at least this many bytes; Safari holds back smaller first chunks. */\n readonly minShellBytes?: number;\n /**\n * When hole HTML is checked for script, handlers and other escapes before it is framed:\n * `\"always\"`, or `\"development\"` only. The check costs about 20 us per KB of hole HTML; turn it off\n * in production only when a strict CSP already blocks inline script.\n */\n readonly holeHtmlValidation?: \"always\" | \"development\";\n /**\n * Whether a page left with holes pending posts a cancel beacon, so their loaders stop before their\n * deadline. Off by default on Cloudflare Workers, where the beacon reaches another isolate.\n */\n readonly cancelBeacon?: boolean;\n /**\n * How long a process serves a shell or shared hole it wrote to or read from the shared store before\n * reading it there again, so a purge another process made reaches this one. 0 reads it every time.\n */\n readonly sharedRecheckMs?: number;\n}",
11300
+ "doc": "/** Overrides for {@link PPR_DEFAULTS}. Every field is optional; an omitted one keeps its default. */"
11301
+ },
11302
+ {
11303
+ "name": "PprSetup",
11304
+ "kind": "interface",
11305
+ "package": "@nifrajs/web",
11306
+ "signature": "export interface PprSetup {\n readonly [PPR_SETUP]: (environment: PprEnvironment) => PprIntegration;\n}",
11307
+ "doc": "/** What `partialPrerendering()` returns for `createWebApp({ experimental: { ppr } })`. */"
11308
+ },
11309
+ {
11310
+ "name": "PprShells",
11311
+ "kind": "interface",
11312
+ "package": "@nifrajs/web",
11313
+ "signature": "export interface PprShells {\n /**\n * Drop every shell and shared hole frame whose `revalidateTags` listed `tag`, here and in the\n * shared store; a build of either running now is not kept.\n */\n invalidateTag(tag: string): Promise<void>;\n stats(): PprStats;\n}",
11314
+ "doc": "/** One app's shell cache. */"
11315
+ },
11316
+ {
11317
+ "name": "PprStats",
11318
+ "kind": "type",
11319
+ "package": "@nifrajs/web",
11320
+ "signature": "export type PprStats = PprServerStats;",
11321
+ "doc": "/** Admission, shedding and unsent-byte counters of one app's partially prerendered responses. */"
11322
+ },
10817
11323
  {
10818
11324
  "name": "PredictedExecutionResult",
10819
11325
  "kind": "interface",
@@ -11086,7 +11592,7 @@
11086
11592
  "name": "ProjectEvidenceSchema",
11087
11593
  "kind": "interface",
11088
11594
  "package": "@nifrajs/core",
11089
- "signature": "export interface ProjectEvidenceSchema {\n /** Set only when the route chose it; absent means the default for its auth stages. */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n readonly bodyLimit?: number | \"unlimited\";\n readonly bodyLimitReason?: string;\n readonly headers?: ProjectEvidenceSchemaPart;\n readonly cookies?: ProjectEvidenceSchemaPart;\n readonly body?: ProjectEvidenceSchemaPart;\n readonly query?: ProjectEvidenceSchemaPart;\n readonly params?: ProjectEvidenceSchemaPart;\n readonly response?: ProjectEvidenceSchemaPart;\n readonly errors?: Readonly<Record<string, ProjectEvidenceSchemaPart>>;\n readonly sse?: ProjectEvidenceSchemaPart;\n}"
11595
+ "signature": "export interface ProjectEvidenceSchema {\n /** Set only when the route chose it; absent means the default for its auth stages. */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n readonly bodyLimit?: number | \"unlimited\";\n readonly bodyLimitReason?: string;\n readonly headers?: ProjectEvidenceSchemaPart;\n readonly cookies?: ProjectEvidenceSchemaPart;\n readonly body?: ProjectEvidenceSchemaPart;\n readonly query?: ProjectEvidenceSchemaPart;\n readonly params?: ProjectEvidenceSchemaPart;\n readonly response?: ProjectEvidenceSchemaPart;\n readonly errors?: Readonly<Record<string, ProjectEvidenceSchemaPart>>;\n readonly sse?: ProjectEvidenceSchemaPart;\n /** Set when an `onValidationError` hook answers the route's validation failures. */\n readonly validationErrorHook?: true;\n}"
11090
11596
  },
11091
11597
  {
11092
11598
  "name": "ProjectEvidenceSchemaPart",
@@ -11302,7 +11808,7 @@
11302
11808
  "name": "QueryClient",
11303
11809
  "kind": "interface",
11304
11810
  "package": "@nifrajs/web",
11305
- "signature": "export interface QueryClient {\n /** Get the stable {@link QueryHandle} for `key`, fetched via `fn`. Re-binds the latest `fn` (and\n * `options`) each call (closures change between renders); returns the same handle for the same\n * (hashed) key. */\n query: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => QueryHandle<T>;\n /** Get the stable {@link InfiniteQueryHandle} for `key`, whose pages are fetched via `fn(pageParam)`. */\n infiniteQuery: <T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: InfiniteQueryOptions<T, P>) => InfiniteQueryHandle<T, P>;\n /** Mark matching cached queries, infinite ones included, stale and refetch the **mounted** ones\n * (subscribers > 0). Array keys match by **prefix** (`[\"todo\"]` ⇒ every `[\"todo\", …]`); other keys\n * match exactly. */\n invalidateQueries: (keyOrPrefix: unknown) => void;\n /** Read a cached query's data (`undefined` if absent or not yet successful). Synchronous, no fetch. */\n getQueryData: <T>(key: unknown) => T | undefined;\n /** Write a query's data directly (optimistic updates, or seeding). Creates the entry if absent; marks\n * it fresh (`updatedAt = now`). `updater` may be a value or a function of the previous data. */\n setQueryData: <T>(key: unknown, updater: T | ((prev: T | undefined) => T)) => void;\n /** Fetch + cache a query's data WITHOUT subscribing (SSR prefetch, hover warm). Resolves when cached;\n * a fresh entry is a no-op. Rejects if the fetch throws (caller may swallow). */\n prefetchQuery: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => Promise<void>;\n /** Serialize every successful query to a transferable snapshot (server → client SSR bridge). */\n dehydrate: () => DehydratedState;\n /** Seed the cache from a {@link dehydrate} snapshot (client boot). Existing fresher entries win. */\n hydrate: (state: DehydratedState) => void;\n}",
11811
+ "signature": "export interface QueryClient {\n /** Get the stable {@link QueryHandle} for `key`, fetched via `fn`. Re-binds the latest `fn` (and\n * `options`) each call (closures change between renders); returns the same handle for the same\n * (hashed) key. */\n query: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => QueryHandle<T>;\n /** Get the stable {@link InfiniteQueryHandle} for `key`, whose pages are fetched via `fn(pageParam)`. */\n infiniteQuery: <T, P>(key: unknown, fn: (pageParam: P) => Promise<T>, options: InfiniteQueryOptions<T, P>) => InfiniteQueryHandle<T, P>;\n /** Mark matching cached queries, infinite ones included, stale and refetch the **mounted** ones\n * (subscribers > 0). Array keys match by **prefix** (`[\"todo\"]` ⇒ every `[\"todo\", …]`); other keys\n * match exactly. */\n invalidateQueries: (keyOrPrefix: unknown) => void;\n /** Read a cached query's data (`undefined` if absent or not yet successful). Synchronous, no fetch. */\n getQueryData: <T>(key: unknown) => T | undefined;\n /** Write a query's data directly (optimistic updates, or seeding). Creates the entry if absent; marks\n * it fresh (`updatedAt = now`). `updater` may be a value or a function of the previous data. */\n setQueryData: <T>(key: unknown, updater: T | ((prev: T | undefined) => T)) => void;\n /** Fetch + cache a query's data WITHOUT subscribing (SSR prefetch, hover warm). Resolves when cached;\n * a fresh entry is a no-op. Rejects if the fetch throws (caller may swallow). */\n prefetchQuery: <T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions) => Promise<void>;\n /** Serialize every successful query to a transferable snapshot (server → client SSR bridge). */\n dehydrate: () => DehydratedState;\n /** Seed the cache from a {@link dehydrate} snapshot (client boot). Existing fresher entries win. */\n hydrate: (state: DehydratedState) => void;\n /** Drop every cached query: mounted ones go back to pending and refetch, the rest are removed. A\n * live app calls it on every query client in the page when the viewer changes. */\n clear: () => void;\n}",
11306
11812
  "doc": "/** The keyed query cache. One per app (a binding registers it like the router). */"
11307
11813
  },
11308
11814
  {
@@ -11329,7 +11835,7 @@
11329
11835
  "name": "QueryOptions",
11330
11836
  "kind": "interface",
11331
11837
  "package": "@nifrajs/web",
11332
- "signature": "export interface QueryOptions {\n /** Data stays fresh this long (ms) after a fetch; older ⇒ refetch on the next `fetch()`. Overrides\n * the client default for this key. */\n readonly staleTime?: number;\n}",
11838
+ "signature": "export interface QueryOptions {\n /** Data stays fresh this long (ms) after a fetch; older ⇒ refetch on the next `fetch()`. Overrides\n * the client default for this key. */\n readonly staleTime?: number;\n /**\n * Live keys the data depends on, as the page's loaders declare them with `ctx.live()`. While the\n * query is mounted, a change to one refetches it. Needs `live({ queryKeys: true })`.\n */\n readonly live?: readonly string[];\n}",
11333
11839
  "doc": "/** Per-query overrides passed alongside the fetcher. */"
11334
11840
  },
11335
11841
  {
@@ -11616,7 +12122,7 @@
11616
12122
  "name": "RateLimitResult",
11617
12123
  "kind": "interface",
11618
12124
  "package": "@nifrajs/middleware",
11619
- "signature": "export interface RateLimitResult {\n /** Hits recorded in the current window, including this one. */\n readonly count: number;\n /** Epoch-ms when the current window resets. */\n readonly resetAt: number;\n}"
12125
+ "signature": "export interface RateLimitResult {\n /** Hits recorded in the current window, including this one. */\n readonly count: number;\n /** Epoch-ms when the current window resets. */\n readonly resetAt: number;\n /** The key was refused: the store is full and its bounded scan found no expired window this time.\n * An active quota is never discarded to make room. */\n readonly limited?: boolean;\n}"
11620
12126
  },
11621
12127
  {
11622
12128
  "name": "RateLimitStore",
@@ -11669,7 +12175,7 @@
11669
12175
  "name": "ReactWidgetOptions",
11670
12176
  "kind": "interface",
11671
12177
  "package": "@nifrajs/mcp",
11672
- "signature": "export interface ReactWidgetOptions {\n /** The widget's `ui://` resource URI, e.g. `ui://orders/table`. */\n readonly uri: string;\n readonly name: string;\n readonly description?: string;\n readonly title?: string;\n /** Absolute path to a `.tsx`/`.jsx` module whose DEFAULT export is a React component. It receives the\n * tool's `structuredContent` as props. */\n readonly component: string;\n /** Extra `<head>` content (styles, fonts). The bridge + component bundle are injected for you. */\n readonly head?: string;\n /** Minify the client bundle (default true). */\n readonly minify?: boolean;\n}"
12178
+ "signature": "export interface ReactWidgetOptions extends BundleReactWidgetOptions {\n /** The widget's `ui://` resource URI, e.g. `ui://orders/table`. */\n readonly uri: string;\n readonly name: string;\n readonly description?: string;\n readonly title?: string;\n /** Extra `<head>` content (styles, fonts). The bridge + component bundle are injected for you. */\n readonly head?: string;\n}"
11673
12179
  },
11674
12180
  {
11675
12181
  "name": "ReadAt",
@@ -11678,13 +12184,6 @@
11678
12184
  "signature": "export type ReadAt = (bytes: Uint8Array, position: number) => Promise<number>;",
11679
12185
  "doc": "/** Reads into `bytes` from byte `position` of a file, resolving to the count read (0 at its end). */"
11680
12186
  },
11681
- {
11682
- "name": "Readable",
11683
- "kind": "interface",
11684
- "package": "@nifrajs/web",
11685
- "signature": "export interface Readable<T> {\n get(): T;\n subscribe(listener: (value: T) => void): () => void;\n}",
11686
- "doc": "/** A value you can read now and be told about later. Both `signal` and `computed` are `Readable`, so\n * `bind`/`bindList` accept either. */"
11687
- },
11688
12187
  {
11689
12188
  "name": "ReasoningDeltaView",
11690
12189
  "kind": "interface",
@@ -11792,6 +12291,19 @@
11792
12291
  "signature": "export interface RedirectOptions {\n /** HTTP status (default 303 See Other; pass 307/308 to preserve the method). */\n readonly status?: number;\n /** Allow an off-origin / absolute destination. Off by default: only a same-origin path (a single\n * leading `/`) is permitted, so an action can't be turned into an open redirect by passing\n * attacker-controlled input straight through. Set `true` for a deliberate external redirect. */\n readonly external?: boolean;\n /** Extra response headers. A redirect is no longer a `Response`, so there is no `.headers` to\n * mutate after the fact - name them here. Cookies queued with `ctx.set.cookie()` still ride it. */\n readonly headers?: Readonly<Record<string, string>>;\n}",
11793
12292
  "doc": "/** Options for {@link redirect}. */"
11794
12293
  },
12294
+ {
12295
+ "name": "RedisCommand",
12296
+ "kind": "type",
12297
+ "package": "@nifrajs/web",
12298
+ "signature": "export type RedisCommand = (command: string, args: readonly string[]) => Promise<unknown>;",
12299
+ "doc": "/** Send one Redis command and resolve with its reply, as any client's raw-command call does. */"
12300
+ },
12301
+ {
12302
+ "name": "RedisLiveBusOptions",
12303
+ "kind": "interface",
12304
+ "package": "@nifrajs/web",
12305
+ "signature": "export interface RedisLiveBusOptions {\n /** Appends and reads the clock; any connection. */\n readonly send: RedisCommand;\n /** Reads the stream. Its own connection: a blocking `XREAD` holds it. */\n readonly read: RedisCommand;\n /** The stream; the clock lives at `<key>:clock`. Default `nifra:live`. */\n readonly key?: string;\n /** Entries kept, roughly. Default 100,000, the most the live history keeps. */\n readonly maxLength?: number;\n /** How long one `XREAD` blocks, in ms. Default 5,000. */\n readonly blockMs?: number;\n /**\n * How long one `XREAD` may take before it counts as a failed read, in ms: a connection that stopped\n * answering would otherwise leave this process's sockets missing every change. Default `blockMs`\n * plus 5,000.\n */\n readonly readTimeoutMs?: number;\n}"
12306
+ },
11795
12307
  {
11796
12308
  "name": "ReflectedHook",
11797
12309
  "kind": "interface",
@@ -11842,7 +12354,7 @@
11842
12354
  "name": "ReflectedRouteSchema",
11843
12355
  "kind": "interface",
11844
12356
  "package": "@nifrajs/core",
11845
- "signature": "export interface ReflectedRouteSchema {\n /** Explicit external-protocol mode; the handler owns raw request parsing. */\n readonly wire?: \"raw\";\n /** Validation/authentication ordering selected for this route. */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Effective transport body policy; surfaced so upload/streaming exemptions are auditable. */\n readonly bodyLimit?: number | \"unlimited\";\n readonly bodyLimitReason?: string;\n /** Request-header schema; names are normalized to lower-case at runtime. */\n readonly headers?: SchemaReflection;\n /** Request-cookie schema, validated against the parsed `Cookie` header. */\n readonly cookies?: SchemaReflection;\n readonly body?: SchemaReflection;\n readonly query?: SchemaReflection;\n /** Path-params schema - constraints (uuid format, integer min/max) declared via `params: t.object(…)`. */\n readonly params?: SchemaReflection;\n readonly response?: SchemaReflection;\n readonly errors?: Readonly<Record<string, SchemaReflection>>;\n /** The SSE event-payload schema of a typed streaming route (`app.sse()`). */\n readonly sse?: SchemaReflection;\n}"
12357
+ "signature": "export interface ReflectedRouteSchema {\n /** Explicit external-protocol mode; the handler owns raw request parsing. */\n readonly wire?: \"raw\";\n /** Validation/authentication ordering selected for this route. */\n readonly validationOrder?: \"validate-before-auth\" | \"auth-before-validation\";\n /** Effective transport body policy; surfaced so upload/streaming exemptions are auditable. */\n readonly bodyLimit?: number | \"unlimited\";\n readonly bodyLimitReason?: string;\n /** Request-header schema; names are normalized to lower-case at runtime. */\n readonly headers?: SchemaReflection;\n /** Request-cookie schema, validated against the parsed `Cookie` header. */\n readonly cookies?: SchemaReflection;\n readonly body?: SchemaReflection;\n readonly query?: SchemaReflection;\n /** Path-params schema - constraints (uuid format, integer min/max) declared via `params: t.object(…)`. */\n readonly params?: SchemaReflection;\n readonly response?: SchemaReflection;\n readonly errors?: Readonly<Record<string, SchemaReflection>>;\n /** The SSE event-payload schema of a typed streaming route (`app.sse()`). */\n readonly sse?: SchemaReflection;\n /**\n * Set when an `onValidationError` hook (the route's own, or the app-wide default) answers this\n * route's validation failures, so its 422 body is whatever the hook returns.\n */\n readonly validationErrorHook?: true;\n}"
11846
12358
  },
11847
12359
  {
11848
12360
  "name": "ReflectedSchemaField",
@@ -11970,7 +12482,7 @@
11970
12482
  "name": "RenderAdapter",
11971
12483
  "kind": "interface",
11972
12484
  "package": "@nifrajs/web",
11973
- "signature": "export interface RenderAdapter {\n /**\n * Render a route's layout `chain` (outermost layout → page) to a Web stream of HTML bytes,\n * including the framework's hydration markers. When `options.nonce` is set, every executable\n * `<script>` the framework streams (out-of-order Suspense runtimes, serialized resources) must\n * carry it, or a nonce-based Content-Security-Policy blocks it and the boundary never resolves.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /**\n * Render the chain to a complete HTML string when no content is deferred. `options.nonce` is the\n * document's CSP nonce, for any inline script the renderer emits (Solid's hydration data); a\n * document that sends a policy keeps the nonce only when the returned HTML carries it. Return\n * `undefined` when the render suspended on something only `renderToStream` waits for (React's\n * `use` or `lazy` inside `<Suspense>`): the page is then streamed instead.\n */\n renderToString?(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): string | undefined | Promise<string | undefined>;\n /** Per-document bootstrap markup injected into `<head>` for client hydration. */\n hydrationHead(nonce?: string): string;\n /**\n * Set when a render can produce markup that belongs outside the app root. Every render is then\n * passed `options.parts` to fill; an adapter without it never is, and pays nothing for the seam.\n */\n readonly documentParts?: boolean;\n}",
12485
+ "signature": "export interface RenderAdapter {\n /**\n * Render a route's layout `chain` (outermost layout → page) to a Web stream of HTML bytes,\n * including the framework's hydration markers. When `options.nonce` is set, every executable\n * `<script>` the framework streams (out-of-order Suspense runtimes, serialized resources) must\n * carry it, or a nonce-based Content-Security-Policy blocks it and the boundary never resolves.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /**\n * Render the chain to a complete HTML string when no content is deferred. `options.nonce` is the\n * document's CSP nonce, for any inline script the renderer emits (Solid's hydration data); a\n * document that sends a policy keeps the nonce only when the returned HTML carries it. Return\n * `undefined` when the render suspended on something only `renderToStream` waits for (React's\n * `use` or `lazy` inside `<Suspense>`): the page is then streamed instead.\n */\n renderToString?(chain: readonly unknown[], props: RenderProps, options?: RenderStreamOptions): string | undefined | Promise<string | undefined>;\n /** Per-document bootstrap markup injected into `<head>` for client hydration. */\n hydrationHead(nonce?: string): string;\n /**\n * Render one piece of UI (a boundary's `render` result or `fallback`) to an HTML string on its own,\n * outside the route chain. `ui` produces it: call it inside the render, since a framework whose\n * markup is made as it is evaluated (Solid) needs its render context there. `idPrefix` namespaces\n * any ids the framework generates, so two fragments rendered separately never collide. `hydrates`\n * is set when the client hydrates the fragment as a root of its own (an interactive hole). Required\n * for partial prerendering; optional otherwise.\n */\n renderFragment?(ui: () => unknown, options: {\n readonly idPrefix?: string;\n readonly hydrates?: boolean;\n }): string | Promise<string>;\n /**\n * Set when a render can produce markup that belongs outside the app root. Every render is then\n * passed `options.parts` to fill; an adapter without it never is, and pays nothing for the seam.\n */\n readonly documentParts?: boolean;\n /**\n * Render the chain and return only the HTML of the slot named `name`, or `undefined` when the\n * render has no such slot. Called for an {@link SWAP_HEADER} request; an adapter without it, or a\n * render without the slot, answers with the whole document, which the client loads normally.\n */\n renderSlot?(chain: readonly unknown[], props: RenderProps, name: string): string | undefined | Promise<string | undefined>;\n}",
11974
12486
  "doc": "/**\n * The seam every render adapter implements. New adapters should prove these invariants with\n * `assertRenderAdapterConformance`; framework-specific behavior remains locally tested.\n */"
11975
12487
  },
11976
12488
  {
@@ -12012,7 +12524,7 @@
12012
12524
  "name": "RenderPageOptions",
12013
12525
  "kind": "interface",
12014
12526
  "package": "@nifrajs/web",
12015
- "signature": "export interface RenderPageOptions {\n readonly serverComponents?: import(\"../server-components/types.js\").ComponentState;\n readonly adapter: RenderAdapter;\n /** The layout chain to render - outermost layout → page (opaque; the adapter renders it). */\n readonly chain: readonly unknown[];\n /** The loader output for this request. */\n readonly data: unknown;\n /** An action's data return (POST only) - surfaced to the page as `actionData` + serialized\n * for the client so post-POST hydration matches. Omit on GETs. */\n readonly actionData?: unknown;\n /**\n * URL of the built client entry (loaded as a module script).\n *\n * Optional ONLY on a `hydrate: false` page, where there is no client takeover to feed and this value\n * reaches no output at all. The union below is what enforces that: omitting it on a hydrating page\n * stays a compile error rather than rendering `src=\"\"`.\n */\n readonly clientEntry?: string;\n /** Chunk URLs for the **matched** route (its layout chain + own chunk) to `modulepreload` in the\n * shell - so the route code downloads in parallel with the entry instead of after it\n * (`buildClient`'s per-route map). Empty/omitted ⇒ only the entry is preloaded (unchanged). */\n readonly preload?: readonly string[];\n /** Stylesheet URLs for the **matched** route (its layout chain + own CSS, from `buildClient`'s\n * `BuildManifest.css`) - injected as `<link rel=\"stylesheet\">` in `<head>` so styles arrive with the\n * first paint (no FOUC). Rendered even on non-hydrated pages. Empty/omitted ⇒ none (unchanged). */\n readonly styles?: readonly string[];\n /**\n * Activation policy for these framework-owned stylesheet links (default `\"blocking\"`). In\n * `\"deferred\"` mode, hydrating pages fetch with `media=\"print\"` and the generated client promotes\n * them to `media=\"all\"` after load/error/timeout. Non-hydrated pages remain blocking so JS-off pages\n * and terminal documents are styled.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set, serialized to `window.__NIFRA_PRERENDERED__` so the client fetches\n * a static `_data.json` on soft-nav into a prerendered route. Empty/omitted ⇒ not injected. */\n readonly prerenderedPaths?: readonly string[];\n /** SSG: the URL of a JSON array of the prerendered paths, handed over in place of\n * {@link prerenderedPaths} so a large set is fetched once instead of riding in every page. */\n readonly prerenderedListUrl?: string;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`), handed over to the\n * client; the chunks this page reads its copy from are preloaded. Omit ⇒ none. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** The page's locale from the app's locale routing: `<html lang dir>` default to it unless `head`\n * sets `lang`, the response carries `Content-Language`, and the adapter reads it as\n * `RenderProps.locale`. Omit ⇒ none of these. */\n readonly locale?: PageLocale;\n /** The served locales, handed to the client so it names each page's locale on navigation. */\n readonly locales?: PageLocales;\n /** ISR: route freshness in seconds, emitted as the `x-nifra-isr-revalidate` header for a `withISR`\n * wrapper to read. Omit ⇒ no header (the wrapper's default TTL applies). */\n readonly revalidate?: number;\n /** ISR invalidation tags emitted as a bounded `x-nifra-isr-tags` header. */\n readonly revalidateTags?: readonly string[];\n /** Matched route id; written to `window.__NIFRA_ROUTE__` so the client hydrates this chain. */\n readonly routeId?: string;\n /** The matched route's decoded path params - surfaced to the page as `params` (via {@link RenderProps})\n * so an adapter's `useParams` is SSR-correct. Omit ⇒ `{}` (a route with no dynamic segments, or an\n * error/404 render). */\n readonly params?: Readonly<Record<string, string>>;\n /** The request's `pathname + search` - surfaced as `path` (via {@link RenderProps}) so an adapter's\n * `useLocation`/`useSearchParams` render the right URL server-side and hydrate without drift. Omit ⇒\n * `\"\"`. */\n readonly path?: string;\n /** The route's validated search (`searchOf(mod.searchSchema, url.search)`, the same value handed to\n * the loader as `ctx.search`), surfaced as `search` (via {@link RenderProps}) so an adapter's\n * `useSearch` is SSR-correct. Omit ⇒ `{}` (a render with no search context). */\n readonly search?: Record<string, unknown>;\n /** Per-layout loader data, forwarded to the adapter as `RenderProps.layoutData`. Aligned with the\n * chain's layout prefix; omitted when no layout in the chain has a loader. */\n readonly layoutData?: readonly unknown[];\n /** Dynamic-boundary states, forwarded to the adapter and serialized for hydration when present. */\n readonly boundaries?: BoundaryStates;\n /** The chain's ids and `handle` exports, forwarded as `RenderProps.matchChain` for `useMatches`. */\n readonly matchChain?: MatchChain;\n /** HTTP status for the response (default 200; e.g. 404 for a not-found page). */\n readonly status?: number;\n /** Extra response headers - e.g. the `cache-control` a terminal status page wants. `content-type`\n * is ignored (the document is always HTML) and the ISR freshness header is applied after these,\n * so neither can be overridden from here. */\n readonly headers?: HeadersLike;\n /** Document title (fallback when `head.title` is unset). */\n readonly title?: string;\n /** Resolved route head - `title` overrides `title` above; `meta`/`link` render as managed\n * (`data-nifra`) tags the client updates on navigation.\n *\n * **Head contract (the layout chain contributes).** `createWebApp` resolves this via\n * {@link mergeHeads}: a route's head is its **layout chain's** `meta`/`head` exports merged with the\n * page's. A `_layout.tsx` may `export const meta` (or `export function meta(args)`) - its tags land\n * on every page below it (the home for `hreflang`, `preconnect`, a section-default `<title>`). The\n * merge is **nearest-wins for scalars** (the page's `title` overrides an inner layout's, which\n * overrides an outer one; an undefined page title keeps the layout's) and **concatenated for the\n * `meta`/`link` arrays** (outermost layout first, page last). `<meta>`/`<link>` attributes pass a\n * shared tag-specific allowlist (including inert `data-*` metadata) and values are escaped. */\n readonly head?: Meta;\n /** Id of the container wrapping the app markup (default `\"root\"`). A non-default id also gets\n * {@link ROOT_ATTRIBUTE}, which is how the generated client entry finds the container to hydrate -\n * the entry is built once and cannot know what a given render chose. */\n readonly rootId?: string;\n /** When `false`, emit a complete but **non-hydrated** document - no client entry script, data\n * globals, or modulepreloads. Used for server-rendered `_error` pages: a terminal state that needs no\n * client takeover, and it sidesteps an SSR/hydrate mismatch (the server rendered the boundary, not\n * the page the client manifest maps this route id to). Default `true`. */\n readonly hydrate?: boolean;\n /** Island client bundles (`@nifrajs/web/islands`) to load as `<script type=\"module\">` in the document\n * tail - emitted **regardless of `hydrate`**, so a static (`hydrate: false`) page can still mount\n * no-framework islands. URLs are attribute-escaped. Empty/omitted ⇒ none (unchanged output). */\n readonly islandScripts?: readonly string[];\n /** CSP nonce applied to every framework-owned executable script in this document. Nonce-bearing\n * documents are marked `private, no-store` so a request-specific nonce is never replayed. */\n readonly nonce?: string;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`. The document then carries `nonce`\n * only when it needs one (it defers a value, or a head tag names the nonce); otherwise it renders\n * nonce-free and cacheable. The policy's header is set on the response either way.\n */\n readonly csp?: CspPolicy;\n /**\n * Advanced: a per-route slot the renderer fills with the request-invariant document pieces (shell\n * prefix/suffix, tail statics) on the first render and reuses afterwards, skipping their re-assembly.\n *\n * Only pass a cache when every shell-shaping input is IDENTICAL across the requests sharing it:\n * same `head` content (a static meta chain - never a `meta(data)` function), `locale`, `title`, `styles`,\n * `cssLoading`, `preload`, `islandScripts`, `clientEntry`, `rootId`, `hydrate`, and `prerenderedPaths`.\n * Per-request\n * values (`data`, `params`, `search`, `actionData`, `layoutData`, deferred state) are always assembled\n * fresh and safe. A per-request `nonce` disables the cache automatically. `createWebApp` wires this\n * per route, gated on the route + layout metas being static.\n */\n readonly assemblyCache?: RenderAssemblyCache;\n}"
12527
+ "signature": "export interface RenderPageOptions {\n readonly serverComponents?: import(\"../server-components/types.js\").ComponentState;\n readonly adapter: RenderAdapter;\n /** The layout chain to render - outermost layout → page (opaque; the adapter renders it). */\n readonly chain: readonly unknown[];\n /** The loader output for this request. */\n readonly data: unknown;\n /** An action's data return (POST only) - surfaced to the page as `actionData` + serialized\n * for the client so post-POST hydration matches. Omit on GETs. */\n readonly actionData?: unknown;\n /**\n * URL of the built client entry (loaded as a module script).\n *\n * Optional ONLY on a `hydrate: false` page, where there is no client takeover to feed and this value\n * reaches no output at all. The union below is what enforces that: omitting it on a hydrating page\n * stays a compile error rather than rendering `src=\"\"`.\n */\n readonly clientEntry?: string;\n /** Chunk URLs for the **matched** route (its layout chain + own chunk) to `modulepreload` in the\n * shell - so the route code downloads in parallel with the entry instead of after it\n * (`buildClient`'s per-route map). Empty/omitted ⇒ only the entry is preloaded (unchanged). */\n readonly preload?: readonly string[];\n /** Stylesheet URLs for the **matched** route (its layout chain + own CSS, from `buildClient`'s\n * `BuildManifest.css`) - injected as `<link rel=\"stylesheet\">` in `<head>` so styles arrive with the\n * first paint (no FOUC). Rendered even on non-hydrated pages. Empty/omitted ⇒ none (unchanged). */\n readonly styles?: readonly string[];\n /**\n * Activation policy for these framework-owned stylesheet links (default `\"blocking\"`). In\n * `\"deferred\"` mode, hydrating pages fetch with `media=\"print\"` and the generated client promotes\n * them to `media=\"all\"` after load/error/timeout. Non-hydrated pages remain blocking so JS-off pages\n * and terminal documents are styled.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set, serialized to `window.__NIFRA_PRERENDERED__` so the client fetches\n * a static `_data.json` on soft-nav into a prerendered route. Empty/omitted ⇒ not injected. */\n readonly prerenderedPaths?: readonly string[];\n /** SSG: the URL of a JSON array of the prerendered paths, handed over in place of\n * {@link prerenderedPaths} so a large set is fetched once instead of riding in every page. */\n readonly prerenderedListUrl?: string;\n /** Locale key -> copy chunk URL (`buildClient`'s `BuildManifest.copyChunks`), handed over to the\n * client; the chunks this page reads its copy from are preloaded. Omit ⇒ none. */\n readonly copyChunks?: Readonly<Record<string, string>>;\n /** The page's locale from the app's locale routing: `<html lang dir>` default to it unless `head`\n * sets `lang`, the response carries `Content-Language`, and the adapter reads it as\n * `RenderProps.locale`. Omit ⇒ none of these. */\n readonly locale?: PageLocale;\n /** The served locales, handed to the client so it names each page's locale on navigation. */\n readonly locales?: PageLocales;\n /** ISR: route freshness in seconds, emitted as the `x-nifra-isr-revalidate` header for a `withISR`\n * wrapper to read. Omit ⇒ no header (the wrapper's default TTL applies). */\n readonly revalidate?: number;\n /** ISR invalidation tags emitted as a bounded `x-nifra-isr-tags` header. */\n readonly revalidateTags?: readonly string[];\n /** Matched route id; written to `window.__NIFRA_ROUTE__` so the client hydrates this chain. */\n readonly routeId?: string;\n /** The matched route's decoded path params - surfaced to the page as `params` (via {@link RenderProps})\n * so an adapter's `useParams` is SSR-correct. Omit ⇒ `{}` (a route with no dynamic segments, or an\n * error/404 render). */\n readonly params?: Readonly<Record<string, string>>;\n /** The request's `pathname + search` - surfaced as `path` (via {@link RenderProps}) so an adapter's\n * `useLocation`/`useSearchParams` render the right URL server-side and hydrate without drift. Omit ⇒\n * `\"\"`. */\n readonly path?: string;\n /** The route's validated search (`searchOf(mod.searchSchema, url.search)`, the same value handed to\n * the loader as `ctx.search`), surfaced as `search` (via {@link RenderProps}) so an adapter's\n * `useSearch` is SSR-correct. Omit ⇒ `{}` (a render with no search context). */\n readonly search?: Record<string, unknown>;\n /** Per-layout loader data, forwarded to the adapter as `RenderProps.layoutData`. Aligned with the\n * chain's layout prefix; omitted when no layout in the chain has a loader. */\n readonly layoutData?: readonly unknown[];\n /** Dynamic-boundary states, forwarded to the adapter and serialized for hydration when present. */\n readonly boundaries?: BoundaryStates;\n /** The chain's ids and `handle` exports, forwarded as `RenderProps.matchChain` for `useMatches`. */\n readonly matchChain?: MatchChain;\n /** HTTP status for the response (default 200; e.g. 404 for a not-found page). */\n readonly status?: number;\n /**\n * The slot an `x-nifra-swap` request names. When the adapter renders slots and nothing is\n * deferred, the response is that slot's HTML alone; otherwise the whole document.\n */\n readonly swapSlot?: string;\n /** Chain indices the adapter renders inside the slot wrappers of a kept page (`keepAlive`), so the\n * browser can keep the page this document shows without remounting it. */\n readonly slots?: readonly number[];\n /** Extra response headers - e.g. the `cache-control` a terminal status page wants. `content-type`\n * is ignored (the document is always HTML) and the ISR freshness header is applied after these,\n * so neither can be overridden from here. */\n readonly headers?: HeadersLike;\n /** Document title (fallback when `head.title` is unset). */\n readonly title?: string;\n /** Resolved route head - `title` overrides `title` above; `meta`/`link` render as managed\n * (`data-nifra`) tags the client updates on navigation.\n *\n * **Head contract (the layout chain contributes).** `createWebApp` resolves this via\n * {@link mergeHeads}: a route's head is its **layout chain's** `meta`/`head` exports merged with the\n * page's. A `_layout.tsx` may `export const meta` (or `export function meta(args)`) - its tags land\n * on every page below it (the home for `hreflang`, `preconnect`, a section-default `<title>`). The\n * merge is **nearest-wins for scalars** (the page's `title` overrides an inner layout's, which\n * overrides an outer one; an undefined page title keeps the layout's) and **concatenated for the\n * `meta`/`link` arrays** (outermost layout first, page last). `<meta>`/`<link>` attributes pass a\n * shared tag-specific allowlist (including inert `data-*` metadata) and values are escaped. */\n readonly head?: Meta;\n /** Id of the container wrapping the app markup (default `\"root\"`). A non-default id also gets\n * {@link ROOT_ATTRIBUTE}, which is how the generated client entry finds the container to hydrate -\n * the entry is built once and cannot know what a given render chose. */\n readonly rootId?: string;\n /** When `false`, emit a complete but **non-hydrated** document - no client entry script, data\n * globals, or modulepreloads. Used for server-rendered `_error` pages: a terminal state that needs no\n * client takeover, and it sidesteps an SSR/hydrate mismatch (the server rendered the boundary, not\n * the page the client manifest maps this route id to). Default `true`. */\n readonly hydrate?: boolean;\n /** Island client bundles (`@nifrajs/web/islands`) to load as `<script type=\"module\">` in the document\n * tail - emitted **regardless of `hydrate`**, so a static (`hydrate: false`) page can still mount\n * no-framework islands. URLs are attribute-escaped. Empty/omitted ⇒ none (unchanged output). */\n readonly islandScripts?: readonly string[];\n /** CSP nonce applied to every framework-owned executable script in this document. Nonce-bearing\n * documents are marked `private, no-store` so a request-specific nonce is never replayed. */\n readonly nonce?: string;\n /** The request's abort signal. A deferred value that rejects because it aborted is the client\n * leaving, not a failure, so the server log skips it. Omit ⇒ every rejection is logged. */\n readonly signal?: AbortSignal;\n /** Where a rejected deferred value is logged: the app's error log. Omit ⇒ the console. */\n readonly logError?: ((error: unknown) => void) | undefined;\n /**\n * A hash-based Content-Security-Policy from `createCspPolicy`. The document then carries `nonce`\n * only when it needs one (it defers a value, or a head tag names the nonce); otherwise it renders\n * nonce-free and cacheable. The policy's header is set on the response either way.\n */\n readonly csp?: CspPolicy;\n /**\n * Advanced: a per-route slot the renderer fills with the request-invariant document pieces (shell\n * prefix/suffix, tail statics) on the first render and reuses afterwards, skipping their re-assembly.\n *\n * Only pass a cache when every shell-shaping input is IDENTICAL across the requests sharing it:\n * same `head` content (a static meta chain - never a `meta(data)` function), `locale`, `title`, `styles`,\n * `cssLoading`, `preload`, `islandScripts`, `clientEntry`, `rootId`, `hydrate`, and `prerenderedPaths`.\n * Per-request\n * values (`data`, `params`, `search`, `actionData`, `layoutData`, deferred state) are always assembled\n * fresh and safe. A per-request `nonce` disables the cache automatically. `createWebApp` wires this\n * per route, gated on the route + layout metas being static.\n */\n readonly assemblyCache?: RenderAssemblyCache;\n}"
12016
12528
  },
12017
12529
  {
12018
12530
  "name": "RenderProps",
@@ -12044,7 +12556,7 @@
12044
12556
  "name": "RenderStreamOptions",
12045
12557
  "kind": "interface",
12046
12558
  "package": "@nifrajs/web",
12047
- "signature": "export interface RenderStreamOptions {\n /** The document's CSP nonce, for every executable `<script>` the framework streams. */\n readonly nonce?: string;\n /** Present only for an adapter that sets {@link RenderAdapter.documentParts}. */\n readonly parts?: DocumentParts;\n}",
12559
+ "signature": "export interface RenderStreamOptions {\n /** The document's CSP nonce, for every executable `<script>` the framework streams. */\n readonly nonce?: string;\n /** Present only for an adapter that sets {@link RenderAdapter.documentParts}. */\n readonly parts?: DocumentParts;\n /**\n * Chain indices to render inside the two slot wrappers a kept page needs (`keepAlive`), each\n * `<slot data-nifra-entry><slot data-nifra-page>` around that chain entry (a `<slot>` lays out as\n * `display: contents`), so the browser's keep-alive view hydrates the same markup. Present only\n * in an app with a `keepAlive` route; an adapter without keep-alive support ignores it.\n */\n readonly slots?: readonly number[];\n}",
12048
12560
  "doc": "/** Per-document options for {@link RenderAdapter.renderToStream}. */"
12049
12561
  },
12050
12562
  {
@@ -12065,6 +12577,13 @@
12065
12577
  "package": "@nifrajs/agent-app",
12066
12578
  "signature": "export interface RepairRequiredView extends EventViewBase {\n readonly kind: \"repair.required\";\n readonly turnId?: string;\n readonly taskId: string;\n readonly verification: \"check\" | \"assure\" | \"test\";\n readonly capabilities: readonly string[];\n}"
12067
12579
  },
12580
+ {
12581
+ "name": "RepeatedPrefix",
12582
+ "kind": "interface",
12583
+ "package": "@nifrajs/core",
12584
+ "signature": "export interface RepeatedPrefix {\n /** Bytes the producer sends again in later responses and never changes. */\n readonly source: Uint8Array;\n /** How many of `source`'s leading bytes the chunk starts with. */\n readonly length: number;\n}",
12585
+ "doc": "/** What {@link markRepeatedPrefix} recorded for a chunk. */"
12586
+ },
12068
12587
  {
12069
12588
  "name": "ReplayBackend",
12070
12589
  "kind": "class",
@@ -12242,17 +12761,17 @@
12242
12761
  },
12243
12762
  {
12244
12763
  "name": "Resource",
12245
- "kind": "interface",
12764
+ "kind": "type",
12246
12765
  "package": "@nifrajs/web",
12247
- "signature": "export interface Resource<T> extends Readable<ResourceState<T>> {\n refetch(): void;\n}",
12248
- "doc": "/** An async cell: a `Readable` of `ResourceState<T>` plus `refetch()`. This is nano's answer to\n * \"suspense\" - an explicit pending/error/ready value, never a thrown promise or a magic boundary. */"
12766
+ "signature": "export type Resource<T> = {\n (): ResourceState<T>;\n /** Fetch the current key again; once disposed, nothing. */\n refetch(): void;\n /** Stop refetching and abort the request in flight; its result is dropped. */\n dispose(): void;\n};",
12767
+ "doc": "/** Call it to read the current state (tracking, like a signal). */"
12249
12768
  },
12250
12769
  {
12251
12770
  "name": "ResourceState",
12252
12771
  "kind": "type",
12253
12772
  "package": "@nifrajs/web",
12254
12773
  "signature": "export type ResourceState<T> = {\n readonly status: \"pending\";\n readonly value: undefined;\n readonly error: undefined;\n} | {\n readonly status: \"ready\";\n readonly value: T;\n readonly error: undefined;\n} | {\n readonly status: \"error\";\n readonly value: undefined;\n readonly error: unknown;\n};",
12255
- "doc": "/** The three states of an async cell. A discriminated union on `status` so a consumer must handle\n * every branch - there is no \"value that might secretly be loading\", the failure mode of ad-hoc\n * `isLoading` booleans. `value`/`error` are narrowed by `status`. */"
12774
+ "doc": "/** An async value's state. `status` narrows `value` and `error`, so no branch can be skipped. */"
12256
12775
  },
12257
12776
  {
12258
12777
  "name": "ResponseBodyHook",
@@ -12514,13 +13033,20 @@
12514
13033
  "name": "RevalidateEndpointOptions",
12515
13034
  "kind": "interface",
12516
13035
  "package": "@nifrajs/web",
12517
- "signature": "export interface RevalidateEndpointOptions {\n readonly store: CacheStore;\n /** Shared secret; the request's token must match it (constant-time). */\n readonly secret: string;\n /** Header carrying the secret. Default `x-nifra-revalidate-token`. */\n readonly tokenHeader?: string;\n /** Map a to-purge path → its cache key - MUST match the `withISR` `key` fn. The default uses the\n * revalidation request's origin plus the purged path, matching `withISR`'s default host-aware key. */\n readonly key?: (path: string, req: Request) => string;\n /** The `query` policy given to `withISR`, so a purged path's query string is keyed the same way.\n * Default `\"bypass\"`. A path whose query `withISR` never caches is refused with `400`. Ignored\n * when `key` is supplied. */\n readonly query?: ISRQuery;\n /**\n * A CDN to purge after the origin store (a `@nifrajs/web/cdn` provider). The origin goes first so a\n * CDN refetch cannot repopulate from a stale origin entry. The reply is `200` when the CDN accepted\n * the purge, `202` when it is queued (rate limit or retry), and `502` when the CDN refused it.\n */\n readonly cdn?: CdnPurgeTarget;\n /**\n * Caches below the pages whose entries carry the same tags, such as a `@nifrajs/cache` holding\n * loader data. A tag purge invalidates each of them first, then the page store, then the CDN, so a\n * page regenerated mid-purge cannot be rebuilt from stale data. A failure answers `500` before the\n * page store is touched, so a retry purges everything again. Path purges do not reach them.\n */\n readonly dataCaches?: readonly {\n invalidateTag(tag: string): unknown;\n }[];\n}"
13036
+ "signature": "export interface RevalidateEndpointOptions {\n readonly store: CacheStore;\n /** Shared secret; the request's token must match it (constant-time). */\n readonly secret: string;\n /** Header carrying the secret. Default `x-nifra-revalidate-token`. */\n readonly tokenHeader?: string;\n /** Map a to-purge path → its cache key - MUST match the `withISR` `key` fn. The default uses the\n * revalidation request's origin plus the purged path, matching `withISR`'s default host-aware key. */\n readonly key?: (path: string, req: Request) => string;\n /** The `query` policy given to `withISR`, so a purged path's query string is keyed the same way.\n * Default `\"bypass\"`. A path whose query `withISR` never caches is refused with `400`. Ignored\n * when `key` is supplied. */\n readonly query?: ISRQuery;\n /**\n * A CDN to purge after the origin store (a `@nifrajs/web/cdn` provider). The origin goes first so a\n * CDN refetch cannot repopulate from a stale origin entry. The reply is `200` when the CDN accepted\n * the purge, `202` when it is queued (rate limit or retry), and `502` when the CDN refused it.\n */\n readonly cdn?: CdnPurgeTarget;\n /**\n * Caches below the pages whose entries carry the same tags, such as a `@nifrajs/cache` holding\n * loader data. A tag purge invalidates each of them first, then the page store, then the CDN, so a\n * page regenerated mid-purge cannot be rebuilt from stale data. A failure answers `500` before the\n * page store is touched, so a retry purges everything again. Path purges do not reach them.\n */\n readonly dataCaches?: readonly {\n invalidateTag(tag: string): unknown;\n }[];\n /**\n * The app's live runtime: a purge also tells live pages watching a purged tag to reload, after the\n * caches and before the CDN. A publish that fails answers `502` with `origin: \"done\"`.\n */\n readonly live?: {\n publish(...keys: string[]): Promise<void>;\n };\n}"
13037
+ },
13038
+ {
13039
+ "name": "RevalidateOptions",
13040
+ "kind": "interface",
13041
+ "package": "@nifrajs/web",
13042
+ "signature": "export interface RevalidateOptions {\n /** Cache tags: data caches, the page store and the CDN drop entries carrying them; live pages watching a tag as a key reload. */\n readonly tags?: readonly string[];\n /** Live keys (`ctx.live`): every open page watching one reloads it. */\n readonly keys?: readonly string[];\n}",
13043
+ "doc": "/** Cache tags and live keys an action's write made stale, beside its paths. */"
12518
13044
  },
12519
13045
  {
12520
13046
  "name": "RevalidateResult",
12521
13047
  "kind": "interface",
12522
13048
  "package": "@nifrajs/web",
12523
- "signature": "export interface RevalidateResult<T> {\n readonly __nifraRevalidate: readonly string[];\n readonly data: T;\n}",
13049
+ "signature": "export interface RevalidateResult<T> {\n readonly __nifraRevalidate: readonly string[];\n readonly data: T;\n /** What else the write made stale: cache tags and live keys. */\n readonly __nifraInvalidate?: {\n readonly tags: readonly string[];\n readonly keys: readonly string[];\n };\n}",
12524
13050
  "doc": "/** The wrapper `revalidate()` returns: the action's `data` plus the paths it changed. A plain tagged\n * shape (not a class) so `@nifrajs/client`'s `ActionData` can unwrap it structurally without importing\n * from `@nifrajs/web`. `createWebApp` strips the wrapper - the client receives `data` as the body and\n * the paths via the `X-Nifra-Revalidate` header. */"
12525
13051
  },
12526
13052
  {
@@ -12534,7 +13060,7 @@
12534
13060
  "name": "RevalidateTagsInput",
12535
13061
  "kind": "interface",
12536
13062
  "package": "@nifrajs/web",
12537
- "signature": "export interface RevalidateTagsInput {\n readonly params: Readonly<Record<string, string>>;\n readonly url: URL;\n}",
13063
+ "signature": "export interface RevalidateTagsInput {\n readonly params: Readonly<Record<string, string>>;\n /**\n * The request's URL. On a partially prerendered route and its shared holes, the shell's: the\n * configured origin, the path and the declared variations, never the visitor's Host or other query.\n */\n readonly url: URL;\n}",
12538
13064
  "doc": "/** What a `revalidateTags` function is given: the URL and route params only, both already public. */"
12539
13065
  },
12540
13066
  {
@@ -12893,7 +13419,7 @@
12893
13419
  "name": "RouteEntry",
12894
13420
  "kind": "interface",
12895
13421
  "package": "@nifrajs/web",
12896
- "signature": "export interface RouteEntry {\n readonly id: string;\n readonly pattern: string;\n readonly layoutIds: readonly string[];\n /**\n * Param names each layout in {@link layoutIds} owns, aligned by index.\n *\n * A layout wraps a URL prefix, so these are the params it may read and the ones whose change should\n * re-run its loader - everything deeper belongs to routes beneath it. Derived per (route, layout)\n * pair rather than per layout, because one layout can own different params on different expanded\n * patterns: `[[lang]]/docs/_layout` owns nothing on `/docs/:slug` and `{lang}` on `/:lang/docs/:slug`.\n * Optional only so hand-built test manifests may omit it.\n */\n readonly layoutParams?: ReadonlyArray<readonly string[]>;\n /** `_middleware` ids in this route's ancestor chain (outermost → innermost), run before its\n * layouts. Absent ⇒ none. */\n readonly middlewareIds?: readonly string[];\n /** Param names each middleware in {@link middlewareIds} sees, aligned by index: the params of its\n * directory's URL prefix, as {@link layoutParams} holds them for a layout. */\n readonly middlewareParams?: ReadonlyArray<readonly string[]>;\n /** `_error` boundary ids in this route's ancestor chain (outermost → innermost). The last is the\n * **nearest** boundary, rendered when the route's loader throws. Always set by `buildManifest`\n * (optional only so hand-built test manifests may omit it); absent/empty ⇒ no boundary (error 500s). */\n readonly errorIds?: readonly string[];\n /** Nested `_404` page ids in this route's ancestor chain (outermost → innermost); the root `_404`\n * is not listed. The last is the **nearest**, rendered when the route's loader answers\n * `notFound()`. Absent ⇒ the root `_404`. */\n readonly notFoundIds?: readonly string[];\n /** `_loading` page ids in this route's ancestor chain (outermost → innermost). A client navigation\n * to the route shows the innermost one whose layouts are already on screen. Absent ⇒ none. */\n readonly loadingIds?: readonly string[];\n /** The frontend half: the file the browser bundle imports. */\n readonly file: string;\n /** The backend half (`x.backend.ts`), when the route has one. Server-only. */\n readonly backend?: string;\n /** Both halves, merged and checked. */\n readonly load: () => Promise<RouteModule>;\n}",
13422
+ "signature": "export interface RouteEntry {\n readonly id: string;\n readonly pattern: string;\n readonly layoutIds: readonly string[];\n /**\n * Param names each layout in {@link layoutIds} owns, aligned by index.\n *\n * A layout wraps a URL prefix, so these are the params it may read and the ones whose change should\n * re-run its loader - everything deeper belongs to routes beneath it. Derived per (route, layout)\n * pair rather than per layout, because one layout can own different params on different expanded\n * patterns: `[[lang]]/docs/_layout` owns nothing on `/docs/:slug` and `{lang}` on `/:lang/docs/:slug`.\n * Optional only so hand-built test manifests may omit it.\n */\n readonly layoutParams?: ReadonlyArray<readonly string[]>;\n /** `_middleware` ids in this route's ancestor chain (outermost → innermost), run before its\n * layouts. Absent ⇒ none. */\n readonly middlewareIds?: readonly string[];\n /** Param names each middleware in {@link middlewareIds} sees, aligned by index: the params of its\n * directory's URL prefix, as {@link layoutParams} holds them for a layout. */\n readonly middlewareParams?: ReadonlyArray<readonly string[]>;\n /** `_error` boundary ids in this route's ancestor chain (outermost → innermost). The last is the\n * **nearest** boundary, rendered when the route's loader throws. Always set by `buildManifest`\n * (optional only so hand-built test manifests may omit it); absent/empty ⇒ no boundary (error 500s). */\n readonly errorIds?: readonly string[];\n /** Nested `_404` page ids in this route's ancestor chain (outermost → innermost); the root `_404`\n * is not listed. The last is the **nearest**, rendered when the route's loader answers\n * `notFound()`. Absent ⇒ the root `_404`. */\n readonly notFoundIds?: readonly string[];\n /** `_loading` page ids in this route's ancestor chain (outermost → innermost). A client navigation\n * to the route shows the innermost one whose layouts are already on screen. Absent ⇒ none. */\n readonly loadingIds?: readonly string[];\n /** The frontend half: the file the browser bundle imports. */\n readonly file: string;\n /** Set when the frontend half exports `keepAlive` (found by a scan of its source): its page renders\n * inside the slot wrappers a kept page needs, on the server and in the browser. */\n readonly keepAlive?: true;\n /** The backend half (`x.backend.ts`), when the route has one. Server-only. */\n readonly backend?: string;\n /** Both halves, merged and checked. */\n readonly load: () => Promise<RouteModule>;\n}",
12897
13423
  "doc": "/** One matched route: pattern, nested layout ids (outermost → innermost), source file, loader. */"
12898
13424
  },
12899
13425
  {
@@ -13005,7 +13531,7 @@
13005
13531
  "name": "RouteModule",
13006
13532
  "kind": "interface",
13007
13533
  "package": "@nifrajs/web",
13008
- "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /** Layout loader that must run before actions and is not retained across the action's render. */\n readonly gate?: boolean;\n readonly action?: Action;\n /**\n * Backend half only: which browser origins may POST to {@link action}. When omitted, a request\n * whose `Origin` is another site's is refused with 403 before middleware, gates or the action run;\n * requests without an `Origin` (non-browser clients) pass. An array allows exactly those origins\n * (and refuses a request without one); a function decides, receiving `null` when there is none.\n * Use it for a callback a third party posts to, such as an identity provider's `form_post`.\n * `Origin` is browser-enforced, not authentication: keep the action's own auth checks.\n */\n readonly allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * Backend half only: the schema of what {@link loader} sends to the browser. Required whenever the\n * loader returns data. Keys it does not declare are dropped before the page renders; a declared\n * field of the wrong shape fails the request with a 500 naming the field's path.\n */\n readonly loaderOutput?: StandardSchemaV1;\n /** Backend half only: the schema of what {@link action} sends back, held to the same rule. */\n readonly actionOutput?: StandardSchemaV1;\n /** Optional client-only loader. It runs after hydration and on client navigations. */\n readonly clientLoader?: ClientLoader;\n /** Optional client-only submit wrapper. The server action remains mandatory for mutations. */\n readonly clientAction?: ClientAction;\n /** Named async boundaries owned by this route. The adapter renders their neutral state seam. A\n * boundary's `load` comes from {@link boundaryLoaders} in the route's backend half; the frontend\n * file declares only how it renders. */\n readonly boundaries?: readonly BoundaryRegistration[];\n /** Backend half only: each boundary's server loader, keyed by boundary name. */\n readonly boundaryLoaders?: Readonly<Record<string, BoundaryLoaderEntry>>;\n /** A Standard Schema validating this route's URL search params. When present, `ctx.search` is parsed +\n * validated against it (failing closed to the schema's defaults on invalid input); type it into the\n * loader with `LoaderArgs<Api, Env, typeof searchSchema>`. */\n readonly searchSchema?: StandardSchemaV1<unknown, Record<string, unknown>>;\n /** Search keys that are purely client-side UI (`\"tab\"`, a client-side `\"sort\"`, `\"modal\"`) and do NOT\n * affect this route's loader. When a client navigation stays on the same route + pathname and changes\n * ONLY these keys, the router updates the URL (so `useSearch` re-renders) WITHOUT re-running the loader.\n * Any other key change revalidates as usual - so omitting a data-affecting key here can never serve\n * stale data, it only forgoes the optimization. Client-only: the server always renders fresh. */\n readonly searchClientKeys?: readonly string[];\n readonly meta?: MetaInput;\n /**\n * Opt this route out of nifra's full-document client hydration. The server still renders the full\n * HTML document, loaders/actions still run, and native links/forms still work; the generated app\n * client, route chunks, and loader globals are omitted for hard navigations. Intended for static or\n * island-hydrated pages where interactivity is mounted by smaller, explicit client entries.\n */\n readonly hydrate?: boolean;\n /**\n * `false` renders this route's component in the browser only. The server still matches the route,\n * runs its gates and loaders, renders the layouts around it and embeds the data - it skips the\n * component alone, putting {@link HydrateFallback} (or nothing) in the page slot. The browser\n * hydrates against that, then renders the component. For a component that cannot render on a\n * server: one that reads `window` or a browser-only API while it renders.\n *\n * The module itself is still imported on the server, for its loader and options - so an import\n * that needs a browser at load time belongs inside the component (a dynamic `import()`), not at the\n * top of the file. Cannot be combined with `hydrate = false`: nothing would ever render the page.\n */\n readonly ssr?: boolean;\n /**\n * What the server renders in the page slot of an `ssr = false` route, and what the browser hydrates\n * before the component takes over - a skeleton, a spinner. Receives the same props as the\n * component, loader `data` included. Omitted ⇒ the slot is empty until the component renders.\n */\n readonly HydrateFallback?: unknown;\n /**\n * Any value to report through `useMatches` - a breadcrumb label, a render function, a flag a layout\n * reads about the page inside it. Layouts, pages, and status pages may export one. It is read from\n * the module on the server and in the browser, so it must be the same value on both.\n */\n readonly handle?: unknown;\n /**\n * On a root status page (`_404.tsx`, `_<status>.tsx`) or an `_error.tsx`. By default (`true`) the\n * page renders inside the layouts above it with their loader data and `meta`, as a nested `_404`\n * renders. When those layouts cannot render it - a loader throws, a gate or the middleware refuses -\n * a root status page renders alone and an `_error` inside its layouts without their data, with the\n * same status. `false` always renders them that way, and runs no layout loader for them.\n */\n readonly inLayouts?: boolean;\n /**\n * Opt a **static** route (no `:param`/`*`) into build-time prerendering (SSG): `prerenderRoutes`\n * (from `@nifrajs/web/build`) renders it to a static `index.html` at build. The loader runs at build\n * with the in-process `api` (build-safe data only - no per-request cookies/secrets); `defer()` on a\n * prerendered route resolves at build. For **dynamic** routes use {@link getStaticPaths} instead.\n */\n readonly prerender?: boolean;\n /**\n * Enumerate the concrete params to prerender for a **dynamic** (`:param`) route - the SSG path list\n * (blogs/docs/etc.). Runs at build; `prerenderRoutes` renders one `index.html` per returned path.\n */\n readonly getStaticPaths?: GetStaticPaths;\n /**\n * ISR freshness for this route, in **seconds**. `createWebApp` emits it as an\n * `x-nifra-isr-revalidate` response header that `withISR` reads to set the page's cache TTL\n * (overriding the wrapper's default). Older-than-`revalidate` cached pages are served stale while\n * regenerating. (Distinct from the action-revalidation `x-nifra-revalidate` header - a CSV path\n * list the client parses to refetch - so the two channels never alias.)\n */\n readonly revalidate?: number;\n /**\n * Bounded tags ISR on-demand invalidation (`?tag=...`) and a CDN purge reach this page by. A list, or\n * a function of the route's params and URL (`({ params }) => [\\`product:${params.id}\\`]`) for tags\n * per page. Tags travel to the CDN and reach anyone reading the origin: never put personal data in one.\n */\n readonly revalidateTags?: RevalidateTags;\n /**\n * No-framework island bundles (`@nifrajs/web/islands`) to load on this route, as `<script\n * type=\"module\">` in the document tail. Loaded **regardless of `hydrate`** - pair with\n * `export const hydrate = false` for a static page that ships zero framework JS and mounts\n * interactivity through `<Island>` markers + `mountIslands` enhancers instead.\n */\n readonly islandScripts?: readonly string[];\n}",
13534
+ "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n /** Layout loader that must run before actions and is not retained across the action's render. */\n readonly gate?: boolean;\n readonly action?: Action;\n /**\n * Backend half only: which browser origins may POST to {@link action}. When omitted, a request\n * whose `Origin` is another site's is refused with 403 before middleware, gates or the action run;\n * requests without an `Origin` (non-browser clients) pass. An array allows exactly those origins\n * (and refuses a request without one); a function decides, receiving `null` when there is none.\n * Use it for a callback a third party posts to, such as an identity provider's `form_post`.\n * `Origin` is browser-enforced, not authentication: keep the action's own auth checks.\n */\n readonly allowedOrigins?: ReadonlyArray<string> | ((origin: string | null) => boolean);\n /**\n * Backend half only: the schema of what {@link loader} sends to the browser. Required whenever the\n * loader returns data. Keys it does not declare are dropped before the page renders; a declared\n * field of the wrong shape fails the request with a 500 naming the field's path.\n */\n readonly loaderOutput?: StandardSchemaV1;\n /** Backend half only: the schema of what {@link action} sends back, held to the same rule. */\n readonly actionOutput?: StandardSchemaV1;\n /**\n * Experimental, backend half only: the loader of a partially prerendered page's shared shell. It\n * receives no request, so its output is the same for every visitor and the shell is cached.\n */\n readonly shellLoader?: (ctx: ShellCtx) => unknown;\n /** Experimental, backend half only: the schema of what {@link shellLoader} returns. */\n readonly shellOutput?: StandardSchemaV1;\n /**\n * Experimental, backend half only: query parameters that select a different shell, each with its\n * closed set of values (`{ search: { color: [\"red\", \"blue\"] } }`). Any other parameter, or a value\n * outside its set, builds the default shell; holes still read the whole query.\n */\n readonly shellVariations?: ShellVariations;\n /** Optional client-only loader. It runs after hydration and on client navigations. */\n readonly clientLoader?: ClientLoader;\n /** Optional client-only submit wrapper. The server action remains mandatory for mutations. */\n readonly clientAction?: ClientAction;\n /** Named async boundaries owned by this route. The adapter renders their neutral state seam. A\n * boundary's `load` comes from {@link boundaryLoaders} in the route's backend half; the frontend\n * file declares only how it renders. */\n readonly boundaries?: readonly BoundaryRegistration[];\n /** Backend half only: each boundary's server loader, keyed by boundary name. */\n readonly boundaryLoaders?: Readonly<Record<string, BoundaryLoaderEntry>>;\n /** A Standard Schema validating this route's URL search params. When present, `ctx.search` is parsed +\n * validated against it (failing closed to the schema's defaults on invalid input); type it into the\n * loader with `LoaderArgs<Api, Env, typeof searchSchema>`. */\n readonly searchSchema?: StandardSchemaV1<unknown, Record<string, unknown>>;\n /** Search keys that are purely client-side UI (`\"tab\"`, a client-side `\"sort\"`, `\"modal\"`) and do NOT\n * affect this route's loader. When a client navigation stays on the same route + pathname and changes\n * ONLY these keys, the router updates the URL (so `useSearch` re-renders) WITHOUT re-running the loader.\n * Any other key change revalidates as usual - so omitting a data-affecting key here can never serve\n * stale data, it only forgoes the optimization. Client-only: the server always renders fresh. */\n readonly searchClientKeys?: readonly string[];\n /**\n * `false` gives every client reload of this page (an action's revalidation, `invalidate()`, a live\n * refresh) fresh data. By default a reload keeps the identity of the parts of `data` and the layouts'\n * data that it did not change, so an unchanged row keeps its DOM and component state, and a renderer\n * that memoizes on identity skips it. Not every unchanged row, though: an array whose first 32\n * elements all changed is taken whole, later unchanged elements included, so code that needs a row's\n * identity must not count on it. Opt out for a page whose code compares `data` against its value\n * from before the reload, or whose rows re-render whatever their identity, which then pay the\n * comparison for nothing. Client-only.\n */\n readonly shareData?: boolean;\n /**\n * Keep this page mounted after the visitor leaves it, so back and forward show it again as it was\n * left: its component state, form fields, inner scroll offsets and focus. At most three pages are\n * kept per tab, each for at most 10 minutes; a kept page is shown again only by a back or forward to\n * its own history entry, and its data reloads in place. A sign-in or sign-out drops every kept page.\n * Client-only.\n */\n readonly keepAlive?: true | KeepAliveOptions;\n readonly meta?: MetaInput;\n /**\n * Opt this route out of nifra's full-document client hydration. The server still renders the full\n * HTML document, loaders/actions still run, and native links/forms still work; the generated app\n * client, route chunks, and loader globals are omitted for hard navigations. Intended for static or\n * island-hydrated pages where interactivity is mounted by smaller, explicit client entries.\n */\n readonly hydrate?: boolean;\n /**\n * `false` renders this route's component in the browser only. The server still matches the route,\n * runs its gates and loaders, renders the layouts around it and embeds the data - it skips the\n * component alone, putting {@link HydrateFallback} (or nothing) in the page slot. The browser\n * hydrates against that, then renders the component. For a component that cannot render on a\n * server: one that reads `window` or a browser-only API while it renders.\n *\n * The module itself is still imported on the server, for its loader and options - so an import\n * that needs a browser at load time belongs inside the component (a dynamic `import()`), not at the\n * top of the file. Cannot be combined with `hydrate = false`: nothing would ever render the page.\n */\n readonly ssr?: boolean;\n /**\n * What the server renders in the page slot of an `ssr = false` route, and what the browser hydrates\n * before the component takes over - a skeleton, a spinner. Receives the same props as the\n * component, loader `data` included. Omitted ⇒ the slot is empty until the component renders.\n */\n readonly HydrateFallback?: unknown;\n /**\n * Any value to report through `useMatches` - a breadcrumb label, a render function, a flag a layout\n * reads about the page inside it. Layouts, pages, and status pages may export one. It is read from\n * the module on the server and in the browser, so it must be the same value on both.\n */\n readonly handle?: unknown;\n /**\n * On a root status page (`_404.tsx`, `_<status>.tsx`) or an `_error.tsx`. By default (`true`) the\n * page renders inside the layouts above it with their loader data and `meta`, as a nested `_404`\n * renders. When those layouts cannot render it - a loader throws, a gate or the middleware refuses -\n * a root status page renders alone and an `_error` inside its layouts without their data, with the\n * same status. `false` always renders them that way, and runs no layout loader for them.\n */\n readonly inLayouts?: boolean;\n /**\n * Opt a **static** route (no `:param`/`*`) into build-time prerendering (SSG): `prerenderRoutes`\n * (from `@nifrajs/web/build`) renders it to a static `index.html` at build. The loader runs at build\n * with the in-process `api` (build-safe data only - no per-request cookies/secrets); `defer()` on a\n * prerendered route resolves at build. For **dynamic** routes use {@link getStaticPaths} instead.\n */\n readonly prerender?: boolean;\n /**\n * Enumerate the concrete params to prerender for a **dynamic** (`:param`) route - the SSG path list\n * (blogs/docs/etc.). Runs at build; `prerenderRoutes` renders one `index.html` per returned path.\n */\n readonly getStaticPaths?: GetStaticPaths;\n /**\n * ISR freshness for this route, in **seconds**. `createWebApp` emits it as an\n * `x-nifra-isr-revalidate` response header that `withISR` reads to set the page's cache TTL\n * (overriding the wrapper's default). Older-than-`revalidate` cached pages are served stale while\n * regenerating. (Distinct from the action-revalidation `x-nifra-revalidate` header - a CSV path\n * list the client parses to refetch - so the two channels never alias.)\n */\n readonly revalidate?: number;\n /**\n * Bounded tags ISR on-demand invalidation (`?tag=...`) and a CDN purge reach this page by. A list, or\n * a function of the route's params and URL (`({ params }) => [\\`product:${params.id}\\`]`) for tags\n * per page. Tags travel to the CDN and reach anyone reading the origin: never put personal data in one.\n */\n readonly revalidateTags?: RevalidateTags;\n /**\n * No-framework island bundles (`@nifrajs/web/islands`) to load on this route, as `<script\n * type=\"module\">` in the document tail. Loaded **regardless of `hydrate`** - pair with\n * `export const hydrate = false` for a static page that ships zero framework JS and mounts\n * interactivity through `<Island>` markers + `mountIslands` enhancers instead.\n */\n readonly islandScripts?: readonly string[];\n}",
13009
13535
  "doc": "/** A route module - the default component + optional loader / action / meta. */"
13010
13536
  },
13011
13537
  {
@@ -13137,7 +13663,7 @@
13137
13663
  "name": "RouterState",
13138
13664
  "kind": "interface",
13139
13665
  "package": "@nifrajs/web",
13140
- "signature": "export interface RouterState {\n readonly serverComponents?: import(\"./server-components/types.js\").ComponentState | undefined;\n readonly routeId: string;\n readonly params: Record<string, string>;\n /** The current URL path (used to revalidate the active loader after an action). */\n readonly path: string;\n readonly data: unknown;\n /** Per-layout loader data, aligned with the matched chain's leading layout prefix. Absent when no\n * layout in that chain has a loader. */\n readonly layoutData?: readonly unknown[] | undefined;\n /** Neutral named-boundary states for the active route. */\n readonly boundaries?: BoundaryStates;\n /** An action's data return after a client-side submit (cleared on navigation). */\n readonly actionData?: unknown;\n /** True while a navigation or submit is in flight (drives loading UI). */\n readonly pending: boolean;\n /** The path a navigation or a submit's redirect is loading while `pending`; a redirect the router\n * follows moves it to the target. Lets a `NavLink` know whether its own `to` is the one loading;\n * `undefined` when idle. */\n readonly pendingPath?: string | undefined;\n /** The in-flight submit (set during a `submit`, cleared when it settles) - for optimistic UI. */\n readonly submission?: Submission;\n}",
13666
+ "signature": "export interface RouterState {\n readonly serverComponents?: import(\"./server-components/types.js\").ComponentState | undefined;\n readonly routeId: string;\n readonly params: Record<string, string>;\n /** The current URL path (used to revalidate the active loader after an action). While\n * {@link intercepted} is set it is the target shown in the boundary, not the page's own. */\n readonly path: string;\n readonly data: unknown;\n /** Per-layout loader data, aligned with the matched chain's leading layout prefix. Absent when no\n * layout in that chain has a loader. */\n readonly layoutData?: readonly unknown[] | undefined;\n /** Neutral named-boundary states for the active route. */\n readonly boundaries?: BoundaryStates;\n /** An action's data return after a client-side submit (cleared on navigation). */\n readonly actionData?: unknown;\n /** True while a navigation or submit is in flight (drives loading UI). */\n readonly pending: boolean;\n /** The path a navigation or a submit's redirect is loading while `pending`; a redirect the router\n * follows moves it to the target. Lets a `NavLink` know whether its own `to` is the one loading;\n * `undefined` when idle. */\n readonly pendingPath?: string | undefined;\n /** The in-flight submit (set during a `submit`, cleared when it settles) - for optimistic UI. */\n readonly submission?: Submission;\n /** Set while an intercept boundary shows a navigation's target over the page: the boundary holding\n * it, and the path the page underneath was loaded from. The page revalidates under `pagePath`, the\n * boundary under `path`. */\n readonly intercepted?: Intercepted;\n /** Opaque: which live load the page data on screen came from (`@nifrajs/web/live-client`). */\n readonly live?: unknown;\n /** The page instance on screen, when the app keeps pages alive (`@nifrajs/web/keep-alive`). */\n readonly instance?: string | undefined;\n /** Pages kept mounted and hidden, least recently shown first. Absent when none is kept. */\n readonly kept?: readonly KeptPage[] | undefined;\n /** This publish showed a kept page again. */\n readonly restored?: boolean | undefined;\n /** A page shown again is reloading its data in place: not a navigation, so `pending` stays false. */\n readonly revalidating?: boolean | undefined;\n}",
13141
13667
  "doc": "/** The router's observable state. A new object is published on every transition. */"
13142
13668
  },
13143
13669
  {
@@ -13419,7 +13945,7 @@
13419
13945
  "name": "RunQueryOptions",
13420
13946
  "kind": "interface",
13421
13947
  "package": "@nifrajs/mcp-db",
13422
- "signature": "export interface RunQueryOptions {\n /**\n * REQUIRED. Authorize each `run_query` call at the transport boundary (inspect the inbound\n * Request's auth). Return false to reject with a JSON-RPC error. There is no unauthenticated\n * mode - schema tools are the anonymous surface. Note: `run_query` is therefore HTTP-only;\n * direct `handle()` dispatch rejects it (no Request to authorize - fails closed).\n */\n readonly authorize: (context: McpDbAuthorizeContext) => boolean | Promise<boolean>;\n /** Max rows returned per query (default 100). */\n readonly maxRows?: number;\n /**\n * Max serialized result size in bytes (default 100 KB). It also bounds what is read: a text or\n * blob cell longer than this arrives as `\"<n bytes>\"`, and rows stop being read once their cells\n * pass it, so a query cannot make the server hold more than about one row past the budget.\n */\n readonly maxResultBytes?: number;\n /**\n * Maximum wall-clock time for planning, execution, and optional counting (default 5 seconds).\n * The deadline always bounds the RESPONSE. Whether it also stops the WORK depends on where the\n * query runs: a file-backed database runs it in a reusable read-only worker that is terminated\n * on expiry, while an in-memory database (or a shim with no `filename`) runs it on this thread,\n * where a synchronous statement cannot be preempted and the overrun is only reported after it\n * returns.\n */\n readonly queryTimeoutMs?: number;\n /** Return an exact total after row truncation. Off by default because it re-executes the query. */\n readonly exactTotal?: boolean;\n /** Maximum simultaneous run_query calls on this database connection (default 1). */\n readonly maxConcurrentQueries?: number;\n}"
13948
+ "signature": "export interface RunQueryOptions {\n /**\n * REQUIRED. Authorize each `run_query` call at the transport boundary (inspect the inbound\n * Request's auth). Return false to reject with a JSON-RPC error. There is no unauthenticated\n * mode - schema tools are the anonymous surface. Note: `run_query` is therefore HTTP-only;\n * direct `handle()` dispatch rejects it (no Request to authorize - fails closed).\n */\n readonly authorize: (context: McpDbAuthorizeContext) => boolean | Promise<boolean>;\n /** Max rows returned per query (default 100). */\n readonly maxRows?: number;\n /**\n * Max serialized result size in bytes (default 100 KB). It also bounds what is read: a text or\n * blob cell longer than this arrives as `\"<n bytes>\"`, and rows stop being read once their cells\n * pass it, so a query cannot make the server hold more than about one row past the budget.\n */\n readonly maxResultBytes?: number;\n /**\n * Maximum wall-clock time for planning, execution, and optional counting (default 5 seconds). It\n * also bounds `list_tables`' row counts, at the same 5-second default when `runQuery` is omitted.\n * The deadline always bounds the RESPONSE. Whether it also stops the WORK depends on where the\n * query runs: a file-backed database runs it in a reusable read-only worker that is terminated\n * on expiry, while an in-memory database (or a shim with no `filename`) runs it on this thread,\n * where a synchronous statement cannot be preempted and the overrun is only reported after it\n * returns.\n */\n readonly queryTimeoutMs?: number;\n /** Return an exact total after row truncation. Off by default because it re-executes the query. */\n readonly exactTotal?: boolean;\n /** Maximum simultaneous run_query calls on this database connection (default 1). */\n readonly maxConcurrentQueries?: number;\n}"
13423
13949
  },
13424
13950
  {
13425
13951
  "name": "RunRecoveryMachine",
@@ -13577,7 +14103,7 @@
13577
14103
  "name": "SERVER_ENTRY_OPTIONS",
13578
14104
  "kind": "const",
13579
14105
  "package": "@nifrajs/web",
13580
- "signature": "export declare const SERVER_ENTRY_OPTIONS: readonly [\"apiPrefix\", \"apiStrip\", \"mounts\", \"csp\", \"nonce\", \"i18n\", \"hostPolicy\"];",
14106
+ "signature": "export declare const SERVER_ENTRY_OPTIONS: readonly [\"apiPrefix\", \"apiStrip\", \"mounts\", \"csp\", \"nonce\", \"i18n\", \"hostPolicy\", \"live\"];",
13581
14107
  "doc": "/** The `createWebApp` options a generated server entry can import from the app's framework module. */"
13582
14108
  },
13583
14109
  {
@@ -13691,13 +14217,13 @@
13691
14217
  "name": "SSEInit",
13692
14218
  "kind": "interface",
13693
14219
  "package": "@nifrajs/core",
13694
- "signature": "export interface SSEInit {\n readonly status?: number;\n readonly headers?: ConstructorParameters<typeof Headers>[0];\n /** Send a `: ` comment ping every N ms so idle proxies don't drop the connection. */\n readonly keepAlive?: number;\n /**\n * Bytes of sent events one client may leave unread, default 1 MiB. Past it the client is dropped:\n * `signal` aborts, the queued frames are released, and later sends are no-ops, so a reader that\n * stalls cannot hold server memory without limit. Raise it for a burst larger than this sent before\n * the client can read; `Infinity` turns the limit off.\n */\n readonly maxBufferedBytes?: number;\n}"
14220
+ "signature": "export interface SSEInit {\n readonly status?: number;\n readonly headers?: ConstructorParameters<typeof Headers>[0];\n /** Send a `: ` comment ping every N ms so idle proxies don't drop the connection. */\n readonly keepAlive?: number;\n /**\n * Bytes of sent events one client may leave unread, default 1 MiB. Past it the client is dropped:\n * `signal` aborts, the queued frames are released, and later sends are no-ops, so a reader that\n * stalls cannot hold server memory without limit. Raise it for a burst larger than this sent before\n * the client can read. A single frame over the cap is also refused; `Infinity` turns the limit off.\n */\n readonly maxBufferedBytes?: number;\n}"
13695
14221
  },
13696
14222
  {
13697
14223
  "name": "SSEInit",
13698
14224
  "kind": "interface",
13699
14225
  "package": "nifra",
13700
- "signature": "export interface SSEInit {\n readonly status?: number;\n readonly headers?: ConstructorParameters<typeof Headers>[0];\n /** Send a `: ` comment ping every N ms so idle proxies don't drop the connection. */\n readonly keepAlive?: number;\n /**\n * Bytes of sent events one client may leave unread, default 1 MiB. Past it the client is dropped:\n * `signal` aborts, the queued frames are released, and later sends are no-ops, so a reader that\n * stalls cannot hold server memory without limit. Raise it for a burst larger than this sent before\n * the client can read; `Infinity` turns the limit off.\n */\n readonly maxBufferedBytes?: number;\n}"
14226
+ "signature": "export interface SSEInit {\n readonly status?: number;\n readonly headers?: ConstructorParameters<typeof Headers>[0];\n /** Send a `: ` comment ping every N ms so idle proxies don't drop the connection. */\n readonly keepAlive?: number;\n /**\n * Bytes of sent events one client may leave unread, default 1 MiB. Past it the client is dropped:\n * `signal` aborts, the queued frames are released, and later sends are no-ops, so a reader that\n * stalls cannot hold server memory without limit. Raise it for a burst larger than this sent before\n * the client can read. A single frame over the cap is also refused; `Infinity` turns the limit off.\n */\n readonly maxBufferedBytes?: number;\n}"
13701
14227
  },
13702
14228
  {
13703
14229
  "name": "SSEMessage",
@@ -13902,6 +14428,18 @@
13902
14428
  "signature": "export interface SassCompiler {\n compileString(source: string, options?: {\n readonly syntax?: \"scss\" | \"indented\";\n readonly style?: \"expanded\" | \"compressed\";\n readonly loadPaths?: readonly string[];\n readonly url?: URL;\n }): {\n readonly css: string;\n };\n}",
13903
14429
  "doc": "/** The subset of the `sass` / `sass-embedded` API this plugin uses. Both packages satisfy it. */"
13904
14430
  },
14431
+ {
14432
+ "name": "ScaffoldOptions",
14433
+ "kind": "interface",
14434
+ "package": "create-nifra",
14435
+ "signature": "export interface ScaffoldOptions {\n /** Destination directory. */\n readonly target: string;\n /** Template to copy. Default `\"api\"`. */\n readonly template?: TemplateName;\n /** Frontend framework (site template only). Default `\"react\"`. */\n readonly framework?: string;\n /** Where the site deploys (site template only): `bun` (default), `node`, `deno`, `cloudflare` or\n * `vercel`. */\n readonly deployTarget?: string;\n /** Add a Dockerfile that builds and runs the server (`bun` and `node` targets). */\n readonly docker?: boolean;\n /** Emit a CI deploy workflow for the site's target. Only `\"github\"` today. */\n readonly ci?: string;\n /** Wire a data layer: `drizzle-{libsql,postgres,sqlite}` | `prisma-{postgres,sqlite}` | `kysely-postgres`. */\n readonly db?: string;\n /** Wire authentication: `better-auth` (requires `--db` - auth needs a database). */\n readonly auth?: string;\n /** Allow scaffolding into a non-empty directory (copies template, overwrites collisions). */\n readonly force?: boolean;\n /** Path to a local nifra monorepo - replaces `@nifrajs/*` semver deps with `file:` refs so\n * the app runs against the local source before the packages are published to npm. */\n readonly link?: string;\n}"
14436
+ },
14437
+ {
14438
+ "name": "ScaffoldResult",
14439
+ "kind": "interface",
14440
+ "package": "create-nifra",
14441
+ "signature": "export interface ScaffoldResult {\n readonly name: string;\n readonly template: TemplateName;\n readonly framework?: Framework;\n /** Where a site deploys, and whether it ships a Dockerfile. */\n readonly deploy?: {\n readonly target: DeployTarget;\n readonly label: string;\n readonly docker: boolean;\n };\n /** The CI provider a workflow was generated for, when `--ci` was passed. */\n readonly ci?: \"github\";\n /** Repo secrets the generated workflow needs (for the next-steps message). */\n readonly ciSecrets?: readonly string[];\n /** The Drizzle preset wired in, when `--db` was passed. */\n readonly db?: DbChoice;\n /** The auth preset wired in, when `--auth` was passed. */\n readonly auth?: AuthChoice;\n /** Local nifra monorepo path when `--link` was used; undefined when using published packages. */\n readonly link?: string;\n}"
14442
+ },
13905
14443
  {
13906
14444
  "name": "ScheduledController",
13907
14445
  "kind": "interface",
@@ -13946,9 +14484,16 @@
13946
14484
  "name": "SchemaReflection",
13947
14485
  "kind": "interface",
13948
14486
  "package": "@nifrajs/core",
13949
- "signature": "export interface SchemaReflection {\n /** The Standard Schema validator, when the value implements Standard Schema v1. */\n readonly standard: StandardSchemaV1 | undefined;\n /** Raw JSON Schema metadata, when the value exposes it or is itself a raw JSON Schema. */\n readonly jsonSchema: JsonSchema | undefined;\n /** Top-level object fields, or `undefined` when the JSON Schema is absent/non-object. */\n readonly fields: readonly ReflectedSchemaField[] | undefined;\n /**\n * The media types a body schema reads through a parser of its own (`bodyParser`), beyond the\n * JSON and urlencoded bodies every body schema reads. Absent when it declares none.\n */\n readonly mediaTypes?: readonly string[];\n}",
14487
+ "signature": "export interface SchemaReflection {\n /** The Standard Schema validator, when the value implements Standard Schema v1. */\n readonly standard: StandardSchemaV1 | undefined;\n /** Raw JSON Schema metadata, when the value exposes it or is itself a raw JSON Schema. */\n readonly jsonSchema: JsonSchema | undefined;\n /**\n * Set when `jsonSchema` came from the schema's Standard JSON Schema converter (`~standard.jsonSchema`)\n * rather than from metadata it carries. Such output may use `$defs` and `$ref`.\n */\n readonly converted?: true;\n /** Top-level object fields, or `undefined` when the JSON Schema is absent/non-object. */\n readonly fields: readonly ReflectedSchemaField[] | undefined;\n /**\n * The media types a body schema reads through a parser of its own (`bodyParser`), beyond the\n * JSON and urlencoded bodies every body schema reads. Absent when it declares none.\n */\n readonly mediaTypes?: readonly string[];\n}",
13950
14488
  "doc": "/** Validation and introspection capabilities discovered for one schema-like value. */"
13951
14489
  },
14490
+ {
14491
+ "name": "SchemaSide",
14492
+ "kind": "type",
14493
+ "package": "@nifrajs/core",
14494
+ "signature": "export type SchemaSide = \"input\" | \"output\";",
14495
+ "doc": "/** Which side of a schema to describe: the value a request sends, or the value a response carries. */"
14496
+ },
13952
14497
  {
13953
14498
  "name": "SchemaSnapshot",
13954
14499
  "kind": "interface",
@@ -14117,7 +14662,7 @@
14117
14662
  "name": "ServeDatabaseAsMcpOptions",
14118
14663
  "kind": "interface",
14119
14664
  "package": "@nifrajs/mcp-db",
14120
- "signature": "export interface ServeDatabaseAsMcpOptions {\n /**\n * REQUIRED allowlist of tables the MCP surface may see. `list_tables`/`describe_table` are\n * restricted to it and `run_query` plans are verified against it. Empty array → construction\n * throws; expose nothing by accident, ever.\n */\n readonly tables: readonly string[];\n /** Enable the `run_query` tool. Omitted → schema tools only. */\n readonly runQuery?: RunQueryOptions;\n /** MCP server identity (defaults: name `nifra-db`, version `1.0.0`). */\n readonly name?: string;\n readonly version?: string;\n /**\n * Set `PRAGMA query_only = ON` on the connection at construction (default true). Disable ONLY\n * when the same connection must also serve writes elsewhere in the app - with it disabled,\n * `run_query` still gates on SELECT/WITH + plan verification, but the engine-level guarantee is\n * yours to provide (e.g. open a second, read-only connection for the MCP mount - preferred).\n */\n readonly enforceQueryOnly?: boolean;\n /**\n * Host allowlist for the HTTP transport (e.g. `[\"localhost\", \"127.0.0.1\"]`). Set it when the server\n * listens on localhost or a private network: the same-origin default alone does not stop a\n * DNS-rebound browser page from reading the schema tools.\n */\n readonly allowedHosts?: readonly string[];\n}"
14665
+ "signature": "export interface ServeDatabaseAsMcpOptions {\n /**\n * REQUIRED allowlist of tables the MCP surface may see. `list_tables`/`describe_table` are\n * restricted to it and `run_query` plans are verified against it. Empty array → construction\n * throws; expose nothing by accident, ever.\n */\n readonly tables: readonly string[];\n /** Enable the `run_query` tool. Omitted → schema tools only. */\n readonly runQuery?: RunQueryOptions;\n /** MCP server identity (defaults: name `nifra-db`, version `1.0.0`). */\n readonly name?: string;\n readonly version?: string;\n /**\n * Set `PRAGMA query_only = ON` on the connection at construction (default true). Disable ONLY\n * when the same connection must also serve writes elsewhere in the app - with it disabled,\n * `run_query` still gates on SELECT/WITH + compiled-statement verification, but the engine-level guarantee is\n * yours to provide (e.g. open a second, read-only connection for the MCP mount - preferred).\n */\n readonly enforceQueryOnly?: boolean;\n /**\n * Host allowlist for the HTTP transport (e.g. `[\"localhost\", \"127.0.0.1\"]`). Set it when the server\n * listens on localhost or a private network: the same-origin default alone does not stop a\n * DNS-rebound browser page from reading the schema tools.\n */\n readonly allowedHosts?: readonly string[];\n}"
14121
14666
  },
14122
14667
  {
14123
14668
  "name": "ServeOptions",
@@ -14144,6 +14689,12 @@
14144
14689
  "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * URL paths of the content-hashed files, such as a client build manifest's `assets`. When set,\n * `immutable` applies only to these; any other file is sent with its validators and no\n * `cache-control`, so a file that keeps its name across deploys still revalidates.\n */\n readonly hashedFiles?: Iterable<string>;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /**\n * Whether this mount may answer `pathname` (as sent, without the query) for a request addressed to\n * `host` (its Host header). `false` passes the request on, without touching the filesystem, to the\n * next mount and then the app - the seam a host policy uses so a host's refused file meets the\n * app's own refusal instead of being served.\n */\n readonly allow?: (host: string, pathname: string) => boolean;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered `404` - the same response as a missing file, so probing\n * can't distinguish \"hidden\" from \"absent\". Dotfiles land in build output by accident, not by\n * design (`.env` next to the bundle, a `.git` dir in a copied tree), so serving them is opt-in.\n * `/.well-known` is public by definition (RFC 8615) and always served, as `servePublicDir` does.\n * The rule applies to the requested path and again to the file it resolves to, so a visible name\n * linking to `.env` is denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n}",
14145
14690
  "doc": "/**\n * Serve static files from a directory (e.g. the client build) under a URL prefix - so a self-hosted\n * Node deploy doesn't need a CDN or a hand-rolled `/assets/*` handler. (On Cloudflare/Vercel the\n * platform serves assets; this is for `node server.js`.)\n */"
14146
14691
  },
14692
+ {
14693
+ "name": "ServeStdioOptions",
14694
+ "kind": "interface",
14695
+ "package": "@nifrajs/mcp",
14696
+ "signature": "export interface ServeStdioOptions extends Omit<StdioTransportOptions, \"onRequest\" | \"onResponse\"> {\n /**\n * Answer a throwing tool with its error message instead of only \"Tool execution failed\". Paths, SQL\n * diagnostics and provider responses end up in error messages; enable it only when every process that\n * can write to stdin may read them.\n */\n readonly exposeToolErrors?: boolean;\n}"
14697
+ },
14147
14698
  {
14148
14699
  "name": "ServeTestAppOptions",
14149
14700
  "kind": "interface",
@@ -14160,14 +14711,14 @@
14160
14711
  "name": "Server",
14161
14712
  "kind": "class",
14162
14713
  "package": "@nifrajs/core",
14163
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it. Open WebSockets\n * get a 1001 close at once and the same window to finish it, before any `onStop` hook runs.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
14714
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it. Open WebSockets\n * get a 1001 close at once and the same window to finish it, before any `onStop` hook runs.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
14164
14715
  "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 */"
14165
14716
  },
14166
14717
  {
14167
14718
  "name": "Server",
14168
14719
  "kind": "class",
14169
14720
  "package": "nifra",
14170
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it. Open WebSockets\n * get a 1001 close at once and the same window to finish it, before any `onStop` hook runs.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
14721
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n /** Each socket path, its declared capabilities, the evidence declarations its handshake captured\n * and the chain it runs; reflection reads it. */\n private readonly wsRoutes;\n /** `wsChanges` when `wsMountsLive` was last worked out; -1 until then. */\n private wsMountsCheckedAt;\n /** Whether an app mounted here takes WebSocket upgrades, as of `wsMountsCheckedAt`. */\n private wsMountsLive;\n /** In-process pub/sub backing `ws.subscribe(topic)` + `app.publish(topic, data)` (single-instance).\n * Created by the first `app.ws()` via the `@nifrajs/core/ws` runtime - `undefined` until then, so a\n * no-WebSocket app never constructs (or bundles) it. */\n private topics;\n /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, with a validated-send route,\n * or when a mounted app takes upgrades. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n private readonly formOrigins;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly fetchMounts;\n private mountOrder;\n /** Number of composed mounts that must run before the parent route table. Keeps legacy mounts off the hot path. */\n private preRouteMountCount;\n /** Capacity-admission gate; `undefined` = off (the request path pays nothing). */\n private readonly capacityGate;\n private readonly onCapabilityUse;\n private readonly capabilityInterceptors;\n private readonly capabilityObservers;\n /** The installed effect-ledger runtime (owns the sink + per-route resolution + settle), or\n * `undefined` when the effect-ledger plugin is not installed. */\n private effectLedgerRuntime;\n /** The installed idempotency runtime (owns the app-wide default store + the dedupe lane), or\n * `undefined` when the idempotency plugin is not installed. */\n private idempotencyRuntime;\n /** Installed opt-in runtime for `.tool()`/`.resource()`/`.prompt()`; `undefined` until `.use(mcp())`. */\n private mcpRuntime;\n /** Installed answer for a request no route matched; `undefined` (the plain 404) until `.use(notFound())`. */\n private notFoundLane;\n /** Installed Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private bunSockets;\n private signalHandler;\n private sealed;\n private readonly derives;\n /** Dedicated authentication stages captured by subsequent routes. */\n private readonly authStages;\n private readonly decorations;\n private readonly beforeHandleHooks;\n private readonly afterHandleHooks;\n private readonly onErrorHooks;\n private readonly aroundHooks;\n private readonly onRequestHooks;\n private readonly onNodeRequestHooks;\n /** Registration-time eligibility for the Node request twin lane. */\n private nodeRequestHooksComplete;\n /** True when every request hook is safe to skip on a Bun native route. */\n private bunNativeRequestHooksSafe;\n private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\n /** True when every response hook only mutates headers and can run after a Bun fused response. */\n private bunNativeResponseHeadersOnly;\n /**\n * True once a bundle registers a RAW `onNodeResponse` twin - one handed the outcome's header\n * record itself rather than the case-normalizing view. Their names are contractually the wire\n * spelling, but registration cannot PROVE it, so such an app forgoes the all-lowercase mark and\n * every reader re-derives the answer, exactly as before the mark existed.\n */\n private hasRawNodeResponseHook;\n private readonly onResponseFinalizedHooks;\n /**\n * Statically declared response headers, merged and prebuilt at registration; `undefined` (the\n * default) leaves every render path in its original shape. These are NOT response hooks - they are\n * folded into response construction - so declaring them keeps the fused native lanes an\n * `onResponse` hook would have disabled.\n */\n private staticResponseHeaders;\n /** A group's view of the static headers its enclosing scopes declared before it was created. */\n private inheritedStatics;\n /** A group's view of the plugins its enclosing scopes applied before it was created; unset while\n * a plugin applies, so its own dependency `use()` shares the parent's copy. */\n private inheritedPlugins;\n /** `wrapResponse` for the Web lanes: identity until static headers exist to fold into the\n * framework's own error/404/timeout renders, which are built outside the header init. */\n private wrapWebResponse;\n private webResponseTimeout;\n /** Body/raw response hooks need a framework-payload marker; keep that decision per app. */\n private responseBodyTag;\n private readonly responseBodyOwners;\n private readonly finalizeResponse;\n private readonly responseRequests;\n /** A request the WebSocket handshake check ran the onRequest hooks on and then passed to HTTP →\n * what the hooks returned, so `fetch` routes that instead of running the hooks a second time. */\n private wsHookedPasses;\n /** Original source → request observed by generic request hooks, including in-place mutations. */\n private readonly responseSources;\n /** Memoized NodeRequestContext per plain-`Request` source - see {@link nodeRequestContextOf}. */\n private readonly nodeContexts;\n /** Plugins/middleware already applied via `use`, by name - for idempotent dedupe. */\n private readonly appliedPlugins;\n /** Order-scoped evidence captured by routes registered after an assured plugin. */\n private readonly activeAssurance;\n /** App-wide evidence from global hooks; applies retroactively to every route. */\n private readonly globalAssurance;\n /** App-declared MCP resources / prompts (via {@link resource} / {@link prompt}), read by `nifra mcp`. */\n private readonly mcpResourceList;\n private readonly mcpPromptList;\n /** Kept so a {@link group} scope is built with exactly this server's settings: fused lanes read\n * several of them at request time, so a group route must never run under different ones. */\n private readonly options;\n /** Static prefix joined onto every route this server registers; non-empty only on a group scope. */\n private routePrefix;\n constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks. An\n * `authenticate()` stage registered before the mount, or a required auth plugin built on one\n * (`bearer()`, `jwt()`, `basicAuth()`, `apiKey()`), refuses a request before the handler sees it;\n * mount before the stage to keep the legacy surface public.\n *\n * It carries HTTP only: a WebSocket upgrade under the prefix reaches the handler as an ordinary\n * request and never becomes a socket. Serve that path's sockets with `app.ws()` routes or a\n * mounted child app, or keep the legacy server running beside this one for them.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /**\n * Compose a child fetch app under a literal path prefix.\n *\n * Composed mounts run after the app-global request phase and before the parent's route table. This\n * makes them safe to use in an SSR shell whose `/*` page route would otherwise swallow an API mount.\n * If the child exposes `resolveWebSocketUpgrade`, the same mount also participates in adapter-owned\n * WebSocket upgrades; the serving adapter still upgrades its original socket, while the child sees\n * the mounted request path (stripped when requested).\n *\n * `fallbackOn: 404` is deliberately limited to GET/HEAD/OPTIONS at dispatch time. Those methods are\n * replayable without buffering an untrusted request body; POST/PUT/PATCH and streaming requests\n * never get retried after a child has had a chance to consume them.\n */\n mount(options: MountOptions<EnvOf<Ctx>>): this;\n /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n /**\n * Register a dedicated authentication stage for subsequent routes, and for the `mount()` and\n * `mountFetch()` handlers registered after it: a request it refuses never reaches them.\n *\n * Unlike `derive`, this stage receives a body-blind authentication capsule and is compiled before\n * route validation. Keeping it separate prevents an unrelated derive from accidentally becoming a\n * security gate and lets the route compiler retain a protected fast lane.\n *\n * A stage that throws, or returns anything but `authenticated(principal)` or `rejected(...)`, fails\n * closed with 503 `{ ok: false, error: \"auth_unavailable\" }`. The cause goes where a handler's error\n * goes: to `onError`, whose response replaces the 503, and when no hook answers, to the logger. A\n * thrown `Response` or `status(...)` is sent as thrown, as it is from a handler.\n */\n authenticate<Principal>(stage: AuthenticationStage<Principal, EnvOf<Ctx>>): Server<R, Ctx & {\n readonly principal: Principal;\n }, HookOutput>;\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` or a `status()` result to\n * short-circuit, or a replacement `Request` to continue routing with a rewritten method/URL/headers.\n * Global. A throw or rejection goes to every registered {@link onError} (route-less context), then\n * the logged default 500.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500, or 503\n * `auth_unavailable` for a failed {@link authenticate} stage). Order-scoped: captured by routes\n * declared *after* this call, none before; one added after the last route reaches no route (see\n * {@link ServerOptions.unusedScopedHooks}). Every one answers an {@link onRequest} failure. */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. In a group, a name the group declares replaces the value its\n * enclosing scopes declared before the group, on the group's routes. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /**\n * Apply `all()` or `method()` from `@nifrajs/core/methods`: one handler registered under several\n * methods, or under a method outside the standard seven. The standard methods join the registry.\n *\n * Declared first on purpose. The plugin's handler is typed against this app's context, which\n * TypeScript reads from the first overload it tries.\n */\n use<M extends string, Path extends string, S extends RouteSchema, Output>(plugin: MethodRoutesPlugin<M, Path, S, Output, Ctx>): Server<WithMethodRoutes<R, M, Path, S, Output, HookOutput>, Ctx, HookOutput>;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe), however it was configured,\n * so a plugin meant to stack - a second, stricter guard - needs a name of its own per instance.\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - an endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. It is a GET route, or a POST route when the schema\n * declares a `body` (a GET carries none): the body validates as on any POST, and the client sends\n * it with `.subscribe(onEvent, { body })` - the shape of a chat stream that posts its prompt. The handler receives the validated context plus a\n * {@link TypedSSEStream}: `stream.send(event)` is compile-time-checked against the schema and\n * JSON-serialized into the SSE `data:` field. The typed client sees the marker and grows a\n * `.subscribe(onEvent)` for the route with the same payload type - end-to-end typed streaming.\n *\n * import { streaming } from \"@nifrajs/core/sse\" // .use(streaming()) enables .sse()\n * const app = server().use(streaming()).sse(\"/feed\", { sse: t.object({ id: t.integer(), title: t.string() }) },\n * async (c, stream) => {\n * stream.send({ id: 1, title: \"hello\" }) // typed\n * await waitForDisconnect(stream.signal)\n * },\n * { keepAlive: 15_000 })\n *\n * // client: const off = api.feed.subscribe((post) => console.log(post.title))\n *\n * `init` passes through to the underlying {@link sse} helper (`keepAlive`, `maxBufferedBytes`,\n * extra headers). The connection closes when the handler resolves, `stream.close()` runs, or the\n * client disconnects (`stream.signal`). Query/body schemas validate exactly as on any other route.\n */\n sse<Path extends string, S extends RouteSchema & {\n sse: StandardSchemaV1;\n }>(path: Path, schema: S, run: (context: Context<Path, S> & Ctx, stream: TypedSSEStream<InferOutput<S[\"sse\"]>>) => void | Promise<void>, init?: SSEInit): Server<AddRoute<R, SseMethodOf<S>, Path, RouteInfoFor<Path, S, Response, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`. The handshake runs the chain an HTTP `GET` registered here would: the\n * `authenticate()` stages, `derive`s and `beforeHandle`s added before this call, then the optional\n * `handler.upgrade(c)`. Any of them may reject (a `Response`, a `status(...)`, a failed auth stage);\n * `upgrade()` may seed per-connection `ws.data`. To keep a socket public, register it before the\n * guard. WebSockets are served by the\n * adapter (`listen()`, `@nifrajs/node`, `@nifrajs/deno`, `toFetchHandler`) - not by bare `app.fetch`, which\n * has no socket (a WS path through `app.fetch` is a normal HTTP response).\n *\n * The route also enters the type-level registry (under the pseudo-method `\"WS\"`), so the typed\n * client grows a `.ws()` handle for it: `messageSchema` types what the client may `send`,\n * `sendSchema` types the frames it receives. Passing explicit type arguments (`ws<MyData>(…)`)\n * defeats path-literal inference and skips the registry entry - the route still serves, it is just\n * invisible to `client<App>`; prefer typing `data` via `upgrade()`'s return.\n *\n * app.ws(\"/chat\", { open: (ws) => ws.send(\"hi\"), message: (ws, data) => ws.send(data) })\n */\n ws<Data = unknown, Schema extends StandardSchemaV1 | undefined = undefined, Send extends StandardSchemaV1 | undefined = undefined, Path extends string = string>(path: Path, handler: WebSocketHandler<Data, EnvOf<Ctx>, Schema, Send, Ctx>): string extends Path ? Server<R, Ctx, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: string, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): void;\n /** Register a contract/group route batch atomically. Every route captures the same current chain it\n * would capture through {@link register}; no route becomes visible unless the full batch validates.\n *\n * A path ending in optional parameters (`/users/:id?`) is one catalog route per concrete pattern,\n * so reflection, OpenAPI, evidence and the typed client all see ordinary routes. */\n registerBatch(routes: readonly {\n readonly method: string;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n /** Join a group scope's prefix BEFORE compilation, so the pattern, the reflected descriptor, the\n * capability guard, the ledger record, and assurance path matching all see the one served path. */\n private prefixed;\n private prepareRoute;\n /** @internal Symbol-keyed install seam for the `responseContract()` plugin. Off the public typed surface. */\n [INSTALL_RESPONSE_CONTRACT](runtime: ResponseContractRuntime): void;\n /** @internal Symbol-keyed install seam for the response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `notFound()` plugin. Off the public typed surface. */\n [INSTALL_NOT_FOUND](lane: NotFoundLane): void;\n /** @internal Symbol-keyed install seam for the `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): void;\n /** @internal An adapter reports a failure no response hook saw (a hook that threw past `fetch`, a\n * response the runtime refused to write), logged as Bun's `listen()` logs one. */\n [REPORT_ERROR](error: unknown): void;\n /** @internal Symbol-keyed install seam for the `streaming()` plugin. Off the public typed surface. */\n [INSTALL_SSE](runtime: SseRuntime): void;\n /** @internal Symbol-keyed install seam for the `websocket()` plugin. Off the public typed surface. */\n [INSTALL_WS](runtime: WsRuntime): void;\n /**\n * @internal The runtime Bun serves this app's WebSocket upgrades with, asked by `listen()` and by a\n * parent that mounts this app: `undefined` while nothing here can take one, `null` when something\n * can but no runtime is at hand. A mounted Nifra app answers through this same seam, so mounting an\n * app without a WebSocket route needs no runtime; a resolver without the seam cannot say, so it\n * counts. `seen` ends a mount cycle (an app mounted under itself to alias a prefix).\n */\n [GET_WS_RUNTIME](seen?: Set<unknown>): WsRuntime | null | undefined;\n /** The `[GET_WS_RUNTIME]` answer for the apps mounted here alone, whatever this app's own routes. */\n private mountedWsRuntime;\n /** Whether an app mounted here takes WebSocket upgrades. Worked out again only after a `ws()` or a\n * `mount()` somewhere, so the upgrade check on a plain request costs one comparison. */\n private mountsTakeUpgrades;\n /**\n * Merge another server's routes into this one - the composition escape hatch for large apps.\n *\n * WHY: the fluent chain accumulates one type-alias level per route, and TypeScript resolves\n * that stack in one recursion - a single chain hits TS2589 at ~95 routes. Groups keep every\n * chain short: build each domain (`listings`, `agents`, …) as its own `server()` (its registry\n * resolves independently), then `app.merge(listings).merge(agents)` - each merge adds ONE level\n * regardless of group size. 300+ routes stay fully typed (see many-routes.test-d.ts). The\n * other escape hatch is contract-first `implement()`, whose registry is a single object type.\n *\n * Semantics: merged routes keep the chains captured where they were DEFINED - the group's\n * `derive`/`decorate`/`beforeHandle`/`afterHandle`/`onError`/`around` apply to its routes\n * exactly as they did standalone, so a group wires its own plugins. The same locality rule\n * covers the group's `onRequest` hooks: they run only for requests that route to the GROUP's\n * routes, and for an `OPTIONS` preflight to a path they serve (a `bodyLimit()` mounted on an uploads group must not start gating the whole app\n * because the app composed it in), and the group's global assurance follows its hooks onto\n * exactly those routes. A group with hooks but NO routes is a middleware bundle - its hooks\n * can only mean app-wide intent, so they are appended globally, unchanged. Response-side hooks\n * (`onResponse`/`onResponseFinalized`) are appended to this server's. This server's\n * route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like routes\n * registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes or mounts is refused\n * (register those on the parent).\n *\n * What this server's `.use()`, made BEFORE the merge, covers on a merged route versus a\n * `group()` route:\n *\n * | installed on this server | group() route | merge()d route |\n * | ------------------------------------------ | ------------- | ------------------------------ |\n * | derive/decorate/beforeHandle/afterHandle, | yes | no - wire it on the merged |\n * | onError/around, authenticate, route-scoped | | server |\n * | assurance | | |\n * | onRequest/onResponse/responseHeaders hooks | yes | yes (app-wide) |\n * | responseContract() | yes | yes, when the route declares a |\n * | | | response and its own server |\n * | | | installed no contract |\n * | effectLedger() | yes | yes, when the route declares |\n * | | | capabilities and has no ledger |\n * | idempotency() | yes | the merged server's own; a |\n * | | | route declaring it without one |\n * | | | is refused at registration |\n *\n * The response contract and the ledger can only add a check or a record, so a merged route is\n * recompiled under them. A runtime installed AFTER the merge covers neither kind of route.\n *\n * In development, {@link ServerOptions.unusedScopedHooks} reports a hook followed only by merges and\n * a contract or ledger installed after the routes it would cover; `nifra check` reports a merge whose\n * server authenticates none of its routes under this server's `authenticate()` (NF-C043).\n */\n merge<R2 extends Registry, Ctx2, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /**\n * Declare routes under a static path prefix, with the prefix in the typed client, `routes()`,\n * OpenAPI, capability events, and the effect ledger - the counterpart of Hono's `route()`,\n * Elysia's `group()`, and Fastify's `register({ prefix })`.\n *\n * app\n * .derive(session)\n * .group(\"/admin\", (admin) =>\n * admin.beforeHandle(requireAdmin).get(\"/users\", listUsers).get(\"/users/:id\", getUser),\n * )\n * .get(\"/\", home) // not covered by requireAdmin\n *\n * The builder receives a scope that INHERITS this server's route chain as it stands at the call\n * (`derive`/`decorate`/`authenticate`/`beforeHandle`/`afterHandle`/`onError`/`around`, assurance,\n * capability interceptors, installed runtimes, applied plugins), exactly as a route declared here\n * would. {@link merge} documents how that differs for a merged server. A plugin this server already applied is in effect for the group: the group's `use()` of\n * that same instance does nothing, and its `use()` of another instance under the same name throws a\n * `RouteConfigError` (`PLUGIN_RECONFIGURED`), because that instance could never replace the parent's.\n * A plugin the group applies still shares the parent's copy of a dependency it `use()`s itself.\n * What it adds stays in the group: its chain additions apply only to its own routes, and its\n * request/response hooks (`onRequest`, `onResponse`, `responseHeaders`, `onResponseFinalized`, and\n * middleware bundles that use them) run only for requests whose path is the prefix or below it.\n * Per-route authorization belongs in `authenticate`/`beforeHandle`, which are compiled into each\n * route; request hooks are path prefilters.\n *\n * The prefix is static text - `\"/api\"`, `\"/api/v1\"` - validated when declared: no params,\n * wildcards, empty or dot segments, percent-escapes, or trailing slash. A group's `\"/\"` route\n * serves the prefix itself. Groups nest (`\"/api\"` then `\"/v1\"` serves `/api/v1/...`).\n *\n * Fail closed: the builder must synchronously return the scope it was given; a collision with an\n * existing route throws `RouteConfigError` and adds none of the group's routes; `.ws()`, mounts,\n * MCP `.tool()`s, and `merge()` inside a group are refused (register them on the parent). Once the\n * builder returns, the scope is closed - a leaked reference cannot add routes later.\n */\n group<const P extends string, R2 extends Registry, Ctx2, HookOutput2>(prefix: P, build: (group: Server<EmptyRegistry, Ctx, HookOutput>) => Server<R2, Ctx2, HookOutput2>): Server<R & PrefixRegistry<P, R2>, Ctx, HookOutput>;\n /**\n * Take over another server's routes and hooks - the shared core of {@link merge} and {@link group}.\n * `prefix` selects group semantics: hooks are scoped to requests under the prefix (response hooks\n * included), and the source's global assurance past `inheritedGlobal` (what it copied from this\n * server) is folded into its routes. Without a prefix, merge semantics: request hooks are scoped to\n * the source's routes when it has any, response hooks are appended app-wide.\n */\n private adopt;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n private firstMountUnder;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private trustedPlatform;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** A fused Web lane's render in an async continuation, where a result that cannot be rendered\n * must fail like a handler throw; a synchronous render throw reaches {@link runMatchedLanes}. */\n private respondFused;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n /**\n * Generic (finalize/wrapResponse-parameterized) fused runner for the derive-before(-after) lane:\n * the Node-direct counterpart of `buildFusedDeriveBefore` / `buildFusedDeriveBeforeAfter`.\n *\n * The Web fused builders above return a `Response`, so the Node dispatcher (`webFast === false`)\n * cannot use them and a derive+before route falls back to the generic route program there - two\n * staged loops, per-stage dispatch, and the async-continuation machinery - while Bun rides the\n * single closure. That asymmetry is the realistic-route Node deficit against Fastify: this runner\n * closes it by running validate → derive → before → handler → (after) in one frame and finalizing\n * through the caller's own `finalize` (the Node outcome on the direct lane, `toResponse` on Web),\n * so the same registration feeds both runtimes with no per-lane copy of the lifecycle to drift.\n *\n * Semantics mirror the generic program stage-for-stage for the shapes this lane admits (exactly\n * one derive, one beforeHandle, zero-or-one afterHandle, no onError/around/decorations/contracts/\n * recovery hooks - enforced by `selectRouteLanes`): thrown `Response`/`status(...)` are control\n * flow through `wrapResponse`/`finalize`, anything else logs + 500s via the shared `bareError`\n * lane (identical to `handleLifecycleError` with no `onError` hooks), and a terminal `finalize`\n * throw (e.g. an unstringifiable handler return on the Node lane) is caught exactly as\n * `finishLifecycleContract` catches it. Step functions close over registration state only and take\n * the request state as arguments, so the hot path allocates no per-request closures.\n */\n private buildFusedDeriveBeforeRunner;\n /**\n * Generic fused runner for the body+derive-before(-after) lane: the Node-direct counterpart of\n * `buildFusedBodyDeriveBeforeAfter`. Same contract as `buildFusedDeriveBeforeRunner` above - one\n * frame running parse → validate → derive → before → handler → (after) through the caller's own\n * `finalize` - with the body read ahead of validation, exactly as the generic program orders its\n * body stage before the derive/before stages. `readBodyFramed` keeps the shared bounded-read,\n * content-type, and prototype-poisoning contracts; the 415/400 renders take `wrapResponse`\n * directly, which is what the generic lane's wrap-after-identity amounts to.\n */\n private buildFusedBodyDeriveBeforeAfterRunner;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** An `onRequest` hook threw or rejected. No route has matched, so every `onError` the app holds\n * answers it, with a route-less context; otherwise the logged default 500, as for a handler. */\n private onRequestFailure;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands.\n * Never rejects: nothing outside it re-enters `onError`, so a hook that throws, or an answer that\n * cannot be rendered, is logged and answered here. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade.\n *\n * Bun and the portable router agree on which of two static-and-`:param` paths wins a request, so\n * the table is kept to those paths. Where Bun would otherwise pass a request on to a less specific\n * path, the more specific one carries `fallback`, the portable dispatcher, under that method.\n * `peer` is the platform every request served from the table shares. */\n private buildBunNativeRoutes;\n /**\n * Start a `Bun.serve` instance bound to `port` (use `0` for an ephemeral port).\n *\n * `reusePort` sets `SO_REUSEPORT` so **multiple processes can bind the same port** and the kernel\n * load-balances connections across them - the standard way to use every core (Bun is\n * single-threaded per process). Spawn one process per core, each calling\n * `app.listen(PORT, { reusePort: true })`; see `examples/cluster.ts`. Every process must opt in,\n * and all of them must be the same app. Linux balances ~evenly; macOS accepts the flag but may\n * favor one socket (fine for dev, measure on Linux for production numbers).\n *\n * `hostname` is the bind address, defaulting to Bun's `0.0.0.0` (every interface). Pass\n * `\"127.0.0.1\"` to bind loopback only - an admin surface, a sidecar, or anything that must not be\n * reachable off the box. Omitting it when you meant to restrict is a real exposure, so it is a\n * first-class option rather than something a caller has to drop down to `Bun.serve` for.\n *\n * `idleTimeoutSec` is how long Bun tolerates a connection with no bytes moving before it closes\n * the socket. Bun's default is **10 seconds**, and a request whose handler is still working sends\n * nothing - so any endpoint slower than 10s (a render, an export, a long upstream call) has its\n * connection cut mid-flight regardless of `requestTimeoutMs`. Apps with such endpoints must raise\n * this above their slowest expected response, which is why it is a first-class option and not a\n * reason to drop down to `Bun.serve`. `0` disables the timeout entirely; max 255.\n *\n * `tls` serves HTTPS directly: `app.listen(443, { tls: { cert, key } })` with PEM text or bytes.\n * Requests then arrive with `https:` URLs. Behind a proxy or a platform that terminates TLS, leave\n * it unset.\n */\n listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n readonly tls?: ListenTlsOptions;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it. Open WebSockets\n * get a 1001 close at once and the same window to finish it, before any `onStop` hook runs.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
14171
14722
  "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 */"
14172
14723
  },
14173
14724
  {
@@ -14271,14 +14822,14 @@
14271
14822
  "name": "ServerComponentRuntime",
14272
14823
  "kind": "interface",
14273
14824
  "package": "@nifrajs/web",
14274
- "signature": "export interface ServerComponentRuntime {\n owns(routeId: string): boolean;\n capabilities(routeId: string): readonly string[];\n classify(request: Request, routeId: string): import(\"./protocol.js\").ComponentRequest | undefined;\n execute(routeId: string, context: ServerComponentContext, selection?: import(\"./protocol.js\").ComponentRequest, nonce?: string): Promise<ComponentState>;\n response(state: ComponentState, selection: import(\"./protocol.js\").ComponentRequest): Response;\n failure(error: unknown): Response;\n}",
14825
+ "signature": "export interface ServerComponentRuntime {\n owns(routeId: string): boolean;\n capabilities(routeId: string): readonly string[];\n classify(request: Request, routeId: string): import(\"./protocol.js\").ComponentRequest | undefined;\n execute(routeId: string, context: ServerComponentContext, selection?: import(\"./protocol.js\").ComponentRequest, nonce?: string): Promise<ComponentState>;\n response(state: ComponentState, selection: import(\"./protocol.js\").ComponentRequest): Response;\n failure(error: unknown): Response;\n /** Whether the route's partially prerendered holes may show server components. */\n hosts?(routeId: string): boolean;\n /** Render `component` as the route's hole `key`, with the hole loader's output as its input. */\n hole?(routeId: string, component: object, key: string, input: unknown, context: ServerComponentContext): Promise<ComponentRecord>;\n}",
14275
14826
  "doc": "/** Optional seam passed to createWebApp; disabled applications have no runtime import of this feature. */"
14276
14827
  },
14277
14828
  {
14278
14829
  "name": "ServerComponentsOptions",
14279
14830
  "kind": "interface",
14280
14831
  "package": "@nifrajs/web",
14281
- "signature": "export interface ServerComponentsOptions {\n readonly build: string;\n readonly adapter: ServerComponentRenderAdapter;\n readonly owners: Readonly<Record<string, ComponentOwner>>;\n readonly capabilities?: readonly CapabilityDefinition[];\n readonly assets?: readonly string[];\n}"
14832
+ "signature": "export interface ServerComponentsOptions {\n readonly build: string;\n readonly adapter: ServerComponentRenderAdapter;\n readonly owners: Readonly<Record<string, ComponentOwner>>;\n /**\n * Experimental: route id to the server components its partially prerendered holes may show, each\n * through `serverHole`. A route is an owner or hosts holes, never both.\n */\n readonly holes?: Readonly<Record<string, ComponentHoles>>;\n readonly capabilities?: readonly CapabilityDefinition[];\n readonly assets?: readonly string[];\n}"
14282
14833
  },
14283
14834
  {
14284
14835
  "name": "ServerComponentsPluginOptions",
@@ -14311,7 +14862,7 @@
14311
14862
  "kind": "interface",
14312
14863
  "package": "@nifrajs/web",
14313
14864
  "signature": "export interface ServerFn<Input, Output> {\n (input: Input, context: Context): MaybePromise<Output>;\n readonly [SERVER_FN]: ServerFnConfig<Input>;\n}",
14314
- "doc": "/**\n * A declared server function. Callable directly on the server (the same value your own server-side\n * code can await); on the client, phase 2's build transform replaces this module with typed stubs\n * that POST to the mounted route.\n *\n * This is the SERVER declaration type, so context is required. Client builds replace the module with\n * a one-argument {@link ClientServerFn}; UI bindings accept either shape and adapt at that boundary.\n * Keeping the types separate prevents a direct server call from type-checking while handing the\n * declaration `undefined` for a context its implementation requires.\n */"
14865
+ "doc": "/**\n * A declared server function. Callable directly on the server (the same value your own server-side\n * code can await); in a client build, this module becomes typed stubs that POST under its\n * file's name (`todos.fn.ts` posts under `todos`), so {@link serverFunctions} must mount it\n * under that name.\n *\n * This is the SERVER declaration type, so context is required. Client builds replace the module with\n * a one-argument {@link ClientServerFn}; UI bindings accept either shape and adapt at that boundary.\n * Keeping the types separate prevents a direct server call from type-checking while handing the\n * declaration `undefined` for a context its implementation requires.\n */"
14315
14866
  },
14316
14867
  {
14317
14868
  "name": "ServerFnConfig",
@@ -14408,13 +14959,13 @@
14408
14959
  "name": "ServerOptions",
14409
14960
  "kind": "interface",
14410
14961
  "package": "@nifrajs/core",
14411
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun drops the connection and the\n * client sees `1006`, while the `close` handler still gets `1009`. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
14962
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
14412
14963
  },
14413
14964
  {
14414
14965
  "name": "ServerOptions",
14415
14966
  "kind": "interface",
14416
14967
  "package": "nifra",
14417
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun drops the connection and the\n * client sees `1006`, while the `close` handler still gets `1009`. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
14968
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Every guarded\n * payload pays one iterative pass over its parsed object nodes; `\"ignore\"` skips it.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Other sites whose HTML forms may post to a body-schema route: exact origins, or a function that\n * receives the `Origin`. A urlencoded, multipart or `text/plain` body is one a form on any site can\n * send with the visitor's cookies and no preflight, so one whose `Origin` names another site is\n * refused with `403` before it is read. Same-origin posts and requests without an `Origin`, such\n * as server-to-server calls, pass. JSON is not affected: a browser preflights it, so CORS decides.\n */\n readonly formOrigins?: ReadonlyArray<string> | ((origin: string) => boolean);\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /**\n * Max inbound WebSocket message size (bytes). A larger message never reaches the handler and the\n * socket closes with `1009`; when Bun's own frame limit refuses it, Bun up to 1.4.3 drops the\n * connection (the client sees `1006`) and Bun 1.4.4 sends `1009`, while the `close` handler gets\n * `1009` either way. Default: `maxBodyBytes` (1 MB).\n * Bun and Node stop buffering at the cap, so a huge frame is never held in memory; on Bun a mounted\n * app's smaller cap, and on Deno and Workers every cap, is checked after the runtime has buffered\n * the whole message.\n */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /**\n * When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false.\n * `{ drainMs }` sets how long in-flight requests get to finish before the stop forces them closed\n * (default 10_000) - keep it under the platform's kill grace period (`docker stop` waits 10 s).\n */\n readonly gracefulSignals?: boolean | {\n readonly drainMs?: number;\n };\n /**\n * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a\n * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.\n * Off by default. Enabling it disables the fused native-route fast path (requests route through the\n * shared matched lane where the gate runs); when unset, the request path pays nothing.\n */\n readonly admission?: AdmissionController;\n /**\n * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,\n * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.\n */\n readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;\n /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */\n readonly logger?: Logger;\n /**\n * How much of an unhandled error reaches the log for a 500. Never reaches the client either way -\n * the response is always a bare `internal_error`.\n *\n * - `\"full\"` (default) - `name`, the error's own text as `detail`, and `stack`.\n * - `\"message\"` - `name` and `detail`, no stack.\n * - `\"none\"` - `name` only.\n *\n * An error's text can quote the input that produced it, which is how request data ends up in a log\n * sink. The framework's answer is the redacting logger rather than blanket suppression: pass\n * `logger: jsonLogger({ valuePatterns: commonSecretPatterns })` to scrub tokens, JWTs, and emails\n * out of `detail` and `stack` while keeping the diagnosis. Reach for `\"none\"` when the sink itself\n * is the thing you don't trust.\n */\n readonly errorLogDetail?: \"full\" | \"message\" | \"none\";\n /**\n * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query\n * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |\n * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by\n * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /\n * Fastify's `setErrorHandler`) instead of repeating a formatter per route.\n */\n readonly onValidationError?: RouteSchema[\"onValidationError\"];\n /**\n * What to do when an order-scoped hook (`derive`/`authenticate`/`beforeHandle`/`around`/\n * `aroundCapability`/`afterHandle`/`onError`/`decorate`) covers no route because it was added after\n * the last route was registered. `register()` snapshots the current chain into each route as it is\n * declared, so a hook appended after every route reaches nothing and is silently dead. A `merge()`d\n * route keeps the chain of the server that declared it, so a hook followed only by merges is dead\n * too. The same report covers `responseContract()` and `effectLedger()` installed after routes they\n * would have covered (a declared response, declared capabilities). `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
14418
14969
  },
14419
14970
  {
14420
14971
  "name": "ServerPrerenderedPage",
@@ -14595,6 +15146,20 @@
14595
15146
  "signature": "export interface ShapeRowsOptions {\n readonly maxRows: number;\n readonly maxResultBytes: number;\n readonly redaction?: DbRedaction;\n}",
14596
15147
  "doc": "/** Options for {@link shapeRows}. */"
14597
15148
  },
15149
+ {
15150
+ "name": "SharedBoundary",
15151
+ "kind": "type",
15152
+ "package": "@nifrajs/web",
15153
+ "signature": "export type SharedBoundary<Data, UI> = BoundaryBase<Data, UI> & {\n readonly mode: \"shared\";\n readonly load?: (ctx: SharedHoleCtx) => Data | Promise<Data>;\n /** The hole ships its props and hydrates. Default `false`. */\n readonly interactive?: boolean;\n /** How long a visitor waits for a build in milliseconds, then gets the error slot. Default 5000. */\n readonly timeout?: number;\n};",
15154
+ "doc": "/**\n * Experimental, partial prerendering: a hole that is the same for every visitor, built like the shell\n * from a request-free context and cached on its own `revalidate`, then written right after the shell.\n * Its loader entry in `boundaryLoaders` needs `revalidate`.\n */"
15155
+ },
15156
+ {
15157
+ "name": "SharedHoleCtx",
15158
+ "kind": "interface",
15159
+ "package": "@nifrajs/web",
15160
+ "signature": "export interface SharedHoleCtx extends ShellCtx {\n readonly live: (...keys: string[]) => void;\n}",
15161
+ "doc": "/**\n * Experimental: what a shared hole's loader receives. The keys it declares are kept with the built\n * entry and watched for every visitor it serves; a change reloads the hole, which the shared entry\n * answers until a purge by one of its `revalidateTags` drops it, so publish each key with a tag.\n */"
15162
+ },
14598
15163
  {
14599
15164
  "name": "SharedKey",
14600
15165
  "kind": "type",
@@ -14616,6 +15181,38 @@
14616
15181
  "signature": "export type ShedReason = \"inflight\" | \"loop-lag\" | \"queue-timeout\" | \"policy\" | \"cancelled\";",
14617
15182
  "doc": "/**\n * Adaptive capacity admission. Rate limiting bounds request *frequency* and `@nifrajs/core/budget` bounds\n * request *duration*; neither stops a healthy instance from accepting more *concurrent* work than it\n * can finish. This gate admits on live capacity evidence - in-flight count + event-loop lag - briefly\n * queues at the edge, and sheds the rest with `429` + `Retry-After`, so p99 stays bounded under load\n * instead of collapsing.\n *\n * Public mechanics (in-flight + loop lag) know nothing about tenants. An application-supplied {@link AdmissionPolicy}\n * hook layers tenant priority and reserved capacity on top without leaking\n * those concerns into the OSS core.\n *\n * Wire it as the server's `admission` option (NOT an `onRequest` hook - a hook disables the native\n * route table). Off by default: when unset, the request path is untouched.\n */"
14618
15183
  },
15184
+ {
15185
+ "name": "ShellCanaryFinding",
15186
+ "kind": "interface",
15187
+ "package": "@nifrajs/web",
15188
+ "signature": "export interface ShellCanaryFinding {\n readonly path: string;\n readonly via: CanaryCarrier;\n /** The shared hole whose frame carried it; absent when the shell did. */\n readonly hole?: string;\n}"
15189
+ },
15190
+ {
15191
+ "name": "ShellCanaryOptions",
15192
+ "kind": "interface",
15193
+ "package": "@nifrajs/web",
15194
+ "signature": "export interface ShellCanaryOptions {\n /** The origin the requests are made against. Default `http://canary.invalid`. */\n readonly origin?: string;\n}"
15195
+ },
15196
+ {
15197
+ "name": "ShellCheckError",
15198
+ "kind": "class",
15199
+ "package": "@nifrajs/web",
15200
+ "signature": "export declare class ShellCheckError extends Error {\n readonly routeId: string;\n readonly chain: readonly string[];\n readonly name = \"ShellCheckError\";\n constructor(routeId: string, chain: readonly string[]);\n}"
15201
+ },
15202
+ {
15203
+ "name": "ShellCheckRecord",
15204
+ "kind": "interface",
15205
+ "package": "@nifrajs/web",
15206
+ "signature": "export interface ShellCheckRecord {\n readonly v: 1;\n readonly deployment: string;\n /** Route id to the sha256 of the checked shell bundle. */\n readonly routes: Readonly<Record<string, string>>;\n /** Route id to the shared holes whose loaders were checked in that bundle: only these are stored. */\n readonly sharedHoles?: Readonly<Record<string, readonly string[]>>;\n}",
15207
+ "doc": "/**\n * Which routes passed the shell check for one deployment. The server shares a shell only for a route\n * listed here under its own deployment; anything else renders blocking (fail closed).\n */"
15208
+ },
15209
+ {
15210
+ "name": "ShellCtx",
15211
+ "kind": "interface",
15212
+ "package": "@nifrajs/web",
15213
+ "signature": "export interface ShellCtx {\n /** `\"shell\"`: built on demand at runtime, under the same rules as a build. */\n readonly phase: \"build\" | \"shell\";\n /** The deployment's origin from config, never from a Host header. */\n readonly origin?: string;\n /** Decoded params, as the route pattern matched them. */\n readonly params: Readonly<Record<string, string>>;\n readonly locale: string | undefined;\n /** The route's declared `shellVariations` this request selected: declared keys and values only. */\n readonly variations: Readonly<Record<string, string>>;\n /** Aborts on the shell build deadline, never on one visitor's disconnect. */\n readonly signal: AbortSignal;\n /** The in-process api, unbound to any request: build-safe calls only, as in a prerender. */\n readonly api: unknown;\n}",
15214
+ "doc": "/**\n * Experimental: what a partially prerendered page's `shellLoader` receives. No request, env, draft or\n * search: the shell is shared by every visitor whose URL maps to the same params and locale.\n */"
15215
+ },
14619
15216
  {
14620
15217
  "name": "ShouldRevalidate",
14621
15218
  "kind": "type",
@@ -14658,17 +15255,10 @@
14658
15255
  {
14659
15256
  "name": "Signal",
14660
15257
  "kind": "type",
14661
- "package": "@nifrajs/islets",
15258
+ "package": "@nifrajs/web",
14662
15259
  "signature": "export type Signal<T> = {\n (): T;\n set(next: T | ((prev: T) => T)): void;\n};",
14663
15260
  "doc": "/** A readable/writable reactive value: call it to read (tracking), `.set` to write. */"
14664
15261
  },
14665
- {
14666
- "name": "Signal",
14667
- "kind": "interface",
14668
- "package": "@nifrajs/web",
14669
- "signature": "export interface Signal<T> extends Readable<T> {\n set(value: T): void;\n}",
14670
- "doc": "/** A writable cell. `set` notifies subscribers only when the value actually changes (`Object.is`), so\n * a redundant write costs nothing. */"
14671
- },
14672
15262
  {
14673
15263
  "name": "SignatureEncoding",
14674
15264
  "kind": "type",
@@ -14747,6 +15337,20 @@
14747
15337
  "signature": "export interface SizeReport {\n /** Per-chunk sizes, sorted biggest gzip first (the regression you want to see at the top). */\n readonly chunks: readonly ChunkSize[];\n /** Sum of every chunk's raw bytes. */\n readonly totalBytes: number;\n /** Sum of every chunk's gzip bytes. */\n readonly totalGzip: number;\n}",
14748
15338
  "doc": "/** A whole build's size report - every chunk (largest first) + the totals. */"
14749
15339
  },
15340
+ {
15341
+ "name": "SlotNode",
15342
+ "kind": "interface",
15343
+ "package": "@nifrajs/web",
15344
+ "signature": "export interface SlotNode {\n /** Unique in the tree: a layout's id, or `\\0` and a page instance. */\n readonly key: string;\n /** The chain index of the element it renders: a layout's depth, or the page's (its route's layout\n * count), from where the page's own chain (an `_error` boundary, then the page) continues. */\n readonly depth: number;\n /** The state it renders from: the page on screen's while it is on the path to it, else the most\n * recently shown kept page under it. */\n readonly state: RouterState;\n /** Not on the path to the page on screen. */\n readonly hidden: boolean;\n /** Rendered inside the two slot wrappers, so it can be taken out of the document. */\n readonly wrapped: boolean;\n /** The slots under a layout, in the order their pages were first shown. Absent on a page. */\n readonly children?: readonly SlotNode[];\n}",
15345
+ "doc": "/** One element of the view: a layout and the slots under it, or a page. */"
15346
+ },
15347
+ {
15348
+ "name": "SlotParking",
15349
+ "kind": "interface",
15350
+ "package": "@nifrajs/web",
15351
+ "signature": "export interface SlotParking {\n /** The ref of a slot's outer wrapper (`data-nifra-entry`). Stable per key. */\n entry(key: string): (element: Element | null) => void;\n /** The ref of a slot's inner wrapper (`data-nifra-page`), the element that is parked. Stable per key. */\n page(key: string): (element: Element | null) => void;\n /** Before the render of `next`: put back what it shows again, and note the inner scroll offsets and\n * focus of what it hides while that is still laid out (React hides it during the commit). */\n before(next: readonly SlotNode[]): void;\n /** After the render of `tree` committed: park what it hides, restore what it shows again. */\n after(tree: readonly SlotNode[]): void;\n}",
15352
+ "doc": "/** The DOM half of keep-alive: takes hidden slots out of the document and puts them back. */"
15353
+ },
14750
15354
  {
14751
15355
  "name": "SourceFile",
14752
15356
  "kind": "interface",
@@ -15081,6 +15685,32 @@
15081
15685
  "signature": "export interface StatusResponse<Code extends number = number, Body = unknown> extends ResponseResult {\n readonly [STATUS_RESPONSE_TYPE]: {\n readonly code: Code;\n readonly body: Body;\n };\n}",
15082
15686
  "doc": "/** A status-bearing response whose code and body remain visible to TypeScript. */"
15083
15687
  },
15688
+ {
15689
+ "name": "StdioConnection",
15690
+ "kind": "interface",
15691
+ "package": "@nifrajs/mcp",
15692
+ "signature": "export interface StdioConnection {\n /**\n * Write one message as one line. A message that cannot be serialized, or whose encoding exceeds the\n * message cap, is replaced by a `-32603` error carrying the same id, so the peer still gets an answer.\n */\n send(message: StdioMessage): void;\n}"
15693
+ },
15694
+ {
15695
+ "name": "StdioMessage",
15696
+ "kind": "type",
15697
+ "package": "@nifrajs/mcp",
15698
+ "signature": "export type StdioMessage = JsonRpcRequest | JsonRpcResponse | JsonRpcNotification;",
15699
+ "doc": "/** Anything one side of the connection may send. */"
15700
+ },
15701
+ {
15702
+ "name": "StdioOutput",
15703
+ "kind": "interface",
15704
+ "package": "@nifrajs/mcp",
15705
+ "signature": "export interface StdioOutput {\n write(chunk: string): unknown;\n}",
15706
+ "doc": "/** Where encoded lines go. `process.stdout` satisfies it. */"
15707
+ },
15708
+ {
15709
+ "name": "StdioTransportOptions",
15710
+ "kind": "interface",
15711
+ "package": "@nifrajs/mcp",
15712
+ "signature": "export interface StdioTransportOptions {\n /** Default `process.stdin`. String chunks are UTF-8 encoded before framing. */\n readonly input?: AsyncIterable<Uint8Array | string>;\n /** Default `process.stdout`. */\n readonly output?: StdioOutput;\n /** Cap on one message in UTF-8 bytes, in either direction. Default {@link MAX_STDIO_MESSAGE_BYTES}. */\n readonly maxMessageBytes?: number;\n /**\n * A client request or notification. Resolve to its response, or `null` to send none. Requests are\n * dispatched concurrently as their lines arrive. A rejection is answered with a generic `-32603`\n * error for a request and with nothing for a notification - the rejection's message is never sent.\n */\n readonly onRequest: (message: JsonRpcRequest, connection: StdioConnection) => Promise<JsonRpcResponse | null>;\n /**\n * A response to a request this side sent through {@link StdioConnection.send}. Return `false` when no\n * request with that id is pending, and the line is answered as an Invalid Request. Omitted, every\n * response is invalid.\n */\n readonly onResponse?: (message: JsonRpcResponse, connection: StdioConnection) => boolean;\n}"
15713
+ },
15084
15714
  {
15085
15715
  "name": "StepCatalog",
15086
15716
  "kind": "interface",
@@ -15288,6 +15918,13 @@
15288
15918
  "signature": "export interface SubagentAbandonmentLedger {\n abandoned: number;\n}",
15289
15919
  "doc": "/** Abandoned executors still running. Runners sharing one ledger are counted, and bounded by\n * `maxAbandoned`, together. */"
15290
15920
  },
15921
+ {
15922
+ "name": "SubagentChildLedger",
15923
+ "kind": "interface",
15924
+ "package": "@nifrajs/coding-agent",
15925
+ "signature": "export interface SubagentChildLedger {\n started: number;\n}",
15926
+ "doc": "/** Children started, plus those still acquiring a workspace. Runners sharing one ledger are counted,\n * and bounded by `maxChildren`, together. */"
15927
+ },
15291
15928
  {
15292
15929
  "name": "SubagentExecutor",
15293
15930
  "kind": "interface",
@@ -15304,7 +15941,7 @@
15304
15941
  "name": "SubagentRunnerOptions",
15305
15942
  "kind": "interface",
15306
15943
  "package": "@nifrajs/coding-agent",
15307
- "signature": "export interface SubagentRunnerOptions {\n readonly maxChildren?: number;\n readonly maxDepth?: number;\n readonly depth?: number;\n readonly signal?: AbortSignal;\n readonly allowedCapabilities?: readonly string[];\n readonly workspace?: SubagentWorkspacePolicy;\n /**\n * Called when a run returns while its executor keeps running: it timed out or was cancelled and\n * ignored its abort signal. Use it to stop the executor another way, such as ending its process.\n */\n readonly onAbandoned?: (abandonment: SubagentAbandonment) => void;\n /** Refuse new children while this many abandoned executors are still running. Default: no bound. */\n readonly maxAbandoned?: number;\n /** Where abandoned executors are counted. Default: a ledger of this runner's own. */\n readonly abandonment?: SubagentAbandonmentLedger;\n}"
15944
+ "signature": "export interface SubagentRunnerOptions {\n readonly maxChildren?: number;\n readonly maxDepth?: number;\n readonly depth?: number;\n readonly signal?: AbortSignal;\n readonly allowedCapabilities?: readonly string[];\n readonly workspace?: SubagentWorkspacePolicy;\n /**\n * Called when a run returns while its executor keeps running: it timed out or was cancelled and\n * ignored its abort signal. Use it to stop the executor another way, such as ending its process.\n */\n readonly onAbandoned?: (abandonment: SubagentAbandonment) => void;\n /** Refuse new children while this many abandoned executors are still running. Default: no bound. */\n readonly maxAbandoned?: number;\n /** Where abandoned executors are counted. Default: a ledger of this runner's own. */\n readonly abandonment?: SubagentAbandonmentLedger;\n /** Where started children are counted for `maxChildren`. Default: a ledger of this runner's own. */\n readonly children?: SubagentChildLedger;\n}"
15308
15945
  },
15309
15946
  {
15310
15947
  "name": "SubagentSpec",
@@ -15344,6 +15981,13 @@
15344
15981
  "package": "@nifrajs/client",
15345
15982
  "signature": "export interface Subscription {\n /** Stop the subscription: aborts the live stream and cancels any pending reconnect. */\n close(): void;\n}"
15346
15983
  },
15984
+ {
15985
+ "name": "SvelteUI",
15986
+ "kind": "interface",
15987
+ "package": "@nifrajs/web-svelte",
15988
+ "signature": "export interface SvelteUI {\n readonly component: Component<Record<string, unknown>>;\n readonly props: Record<string, unknown>;\n}",
15989
+ "doc": "/**\n * What a Svelte boundary's `render` and `fallback` return: a component and the props it renders with.\n * Svelte components compile from files, so a hole's output is this pair instead of a node.\n */"
15990
+ },
15347
15991
  {
15348
15992
  "name": "SvgMarkupRules",
15349
15993
  "kind": "interface",
@@ -15370,6 +16014,27 @@
15370
16014
  "package": "@nifrajs/web",
15371
16015
  "signature": "export interface SvgToJsxOptions {\n /** The JSX prop name for `class`. `\"className\"` for React/Preact; `\"class\"` for Solid. */\n readonly classProp?: string;\n}"
15372
16016
  },
16017
+ {
16018
+ "name": "SwapOptions",
16019
+ "kind": "interface",
16020
+ "package": "@nifrajs/web",
16021
+ "signature": "export interface SwapOptions {\n /** Default `document`. */\n readonly root?: Document | Element;\n}",
16022
+ "doc": "/** Where `enableSwap` looks for links, forms, slots and islands. */"
16023
+ },
16024
+ {
16025
+ "name": "TEMPLATE_DEV_URLS",
16026
+ "kind": "const",
16027
+ "package": "create-nifra",
16028
+ "signature": "export declare const TEMPLATE_DEV_URLS: Readonly<Record<TemplateName, string>>;",
16029
+ "doc": "/** Where each template's `dev` script serves: `PORT ?? 3000`, `nifra dev`'s default, `wrangler dev`'s. */"
16030
+ },
16031
+ {
16032
+ "name": "TOOL_CLI_EXIT",
16033
+ "kind": "const",
16034
+ "package": "@nifrajs/core",
16035
+ "signature": "export declare const TOOL_CLI_EXIT: Readonly<{\n ok: 0;\n failed: 1;\n usage: 2;\n refused: 3;\n}>;",
16036
+ "doc": "/** Process exit codes {@link runToolCli} resolves to. */"
16037
+ },
15373
16038
  {
15374
16039
  "name": "TableCatalogs",
15375
16040
  "kind": "interface",
@@ -15384,6 +16049,12 @@
15384
16049
  "signature": "export declare class Template {\n /** The final markup. Built eagerly at tag time (interpolations are already values by then). */\n readonly html: string;\n constructor(htmlString: string);\n toString(): string;\n}",
15385
16050
  "doc": "/** A rendered HTML fragment - what `html` returns and components produce. Stringified once. */"
15386
16051
  },
16052
+ {
16053
+ "name": "TemplateName",
16054
+ "kind": "type",
16055
+ "package": "create-nifra",
16056
+ "signature": "export type TemplateName = keyof typeof TEMPLATES;"
16057
+ },
15387
16058
  {
15388
16059
  "name": "TestClientOptions",
15389
16060
  "kind": "interface",
@@ -15520,6 +16191,19 @@
15520
16191
  "signature": "export interface ToolCatalogEntry {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: Record<string, unknown>;\n readonly capability: string;\n readonly sensitivity: ToolSensitivity;\n readonly approval: ToolApprovalPolicy;\n readonly idempotent: boolean;\n readonly annotations: ToolAnnotations;\n}",
15521
16192
  "doc": "/**\n * A read-only, transport-neutral view of a tool contract.\n *\n * This module is descriptive only. It never validates input, checks capabilities, requests approval,\n * reserves idempotency, consumes cost, or executes the tool. Those policies stay in `executeTool`.\n */"
15522
16193
  },
16194
+ {
16195
+ "name": "ToolCliOptions",
16196
+ "kind": "interface",
16197
+ "package": "@nifrajs/core",
16198
+ "signature": "export interface ToolCliOptions extends Omit<ToolCallOptions, \"approval\" | \"dryRun\" | \"ledger\"> {\n /** The command name shown in usage text. */\n readonly program: string;\n /** Default: the process streams. */\n readonly streams?: ToolCliStreams;\n /** Cap on `--input` JSON, inline or from stdin, in UTF-8 bytes. Default 1 MiB. */\n readonly maxInputBytes?: number;\n /** Prototype-poisoning policy for every JSON value read. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n}"
16199
+ },
16200
+ {
16201
+ "name": "ToolCliStreams",
16202
+ "kind": "interface",
16203
+ "package": "@nifrajs/core",
16204
+ "signature": "export interface ToolCliStreams {\n readonly stdout: {\n write(chunk: string): unknown;\n };\n readonly stderr: {\n write(chunk: string): unknown;\n };\n /** Read by `--input -`. */\n readonly stdin?: AsyncIterable<Uint8Array | string>;\n}",
16205
+ "doc": "/** Where the CLI writes. `process.stdout` / `process.stderr` / `process.stdin` satisfy it. */"
16206
+ },
15523
16207
  {
15524
16208
  "name": "ToolCompletedView",
15525
16209
  "kind": "interface",
@@ -16082,14 +16766,14 @@
16082
16766
  "name": "VERSION",
16083
16767
  "kind": "const",
16084
16768
  "package": "@nifrajs/core",
16085
- "signature": "export declare const VERSION: \"5.5.1\";",
16769
+ "signature": "export declare const VERSION: \"5.6.0\";",
16086
16770
  "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 */"
16087
16771
  },
16088
16772
  {
16089
16773
  "name": "VERSION",
16090
16774
  "kind": "const",
16091
16775
  "package": "nifra",
16092
- "signature": "export declare const VERSION: \"5.5.1\";",
16776
+ "signature": "export declare const VERSION: \"5.6.0\";",
16093
16777
  "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 */"
16094
16778
  },
16095
16779
  {
@@ -16205,7 +16889,7 @@
16205
16889
  "name": "ViteDevServerOptions",
16206
16890
  "kind": "interface",
16207
16891
  "package": "@nifrajs/web",
16208
- "signature": "export interface ViteDevServerOptions {\n /** Absolute (or cwd-relative) path to the `routes/` dir. */\n readonly routesDir: string;\n /** Client runtime module providing `mountRouter` (e.g. `\"@nifrajs/web-react/client\"`). */\n readonly clientModule: string;\n /**\n * Build the nifra app for the given dev client-entry URL.\n *\n * `load` resolves a route module through **Vite's** graph (`ssrLoadModule`). Pass it to\n * `discoverRoutes(routesDir, { load })` so SSR and the client are resolved by the SAME toolchain.\n * Without it SSR resolves through Bun while the client resolves through Vite - two resolvers, one\n * process - which is what makes `resolve.dedupe` fail to reach SSR and produces the dual-React\n * crash. Vite re-evaluates on change, so no `importQuery` cache-buster is needed alongside it.\n *\n * Pass `dev.onLoaderError` to `createWebApp` so failures an `_error` boundary renders still reach the\n * dev feed (`nifra errors`).\n */\n readonly createApp: (clientEntry: string, load: (absolutePath: string) => Promise<unknown>, dev: DevAppHooks) => FetchApp | Promise<FetchApp>;\n /** Vite plugins - inject your framework's official plugin, e.g. `[react()]`. */\n readonly plugins?: readonly unknown[];\n /**\n * Extra `resolve.conditions` prepended ahead of nifra's defaults - some frameworks need their own\n * (e.g. Solid's `\"solid\"` condition routes `solid-js` to its source/JSX-dev build).\n */\n readonly conditions?: readonly string[];\n /**\n * Compile-time `define` replacements (e.g. Vue's `__VUE_OPTIONS_API__` flags). Vite already sets\n * `process.env.NODE_ENV` in dev; this is for framework feature flags the plugin doesn't inject.\n */\n readonly define?: Readonly<Record<string, string>>;\n /** Vite project root (default `process.cwd()`). */\n readonly root?: string;\n /** Port (default {@link DEFAULT_DEV_PORT}). */\n readonly port?: number;\n /**\n * Use polling for the file watcher. Native fs events (fsevents/inotify) are unreliable inside\n * containers, networked filesystems, and some sandboxes - there, HMR silently never fires. Set\n * `true` (or the env var `CHOKIDAR_USEPOLLING=1`) to poll instead. Default: off (native events).\n */\n readonly poll?: boolean;\n /** Vite public directory. Defaults to `<root>/public`; `false` disables it. */\n readonly publicDir?: string | false;\n /** Client-visible environment prefix (default `\"PUBLIC_\"`; empty disables exposure). */\n readonly publicEnvPrefix?: string;\n /**\n * Downgrade the startup identity-parity check from a hard failure to a loud warning (dev only).\n * The check catches two physical copies of an identity-sensitive package (e.g. React) resolving in\n * one process, which reliably breaks hydration and framework context. When a duplicate comes from a\n * linked sibling repo you cannot fix in the moment, set this to keep the dev server running while you\n * resolve it; `nifra build` never honors it. Wired to `nifra dev --allow-duplicate-identity`.\n */\n readonly allowDuplicateIdentity?: boolean;\n /**\n * Write `.nifra/dev-server.json` (how `nifra errors`/`nifra logs` and the MCP tools find this server)\n * and the persisted dev log beside it (default `true`).\n */\n readonly record?: boolean;\n /**\n * Show the browser errors a dev page reports in a badge on that page, with a Copy prompt button per\n * fix (default `true`). Off, the errors still reach the feed.\n */\n readonly indicator?: boolean;\n}"
16892
+ "signature": "export interface ViteDevServerOptions {\n /** Absolute (or cwd-relative) path to the `routes/` dir. */\n readonly routesDir: string;\n /** Client runtime module providing `mountRouter` (e.g. `\"@nifrajs/web-react/client\"`). */\n readonly clientModule: string;\n /**\n * Build the nifra app for the given dev client-entry URL.\n *\n * `load` resolves a route module through **Vite's** graph (`ssrLoadModule`). Pass it to\n * `discoverRoutes(routesDir, { load })` so SSR and the client are resolved by the SAME toolchain.\n * Without it SSR resolves through Bun while the client resolves through Vite - two resolvers, one\n * process - which is what makes `resolve.dedupe` fail to reach SSR and produces the dual-React\n * crash. Vite re-evaluates on change, so no `importQuery` cache-buster is needed alongside it.\n *\n * Pass `dev.onLoaderError` to `createWebApp` so failures an `_error` boundary renders still reach the\n * dev feed (`nifra errors`).\n */\n readonly createApp: (clientEntry: string, load: (absolutePath: string) => Promise<unknown>, dev: DevAppHooks) => FetchApp | Promise<FetchApp>;\n /** Vite plugins - inject your framework's official plugin, e.g. `[react()]`. */\n readonly plugins?: readonly unknown[];\n /**\n * Extra `resolve.conditions` prepended ahead of nifra's defaults - some frameworks need their own\n * (e.g. Solid's `\"solid\"` condition routes `solid-js` to its source/JSX-dev build).\n */\n readonly conditions?: readonly string[];\n /**\n * Compile-time `define` replacements (e.g. Vue's `__VUE_OPTIONS_API__` flags). Vite already sets\n * `process.env.NODE_ENV` in dev; this is for framework feature flags the plugin doesn't inject.\n */\n readonly define?: Readonly<Record<string, string>>;\n /** Vite project root (default `process.cwd()`). */\n readonly root?: string;\n /** Port (default {@link DEFAULT_DEV_PORT}). */\n readonly port?: number;\n /**\n * Use polling for the file watcher. Native fs events (fsevents/inotify) are unreliable inside\n * containers, networked filesystems, and some sandboxes - there, HMR silently never fires. Set\n * `true` (or the env var `CHOKIDAR_USEPOLLING=1`) to poll instead. Default: off (native events).\n */\n readonly poll?: boolean;\n /** Vite public directory. Defaults to `<root>/public`; `false` disables it. */\n readonly publicDir?: string | false;\n /** Client-visible environment prefix (default `\"PUBLIC_\"`; empty disables exposure). */\n readonly publicEnvPrefix?: string;\n /**\n * Downgrade the startup identity-parity check from a hard failure to a loud warning (dev only).\n * The check catches two physical copies of an identity-sensitive package (e.g. React) resolving in\n * one process, which reliably breaks hydration and framework context. When a duplicate comes from a\n * linked sibling repo you cannot fix in the moment, set this to keep the dev server running while you\n * resolve it; `nifra build` never honors it. Wired to `nifra dev --allow-duplicate-identity`.\n */\n readonly allowDuplicateIdentity?: boolean;\n /**\n * Write `.nifra/dev-server.json` (how `nifra errors`/`nifra logs` and the MCP tools find this server)\n * and the persisted dev log beside it (default `true`).\n */\n readonly record?: boolean;\n /**\n * Show the browser errors a dev page reports in a badge on that page, with a Copy prompt button per\n * fix (default `true`). Off, the errors still reach the feed.\n */\n readonly indicator?: boolean;\n /** The app runs `createWebApp({ live })`: the same option as the build's (`BuildClientOptions.live`). */\n readonly live?: LiveClientEntry | undefined;\n}"
16209
16893
  },
16210
16894
  {
16211
16895
  "name": "WaitForStylesOptions",
@@ -16309,14 +16993,14 @@
16309
16993
  "name": "WebSocketHandler",
16310
16994
  "kind": "interface",
16311
16995
  "package": "@nifrajs/core",
16312
- "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>;\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 close?(ws: NifraWebSocket<Data>, code: number, reason: string): MaybePromise<void>;\n error?(ws: NifraWebSocket<Data>, error: unknown): MaybePromise<void>;\n}",
16996
+ "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}",
16313
16997
  "doc": "/** A WebSocket route's lifecycle. All callbacks optional; only `message` is needed for an echo. */"
16314
16998
  },
16315
16999
  {
16316
17000
  "name": "WebSocketHandler",
16317
17001
  "kind": "interface",
16318
17002
  "package": "nifra",
16319
- "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>;\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 close?(ws: NifraWebSocket<Data>, code: number, reason: string): MaybePromise<void>;\n error?(ws: NifraWebSocket<Data>, error: unknown): MaybePromise<void>;\n}",
17003
+ "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}",
16320
17004
  "doc": "/** A WebSocket route's lifecycle. All callbacks optional; only `message` is needed for an echo. */"
16321
17005
  },
16322
17006
  {
@@ -16358,7 +17042,7 @@
16358
17042
  "name": "WebhookFailureReason",
16359
17043
  "kind": "type",
16360
17044
  "package": "@nifrajs/core",
16361
- "signature": "export type WebhookFailureReason = \"missing_signature\" | \"invalid_signature\" | \"timestamp_out_of_tolerance\" | \"malformed_signature\" | \"payload_too_large\" | \"invalid_content_length\";"
17045
+ "signature": "export type WebhookFailureReason = \"missing_signature\" | \"invalid_signature\" | \"timestamp_out_of_tolerance\" | \"malformed_signature\" | \"payload_too_large\" | \"invalid_content_length\" | \"invalid_body\";"
16362
17046
  },
16363
17047
  {
16364
17048
  "name": "WebhookProvider",
@@ -16931,16 +17615,30 @@
16931
17615
  {
16932
17616
  "name": "batch",
16933
17617
  "kind": "function",
16934
- "package": "@nifrajs/islets",
17618
+ "package": "@nifrajs/web",
16935
17619
  "signature": "export declare function batch<T>(fn: () => T): T;",
16936
17620
  "doc": "/**\n * Batch writes: effects triggered inside `fn` run ONCE after it returns, deduplicated - so\n * `setA(); setB()` updates the DOM once, not twice. Re-entrant; an effect re-queued during the\n * flush runs in the same flush.\n */"
16937
17621
  },
16938
17622
  {
16939
- "name": "bearer",
17623
+ "name": "bearer",
17624
+ "kind": "function",
17625
+ "package": "@nifrajs/middleware",
17626
+ "signature": "export declare function bearer<P>(options: BearerOptions<P>): AuthPlugin<P>;",
17627
+ "doc": "/**\n * `Authorization: Bearer <token>` authentication. Parses the header, runs `verify`, and rejects with\n * `401` (+ `WWW-Authenticate: Bearer`) when the token is missing/invalid (unless `optional`). The\n * verified principal is read via the returned instance - see {@link AuthPlugin}.\n */"
17628
+ },
17629
+ {
17630
+ "name": "beforeHandler",
17631
+ "kind": "function",
17632
+ "package": "@nifrajs/core",
17633
+ "signature": "export declare function beforeHandler<H extends (context: Context) => unknown>(hook: H): H;",
17634
+ "doc": "/**\n * Mark a `beforeHandle` hook to run just before the handler: a guard registered after it in the same\n * scope still goes ahead of it, so it only sees requests every guard admitted. A hook that answers\n * from stored state (an idempotency replay) needs this, or it would answer ahead of a later guard.\n */"
17635
+ },
17636
+ {
17637
+ "name": "beforeHandler",
16940
17638
  "kind": "function",
16941
- "package": "@nifrajs/middleware",
16942
- "signature": "export declare function bearer<P>(options: BearerOptions<P>): AuthPlugin<P>;",
16943
- "doc": "/**\n * `Authorization: Bearer <token>` authentication. Parses the header, runs `verify`, and rejects with\n * `401` (+ `WWW-Authenticate: Bearer`) when the token is missing/invalid (unless `optional`). The\n * verified principal is read via the returned instance - see {@link AuthPlugin}.\n */"
17639
+ "package": "nifra",
17640
+ "signature": "export declare function beforeHandler<H extends (context: Context) => unknown>(hook: H): H;",
17641
+ "doc": "/**\n * Mark a `beforeHandle` hook to run just before the handler: a guard registered after it in the same\n * scope still goes ahead of it, so it only sees requests every guard admitted. A hook that answers\n * from stored state (an idempotency replay) needs this, or it would answer ahead of a later guard.\n */"
16944
17642
  },
16945
17643
  {
16946
17644
  "name": "betterAuth",
@@ -16949,40 +17647,26 @@
16949
17647
  "signature": "export declare function betterAuth(auth: BetterAuthLike, options?: BetterAuthOptions): import(\"@nifrajs/core\").IdentityPlugin<never>;",
16950
17648
  "doc": "/**\n * Mount a better-auth instance into a nifra app: registers its handler at `${basePath}/*`\n * (default `/api/auth/*`) for `GET` + `POST`, so every better-auth endpoint - sign-in/up/out, OAuth\n * callbacks, session, 2FA, magic links, … - is served by your nifra server.\n *\n * ```ts\n * import { betterAuth, requireSession } from \"@nifrajs/better-auth\"\n * import { auth } from \"./auth\" // your configured better-auth instance\n *\n * const app = server().use(betterAuth(auth)) // wires /api/auth/*\n * .get(\"/me\", async (c) => (await requireSession(auth, c.req)).user)\n * ```\n *\n * Idempotent (named `\"better-auth\"` - applying twice mounts once). Read the session with\n * {@link getSession} / {@link requireSession}, which infer your better-auth types.\n */"
16951
17649
  },
16952
- {
16953
- "name": "bind",
16954
- "kind": "function",
16955
- "package": "@nifrajs/web",
16956
- "signature": "export declare function bind<T>(el: HTMLElement, source: Readable<T>, apply: (el: HTMLElement, value: T) => void): () => void;",
16957
- "doc": "/**\n * Bind one element to a source: `apply(el, value)` runs once immediately and again on every change.\n * Returns the unsubscribe - hand it back as the island's cleanup (or collect several).\n *\n * bind(count, remaining, (el, n) => { el.textContent = String(n) })\n */"
16958
- },
16959
17650
  {
16960
17651
  "name": "bindComponentRouter",
16961
17652
  "kind": "function",
16962
17653
  "package": "@nifrajs/web",
16963
17654
  "signature": "export declare function bindComponentRouter(router: Pick<ClientRouter, \"snapshot\" | \"subscribe\">): () => void;",
16964
- "doc": "/** Optional router integration; imported only by opted-in application entries. */"
17655
+ "doc": "/**\n * Optional router integration; imported only by opted-in application entries. The components of a\n * `keepAlive` page are parked while it is hidden, so navigation leaves them as they are.\n */"
16965
17656
  },
16966
17657
  {
16967
- "name": "bindList",
17658
+ "name": "bindIsland",
16968
17659
  "kind": "function",
16969
17660
  "package": "@nifrajs/web",
16970
- "signature": "export declare function bindList<T>(source: Readable<readonly T[]>, container: HTMLElement, options: BindListOptions<T>): () => void;",
16971
- "doc": "/**\n * Bind a list signal to a container with keyed reconciliation: new items are `create`d, surviving\n * items are `update`d in place (keeping focus, scroll, and selection), removed items are detached,\n * and the children are ordered to match the array. Returns the unsubscribe.\n *\n * This is the one imperative task too error-prone to hand-write each time - it is why nano exists on\n * top of islands rather than leaving you to rebuild the container on every change.\n */"
17661
+ "signature": "export declare function bindIsland<P = Record<string, unknown>>(setup: (ctx: BindIslandContext<P>) => Record<string, (event: Event) => void> | void): IslandEnhancer<P>;",
17662
+ "doc": "/**\n * The binding tier: `setup` creates the island's state and returns the event handlers its markup\n * names; the island's `data-bind-*` attributes then bind them.\n *\n * data-bind-text=\"count\" data-bind-show=\"open\" data-bind-class=\"active:open\"\n * data-bind-attr=\"aria-expanded:open\" data-bind-value=\"query\" data-bind-on=\"click:add\"\n *\n * Attribute values are signal and handler names, never code; an unknown name warns once and the\n * server-rendered content stays as it is. A binding belongs to its nearest island.\n *\n * A setup or binding that throws stops everything the island started before the error reaches\n * `mountIslands`. On unmount every cleanup runs; one that throws is logged and the rest still run.\n */"
16972
17663
  },
16973
17664
  {
16974
- "name": "bindResource",
17665
+ "name": "bindList",
16975
17666
  "kind": "function",
16976
17667
  "package": "@nifrajs/web",
16977
- "signature": "export declare function bindResource<T>(el: HTMLElement, source: Readable<ResourceState<T>>, handlers: BindResourceHandlers<T>): () => void;",
16978
- "doc": "/**\n * Bind an element to a `resource`, dispatching on `status`. Like `bind`, it applies immediately and\n * on every change and returns the unsubscribe - collect it (a discarded disposer is `NF-C021`).\n *\n * bindResource(el, user, {\n * pending: (n) => { n.textContent = \"Loading…\" },\n * ready: (n, u) => { n.textContent = u.name },\n * error: (n) => { n.textContent = \"Failed to load\" },\n * })\n */"
16979
- },
16980
- {
16981
- "name": "bindScope",
16982
- "kind": "function",
16983
- "package": "@nifrajs/islets",
16984
- "signature": "export declare function bindScope(root: BindableRoot, scope: IslandScope): Array<() => void>;",
16985
- "doc": "/** Walk `root` and attach every `data-bind-*` binding against `scope`. Returns disposers for\n * both reactive effects and event listeners. */"
17668
+ "signature": "export declare function bindList<T, E extends ListNode = HTMLElement>(source: () => readonly T[], container: ListContainer<NoInfer<E>>, options: BindListOptions<T, E>): () => void;",
17669
+ "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 */"
16986
17670
  },
16987
17671
  {
16988
17672
  "name": "bodyLimit",
@@ -17003,7 +17687,7 @@
17003
17687
  "kind": "function",
17004
17688
  "package": "@nifrajs/env",
17005
17689
  "signature": "export declare function boolean(opts?: Base<boolean>): StandardSchemaV1<boolean>;",
17006
- "doc": "/** A boolean: `true`/`1`/`yes`/`on` → true; `false`/`0`/`no`/`off`/empty → false (case-insensitive). */"
17690
+ "doc": "/** A boolean: `true`/`1`/`yes`/`on` → true; `false`/`0`/`no`/`off` → false (case-insensitive). Set\n * but empty is `default` when there is one, else false. */"
17007
17691
  },
17008
17692
  {
17009
17693
  "name": "boundAgentText",
@@ -17128,7 +17812,7 @@
17128
17812
  "name": "buildManifest",
17129
17813
  "kind": "function",
17130
17814
  "package": "@nifrajs/web",
17131
- "signature": "export declare function buildManifest(files: readonly string[], importer: (file: string) => () => Promise<RouteModule>): Manifest;",
17815
+ "signature": "export declare function buildManifest(files: readonly string[], importer: (file: string) => () => Promise<RouteModule>, options?: BuildManifestOptions): Manifest;",
17132
17816
  "doc": "/**\n * Build a manifest from route file paths (relative to the routes dir) + an `importer` that\n * turns a path into a lazy module loader. Pure - no fs. Throws at boot (the loud-and-early\n * RouteConfigError ethos) on duplicate patterns. `_layout`/`_404`/`_error`/`_loading`/`_middleware`\n * files are special; other `_`-prefixed files are ignored (private/colocated, never routed).\n * A page pairs with its `.backend.*` half only when both are in `files`, so a hand-written list that\n * omits the half serves the page without its loader and guards; `discoverRoutes` from\n * `@nifrajs/web/fs` scans a routes dir and never does.\n */"
17133
17817
  },
17134
17818
  {
@@ -17219,6 +17903,13 @@
17219
17903
  "signature": "export declare function bunImageBackend(): ImageBackend;",
17220
17904
  "doc": "/**\n * {@link ImageBackend} backed by `Bun.Image` (libjpeg-turbo / libspng / libwebp, decoded off the main\n * thread). Requires the Bun runtime. The default backend of `createImageHandler`.\n */"
17221
17905
  },
17906
+ {
17907
+ "name": "bundleReactWidget",
17908
+ "kind": "function",
17909
+ "package": "@nifrajs/mcp",
17910
+ "signature": "export declare function bundleReactWidget(opts: BundleReactWidgetOptions): Promise<string>;",
17911
+ "doc": "/**\n * Bundle a React component into a widget body: the mount point and one inline script that renders the\n * component on every pushed `structuredContent`. Pass it to `defineMcpWidget({ html })`, which adds the\n * document shell and the bridge. Run it at build time and ship the result as a file when the server\n * itself does not run on Bun.\n */"
17912
+ },
17222
17913
  {
17223
17914
  "name": "bytes",
17224
17915
  "kind": "function",
@@ -17398,12 +18089,40 @@
17398
18089
  "signature": "export declare function checkRouteResponseContract(definition: ResponseContractDefinition, result: unknown, mode: \"warn\" | \"enforce\", jsonReply?: {\n readonly body: unknown;\n}, options?: ResponseContractOptions): ResponseContractOutcome | Promise<ResponseContractOutcome>;",
17399
18090
  "doc": "/**\n * Check a route's success or status-specific error payload. Plain `status()` results retain their\n * status while enforcement replaces only the body with the validator's output. A `c.json(...)`\n * reply is held to the contract through the value it was built from (`jsonReply`). Any other raw\n * `Response` remains an explicit transport escape hatch because inspecting it would consume\n * streams or alter redirects; assurance/static checks must govern that path separately.\n */"
17400
18091
  },
18092
+ {
18093
+ "name": "checkShellCanaries",
18094
+ "kind": "function",
18095
+ "package": "@nifrajs/web",
18096
+ "signature": "export declare function checkShellCanaries(app: {\n fetch(request: Request): Response | Promise<Response>;\n}, paths: readonly string[], options?: ShellCanaryOptions): Promise<readonly ShellCanaryFinding[]>;",
18097
+ "doc": "/**\n * The canary check. Each path is requested through the app's own middleware and gates with a\n * unique value in a cookie, an `Authorization` header, a custom header and the query, until a\n * response carries a shell (`shellAfterRequests` decides which request builds it) and a built frame\n * for each shared hole, and those are scanned for every value the path's requests carried. It\n * catches visitor data the app keeps in module state, which no import check sees. Run it against a\n * fresh app before it serves traffic: a shell or frame already cached was built without the canaries.\n */"
18098
+ },
18099
+ {
18100
+ "name": "checkSlotCss",
18101
+ "kind": "function",
18102
+ "package": "@nifrajs/web",
18103
+ "signature": "export declare function checkSlotCss(entry: Element, page: Element): void;",
18104
+ "doc": "/**\n * Dev only: report each same-origin style rule whose selector the slot wrappers around `page` stop\n * matching (`NIFRA_KEEPALIVE_DIRECT_CHILD_CSS`). A stylesheet the page cannot read is skipped.\n */"
18105
+ },
17401
18106
  {
17402
18107
  "name": "checkTrajectoryInvariants",
17403
18108
  "kind": "function",
17404
18109
  "package": "@nifrajs/testing",
17405
18110
  "signature": "export declare function checkTrajectoryInvariants(result: AgentRunResult<unknown>, options?: TrajectoryInvariantOptions): readonly TrajectoryInvariantResult[];"
17406
18111
  },
18112
+ {
18113
+ "name": "childProcessBaseEnv",
18114
+ "kind": "function",
18115
+ "package": "@nifrajs/agent-protocol",
18116
+ "signature": "export declare function childProcessBaseEnv(platform: string): readonly string[];",
18117
+ "doc": "/** What a spawned process needs to start on `platform`. None of it is a credential. */"
18118
+ },
18119
+ {
18120
+ "name": "childProcessEnv",
18121
+ "kind": "function",
18122
+ "package": "@nifrajs/agent-protocol",
18123
+ "signature": "export declare function childProcessEnv(input: ChildProcessEnvInput): Record<string, string>;",
18124
+ "doc": "/**\n * The environment for a spawned process: the {@link childProcessBaseEnv} names and `names`, read\n * from `env`, with `values` over them. A name with no value is left out.\n */"
18125
+ },
17407
18126
  {
17408
18127
  "name": "classificationAtLeast",
17409
18128
  "kind": "function",
@@ -17444,6 +18163,13 @@
17444
18163
  "package": "@nifrajs/web",
17445
18164
  "signature": "export declare function clientIsland<Props>(contract: ClientIsland<Props>, key: ComponentKey, props: NoInfer<Props>, slots?: Readonly<Record<string, string>>): IslandInstance;"
17446
18165
  },
18166
+ {
18167
+ "name": "closeBoundary",
18168
+ "kind": "function",
18169
+ "package": "@nifrajs/web",
18170
+ "signature": "export declare function closeBoundary(name: string): void;",
18171
+ "doc": "/**\n * Close the intercept boundary `name` and return to the page underneath it: back through the history\n * entries the boundary added when the page's entry is there, otherwise by replacing the boundary's URL\n * with the page's. A no-op on the server, before hydration, and when `name` holds no target.\n */"
18172
+ },
17447
18173
  {
17448
18174
  "name": "cloudflareLoader",
17449
18175
  "kind": "function",
@@ -17477,7 +18203,7 @@
17477
18203
  "kind": "function",
17478
18204
  "package": "@nifrajs/web",
17479
18205
  "signature": "export declare function cloudflareZone(options: CloudflareZoneOptions): CdnProvider;",
17480
- "doc": "/**\n * A Cloudflare zone proxying the origin. HTML is only cached by a Cache Rule that makes it eligible,\n * and the zone's cache ignores `Vary`: the rule must also bypass the cache when the request carries\n * `x-nifra-data` (soft navigations fetch the page URL with that header). `nifra cdn-check` tests both.\n */"
18206
+ "doc": "/**\n * A Cloudflare zone proxying the origin. HTML is only cached by a Cache Rule that makes it eligible,\n * and the zone's cache ignores `Vary`: the rule must also bypass the cache when the request carries\n * `x-nifra-data` or `x-nifra-swap` (soft navigations and slot swaps fetch the page URL with those\n * headers). `nifra cdn-check` tests all three.\n */"
17481
18207
  },
17482
18208
  {
17483
18209
  "name": "collectAssuranceReport",
@@ -17601,6 +18327,13 @@
17601
18327
  "signature": "export declare function compileSchema<T extends TSchema>(schema: NifraSchema<T>, options: CompileSchemaOptions): string;",
17602
18328
  "doc": "/** Generate a typed module with static validation code. Run at build time, then import its export at runtime. */"
17603
18329
  },
18330
+ {
18331
+ "name": "compileShells",
18332
+ "kind": "function",
18333
+ "package": "@nifrajs/web",
18334
+ "signature": "export declare function compileShells(options: CompileShellsOptions): Promise<ShellCheckRecord>;",
18335
+ "doc": "/**\n * Bundle each route's shell (its page and layout modules, its backend `shellLoader`, and nothing else)\n * and refuse it when the emitted code reaches a request-scoped module. A module counts only\n * when its code reached the output, so an import only a hole loader uses is not a leak. Routes whose\n * backend half has no `shellLoader` are skipped. Bun only.\n */"
18336
+ },
17604
18337
  {
17605
18338
  "name": "compileVue",
17606
18339
  "kind": "function",
@@ -17695,7 +18428,7 @@
17695
18428
  "kind": "function",
17696
18429
  "package": "@nifrajs/middleware",
17697
18430
  "signature": "export declare function compression(options?: CompressionOptions): import(\"@nifrajs/core\").IdentityPlugin<never>;",
17698
- "doc": "/**\n * Transparently **gzip** responses when the client sends `Accept-Encoding: gzip` and the body is a\n * compressible type larger than `threshold`. Uses the Web-standard `CompressionStream`, so it runs\n * on every nifra runtime including the edge; gzip is the one encoding `CompressionStream`\n * guarantees everywhere, so brotli isn't offered.\n *\n * Built on the portable `onResponseBody` tier for framework-serialized bytes, with a stream-safe raw\n * fallback for handler-returned/proxied Responses. The common JSON path stays on Node's direct\n * writer; raw streams are compressed incrementally without being fully buffered.\n *\n * Skips: clients that don't accept gzip, already-encoded responses, bodyless responses,\n * `Range` responses (206 / `Content-Range`), `Cache-Control: no-transform`, non-compressible\n * types, and bodies below `threshold` (gzip's ~20-byte overhead would enlarge them). Adds\n * `Vary: Accept-Encoding` to every response it would compress for a gzip-accepting client, the\n * identity one sent to any other client included.\n *\n * **Security (BREACH).** Compression makes the response length depend on its content, so a response\n * that mixes a secret with attacker-reflected input leaks the secret through the compressed size\n * (the BREACH class of attacks). This applies to any HTTP compression, not this middleware\n * specifically. Nifra's own CSRF tokens are HMAC-signed per session and safe to compress, but if a\n * response body reflects request input **and** carries a per-request secret, exclude that route via\n * `compressible`/route scoping, or split the secret and the reflection into separate responses.\n *\n * ```ts\n * app.use(compression())\n * ```\n */"
18431
+ "doc": "/**\n * Transparently **gzip** responses when the client sends `Accept-Encoding: gzip` and the body is a\n * compressible type larger than `threshold`. Uses the Web-standard `CompressionStream`, so it runs\n * on every nifra runtime including the edge; gzip is the one encoding `CompressionStream`\n * guarantees everywhere, so brotli isn't offered.\n *\n * Built on the portable `onResponseBody` tier for framework-serialized bytes, with a stream-safe raw\n * fallback for handler-returned/proxied Responses. The common JSON path stays on Node's direct\n * writer; raw streams are compressed incrementally without being fully buffered.\n *\n * On Cloudflare Workers it does nothing: the runtime gzips any body sent with `Content-Encoding:\n * gzip` again, and the platform compresses responses for clients that accept it.\n *\n * Skips: clients that don't accept gzip, already-encoded responses, bodyless responses,\n * `Range` responses (206 / `Content-Range`), `Cache-Control: no-transform`, non-compressible\n * types, and bodies below `threshold` (gzip's ~20-byte overhead would enlarge them). Adds\n * `Vary: Accept-Encoding` to every response it would compress for a gzip-accepting client, the\n * identity one sent to any other client included.\n *\n * **Security (BREACH).** Compression makes the response length depend on its content, so a response\n * that mixes a secret with attacker-reflected input leaks the secret through the compressed size\n * (the BREACH class of attacks). This applies to any HTTP compression, not this middleware\n * specifically. Nifra's own CSRF tokens are HMAC-signed per session and safe to compress, but if a\n * response body reflects request input **and** carries a per-request secret, exclude that route via\n * `compressible`/route scoping, or split the secret and the reflection into separate responses.\n *\n * ```ts\n * app.use(compression())\n * ```\n */"
17699
18432
  },
17700
18433
  {
17701
18434
  "name": "computeEffectDigest",
@@ -17714,17 +18447,10 @@
17714
18447
  {
17715
18448
  "name": "computed",
17716
18449
  "kind": "function",
17717
- "package": "@nifrajs/islets",
18450
+ "package": "@nifrajs/web",
17718
18451
  "signature": "export declare function computed<T>(fn: () => T): Computed<T>;",
17719
18452
  "doc": "/**\n * Derived value, cached into a signal and computed on first read. While an effect (or another\n * computed) reads it, it recomputes when its tracked inputs change. Once nothing reads it, the next\n * input change stops it instead of recomputing, so a dropped computed costs nothing; reading it\n * again starts it afresh. `dispose()` stops it at once.\n */"
17720
18453
  },
17721
- {
17722
- "name": "computed",
17723
- "kind": "function",
17724
- "package": "@nifrajs/web",
17725
- "signature": "export declare function computed<T>(compute: () => T, deps: readonly Readable<unknown>[]): Readable<T>;",
17726
- "doc": "/**\n * A derived cell. `computed(() => a.get() + b.get(), [a, b])` recomputes whenever a declared\n * dependency changes and notifies its own subscribers when the derived value changes.\n *\n * The `deps` array is mandatory and explicit ON PURPOSE - it is the contract a linter checks against\n * the signals the body reads (`NF-C023`). Auto-tracking would remove the array but reintroduce the\n * exact \"why didn't this update\" bug that makes framework reactivity hard to get right.\n */"
17727
- },
17728
18454
  {
17729
18455
  "name": "concatSourceMaps",
17730
18456
  "kind": "function",
@@ -18272,8 +18998,8 @@
18272
18998
  "name": "createQuery",
18273
18999
  "kind": "function",
18274
19000
  "package": "@nifrajs/web-solid",
18275
- "signature": "export declare function createQuery<T>(key: unknown, fn: () => Promise<T>): CreateQueryResult<T>;",
18276
- "doc": "/**\n * Bind the keyed query for `key`, fetched via `fn`. Returns a reactive `state()` accessor + `refetch`.\n * Concurrent `createQuery`s with the same key share one cache entry + one in-flight fetch (dedup).\n * Fetches on mount; SSR-idle. Call inside a component (owns the subscription).\n */"
19001
+ "signature": "export declare function createQuery<T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions): CreateQueryResult<T>;",
19002
+ "doc": "/**\n * Bind the keyed query for `key`, fetched via `fn`. Returns a reactive `state()` accessor + `refetch`.\n * Concurrent `createQuery`s with the same key share one cache entry + one in-flight fetch (dedup).\n * Fetches on mount; SSR-idle. Call inside a component (owns the subscription). `options.live` names\n * the live keys that refetch it.\n */"
18277
19003
  },
18278
19004
  {
18279
19005
  "name": "createQueryClient",
@@ -18375,6 +19101,13 @@
18375
19101
  "package": "@nifrajs/auth",
18376
19102
  "signature": "export declare function createSessions<Data extends Record<string, unknown> = Record<string, unknown>>(options: SessionOptions): SessionManager<Data>;"
18377
19103
  },
19104
+ {
19105
+ "name": "createSlotParking",
19106
+ "kind": "function",
19107
+ "package": "@nifrajs/web",
19108
+ "signature": "export declare function createSlotParking(): SlotParking;",
19109
+ "doc": "/** One per mounted view. */"
19110
+ },
18378
19111
  {
18379
19112
  "name": "createStepCatalog",
18380
19113
  "kind": "function",
@@ -18769,7 +19502,7 @@
18769
19502
  "kind": "function",
18770
19503
  "package": "@nifrajs/web",
18771
19504
  "signature": "export declare function defineIsland<P = unknown>(enhancer: IslandEnhancer<P>): IslandEnhancer<P>;",
18772
- "doc": "/**\n * Author a typed enhancer. Pure identity at runtime (zero cost, tree-shaken away) - its only job is\n * to pin the `data-props` shape so `el` and `props` are typed inside the body and the enhancer is\n * assignable to `mountIslands`. Prefer this over an inline arrow whenever an island reads props:\n *\n * const counter = defineIsland<{ start: number }>((el, props) => {\n * let n = props.start // props typed, no cast\n * const out = el.querySelector(\"output\")!\n * const onClick = () => { out.textContent = String(++n) }\n * el.querySelector(\"button\")?.addEventListener(\"click\", onClick)\n * return () => el.querySelector(\"button\")?.removeEventListener(\"click\", onClick)\n * })\n * mountIslands({ counter })\n *\n * The props type is a contract, not a validator - `data-props` is JSON authored by your own SSR, so\n * it is trusted framing, not user input. Keep the enhancer body imperative: read the DOM, wire\n * listeners, return cleanup. No hidden reactivity to get wrong.\n */"
19505
+ "doc": "/**\n * Author a typed enhancer. Pure identity at runtime (zero cost, tree-shaken away) - its only job is\n * to pin the props shape so `el` and `props` are typed inside the body and the enhancer is\n * assignable to `mountIslands`. Prefer this over an inline arrow whenever an island reads props:\n *\n * const counter = defineIsland<{ start: number }>((el, props) => {\n * let n = props.start // props typed, no cast\n * const out = el.querySelector(\"output\")!\n * const onClick = () => { out.textContent = String(++n) }\n * el.querySelector(\"button\")?.addEventListener(\"click\", onClick)\n * return () => el.querySelector(\"button\")?.removeEventListener(\"click\", onClick)\n * })\n * mountIslands({ counter })\n *\n * The props type is a contract, not a validator - `data-island-props` is JSON authored by your own\n * SSR, so it is trusted framing, not user input. Keep the enhancer body imperative: read the DOM,\n * wire listeners, return cleanup.\n */"
18773
19506
  },
18774
19507
  {
18775
19508
  "name": "defineLocales",
@@ -18836,6 +19569,13 @@
18836
19569
  "package": "@nifrajs/web",
18837
19570
  "signature": "export declare function defineServerComponent<Input, Props, View>(definition: ServerComponentDefinition<Input, Props, View>, reference?: string): ServerComponent<Input, Props, View>;"
18838
19571
  },
19572
+ {
19573
+ "name": "defineShellLoader",
19574
+ "kind": "const",
19575
+ "package": "@nifrajs/web",
19576
+ "signature": "export declare const defineShellLoader: <Data>(loader: (ctx: ShellCtx) => Data | Promise<Data>) => ((ctx: ShellCtx) => Data | Promise<Data>);",
19577
+ "doc": "/** Types a backend half's `shellLoader` from its context; returns it unchanged. */"
19578
+ },
18839
19579
  {
18840
19580
  "name": "defineTool",
18841
19581
  "kind": "function",
@@ -18892,7 +19632,7 @@
18892
19632
  {
18893
19633
  "name": "detectFileType",
18894
19634
  "kind": "function",
18895
- "package": "@nifrajs/uploads",
19635
+ "package": "@nifrajs/core",
18896
19636
  "signature": "export declare function detectFileType(bytes: Uint8Array): FileType | null;",
18897
19637
  "doc": "/** Detect a file's type from its magic bytes, or `null` if unrecognized. */"
18898
19638
  },
@@ -18948,7 +19688,7 @@
18948
19688
  "kind": "function",
18949
19689
  "package": "@nifrajs/devtools",
18950
19690
  "signature": "export declare function devtoolsClientScript(options?: DevToolsClientOptions): string;",
18951
- "doc": "/**\n * Returns a self-contained JavaScript string that creates a floating DevTools\n * overlay in the browser. Inject via `<script>` tag in dev mode.\n *\n * The overlay:\n * - Connects to `/_nifra/devtools` via EventSource\n * - Shows a scrolling log of request traces\n * - Color-coded method badges and status codes\n * - ISR hit/miss/stale indicators\n * - Collapsible with a ⚡ toggle button\n */"
19691
+ "doc": "/**\n * Returns a self-contained JavaScript string that creates a floating DevTools\n * overlay in the browser. Inject via `<script>` tag in dev mode.\n *\n * The overlay:\n * - Connects to `/_nifra/devtools` via EventSource\n * - Shows a scrolling log of request traces\n * - Color-coded method badges and status codes\n * - ISR hit/miss/stale indicators\n * - In an app with `keepAlive` routes, the pages kept hidden: path, instance, hidden time and node count\n * - Collapsible with a ⚡ toggle button\n */"
18952
19692
  },
18953
19693
  {
18954
19694
  "name": "diagnostic",
@@ -19097,9 +19837,9 @@
19097
19837
  {
19098
19838
  "name": "effect",
19099
19839
  "kind": "function",
19100
- "package": "@nifrajs/islets",
19840
+ "package": "@nifrajs/web",
19101
19841
  "signature": "export declare function effect(fn: () => void): () => void;",
19102
- "doc": "/**\n * Run `fn` now and again whenever any signal it read changes. Returns a disposer. Dependencies\n * re-track on every run, so conditional reads subscribe to exactly the live branch.\n */"
19842
+ "doc": "/**\n * Run `fn` now and again whenever any signal it read changes. Returns a disposer. Dependencies\n * re-track on every run, so conditional reads subscribe to exactly the live branch. Every run,\n * the first included, finishes before the effects its writes trigger run, itself among them.\n */"
19103
19843
  },
19104
19844
  {
19105
19845
  "name": "effectLedger",
@@ -19149,6 +19889,13 @@
19149
19889
  "signature": "export declare function enableDraft(c: {\n readonly set: DraftCookieControls;\n}, secret: string, options?: EnableDraftOptions): Promise<void>;",
19150
19890
  "doc": "/**\n * Turn draft mode **on** for this client by setting a signed, HttpOnly `__nifra_draft` cookie. Call it\n * from a route you've already authorized. `secret` signs the cookie - pass the SAME secret to\n * `createWebApp({ draftSecret })` and `withISR({ draftSecret })` so the framework can verify it.\n */"
19151
19891
  },
19892
+ {
19893
+ "name": "enableSwap",
19894
+ "kind": "function",
19895
+ "package": "@nifrajs/web",
19896
+ "signature": "export declare function enableSwap(enhancers: Readonly<Record<string, IslandEnhancer<never>>>, options?: SwapOptions): () => void;",
19897
+ "doc": "/**\n * Mount the page's islands, as `mountIslands` does, and make every `data-swap` link and GET form under\n * `root` refresh its slot in place. Call it instead of `mountIslands`.\n *\n * - `data-swap=\"replace:<slot>\"` replaces the content of the `data-swap-slot=\"<slot>\"` element;\n * `append:<slot>` adds to it, and a link or form inside that slot is spent: the slot's child holding\n * it is removed when the next content arrives, so a \"more\" link at the end of a list gives way to\n * the next page and its own \"more\" link.\n * - A replacing GET pushes its URL, so a filtered list survives reload and can be shared; back and\n * forward fetch the slots again for the URL they land on.\n * - The islands inside a slot mount with it and unmount when it is replaced.\n * - While a slot loads it carries `aria-busy=\"true\"`; a newer swap of the same slot cancels the\n * older one. When the request fails, the page stays as it is and the link or form gets\n * `data-swap-error`.\n *\n * Nothing inside a `data-island-ignore` element swaps. Returns a disposer that removes the listeners,\n * cancels pending swaps and unmounts every island.\n */"
19898
+ },
19152
19899
  {
19153
19900
  "name": "encode",
19154
19901
  "kind": "function",
@@ -19249,7 +19996,7 @@
19249
19996
  "kind": "function",
19250
19997
  "package": "@nifrajs/middleware",
19251
19998
  "signature": "export declare function etag(options?: ETagOptions): import(\"@nifrajs/core\").IdentityPlugin<never>;",
19252
- "doc": "/**\n * A {@link defineRouterPlugin} plugin that adds a content-hash `ETag` to `GET` `200` responses and returns\n * **`304 Not Modified`** when the client's `If-None-Match` matches - saving bandwidth on unchanged\n * responses. Built on the portable `onResponseBody` tier: the hook receives the final\n * framework-serialized bytes on every runtime with nothing drained, so the middleware stays on\n * Node's direct writer. Handler-returned raw `Response`s (streams, proxied fetches) use a capped,\n * replaying fallback so oversized bodies remain intact. Idempotent.\n */"
19999
+ "doc": "/**\n * A {@link defineRouterPlugin} plugin that adds a content-hash `ETag` to `GET` `200` responses and returns\n * **`304 Not Modified`** when the client's `If-None-Match` matches - saving bandwidth on unchanged\n * responses. Built on the portable `onResponseBody` tier: the hook receives the final\n * framework-serialized bytes on every runtime with nothing drained, so the middleware stays on\n * Node's direct writer. Handler-returned raw `Response`s (streams, proxied fetches) use a capped,\n * replaying fallback so oversized bodies remain intact. A response that already carries an `ETag`\n * (a version the app manages) keeps it, and `If-None-Match` is checked against that tag. Idempotent.\n */"
19253
20000
  },
19254
20001
  {
19255
20002
  "name": "evaluateBuildFreshness",
@@ -19578,7 +20325,7 @@
19578
20325
  "kind": "function",
19579
20326
  "package": "@nifrajs/mcp-db",
19580
20327
  "signature": "export declare function gateSqliteStatement(input: string, exposed: (relation: string) => boolean): SqliteGate;",
19581
- "doc": "/**\n * Gate one statement before SQLite sees it: non-empty, a single statement, SELECT/WITH only, and every\n * relation it names after `FROM`/`JOIN`/`IN` exposed. Returns the statement without its terminator, ready\n * to wrap. Relation names are checked here as well as in the plan because SQLite's plan names an\n * alias as the scan target (`users AS habits` plans as `SCAN habits`).\n */"
20328
+ "doc": "/**\n * Gate one statement before SQLite sees it: non-empty, a single statement, SELECT/WITH only, and every\n * relation it names after `FROM`/`JOIN`/`IN` exposed. Returns the statement without its terminator, ready\n * to wrap. The compiled program ({@link unexposedProgramRelation}) remains the authority on the\n * tables a statement reads; this check refuses a named relation before SQLite compiles anything.\n */"
19582
20329
  },
19583
20330
  {
19584
20331
  "name": "gatewayCertificationProfile",
@@ -19598,8 +20345,7 @@
19598
20345
  "name": "generateClientEntry",
19599
20346
  "kind": "function",
19600
20347
  "package": "@nifrajs/web",
19601
- "signature": "export declare function generateClientEntry(manifest: Manifest, options: GenerateClientEntryOptions): string;",
19602
- "doc": "/**\n * Codegen: emit a client-entry module (as source) that lazily imports each route's layout chain\n * (so `Bun.build` with `splitting` code-splits one chunk per route), builds a `patterns` list,\n * then creates the agnostic router store (with a `loadModule` hook), installs history + form\n * interception, loads the initial route's chunk, and hydrates the adapter's stateful Router. The\n * initial route is derived from the URL (falling back to the server-injected route id, e.g.\n * `_404`), so after hydration the Router owns navigation and swaps routes without full reloads.\n * Bun has no `import.meta.glob`, so file-based routing needs this. Write the result to a file and\n * bundle it with `buildClient` / `Bun.build` (+ the adapter's transform).\n */"
20348
+ "signature": "export declare function generateClientEntry(manifest: Manifest, options: GenerateClientEntryOptions): string;"
19603
20349
  },
19604
20350
  {
19605
20351
  "name": "generateMockValue",
@@ -19696,6 +20442,13 @@
19696
20442
  "signature": "export declare function getSession<A extends BetterAuthLike>(auth: A, input: Request | Headers | AuthHeaders): Promise<SessionOf<A> | null>;",
19697
20443
  "doc": "/**\n * Resolve the better-auth session for a request - a thin, typed wrapper over `auth.api.getSession`.\n * Returns `null` when unauthenticated. Accepts a raw `Request` for handlers/loaders, native\n * `Headers`, or the body-blind `AuthHeaders` capsule supplied by `authenticate()`.\n *\n * ```ts\n * const session = await getSession(auth, c.req) // typed: { user, session } | null\n * if (session) c.set.headers[\"x-user\"] = session.user.id\n * ```\n */"
19698
20444
  },
20445
+ {
20446
+ "name": "githubDeployWorkflow",
20447
+ "kind": "function",
20448
+ "package": "create-nifra",
20449
+ "signature": "export declare function githubDeployWorkflow(target: string, appName: string): string;",
20450
+ "doc": "/**\n * Build a GitHub Actions workflow that builds on every push/PR and deploys `target` on a push to `main`.\n * Runs `bun run build` (`nifra build` for the app's target), then the target's official deploy\n * mechanism. Exported for unit tests. Throws on an unknown target.\n */"
20451
+ },
19699
20452
  {
19700
20453
  "name": "gone",
19701
20454
  "kind": "function",
@@ -19817,6 +20570,13 @@
19817
20570
  "signature": "export declare function healthcheck(options?: HealthcheckOptions): IdentityPlugin;",
19818
20571
  "doc": "/**\n * Register **liveness** (`/health`) and **readiness** (`/ready`) endpoints. Liveness is a flat `200`\n * (the process is serving). Readiness runs each `check` and returns `200 { status: \"ok\", checks }`\n * when all pass, or `503 { status: \"error\", checks }` when any fail (a thrown check counts as failed).\n * Both are `Cache-Control: no-store`.\n *\n * Apply it **before** auth guards so the endpoints stay public (`beforeHandle` is order-scoped):\n *\n * ```ts\n * app.use(healthcheck({ checks: { db: () => db.ping() } })).use(bearer({ verify }))\n * ```\n */"
19819
20572
  },
20573
+ {
20574
+ "name": "holeComponents",
20575
+ "kind": "function",
20576
+ "package": "@nifrajs/web",
20577
+ "signature": "export declare function holeComponents(client: ComponentClientAdapter | undefined): void;",
20578
+ "doc": "/**\n * Experimental: how the client islands inside partially prerendered holes that show server\n * components mount, as the adapter's component client, such as `vueComponentClient({ islands })`;\n * `undefined` forgets it. Call it in the client entry before the router mounts. Without one such a\n * hole shows its error slot.\n */"
20579
+ },
19820
20580
  {
19821
20581
  "name": "hotUpdateNeedsReload",
19822
20582
  "kind": "const",
@@ -19908,9 +20668,16 @@
19908
20668
  "name": "idempotency",
19909
20669
  "kind": "function",
19910
20670
  "package": "@nifrajs/middleware",
19911
- "signature": "export declare function idempotency(options: IdempotencyOptions): Middleware;",
20671
+ "signature": "export declare function idempotency(options: IdempotencyOptions): IdentityPlugin;",
19912
20672
  "doc": "/**\n * Idempotency-key middleware. Apply with `app.use(idempotency({ store }))`.\n *\n * The store key is scoped by method + path **and** by a digest of the caller's credential headers, so\n * a key one caller chose addresses only that caller's entry - presenting someone else's key replays\n * nothing. See `principalHeaders`; a custom `key` replaces that scoping and must do it itself.\n *\n * **`Set-Cookie` is intentionally not cached or replayed** - a cookie set on the first request is\n * session-specific, so replaying it to a different caller (key collision or abuse) would leak/fixate a\n * session. Cache the body + status + the rest of the headers; let auth cookies re-issue per request.\n *\n * The key is not bound to the request body: a key reused with a different body replays the first\n * answer. A route that needs that check declares `schema.idempotency`, which fingerprints the request\n * and refuses a mismatched reuse with 409.\n *\n * Caching buffers the response body, so apply this to JSON/API routes, not streaming SSR responses.\n */"
19913
20673
  },
20674
+ {
20675
+ "name": "identityChanged",
20676
+ "kind": "function",
20677
+ "package": "@nifrajs/web",
20678
+ "signature": "export declare function identityChanged(): void;",
20679
+ "doc": "/**\n * Tell this tab and every other tab of the origin that the visitor signed in or out. Call it at login\n * and logout when identity lives in client storage (a bearer token) rather than in a cookie, which the\n * server's epoch cookie already covers: every page kept alive for the previous visitor is dropped.\n */"
20680
+ },
19914
20681
  {
19915
20682
  "name": "identityLoader",
19916
20683
  "kind": "const",
@@ -20114,7 +20881,7 @@
20114
20881
  "kind": "const",
20115
20882
  "package": "@nifrajs/web",
20116
20883
  "signature": "export declare const isCacheablePage: (req: Request, res: Response) => boolean;",
20117
- "doc": "/**\n * Whether `res` may be stored by a shared cache and served to anyone requesting `req`'s URL: a\n * full-document `GET` 200 `text/html` with no Set-Cookie, no `private`/`no-store`, no `Vary` beyond\n * the data header, and, for a request carrying a cookie or Authorization or accepted by an\n * authentication stage, an explicit `public`.\n * The one rule both `withISR` and `@nifrajs/web/cdn` cache by.\n */"
20884
+ "doc": "/**\n * Whether `res` may be stored by a shared cache and served to anyone requesting `req`'s URL: a\n * full-document `GET` 200 `text/html` with no Set-Cookie, no `private`/`no-store`, no `Vary` beyond\n * the data/swap headers, and, for a request carrying a cookie or Authorization or accepted by an\n * authentication stage, an explicit `public`.\n * The one rule both `withISR` and `@nifrajs/web/cdn` cache by.\n */"
20118
20885
  },
20119
20886
  {
20120
20887
  "name": "isClientIsland",
@@ -20122,6 +20889,13 @@
20122
20889
  "package": "@nifrajs/web",
20123
20890
  "signature": "export declare function isClientIsland(value: unknown): value is ClientIsland;"
20124
20891
  },
20892
+ {
20893
+ "name": "isConsoleDiagnostic",
20894
+ "kind": "function",
20895
+ "package": "@nifrajs/web",
20896
+ "signature": "export declare function isConsoleDiagnostic(message: string): boolean;",
20897
+ "doc": "/** True when a console `message` reports a catalog failure that is only ever logged, never thrown. */"
20898
+ },
20125
20899
  {
20126
20900
  "name": "isDataClassification",
20127
20901
  "kind": "function",
@@ -20308,6 +21082,12 @@
20308
21082
  "signature": "export declare function isServerPackageSpecifier(specifier: string): boolean;",
20309
21083
  "doc": "/** Whether a bare specifier names one of {@link SERVER_PACKAGES} or a database driver entry. */"
20310
21084
  },
21085
+ {
21086
+ "name": "isSvelteUI",
21087
+ "kind": "const",
21088
+ "package": "@nifrajs/web-svelte",
21089
+ "signature": "export declare const isSvelteUI: (value: unknown) => value is SvelteUI;"
21090
+ },
20311
21091
  {
20312
21092
  "name": "isTerminalApprovalState",
20313
21093
  "kind": "function",
@@ -20330,18 +21110,11 @@
20330
21110
  "doc": "/**\n * Whether a gate's command can be found and run from `cwd`, without running the gate. `test` runs\n * on the Bun this agent runs on, so it is always available unless `command` replaces it.\n */"
20331
21111
  },
20332
21112
  {
20333
- "name": "island",
20334
- "kind": "function",
20335
- "package": "@nifrajs/islets",
20336
- "signature": "export declare function island(name: string, setup: IslandSetup): void;",
20337
- "doc": "/** Register an island's behavior by name (the markup's `data-island` value). */"
20338
- },
20339
- {
20340
- "name": "islandState",
21113
+ "name": "islandProps",
20341
21114
  "kind": "function",
20342
- "package": "@nifrajs/islets",
20343
- "signature": "export declare function islandState(state: Record<string, unknown>): string;",
20344
- "doc": "/**\n * Server-side helper: the value for a host's `data-island-state` attribute. Plain JSON - emit it\n * through an escaping renderer (`@nifrajs/web-vanilla`'s `html` escapes quotes in attributes), e.g.\n * `html\\`<div data-island=\"compare\" data-island-state=\"${islandState({ count })}\">…\\``.\n */"
21115
+ "package": "@nifrajs/web",
21116
+ "signature": "export declare function islandProps(props: Record<string, unknown>): string;",
21117
+ "doc": "/**\n * The `data-island-props` value for `props`: JSON. Emit it through an escaping renderer into a quoted\n * attribute (`data-island-props=\"${...}\"`): unquoted, a space in the JSON ends the value and the rest\n * parses as attributes.\n */"
20345
21118
  },
20346
21119
  {
20347
21120
  "name": "jobStoreCertificationProfile",
@@ -20427,6 +21200,13 @@
20427
21200
  "package": "@nifrajs/middleware",
20428
21201
  "signature": "export declare function jwt<C extends JwtClaims = JwtClaims>(options: JwtOptions): JwtPlugin<C>;"
20429
21202
  },
21203
+ {
21204
+ "name": "keepAliveClient",
21205
+ "kind": "function",
21206
+ "package": "@nifrajs/web",
21207
+ "signature": "export declare function keepAliveClient(options: KeepAliveClientOptions): KeepAliveClient;",
21208
+ "doc": "/**\n * Keep-alive for a router. See the module docs; the generated client entry wires it:\n *\n * ```ts\n * const keep = keepAliveClient({ table, routeHooks, matchChains })\n * const router = keep.attach(createClientRouter({ ..., fetchData: keep.fetchData }))\n * installHistory(router)\n * ```\n */"
21209
+ },
20430
21210
  {
20431
21211
  "name": "language",
20432
21212
  "kind": "function",
@@ -20454,6 +21234,26 @@
20454
21234
  "package": "@nifrajs/cli",
20455
21235
  "signature": "export declare function listFixRecipes(): readonly FixRecipe[];"
20456
21236
  },
21237
+ {
21238
+ "name": "live",
21239
+ "kind": "function",
21240
+ "package": "@nifrajs/web",
21241
+ "signature": "export declare function live(options: LiveOptions): Live;",
21242
+ "doc": "/** Create the live runtime for one app. */"
21243
+ },
21244
+ {
21245
+ "name": "liveClient",
21246
+ "kind": "function",
21247
+ "package": "@nifrajs/web",
21248
+ "signature": "export declare function liveClient(options?: LiveClientOptions): LiveClient;"
21249
+ },
21250
+ {
21251
+ "name": "liveHub",
21252
+ "kind": "function",
21253
+ "package": "@nifrajs/web",
21254
+ "signature": "export declare function liveHub<Env = Record<string, string | undefined>>(options: LiveHubOptions | ((env: Env) => LiveHubOptions)): new (state: LiveHubState, env: Env) => LiveHubObject;",
21255
+ "doc": "/**\n * The live hub's Durable Object class. Export it from the Worker's main module under the class name\n * the binding names.\n */"
21256
+ },
20457
21257
  {
20458
21258
  "name": "loadAssuranceConfig",
20459
21259
  "kind": "function",
@@ -20530,6 +21330,13 @@
20530
21330
  "signature": "export declare function markIdempotencySafeToRetry(context: object): void;",
20531
21331
  "doc": "/**\n * Opt a concrete 5xx response into releasing its idempotency reservation, but only while the\n * request-local effect scope still proves that no owned effect began.\n */"
20532
21332
  },
21333
+ {
21334
+ "name": "markRepeatedPrefix",
21335
+ "kind": "function",
21336
+ "package": "@nifrajs/core",
21337
+ "signature": "export declare function markRepeatedPrefix(chunk: Uint8Array, source: Uint8Array, length: number): void;",
21338
+ "doc": "/**\n * Record that `chunk` starts with the first `length` bytes of `source`: bytes its producer sends again\n * in later responses and never changes, such as a cached page shell. A response observer that\n * transforms streamed bodies may keep its work on those bytes, keyed by `source`, and reuse it. It must\n * check that the chunk still holds them, since a later reader may have written into the chunk.\n */"
21339
+ },
20533
21340
  {
20534
21341
  "name": "markResidentBody",
20535
21342
  "kind": "function",
@@ -20633,6 +21440,13 @@
20633
21440
  "signature": "export declare function memoryArtifactPort(options?: {\n readonly maxBytes?: number;\n}): MemoryArtifactPort;",
20634
21441
  "doc": "/**\n * A disposable in-memory port for tests. Retains payloads up to a small byte budget and throws past\n * it, refusing any load that resembles durable use. NEVER use outside tests - it has no persistence,\n * no tenancy, and no eviction beyond the hard cap.\n */"
20635
21442
  },
21443
+ {
21444
+ "name": "memoryBus",
21445
+ "kind": "function",
21446
+ "package": "@nifrajs/web",
21447
+ "signature": "export declare function memoryBus(): LiveBus;",
21448
+ "doc": "/**\n * The single-process bus: an in-memory clock, events delivered to every subscriber before `append`\n * resolves. Processes do not share it; run several behind a shared bus instead.\n */"
21449
+ },
20636
21450
  {
20637
21451
  "name": "memoryChannelHub",
20638
21452
  "kind": "function",
@@ -20736,19 +21550,12 @@
20736
21550
  "signature": "export declare function mountGraphql<Context = unknown, Env = unknown>(app: MountableApp<Env>, options: MountGraphqlOptions<Context, Env>): void;",
20737
21551
  "doc": "/**\n * Mount a GraphQL endpoint. Wires `POST` (and `GET`, unless disabled) on `path`, injecting the nifra\n * route context into your resolver context, and - when `subscriptions` is set - a `graphql-ws` WebSocket\n * on the same path.\n *\n * ```ts\n * import { server } from \"@nifrajs/core\"\n * import { websocket } from \"@nifrajs/core/ws\"\n * import { mountGraphql, createPubSub } from \"@nifrajs/graphql\"\n *\n * const pubsub = createPubSub()\n * const app = server().use(websocket())\n * mountGraphql(app, {\n * schema,\n * context: ({ nifra }) => ({ user: nifra?.env, pubsub }),\n * subscriptions: true,\n * })\n * ```\n */"
20738
21552
  },
20739
- {
20740
- "name": "mountIslands",
20741
- "kind": "function",
20742
- "package": "@nifrajs/islets",
20743
- "signature": "export declare function mountIslands(rootOrOptions?: BindableRoot | MountIslandOptions): () => void;",
20744
- "doc": "/**\n * Mount every registered island under `root` (default: the document). Idempotent - a host is\n * marked once mounted, so calling again (e.g. after a soft navigation swapped content in) only\n * mounts new hosts. Unregistered island names are skipped silently: markup may ship ahead of\n * its script, and progressive enhancement means the static content is already correct.\n */"
20745
- },
20746
21553
  {
20747
21554
  "name": "mountIslands",
20748
21555
  "kind": "function",
20749
21556
  "package": "@nifrajs/web",
20750
- "signature": "export declare function mountIslands(enhancers: Readonly<Record<string, IslandEnhancer>>, options?: {\n readonly root?: ParentNode;\n}): () => void;",
20751
- "doc": "/**\n * Find every `<nifra-island data-id>` under `root` (default `document`) and enhance each with the\n * matching enhancer, honoring its `data-strategy`. An island whose `id` has no enhancer is left as\n * inert SSR HTML (forward-compatible). An enhancer that throws is isolated - it never blocks the\n * others (each island is independent). Returns a disposer that cancels pending triggers and runs every\n * enhancer's cleanup (call it on soft-nav teardown; harmless if your app never navigates).\n */"
21557
+ "signature": "export declare function mountIslands(enhancers: Readonly<Record<string, IslandEnhancer<never>>>, options?: {\n readonly root?: ParentNode;\n}): () => void;",
21558
+ "doc": "/**\n * Find every `[data-island]` element under `root` (default `document`) and enhance each with the\n * matching enhancer, honoring its `data-island-strategy`. An island whose id has no enhancer, or that\n * is already mounted, is left alone, so calling again after a soft navigation mounts only new hosts.\n * An enhancer that throws is isolated - it never blocks the others. Every effect, list binding and\n * resource an enhancer creates is owned by its island. Returns a disposer that cancels pending\n * triggers and tears down every island it mounted (call it on soft-nav teardown).\n */"
20752
21559
  },
20753
21560
  {
20754
21561
  "name": "mountRouter",
@@ -20874,6 +21681,13 @@
20874
21681
  "signature": "export declare function nextRun(fields: CronFields, from: Date): Date | null;",
20875
21682
  "doc": "/**\n * The next instant at/after `from` (exclusive of the current minute's already-started second) that\n * matches. Steps minute-by-minute with a safety cap (~5 years) so a never-matching expression\n * returns `null` instead of looping forever.\n */"
20876
21683
  },
21684
+ {
21685
+ "name": "nextSeq",
21686
+ "kind": "const",
21687
+ "package": "@nifrajs/web",
21688
+ "signature": "export declare const nextSeq: (last: number, nowMs: number) => number;",
21689
+ "doc": "/** The seq a clock reading allows, never at or below `last`. */"
21690
+ },
20877
21691
  {
20878
21692
  "name": "nifraScriptHashes",
20879
21693
  "kind": "function",
@@ -20935,7 +21749,7 @@
20935
21749
  "kind": "function",
20936
21750
  "package": "@nifrajs/web",
20937
21751
  "signature": "export declare function normalizeRolldownPlugins(plugins: readonly unknown[], isRolldown: boolean): readonly unknown[];",
20938
- "doc": "/**\n * Move a plugin's `optimizeDeps.rollupOptions` to `optimizeDeps.rolldownOptions` under rolldown-vite and\n * drop its `jsx` key, so Vite 8 warns about neither on `nifra dev` or a Vite build.\n *\n * Both are version-skew artifacts of plugins such as `@vitejs/plugin-react@4.x`, which still emit\n * `optimizeDeps.rollupOptions.jsx`:\n *\n * - Vite 8 renamed the dep optimizer's options to `rolldownOptions` and moved jsx under `transform.jsx`,\n * so a stale `jsx` key prints `Invalid input options … \"jsx\" Invalid key`. The route JSX transform runs\n * through the plugin's own `transform` hook and pre-bundled deps almost never hold raw JSX, so the key\n * is dead and dropping it changes no behavior.\n * - Vite 8 reads `rollupOptions` there only as a deprecated alias of `rolldownOptions` and warns on every\n * resolve, even for `{}`. The remaining keys move to `rolldownOptions`; when the same object already\n * sets `rolldownOptions`, Vite ignores the alias, so it is dropped. `ssr.optimizeDeps` gets the same.\n *\n * Only a plugin's `config` hook output is rewritten, never mutated, and only under rolldown-vite.\n * Non-rolldown Vite is passed through verbatim.\n *\n * FLATTEN FIRST: a Vite plugin factory may return an ARRAY of plugins - `@vitejs/plugin-react`'s `react()`\n * returns `[vite:react-babel, vite:react-refresh]`, and it's `react:react-babel`'s `config` hook that emits\n * the offending `optimizeDeps.rollupOptions.jsx`. `nifra.config.ts` writes `vitePlugins = [react()]`, so the\n * plugin list arrives NESTED (`[[babel, refresh]]`). Without flattening, `.map` sees the inner array (which\n * has no `config`), leaves it untouched, and Vite - which flattens plugin arrays itself before running them\n * - then executes the un-stripped babel hook, so the warning survives. Flattening here (Vite accepts a flat\n * list identically) is what lets the strip reach every real plugin.\n */"
21752
+ "doc": "/**\n * Move a plugin's `optimizeDeps.rollupOptions` to `optimizeDeps.rolldownOptions` under rolldown-vite and\n * drop its `jsx` key, so Vite 8 warns about neither on `nifra dev` or a Vite build.\n *\n * Both are version-skew artifacts of plugins such as `@vitejs/plugin-react@4.x`, which still emit\n * `optimizeDeps.rollupOptions.jsx`:\n *\n * - Vite 8 renamed the dep optimizer's options to `rolldownOptions` and moved jsx under `transform.jsx`,\n * so a stale `jsx` key prints `Invalid input options … \"jsx\" Invalid key`. The route JSX transform runs\n * through the plugin's own `transform` hook and pre-bundled deps almost never hold raw JSX, so the key\n * is dead and dropping it changes no behavior.\n * - Vite 8 reads `rollupOptions` there only as a deprecated alias of `rolldownOptions` and warns on every\n * resolve, even for `{}`. The remaining keys move to `rolldownOptions`; when the same object already\n * sets `rolldownOptions`, Vite ignores the alias, so it is dropped. `ssr.optimizeDeps` gets the same.\n *\n * Only a plugin's `config` hook output is rewritten, never mutated, and only under rolldown-vite.\n * Non-rolldown Vite is passed through verbatim.\n *\n * FLATTEN FIRST: a plugin factory may return an ARRAY of plugins - `@vitejs/plugin-react@4.x`'s `react()`\n * returns `[vite:react-babel, vite:react-refresh]`, and it's `vite:react-babel`'s `config` hook that emits\n * the offending `optimizeDeps.rollupOptions.jsx`. `nifra.config.ts` writes `vitePlugins = [react()]`, so the\n * plugin list arrives NESTED (`[[babel, refresh]]`). Without flattening, `.map` sees the inner array (which\n * has no `config`), leaves it untouched, and Vite - which flattens plugin arrays itself before running them\n * - then executes the un-stripped babel hook, so the warning survives. Flattening here (Vite accepts a flat\n * list identically) is what lets the strip reach every real plugin.\n */"
20939
21753
  },
20940
21754
  {
20941
21755
  "name": "normalizeSeverity",
@@ -20971,12 +21785,19 @@
20971
21785
  "signature": "export declare function notFoundInput<Env>(source: RequestSource, pathname: string, platform: Platform<Env> | undefined, signal?: AbortSignal): NotFoundInput<Env>;",
20972
21786
  "doc": "/** @internal The read-only view a {@link NotFoundHandler} receives. `url` and `headers` stay getters\n * so a source that builds them on demand is not forced to for a handler that never reads them. */"
20973
21787
  },
21788
+ {
21789
+ "name": "noteKeptView",
21790
+ "kind": "function",
21791
+ "package": "@nifrajs/web",
21792
+ "signature": "export declare function noteKeptView(key: string, elements: (() => readonly Element[]) | undefined): void;",
21793
+ "doc": "/**\n * For an adapter, in development: the elements slot `key` renders, read when the devtools panel\n * counts a kept page's nodes. `undefined` once the slot has left the view.\n */"
21794
+ },
20974
21795
  {
20975
21796
  "name": "number",
20976
21797
  "kind": "function",
20977
21798
  "package": "@nifrajs/env",
20978
21799
  "signature": "export declare function number(opts?: Base<number> & Optional): StandardSchemaV1<number | undefined>;",
20979
- "doc": "/** A finite number, coerced from its decimal string. */"
21800
+ "doc": "/** A finite number, coerced from its decimal string (`42`, `-3.5`; not `0x10` or `1e3`). */"
20980
21801
  },
20981
21802
  {
20982
21803
  "name": "ogImageResponse",
@@ -20985,6 +21806,76 @@
20985
21806
  "signature": "export declare function ogImageResponse(options: OgImageOptions, request?: Request): Promise<Response>;",
20986
21807
  "doc": "/**\n * Build a cacheable OG image response. GET and HEAD are supported; conditional requests short-circuit\n * rasterization, so a crawler revalidation never repeats expensive codec work. The ETag still names the\n * bytes a rasterizer produced: a revalidation is answered from the tag this process last sent for the\n * same SVG and rasterizer, and rasterizes only when it has none.\n */"
20987
21808
  },
21809
+ {
21810
+ "name": "onPageHide",
21811
+ "kind": "function",
21812
+ "package": "@nifrajs/web",
21813
+ "signature": "export declare function onPageHide(el: Element, callback: () => void): () => void;",
21814
+ "doc": "/**\n * Run `callback` each time the `keepAlive` page `el` renders in is hidden behind another page, just\n * before it leaves the document. An island in a kept page stays mounted, and its timers and window\n * listeners keep running, while the page is hidden: pause them here. Returns its removal - hand it back\n * as part of the enhancer's cleanup. Never runs outside a kept page.\n *\n * const clock = defineIsland((el) => {\n * let timer = setInterval(tick, 1000)\n * const hide = onPageHide(el, () => clearInterval(timer))\n * const show = onPageShow(el, () => { timer = setInterval(tick, 1000) })\n * return () => { hide(); show(); clearInterval(timer) }\n * })\n */"
21815
+ },
21816
+ {
21817
+ "name": "onPageHide",
21818
+ "kind": "function",
21819
+ "package": "@nifrajs/web-preact",
21820
+ "signature": "export declare function onPageHide(callback: () => void): void;",
21821
+ "doc": "/**\n * Run `callback` each time the `keepAlive` page this component renders in is hidden behind another\n * page, before it leaves the document. The page keeps running while it is hidden: pause its timers,\n * sockets and media here. A hook: call it unconditionally while rendering. A no-op outside a kept page.\n */"
21822
+ },
21823
+ {
21824
+ "name": "onPageHide",
21825
+ "kind": "function",
21826
+ "package": "@nifrajs/web-solid",
21827
+ "signature": "export declare function onPageHide(callback: () => void): void;",
21828
+ "doc": "/**\n * Run `callback` each time the `keepAlive` page this component renders in is hidden behind another\n * page, before it leaves the document. The page keeps running while it is hidden: pause its timers,\n * sockets and media here. Call it while the component sets up; it is removed with the component. A\n * no-op outside a kept page.\n */"
21829
+ },
21830
+ {
21831
+ "name": "onPageHide",
21832
+ "kind": "function",
21833
+ "package": "@nifrajs/web-svelte",
21834
+ "signature": "export declare function onPageHide(callback: () => void): () => void;",
21835
+ "doc": "/**\n * Run `callback` each time the `keepAlive` page this component renders in is hidden behind another\n * page. The page keeps running while it is hidden: pause its timers, sockets and media here. Call it\n * while the component initializes; returns its removal. A no-op outside a kept page.\n */"
21836
+ },
21837
+ {
21838
+ "name": "onPageHide",
21839
+ "kind": "function",
21840
+ "package": "@nifrajs/web-vue",
21841
+ "signature": "export declare function onPageHide(callback: () => void): void;",
21842
+ "doc": "/**\n * Run `callback` each time the `keepAlive` page this component renders in is hidden behind another\n * page, before it leaves the document (Vue's `onDeactivated` runs after). The page keeps running while\n * it is hidden: pause its timers, sockets and media here. Call it in `setup`; it is removed with the\n * component. A no-op outside a kept page.\n */"
21843
+ },
21844
+ {
21845
+ "name": "onPageShow",
21846
+ "kind": "function",
21847
+ "package": "@nifrajs/web",
21848
+ "signature": "export declare function onPageShow(el: Element, callback: () => void): () => void;",
21849
+ "doc": "/** Run `callback` each time the `keepAlive` page `el` renders in is shown again; returns its removal. */"
21850
+ },
21851
+ {
21852
+ "name": "onPageShow",
21853
+ "kind": "function",
21854
+ "package": "@nifrajs/web-preact",
21855
+ "signature": "export declare function onPageShow(callback: () => void): void;",
21856
+ "doc": "/** Run `callback` each time the `keepAlive` page this component renders in is shown again. A hook. */"
21857
+ },
21858
+ {
21859
+ "name": "onPageShow",
21860
+ "kind": "function",
21861
+ "package": "@nifrajs/web-solid",
21862
+ "signature": "export declare function onPageShow(callback: () => void): void;",
21863
+ "doc": "/** Run `callback` each time the `keepAlive` page this component renders in is shown again. */"
21864
+ },
21865
+ {
21866
+ "name": "onPageShow",
21867
+ "kind": "function",
21868
+ "package": "@nifrajs/web-svelte",
21869
+ "signature": "export declare function onPageShow(callback: () => void): () => void;",
21870
+ "doc": "/** Run `callback` each time the `keepAlive` page this component renders in is shown again. */"
21871
+ },
21872
+ {
21873
+ "name": "onPageShow",
21874
+ "kind": "function",
21875
+ "package": "@nifrajs/web-vue",
21876
+ "signature": "export declare function onPageShow(callback: () => void): void;",
21877
+ "doc": "/**\n * Run `callback` each time the `keepAlive` page this component renders in is shown again, once it is\n * back in the document with its scroll and focus. Unlike Vue's `onActivated`, not when it first mounts.\n */"
21878
+ },
20988
21879
  {
20989
21880
  "name": "openGraph",
20990
21881
  "kind": "function",
@@ -21144,6 +22035,13 @@
21144
22035
  "signature": "export declare function parseComponentHTML(html: string, context: Element, trustedHTML?: NativeRangeOptions[\"trustedHTML\"]): DocumentFragment;",
21145
22036
  "doc": "/** Parse inertly and reject executable content before it can reach a live document. */"
21146
22037
  },
22038
+ {
22039
+ "name": "parseComponentRecord",
22040
+ "kind": "function",
22041
+ "package": "@nifrajs/web",
22042
+ "signature": "export declare function parseComponentRecord(value: unknown): ComponentRecord;",
22043
+ "doc": "/** A record that arrives alone, as a partially prerendered hole's does, checked as a state's are. */"
22044
+ },
21147
22045
  {
21148
22046
  "name": "parseComponentState",
21149
22047
  "kind": "function",
@@ -21459,6 +22357,13 @@
21459
22357
  "signature": "export declare function parseZoneConfig(value: unknown, source: string): ZoneConfig;",
21460
22358
  "doc": "/**\n * Validate a `zones` setting. `source` names where it came from in the error. Folders and files are\n * plain app-relative paths (a trailing `/**` is accepted and dropped); any other glob is refused, so\n * a pattern can never match less than its author meant without saying so. One path under two sides\n * is refused; a path nested in another's folder is not, since the most specific one decides.\n */"
21461
22359
  },
22360
+ {
22361
+ "name": "partialPrerendering",
22362
+ "kind": "function",
22363
+ "package": "@nifrajs/web",
22364
+ "signature": "export declare function partialPrerendering(config: PprConfig): PprSetup;",
22365
+ "doc": "/**\n * Experimental: partial prerendering for `createWebApp({ experimental: { ppr } })`. Options are\n * checked here, at startup; each app the value is given to gets its own shell cache.\n */"
22366
+ },
21462
22367
  {
21463
22368
  "name": "pathTag",
21464
22369
  "kind": "function",
@@ -21581,6 +22486,13 @@
21581
22486
  "signature": "export declare function poweredBy(options?: PoweredByOptions): Middleware;",
21582
22487
  "doc": "/**\n * Opt-in `X-Powered-By` style header. Nifra does not emit this by default; use it only when you want a\n * public framework/product marker.\n */"
21583
22488
  },
22489
+ {
22490
+ "name": "pprShells",
22491
+ "kind": "function",
22492
+ "package": "@nifrajs/web",
22493
+ "signature": "export declare function pprShells(app: object): PprShells;",
22494
+ "doc": "/**\n * The shell cache of an app made with `experimental.ppr`. Pass it in `createInvalidator`'s\n * `dataCaches` so a purge by tag also drops the shells built from the purged data.\n */"
22495
+ },
21584
22496
  {
21585
22497
  "name": "preRouteMountPaths",
21586
22498
  "kind": "function",
@@ -22027,6 +22939,12 @@
22027
22939
  "signature": "export declare function redirect(location: string, options?: RedirectOptions): ResponseResult;",
22028
22940
  "doc": "/**\n * Build a redirect - return it from a route `action` for the Post/Redirect/Get pattern (POST\n * mutates, 303 sends the browser to a fresh GET, so a reload doesn't re-submit). Defaults to 303\n * (See Other); pass `{ status: 307 }` or `{ status: 308 }` to preserve the method.\n *\n * **Secure by default:** `location` must be a same-origin path (begins with `/`, not `//`). An\n * off-origin/absolute destination throws unless you pass `{ external: true }` - this closes the\n * open-redirect footgun of `return redirect(formData.get(\"next\"))` on the no-JS (native-form) path,\n * which serves the action's control-flow value verbatim.\n *\n * Returns a plain render, not a `Response`. A redirect is a status line and one header - the most\n * body-less response there is - and building a `Response` for it costs the whole Web object plus, on\n * Node, a stream drained back out. As data it renders on the same lane a handler's return takes.\n * `redirect(...)` is still returned or thrown from exactly the same places; only `.status` /\n * `.headers` are gone from the value, replaced by `options.headers` and the request's `c.set`.\n *\n * @param options redirect status, extra headers, and whether an off-origin destination is intentional.\n */"
22029
22941
  },
22942
+ {
22943
+ "name": "redisLiveBus",
22944
+ "kind": "function",
22945
+ "package": "@nifrajs/web",
22946
+ "signature": "export declare function redisLiveBus(options: RedisLiveBusOptions): LiveBus;"
22947
+ },
22030
22948
  {
22031
22949
  "name": "referenceFaultProfile",
22032
22950
  "kind": "const",
@@ -22080,8 +22998,8 @@
22080
22998
  "name": "reflectSchema",
22081
22999
  "kind": "function",
22082
23000
  "package": "@nifrajs/core",
22083
- "signature": "export declare function reflectSchema(value: unknown): SchemaReflection;",
22084
- "doc": "/**\n * Reflect a Standard Schema, Nifra/TypeBox schema carrier, or raw JSON Schema. Never throws.\n * Validation-only schemas have `standard` but no `jsonSchema`; raw JSON Schema has the reverse.\n */"
23001
+ "signature": "export declare function reflectSchema(value: unknown, side?: SchemaSide): SchemaReflection;",
23002
+ "doc": "/**\n * Reflect a Standard Schema, Nifra/TypeBox schema carrier, or raw JSON Schema. Never throws.\n * Validation-only schemas have `standard` but no `jsonSchema`; raw JSON Schema has the reverse.\n * A Standard JSON Schema is read on `side`, since a default or a transform makes the two differ.\n */"
22085
23003
  },
22086
23004
  {
22087
23005
  "name": "reflectedRoutesFromEvidence",
@@ -22150,6 +23068,13 @@
22150
23068
  "package": "nifra",
22151
23069
  "signature": "export declare function rejected(reason?: AuthenticationFailureReason, response?: Response | ResponseResult): AuthenticationFailure;"
22152
23070
  },
23071
+ {
23072
+ "name": "rememberView",
23073
+ "kind": "function",
23074
+ "package": "@nifrajs/web",
23075
+ "signature": "export declare function rememberView(elements: readonly Element[]): PageView;",
23076
+ "doc": "/**\n * Note the inner scroll offsets of a page's top-level `elements` and the element inside them that has\n * focus, while they are still laid out. For an adapter whose framework takes a hidden page out of the\n * document itself (Vue's `KeepAlive`), in place of {@link createSlotParking}.\n */"
23077
+ },
22153
23078
  {
22154
23079
  "name": "removeDevServerRecord",
22155
23080
  "kind": "function",
@@ -22217,6 +23142,13 @@
22217
23142
  "package": "@nifrajs/cli",
22218
23143
  "signature": "export declare function renderWorkGraphText(result: ProjectWorkGraphResult): string;"
22219
23144
  },
23145
+ {
23146
+ "name": "repeatedPrefixOf",
23147
+ "kind": "const",
23148
+ "package": "@nifrajs/core",
23149
+ "signature": "export declare const repeatedPrefixOf: (chunk: Uint8Array) => RepeatedPrefix | undefined;",
23150
+ "doc": "/** The repeated prefix {@link markRepeatedPrefix} recorded for `chunk`, if any. */"
23151
+ },
22220
23152
  {
22221
23153
  "name": "replacedRequestOf",
22222
23154
  "kind": "function",
@@ -22305,7 +23237,7 @@
22305
23237
  "kind": "function",
22306
23238
  "package": "@nifrajs/auth",
22307
23239
  "signature": "export declare function requireSession<Data extends Record<string, unknown>>(session: Session<Data>, options?: GuardOptions): Session<Data>;",
22308
- "doc": "/**\n * Require a non-empty session. Returns it when present; otherwise throws a `status(...)` render\n * (302/401) - control flow, not a `Response`; see the module docs above. Use at\n * the top of a protected loader:\n * `const session = requireSession(await sessions.get(c), { redirectTo: \"/login\" })`.\n */"
23240
+ "doc": "/**\n * Require a non-empty session. Returns it when present; otherwise throws a `status(...)` render\n * (302/401) - control flow, not a `Response`; see the module docs above. Use at\n * the top of a protected loader:\n * `const session = requireSession(await sessions.get(c), { redirectTo: \"/login\" })`.\n *\n * Non-empty is not signed in: a session that holds anything (a cart, a return path, CSRF state)\n * passes. Guard a page for signed-in visitors with {@link requireUser} and the key a login sets.\n */"
22309
23241
  },
22310
23242
  {
22311
23243
  "name": "requireSession",
@@ -22415,8 +23347,8 @@
22415
23347
  "name": "resource",
22416
23348
  "kind": "function",
22417
23349
  "package": "@nifrajs/web",
22418
- "signature": "export declare function resource<T>(fetcher: (signal: AbortSignal) => Promise<T>, deps?: readonly Readable<unknown>[]): Resource<T>;",
22419
- "doc": "/**\n * An async derived cell. `resource(fetcher, [deps])` runs `fetcher` immediately and again whenever a\n * declared dependency changes, exposing the result as an explicit `{ status, value, error }`.\n *\n * Two footguns are handled here so they cannot be got wrong by hand:\n * - Races: each run holds a generation; a stale run's resolution is dropped, and its `AbortSignal` is\n * aborted, so an earlier-started-later-finishing fetch never overwrites a newer one.\n * - Deps: like `computed`, dependencies are DECLARED (`NF-C023` checks the fetcher's `.get()` reads\n * against the array). A `resource` that reads a signal its deps omit won't refetch when it changes.\n */"
23350
+ "signature": "export declare function resource<K, T>(source: () => K, fetcher: (key: K, abort: AbortSignal) => Promise<T>): Resource<T>;",
23351
+ "doc": "/**\n * An async value keyed by `source`. `source` runs tracked, so a write to any signal it reads starts a\n * new fetch; `fetcher` runs untracked with that key, so nothing it reads (before or after an `await`)\n * is a dependency. A newer fetch aborts the older one and only the newest result lands. Inside an\n * island, unmounting disposes it: the request in flight is aborted and its late result dropped.\n */"
22420
23352
  },
22421
23353
  {
22422
23354
  "name": "respondGraphql",
@@ -22497,7 +23429,7 @@
22497
23429
  "name": "revalidate",
22498
23430
  "kind": "function",
22499
23431
  "package": "@nifrajs/web",
22500
- "signature": "export declare function revalidate<T>(paths: readonly string[], data: T): RevalidateResult<T>;",
23432
+ "signature": "export declare function revalidate<T>(paths: readonly string[], data: T, options?: RevalidateOptions): RevalidateResult<T>;",
22501
23433
  "doc": "/**\n * Return this from an action to declare which routes the mutation changed (alongside the action's\n * `data`). `createWebApp` sets the `X-Nifra-Revalidate` response header; after the submit the client\n * marks those cached routes stale - refetching the active one and any mounted fetcher showing them -\n * so a mutation can refresh views beyond the one that was submitted. `data` is still surfaced to the\n * component as `actionData` (the wrapper is transparent to `ActionData<typeof action>`).\n */"
22502
23434
  },
22503
23435
  {
@@ -22576,6 +23508,13 @@
22576
23508
  "signature": "export declare function robots(options: RobotsOptions): string;",
22577
23509
  "doc": "/** Build a `robots.txt` body from grouped rules plus optional `Sitemap:`/`Host:` lines. */"
22578
23510
  },
23511
+ {
23512
+ "name": "rotateIdentityEpoch",
23513
+ "kind": "function",
23514
+ "package": "@nifrajs/web",
23515
+ "signature": "export declare function rotateIdentityEpoch(c: IdentityEpochContext): void;",
23516
+ "doc": "/**\n * Rotate the identity epoch from a flow that changes who is signed in without changing a cookie\n * `createWebApp` watches - say, a session kept server-side under a cookie whose value stays the\n * same. Every tab then drops the pages it kept alive for the previous visitor.\n */"
23517
+ },
22579
23518
  {
22580
23519
  "name": "routeClassification",
22581
23520
  "kind": "function",
@@ -22777,6 +23716,20 @@
22777
23716
  "package": "@nifrajs/core",
22778
23717
  "signature": "export declare function runSagaReconciliationWorker(store: SagaStore, options: SpecializedWorkerOptions<SagaReconciliationFinding>): Promise<ReconciliationWorkerResult>;"
22779
23718
  },
23719
+ {
23720
+ "name": "runStdioTransport",
23721
+ "kind": "function",
23722
+ "package": "@nifrajs/mcp",
23723
+ "signature": "export declare function runStdioTransport(options: StdioTransportOptions): Promise<void>;",
23724
+ "doc": "/**\n * Read newline-delimited JSON-RPC messages from `input` until it ends, dispatching each, then wait for\n * every dispatched request to settle. Resolves once all responses are written.\n *\n * A line over the cap is answered with one `-32600` error and skipped up to its newline without being\n * buffered; invalid UTF-8 and invalid JSON are answered with `-32700`. A final line without a newline\n * is processed at end of input.\n */"
23725
+ },
23726
+ {
23727
+ "name": "runToolCli",
23728
+ "kind": "function",
23729
+ "package": "@nifrajs/core",
23730
+ "signature": "export declare function runToolCli(tools: readonly CliToolContract[], argv: readonly string[], options: ToolCliOptions): Promise<number>;",
23731
+ "doc": "/**\n * Run one command line against `tools`. Resolves to the exit code; it never throws for anything a\n * user typed. `argv` excludes the runtime and script (`process.argv.slice(2)`).\n */"
23732
+ },
22780
23733
  {
22781
23734
  "name": "runToolContractConformance",
22782
23735
  "kind": "function",
@@ -22830,6 +23783,13 @@
22830
23783
  "signature": "export declare const sanitizedHtml: typeof sanitizeHtml;",
22831
23784
  "doc": "/** Explicit sanitized-content vocabulary for callers and security audits. */"
22832
23785
  },
23786
+ {
23787
+ "name": "scaffold",
23788
+ "kind": "function",
23789
+ "package": "create-nifra",
23790
+ "signature": "export declare function scaffold(opts: ScaffoldOptions): Promise<ScaffoldResult>;",
23791
+ "doc": "/**\n * Copy a template into `target` and finalize it (gitignore rename, package name, the site's deploy target).\n * Throws on: unknown template, `--target`/`--docker` with a non-site template, unknown deploy target, or\n * an existing destination. Pure enough to unit-test (no argv, no process.exit).\n */"
23792
+ },
22833
23793
  {
22834
23794
  "name": "scanForSecrets",
22835
23795
  "kind": "function",
@@ -23003,6 +23963,13 @@
23003
23963
  "signature": "export declare function servePublicDir(options: ServePublicDirOptions): (request: Request) => Promise<Response | undefined>;",
23004
23964
  "doc": "/**\n * Build a static-file handler for `dir`.\n *\n * Returns `undefined` on any miss so the caller **falls through to routing** - a static probe must\n * never shadow a route. That ordering is also why a `routes/robots.txt.tsx` beats a\n * `public/robots.txt` only if the caller checks routes first; the documented precedence is that the\n * static probe runs first, so `public/` wins, and an app wanting the route should not ship both.\n *\n * Files up to 256 KiB carry a strong `ETag` from the exact snapshot served, matching the Node and\n * Deno readers. Those snapshots carry `Last-Modified` only while mtime reflects their own last change.\n * Larger files stream without an `ETag`: an open inode can change after a separate hash pass. They\n * are dated once settled, but an `If-Range` request gets the whole file rather than spliced versions.\n */"
23005
23965
  },
23966
+ {
23967
+ "name": "serveStdio",
23968
+ "kind": "function",
23969
+ "package": "@nifrajs/mcp",
23970
+ "signature": "export declare function serveStdio(server: McpServer, options?: ServeStdioOptions): Promise<void>;",
23971
+ "doc": "/**\n * Serve `server`'s tools, resources and prompts over stdio until the input ends. One process is one\n * session: request cancellation (`notifications/cancelled`) and progress notifications work as they\n * do over HTTP.\n */"
23972
+ },
23006
23973
  {
23007
23974
  "name": "serveTestApp",
23008
23975
  "kind": "function",
@@ -23082,7 +24049,14 @@
23082
24049
  "kind": "function",
23083
24050
  "package": "@nifrajs/web",
23084
24051
  "signature": "export declare function serverFunctions(namespace: string, module: ServerFnModule): IdentityPlugin;",
23085
- "doc": "/**\n * Mount a module's server functions under `namespace`, returning a plugin for `app.use(...)`.\n *\n * import * as todos from \"./actions/todos.fn\"\n * app.use(serverFunctions(\"todos\", todos)) // -> POST /_nifra/fn/todos/addTodo\n *\n * The namespace is explicit rather than derived from the file path: a path-derived one would put the\n * build machine's layout in a public URL, and this keeps the route readable in logs and greppable in\n * the codebase. Phase 2's transform supplies it automatically from the file's location in the project.\n *\n * Exports that are not server functions are ignored, so `export type` and helpers can live alongside.\n */"
24052
+ "doc": "/**\n * Mount a module's server functions under `namespace`, returning a plugin for `app.use(...)`.\n *\n * import * as todos from \"./actions/todos.fn\"\n * app.use(serverFunctions(\"todos\", todos)) // -> POST /_nifra/fn/todos/addTodo\n *\n * The namespace is explicit rather than derived from the file path: a path-derived one would put the\n * build machine's layout in a public URL, and this keeps the route readable in logs and greppable in\n * the codebase. The client build's stubs call the namespace named by the module's file (`todos.fn.ts`\n * calls `todos`), so pass that same word here.\n *\n * Exports that are not server functions are ignored, so `export type` and helpers can live alongside.\n */"
24053
+ },
24054
+ {
24055
+ "name": "serverHole",
24056
+ "kind": "function",
24057
+ "package": "@nifrajs/web",
24058
+ "signature": "export declare function serverHole<Input, Props, View>(component: ServerComponent<Input, Props, View>): (data: Input) => never;",
24059
+ "doc": "/**\n * A `dynamic` hole's `render`: the hole shows `component`, given the hole loader's output as its\n * input. The page's app lists the component under `createServerComponents({ holes })` for the route.\n * The hole cannot be `interactive`; its client islands are.\n */"
23086
24060
  },
23087
24061
  {
23088
24062
  "name": "serviceWorkerRegistration",
@@ -23102,8 +24076,8 @@
23102
24076
  "name": "setBrowserNavigate",
23103
24077
  "kind": "function",
23104
24078
  "package": "@nifrajs/web",
23105
- "signature": "export declare function setBrowserNavigate(navigate: BrowserNavigate | undefined, router?: ClientRouter): void;",
23106
- "doc": "/** Register (or clear, with `undefined`) the browser navigate and its router - called by\n * `installHistory`. Not for app use. */"
24079
+ "signature": "export declare function setBrowserNavigate(navigate: BrowserNavigate | undefined, router?: ClientRouter, close?: (name: string) => void): void;",
24080
+ "doc": "/** Register (or clear, with `undefined`) the browser navigate, its router and its boundary close -\n * called by `installHistory`. Not for app use. */"
23107
24081
  },
23108
24082
  {
23109
24083
  "name": "setMountedRouter",
@@ -23237,19 +24211,12 @@
23237
24211
  "signature": "export declare function signValue(value: string, secret: CookieSecret): Promise<string>;",
23238
24212
  "doc": "/** Append an HMAC-SHA256 signature to a value → `value.signature` (base64url). For signed cookies.\n * With a {@link CookieSecret} rotation list, signs with the first secret. */"
23239
24213
  },
23240
- {
23241
- "name": "signal",
23242
- "kind": "function",
23243
- "package": "@nifrajs/islets",
23244
- "signature": "export declare function signal<T>(initial: T): Signal<T>;",
23245
- "doc": "/** Create a signal. Reads inside an {@link effect} (or {@link computed}) subscribe automatically. */"
23246
- },
23247
24214
  {
23248
24215
  "name": "signal",
23249
24216
  "kind": "function",
23250
24217
  "package": "@nifrajs/web",
23251
24218
  "signature": "export declare function signal<T>(initial: T): Signal<T>;",
23252
- "doc": "/** A current-value cell. `signal(0)` -> `.get()` reads, `.set(1)` writes and notifies. */"
24219
+ "doc": "/** Create a signal. Reads inside an {@link effect} (or {@link computed}) subscribe automatically. */"
23253
24220
  },
23254
24221
  {
23255
24222
  "name": "signalHydrated",
@@ -23293,6 +24260,20 @@
23293
24260
  "signature": "export declare function sitemap(entries: readonly SitemapEntry[], options?: SitemapOptions): string;",
23294
24261
  "doc": "/** Build a `<urlset>` sitemap XML document from `entries`. Throws on out-of-spec input (dev-time data). */"
23295
24262
  },
24263
+ {
24264
+ "name": "slot",
24265
+ "kind": "function",
24266
+ "package": "@nifrajs/web-vanilla",
24267
+ "signature": "export declare function slot(name: string, content: HtmlValue): Template;",
24268
+ "doc": "/**\n * A region of the page that a `data-swap` link or form refreshes on its own. Place it as the only\n * content of the element marked `data-swap-slot=\"<name>\"`:\n *\n * html`<ul data-swap-slot=\"results\">${slot(\"results\", rows)}</ul>`\n *\n * It renders `content` unchanged. When the server answers a swap request for `name`, the page runs\n * as usual and the response is this slot's HTML alone, so the fragment is always a slice of the\n * real page and cannot drift from it.\n */"
24269
+ },
24270
+ {
24271
+ "name": "slotTree",
24272
+ "kind": "function",
24273
+ "package": "@nifrajs/web",
24274
+ "signature": "export declare function slotTree(state: RouterState, chains: Readonly<Record<string, MatchChain | undefined>>, table: KeepAliveTable, previous?: readonly SlotNode[]): readonly SlotNode[];",
24275
+ "doc": "/**\n * The view of `state`: the page on screen and every kept page, grouped by the layouts they share. A\n * layout every page under it shares renders once; where two chains part, each part is a slot. Pass\n * the previous tree to keep the identity of every node that did not change.\n */"
24276
+ },
23296
24277
  {
23297
24278
  "name": "snapshotCapabilities",
23298
24279
  "kind": "function",
@@ -24037,6 +25018,13 @@
24037
25018
  "signature": "export declare function typedSSEStream<Event>(stream: SSEStream): TypedSSEStream<Event>;",
24038
25019
  "doc": "/** Wrap a raw {@link SSEStream} in the typed, JSON-serializing surface `app.sse()` hands out. */"
24039
25020
  },
25021
+ {
25022
+ "name": "ui",
25023
+ "kind": "function",
25024
+ "package": "@nifrajs/web-svelte",
25025
+ "signature": "export declare function ui<Props extends Record<string, unknown>>(component: Component<Props>, ...props: Record<string, never> extends Props ? [props?: Props] : [props: Props]): SvelteUI;",
25026
+ "doc": "/** Experimental: `component` rendered with `props`, for a partially prerendered hole. */"
25027
+ },
24040
25028
  {
24041
25029
  "name": "uiResourceMeta",
24042
25030
  "kind": "function",
@@ -24056,7 +25044,7 @@
24056
25044
  "kind": "function",
24057
25045
  "package": "@nifrajs/mcp-db",
24058
25046
  "signature": "export declare function unexposedPlanRelation(planRows: readonly {\n readonly detail?: unknown;\n}[], exposed: (relation: string) => boolean): string | undefined;",
24059
- "doc": "/**\n * The first relation an `EXPLAIN QUERY PLAN` result scans or searches that `exposed` rejects, as the\n * plan spells it, or `undefined` when every scanned relation is exposed.\n */"
25047
+ "doc": "/**\n * The first relation an `EXPLAIN QUERY PLAN` result scans or searches that `exposed` rejects, as the\n * plan spells it, or `undefined` when every scanned relation is exposed. The plan names a scan by its\n * alias (`FROM habits h` plans as `SCAN h`, `users AS habits` as `SCAN habits`), so it cannot decide\n * on its own which tables a statement reads: the compiled program names them by root page.\n */"
24060
25048
  },
24061
25049
  {
24062
25050
  "name": "unsafeInlineScript",
@@ -24079,6 +25067,13 @@
24079
25067
  "signature": "export declare function unsignValue(signed: string, secret: CookieSecret): Promise<string | null>;",
24080
25068
  "doc": "/**\n * Verify a `value.signature` produced by {@link signValue} and return the value, or `null` if the\n * signature is missing, malformed, or doesn't match. Verification is **constant-time**\n * (`crypto.subtle.verify`), so a wrong signature can't be discovered byte-by-byte via timing.\n *\n * With a {@link CookieSecret} rotation list, tries each secret in order and accepts the first\n * match. Every listed secret must meet the 32-byte floor - a weak entry throws even when an\n * earlier secret would have matched, so a rotation list can't quietly carry a weak key. (Which\n * rotation generation matched is not attacker-meaningful, so the early exit between secrets leaks\n * nothing useful; each individual comparison stays constant-time.)\n */"
24081
25069
  },
25070
+ {
25071
+ "name": "untrack",
25072
+ "kind": "function",
25073
+ "package": "@nifrajs/web",
25074
+ "signature": "export declare function untrack<T>(fn: () => T): T;",
25075
+ "doc": "/** Run `fn` without subscribing the running effect or computed to the signals it reads. */"
25076
+ },
24082
25077
  {
24083
25078
  "name": "url",
24084
25079
  "kind": "function",
@@ -24110,7 +25105,7 @@
24110
25105
  "kind": "function",
24111
25106
  "package": "@nifrajs/web-preact",
24112
25107
  "signature": "export declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;",
24113
- "doc": "/**\n * Guard navigation away from a page with unsaved work, confirming with your OWN async UI. Mirrors\n * react-router's `useBlocker`: pass a boolean (`useBlocker(isDirty)`) or a predicate\n * `({ currentLocation, nextLocation }) => boolean`, and get back a {@link Blocker}. When a navigation\n * (an anchor click, `useNavigate`, or a browser back/forward) is intercepted, `blocker.state` becomes\n * `\"blocked\"` and `proceed`/`reset` go live - render a dialog and call `proceed()` to continue or\n * `reset()` to stay put. It also arms the browser's native \"Leave site?\" prompt on tab close / reload.\n * Idle (never blocks) on the server and before hydration.\n */"
25108
+ "doc": "/**\n * Guard navigation away from a page with unsaved work, confirming with your OWN async UI. Mirrors\n * react-router's `useBlocker`: pass a boolean (`useBlocker(isDirty)`) or a predicate\n * `({ currentLocation, nextLocation }) => boolean`, and get back a {@link Blocker}. When a navigation\n * (an anchor click, `useNavigate`, or a browser back/forward) is intercepted, `blocker.state` becomes\n * `\"blocked\"` and `proceed`/`reset` go live - render a dialog and call `proceed()` to continue or\n * `reset()` to stay put. It also arms the browser's native \"Leave site?\" prompt on tab close / reload.\n * Idle (never blocks) on the server, before hydration, and while a `keepAlive` page is hidden.\n */"
24114
25109
  },
24115
25110
  {
24116
25111
  "name": "useBlocker",
@@ -24124,7 +25119,7 @@
24124
25119
  "kind": "function",
24125
25120
  "package": "@nifrajs/web-solid",
24126
25121
  "signature": "export declare function useBlocker(shouldBlock: boolean | BlockerFunction): Accessor<Blocker>;",
24127
- "doc": "/**\n * Guard navigation away from a page with unsaved work, confirming with your OWN async UI. Mirrors\n * react-router's `useBlocker`: pass a boolean or a `({ currentLocation, nextLocation }) => boolean`\n * predicate, and get back a reactive {@link Blocker} accessor. When a navigation (an anchor click,\n * `useNavigate`, or a browser back/forward) is intercepted, `blocker().state` becomes `\"blocked\"` and\n * `proceed`/`reset` go live - show a dialog and call `proceed()` to continue or `reset()` to stay put.\n * It also arms the browser's native \"Leave site?\" prompt on tab close / reload. Idle on the server and\n * before hydration.\n *\n * The component body runs once, so to track a CHANGING flag pass a function -\n * `useBlocker(() => isDirty())` - not a bare signal accessor's current value. A constant boolean is fine.\n */"
25122
+ "doc": "/**\n * Guard navigation away from a page with unsaved work, confirming with your OWN async UI. Mirrors\n * react-router's `useBlocker`: pass a boolean or a `({ currentLocation, nextLocation }) => boolean`\n * predicate, and get back a reactive {@link Blocker} accessor. When a navigation (an anchor click,\n * `useNavigate`, or a browser back/forward) is intercepted, `blocker().state` becomes `\"blocked\"` and\n * `proceed`/`reset` go live - show a dialog and call `proceed()` to continue or `reset()` to stay put.\n * It also arms the browser's native \"Leave site?\" prompt on tab close / reload. Idle on the server,\n * before hydration, and while a `keepAlive` page is hidden.\n *\n * The component body runs once, so to track a CHANGING flag pass a function -\n * `useBlocker(() => isDirty())` - not a bare signal accessor's current value. A constant boolean is fine.\n */"
24128
25123
  },
24129
25124
  {
24130
25125
  "name": "useBlocker",
@@ -24138,7 +25133,7 @@
24138
25133
  "kind": "function",
24139
25134
  "package": "@nifrajs/web-vue",
24140
25135
  "signature": "export declare function useBlocker(shouldBlock: boolean | BlockerFunction): Readonly<ShallowRef<Blocker>>;",
24141
- "doc": "/**\n * Guard navigation away from a page with unsaved work, confirming with your OWN async UI. Mirrors\n * react-router's `useBlocker`: pass a boolean or a `({ currentLocation, nextLocation }) => boolean`\n * predicate, and get back a reactive {@link Blocker} ref. When a navigation (an anchor click,\n * `useNavigate`, or a browser back/forward) is intercepted, `blocker.value.state` becomes `\"blocked\"`\n * and `proceed`/`reset` go live - render a dialog and call `proceed()` to continue or `reset()` to stay.\n * It also arms the browser's native \"Leave site?\" prompt on tab close / reload. Idle on the server and\n * before hydration.\n *\n * `setup` runs once, so to track a CHANGING flag pass a function - `useBlocker(() => form.isDirty)` -\n * not a bare `ref` (which would be truthy and always block). A constant boolean is fine as-is.\n */"
25136
+ "doc": "/**\n * Guard navigation away from a page with unsaved work, confirming with your OWN async UI. Mirrors\n * react-router's `useBlocker`: pass a boolean or a `({ currentLocation, nextLocation }) => boolean`\n * predicate, and get back a reactive {@link Blocker} ref. When a navigation (an anchor click,\n * `useNavigate`, or a browser back/forward) is intercepted, `blocker.value.state` becomes `\"blocked\"`\n * and `proceed`/`reset` go live - render a dialog and call `proceed()` to continue or `reset()` to stay.\n * It also arms the browser's native \"Leave site?\" prompt on tab close / reload. Idle on the server,\n * before hydration, and while a `keepAlive` page is hidden.\n *\n * `setup` runs once, so to track a CHANGING flag pass a function - `useBlocker(() => form.isDirty)` -\n * not a bare `ref` (which would be truthy and always block). A constant boolean is fine as-is.\n */"
24142
25137
  },
24143
25138
  {
24144
25139
  "name": "useCapability",
@@ -24350,6 +25345,41 @@
24350
25345
  "signature": "export declare function useNavigation(): Navigation;",
24351
25346
  "doc": "/**\n * Observe client navigation to drive loading UI (a top-bar spinner, dimmed content, a skeleton). nifra\n * navigates imperatively - it fetches the next route's chunk + loader data while the current route stays\n * on screen, then swaps - so `pending` is the signal for \"a transition is in flight,\" not a Suspense\n * boundary. Always `{ pending: false, state: \"idle\" }` on the server (loaders block before render), so\n * it is hydration-safe.\n *\n * ```tsx\n * const { pending } = useNavigation()\n * return <div className={pending ? \"opacity-60\" : \"\"}>{pending && <TopBarSpinner />}<Outlet /></div>\n * ```\n */"
24352
25347
  },
25348
+ {
25349
+ "name": "usePageVisibility",
25350
+ "kind": "function",
25351
+ "package": "@nifrajs/web-preact",
25352
+ "signature": "export declare function usePageVisibility(): boolean;",
25353
+ "doc": "/**\n * Whether the page this component renders in is on screen. `false` while it is kept hidden behind\n * another page, where its effects keep running: pause timers and listeners on it. Always `true` on the\n * server and on a page that does not keep alive.\n */"
25354
+ },
25355
+ {
25356
+ "name": "usePageVisibility",
25357
+ "kind": "function",
25358
+ "package": "@nifrajs/web-react",
25359
+ "signature": "export declare function usePageVisibility(): boolean;",
25360
+ "doc": "/**\n * Whether the page this component renders in is on screen. `false` while it is kept hidden behind\n * another page; its effects have cleaned up by then (`Activity`), and run again when it is shown.\n * Always `true` on the server and on a page that does not keep alive.\n */"
25361
+ },
25362
+ {
25363
+ "name": "usePageVisibility",
25364
+ "kind": "function",
25365
+ "package": "@nifrajs/web-solid",
25366
+ "signature": "export declare function usePageVisibility(): Accessor<boolean>;",
25367
+ "doc": "/**\n * Whether the page this component renders in is on screen, as an accessor: `false` while it is kept\n * hidden behind another page, where it keeps running. Always `true` on the server and on a page that\n * does not keep alive.\n */"
25368
+ },
25369
+ {
25370
+ "name": "usePageVisibility",
25371
+ "kind": "function",
25372
+ "package": "@nifrajs/web-svelte",
25373
+ "signature": "export declare function usePageVisibility(): () => boolean;",
25374
+ "doc": "/**\n * Whether the page this component renders in is on screen, as a getter: `false` while it is kept hidden\n * behind another page, where it keeps running. Always `true` on the server and on a page that does not\n * keep alive. Call it while the component initializes; read it in markup or a `$derived`.\n */"
25375
+ },
25376
+ {
25377
+ "name": "usePageVisibility",
25378
+ "kind": "function",
25379
+ "package": "@nifrajs/web-vue",
25380
+ "signature": "export declare function usePageVisibility(): Readonly<Ref<boolean>>;",
25381
+ "doc": "/**\n * Whether the page this component renders in is on screen, as a ref: `false` while it is kept hidden\n * behind another page, where it keeps running. Always `true` on the server and on a page that does not\n * keep alive.\n */"
25382
+ },
24353
25383
  {
24354
25384
  "name": "useParams",
24355
25385
  "kind": "function",
@@ -24368,8 +25398,8 @@
24368
25398
  "name": "useQuery",
24369
25399
  "kind": "function",
24370
25400
  "package": "@nifrajs/web-preact",
24371
- "signature": "export declare function useQuery<T>(key: unknown, fn: () => Promise<T>): UseQueryResult<T>;",
24372
- "doc": "/**\n * Subscribe to the keyed query for `key`, fetched via `fn`. Returns `{ status, data, error, isFetching,\n * updatedAt, isPending, refetch }`. Concurrent `useQuery`s with the same key share one cache entry +\n * one in-flight fetch (dedup). Refetches on mount and when the key changes; SSR-idle.\n */"
25401
+ "signature": "export declare function useQuery<T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions): UseQueryResult<T>;",
25402
+ "doc": "/**\n * Subscribe to the keyed query for `key`, fetched via `fn`. Returns `{ status, data, error, isFetching,\n * updatedAt, isPending, refetch }`. Concurrent `useQuery`s with the same key share one cache entry +\n * one in-flight fetch (dedup). Refetches on mount and when the key changes; SSR-idle. `options.live`\n * names the live keys that refetch it.\n */"
24373
25403
  },
24374
25404
  {
24375
25405
  "name": "useQuery",
@@ -24382,15 +25412,15 @@
24382
25412
  "name": "useQuery",
24383
25413
  "kind": "function",
24384
25414
  "package": "@nifrajs/web-svelte",
24385
- "signature": "export declare function useQuery<T>(key: unknown, fn: () => Promise<T>): QueryStore<T>;",
24386
- "doc": "/**\n * Subscribe to the keyed query for `key`, fetched via `fn`. Returns a store of `{ status, data, error,\n * isFetching, updatedAt }` augmented with `refetch`. Fetches on mount (first `$`-subscription); SSR-idle.\n */"
25415
+ "signature": "export declare function useQuery<T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions): QueryStore<T>;",
25416
+ "doc": "/**\n * Subscribe to the keyed query for `key`, fetched via `fn`. Returns a store of `{ status, data, error,\n * isFetching, updatedAt }` augmented with `refetch`. Fetches on mount (first `$`-subscription); SSR-idle.\n * `options.live` names the live keys that refetch it.\n */"
24387
25417
  },
24388
25418
  {
24389
25419
  "name": "useQuery",
24390
25420
  "kind": "function",
24391
25421
  "package": "@nifrajs/web-vue",
24392
- "signature": "export declare function useQuery<T>(key: unknown, fn: () => Promise<T>): UseQueryResult<T>;",
24393
- "doc": "/**\n * Subscribe to the keyed query for `key`, fetched via `fn`. Returns a reactive `state` ref (`status`,\n * `data`, `error`, `isFetching`, `updatedAt`) + `refetch`. Concurrent `useQuery`s with the same key\n * share one cache entry + one in-flight fetch (dedup). Fetches on mount; SSR-idle.\n */"
25422
+ "signature": "export declare function useQuery<T>(key: unknown, fn: () => Promise<T>, options?: QueryOptions): UseQueryResult<T>;",
25423
+ "doc": "/**\n * Subscribe to the keyed query for `key`, fetched via `fn`. Returns a reactive `state` ref (`status`,\n * `data`, `error`, `isFetching`, `updatedAt`) + `refetch`. Concurrent `useQuery`s with the same key\n * share one cache entry + one in-flight fetch (dedup). Fetches on mount; SSR-idle. `options.live`\n * names the live keys that refetch it.\n */"
24394
25424
  },
24395
25425
  {
24396
25426
  "name": "useQueryClient",