@nifrajs/cli 2.11.0 → 2.12.1

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 (177) hide show
  1. package/README.md +6 -0
  2. package/dist/assure-hydration.d.ts +14 -0
  3. package/dist/assure-hydration.d.ts.map +1 -0
  4. package/dist/assure-hydration.js +483 -0
  5. package/dist/assure-hydration.js.map +1 -0
  6. package/dist/assure.d.ts +35 -0
  7. package/dist/assure.d.ts.map +1 -1
  8. package/dist/assure.js +222 -1
  9. package/dist/assure.js.map +1 -1
  10. package/dist/capabilities-tool.d.ts +13 -0
  11. package/dist/capabilities-tool.d.ts.map +1 -1
  12. package/dist/capabilities-tool.js +64 -1
  13. package/dist/capabilities-tool.js.map +1 -1
  14. package/dist/check.d.ts +125 -10
  15. package/dist/check.d.ts.map +1 -1
  16. package/dist/check.js +706 -145
  17. package/dist/check.js.map +1 -1
  18. package/dist/cli.d.ts +23 -0
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +194 -10
  21. package/dist/cli.js.map +1 -1
  22. package/dist/contract-proof.d.ts +49 -0
  23. package/dist/contract-proof.d.ts.map +1 -0
  24. package/dist/contract-proof.js +128 -0
  25. package/dist/contract-proof.js.map +1 -0
  26. package/dist/contracts.d.ts +22 -0
  27. package/dist/contracts.d.ts.map +1 -0
  28. package/dist/contracts.js +134 -0
  29. package/dist/contracts.js.map +1 -0
  30. package/dist/diagnostics.d.ts +23 -0
  31. package/dist/diagnostics.d.ts.map +1 -0
  32. package/dist/diagnostics.js +9 -0
  33. package/dist/diagnostics.js.map +1 -0
  34. package/dist/diff-tool.d.ts +2 -0
  35. package/dist/diff-tool.d.ts.map +1 -1
  36. package/dist/diff-tool.js +1 -1
  37. package/dist/diff-tool.js.map +1 -1
  38. package/dist/docs-search.d.ts +8 -3
  39. package/dist/docs-search.d.ts.map +1 -1
  40. package/dist/docs-search.js +36 -15
  41. package/dist/docs-search.js.map +1 -1
  42. package/dist/doctor.d.ts +28 -2
  43. package/dist/doctor.d.ts.map +1 -1
  44. package/dist/doctor.js +173 -7
  45. package/dist/doctor.js.map +1 -1
  46. package/dist/examples.d.ts +1 -2
  47. package/dist/examples.d.ts.map +1 -1
  48. package/dist/examples.js +37 -16
  49. package/dist/examples.js.map +1 -1
  50. package/dist/fix-recipes.d.ts +12 -0
  51. package/dist/fix-recipes.d.ts.map +1 -0
  52. package/dist/fix-recipes.js +106 -0
  53. package/dist/fix-recipes.js.map +1 -0
  54. package/dist/init-agents.d.ts.map +1 -1
  55. package/dist/init-agents.js +60 -4
  56. package/dist/init-agents.js.map +1 -1
  57. package/dist/internal/source-facts.d.ts +15 -0
  58. package/dist/internal/source-facts.d.ts.map +1 -0
  59. package/dist/internal/source-facts.js +82 -0
  60. package/dist/internal/source-facts.js.map +1 -0
  61. package/dist/internal/typescript-import.d.ts +9 -0
  62. package/dist/internal/typescript-import.d.ts.map +1 -1
  63. package/dist/internal/typescript-import.js +38 -0
  64. package/dist/internal/typescript-import.js.map +1 -1
  65. package/dist/introspect.d.ts +6 -2
  66. package/dist/introspect.d.ts.map +1 -1
  67. package/dist/introspect.js +53 -4
  68. package/dist/introspect.js.map +1 -1
  69. package/dist/load.d.ts +6 -0
  70. package/dist/load.d.ts.map +1 -1
  71. package/dist/load.js.map +1 -1
  72. package/dist/manifest-tool.d.ts.map +1 -1
  73. package/dist/manifest-tool.js +14 -9
  74. package/dist/manifest-tool.js.map +1 -1
  75. package/dist/mcp-docs-tools.d.ts.map +1 -1
  76. package/dist/mcp-docs-tools.js +3 -0
  77. package/dist/mcp-docs-tools.js.map +1 -1
  78. package/dist/mcp-http.js +1 -1
  79. package/dist/mcp-root.d.ts +83 -0
  80. package/dist/mcp-root.d.ts.map +1 -0
  81. package/dist/mcp-root.js +221 -0
  82. package/dist/mcp-root.js.map +1 -0
  83. package/dist/mcp-run.d.ts.map +1 -1
  84. package/dist/mcp-run.js +18 -4
  85. package/dist/mcp-run.js.map +1 -1
  86. package/dist/mcp.d.ts +27 -4
  87. package/dist/mcp.d.ts.map +1 -1
  88. package/dist/mcp.js +358 -25
  89. package/dist/mcp.js.map +1 -1
  90. package/dist/project-path.d.ts +3 -0
  91. package/dist/project-path.d.ts.map +1 -0
  92. package/dist/project-path.js +36 -0
  93. package/dist/project-path.js.map +1 -0
  94. package/dist/replay.d.ts +12 -0
  95. package/dist/replay.d.ts.map +1 -0
  96. package/dist/replay.js +36 -0
  97. package/dist/replay.js.map +1 -0
  98. package/dist/rules/codes.d.ts +42 -0
  99. package/dist/rules/codes.d.ts.map +1 -0
  100. package/dist/rules/codes.js +52 -0
  101. package/dist/rules/codes.js.map +1 -0
  102. package/dist/rules/comment-markers.d.ts +10 -0
  103. package/dist/rules/comment-markers.d.ts.map +1 -0
  104. package/dist/rules/comment-markers.js +24 -0
  105. package/dist/rules/comment-markers.js.map +1 -0
  106. package/dist/rules/index.d.ts +31 -0
  107. package/dist/rules/index.d.ts.map +1 -0
  108. package/dist/rules/index.js +133 -0
  109. package/dist/rules/index.js.map +1 -0
  110. package/dist/rules/legacy.d.ts +7 -0
  111. package/dist/rules/legacy.d.ts.map +1 -0
  112. package/dist/rules/legacy.js +85 -0
  113. package/dist/rules/legacy.js.map +1 -0
  114. package/dist/rules/routes.d.ts +12 -0
  115. package/dist/rules/routes.d.ts.map +1 -0
  116. package/dist/rules/routes.js +142 -0
  117. package/dist/rules/routes.js.map +1 -0
  118. package/dist/rules/security.d.ts +10 -0
  119. package/dist/rules/security.d.ts.map +1 -0
  120. package/dist/rules/security.js +471 -0
  121. package/dist/rules/security.js.map +1 -0
  122. package/dist/search-terms.d.ts +2 -0
  123. package/dist/search-terms.d.ts.map +1 -1
  124. package/dist/search-terms.js +5 -1
  125. package/dist/search-terms.js.map +1 -1
  126. package/dist/types-search.d.ts +1 -2
  127. package/dist/types-search.d.ts.map +1 -1
  128. package/dist/types-search.js +33 -16
  129. package/dist/types-search.js.map +1 -1
  130. package/dist/verification.d.ts +9 -0
  131. package/dist/verification.d.ts.map +1 -1
  132. package/dist/verification.js +17 -1
  133. package/dist/verification.js.map +1 -1
  134. package/dist/work-graph.d.ts +123 -0
  135. package/dist/work-graph.d.ts.map +1 -0
  136. package/dist/work-graph.js +465 -0
  137. package/dist/work-graph.js.map +1 -0
  138. package/docs/examples.json +32 -2
  139. package/docs/llms-full.txt +906 -15
  140. package/docs/types.json +1682 -130
  141. package/package.json +34 -9
  142. package/src/assure-hydration.ts +606 -0
  143. package/src/assure.ts +316 -2
  144. package/src/capabilities-tool.ts +80 -1
  145. package/src/check.ts +873 -168
  146. package/src/cli.ts +198 -11
  147. package/src/contract-proof.ts +194 -0
  148. package/src/contracts.ts +157 -0
  149. package/src/diagnostics.ts +32 -0
  150. package/src/diff-tool.ts +1 -1
  151. package/src/docs-search.ts +45 -15
  152. package/src/doctor.ts +259 -8
  153. package/src/examples.ts +43 -15
  154. package/src/fix-recipes.ts +126 -0
  155. package/src/init-agents.ts +61 -4
  156. package/src/internal/source-facts.ts +133 -0
  157. package/src/internal/typescript-import.ts +29 -0
  158. package/src/introspect.ts +75 -6
  159. package/src/load.ts +6 -0
  160. package/src/manifest-tool.ts +16 -10
  161. package/src/mcp-docs-tools.ts +3 -0
  162. package/src/mcp-http.ts +1 -1
  163. package/src/mcp-root.ts +271 -0
  164. package/src/mcp-run.ts +19 -4
  165. package/src/mcp.ts +438 -32
  166. package/src/project-path.ts +36 -0
  167. package/src/replay.ts +44 -0
  168. package/src/rules/codes.ts +57 -0
  169. package/src/rules/comment-markers.ts +26 -0
  170. package/src/rules/index.ts +175 -0
  171. package/src/rules/legacy.ts +93 -0
  172. package/src/rules/routes.ts +157 -0
  173. package/src/rules/security.ts +505 -0
  174. package/src/search-terms.ts +9 -4
  175. package/src/types-search.ts +39 -15
  176. package/src/verification.ts +18 -1
  177. package/src/work-graph.ts +613 -0
package/docs/types.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "kind": "const",
12
12
  "package": "@nifrajs/web",
13
13
  "signature": "export declare const ACTION_GLOBAL = \"__NIFRA_ACTION__\";",
14
- "doc": "/** Global the server serializes an action's data return into (absent on GETs); the client\n * reads it so hydration after a native form POST matches the server-rendered markup. */"
14
+ "doc": "/** Global the server serializes an action's data return into (absent on GETs); the client reads it\n * so hydration after a native form POST matches the server-rendered markup. */"
15
15
  },
16
16
  {
17
17
  "name": "ActionArgs",
@@ -142,6 +142,38 @@
142
142
  "package": "@nifrajs/testing",
143
143
  "signature": "export interface AdversarialContractResult {\n readonly id: string;\n readonly route: string;\n readonly runtime: string;\n readonly kind: ContractCaseKind;\n readonly target: ContractTarget;\n readonly mutation?: string;\n readonly ok: boolean;\n readonly status?: number;\n readonly message: string;\n /** Number of successful greedy reductions applied to a failing hostile input. */\n readonly shrinkSteps?: number;\n readonly replay: ContractReplay;\n}"
144
144
  },
145
+ {
146
+ "name": "AgentApprovalPort",
147
+ "kind": "interface",
148
+ "package": "@nifrajs/agent",
149
+ "signature": "export interface AgentApprovalPort {\n request(input: {\n readonly turnId: string;\n readonly effectId: string;\n readonly tool: string;\n readonly capability: string;\n readonly signal: AbortSignal;\n /** Wall-clock budget reserved for this approval hop and the following tool execution. */\n readonly deadline?: RequestBudget;\n }): AgentApprovalResult | PromiseLike<AgentApprovalResult>;\n}"
150
+ },
151
+ {
152
+ "name": "AgentApprovalResult",
153
+ "kind": "type",
154
+ "package": "@nifrajs/agent",
155
+ "signature": "export type AgentApprovalResult = {\n readonly status: \"approved\";\n readonly approval: ToolApproval;\n} | {\n readonly status: \"denied\";\n readonly reason?: string;\n} | {\n readonly status: \"pending\";\n readonly effectId: string;\n};"
156
+ },
157
+ {
158
+ "name": "AgentDefinition",
159
+ "kind": "interface",
160
+ "package": "@nifrajs/agent",
161
+ "signature": "export interface AgentDefinition<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly name: string;\n readonly instruction: string;\n readonly input: InputSchema;\n readonly output: OutputSchema;\n readonly tools: readonly AgentToolContract[];\n /** Dimensionless counters charged once per model decision. */\n readonly modelCost?: EffectCost;\n}"
162
+ },
163
+ {
164
+ "name": "AgentEvidenceStream",
165
+ "kind": "interface",
166
+ "package": "@nifrajs/agent",
167
+ "signature": "export interface AgentEvidenceStream extends AgentTelemetryPort, AsyncIterableIterator<AgentStepEvidence> {\n complete(): void;\n /**\n * How many evidence items the queue discarded because the consumer fell behind. Non-zero means the\n * `seq` sequence has gaps; the turn result still carries the complete, authoritative evidence array.\n */\n readonly dropped: number;\n}",
168
+ "doc": "/**\n * The existing step evidence as an async iterable. No second event vocabulary is introduced.\n *\n * Pass the stream as `ports.telemetry`, consume it with `for await`, and call `complete()` when the\n * runner finishes. The stream keeps queued evidence until it has been consumed, then terminates.\n */"
169
+ },
170
+ {
171
+ "name": "AgentEvidenceStreamOptions",
172
+ "kind": "interface",
173
+ "package": "@nifrajs/agent",
174
+ "signature": "export interface AgentEvidenceStreamOptions {\n /** Maximum number of produced evidence items waiting for a consumer. Default 1024. */\n readonly maxQueueSize?: number;\n}",
175
+ "doc": "/** Options for the lifecycle evidence stream. */"
176
+ },
145
177
  {
146
178
  "name": "AgentFileSpec",
147
179
  "kind": "interface",
@@ -149,6 +181,48 @@
149
181
  "signature": "export interface AgentFileSpec {\n /** Path relative to the project root (POSIX-style; the caller joins onto the cwd). */\n readonly path: string;\n /** A human label for the \"wrote/skipped\" report. */\n readonly label: string;\n}",
150
182
  "doc": "/** Identifies a generated agent-discovery file: where it goes (relative to the project root) and how to\n * produce its content. `merge` is for files that augment an existing one (AGENTS.md) rather than own it. */"
151
183
  },
184
+ {
185
+ "name": "AgentModelPort",
186
+ "kind": "interface",
187
+ "package": "@nifrajs/agent",
188
+ "signature": "export interface AgentModelPort {\n /** Provider output is unknown until the response parser accepts it. */\n complete(request: AgentModelRequest): unknown | PromiseLike<unknown>;\n}"
189
+ },
190
+ {
191
+ "name": "AgentModelRequest",
192
+ "kind": "interface",
193
+ "package": "@nifrajs/agent",
194
+ "signature": "export interface AgentModelRequest {\n readonly agent: string;\n readonly instruction: string;\n readonly input: unknown;\n readonly state: AgentTurnState;\n readonly tools: readonly AgentToolDescriptor[];\n readonly toolResult?: AgentToolResult;\n readonly previousOutput?: unknown;\n readonly signal: AbortSignal;\n /** Wall-clock budget shared with the parent request. Use withDeadlineHeader for outbound requests. */\n readonly deadline?: RequestBudget;\n}"
195
+ },
196
+ {
197
+ "name": "AgentModelResponse",
198
+ "kind": "type",
199
+ "package": "@nifrajs/agent",
200
+ "signature": "export type AgentModelResponse = {\n readonly kind: \"output\";\n readonly value: unknown;\n} | {\n readonly kind: \"tool\";\n readonly name: string;\n readonly input: unknown;\n};"
201
+ },
202
+ {
203
+ "name": "AgentPendingContinuation",
204
+ "kind": "interface",
205
+ "package": "@nifrajs/agent",
206
+ "signature": "export interface AgentPendingContinuation {\n readonly kind: AgentPendingKind;\n readonly tool?: string;\n readonly input?: unknown;\n readonly effectId: string;\n}"
207
+ },
208
+ {
209
+ "name": "AgentPendingKind",
210
+ "kind": "type",
211
+ "package": "@nifrajs/agent",
212
+ "signature": "export type AgentPendingKind = \"approval\" | \"budget\" | \"model\" | \"cancelled\";"
213
+ },
214
+ {
215
+ "name": "AgentPorts",
216
+ "kind": "interface",
217
+ "package": "@nifrajs/agent",
218
+ "signature": "export interface AgentPorts {\n readonly model: AgentModelPort;\n readonly capabilities: readonly string[];\n readonly budget?: ToolBudget;\n /** Wall-clock budget shared with the parent request. Distinct from `budget`, which is cost. */\n readonly deadline?: RequestBudget;\n readonly idempotency?: ToolIdempotencyStore;\n readonly state?: AgentStateStore;\n readonly approval?: AgentApprovalPort;\n readonly telemetry?: AgentTelemetryPort;\n readonly clock?: () => number;\n /** Adapter used to satisfy execution policies declared by tool contracts. */\n readonly executionPolicy?: ExecutionPolicyAdapter;\n /** Injectable token generator for deterministic replay and tests. */\n readonly idFactory?: () => string;\n readonly signal?: AbortSignal;\n /** Replay mode skips every tool executor and marks the call dry-run. */\n readonly dryRun?: boolean;\n}"
219
+ },
220
+ {
221
+ "name": "AgentRunResult",
222
+ "kind": "type",
223
+ "package": "@nifrajs/agent",
224
+ "signature": "export type AgentRunResult<Output> = AgentTurnResult<Output> | (AgentTurnBaseResult & {\n readonly status: \"suspended\";\n readonly pending: AgentPendingContinuation;\n readonly reason: \"max_turns\";\n});"
225
+ },
152
226
  {
153
227
  "name": "AGENTS_MD_PATH",
154
228
  "kind": "const",
@@ -162,6 +236,24 @@
162
236
  "signature": "export declare function agentsMcpSection(): string;",
163
237
  "doc": "/**\n * The \"## MCP server\" section appended to a scaffolded (or retrofitted) `AGENTS.md`, so non-Claude\n * agents (Cursor, and anything that reads `AGENTS.md`) also learn the MCP exists and what to prefer.\n * Mirrors the CLAUDE.md preamble's guidance without the Claude-specific `@import`.\n */"
164
238
  },
239
+ {
240
+ "name": "AgentStateStore",
241
+ "kind": "interface",
242
+ "package": "@nifrajs/agent",
243
+ "signature": "export interface AgentStateStore {\n load(turnId: string): AgentTurnState | undefined | PromiseLike<AgentTurnState | undefined>;\n save(state: AgentTurnState): void | PromiseLike<void>;\n}"
244
+ },
245
+ {
246
+ "name": "AgentStatus",
247
+ "kind": "type",
248
+ "package": "@nifrajs/agent",
249
+ "signature": "export type AgentStatus = \"continue\" | \"completed\" | \"suspended\";"
250
+ },
251
+ {
252
+ "name": "AgentStepEvidence",
253
+ "kind": "interface",
254
+ "package": "@nifrajs/agent",
255
+ "signature": "export interface AgentStepEvidence {\n readonly seq: number;\n readonly at: number;\n readonly kind: \"model\" | \"tool\" | \"approval\" | \"budget\" | \"state\";\n readonly outcome: \"started\" | \"passed\" | \"failed\" | \"denied\" | \"suspended\" | \"committed\";\n readonly name?: string;\n readonly effectId?: string;\n readonly code?: string;\n readonly ledgerHead?: string;\n}"
256
+ },
165
257
  {
166
258
  "name": "agentTelemetry",
167
259
  "kind": "function",
@@ -175,6 +267,68 @@
175
267
  "package": "@nifrajs/agent-telemetry",
176
268
  "signature": "export interface AgentTelemetryOptions {\n /** Exporter that receives completed tool-call spans. */\n readonly exporter: ObservationAdapter;\n /** Path prefix for nifra tool routes (default `\"/_nifra/tool/\"`). */\n readonly toolPathPrefix?: string | undefined;\n /** Path for the MCP endpoint (default `\"/mcp\"`). */\n readonly mcpPath?: string | undefined;\n}"
177
269
  },
270
+ {
271
+ "name": "AgentTelemetryPort",
272
+ "kind": "interface",
273
+ "package": "@nifrajs/agent",
274
+ "signature": "export interface AgentTelemetryPort {\n step(evidence: AgentStepEvidence): void | PromiseLike<void>;\n}"
275
+ },
276
+ {
277
+ "name": "AgentToolContract",
278
+ "kind": "type",
279
+ "package": "@nifrajs/agent",
280
+ "signature": "export type AgentToolContract = ToolContract<any, any>;",
281
+ "doc": "/** Heterogeneous tool collection used by an agent definition. Runtime schemas remain authoritative. */"
282
+ },
283
+ {
284
+ "name": "AgentToolDescriptor",
285
+ "kind": "type",
286
+ "package": "@nifrajs/agent",
287
+ "signature": "export type AgentToolDescriptor = ToolCatalogEntry;",
288
+ "doc": "/** The model-facing descriptor is the complete descriptive catalog entry. */"
289
+ },
290
+ {
291
+ "name": "AgentToolResult",
292
+ "kind": "interface",
293
+ "package": "@nifrajs/agent",
294
+ "signature": "export interface AgentToolResult {\n readonly name: string;\n readonly ok: boolean;\n readonly output?: unknown;\n readonly error?: ToolError | {\n readonly code: \"unknown_tool\" | \"invalid_model_response\";\n readonly stage: \"execution\";\n };\n}"
295
+ },
296
+ {
297
+ "name": "AgentTranscript",
298
+ "kind": "interface",
299
+ "package": "@nifrajs/agent",
300
+ "signature": "export interface AgentTranscript {\n readonly version: 1;\n readonly turnId: string;\n readonly responses: readonly AgentModelResponse[];\n readonly evidence: readonly AgentStepEvidence[];\n}"
301
+ },
302
+ {
303
+ "name": "AgentTurnBaseResult",
304
+ "kind": "interface",
305
+ "package": "@nifrajs/agent",
306
+ "signature": "export interface AgentTurnBaseResult {\n readonly state: AgentTurnState;\n readonly evidence: readonly AgentStepEvidence[];\n readonly transcript: AgentTranscript;\n}"
307
+ },
308
+ {
309
+ "name": "AgentTurnError",
310
+ "kind": "interface",
311
+ "package": "@nifrajs/agent",
312
+ "signature": "export interface AgentTurnError {\n readonly code: \"input_invalid\" | \"output_invalid\" | \"model_failed\";\n readonly issues?: readonly StandardIssue[];\n}"
313
+ },
314
+ {
315
+ "name": "AgentTurnInput",
316
+ "kind": "interface",
317
+ "package": "@nifrajs/agent",
318
+ "signature": "export interface AgentTurnInput {\n readonly value: unknown;\n readonly toolResult?: AgentToolResult;\n readonly previousOutput?: unknown;\n readonly resume?: {\n readonly continuation: AgentPendingContinuation;\n readonly approval?: ToolApproval;\n };\n}"
319
+ },
320
+ {
321
+ "name": "AgentTurnResult",
322
+ "kind": "type",
323
+ "package": "@nifrajs/agent",
324
+ "signature": "export type AgentTurnResult<Output> = (AgentTurnBaseResult & {\n readonly status: \"completed\";\n readonly output: Output;\n readonly error?: never;\n}) | (AgentTurnBaseResult & {\n readonly status: \"completed\";\n readonly error: AgentTurnError;\n readonly output?: never;\n}) | (AgentTurnBaseResult & {\n readonly status: \"continue\";\n readonly toolResult: AgentToolResult;\n}) | (AgentTurnBaseResult & {\n readonly status: \"suspended\";\n readonly pending: AgentPendingContinuation;\n readonly reason: \"approval\" | \"budget\" | \"model\" | \"cancelled\";\n});"
325
+ },
326
+ {
327
+ "name": "AgentTurnState",
328
+ "kind": "interface",
329
+ "package": "@nifrajs/agent",
330
+ "signature": "export interface AgentTurnState {\n readonly version: 1;\n readonly turnId: string;\n readonly step: number;\n readonly status: \"ready\" | \"suspended\" | \"completed\";\n readonly evidence: readonly AgentStepEvidence[];\n readonly pending?: {\n readonly kind: AgentPendingKind;\n readonly tool?: string;\n readonly effectId: string;\n };\n}"
331
+ },
178
332
  {
179
333
  "name": "aggregateSizeReport",
180
334
  "kind": "function",
@@ -230,7 +384,7 @@
230
384
  "name": "appendTrailingSlash",
231
385
  "kind": "function",
232
386
  "package": "@nifrajs/middleware",
233
- "signature": "export declare function appendTrailingSlash(options?: TrailingSlashOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
387
+ "signature": "export declare function appendTrailingSlash(options?: TrailingSlashOptions): import(\"@nifrajs/core\").IdentityPlugin;",
234
388
  "doc": "/**\n * Append a trailing slash to non-root paths. By default it skips file-looking paths such as\n * `/app.css`, which keeps static assets and extensionful API routes stable.\n */"
235
389
  },
236
390
  {
@@ -247,6 +401,12 @@
247
401
  "signature": "export interface AppLike {\n fetch(request: Request): Response | Promise<Response>;\n}",
248
402
  "doc": "/** The minimal shape a nifra `server()` app satisfies - its own `fetch`. */"
249
403
  },
404
+ {
405
+ "name": "applyDiagnosticRecipe",
406
+ "kind": "function",
407
+ "package": "@nifrajs/cli",
408
+ "signature": "export declare function applyDiagnosticRecipe(root: string, diagnostic: Diagnostic): Promise<readonly string[]>;"
409
+ },
250
410
  {
251
411
  "name": "applyHead",
252
412
  "kind": "function",
@@ -393,6 +553,12 @@
393
553
  "signature": "export declare function assertStorageAdapterConformance(options: StorageAdapterConformanceOptions): Promise<void>;",
394
554
  "doc": "/**\n * Execute the observable {@link StorageAdapter} contract without depending on a test runner.\n *\n * The adapter must be isolated because this writes deterministic conformance keys. The promise resolves\n * only after proving byte + metadata round-trips, overwrite, missing/delete semantics, prefix/limit listing,\n * and uniform unsafe-key rejection across every key-taking method. When the adapter also implements an\n * optional capability ({@link PagedStorageAdapter}, {@link PresignableStorageAdapter},\n * {@link MovableStorageAdapter}), that capability's contract is proven too - implementing a capability\n * partially or unsafely fails conformance rather than silently escaping it.\n */"
395
555
  },
556
+ {
557
+ "name": "assertTrajectoryInvariants",
558
+ "kind": "function",
559
+ "package": "@nifrajs/testing",
560
+ "signature": "export declare function assertTrajectoryInvariants(result: AgentRunResult<unknown>, options?: TrajectoryInvariantOptions): void;"
561
+ },
396
562
  {
397
563
  "name": "assertTransportTextBounded",
398
564
  "kind": "function",
@@ -400,11 +566,18 @@
400
566
  "signature": "export declare function assertTransportTextBounded(text: string, options: TransportDecodeOptions): void;",
401
567
  "doc": "/**\n * Enforce the transport byte cap on already-read text - the same limit (and the same error) the\n * streaming reader applies during a bounded read. Exported for callers that read a body through a\n * native, non-streaming path (the typed client's in-process branch) and still owe the cap contract.\n */"
402
568
  },
569
+ {
570
+ "name": "AssuranceAttachment",
571
+ "kind": "type",
572
+ "package": "@nifrajs/core",
573
+ "signature": "export type AssuranceAttachment = Omit<AssuranceDeclaration, \"scope\" | \"provenance\"> & {\n readonly scope?: AssuranceScope;\n};",
574
+ "doc": "/**\n * Evidence published from OUTSIDE the plugin chain - a deployment shell, a mount site, the call that\n * hands the app to `serve`. `scope` defaults to `global` (retroactive, app-wide) because the shell\n * runs after every route is registered, and `provenance` is always stamped `declared`: nifra did not\n * install this enforcement and cannot see it, so a `requireProvenance: \"runtime\"` rule still rejects it.\n */"
575
+ },
403
576
  {
404
577
  "name": "AssuranceConfig",
405
578
  "kind": "interface",
406
579
  "package": "@nifrajs/core",
407
- "signature": "export interface AssuranceConfig {\n readonly source: unknown;\n readonly policy: AssurancePolicy;\n readonly capabilities?: CapabilityPolicy;\n /** Off-request-path manifest artifact/signing integration. Private keys remain behind `signer`. */\n readonly manifest?: {\n /** Default `nifra.manifest.json`. */\n readonly path?: string;\n /** Resolve an operator key reference to a signer (KMS/HSM/local WebCrypto). */\n readonly signer?: (keyRef: string) => NifraManifestSigner | Promise<NifraManifestSigner>;\n };\n /** Dynamic invariant execution is opt-in and must use a disposable/sandboxed target. */\n readonly invariants?: {\n readonly executor: InvariantExecutor;\n };\n}"
580
+ "signature": "export interface AssuranceConfig {\n readonly source: unknown;\n readonly policy: AssurancePolicy;\n readonly capabilities?: CapabilityPolicy;\n /** Off-request-path manifest artifact/signing integration. Private keys remain behind `signer`. */\n readonly manifest?: {\n /** Default `nifra.manifest.json`. */\n readonly path?: string;\n /** Resolve an operator key reference to a signer (KMS/HSM/local WebCrypto). */\n readonly signer?: (keyRef: string) => NifraManifestSigner | Promise<NifraManifestSigner>;\n };\n /** Dynamic invariant execution is opt-in and must use a disposable/sandboxed target. */\n readonly invariants?: {\n readonly executor: InvariantExecutor;\n };\n /** Optional application-supplied rule packs appended after built-in verification rules. */\n readonly rulePacks?: readonly AssuranceRulePack[];\n /** Optional sink for an assurance bundle. The CLI validates the callable shape at runtime. */\n readonly assureSink?: unknown;\n /** Optional deterministic effect workloads for the tests gate. */\n readonly idempotency?: readonly IdempotencyWorkload[];\n /** Optional output-size budget for the assurance bundle's size gate. */\n readonly size?: AssuranceSizeBudget;\n}"
408
581
  },
409
582
  {
410
583
  "name": "AssuranceDeclaration",
@@ -424,7 +597,7 @@
424
597
  "name": "AssuranceEvidence",
425
598
  "kind": "interface",
426
599
  "package": "@nifrajs/core",
427
- "signature": "export interface AssuranceEvidence {\n readonly id: string;\n readonly source: string;\n}",
600
+ "signature": "export interface AssuranceEvidence {\n readonly id: string;\n readonly source: string;\n /** Runtime-installed enforcement versus an author assertion on a route. Optional for legacy\n * reflected descriptors; evaluators infer legacy values from source when absent. */\n readonly provenance?: \"runtime\" | \"declared\";\n}",
428
601
  "doc": "/** Reflection-safe proof that a named enforcement module covered a route. */"
429
602
  },
430
603
  {
@@ -455,13 +628,20 @@
455
628
  "name": "AssuranceRouteSelector",
456
629
  "kind": "interface",
457
630
  "package": "@nifrajs/core",
458
- "signature": "export interface AssuranceRouteSelector {\n /** Omit for every method. */\n readonly methods?: readonly Method[];\n /** Absolute route globs. `*` matches one segment; final `**` matches zero or more. */\n readonly paths?: readonly string[];\n /** Restrict the rule to MCP tool routes (`true`) or non-tool routes (`false`). */\n readonly tools?: boolean;\n /**\n * Match routes declaring ANY of these capability tokens.\n *\n * Lets a policy be written about what a route DOES rather than where it lives: \"anything that writes\n * to the database must be authenticated\" survives a route being moved or renamed, which a path glob\n * does not. Reflection already carries the declared tokens, so this reads what the route said about\n * itself.\n *\n * Naming exact tokens is precise but closed: a rule listing `db.write` does not cover `storage.write`,\n * and a capability added next year escapes it in silence. Prefer `access`/`zone` for a rule that is\n * meant to hold for a CLASS of effect.\n */\n readonly capabilities?: readonly string[];\n /**\n * Match routes declaring any capability whose definition has this access.\n *\n * This is the selector to reach for when the rule is \"anything that writes must prove who asked\":\n * it is keyed on what the capability IS rather than what it is called, so a token introduced later\n * is covered the day it is declared instead of the day someone remembers to widen the rule.\n *\n * Requires capability definitions. A policy using it without them is refused rather than quietly\n * matching nothing - a selector that matches nothing lets the route fall through to a laxer rule.\n */\n readonly access?: CapabilityAccess;\n /**\n * Match routes declaring any capability in this zone. Combined with `access`, both must hold for the\n * SAME capability, so `{ access: \"write\", zone: \"domain\" }` is \"writes business state\" and does not\n * match a route that only writes an audit log.\n */\n readonly zone?: CapabilityZone;\n}"
631
+ "signature": "export interface AssuranceRouteSelector {\n /** Omit for every method. */\n readonly methods?: readonly Method[];\n /** Absolute route globs. `*` matches one segment; final `**` matches zero or more. */\n readonly paths?: readonly string[];\n /** Restrict the rule to MCP tool routes (`true`) or non-tool routes (`false`). */\n readonly tools?: boolean;\n /**\n * Match routes declaring ANY of these capability tokens.\n *\n * Lets a policy be written about what a route DOES rather than where it lives: \"anything that writes\n * to the database must be authenticated\" survives a route being moved or renamed, which a path glob\n * does not. Reflection already carries the declared tokens, so this reads what the route said about\n * itself.\n *\n * Naming exact tokens is precise but closed: a rule listing `db.write` does not cover `storage.write`,\n * and a capability added next year escapes it in silence. Prefer `access`/`zone` for a rule that is\n * meant to hold for a CLASS of effect.\n */\n readonly capabilities?: readonly string[];\n /**\n * Match routes declaring any capability whose definition has this access.\n *\n * This is the selector to reach for when the rule is \"anything that writes must prove who asked\":\n * it is keyed on what the capability IS rather than what it is called, so a token introduced later\n * is covered the day it is declared instead of the day someone remembers to widen the rule.\n *\n * Requires capability definitions. A policy using it without them is refused rather than quietly\n * matching nothing - a selector that matches nothing lets the route fall through to a laxer rule.\n */\n readonly access?: CapabilityAccess;\n /**\n * Match routes declaring any capability in this zone. Combined with `access`, both must hold for the\n * SAME capability, so `{ access: \"write\", zone: \"domain\" }` is \"writes business state\" and does not\n * match a route that only writes an audit log.\n */\n readonly zone?: CapabilityZone;\n /** Match routes whose response classification is at least this sensitivity. */\n readonly classificationAtLeast?: DataClassification;\n}"
459
632
  },
460
633
  {
461
634
  "name": "AssuranceRule",
462
635
  "kind": "interface",
463
636
  "package": "@nifrajs/core",
464
- "signature": "export interface AssuranceRule {\n /** Stable human-readable classification included in diagnostics. */\n readonly name: string;\n readonly match: AssuranceRouteSelector;\n /** Evidence ids the route must carry. */\n readonly require?: readonly string[];\n /** Evidence ids the route must not carry (useful for public webhooks and health routes). */\n readonly forbid?: readonly string[];\n}"
637
+ "signature": "export interface AssuranceRule {\n /** Stable human-readable classification included in diagnostics. */\n readonly name: string;\n readonly match: AssuranceRouteSelector;\n /** Evidence ids the route must carry. */\n readonly require?: readonly string[];\n /** Evidence ids the route must not carry (useful for public webhooks and health routes). */\n readonly forbid?: readonly string[];\n /**\n * Provenance required for every id in require. any (default) preserves compatibility with\n * existing policies; runtime rejects schema.assurance author assertions and accepts only\n * evidence installed by middleware/plugins or framework runtime policy. declared is useful for\n * explicitly reviewing in-handler assertions and should not be used as an enforcement gate.\n */\n readonly requireProvenance?: \"any\" | \"runtime\" | \"declared\";\n /**\n * When true, an authenticated route selected by this rule must also carry runtime CSRF evidence.\n * Enable this on rules covering cookie/session-authenticated browser routes; bearer-only APIs\n * should use a separate rule because they do not have browser ambient-authority exposure.\n */\n readonly requireCsrfWithAuthenticated?: boolean;\n}"
638
+ },
639
+ {
640
+ "name": "AssuranceRulePack",
641
+ "kind": "interface",
642
+ "package": "@nifrajs/core",
643
+ "signature": "export interface AssuranceRulePack {\n readonly name: string;\n readonly rules: readonly unknown[];\n}",
644
+ "doc": "/** Application-supplied verification rules. The CLI validates the executable rule shape at runtime. */"
465
645
  },
466
646
  {
467
647
  "name": "AssuranceScope",
@@ -470,6 +650,25 @@
470
650
  "signature": "export type AssuranceScope = \"global\" | \"subsequent\" | \"plugin\";",
471
651
  "doc": "/** Where enforcement evidence follows Nifra's route-registration semantics. */"
472
652
  },
653
+ {
654
+ "name": "AssuranceSizeBudget",
655
+ "kind": "interface",
656
+ "package": "@nifrajs/core",
657
+ "signature": "export interface AssuranceSizeBudget {\n readonly outDir?: string;\n readonly maxBytes?: number;\n readonly maxGzipBytes?: number;\n}"
658
+ },
659
+ {
660
+ "name": "assure",
661
+ "kind": "function",
662
+ "package": "@nifrajs/core",
663
+ "signature": "export declare function assure(app: unknown, evidence: AssuranceAttachment | readonly AssuranceAttachment[]): void;",
664
+ "doc": "/**\n * Publish enforcement evidence from OUTSIDE the plugin chain - the deployment shell that wraps the\n * app, the mount site, or the call that hands it to `serve`. When the thing doing the enforcing is\n * not a nifra plugin (a gateway, a service mesh, an outer framework), the alternative is switching\n * the affected rules off; this records what covers the routes instead, so the policy keeps running.\n *\n * const app = buildApp() // no assurance-bearing plugin in its .use() chain\n * assure(app, { id: NIFRA_ASSURANCE.AUTHENTICATED, source: \"edge-gateway\" })\n * serve(app)\n *\n * `scope` defaults to `global`: the shell runs after every route is registered, so the evidence is\n * retroactive and app-wide. Narrow it with `methods`/`paths` (absolute globs), or pass\n * `scope: \"subsequent\"` to cover only routes registered after the call.\n *\n * Provenance is always `declared` - nifra did not install this enforcement and cannot observe it, so\n * a rule with `requireProvenance: \"runtime\"` still rejects the route, by design.\n */"
665
+ },
666
+ {
667
+ "name": "AssureBundle",
668
+ "kind": "interface",
669
+ "package": "@nifrajs/cli",
670
+ "signature": "export interface AssureBundle {\n readonly version: 1;\n readonly createdAt: string;\n readonly commit: string;\n readonly gates: readonly GateResult[];\n readonly verdict: \"green\" | \"red\";\n}"
671
+ },
473
672
  {
474
673
  "name": "AssuredCapabilityRoute",
475
674
  "kind": "interface",
@@ -482,6 +681,12 @@
482
681
  "package": "@nifrajs/core",
483
682
  "signature": "export interface AssuredRoute {\n readonly method: string;\n readonly path: string;\n readonly rule?: string;\n readonly evidence: readonly AssuranceEvidence[];\n readonly missing: readonly string[];\n readonly forbidden: readonly string[];\n}"
484
683
  },
684
+ {
685
+ "name": "AssureSink",
686
+ "kind": "interface",
687
+ "package": "@nifrajs/cli",
688
+ "signature": "export interface AssureSink {\n record(bundle: AssureBundle): Promise<void>;\n}"
689
+ },
485
690
  {
486
691
  "name": "attachCapabilityJournal",
487
692
  "kind": "function",
@@ -500,7 +705,7 @@
500
705
  "name": "attachWebSocket",
501
706
  "kind": "function",
502
707
  "package": "@nifrajs/core",
503
- "signature": "export declare function attachWebSocket(socket: StandardWebSocket, handler: WebSocketHandler, data: unknown, options: {\n openNow: boolean;\n pubsub: TopicRegistry;\n}): NifraWebSocket;",
708
+ "signature": "export declare function attachWebSocket(socket: StandardWebSocket, handler: WebSocketHandler, data: unknown, options: {\n openNow: boolean;\n pubsub: TopicRegistry;\n maxPayloadBytes?: number;\n}): NifraWebSocket;",
504
709
  "doc": "/**\n * Wire a standard server-side `WebSocket` to a nifra {@link WebSocketHandler}, returning the portable\n * {@link NifraWebSocket}. Shared by the Deno and Workers bridges. `openNow` fires `open` immediately\n * (Workers, where the socket is already open after `accept()`); otherwise `open` waits for the socket's\n * `open` event (Deno). Lifecycle callbacks are error-isolated - a throw (or async rejection) routes to\n * `error()` and never tears the process down; binary frames are normalized to `Uint8Array`.\n */"
505
710
  },
506
711
  {
@@ -540,7 +745,7 @@
540
745
  "name": "AuthPlugin",
541
746
  "kind": "type",
542
747
  "package": "@nifrajs/middleware",
543
- "signature": "export type AuthPlugin<P> = NifraPlugin & {\n /** The verified principal for this request, or `null` (no/invalid token in `optional` mode). */\n principal(request: Request): P | null;\n /** The verified principal, or **throws a `401` `Response`** when absent. */\n requirePrincipal(request: Request): P;\n};",
748
+ "signature": "export type AuthPlugin<P> = IdentityPlugin & {\n /** The verified principal for this request, or `null` (no/invalid token in `optional` mode). */\n principal(request: Request): P | null;\n /** The verified principal, or **throws a `401` `Response`** when absent. */\n requirePrincipal(request: Request): P;\n};",
544
749
  "doc": "/**\n * A token-auth plugin (`bearer` / `apiKey`). Apply it with `app.use(auth)` - it rejects unauthorized\n * requests to **routes defined after it** with `401` (unless `optional`). Read the verified principal\n * inside a handler/loader via {@link AuthPlugin.principal} (nullable) or\n * {@link AuthPlugin.requirePrincipal} (throws `401` when absent). The principal is verified once per\n * request and cached, so reading it is free.\n *\n * `beforeHandle` is **order-scoped**: place `app.use(auth)` before the routes it should guard. Hold the\n * returned instance to read the principal (mirrors `@nifrajs/auth`'s `sessions.get(c)` and\n * `@nifrajs/better-auth`'s `getSession(auth, req)`):\n *\n * ```ts\n * const auth = bearer({ verify: (t) => lookupUser(t) }) // P = User (inferred)\n * const app = server().use(auth).get(\"/me\", (c) => auth.requirePrincipal(c.req))\n * ```\n */"
545
750
  },
546
751
  {
@@ -648,7 +853,7 @@
648
853
  "name": "BasicAuthPlugin",
649
854
  "kind": "type",
650
855
  "package": "@nifrajs/middleware",
651
- "signature": "export type BasicAuthPlugin<P> = NifraPlugin & {\n principal(request: Request): P | null;\n requirePrincipal(request: Request): P;\n};"
856
+ "signature": "export type BasicAuthPlugin<P> = IdentityPlugin & {\n principal(request: Request): P | null;\n requirePrincipal(request: Request): P;\n};"
652
857
  },
653
858
  {
654
859
  "name": "BasicAuthStaticOptions",
@@ -693,7 +898,7 @@
693
898
  "name": "betterAuth",
694
899
  "kind": "function",
695
900
  "package": "@nifrajs/better-auth",
696
- "signature": "export declare function betterAuth(auth: BetterAuthLike, options?: BetterAuthOptions): import(\"@nifrajs/core/server\").IdentityPlugin;",
901
+ "signature": "export declare function betterAuth(auth: BetterAuthLike, options?: BetterAuthOptions): import(\"@nifrajs/core\").IdentityPlugin;",
697
902
  "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 */"
698
903
  },
699
904
  {
@@ -992,6 +1197,12 @@
992
1197
  "signature": "export declare function buildFailureDetail(err: unknown): string;",
993
1198
  "doc": "/**\n * Format a client-build rejection for the guard's report. Bun.build rejects with an AggregateError\n * whose message is just \"Bundle failed\" - the actionable part (which file, which import) lives in\n * `.errors`. Surface it, or the guard reports a failure while hiding the reason.\n */"
994
1199
  },
1200
+ {
1201
+ "name": "BuildFreshness",
1202
+ "kind": "interface",
1203
+ "package": "@nifrajs/cli",
1204
+ "signature": "export interface BuildFreshness {\n readonly ok: boolean;\n readonly buildDir?: string;\n readonly newestSourceMs?: number;\n readonly newestBuildMs?: number;\n readonly reason?: string;\n}"
1205
+ },
995
1206
  {
996
1207
  "name": "buildManifest",
997
1208
  "kind": "function",
@@ -1016,7 +1227,7 @@
1016
1227
  "name": "BuildNifraManifestInput",
1017
1228
  "kind": "interface",
1018
1229
  "package": "@nifrajs/core",
1019
- "signature": "export interface BuildNifraManifestInput {\n readonly source: unknown;\n readonly assurance?: AssuranceReport;\n readonly capabilities?: CapabilityAssuranceReport;\n}"
1230
+ "signature": "export interface BuildNifraManifestInput {\n /** Runtime route source, retained for compatibility with callers that have not built a snapshot. */\n readonly source?: unknown;\n /** Canonical offline evidence; when supplied, no second route reflection is performed. */\n readonly evidence?: ProjectEvidenceSnapshot;\n readonly assurance?: AssuranceReport;\n readonly capabilities?: CapabilityAssuranceReport;\n}"
1020
1231
  },
1021
1232
  {
1022
1233
  "name": "buildOpenApiDocument",
@@ -1025,6 +1236,12 @@
1025
1236
  "signature": "export declare function buildOpenApiDocument(routes: readonly RouteLike[], options?: OpenApiOptions): Record<string, unknown>;",
1026
1237
  "doc": "/**\n * Build an OpenAPI 3.1 document from a route list. Delegates to `@nifrajs/schema`'s `toOpenAPI`, so a\n * route validated with `t` (TypeBox) emits full field-level request/query/response schemas plus\n * `$ref`-reused `components.schemas`; a BYO Standard Schema (zod/valibot/arktype) exposes no portable\n * JSON-Schema form, so its body/response is omitted (supply it via `options.operations`). Path params,\n * wildcards, tags, security, and servers always emit. Exported so you can also generate the doc at\n * build time (write it to disk in CI) without booting the server.\n */"
1027
1238
  },
1239
+ {
1240
+ "name": "buildProjectWorkGraph",
1241
+ "kind": "function",
1242
+ "package": "@nifrajs/cli",
1243
+ "signature": "export declare function buildProjectWorkGraph(input: WorkGraphBuildInput, options?: {\n readonly changedFiles?: readonly string[];\n readonly minLevel?: number;\n}): Promise<ProjectWorkGraphResult>;"
1244
+ },
1028
1245
  {
1029
1246
  "name": "buildRouteManifest",
1030
1247
  "kind": "function",
@@ -1076,7 +1293,7 @@
1076
1293
  "name": "BuildTargetOptions",
1077
1294
  "kind": "interface",
1078
1295
  "package": "@nifrajs/web",
1079
- "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. */\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. */\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 /** 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`); ignored otherwise. */\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 /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n}"
1296
+ "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. */\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. */\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 /** 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`); ignored otherwise. */\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 /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n}"
1080
1297
  },
1081
1298
  {
1082
1299
  "name": "BuildTargetResult",
@@ -1099,6 +1316,12 @@
1099
1316
  "signature": "export declare function buildTargetWith(target: BuildTarget, options: BuildTargetOptions, bundler: Bundler): Promise<BuildTargetResult>;",
1100
1317
  "doc": "/**\n * The bundler-agnostic deploy orchestrator: everything `buildTarget` does EXCEPT the two bundling steps,\n * which come from `bundler`. `buildTarget` passes {@link bunBundler}; `buildTargetVite`\n * (`@nifrajs/web/build-vite`) passes the Vite strategy. One orchestrator, so the deploy-dir shape,\n * server-entry codegen, prerender and size report are identical across pipelines.\n */"
1101
1318
  },
1319
+ {
1320
+ "name": "buildWorkGraph",
1321
+ "kind": "function",
1322
+ "package": "@nifrajs/cli",
1323
+ "signature": "export declare function buildWorkGraph(input: WorkGraphBuildInput): Promise<WorkGraph>;"
1324
+ },
1102
1325
  {
1103
1326
  "name": "bunBundler",
1104
1327
  "kind": "const",
@@ -1182,7 +1405,7 @@
1182
1405
  "name": "cacheControl",
1183
1406
  "kind": "function",
1184
1407
  "package": "@nifrajs/middleware",
1185
- "signature": "export declare function cacheControl(value: string | ((request: Request) => string | undefined), options?: CacheControlOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
1408
+ "signature": "export declare function cacheControl(value: string | ((request: Request) => string | undefined), options?: CacheControlOptions): import(\"@nifrajs/core\").IdentityPlugin;",
1186
1409
  "doc": "/**\n * Set a `Cache-Control` header on matching responses. `value` is either a fixed directive string or a\n * function of the request (return `undefined` to leave a response untouched - e.g. cache by path).\n * Defaults to `GET`/`HEAD` + 2xx, and never clobbers a `Cache-Control` the handler set itself.\n *\n * ```ts\n * app.use(cacheControl(\"public, max-age=3600, stale-while-revalidate=60\"))\n * // or per-path:\n * app.use(cacheControl((req) =>\n * new URL(req.url).pathname.startsWith(\"/assets/\") ? \"public, max-age=31536000, immutable\" : undefined,\n * ))\n * ```\n */"
1187
1410
  },
1188
1411
  {
@@ -1214,7 +1437,7 @@
1214
1437
  "name": "CacheOptions",
1215
1438
  "kind": "interface",
1216
1439
  "package": "@nifrajs/middleware",
1217
- "signature": "export interface CacheOptions {\n readonly store: ResponseCacheStore;\n /** Time to live in milliseconds. */\n readonly ttlMs: number;\n /** Methods cached. Default `[\"GET\", \"HEAD\"]`. */\n readonly methods?: readonly string[];\n /** Status predicate. Default: `200` only. */\n readonly status?: (status: number) => boolean;\n /** Header names included in the cache key and emitted in `Vary`. */\n readonly vary?: readonly string[];\n /** Custom cache key. Receives the normalized `vary` headers through the request itself. */\n readonly key?: (request: Request) => string;\n /** Maximum response bytes to store. Default `1_000_000`. Larger responses pass through. */\n readonly maxBytes?: number;\n /** Respect request `Cache-Control: no-cache/no-store`. Default `true`. */\n readonly respectRequestCacheControl?: boolean;\n /** Respect response `Cache-Control: private/no-store`. Default `true`. */\n readonly respectResponseCacheControl?: boolean;\n /** Cache responses with `Set-Cookie`. Default `false`. */\n readonly cacheSetCookie?: boolean;\n /** Cache responses to requests bearing `Authorization` or `Cookie` even when the response is not\n * explicitly `Cache-Control: public` (or `s-maxage`). Default `false`: a shared cache must not store a\n * personalized response (RFC 9111 §3.5), or it would be replayed to other users. Leave this off unless\n * the cached route is genuinely the same for every caller. */\n readonly cacheAuthenticated?: boolean;\n /** Response header for cache status. Default `\"x-nifra-cache\"`; set `false` to disable. */\n readonly cacheStatusHeader?: string | false;\n}"
1440
+ "signature": "export interface CacheOptions {\n readonly store: ResponseCacheStore;\n /** Time to live in milliseconds. */\n readonly ttlMs: number;\n /** Methods cached. Default `[\"GET\", \"HEAD\"]`. */\n readonly methods?: readonly string[];\n /** Status predicate. Default: `200` only. */\n readonly status?: (status: number) => boolean;\n /** Header names included in the cache key and emitted in `Vary`. */\n readonly vary?: readonly string[];\n /** Custom cache key. Receives the normalized `vary` headers through the request itself. */\n readonly key?: (request: Request) => string;\n /** Maximum response bytes to store. Default `1_000_000`. Larger responses pass through. */\n readonly maxBytes?: number;\n /** Respect request `Cache-Control: no-cache/no-store`. Default `true`. */\n readonly respectRequestCacheControl?: boolean;\n /** Respect response `Cache-Control: private/no-store`. Default `true`. */\n readonly respectResponseCacheControl?: boolean;\n /** Cache responses with `Set-Cookie`. Default `false`. */\n readonly cacheSetCookie?: boolean;\n /** Cache responses to requests bearing `Authorization` or `Cookie` even when the response is not\n * explicitly `Cache-Control: public` (or `s-maxage`). Default `false`: a shared cache must not store a\n * personalized response (RFC 9111 §3.5), or it would be replayed to other users. Leave this off unless\n * the cached route is genuinely the same for every caller. */\n readonly cacheAuthenticated?: boolean;\n /** Credential headers that make a request private. Defaults to Authorization, Cookie, and x-api-key. */\n readonly authenticatedHeaders?: readonly string[];\n /** Response header for cache status. Default `\"x-nifra-cache\"`; set `false` to disable. */\n readonly cacheStatusHeader?: string | false;\n}"
1218
1441
  },
1219
1442
  {
1220
1443
  "name": "CacheStore",
@@ -1392,7 +1615,7 @@
1392
1615
  "name": "CapabilityFindingCode",
1393
1616
  "kind": "type",
1394
1617
  "package": "@nifrajs/core",
1395
- "signature": "export type CapabilityFindingCode = \"unknown-capability\" | \"provenance-uncovered\" | \"undeclared-capability-evidence\" | \"safe-method-domain-write\" | \"unconfined-write-reach\" | \"missing-request-idempotency\" | \"missing-durable-idempotency\" | \"forbidden-effect-import\" | \"provenance-truncated\";"
1618
+ "signature": "export type CapabilityFindingCode = \"unknown-capability\" | \"provenance-uncovered\" | \"undeclared-capability-evidence\" | \"safe-method-domain-write\" | \"unconfined-write-reach\" | \"missing-request-idempotency\" | \"missing-durable-idempotency\" | \"forbidden-effect-import\" | \"provenance-truncated\" | \"unmatched-provenance-seam\";"
1396
1619
  },
1397
1620
  {
1398
1621
  "name": "CapabilityIdempotency",
@@ -1404,7 +1627,7 @@
1404
1627
  "name": "CapabilityImportRule",
1405
1628
  "kind": "interface",
1406
1629
  "package": "@nifrajs/core",
1407
- "signature": "export interface CapabilityImportRule {\n /** Exact module specifier, or a trailing `/*` prefix rule. */\n readonly specifier: string;\n readonly capabilities: readonly string[];\n}"
1630
+ "signature": "export interface CapabilityImportRule {\n /** Exact module specifier, or a trailing `/*` prefix rule. */\n readonly specifier: string;\n readonly capabilities: readonly string[];\n /**\n * Allow this seam to be absent. A rule that matches no import anywhere in the project is reported\n * as `unmatched-provenance-seam` by default, because a specifier written differently from the\n * import it means to govern (`\"./db/client.ts\"` vs `import \"./db/client\"`) governs nothing and\n * every route touching that effect still passes. Set this only for a policy shared across projects\n * where some of them genuinely do not use the seam.\n */\n readonly optional?: boolean;\n}"
1408
1631
  },
1409
1632
  {
1410
1633
  "name": "CapabilityInterceptor",
@@ -1829,6 +2052,18 @@
1829
2052
  "signature": "export declare function checkResponseContract(schema: StandardSchemaV1, result: unknown, mode: \"warn\" | \"enforce\"): ResponseContractOutcome | Promise<ResponseContractOutcome>;",
1830
2053
  "doc": "/**\n * Check one result against the route's declared response schema.\n *\n * Returns synchronously when the schema does (the common case), so an app that opts in does not pay a\n * microtask per response for a check that had no work to do.\n */"
1831
2054
  },
2055
+ {
2056
+ "name": "CheckRule",
2057
+ "kind": "interface",
2058
+ "package": "@nifrajs/cli",
2059
+ "signature": "export interface CheckRule {\n readonly code: string;\n readonly title: string;\n scan(ctx: RuleContext): Promise<readonly Diagnostic[]>;\n}"
2060
+ },
2061
+ {
2062
+ "name": "checkTrajectoryInvariants",
2063
+ "kind": "function",
2064
+ "package": "@nifrajs/testing",
2065
+ "signature": "export declare function checkTrajectoryInvariants(result: AgentRunResult<unknown>, options?: TrajectoryInvariantOptions): readonly TrajectoryInvariantResult[];"
2066
+ },
1832
2067
  {
1833
2068
  "name": "ChunkSize",
1834
2069
  "kind": "interface",
@@ -1975,6 +2210,18 @@
1975
2210
  "signature": "export interface Codeframe {\n readonly file: string;\n readonly line: number;\n readonly column?: number | undefined;\n readonly lines: ReadonlyArray<{\n readonly number: number;\n readonly text: string;\n readonly caret: boolean;\n }>;\n}",
1976
2211
  "doc": "/** A source window around the offending line. `caret` marks the exact line the top frame points at. */"
1977
2212
  },
2213
+ {
2214
+ "name": "collectAssuranceReport",
2215
+ "kind": "function",
2216
+ "package": "@nifrajs/cli",
2217
+ "signature": "export declare function collectAssuranceReport(cwd: string, configPath?: string): Promise<AssuranceReport>;"
2218
+ },
2219
+ {
2220
+ "name": "collectAssureBundle",
2221
+ "kind": "function",
2222
+ "package": "@nifrajs/cli",
2223
+ "signature": "export declare function collectAssureBundle(cwd: string, options?: {\n readonly config?: string;\n readonly strict?: boolean;\n readonly hydration?: boolean;\n readonly interact?: boolean;\n}): Promise<AssureBundle>;"
2224
+ },
1978
2225
  {
1979
2226
  "name": "Collection",
1980
2227
  "kind": "interface",
@@ -1988,12 +2235,18 @@
1988
2235
  "package": "@nifrajs/content",
1989
2236
  "signature": "export interface CollectionConfig<S extends StandardSchemaV1> {\n /** Directory of content files, relative to the process cwd (or absolute). */\n readonly dir: string;\n /** Standard Schema validating each file's frontmatter. */\n readonly schema: S;\n /** File extensions to include (default `[\".md\", \".markdown\"]`). */\n readonly extensions?: readonly string[];\n}"
1990
2237
  },
2238
+ {
2239
+ "name": "collectProjectWorkGraph",
2240
+ "kind": "function",
2241
+ "package": "@nifrajs/cli",
2242
+ "signature": "export declare function collectProjectWorkGraph(cwd: string, options?: {\n readonly changedFiles?: readonly string[];\n readonly minLevel?: number;\n}): Promise<ProjectWorkGraphResult>;"
2243
+ },
1991
2244
  {
1992
2245
  "name": "combine",
1993
2246
  "kind": "function",
1994
2247
  "package": "@nifrajs/middleware",
1995
- "signature": "export declare function combine(...items: readonly Composable[]): NifraPlugin;",
1996
- "doc": "/** Compose middleware/plugins into one reusable bundle. Individual named plugins still dedupe. */"
2248
+ "signature": "export declare function combine(...items: readonly Composable[]): IdentityPlugin;",
2249
+ "doc": "/**\n * Compose middleware/plugins into one reusable bundle. Individual named plugins still dedupe.\n *\n * The bundle is a type **identity**: everything it contains runs, but context a member adds via\n * `derive`/`decorate` is not threaded to the caller's handler types (there is no way to sum unknown\n * members' context at the type level). Apply such a member with its own `.use(...)` instead.\n */"
1997
2250
  },
1998
2251
  {
1999
2252
  "name": "combineObservationAdapters",
@@ -2030,6 +2283,12 @@
2030
2283
  "signature": "export declare function compareRoutePatternSpecificity(left: CompiledRoutePattern, right: CompiledRoutePattern): number;",
2031
2284
  "doc": "/** Core precedence: static > mixed > param > wildcard at the first differing segment, independent of\n * registration order. */"
2032
2285
  },
2286
+ {
2287
+ "name": "CompatibleReplayFile",
2288
+ "kind": "type",
2289
+ "package": "@nifrajs/core",
2290
+ "signature": "export type CompatibleReplayFile = ReplayFile | LegacyContractReplayFile | LegacyFailureReplayFile;"
2291
+ },
2033
2292
  {
2034
2293
  "name": "CompiledRoutePattern",
2035
2294
  "kind": "interface",
@@ -2062,7 +2321,7 @@
2062
2321
  "name": "Composable",
2063
2322
  "kind": "type",
2064
2323
  "package": "@nifrajs/middleware",
2065
- "signature": "export type Composable = Middleware | NifraPlugin;"
2324
+ "signature": "export type Composable = Middleware | IdentityPlugin;"
2066
2325
  },
2067
2326
  {
2068
2327
  "name": "compose",
@@ -2075,8 +2334,8 @@
2075
2334
  "name": "compression",
2076
2335
  "kind": "function",
2077
2336
  "package": "@nifrajs/middleware",
2078
- "signature": "export declare function compression(options?: CompressionOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
2079
- "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`.\n *\n * ```ts\n * app.use(compression())\n * ```\n */"
2337
+ "signature": "export declare function compression(options?: CompressionOptions): import(\"@nifrajs/core\").IdentityPlugin;",
2338
+ "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`.\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 */"
2080
2339
  },
2081
2340
  {
2082
2341
  "name": "CompressionOptions",
@@ -2201,14 +2460,14 @@
2201
2460
  "name": "Context",
2202
2461
  "kind": "interface",
2203
2462
  "package": "@nifrajs/core",
2204
- "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached. Signed cookies arrive as `value.signature` - verify with `unsignValue`. */\n readonly cookies: Readonly<Record<string, string>>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
2463
+ "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n /** Lower-case request headers, validated/coerced when `schema.headers` is declared. */\n readonly headers: HeadersOf<S>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached. Signed cookies arrive as `value.signature` - verify with `unsignValue`. */\n readonly cookies: Readonly<Record<string, string>>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
2205
2464
  "doc": "/**\n * Handler context. `params` are inferred from the path; `body` and `query` are\n * the validated outputs of their schemas when declared (else `undefined` /\n * raw `URLSearchParams`).\n */"
2206
2465
  },
2207
2466
  {
2208
2467
  "name": "Context",
2209
2468
  "kind": "interface",
2210
2469
  "package": "nifra",
2211
- "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached. Signed cookies arrive as `value.signature` - verify with `unsignValue`. */\n readonly cookies: Readonly<Record<string, string>>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
2470
+ "signature": "export interface Context<Path extends string = string, S extends RouteSchema = RouteSchema> {\n readonly req: Request;\n /**\n * Alias of {@link req} - the same `Request`. Page loaders/actions receive their request as `request`;\n * this alias lets route handlers and loaders share one name, so `c.request` and `ctx.req` both work\n * everywhere (no more `c.req` vs `ctx.request` mismatch).\n */\n readonly request: Request;\n /** Read one request header without materializing a Web `Request` on the Node adapter hot path. */\n readonly header: (name: string) => string | null;\n readonly params: ParamsOf<S, Path>;\n /** Lower-case request headers, validated/coerced when `schema.headers` is declared. */\n readonly headers: HeadersOf<S>;\n readonly query: QueryOf<S>;\n readonly body: BodyOf<S>;\n /** The request's cookies, parsed from the `Cookie` header (values URL-decoded). Parsed lazily on\n * first access + cached. Signed cookies arrive as `value.signature` - verify with `unsignValue`. */\n readonly cookies: Readonly<Record<string, string>>;\n readonly set: ResponseControls;\n /**\n * Aborts when the server's `requestTimeoutMs` elapses (and never, when no timeout\n * is configured). Pass it to cancellation-aware work - DB drivers, `fetch` - so a\n * timed-out request stops doing work instead of running on after the 503.\n */\n readonly signal: AbortSignal;\n /**\n * Absolute request deadline plus monotonic remaining time. It shares {@link signal}; the server\n * clamps an inbound deadline to local policy when `acceptInboundDeadlines` is enabled.\n */\n readonly budget: RequestBudget;\n /**\n * Platform bindings from `app.fetch(request, { env })` - Workers `env` (KV/D1/secrets), etc.\n * `undefined` off-edge (Bun/Node/Deno). Declare the shape with `server<Env>()` to read it typed\n * (`c.env: Env`); otherwise `unknown`. Validate at the trust boundary before use either way.\n */\n readonly env: unknown;\n /**\n * The caller's IP. By default the raw socket peer the serving adapter observed (`listen()`,\n * `@nifrajs/node`, `@nifrajs/deno`) - the one address a client cannot forge - or `undefined` when the\n * runtime exposes no socket (Workers) and no trust is declared. Behind a proxy/CDN, set the\n * `clientIp` server option (`{ trustedHops }` or `{ header }`) to derive the real caller from the\n * forwarding chain as far as you trust it; unset, no forwarded header is ever believed. Safe to key\n * rate limits and audit logs on.\n */\n readonly clientIp: string | undefined;\n /**\n * Schedule background work. On edge runtimes it extends the response lifetime (Workers\n * `ctx.waitUntil`); off-edge it runs the promise fire-and-forget (a rejection is swallowed,\n * never an unhandled rejection).\n */\n readonly waitUntil: (promise: Promise<unknown>) => void;\n /**\n * Read the raw request body as bytes, **capped** at `maxBytes` (default: the server's\n * `maxBodyBytes`). For routes with **no body schema** - raw bodies, file uploads,\n * BYO-validation - where the automatic schema cap doesn't apply. An over-cap body (by\n * `Content-Length` or while streaming) throws a flat `413`; a malformed `Content-Length`\n * throws `400`. Consumes the body stream (call once). Pass a larger `maxBytes` for an\n * upload route, a smaller one to tighten a specific endpoint.\n */\n readonly boundedBody: (maxBytes?: number) => Promise<Uint8Array>;\n /**\n * `boundedBody` + `JSON.parse` (UTF-8). Same cap + `413`/`400` semantics; additionally\n * throws a flat `400` on invalid JSON. Use for a schema-less JSON endpoint that still\n * wants the body bounded.\n */\n readonly boundedJson: <T = unknown>(maxBytes?: number) => Promise<T>;\n /**\n * Build a JSON `Response`. Pass a status number or a full `ResponseInit` as the second arg. `return` it\n * from a handler, or `throw` it from `derive`/`beforeHandle` to short-circuit - both work:\n * `throw c.json({ error: \"unauthorized\" }, 401)`. A terser alternative to\n * `new Response(JSON.stringify(...), { status, headers: { \"content-type\": \"application/json\" } })`.\n */\n readonly json: (body: unknown, init?: ResponseInit | number) => Response;\n /** Build a `text/plain; charset=utf-8` `Response`. Like {@link json}, pass a status or `ResponseInit`. */\n readonly text: (body: string, init?: ResponseInit | number) => Response;\n}",
2212
2471
  "doc": "/**\n * Handler context. `params` are inferred from the path; `body` and `query` are\n * the validated outputs of their schemas when declared (else `undefined` /\n * raw `URLSearchParams`).\n */"
2213
2472
  },
2214
2473
  {
@@ -2218,6 +2477,20 @@
2218
2477
  "signature": "export type ContextForOp<O extends OperationDef> = Context<O[\"path\"], SchemaForOp<O> & RouteSchema>;",
2219
2478
  "doc": "/**\n * The handler context for an op - identical to the inline `Context<Path, S>`, so a\n * handler written for an inline route type-checks unchanged under `implement`\n * (the graduation guarantee).\n */"
2220
2479
  },
2480
+ {
2481
+ "name": "ContextPlugin",
2482
+ "kind": "type",
2483
+ "package": "@nifrajs/core",
2484
+ "signature": "export type ContextPlugin<D extends object> = (<R extends Registry, Ctx>(app: Server<R, Ctx>) => Server<R, Ctx & D>) & {\n readonly pluginName?: string;\n};",
2485
+ "doc": "/**\n * A named plugin built with {@link defineContextPlugin}: it adds the context `D` to every handler\n * downstream while threading the caller's route registry and existing context UNCHANGED. This is the\n * type {@link definePlugin} cannot express - `definePlugin` infers its parameter from an untyped\n * `(app) => ...` arrow, which lands on `AnyServer`, so `use` returns `Server<any, any>`.\n */"
2486
+ },
2487
+ {
2488
+ "name": "ContextPlugin",
2489
+ "kind": "type",
2490
+ "package": "nifra",
2491
+ "signature": "export type ContextPlugin<D extends object> = (<R extends Registry, Ctx>(app: Server<R, Ctx>) => Server<R, Ctx & D>) & {\n readonly pluginName?: string;\n};",
2492
+ "doc": "/**\n * A named plugin built with {@link defineContextPlugin}: it adds the context `D` to every handler\n * downstream while threading the caller's route registry and existing context UNCHANGED. This is the\n * type {@link definePlugin} cannot express - `definePlugin` infers its parameter from an untyped\n * `(app) => ...` arrow, which lands on `AnyServer`, so `use` returns `Server<any, any>`.\n */"
2493
+ },
2221
2494
  {
2222
2495
  "name": "contextStorage",
2223
2496
  "kind": "function",
@@ -2317,6 +2590,20 @@
2317
2590
  "signature": "export interface CookieJar {\n /** The current `Cookie` request-header value (`\"a=1; b=2\"`, or `\"\"` when empty). */\n header(): string;\n /** Set the `Cookie` header on `headers` when the jar is non-empty. */\n applyTo(headers: Headers): void;\n /** Absorb every `Set-Cookie` on a response (setting or, on removal, deleting each). */\n store(response: {\n headers: Headers;\n }): void;\n set(name: string, value: string): void;\n get(name: string): string | undefined;\n clear(): void;\n readonly size: number;\n}",
2318
2591
  "doc": "/**\n * A tiny cookie jar for in-process tests - parses `Set-Cookie` off responses and emits a `Cookie`\n * request header, so a login → authenticated-request flow works without threading headers by hand. It\n * honours removal (`Max-Age=0` / a past `Expires`) so logout clears the cookie; other attributes\n * (Domain/Path/Secure/SameSite) are ignored - everything is same-origin in-process.\n */"
2319
2592
  },
2593
+ {
2594
+ "name": "cookieNamePrefix",
2595
+ "kind": "function",
2596
+ "package": "@nifrajs/core",
2597
+ "signature": "export declare function cookieNamePrefix(name: string): \"secure\" | \"host\" | undefined;",
2598
+ "doc": "/**\n * RFC 6265bis cookie-name prefix, matched **case-insensitively** the way browsers match it -\n * `__secure-x` triggers the same enforcement as `__Secure-x`. `undefined` for unprefixed names.\n * Writers (set AND delete) must satisfy the prefix contract or the user agent silently discards\n * the whole `Set-Cookie`.\n */"
2599
+ },
2600
+ {
2601
+ "name": "cookieNamePrefix",
2602
+ "kind": "function",
2603
+ "package": "nifra",
2604
+ "signature": "export declare function cookieNamePrefix(name: string): \"secure\" | \"host\" | undefined;",
2605
+ "doc": "/**\n * RFC 6265bis cookie-name prefix, matched **case-insensitively** the way browsers match it -\n * `__secure-x` triggers the same enforcement as `__Secure-x`. `undefined` for unprefixed names.\n * Writers (set AND delete) must satisfy the prefix contract or the user agent silently discards\n * the whole `Set-Cookie`.\n */"
2606
+ },
2320
2607
  {
2321
2608
  "name": "CookieOptions",
2322
2609
  "kind": "interface",
@@ -2331,6 +2618,20 @@
2331
2618
  "signature": "export interface CookieOptions {\n /** Lifetime in seconds. `0` (with a past `expires`) deletes the cookie. */\n readonly maxAge?: number;\n readonly expires?: Date;\n readonly path?: string;\n readonly domain?: string;\n readonly secure?: boolean;\n readonly httpOnly?: boolean;\n readonly sameSite?: \"strict\" | \"lax\" | \"none\";\n readonly partitioned?: boolean;\n}",
2332
2619
  "doc": "/** Attributes for a `Set-Cookie`. `expires` is a `Date`; `maxAge` is in **seconds**. */"
2333
2620
  },
2621
+ {
2622
+ "name": "CookieSecret",
2623
+ "kind": "type",
2624
+ "package": "@nifrajs/core",
2625
+ "signature": "export type CookieSecret = string | readonly string[];",
2626
+ "doc": "/**\n * A signing secret, or a rotation list of them. With a list, **the first secret signs** and\n * verification accepts **any** entry - so rotation is: prepend the new secret, keep the old one\n * until every cookie signed by it has expired, then drop it. An empty list throws.\n */"
2627
+ },
2628
+ {
2629
+ "name": "CookieSecret",
2630
+ "kind": "type",
2631
+ "package": "nifra",
2632
+ "signature": "export type CookieSecret = string | readonly string[];",
2633
+ "doc": "/**\n * A signing secret, or a rotation list of them. With a list, **the first secret signs** and\n * verification accepts **any** entry - so rotation is: prepend the new secret, keep the old one\n * until every cookie signed by it has expired, then drop it. An empty list throws.\n */"
2634
+ },
2334
2635
  {
2335
2636
  "name": "copyPublicDir",
2336
2637
  "kind": "function",
@@ -2365,6 +2666,19 @@
2365
2666
  "signature": "export declare function createAdmissionController(options: AdmissionOptions): AdmissionControllerHandle;",
2366
2667
  "doc": "/**\n * Build a capacity-admission controller. Pass the returned handle as the server's `admission` option.\n */"
2367
2668
  },
2669
+ {
2670
+ "name": "createAgentEvidenceStream",
2671
+ "kind": "function",
2672
+ "package": "@nifrajs/agent",
2673
+ "signature": "export declare function createAgentEvidenceStream(options?: AgentEvidenceStreamOptions): AgentEvidenceStream;",
2674
+ "doc": "/** Create an async iterable that yields the exact evidence values received by `step`. */"
2675
+ },
2676
+ {
2677
+ "name": "createAgentState",
2678
+ "kind": "function",
2679
+ "package": "@nifrajs/agent",
2680
+ "signature": "export declare function createAgentState(turnId: string): AgentTurnState;"
2681
+ },
2368
2682
  {
2369
2683
  "name": "createApprovalCoordinator",
2370
2684
  "kind": "function",
@@ -2388,7 +2702,7 @@
2388
2702
  "name": "createCsrfToken",
2389
2703
  "kind": "function",
2390
2704
  "package": "@nifrajs/middleware",
2391
- "signature": "export declare function createCsrfToken(secret: string | Uint8Array, nonce?: string): Promise<string>;"
2705
+ "signature": "export declare function createCsrfToken(secret: CsrfSecret, nonce?: string): Promise<string>;"
2392
2706
  },
2393
2707
  {
2394
2708
  "name": "createDataPort",
@@ -2443,6 +2757,12 @@
2443
2757
  "signature": "export declare function createEventRegistry(contracts: readonly EventContract[]): EventRegistry;",
2444
2758
  "doc": "/** Build a registry from a set of contracts. Throws on a duplicate `type@version`. */"
2445
2759
  },
2760
+ {
2761
+ "name": "createEvidenceBundle",
2762
+ "kind": "function",
2763
+ "package": "@nifrajs/cli",
2764
+ "signature": "export declare function createEvidenceBundle(graph: WorkGraph, impact: ImpactReport, plan: ProofPlan, proofs?: readonly ProofEvidence[]): EvidenceBundle;"
2765
+ },
2446
2766
  {
2447
2767
  "name": "createFailureLab",
2448
2768
  "kind": "function",
@@ -2471,6 +2791,13 @@
2471
2791
  "signature": "export declare function createImageHandler(options?: ImageHandlerOptions): (req: Request) => Promise<Response>;",
2472
2792
  "doc": "/**\n * Build the resize request handler. Mount its return value at the `selfHostedLoader` endpoint:\n *\n * ```ts\n * const image = createImageHandler({ root: \"./public\", allowedOrigins: [\"https://cdn.example\"] })\n * // inside your router: if (url.pathname === \"/_image\") return image(req)\n * ```\n */"
2473
2793
  },
2794
+ {
2795
+ "name": "createLocalProcessAdapter",
2796
+ "kind": "function",
2797
+ "package": "@nifrajs/agent",
2798
+ "signature": "export declare function createLocalProcessAdapter(options?: LocalProcessAdapterOptions): LocalProcessAdapter;",
2799
+ "doc": "/**\n * Run a command with the host controls available to a normal child process. The local adapter is NOT\n * a security boundary. Without OS-level sandboxing it contains crashes and accidents, not hostile code.\n */"
2800
+ },
2474
2801
  {
2475
2802
  "name": "createMatcher",
2476
2803
  "kind": "function",
@@ -2494,7 +2821,13 @@
2494
2821
  "name": "CreateMcpServerOptions",
2495
2822
  "kind": "interface",
2496
2823
  "package": "@nifrajs/mcp",
2497
- "signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets - their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n /** Natural-language guidance for LLMs, surfaced in the modern `server/discover` result (2026-07-28). */\n readonly instructions?: string;\n /** Origin allowlist for the DNS-rebinding guard. Omit to allow any origin; set it to reject other\n * browser origins with 403 (e.g. a hardened, non-public mount). */\n readonly allowedOrigins?: readonly string[];\n}"
2824
+ "signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets - their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n /** Natural-language guidance for LLMs, surfaced in the modern `server/discover` result (2026-07-28). */\n readonly instructions?: string;\n /** Origin allowlist for the DNS-rebinding guard. Omit to allow any origin; set it to reject other\n * browser origins with 403 (e.g. a hardened, non-public mount). */\n readonly allowedOrigins?: readonly string[];\n /**\n * Per-message authorization, applied after the message parses and before any tool runs. Return\n * `false` to answer 403 with a JSON-RPC `unauthorized` error (`MCP_ERROR.UNAUTHORIZED`) and no result.\n *\n * This is the seam for \"this caller may list tools but may not call the write ones\" - the HTTP\n * layer above only sees one opaque POST, so a route guard cannot make that distinction.\n * `fetch(request, { authorizeMessage })` overrides it per request when the decision depends on\n * something the surrounding handler resolved (a session, a tenant).\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
2825
+ },
2826
+ {
2827
+ "name": "createMemoryAssureSink",
2828
+ "kind": "function",
2829
+ "package": "@nifrajs/cli",
2830
+ "signature": "export declare function createMemoryAssureSink(): MemoryAssureSink;"
2498
2831
  },
2499
2832
  {
2500
2833
  "name": "createMemoryCausalityStore",
@@ -2552,6 +2885,13 @@
2552
2885
  "signature": "export declare function createPngRasterizer(render: PngRenderer): OgImageRasterizer;",
2553
2886
  "doc": "/**\n * Adapt an injected SVG→PNG renderer to `ogImageResponse`.\n *\n * The renderer stays application-owned because codec/WASM choice is runtime-specific. For example:\n *\n * ```ts\n * import { Resvg } from \"@resvg/resvg-js\"\n * import { createPngRasterizer } from \"@nifrajs/image/og-png\"\n * const rasterizer = createPngRasterizer((svg) => new Resvg(svg).render().asPng())\n * ```\n *\n * This is the public reference adapter; the core package remains zero-dependency and keeps SVG as its\n * explicit default for callers that do not opt into a codec.\n */"
2554
2887
  },
2888
+ {
2889
+ "name": "createProxy",
2890
+ "kind": "function",
2891
+ "package": "@nifrajs/proxy",
2892
+ "signature": "export declare function createProxy(options: ProxyOptions): ProxyHandler;",
2893
+ "doc": "/**\n * Create a proxy handler bound to one upstream origin.\n *\n * ```ts\n * const upstream = createProxy({ upstream: \"http://127.0.0.1:8081\" })\n * app.mountFetch(\"/api\", upstream, { stripPrefix: true })\n * ```\n *\n * Streams both directions, preserves method/path/query/status, strips hop-by-hop and\n * Connection-nominated headers both ways, never follows upstream redirects, and answers flat\n * errors: `502 bad_gateway` when the upstream is unreachable, `504 gateway_timeout` on deadline.\n * WebSocket upgrade is not proxied.\n */"
2894
+ },
2555
2895
  {
2556
2896
  "name": "createQuery",
2557
2897
  "kind": "function",
@@ -2645,6 +2985,38 @@
2645
2985
  "signature": "export declare function createStylesheetEmitter(build: PluginBuilder, namespace: string): StylesheetEmitter;",
2646
2986
  "doc": "/**\n * Wire the virtual-CSS-module handlers onto `build` for `namespace`, returning an {@link StylesheetEmitter}.\n * The `namespace` must be a plain identifier (letters/`-`); it's used verbatim as the import suffix and\n * the Bun namespace. Only the `\"dom\"` build should emit CSS - the `\"ssr\"` build ships no stylesheet.\n */"
2647
2987
  },
2988
+ {
2989
+ "name": "createToolBudget",
2990
+ "kind": "function",
2991
+ "package": "@nifrajs/core",
2992
+ "signature": "export declare function createToolBudget(options: CreateToolBudgetOptions): ToolBudget;"
2993
+ },
2994
+ {
2995
+ "name": "CreateToolBudgetOptions",
2996
+ "kind": "interface",
2997
+ "package": "@nifrajs/core",
2998
+ "signature": "export interface CreateToolBudgetOptions {\n readonly limits: EffectCost;\n readonly initial?: EffectCost;\n}"
2999
+ },
3000
+ {
3001
+ "name": "createToolHttpHandler",
3002
+ "kind": "function",
3003
+ "package": "@nifrajs/core",
3004
+ "signature": "export declare function createToolHttpHandler<Input, Output>(tool: ToolContract<Input, Output>, options?: ToolHttpOptions): (request: Request) => Promise<Response>;",
3005
+ "doc": "/**\n * Mount one contract behind a Web-standard handler. The handler accepts one JSON request body.\n * A body carrying a poisoned key (own `__proto__`, or `constructor.prototype`) is rejected with\n * the same `input_invalid` result as malformed JSON. The body is capped at\n * {@link ToolHttpOptions.maxBytes} (1 MiB by default); over-cap answers a flat `413` and a\n * malformed `Content-Length` a flat `400`, before any parse.\n */"
3006
+ },
3007
+ {
3008
+ "name": "createTrajectoryTranscript",
3009
+ "kind": "function",
3010
+ "package": "@nifrajs/testing",
3011
+ "signature": "export declare function createTrajectoryTranscript(transcript: AgentTranscript, options?: CreateTrajectoryTranscriptOptions): Promise<TrajectoryTranscript>;",
3012
+ "doc": "/** Record the transcript emitted by a turn without adding a second execution recording path. */"
3013
+ },
3014
+ {
3015
+ "name": "CreateTrajectoryTranscriptOptions",
3016
+ "kind": "interface",
3017
+ "package": "@nifrajs/testing",
3018
+ "signature": "export interface CreateTrajectoryTranscriptOptions {\n readonly faultProfile?: string;\n readonly seed?: number;\n}"
3019
+ },
2648
3020
  {
2649
3021
  "name": "createTransportCodecRegistry",
2650
3022
  "kind": "function",
@@ -2669,14 +3041,14 @@
2669
3041
  "name": "createWebApp",
2670
3042
  "kind": "function",
2671
3043
  "package": "@nifrajs/web",
2672
- "signature": "export declare function createWebApp<Env = unknown>(options: CreateWebAppOptions): ReturnType<typeof server<Env>>;",
3044
+ "signature": "export declare function createWebApp<Env = unknown>(options: CreateWebAppOptions<Env>): ReturnType<typeof server<Env>>;",
2673
3045
  "doc": "/**\n * Build a nifra app from a route manifest: every route SSRs its layout chain via `renderPage`,\n * and a wildcard catch-all renders `_404` (or a plain 404). Reuses @nifrajs/core's router +\n * lifecycle, so matching, params, and precedence are battle-tested. fs-free - feed it a\n * manifest from `discoverRoutes` (`@nifrajs/web/fs`) at startup, so the served app stays portable.\n *\n * **Typed platform bindings.** Pass `Env` - `createWebApp<Env>({ … })` - to declare the app's Workers\n * bindings ONCE. It seeds the returned `Server`'s context with `{ env: Env }` (exactly as the backend's\n * `server<Env>()` does), so `app.fetch(req, { env })` / `toFetchHandler(app)` type-check the `env`\n * argument against the declared shape - no per-binding cast at the edge entry. Per-route loaders/actions\n * stay typed independently of this call: annotate them with `@nifrajs/client`'s `LoaderArgs<Api, Env>`\n * (same `Env`) so `ctx.env.MY_KV` is typed there too. Omit the parameter and `Env` is `unknown` - the\n * secure default; validate at the trust boundary before use.\n */"
2674
3046
  },
2675
3047
  {
2676
3048
  "name": "CreateWebAppOptions",
2677
3049
  "kind": "interface",
2678
3050
  "package": "@nifrajs/web",
2679
- "signature": "export interface CreateWebAppOptions {\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /** 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`; `createWebApp` also serves that backend over HTTP at\n * {@link apiPrefix} (default `/api`): a request whose pathname starts with the prefix is dispatched\n * before page routing with the same `env`/`waitUntil` platform context, and the backend's `Response`\n * is returned untouched. The mount runs in `nifra dev` too. Pass `apiPrefix: \"\"` to disable it. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is auto-mounted at (default `\"/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. Set to `\"\"` to disable the\n * auto-mount entirely (the app serves pages only and `api` stays a loader-only `ctx.api`). Mounting\n * is also a no-op when `api` does not expose the symbol 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.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: {\n fetch(request: Request): Response | Promise<Response>;\n };\n readonly stripPrefix?: boolean;\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 /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Injected 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. */\n readonly prerenderedPaths?: readonly string[];\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 /** 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 - so it sees errors that the boundary would\n * otherwise hide. 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}"
3051
+ "signature": "export interface CreateWebAppOptions<Env = unknown> {\n readonly adapter: RenderAdapter;\n readonly manifest: Manifest;\n /** URL of the built client entry (module script) injected into every page. */\n readonly clientEntry: string;\n /** Default document title for all pages. */\n readonly title?: string;\n /**\n * 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 binds\n * them to nothing, silently. `requestId()` is exactly that case: it is a `derive`, so applied late\n * it leaves every page without `c.requestId`. 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`; `createWebApp` also serves that backend over HTTP at\n * {@link apiPrefix} (default `/api`): a request whose pathname starts with the prefix is dispatched\n * before page routing with the same `env`/`waitUntil` platform context, and the backend's `Response`\n * is returned untouched. The mount runs in `nifra dev` too. Pass `apiPrefix: \"\"` to disable it. */\n readonly api?: unknown;\n /** HTTP path prefix the {@link api} backend is auto-mounted at (default `\"/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. Set to `\"\"` to disable the\n * auto-mount entirely (the app serves pages only and `api` stays a loader-only `ctx.api`). Mounting\n * is also a no-op when `api` does not expose the symbol 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.\n */\n readonly mounts?: ReadonlyArray<{\n readonly path: string;\n readonly app: {\n fetch(request: Request): Response | Promise<Response>;\n };\n readonly stripPrefix?: boolean;\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 /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). Injected 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. */\n readonly prerenderedPaths?: readonly string[];\n /** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:\n * those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the\n * team - unreleased feature names, internal hostnames, and \"don't touch X yet\" notes live there\n * routinely. Turn it on only for a repo whose guidelines you would publish as a page. */\n readonly publishLocalGuidelines?: boolean;\n /** 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 /** 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 - so it sees errors that the boundary would\n * otherwise hide. 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}"
2680
3052
  },
2681
3053
  {
2682
3054
  "name": "createWebSocketHub",
@@ -2729,7 +3101,7 @@
2729
3101
  "name": "CsrfOptions",
2730
3102
  "kind": "interface",
2731
3103
  "package": "@nifrajs/middleware",
2732
- "signature": "export interface CsrfOptions {\n /** HMAC secret. Must be at least 32 bytes. */\n readonly secret: string | Uint8Array;\n /** Cookie carrying the signed token. Default `\"csrf-token\"`. */\n readonly cookie?: string;\n /** Header carrying the same signed token. Default `\"x-csrf-token\"`. */\n readonly header?: string;\n /** Unsafe methods to protect. Default: every method except GET/HEAD/OPTIONS/TRACE. */\n readonly methods?: readonly string[];\n /** Allowed request origins. Default: same-origin derived from the request URL. */\n readonly origins?: readonly string[];\n /** Check Origin/Referer on protected requests. Default true. */\n readonly checkOrigin?: boolean;\n}"
3104
+ "signature": "export interface CsrfOptions {\n /** HMAC secret (≥ 32 bytes), or a rotation list - see {@link CsrfSecret}. */\n readonly secret: CsrfSecret;\n /** Cookie carrying the signed token. Default `\"csrf-token\"`. */\n readonly cookie?: string;\n /** Header carrying the same signed token. Default `\"x-csrf-token\"`. */\n readonly header?: string;\n /** Unsafe methods to protect. Default: every method except GET/HEAD/OPTIONS/TRACE. */\n readonly methods?: readonly string[];\n /** Allowed request origins. Default: same-origin derived from the request URL. */\n readonly origins?: readonly string[];\n /** Check Origin/Referer on protected requests. Default true. */\n readonly checkOrigin?: boolean;\n}"
2733
3105
  },
2734
3106
  {
2735
3107
  "name": "CssModuleResult",
@@ -2979,6 +3351,12 @@
2979
3351
  "signature": "export declare function decodeTransportText(text: string, contentType: string | null, registry?: TransportCodecRegistry, options?: TransportDecodeOptions): unknown;",
2980
3352
  "doc": "/**\n * Decode an ALREADY-READ transport body. The counterpart to {@link decodeTransportResponse} for a\n * caller that obtained the text through its own bounded read - notably the typed client's\n * in-process path, where the response body is same-process memory that was fully resident before\n * the read, so the native `Response.text()` is safe and the streaming byte-cap loop would protect\n * nothing while costing ~23x. The byte cap is still enforced here (identical error), just after\n * the read instead of during it.\n */"
2981
3353
  },
3354
+ {
3355
+ "name": "DEFAULT_ASSURANCE_CONFIG",
3356
+ "kind": "const",
3357
+ "package": "@nifrajs/cli",
3358
+ "signature": "export declare const DEFAULT_ASSURANCE_CONFIG = \"nifra.assurance.ts\";"
3359
+ },
2982
3360
  {
2983
3361
  "name": "DEFAULT_DEV_PORT",
2984
3362
  "kind": "const",
@@ -3007,6 +3385,13 @@
3007
3385
  "signature": "export declare const DEFAULT_MAX_ENTRIES = 1000;",
3008
3386
  "doc": "/** Per-request entry bound. Generous for real handlers, small enough to stop a runaway loop. */"
3009
3387
  },
3388
+ {
3389
+ "name": "DEFAULT_TOOL_MAX_BYTES",
3390
+ "kind": "const",
3391
+ "package": "@nifrajs/core",
3392
+ "signature": "export declare const DEFAULT_TOOL_MAX_BYTES = 1048576;",
3393
+ "doc": "/** Default transport body cap for {@link createToolHttpHandler}: 1 MiB. */"
3394
+ },
3010
3395
  {
3011
3396
  "name": "DEFAULT_WIRE_DECODE_LIMITS",
3012
3397
  "kind": "const",
@@ -3075,6 +3460,20 @@
3075
3460
  "signature": "export declare function defineCollection<S extends StandardSchemaV1>(config: CollectionConfig<S>): Collection<InferSchema<S>>;",
3076
3461
  "doc": "/**\n * Define a content collection backed by a directory. `all()` discovers + parses every matching file;\n * `get(slug)` loads one. Frontmatter is validated against `schema`, so entries are fully typed and a\n * malformed file fails loudly. Reads the filesystem - use it at build time (SSG/prerender) or on a\n * long-lived server (Bun/Node/Deno).\n */"
3077
3462
  },
3463
+ {
3464
+ "name": "defineContextPlugin",
3465
+ "kind": "function",
3466
+ "package": "@nifrajs/core",
3467
+ "signature": "export declare function defineContextPlugin<D extends object>(name: string, apply: <R extends Registry, Ctx>(app: Server<R, Ctx>) => Server<R, Ctx & D>): ContextPlugin<D>;",
3468
+ "doc": "/**\n * Define a named plugin that **adds typed context and nothing else** - the `derive` case - without\n * collapsing the caller's types. `use` instantiates the generic signature against the concrete\n * receiver, so `R` and `Ctx` come back unchanged with `D` intersected onto the context.\n *\n * Use this instead of {@link definePlugin} for every `(app) => app.derive(...)` plugin. `definePlugin`\n * is only safe when the caller supplies `In`/`Out` explicitly; with the usual untyped arrow both\n * default to `AnyServer` and the typed client silently collapses to `any`.\n *\n * ```ts\n * export const requestId = defineContextPlugin<{ requestId: string }>(\"requestId\", (app) =>\n * app.derive(() => ({ requestId: crypto.randomUUID() })),\n * )\n * const api = server().get(\"/a\", h).use(requestId).get(\"/b\", h) // /a AND /b stay typed; c.requestId typed\n * ```\n */"
3469
+ },
3470
+ {
3471
+ "name": "defineContextPlugin",
3472
+ "kind": "function",
3473
+ "package": "nifra",
3474
+ "signature": "export declare function defineContextPlugin<D extends object>(name: string, apply: <R extends Registry, Ctx>(app: Server<R, Ctx>) => Server<R, Ctx & D>): ContextPlugin<D>;",
3475
+ "doc": "/**\n * Define a named plugin that **adds typed context and nothing else** - the `derive` case - without\n * collapsing the caller's types. `use` instantiates the generic signature against the concrete\n * receiver, so `R` and `Ctx` come back unchanged with `D` intersected onto the context.\n *\n * Use this instead of {@link definePlugin} for every `(app) => app.derive(...)` plugin. `definePlugin`\n * is only safe when the caller supplies `In`/`Out` explicitly; with the usual untyped arrow both\n * default to `AnyServer` and the typed client silently collapses to `any`.\n *\n * ```ts\n * export const requestId = defineContextPlugin<{ requestId: string }>(\"requestId\", (app) =>\n * app.derive(() => ({ requestId: crypto.randomUUID() })),\n * )\n * const api = server().get(\"/a\", h).use(requestId).get(\"/b\", h) // /a AND /b stay typed; c.requestId typed\n * ```\n */"
3476
+ },
3078
3477
  {
3079
3478
  "name": "defineContract",
3080
3479
  "kind": "function",
@@ -3109,6 +3508,19 @@
3109
3508
  "signature": "export declare function defineEventContract<Schema extends StandardSchemaV1>(spec: {\n type: string;\n version: number;\n payload: Schema;\n}): EventContract<Schema>;",
3110
3509
  "doc": "/** Define a portable, versioned event contract. */"
3111
3510
  },
3511
+ {
3512
+ "name": "defineExecutionPolicy",
3513
+ "kind": "function",
3514
+ "package": "@nifrajs/core",
3515
+ "signature": "export declare function defineExecutionPolicy(policy: ExecutionPolicy): ExecutionPolicy;"
3516
+ },
3517
+ {
3518
+ "name": "defineFaultProfile",
3519
+ "kind": "function",
3520
+ "package": "@nifrajs/testing",
3521
+ "signature": "export declare function defineFaultProfile(profile: FaultProfile): FaultProfile;",
3522
+ "doc": "/** Validate and freeze a reusable fault profile. */"
3523
+ },
3112
3524
  {
3113
3525
  "name": "defineIdentityPlugin",
3114
3526
  "kind": "function",
@@ -3151,15 +3563,33 @@
3151
3563
  "name": "definePlugin",
3152
3564
  "kind": "function",
3153
3565
  "package": "@nifrajs/core",
3154
- "signature": "export declare function definePlugin<In extends AnyServer, Out extends AnyServer>(name: string, apply: (app: In) => Out): NifraPlugin<In, Out>;",
3155
- "doc": "/**\n * Name + ergonomics for a plugin that **adds typed context** (`derive`/`decorate`). `app.use(myPlugin)`\n * applies it once; a second `use` of the same name is skipped (idempotent), so plugins can depend on each\n * other without double-registering hooks.\n *\n * ```ts\n * export const requestId = definePlugin(\"requestId\", (app) => app.derive(() => ({ requestId: uuid() })))\n * app.use(requestId) // downstream handlers see c.requestId\n * ```\n *\n * FOOTGUN: only use this for a plugin that adds context. For a plugin that **mounts routes/hooks but adds\n * NO context** (an auth router, an audit logger), use {@link defineRouterPlugin} ({@link defineIdentityPlugin}).\n * `definePlugin((app) => app.get(...))` infers `app: Server<any, any>`, so `.use()` returns `Server<any, any>`\n * and your whole typed client silently collapses to `any` - no type error, no runtime error.\n */"
3566
+ "signature": "export declare function definePlugin<In extends AnyServer, Out extends AnyServer>(name: string, apply: (app: In) => Out): DefinePluginResult<In, Out>;",
3567
+ "doc": "/**\n * Name + ergonomics for a plugin that **adds typed context** (`derive`/`decorate`). `app.use(myPlugin)`\n * applies it once; a second `use` of the same name is skipped (idempotent), so plugins can depend on each\n * other without double-registering hooks.\n *\n * ```ts\n * export const requestId = definePlugin(\"requestId\", (app: typeof api) =>\n * app.derive(() => ({ requestId: uuid() })),\n * )\n * app.use(requestId) // downstream handlers see c.requestId\n * ```\n *\n * This helper only threads types when the caller pins the input server type - by annotating the\n * parameter as above, or with explicit type arguments. With a bare `(app) => ...` arrow `app` infers as\n * `AnyServer`, which would widen the caller's whole route registry to `any`; that case now returns\n * {@link PluginTypeCollapsed}, so `.use()` fails to compile with one error at the call site rather than\n * producing a typed client full of `any`. Prefer a definer that cannot collapse at all:\n *\n * - adds context via `derive`/`decorate` -> {@link defineContextPlugin}\n * - mounts routes/hooks and adds NO context -> {@link defineRouterPlugin} ({@link defineIdentityPlugin})\n */"
3156
3568
  },
3157
3569
  {
3158
3570
  "name": "definePlugin",
3159
3571
  "kind": "function",
3160
3572
  "package": "nifra",
3161
- "signature": "export declare function definePlugin<In extends AnyServer, Out extends AnyServer>(name: string, apply: (app: In) => Out): NifraPlugin<In, Out>;",
3162
- "doc": "/**\n * Name + ergonomics for a plugin that **adds typed context** (`derive`/`decorate`). `app.use(myPlugin)`\n * applies it once; a second `use` of the same name is skipped (idempotent), so plugins can depend on each\n * other without double-registering hooks.\n *\n * ```ts\n * export const requestId = definePlugin(\"requestId\", (app) => app.derive(() => ({ requestId: uuid() })))\n * app.use(requestId) // downstream handlers see c.requestId\n * ```\n *\n * FOOTGUN: only use this for a plugin that adds context. For a plugin that **mounts routes/hooks but adds\n * NO context** (an auth router, an audit logger), use {@link defineRouterPlugin} ({@link defineIdentityPlugin}).\n * `definePlugin((app) => app.get(...))` infers `app: Server<any, any>`, so `.use()` returns `Server<any, any>`\n * and your whole typed client silently collapses to `any` - no type error, no runtime error.\n */"
3573
+ "signature": "export declare function definePlugin<In extends AnyServer, Out extends AnyServer>(name: string, apply: (app: In) => Out): DefinePluginResult<In, Out>;",
3574
+ "doc": "/**\n * Name + ergonomics for a plugin that **adds typed context** (`derive`/`decorate`). `app.use(myPlugin)`\n * applies it once; a second `use` of the same name is skipped (idempotent), so plugins can depend on each\n * other without double-registering hooks.\n *\n * ```ts\n * export const requestId = definePlugin(\"requestId\", (app: typeof api) =>\n * app.derive(() => ({ requestId: uuid() })),\n * )\n * app.use(requestId) // downstream handlers see c.requestId\n * ```\n *\n * This helper only threads types when the caller pins the input server type - by annotating the\n * parameter as above, or with explicit type arguments. With a bare `(app) => ...` arrow `app` infers as\n * `AnyServer`, which would widen the caller's whole route registry to `any`; that case now returns\n * {@link PluginTypeCollapsed}, so `.use()` fails to compile with one error at the call site rather than\n * producing a typed client full of `any`. Prefer a definer that cannot collapse at all:\n *\n * - adds context via `derive`/`decorate` -> {@link defineContextPlugin}\n * - mounts routes/hooks and adds NO context -> {@link defineRouterPlugin} ({@link defineIdentityPlugin})\n */"
3575
+ },
3576
+ {
3577
+ "name": "DefinePluginResult",
3578
+ "kind": "type",
3579
+ "package": "@nifrajs/core",
3580
+ "signature": "export type DefinePluginResult<In extends AnyServer, Out extends AnyServer> = ServerTypeUnpinned<In> extends true ? PluginTypeCollapsed : NifraPlugin<In, Out>;"
3581
+ },
3582
+ {
3583
+ "name": "DefinePluginResult",
3584
+ "kind": "type",
3585
+ "package": "nifra",
3586
+ "signature": "export type DefinePluginResult<In extends AnyServer, Out extends AnyServer> = ServerTypeUnpinned<In> extends true ? PluginTypeCollapsed : NifraPlugin<In, Out>;"
3587
+ },
3588
+ {
3589
+ "name": "defineReplayFile",
3590
+ "kind": "function",
3591
+ "package": "@nifrajs/core",
3592
+ "signature": "export declare function defineReplayFile(input: Omit<ReplayFile, \"version\">): ReplayFile;"
3163
3593
  },
3164
3594
  {
3165
3595
  "name": "defineRouterPlugin",
@@ -3181,6 +3611,12 @@
3181
3611
  "package": "@nifrajs/core",
3182
3612
  "signature": "export declare function defineSaga<I, C extends Record<string, unknown>>(definition: SagaDefinition<I, C>): SagaDefinition<I, C>;"
3183
3613
  },
3614
+ {
3615
+ "name": "defineTool",
3616
+ "kind": "function",
3617
+ "package": "@nifrajs/core",
3618
+ "signature": "export declare function defineTool<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(options: ToolContractOptions<InferOutput<InputSchema>, InferOutput<OutputSchema>, InputSchema, OutputSchema>): ToolContract<InferOutput<InputSchema>, InferOutput<OutputSchema>>;"
3619
+ },
3184
3620
  {
3185
3621
  "name": "DehydratedState",
3186
3622
  "kind": "interface",
@@ -3286,7 +3722,7 @@
3286
3722
  "name": "devtools",
3287
3723
  "kind": "function",
3288
3724
  "package": "@nifrajs/devtools",
3289
- "signature": "export declare function devtools(options?: DevToolsOptions | undefined): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;"
3725
+ "signature": "export declare function devtools(options?: DevToolsOptions | undefined): import(\"@nifrajs/core\").IdentityPlugin;"
3290
3726
  },
3291
3727
  {
3292
3728
  "name": "DevToolsClientOptions",
@@ -3321,6 +3757,18 @@
3321
3757
  "signature": "export interface DevToolsQuery {\n readonly path?: string | undefined;\n readonly limit?: number | undefined;\n}",
3322
3758
  "doc": "/** Query for a DevTools state snapshot: an optional `path` prefix and a most-recent-`limit`. */"
3323
3759
  },
3760
+ {
3761
+ "name": "diagnostic",
3762
+ "kind": "const",
3763
+ "package": "@nifrajs/cli",
3764
+ "signature": "export declare const diagnostic: (value: Diagnostic) => Diagnostic;"
3765
+ },
3766
+ {
3767
+ "name": "Diagnostic",
3768
+ "kind": "interface",
3769
+ "package": "@nifrajs/cli",
3770
+ "signature": "export interface Diagnostic {\n /** Stable forever. Never renumber or reuse. */\n readonly code: string;\n readonly severity: Severity;\n readonly message: string;\n readonly file?: string;\n readonly line?: number;\n /** Short evidence strings that help an agent act without exposing payloads. */\n readonly evidence?: readonly string[];\n readonly fix?: DiagnosticFix;\n /** Command that proves the fix worked. */\n readonly verify?: string;\n}"
3771
+ },
3324
3772
  {
3325
3773
  "name": "Diagnostic",
3326
3774
  "kind": "interface",
@@ -3335,6 +3783,12 @@
3335
3783
  "signature": "export declare const DIAGNOSTIC_CATALOG: readonly CatalogEntry[];",
3336
3784
  "doc": "/**\n * The recognised-failure catalog. Seeded with the highest-signal nifra failures; extend it as new\n * classes of error earn a stable code. Order matters only in that the first match wins.\n */"
3337
3785
  },
3786
+ {
3787
+ "name": "DiagnosticFix",
3788
+ "kind": "interface",
3789
+ "package": "@nifrajs/cli",
3790
+ "signature": "export interface DiagnosticFix {\n readonly recipe: string;\n readonly command?: string;\n}"
3791
+ },
3338
3792
  {
3339
3793
  "name": "DiagnosticFrame",
3340
3794
  "kind": "interface",
@@ -3376,6 +3830,13 @@
3376
3830
  "package": "@nifrajs/core",
3377
3831
  "signature": "export type DiffSeverity = \"breaking\" | \"compatible\" | \"info\";"
3378
3832
  },
3833
+ {
3834
+ "name": "digestProjectEvidence",
3835
+ "kind": "function",
3836
+ "package": "@nifrajs/core",
3837
+ "signature": "export declare function digestProjectEvidence(snapshot: ProjectEvidenceSnapshot): Promise<string>;",
3838
+ "doc": "/** SHA-256 of the canonical snapshot, useful as a cheap freshness/reference token. */"
3839
+ },
3379
3840
  {
3380
3841
  "name": "disableDraft",
3381
3842
  "kind": "function",
@@ -3422,7 +3883,7 @@
3422
3883
  "name": "durableCommand",
3423
3884
  "kind": "function",
3424
3885
  "package": "@nifrajs/middleware",
3425
- "signature": "export declare function durableCommand(options: DurableCommandOptions): NifraPlugin;",
3886
+ "signature": "export declare function durableCommand(options: DurableCommandOptions): IdentityPlugin;",
3426
3887
  "doc": "/**\n * Journal every capability effect on the routes below it, and declare the evidence that says so.\n *\n * A capability defined `idempotency: \"durable\"` requires `nifra.durable-command` evidence, and until\n * this adapter existed nothing in the framework produced it. The only way to satisfy the tier was to\n * write `assurance: [\"nifra.durable-command\"]` on the route - an assertion with nothing behind it,\n * wrong in both directions: a route that genuinely journals its effects but omits the string fails\n * `nifra check`, and a route that journals nothing but includes it passes.\n *\n * The evidence is a by-product here rather than a claim. Installing the adapter puts the journal on\n * the request, so `executeCapability` records intent before an effect runs and exactly one terminal\n * outcome after - which is what the tier is asking about. A call that passes its own `journal` still\n * uses that one.\n *\n * const commands = durableCommand({ journal: createDurableEffectJournal({ store }) })\n * const app = server().use(commands).post(\"/charge\", { capabilities: [\"billing.charge\"] }, …)\n *\n * `beforeHandle` is order-scoped, like the auth plugins: routes registered before `.use(...)` are not\n * covered, and the `subsequent` scope on the evidence says the same thing to `nifra check`.\n *\n * Note what this does NOT claim. Response replay (`schema.idempotency`) is a different guarantee and\n * deliberately never proves this one: replaying a stored response after a crash mid-effect does not\n * make the effect exactly-once, and the journal is what survives the crash.\n */"
3427
3888
  },
3428
3889
  {
@@ -3571,6 +4032,12 @@
3571
4032
  "signature": "export declare function effectLedger(options: EffectLedgerOptions): IdentityPlugin;",
3572
4033
  "doc": "/**\n * Enable the per-request effect ledger. Each route that declares `schema.capabilities` gets a bounded,\n * token-only ledger; `useCapability(c, id, …)` appends one entry per effect, and the sink receives the\n * sealed ledger when the response settles (only when it recorded entries). Token-only by construction -\n * capability ids, phases, counters, digests; never payloads, values, or the concrete URL (the route\n * pattern is recorded). Without this plugin, capability-declaring routes simply carry no ledger.\n */"
3573
4034
  },
4035
+ {
4036
+ "name": "EffectLedger",
4037
+ "kind": "type",
4038
+ "package": "@nifrajs/testing",
4039
+ "signature": "export type EffectLedger = SealedEffectLedger;"
4040
+ },
3574
4041
  {
3575
4042
  "name": "effectLedgerOf",
3576
4043
  "kind": "function",
@@ -3847,8 +4314,8 @@
3847
4314
  "name": "etag",
3848
4315
  "kind": "function",
3849
4316
  "package": "@nifrajs/middleware",
3850
- "signature": "export declare function etag(options?: ETagOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
3851
- "doc": "/**\n * A {@link definePlugin} 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 */"
4317
+ "signature": "export declare function etag(options?: ETagOptions): import(\"@nifrajs/core\").IdentityPlugin;",
4318
+ "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 */"
3852
4319
  },
3853
4320
  {
3854
4321
  "name": "ETagOptions",
@@ -3856,6 +4323,12 @@
3856
4323
  "package": "@nifrajs/middleware",
3857
4324
  "signature": "export interface ETagOptions {\n /** Emit a weak validator (`W/\"…\"`). Default `true` - it's a content hash, not a byte-for-byte promise. */\n readonly weak?: boolean;\n /** Maximum response bytes to hash. Default `1_000_000`; larger responses pass through unchanged. */\n readonly maxBytes?: number;\n}"
3858
4325
  },
4326
+ {
4327
+ "name": "evaluateBuildFreshness",
4328
+ "kind": "function",
4329
+ "package": "@nifrajs/cli",
4330
+ "signature": "export declare function evaluateBuildFreshness(input: {\n readonly hasArtifact: boolean;\n readonly newestSourceMs: number;\n readonly newestBuildMs: number;\n readonly buildDir?: string;\n}): BuildFreshness;"
4331
+ },
3859
4332
  {
3860
4333
  "name": "evaluateCapabilityAssurance",
3861
4334
  "kind": "function",
@@ -3908,6 +4381,12 @@
3908
4381
  "package": "@nifrajs/events",
3909
4382
  "signature": "export interface EventRegistry {\n readonly contracts: readonly EventContract[];\n /** Look up a contract by type + version (defaults to version 0). */\n get(type: string, version?: number): EventContract | undefined;\n /** Dispatch untrusted input to its contract by `type`/`version` and parse. Never throws. */\n parse(input: unknown): RegistryParseResult;\n}"
3910
4383
  },
4384
+ {
4385
+ "name": "EvidenceBundle",
4386
+ "kind": "interface",
4387
+ "package": "@nifrajs/cli",
4388
+ "signature": "export interface EvidenceBundle {\n readonly version: 1;\n readonly graphDigest: string;\n readonly changedFiles: readonly string[];\n readonly targetLevel: number;\n readonly plan: ProofPlan;\n readonly proofs: readonly ProofEvidence[];\n readonly stop: {\n readonly done: boolean;\n readonly missing: readonly string[];\n readonly next?: ProofStep;\n };\n}"
4389
+ },
3911
4390
  {
3912
4391
  "name": "Example",
3913
4392
  "kind": "interface",
@@ -3936,6 +4415,12 @@
3936
4415
  "signature": "export declare function executeCapability<T>(context: object, capability: string, options: CapabilityExecutionOptions, executor: CapabilityExecutor<T>): Promise<T>;",
3937
4416
  "doc": "/**\n * Execute one owned effect behind a fail-closed capability boundary. The boundary assigns a stable\n * effect id, records intent before execution, and records exactly one terminal outcome automatically.\n * The callback result and errors never enter the token-only ledger.\n */"
3938
4417
  },
4418
+ {
4419
+ "name": "executeTool",
4420
+ "kind": "function",
4421
+ "package": "@nifrajs/core",
4422
+ "signature": "export declare function executeTool<Input, Output>(tool: ToolContract<Input, Output>, input: unknown, options?: ToolCallOptions): Promise<ToolCallResult<Output>>;"
4423
+ },
3939
4424
  {
3940
4425
  "name": "ExecutionContext",
3941
4426
  "kind": "interface",
@@ -3950,6 +4435,48 @@
3950
4435
  "signature": "export interface ExecutionContext {\n waitUntil(promise: Promise<unknown>): void;\n}",
3951
4436
  "doc": "/** A Cloudflare Workers-style execution context (the `fetch` 3rd arg). Structural - only\n * `waitUntil` is used; declared here so `@nifrajs/core` needs no Workers type dependency. */"
3952
4437
  },
4438
+ {
4439
+ "name": "ExecutionFilesystemScope",
4440
+ "kind": "type",
4441
+ "package": "@nifrajs/core",
4442
+ "signature": "export type ExecutionFilesystemScope = \"none\" | \"cwd\" | \"declared\";",
4443
+ "doc": "/** The filesystem access a child process is expected to have. */"
4444
+ },
4445
+ {
4446
+ "name": "ExecutionNetworkAccess",
4447
+ "kind": "type",
4448
+ "package": "@nifrajs/core",
4449
+ "signature": "export type ExecutionNetworkAccess = \"deny\" | \"allow\";",
4450
+ "doc": "/** Network access requested by an execution policy. */"
4451
+ },
4452
+ {
4453
+ "name": "ExecutionPolicy",
4454
+ "kind": "interface",
4455
+ "package": "@nifrajs/agent",
4456
+ "signature": "export interface ExecutionPolicy {\n readonly filesystem: ExecutionFilesystemScope;\n readonly network: ExecutionNetworkAccess;\n readonly timeMs: number;\n readonly capabilityCeiling: readonly string[];\n}",
4457
+ "doc": "/**\n * A public, token-only execution policy. It describes a required capability; it is not an\n * isolation mechanism by itself.\n */"
4458
+ },
4459
+ {
4460
+ "name": "ExecutionPolicy",
4461
+ "kind": "interface",
4462
+ "package": "@nifrajs/core",
4463
+ "signature": "export interface ExecutionPolicy {\n readonly filesystem: ExecutionFilesystemScope;\n readonly network: ExecutionNetworkAccess;\n readonly timeMs: number;\n readonly capabilityCeiling: readonly string[];\n}",
4464
+ "doc": "/**\n * A public, token-only execution policy. It describes a required capability; it is not an\n * isolation mechanism by itself.\n */"
4465
+ },
4466
+ {
4467
+ "name": "ExecutionPolicyAdapter",
4468
+ "kind": "interface",
4469
+ "package": "@nifrajs/agent",
4470
+ "signature": "export interface ExecutionPolicyAdapter {\n readonly name: string;\n canSatisfy(policy: ExecutionPolicy): boolean | PromiseLike<boolean>;\n /** Token-only limitations are suitable for evidence and diagnostics. */\n limitations(policy: ExecutionPolicy): readonly string[];\n}",
4471
+ "doc": "/** An adapter that can prove whether it satisfies a contract's execution policy. */"
4472
+ },
4473
+ {
4474
+ "name": "ExecutionPolicyAdapter",
4475
+ "kind": "interface",
4476
+ "package": "@nifrajs/core",
4477
+ "signature": "export interface ExecutionPolicyAdapter {\n readonly name: string;\n canSatisfy(policy: ExecutionPolicy): boolean | PromiseLike<boolean>;\n /** Token-only limitations are suitable for evidence and diagnostics. */\n limitations(policy: ExecutionPolicy): readonly string[];\n}",
4478
+ "doc": "/** An adapter that can prove whether it satisfies a contract's execution policy. */"
4479
+ },
3953
4480
  {
3954
4481
  "name": "exponentialBackoff",
3955
4482
  "kind": "function",
@@ -4018,6 +4545,43 @@
4018
4545
  "package": "@nifrajs/testing",
4019
4546
  "signature": "export interface FailureScenarioReport {\n readonly name: string;\n readonly ok: boolean;\n readonly replay: FailureReplay;\n readonly evidence: readonly FailureEvidence[];\n /** Sanitized failure identity. Messages and stacks are deliberately excluded. */\n readonly error?: {\n readonly name: string;\n readonly kind?: FailureInjectedError[\"kind\"];\n };\n}"
4020
4547
  },
4548
+ {
4549
+ "name": "FaultProfile",
4550
+ "kind": "interface",
4551
+ "package": "@nifrajs/testing",
4552
+ "signature": "export interface FaultProfile {\n readonly name: string;\n readonly scenarios: readonly FaultProfileScenario[];\n /** Optional trajectory faults consumed by the agent trajectory harness. */\n readonly faults?: readonly FaultProfileFault[];\n /** Existing deterministic failure-lab schedule shared by trajectory runs. */\n readonly schedule?: readonly FailureDirective[];\n}",
4553
+ "doc": "/** A named adapter profile composed from the deterministic failure laboratory. */"
4554
+ },
4555
+ {
4556
+ "name": "FaultProfileFault",
4557
+ "kind": "interface",
4558
+ "package": "@nifrajs/testing",
4559
+ "signature": "export interface FaultProfileFault {\n readonly point: \"model\" | \"tool\" | \"effect\";\n readonly kind: FaultProfileFaultKind;\n readonly occurrence?: number;\n}"
4560
+ },
4561
+ {
4562
+ "name": "FaultProfileFaultKind",
4563
+ "kind": "type",
4564
+ "package": "@nifrajs/testing",
4565
+ "signature": "export type FaultProfileFaultKind = \"tool-error\" | \"malformed-model-output\" | \"budget-pressure\" | \"approval-denial\" | \"cancellation\";"
4566
+ },
4567
+ {
4568
+ "name": "FaultProfileReport",
4569
+ "kind": "interface",
4570
+ "package": "@nifrajs/testing",
4571
+ "signature": "export interface FaultProfileReport {\n readonly name: string;\n readonly ok: boolean;\n readonly scenarios: readonly FaultProfileScenarioReport[];\n}"
4572
+ },
4573
+ {
4574
+ "name": "FaultProfileScenario",
4575
+ "kind": "interface",
4576
+ "package": "@nifrajs/testing",
4577
+ "signature": "export interface FaultProfileScenario extends FailureScenario<unknown> {\n readonly id: string;\n readonly description: string;\n}"
4578
+ },
4579
+ {
4580
+ "name": "FaultProfileScenarioReport",
4581
+ "kind": "interface",
4582
+ "package": "@nifrajs/testing",
4583
+ "signature": "export interface FaultProfileScenarioReport {\n readonly id: string;\n readonly description: string;\n readonly ok: boolean;\n readonly replay: FailureReplay;\n readonly evidence: readonly FailureEvidence[];\n readonly error?: {\n readonly name: string;\n readonly kind?: string;\n };\n}"
4584
+ },
4021
4585
  {
4022
4586
  "name": "FetchApp",
4023
4587
  "kind": "interface",
@@ -4086,6 +4650,13 @@
4086
4650
  "signature": "export type FetchFn = (input: string, init?: RequestInit) => Promise<Response>;",
4087
4651
  "doc": "/**\n * The fetch shape the client needs - looser than `typeof fetch` so an in-process bridge or a\n * test mock satisfies it without the extra members (`.preconnect`, overloads) of the global.\n */"
4088
4652
  },
4653
+ {
4654
+ "name": "FetchHandler",
4655
+ "kind": "interface",
4656
+ "package": "@nifrajs/aws-lambda",
4657
+ "signature": "export interface FetchHandler {\n fetch(request: Request, platform?: LambdaPlatform): Response | Promise<Response>;\n}",
4658
+ "doc": "/** Anything with a fetch-shaped entry point - a nifra `server()` app satisfies this. */"
4659
+ },
4089
4660
  {
4090
4661
  "name": "FetchHandler",
4091
4662
  "kind": "interface",
@@ -4175,6 +4746,12 @@
4175
4746
  "signature": "export declare const fixedBackoff: (ms: number) => Backoff;",
4176
4747
  "doc": "/** Fixed delay before every retry. */"
4177
4748
  },
4749
+ {
4750
+ "name": "FixRecipe",
4751
+ "kind": "interface",
4752
+ "package": "@nifrajs/cli",
4753
+ "signature": "export interface FixRecipe {\n readonly id: string;\n readonly description: string;\n apply(root: string, diagnostic: Diagnostic): Promise<readonly string[]>;\n readonly verify: string;\n}"
4754
+ },
4178
4755
  {
4179
4756
  "name": "FontAsset",
4180
4757
  "kind": "interface",
@@ -4227,6 +4804,12 @@
4227
4804
  "package": "@nifrajs/core",
4228
4805
  "signature": "export interface ForbiddenCapabilityImport {\n /** Exact module specifier, or a trailing `/*` prefix rule. */\n readonly specifier: string;\n readonly reason: string;\n}"
4229
4806
  },
4807
+ {
4808
+ "name": "formatAssuranceReport",
4809
+ "kind": "function",
4810
+ "package": "@nifrajs/cli",
4811
+ "signature": "export declare function formatAssuranceReport(report: AssuranceReport): string;"
4812
+ },
4230
4813
  {
4231
4814
  "name": "formatBytes",
4232
4815
  "kind": "function",
@@ -4255,6 +4838,13 @@
4255
4838
  "signature": "export declare function formatServerOnlyLeak(findings: ReadonlyArray<ServerOnlyFinding>): string | undefined;",
4256
4839
  "doc": "/** The build-failing message for `server-only`-marked modules that reached the client. `undefined` ⇒ clean. */"
4257
4840
  },
4841
+ {
4842
+ "name": "formatStandardIssues",
4843
+ "kind": "function",
4844
+ "package": "@nifrajs/core",
4845
+ "signature": "export declare function formatStandardIssues(issues: ReadonlyArray<StandardIssue>): string;",
4846
+ "doc": "/** Format Standard Schema issues consistently across server and client contract diagnostics. */"
4847
+ },
4258
4848
  {
4259
4849
  "name": "Formatter",
4260
4850
  "kind": "interface",
@@ -4335,6 +4925,12 @@
4335
4925
  "signature": "export declare function fromTypeBox<T extends TSchema>(schema: T, options?: {\n readonly coerce?: boolean;\n}): NifraSchema<T>;",
4336
4926
  "doc": "/**\n * Wrap a TypeBox schema as a `NifraSchema`.\n *\n * **Validation is fast where it can be, and works everywhere.** The first `validate`\n * builds a compiled `TypeCompiler` validator (codegen via `new Function`) and memoizes\n * it - composing schemas (`t.object({ a: t.string() })`) never compiles the inner\n * pieces; only a schema actually used to validate a request pays the one-time codegen\n * cost. On Bun and Node this is the only path and it is untouched.\n *\n * Edge runtimes (Cloudflare Workers, Vercel Edge, Deno Deploy) **forbid dynamic code\n * generation**, so that first compile throws there. We catch it once per schema and\n * fall back to TypeBox's eval-free `Value` checker - same semantics (and same global\n * `FormatRegistry`, so `t.string({ format })` behaves identically), no `new Function`.\n * The branch is decided once and memoized, so the hot path is a single check either way.\n *\n * Exposed (not just used internally by `t`) so a TypeBox schema authored directly can\n * be adapted without leaving the Standard Schema world.\n *\n * `options.coerce` runs TypeBox's `Value.Convert` (string→number/integer/boolean, per the schema)\n * BEFORE validating. Query values always arrive as strings (`?limit=20` → `\"20\"`), so a query schema\n * with a numeric field can't validate without this - it's how `t.pageQuery` yields a real `number`.\n * Leave it OFF (the default) for body/JSON schemas: a JSON number is already a number, and coercing\n * would silently accept `\"20\"` where the contract said `20`.\n */"
4337
4927
  },
4928
+ {
4929
+ "name": "GateResult",
4930
+ "kind": "interface",
4931
+ "package": "@nifrajs/cli",
4932
+ "signature": "export interface GateResult {\n readonly gate: \"check\" | \"doctor\" | \"render\" | \"hydration\" | \"contracts\" | \"size\" | \"tests\" | string;\n readonly status: \"pass\" | \"fail\" | \"skip\";\n readonly skipReason?: string;\n readonly durationMs: number;\n readonly diagnostics: readonly Diagnostic[];\n readonly replay?: string;\n}"
4933
+ },
4338
4934
  {
4339
4935
  "name": "Gauge",
4340
4936
  "kind": "class",
@@ -4392,7 +4988,7 @@
4392
4988
  "name": "generateServerEntry",
4393
4989
  "kind": "function",
4394
4990
  "package": "@nifrajs/web",
4395
- "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n}): string;",
4991
+ "signature": "export declare function generateServerEntry(options: {\n readonly target: BuildTarget;\n /** Import specifier for the module exporting `adapter` (e.g. `\"../framework.ts\"`). */\n readonly adapterImport: string;\n /** Import specifier for the module exporting `backend`, or `undefined` for a frontend-only app. */\n readonly backendImport?: string;\n /** Import specifier for the module exporting `use`, or `undefined`. Must resolve to the\n * same edge-safe module as `adapterImport`. */\n readonly useImport?: string;\n /** Document `<title>` passed to `createWebApp`. */\n readonly title?: string;\n /** Encoded root-relative public file paths copied into the deploy directory. */\n readonly publicFiles?: readonly string[];\n}): string;",
4396
4992
  "doc": "/**\n * Codegen the per-target **server entry** module (source text) for `buildServer` to bundle. It imports\n * the app's `adapter` (from `framework.ts`), the optional `backend` (from `backend.ts`), and the\n * generated `{ manifest, clientEntry }` (from `./server-manifest`), builds `createWebApp`, then wires\n * the right host:\n * - `cf-pages` / `vercel`: `export default` the fetch handler (the platform serves /assets/* itself).\n * - `deno`: same fetch-handler default, plus `Deno.serve` self-host when run directly.\n * - `bun` / `node`: a self-hosting server that ALSO serves the client bundle from disk (those\n * runtimes have a filesystem; the static `/assets/*` sit next to the entry).\n * `adapterImport`/`backendImport` are the specifiers the entry uses (relative to where it's written) -\n * `buildServer` writes the entry next to `serverEntry`, so they're resolved from there. Pure (string in,\n * string out) so the generation is unit-testable without a real build.\n */"
4397
4993
  },
4398
4994
  {
@@ -4443,6 +5039,12 @@
4443
5039
  "signature": "export declare function getContext<C extends Context = Context>(): C;",
4444
5040
  "doc": "/** Return the current request context, or throw when no context-storage wrapper is active. */"
4445
5041
  },
5042
+ {
5043
+ "name": "getFixRecipe",
5044
+ "kind": "function",
5045
+ "package": "@nifrajs/cli",
5046
+ "signature": "export declare function getFixRecipe(id: string): FixRecipe | undefined;"
5047
+ },
4446
5048
  {
4447
5049
  "name": "getSession",
4448
5050
  "kind": "function",
@@ -4468,7 +5070,7 @@
4468
5070
  "name": "GoogleFontOptions",
4469
5071
  "kind": "interface",
4470
5072
  "package": "@nifrajs/web",
4471
- "signature": "export interface GoogleFontOptions {\n /** Family name exactly as Google lists it, e.g. `\"Inter\"`, `\"Open Sans\"`, `\"Roboto Mono\"`. */\n readonly family: string;\n /** Weights to request - numbers (`400`), numeric strings, a variable range (`\"100 900\"`), or the\n * keywords `\"normal\"`/`\"bold\"`. Defaults to `[400]`. */\n readonly weights?: readonly (number | string)[];\n /** Styles to request. Defaults to `[\"normal\"]`. */\n readonly styles?: readonly (\"normal\" | \"italic\")[];\n /** Keep only these named subsets (`\"latin\"`, `\"latin-ext\"`, `\"cyrillic\"`, …). Google returns every\n * subset it has as a separate `@font-face`; this filters to the ones you serve. Defaults to keeping\n * all returned subsets. Ignored when {@link text} is set (glyph subsetting supersedes it). */\n readonly subsets?: readonly string[];\n /** `font-display` strategy for the generated faces. Defaults to `\"swap\"`. */\n readonly display?: FontDisplay;\n /** Glyph subsetting: request only the glyphs needed to render exactly this text (Google's `&text=`).\n * Ideal for a logo/heading font - produces one tiny file. */\n readonly text?: string;\n /** CLS metric overrides forwarded to every generated `@font-face` (the layout-shift fix). */\n readonly sizeAdjust?: string;\n readonly ascentOverride?: string;\n readonly descentOverride?: string;\n readonly lineGapOverride?: string;\n}",
5073
+ "signature": "export interface GoogleFontOptions {\n /** Family name exactly as Google lists it, e.g. `\"Inter\"`, `\"Open Sans\"`, `\"Roboto Mono\"`. */\n readonly family: string;\n /** Weights to request - numbers (`400`), numeric strings, a variable range (`\"100..900\"`, the\n * CSS-style `\"100 900\"` also accepted), or the keywords `\"normal\"`/`\"bold\"`. Defaults to `[400]`. */\n readonly weights?: readonly (number | string)[];\n /** Styles to request. Defaults to `[\"normal\"]`. */\n readonly styles?: readonly (\"normal\" | \"italic\")[];\n /** Keep only these named subsets (`\"latin\"`, `\"latin-ext\"`, `\"cyrillic\"`, …). Google returns every\n * subset it has as a separate `@font-face`; this filters to the ones you serve. Defaults to keeping\n * all returned subsets. Ignored when {@link text} is set (glyph subsetting supersedes it). */\n readonly subsets?: readonly string[];\n /** `font-display` strategy for the generated faces. Defaults to `\"swap\"`. */\n readonly display?: FontDisplay;\n /** Glyph subsetting: request only the glyphs needed to render exactly this text (Google's `&text=`).\n * Ideal for a logo/heading font - produces one tiny file. */\n readonly text?: string;\n /** CLS metric overrides forwarded to every generated `@font-face` (the layout-shift fix). */\n readonly sizeAdjust?: string;\n readonly ascentOverride?: string;\n readonly descentOverride?: string;\n readonly lineGapOverride?: string;\n}",
4472
5074
  "doc": "/** Options describing the Google font to fetch + self-host. */"
4473
5075
  },
4474
5076
  {
@@ -4485,6 +5087,13 @@
4485
5087
  "signature": "export interface GuardOptions {\n readonly redirectTo?: string;\n}",
4486
5088
  "doc": "/** What a guard does when the check fails: 302 to `redirectTo` (a same-origin path), or - omitted - a\n * 401 JSON (`{ ok: false, error: \"unauthorized\" }`). */"
4487
5089
  },
5090
+ {
5091
+ "name": "handle",
5092
+ "kind": "function",
5093
+ "package": "@nifrajs/aws-lambda",
5094
+ "signature": "export declare function handle(app: FetchHandler, options?: LambdaOptions): (event: LambdaEvent, context?: LambdaContext) => Promise<LambdaResult>;",
5095
+ "doc": "/**\n * A buffered Lambda handler for API Gateway HTTP APIs (payload v2) and Function URLs.\n *\n * ```ts\n * import { handle } from \"@nifrajs/aws-lambda\"\n * import { app } from \"./app.js\" // built once per container, at module scope\n *\n * export const handler = handle(app)\n * ```\n */"
5096
+ },
4488
5097
  {
4489
5098
  "name": "handleMcpHttp",
4490
5099
  "kind": "function",
@@ -4538,7 +5147,7 @@
4538
5147
  "name": "healthcheck",
4539
5148
  "kind": "function",
4540
5149
  "package": "@nifrajs/middleware",
4541
- "signature": "export declare function healthcheck(options?: HealthcheckOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
5150
+ "signature": "export declare function healthcheck(options?: HealthcheckOptions): IdentityPlugin;",
4542
5151
  "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 */"
4543
5152
  },
4544
5153
  {
@@ -4589,6 +5198,13 @@
4589
5198
  "signature": "export type HtmlValue = string | number | bigint | boolean | null | undefined | Template | RawHtml | ReadonlyArray<HtmlValue>;",
4590
5199
  "doc": "/** What an interpolation may be: escaped primitives, nested templates/raw, arrays of the same.\n * `null`/`undefined`/`false` render as nothing (conditional rendering: `cond && html\\`…\\``). */"
4591
5200
  },
5201
+ {
5202
+ "name": "httpToolAdapter",
5203
+ "kind": "function",
5204
+ "package": "@nifrajs/testing",
5205
+ "signature": "export declare function httpToolAdapter<Input, Output>(tool: ToolContract<Input, Output>, baseOptions?: Omit<ToolCallOptions, \"signal\" | \"ledger\">): ToolAdapter;",
5206
+ "doc": "/** Exercise the Web adapter while returning the same normalized result shape as direct calls. */"
5207
+ },
4592
5208
  {
4593
5209
  "name": "hydrate",
4594
5210
  "kind": "function",
@@ -4600,8 +5216,7 @@
4600
5216
  "name": "hydrate",
4601
5217
  "kind": "function",
4602
5218
  "package": "@nifrajs/web-react",
4603
- "signature": "export declare function hydrate(chain: readonly unknown[], props: RenderProps, container: unknown): void;",
4604
- "doc": "/** Hydrate a server-rendered React layout `chain` (with the loader `props`) inside `container`. */"
5219
+ "signature": "export declare function hydrate(chain: readonly unknown[], props: RenderProps, container: unknown, options?: HydrationAssuranceOptions): void;"
4605
5220
  },
4606
5221
  {
4607
5222
  "name": "hydrate",
@@ -4614,14 +5229,54 @@
4614
5229
  "name": "hydrate",
4615
5230
  "kind": "function",
4616
5231
  "package": "@nifrajs/web-svelte",
4617
- "signature": "export declare function hydrate(chain: readonly unknown[], props: RenderProps, container: unknown): void;",
4618
- "doc": "/** Hydrate a server-rendered Svelte layout `chain` (with the loader `props`) inside `container`. */"
5232
+ "signature": "export declare function hydrate(chain: readonly unknown[], props: RenderProps, container: unknown, options?: HydrationAssuranceOptions): void;"
4619
5233
  },
4620
5234
  {
4621
5235
  "name": "hydrate",
4622
5236
  "kind": "function",
4623
5237
  "package": "@nifrajs/web-vue",
4624
- "signature": "export declare function hydrate(chain: readonly unknown[], props: RenderProps, container: unknown): void;",
5238
+ "signature": "export declare function hydrate(chain: readonly unknown[], props: RenderProps, container: unknown, options?: HydrationAssuranceOptions): void;"
5239
+ },
5240
+ {
5241
+ "name": "hydrationAssuranceHook",
5242
+ "kind": "const",
5243
+ "package": "@nifrajs/web-react",
5244
+ "signature": "export declare const hydrationAssuranceHook: Readonly<{\n framework: \"react\";\n runtimeIdentity: () => object;\n}>;",
5245
+ "doc": "/** Testing hook used by verification runners to observe React's recoverable errors and identity. */"
5246
+ },
5247
+ {
5248
+ "name": "hydrationAssuranceHook",
5249
+ "kind": "const",
5250
+ "package": "@nifrajs/web-svelte",
5251
+ "signature": "export declare const hydrationAssuranceHook: Readonly<{\n framework: \"svelte\";\n runtimeIdentity: () => object;\n}>;",
5252
+ "doc": "/** Testing hook used by verification runners to observe Svelte warnings and identity. */"
5253
+ },
5254
+ {
5255
+ "name": "hydrationAssuranceHook",
5256
+ "kind": "const",
5257
+ "package": "@nifrajs/web-vue",
5258
+ "signature": "export declare const hydrationAssuranceHook: Readonly<{\n framework: \"vue\";\n runtimeIdentity: () => object;\n}>;",
5259
+ "doc": "/** Testing hook used by verification runners to observe Vue warnings and identity. */"
5260
+ },
5261
+ {
5262
+ "name": "HydrationAssuranceOptions",
5263
+ "kind": "interface",
5264
+ "package": "@nifrajs/web-react",
5265
+ "signature": "export interface HydrationAssuranceOptions {\n readonly onRecoverableError?: (error: unknown, info?: unknown) => void;\n}",
5266
+ "doc": "/** Hydrate a server-rendered React layout `chain` (with the loader `props`) inside `container`. */"
5267
+ },
5268
+ {
5269
+ "name": "HydrationAssuranceOptions",
5270
+ "kind": "interface",
5271
+ "package": "@nifrajs/web-svelte",
5272
+ "signature": "export interface HydrationAssuranceOptions {\n readonly onWarning?: (message: string) => void;\n}",
5273
+ "doc": "/** Hydrate a server-rendered Svelte layout `chain` (with the loader `props`) inside `container`. */"
5274
+ },
5275
+ {
5276
+ "name": "HydrationAssuranceOptions",
5277
+ "kind": "interface",
5278
+ "package": "@nifrajs/web-vue",
5279
+ "signature": "export interface HydrationAssuranceOptions {\n readonly onWarning?: (message: string) => void;\n}",
4625
5280
  "doc": "/** Hydrate a server-rendered Vue layout `chain` (with the loader `props`) inside `container`. */"
4626
5281
  },
4627
5282
  {
@@ -4694,7 +5349,8 @@
4694
5349
  "name": "idempotency",
4695
5350
  "kind": "function",
4696
5351
  "package": "@nifrajs/middleware",
4697
- "signature": "export declare function idempotency(options: IdempotencyOptions): Middleware;"
5352
+ "signature": "export declare function idempotency(options: IdempotencyOptions): Middleware;",
5353
+ "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 * Caching buffers the response body, so apply this to JSON/API routes, not streaming SSR responses.\n */"
4698
5354
  },
4699
5355
  {
4700
5356
  "name": "IdempotencyAbandonInput",
@@ -4727,6 +5383,12 @@
4727
5383
  "package": "@nifrajs/core",
4728
5384
  "signature": "export interface IdempotencyCompletionInput extends IdempotencyEntryKey {\n /** Opaque ownership token returned by `begin(state:\"new\")`. */\n readonly reservation: string;\n readonly response: StoredResponse;\n}"
4729
5385
  },
5386
+ {
5387
+ "name": "IdempotencyDivergence",
5388
+ "kind": "interface",
5389
+ "package": "@nifrajs/testing",
5390
+ "signature": "export interface IdempotencyDivergence {\n readonly step: number;\n readonly field: string;\n readonly first: unknown;\n readonly second: unknown;\n}"
5391
+ },
4730
5392
  {
4731
5393
  "name": "IdempotencyEntryKey",
4732
5394
  "kind": "interface",
@@ -4738,7 +5400,7 @@
4738
5400
  "name": "IdempotencyOptions",
4739
5401
  "kind": "interface",
4740
5402
  "package": "@nifrajs/middleware",
4741
- "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 /** Whether a response should be cached for replay. Default: status `< 500` (don't replay transient 5xx). */\n readonly shouldCache?: (response: Response) => boolean;\n /**\n * Derive the store key from the request. Default: the `header` value **scoped by method + path**, so the\n * same key on a different endpoint can't collide. Return a **principal-scoped** key (e.g.\n * `` `${userId}:${req.headers.get(\"idempotency-key\")}` ``) so one user can't replay another's stored\n * response on a shared key. Return `null`/`\"\"` to skip dedupe for this request.\n */\n readonly key?: (req: Request, header: string) => string | null;\n}"
5403
+ "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 /** Whether a response should be cached for replay. Default: status `< 500` (don't replay transient 5xx). */\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 readonly principalHeaders?: readonly string[];\n}"
4742
5404
  },
4743
5405
  {
4744
5406
  "name": "IdempotencyPluginOptions",
@@ -4747,6 +5409,12 @@
4747
5409
  "signature": "export interface IdempotencyPluginOptions {\n readonly store?: IdempotencyStore | undefined;\n}",
4748
5410
  "doc": "/**\n * Enable request idempotency. Routes that declare `schema.idempotency` get the dedupe lane: a repeat\n * `Idempotency-Key` replays the stored response instead of re-running the handler. Without this plugin,\n * declaring `schema.idempotency` is a registration error (the safety gate can never be silently\n * dropped). `store` is the app-wide default backing routes that do not pin their own; omit it for a\n * shared in-process store (development/tests only - inject a durable store in production).\n */"
4749
5411
  },
5412
+ {
5413
+ "name": "IdempotencyProof",
5414
+ "kind": "interface",
5415
+ "package": "@nifrajs/testing",
5416
+ "signature": "export interface IdempotencyProof {\n readonly ok: boolean;\n readonly divergences: readonly IdempotencyDivergence[];\n}"
5417
+ },
4750
5418
  {
4751
5419
  "name": "IdempotencyRecord",
4752
5420
  "kind": "interface",
@@ -4781,6 +5449,12 @@
4781
5449
  "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 and release the lock (kept for `ttlMs`). */\n complete(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;\n /** Release the lock without storing (handler errored / response not cacheable). */\n release(key: string): Promise<void>;\n}",
4782
5450
  "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 */"
4783
5451
  },
5452
+ {
5453
+ "name": "IdempotencyWorkload",
5454
+ "kind": "interface",
5455
+ "package": "@nifrajs/core",
5456
+ "signature": "export interface IdempotencyWorkload {\n readonly name: string;\n readonly run: () => Promise<SealedEffectLedger> | SealedEffectLedger;\n}"
5457
+ },
4784
5458
  {
4785
5459
  "name": "IDEMPOTENT_REPLAY_HEADER",
4786
5460
  "kind": "const",
@@ -4899,7 +5573,7 @@
4899
5573
  "name": "ImageHandlerOptions",
4900
5574
  "kind": "interface",
4901
5575
  "package": "@nifrajs/image",
4902
- "signature": "export interface ImageHandlerOptions {\n /** Codec backend. Default: {@link bunImageBackend} (requires the Bun runtime). */\n readonly backend?: ImageBackend;\n /** Absolute directory that local (path) sources resolve under. Path-traversal- and symlink-guarded.\n * Omit to **disable local sources** (every path source → 403). */\n readonly root?: string;\n /** Exact origins (`https://cdn.example`) allowed for remote sources. Omitted/empty ⇒ **no remote\n * sources** (fail-closed against SSRF). Only `http:`/`https:` URLs are ever considered. */\n readonly allowedOrigins?: readonly string[];\n /** Max bytes read from a source before rejecting (413). Default 20 MiB. */\n readonly maxSourceBytes?: number;\n /** Max source pixels (w×h) before rejecting (413) - decompression-bomb guard. Default 40 MP. */\n readonly maxSourcePixels?: number;\n /** Hard cap on the requested width; larger `?w` is clamped down. Default 3840. */\n readonly maxWidth?: number;\n /** Max concurrent transforms (codec work is CPU/memory-heavy). Excess requests queue. Default 4. */\n readonly concurrency?: number;\n /** `Cache-Control: public, max-age=<n>, immutable` seconds. Default 1 year. */\n readonly cacheMaxAge?: number;\n /** Quality used when `?q` is absent. Default 75. */\n readonly defaultQuality?: number;\n /** Remote-fetch timeout (ms). Default 10 000. */\n readonly fetchTimeoutMs?: number;\n /** `fetch` implementation for remote sources (injectable for custom timeouts/proxy and for tests).\n * Default: the global `fetch`. */\n readonly fetch?: typeof fetch;\n /** Require **signed URLs**: every request must carry a valid `&s=` HMAC over `(src, w, q[, exp])` or\n * it's rejected with `403`. Use the SAME `secret` as your `selfHostedLoader`/`signImageUrl`. This\n * locks the endpoint to URLs your app minted - the defense against resize-bombing. */\n readonly signing?: {\n readonly secret: string;\n };\n}"
5576
+ "signature": "export interface ImageHandlerOptions {\n /** Codec backend. Default: {@link bunImageBackend} (requires the Bun runtime). */\n readonly backend?: ImageBackend;\n /** Absolute directory that local (path) sources resolve under. Path-traversal- and symlink-guarded.\n * Omit to **disable local sources** (every path source → 403). */\n readonly root?: string;\n /** Exact origins (`https://cdn.example`) allowed for remote sources. Omitted/empty ⇒ **no remote\n * sources** (fail-closed against SSRF). Only `http:`/`https:` URLs are ever considered. */\n readonly allowedOrigins?: readonly string[];\n /** Max bytes read from a source before rejecting (413). Default 20 MiB. */\n readonly maxSourceBytes?: number;\n /** Max source pixels (w×h) before rejecting (413) - decompression-bomb guard. Default 40 MP. */\n readonly maxSourcePixels?: number;\n /** Hard cap on the requested width; larger `?w` is clamped down. Default 3840. */\n readonly maxWidth?: number;\n /** Max concurrent transforms (codec work is CPU/memory-heavy). Excess requests queue. Default 4. */\n readonly concurrency?: number;\n /**\n * Max requests reading a source at once - the admission width. Sized above `concurrency` on purpose:\n * a remote source is network-bound, and holding a codec slot across a 10s fetch would let a handful\n * of slow origins idle the CPU lane out entirely. Default `concurrency * 2`.\n *\n * This is also the memory bound: at most this many source buffers exist at once, so the ceiling is\n * `sourceConcurrency * maxSourceBytes` (default 8 x 20 MiB = 160 MiB) plus the codec's own working\n * set. Lower it, or `maxSourceBytes`, on a small instance.\n */\n readonly sourceConcurrency?: number;\n /** Maximum queued image requests beyond the admission width. Default `concurrency * 16`. */\n readonly maxQueue?: number;\n /** `Cache-Control: public, max-age=<n>, immutable` seconds. Default 1 year. */\n readonly cacheMaxAge?: number;\n /** Quality used when `?q` is absent. Default 75. */\n readonly defaultQuality?: number;\n /** Remote-fetch timeout (ms). Default 10 000. */\n readonly fetchTimeoutMs?: number;\n /** `fetch` implementation for remote sources (injectable for custom timeouts/proxy and for tests).\n * Default: the global `fetch`. */\n readonly fetch?: typeof fetch;\n /** Require **signed URLs**: every request must carry a valid `&s=` HMAC over `(src, w, q[, exp])` or\n * it's rejected with `403`. Use the SAME `secret` as your `selfHostedLoader`/`signImageUrl`. This\n * locks the endpoint to URLs your app minted - the defense against resize-bombing. */\n readonly signing?: {\n readonly secret: string;\n };\n}"
4903
5577
  },
4904
5578
  {
4905
5579
  "name": "ImageInfo",
@@ -4941,6 +5615,12 @@
4941
5615
  "signature": "export interface ImageReencoder {\n probe(bytes: Uint8Array): Promise<{\n readonly width: number;\n readonly height: number;\n readonly format: string;\n }>;\n transform(input: {\n readonly bytes: Uint8Array;\n readonly width: number;\n readonly quality: number;\n readonly format: StripFormat;\n }): Promise<{\n readonly bytes: Uint8Array;\n }>;\n}",
4942
5616
  "doc": "/** The slice of `@nifrajs/image`'s `ImageBackend` this needs - `probe` for dims/format, `transform` to re-encode. */"
4943
5617
  },
5618
+ {
5619
+ "name": "ImpactReport",
5620
+ "kind": "interface",
5621
+ "package": "@nifrajs/cli",
5622
+ "signature": "export interface ImpactReport {\n readonly changedFiles: readonly string[];\n readonly impactedNodes: readonly string[];\n readonly impactedRoutes: readonly string[];\n}"
5623
+ },
4944
5624
  {
4945
5625
  "name": "implement",
4946
5626
  "kind": "function",
@@ -5050,8 +5730,7 @@
5050
5730
  "name": "inProcessClient",
5051
5731
  "kind": "function",
5052
5732
  "package": "@nifrajs/client",
5053
- "signature": "export declare function inProcessClient<App extends {\n fetch(request: Request): Response | Promise<Response>;\n}>(app: App, options?: InProcessClientOptions): InProcessClient<App>;",
5054
- "doc": "/**\n * A {@link client} whose `fetch` calls a nifra app's own `fetch` in-process - no network, full\n * lifecycle (validation, middleware, contracts). For SSR loaders. Typed from `App` exactly like\n * the network client. The `(url, init) → Request` bridge is required because the client calls\n * `fetch(url, init)` while `app.fetch` takes a `Request`.\n *\n * The returned proxy also implements the explicit symbol-keyed {@link BackendMount} interface, so\n * `createWebApp({ api: inProcessClient(backend) })` can auto-mount the backend while forwarding the\n * outer runtime's `env` and `waitUntil`.\n */"
5733
+ "signature": "export declare function inProcessClient<App extends {\n fetch(request: Request): Response | Promise<Response>;\n}>(app: App, options?: InProcessClientOptions): InProcessClient<App>;"
5055
5734
  },
5056
5735
  {
5057
5736
  "name": "InProcessClient",
@@ -5066,6 +5745,18 @@
5066
5745
  "package": "@nifrajs/client",
5067
5746
  "signature": "export interface InProcessClientOptions extends Omit<ClientOptions, \"fetch\"> {\n /**\n * Assert every JSON response against the route's declared contract - `schema.response` for 2xx,\n * `schema.errors[status]` for declared failures - and THROW on mismatch, so a handler whose real\n * output drifts from its schema fails the test instead of passing silently. Statuses with no\n * declared schema, non-JSON bodies, and 204/205/HEAD pass through unchecked. Test-focused: the\n * check parses a clone of each JSON body, a cost that belongs in tests, not production hot paths.\n */\n readonly validateResponses?: boolean;\n}"
5068
5747
  },
5748
+ {
5749
+ "name": "inProcessToolAdapter",
5750
+ "kind": "function",
5751
+ "package": "@nifrajs/testing",
5752
+ "signature": "export declare function inProcessToolAdapter<Input, Output>(tool: ToolContract<Input, Output>, baseOptions?: ToolCallOptions): ToolAdapter;"
5753
+ },
5754
+ {
5755
+ "name": "inspectBuildFreshness",
5756
+ "kind": "function",
5757
+ "package": "@nifrajs/cli",
5758
+ "signature": "export declare function inspectBuildFreshness(cwd: string): Promise<BuildFreshness>;"
5759
+ },
5069
5760
  {
5070
5761
  "name": "installForms",
5071
5762
  "kind": "function",
@@ -5467,7 +6158,7 @@
5467
6158
  "name": "JwtPlugin",
5468
6159
  "kind": "type",
5469
6160
  "package": "@nifrajs/middleware",
5470
- "signature": "export type JwtPlugin<C extends JwtClaims = JwtClaims> = NifraPlugin & {\n claims(request: Request): C | null;\n requireClaims(request: Request): C;\n};"
6161
+ "signature": "export type JwtPlugin<C extends JwtClaims = JwtClaims> = IdentityPlugin & {\n claims(request: Request): C | null;\n requireClaims(request: Request): C;\n};"
5471
6162
  },
5472
6163
  {
5473
6164
  "name": "JwtVerificationKey",
@@ -5509,6 +6200,27 @@
5509
6200
  "signature": "export declare class KVSessionStore implements SessionStore {\n private readonly kv;\n constructor(kv: KVNamespaceLike);\n get(id: string): Promise<SessionRecord | undefined>;\n set(id: string, record: SessionRecord): Promise<void>;\n delete(id: string): Promise<void>;\n}",
5510
6201
  "doc": "/**\n * A {@link SessionStore} backed by a **Cloudflare Workers KV** namespace (or any {@link KVNamespaceLike})\n * - the durable, shared production store: sessions hold across worker instances and survive restarts.\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 */"
5511
6202
  },
6203
+ {
6204
+ "name": "LambdaContext",
6205
+ "kind": "interface",
6206
+ "package": "@nifrajs/aws-lambda",
6207
+ "signature": "export interface LambdaContext {\n readonly awsRequestId?: string;\n readonly functionName?: string;\n readonly [key: string]: unknown;\n}",
6208
+ "doc": "/** The Lambda invocation context. The adapter only forwards it; declare fields structurally. */"
6209
+ },
6210
+ {
6211
+ "name": "LambdaEnv",
6212
+ "kind": "interface",
6213
+ "package": "@nifrajs/aws-lambda",
6214
+ "signature": "export interface LambdaEnv {\n readonly event: LambdaEvent;\n readonly context: LambdaContext | undefined;\n}",
6215
+ "doc": "/** What handlers see as `c.env` (declare your app as `server<LambdaEnv>()` for typed access). */"
6216
+ },
6217
+ {
6218
+ "name": "LambdaEvent",
6219
+ "kind": "interface",
6220
+ "package": "@nifrajs/aws-lambda",
6221
+ "signature": "export interface LambdaEvent {\n readonly rawPath?: string;\n readonly rawQueryString?: string;\n readonly headers?: Readonly<Record<string, string | undefined>>;\n /** Payload v2 delivers cookies here, not in `headers` - this array is the canonical source. */\n readonly cookies?: readonly string[];\n readonly body?: string | null;\n readonly isBase64Encoded?: boolean;\n readonly requestContext?: {\n readonly domainName?: string;\n readonly http?: {\n readonly method?: string;\n readonly sourceIp?: string;\n };\n };\n}",
6222
+ "doc": "/**\n * The slice of an API Gateway HTTP API / Function URL payload-v2 event the adapter reads.\n * Extra fields pass through untouched on `c.env.event`.\n */"
6223
+ },
5512
6224
  {
5513
6225
  "name": "LambdaEvent",
5514
6226
  "kind": "type",
@@ -5533,6 +6245,19 @@
5533
6245
  "package": "nifra",
5534
6246
  "signature": "export type LambdaHandler = (event: LambdaEvent, context?: unknown) => Promise<LambdaResponse>;"
5535
6247
  },
6248
+ {
6249
+ "name": "LambdaOptions",
6250
+ "kind": "interface",
6251
+ "package": "@nifrajs/aws-lambda",
6252
+ "signature": "export interface LambdaOptions {\n /**\n * Reject request bodies whose *decoded* size exceeds this many bytes with a flat 413 before a\n * `Request` is constructed. Defaults to 1,000,000 (nifra core's default). Set it to match your\n * app's `maxBodyBytes` if you customized that.\n */\n readonly maxBodyBytes?: number;\n}"
6253
+ },
6254
+ {
6255
+ "name": "LambdaPlatform",
6256
+ "kind": "interface",
6257
+ "package": "@nifrajs/aws-lambda",
6258
+ "signature": "export interface LambdaPlatform {\n readonly env: LambdaEnv;\n readonly clientIp?: string | undefined;\n readonly waitUntil?: (promise: Promise<unknown>) => void;\n}",
6259
+ "doc": "/** Platform fields the adapter feeds into `app.fetch` (mirrors nifra core's `Platform`). */"
6260
+ },
5536
6261
  {
5537
6262
  "name": "LambdaResponse",
5538
6263
  "kind": "type",
@@ -5545,6 +6270,13 @@
5545
6270
  "package": "nifra",
5546
6271
  "signature": "export type LambdaResponse = PlatformResponse;"
5547
6272
  },
6273
+ {
6274
+ "name": "LambdaResult",
6275
+ "kind": "interface",
6276
+ "package": "@nifrajs/aws-lambda",
6277
+ "signature": "export interface LambdaResult {\n statusCode: number;\n headers: Record<string, string>;\n /** `Set-Cookie` values travel here (payload v2), one entry per cookie - never comma-joined. */\n cookies?: string[];\n body: string;\n isBase64Encoded: boolean;\n}",
6278
+ "doc": "/** A payload-v2 result object, as API Gateway and Function URLs consume it. */"
6279
+ },
5548
6280
  {
5549
6281
  "name": "LambdaV1Event",
5550
6282
  "kind": "interface",
@@ -5573,8 +6305,8 @@
5573
6305
  "name": "language",
5574
6306
  "kind": "function",
5575
6307
  "package": "@nifrajs/middleware",
5576
- "signature": "export declare function language<const L extends readonly string[]>(options: LanguageOptions<L>): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").Server<any, any>>;",
5577
- "doc": "/**\n * Derives `c.language` from `Accept-Language` and emits `Content-Language` by default.\n */"
6308
+ "signature": "export declare function language<const L extends readonly string[]>(options: LanguageOptions<L>): ContextPlugin<{\n language: L[number];\n languageMatch: LanguageMatch;\n}>;",
6309
+ "doc": "/**\n * Derives `c.language` from `Accept-Language` and emits `Content-Language` by default.\n *\n * Header-only by design. For the full detector - `?lang=` query parameter → cookie →\n * `Accept-Language`, with optional cookie persistence - use `localeDetector()` from\n * `@nifrajs/i18n/detector`; use one or the other, not both.\n */"
5578
6310
  },
5579
6311
  {
5580
6312
  "name": "LanguageMatch",
@@ -5600,7 +6332,7 @@
5600
6332
  "kind": "const",
5601
6333
  "package": "@nifrajs/web",
5602
6334
  "signature": "export declare const LAYOUT_DATA_GLOBAL = \"__NIFRA_LAYOUT_DATA__\";",
5603
- "doc": "/** Per-layout loader data for hydration. Emitted ONLY when some layout in the chain has a loader, so\n * a page-only app's HTML is byte-identical to before layout loaders existed. */"
6335
+ "doc": "/** Per-layout loader data for hydration. */"
5604
6336
  },
5605
6337
  {
5606
6338
  "name": "LayoutEntry",
@@ -5623,6 +6355,20 @@
5623
6355
  "signature": "export type LedgerSink = (ledger: SealedEffectLedger) => void | Promise<void>;",
5624
6356
  "doc": "/**\n * Receives each sealed ledger once per request (only when it has entries). Implementations must not\n * assume a payload: the ledger is token-only. A durable/tenant-scoped sink lives behind this seam.\n */"
5625
6357
  },
6358
+ {
6359
+ "name": "LegacyContractReplayFile",
6360
+ "kind": "interface",
6361
+ "package": "@nifrajs/core",
6362
+ "signature": "export interface LegacyContractReplayFile {\n readonly seed: number;\n readonly caseId: string;\n readonly runtime: string;\n}",
6363
+ "doc": "/** Existing adversarial contract replay metadata. Kept as a compatibility envelope. */"
6364
+ },
6365
+ {
6366
+ "name": "LegacyFailureReplayFile",
6367
+ "kind": "interface",
6368
+ "package": "@nifrajs/core",
6369
+ "signature": "export interface LegacyFailureReplayFile {\n readonly seed: number;\n readonly schedule: readonly Record<string, unknown>[];\n}",
6370
+ "doc": "/** Existing deterministic failure-lab replay metadata. Kept as a compatibility envelope. */"
6371
+ },
5626
6372
  {
5627
6373
  "name": "Link",
5628
6374
  "kind": "const",
@@ -5644,12 +6390,24 @@
5644
6390
  "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}",
5645
6391
  "doc": "/** {@link Link} props: every `<a>` attribute except `href` (set from `to`), plus `to` + `replace`. */"
5646
6392
  },
6393
+ {
6394
+ "name": "listFixRecipes",
6395
+ "kind": "function",
6396
+ "package": "@nifrajs/cli",
6397
+ "signature": "export declare function listFixRecipes(): readonly FixRecipe[];"
6398
+ },
5647
6399
  {
5648
6400
  "name": "ListOptions",
5649
6401
  "kind": "interface",
5650
6402
  "package": "@nifrajs/storage",
5651
6403
  "signature": "export interface ListOptions {\n /** Only keys starting with this prefix. */\n readonly prefix?: string;\n /** Cap the number of keys returned. */\n readonly limit?: number;\n}"
5652
6404
  },
6405
+ {
6406
+ "name": "loadAssuranceConfig",
6407
+ "kind": "function",
6408
+ "package": "@nifrajs/cli",
6409
+ "signature": "export declare function loadAssuranceConfig(cwd: string, configPath?: string): Promise<AssuranceConfig>;"
6410
+ },
5653
6411
  {
5654
6412
  "name": "Loader",
5655
6413
  "kind": "type",
@@ -5697,12 +6455,83 @@
5697
6455
  "package": "@nifrajs/web",
5698
6456
  "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}"
5699
6457
  },
6458
+ {
6459
+ "name": "LOCAL_PROCESS_LIMITATION",
6460
+ "kind": "const",
6461
+ "package": "@nifrajs/agent",
6462
+ "signature": "export declare const LOCAL_PROCESS_LIMITATION = \"The local adapter is NOT a security boundary.\";",
6463
+ "doc": "/** This statement is intentionally repeated in the API and runtime result. */"
6464
+ },
5700
6465
  {
5701
6466
  "name": "Locale",
5702
6467
  "kind": "type",
5703
6468
  "package": "@nifrajs/i18n",
5704
6469
  "signature": "export type Locale = string;",
5705
- "doc": "/**\n * Locale negotiation - pick the best supported locale for a request, from (in priority order) an\n * explicit cookie, then the `Accept-Language` header (quality-ranked, with a base-tag fallback so\n * `fr-CA` matches a supported `fr`). Pure + runtime-agnostic.\n */"
6470
+ "doc": "/**\n * Locale negotiation - pick the best supported locale for a request, from (in priority order) an\n * explicit query parameter, then a cookie, then the `Accept-Language` header (quality-ranked, with\n * a base-tag fallback so `fr-CA` matches a supported `fr`). Pure + runtime-agnostic. The result is\n * always a member of the configured `locales` allow-list (or `defaultLocale`): request input is\n * *matched against* the list, never echoed back - so a hostile `?lang=` or header value cannot\n * reach the response. Parsing is split-based and linear; no regex runs on request input.\n */"
6471
+ },
6472
+ {
6473
+ "name": "LocaleContext",
6474
+ "kind": "interface",
6475
+ "package": "@nifrajs/i18n",
6476
+ "signature": "export interface LocaleContext {\n /** The negotiated locale - always one of the configured `locales`. */\n readonly locale: Locale;\n readonly localeSource: LocaleSource;\n}",
6477
+ "doc": "/** Context added by {@link localeDetector}. */"
6478
+ },
6479
+ {
6480
+ "name": "localeDetector",
6481
+ "kind": "function",
6482
+ "package": "@nifrajs/i18n",
6483
+ "signature": "export declare function localeDetector(options: LocaleDetectorOptions): import(\"@nifrajs/core\").ContextPlugin<LocaleContext>;",
6484
+ "doc": "/**\n * Detect the request's locale and expose it as `c.locale` / `c.localeSource`.\n *\n * ```ts\n * import { localeDetector } from \"@nifrajs/i18n/detector\"\n *\n * app.use(\n * localeDetector({\n * locales: [\"en\", \"fr\", \"de\"],\n * defaultLocale: \"en\",\n * queryParam: \"lang\",\n * cookie: \"locale\",\n * persist: true,\n * }),\n * ).get(\"/\", (c) => c.json({ locale: c.locale }))\n * ```\n */"
6485
+ },
6486
+ {
6487
+ "name": "LocaleDetectorOptions",
6488
+ "kind": "interface",
6489
+ "package": "@nifrajs/i18n",
6490
+ "signature": "export interface LocaleDetectorOptions extends NegotiateOptions {\n /** Persist a `queryParam` choice into the locale cookie when it differs from the cookie's current\n * value. Requires both `queryParam` and `cookie`. Default `false`. */\n readonly persist?: boolean;\n /** `Max-Age` (seconds) of the persisted cookie. Default one year. */\n readonly cookieMaxAge?: number;\n /** Emit `Content-Language` (kept if already set by the handler). Default `true`. */\n readonly header?: boolean;\n}"
6491
+ },
6492
+ {
6493
+ "name": "LocaleParts",
6494
+ "kind": "interface",
6495
+ "package": "@nifrajs/i18n",
6496
+ "signature": "export interface LocaleParts {\n readonly header: (name: string) => string | null;\n readonly url?: string;\n readonly query?: URLSearchParams;\n}",
6497
+ "doc": "/**\n * The slice of a request the negotiation reads. Pass a `Request`, or this structural shape where no\n * `Request` object exists (e.g. inside an `onResponseHeaders` hook, which sees only `url` +\n * `header`). `query`/`url` are consulted only when `queryParam` is configured; an already-parsed\n * `query` is preferred over slicing `url`.\n */"
6498
+ },
6499
+ {
6500
+ "name": "LocaleSource",
6501
+ "kind": "type",
6502
+ "package": "@nifrajs/i18n",
6503
+ "signature": "export type LocaleSource = \"query\" | \"cookie\" | \"header\" | \"default\";",
6504
+ "doc": "/** Which source produced the locale, in priority order. */"
6505
+ },
6506
+ {
6507
+ "name": "LocalProcessAdapter",
6508
+ "kind": "interface",
6509
+ "package": "@nifrajs/agent",
6510
+ "signature": "export interface LocalProcessAdapter extends ExecutionPolicyAdapter {\n run(request: LocalProcessRequest): Promise<LocalProcessResult>;\n}"
6511
+ },
6512
+ {
6513
+ "name": "LocalProcessAdapterOptions",
6514
+ "kind": "interface",
6515
+ "package": "@nifrajs/agent",
6516
+ "signature": "export interface LocalProcessAdapterOptions {\n readonly cwd?: string;\n /** Only these inherited environment names are copied. Default: PATH, LANG, and LC_ALL. */\n readonly envAllowlist?: readonly string[];\n readonly maxOutputBytes?: number;\n}"
6517
+ },
6518
+ {
6519
+ "name": "LocalProcessPolicyError",
6520
+ "kind": "class",
6521
+ "package": "@nifrajs/agent",
6522
+ "signature": "export declare class LocalProcessPolicyError extends Error {\n readonly code: \"policy_unsatisfied\" | \"invalid_request\" | \"cancelled\";\n constructor(code: \"policy_unsatisfied\" | \"invalid_request\" | \"cancelled\");\n}"
6523
+ },
6524
+ {
6525
+ "name": "LocalProcessRequest",
6526
+ "kind": "interface",
6527
+ "package": "@nifrajs/agent",
6528
+ "signature": "export interface LocalProcessRequest {\n readonly command: string;\n readonly args?: readonly string[];\n readonly cwd?: string;\n readonly env?: Readonly<Record<string, string | undefined>>;\n readonly capability?: string;\n readonly policy: ExecutionPolicy;\n readonly signal?: AbortSignal;\n}"
6529
+ },
6530
+ {
6531
+ "name": "LocalProcessResult",
6532
+ "kind": "interface",
6533
+ "package": "@nifrajs/agent",
6534
+ "signature": "export interface LocalProcessResult {\n readonly ok: boolean;\n readonly exitCode: number | null;\n readonly signal?: string;\n readonly stdout: string;\n readonly stderr: string;\n readonly timedOut: boolean;\n readonly cancelled: boolean;\n readonly limitations: readonly string[];\n}"
5706
6535
  },
5707
6536
  {
5708
6537
  "name": "Location",
@@ -5729,8 +6558,8 @@
5729
6558
  "name": "logger",
5730
6559
  "kind": "function",
5731
6560
  "package": "@nifrajs/middleware",
5732
- "signature": "export declare function logger(options?: LoggerOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
5733
- "doc": "/**\n * A {@link definePlugin} plugin that logs one structured line per request - method, path, status,\n * and duration - via `onRequest`/`onResponse` (so it covers 404s and errors too). The start time is\n * paired to the request through a `WeakMap` (no per-request allocation leak). Idempotent.\n */"
6561
+ "signature": "export declare function logger(options?: LoggerOptions): IdentityPlugin;",
6562
+ "doc": "/**\n * A {@link defineIdentityPlugin} plugin that logs one structured line per request - method, path,\n * status, and duration - via `onRequest`/`onResponse` (so it covers 404s and errors too). The start\n * time is paired to the request through a `WeakMap` (no per-request allocation leak). Idempotent.\n *\n * It adds no context and registers no routes, so it is type-identity: routes declared after\n * `.use(logger())` keep their types. (Under `definePlugin` they would not - see that helper's\n * FOOTGUN note.)\n */"
5734
6563
  },
5735
6564
  {
5736
6565
  "name": "Logger",
@@ -5796,7 +6625,7 @@
5796
6625
  "name": "matchesAssuranceSelector",
5797
6626
  "kind": "function",
5798
6627
  "package": "@nifrajs/core",
5799
- "signature": "export declare function matchesAssuranceSelector(route: Pick<ReflectedRoute, \"method\" | \"path\" | \"tool\" | \"capabilities\">, selector: AssuranceRouteSelector, definitions?: ReadonlyMap<string, CapabilityDefinition>): boolean;",
6628
+ "signature": "export declare function matchesAssuranceSelector(route: Pick<ReflectedRoute, \"method\" | \"path\" | \"tool\" | \"capabilities\" | \"classification\">, selector: AssuranceRouteSelector, definitions?: ReadonlyMap<string, CapabilityDefinition>): boolean;",
5800
6629
  "doc": "/**\n * Shared selector semantics for policy rules and framework adapters.\n *\n * `definitions` is only consulted by the `access`/`zone` selectors; every other selector reads\n * reflection alone. A caller that omits it while the selector needs it gets no match, so callers that\n * accept user policy must reject that combination up front - `defineAssuranceConfig` does.\n */"
5801
6630
  },
5802
6631
  {
@@ -5845,7 +6674,7 @@
5845
6674
  "name": "MCP_ERROR",
5846
6675
  "kind": "const",
5847
6676
  "package": "@nifrajs/mcp",
5848
- "signature": "export declare const MCP_ERROR: {\n readonly HEADER_MISMATCH: -32020;\n readonly UNSUPPORTED_VERSION: -32022;\n};",
6677
+ "signature": "export declare const MCP_ERROR: {\n readonly HEADER_MISMATCH: -32020;\n readonly UNSUPPORTED_VERSION: -32022;\n /** Rejected by `authorizeMessage`. In JSON-RPC's implementation-defined server-error band\n * (-32099..-32000), unlike a code in the -326xx range, which is reserved for the spec's own use. */\n readonly UNAUTHORIZED: -32001;\n};",
5849
6678
  "doc": "/** MCP-reserved JSON-RPC error codes (2026-07-28 error-code policy carves out -32020..-32099 for the spec). */"
5850
6679
  },
5851
6680
  {
@@ -5906,13 +6735,13 @@
5906
6735
  "name": "McpHttpOptions",
5907
6736
  "kind": "interface",
5908
6737
  "package": "@nifrajs/cli",
5909
- "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /**\n * Origin allowlist for the DNS-rebinding guard. Omit (the default) to allow any origin - the right\n * choice for a public, unauthenticated docs server that can't enumerate its browser clients' origins.\n * Set it (e.g. a localhost origin for a hardened local host) to reject any other browser origin with 403.\n */\n readonly allowedOrigins?: readonly string[];\n}"
6738
+ "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /**\n * Origin allowlist for the DNS-rebinding guard. Omit (the default) to allow any origin - the right\n * choice for a public, unauthenticated docs server that can't enumerate its browser clients' origins.\n * Set it (e.g. a localhost origin for a hardened local host) to reject any other browser origin with 403.\n */\n readonly allowedOrigins?: readonly string[];\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
5910
6739
  },
5911
6740
  {
5912
6741
  "name": "McpHttpOptions",
5913
6742
  "kind": "interface",
5914
6743
  "package": "@nifrajs/mcp",
5915
- "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /**\n * Origin allowlist for the DNS-rebinding guard. Omit (the default) to allow any origin - the right\n * choice for a public, unauthenticated docs server that can't enumerate its browser clients' origins.\n * Set it (e.g. a localhost origin for a hardened local host) to reject any other browser origin with 403.\n */\n readonly allowedOrigins?: readonly string[];\n}"
6744
+ "signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /**\n * Origin allowlist for the DNS-rebinding guard. Omit (the default) to allow any origin - the right\n * choice for a public, unauthenticated docs server that can't enumerate its browser clients' origins.\n * Set it (e.g. a localhost origin for a hardened local host) to reject any other browser origin with 403.\n */\n readonly allowedOrigins?: readonly string[];\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
5916
6745
  },
5917
6746
  {
5918
6747
  "name": "mcpJson",
@@ -5983,7 +6812,7 @@
5983
6812
  "name": "McpServer",
5984
6813
  "kind": "interface",
5985
6814
  "package": "@nifrajs/mcp",
5986
- "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): 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}"
6815
+ "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\">): 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}"
5987
6816
  },
5988
6817
  {
5989
6818
  "name": "McpServerConfig",
@@ -5996,7 +6825,7 @@
5996
6825
  "name": "McpServerFeatures",
5997
6826
  "kind": "interface",
5998
6827
  "package": "@nifrajs/mcp",
5999
- "signature": "export interface McpServerFeatures {\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** Advertise the MCP Apps UI extension in `initialize`. Present when the server serves `ui://` widgets;\n * `mimeTypes` defaults to `[UI_MIME]`. */\n readonly ui?: {\n readonly mimeTypes?: readonly string[];\n };\n /** Natural-language guidance for LLMs on how to use this server. Surfaced in the modern\n * `server/discover` result (2026-07-28); legacy `initialize` does not carry it. */\n readonly instructions?: string;\n}"
6828
+ "signature": "export interface McpServerFeatures {\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** Advertise the MCP Apps UI extension in `initialize`. Present when the server serves `ui://` widgets;\n * `mimeTypes` defaults to `[UI_MIME]`. */\n readonly ui?: {\n readonly mimeTypes?: readonly string[];\n };\n /** Natural-language guidance for LLMs on how to use this server. Surfaced in the modern\n * `server/discover` result (2026-07-28) and in the legacy `initialize` result (`instructions` is an\n * optional field of that result in every handshake-era revision this server speaks). */\n readonly instructions?: string;\n}"
6000
6829
  },
6001
6830
  {
6002
6831
  "name": "McpTool",
@@ -6004,6 +6833,12 @@
6004
6833
  "package": "@nifrajs/mcp",
6005
6834
  "signature": "export interface McpTool {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: Record<string, unknown>;\n readonly annotations?: McpToolAnnotations;\n readonly _meta?: Record<string, unknown>;\n readonly handler: (args: Record<string, unknown>, context: McpToolContext) => Promise<string | McpToolResult>;\n}"
6006
6835
  },
6836
+ {
6837
+ "name": "mcpToolAdapter",
6838
+ "kind": "function",
6839
+ "package": "@nifrajs/testing",
6840
+ "signature": "export declare function mcpToolAdapter<Input, Output>(tool: ToolContract<Input, Output>, baseOptions?: Omit<ToolCallOptions, \"signal\" | \"ledger\">): ToolAdapter;"
6841
+ },
6007
6842
  {
6008
6843
  "name": "McpToolAnnotations",
6009
6844
  "kind": "interface",
@@ -6017,6 +6852,12 @@
6017
6852
  "package": "@nifrajs/mcp",
6018
6853
  "signature": "export interface McpToolContext {\n readonly signal: AbortSignal;\n readonly requestId: JsonRpcId;\n readonly progressToken?: ProgressToken;\n readonly reportProgress: (progress: number, total?: number) => void;\n}"
6019
6854
  },
6855
+ {
6856
+ "name": "McpToolContractOptions",
6857
+ "kind": "interface",
6858
+ "package": "@nifrajs/mcp",
6859
+ "signature": "export interface McpToolContractOptions extends Omit<ToolCallOptions, \"signal\" | \"ledger\"> {\n readonly capabilities?: readonly string[];\n}"
6860
+ },
6020
6861
  {
6021
6862
  "name": "McpToolHandlerResult",
6022
6863
  "kind": "type",
@@ -6058,12 +6899,24 @@
6058
6899
  "package": "@nifrajs/content",
6059
6900
  "signature": "export interface MdxPluginOptions {\n /** JSX runtime source the compiled MDX imports from - `\"react\"` (default), `\"preact\"`, `\"solid-js\"`. */\n readonly jsxImportSource?: string;\n /** Emit development JSX (line numbers, `jsxDEV`). Default `false`. */\n readonly development?: boolean;\n /** Extra `@mdx-js/mdx` `compile` options - e.g. `remarkPlugins`/`rehypePlugins` (GFM, slugs, …). */\n readonly compileOptions?: Record<string, unknown>;\n /** Advanced: override the compiler module specifier (default `\"@mdx-js/mdx\"`) - e.g. to use a fork. */\n readonly moduleName?: string;\n}"
6060
6901
  },
6902
+ {
6903
+ "name": "MemoryAgentStateStore",
6904
+ "kind": "class",
6905
+ "package": "@nifrajs/agent",
6906
+ "signature": "export declare class MemoryAgentStateStore implements AgentStateStore {\n private readonly states;\n load(turnId: string): AgentTurnState | undefined;\n save(state: AgentTurnState): void;\n}"
6907
+ },
6061
6908
  {
6062
6909
  "name": "MemoryApprovalStore",
6063
6910
  "kind": "class",
6064
6911
  "package": "@nifrajs/core",
6065
6912
  "signature": "export declare class MemoryApprovalStore implements ApprovalStore {\n readonly durability: \"memory\";\n private readonly records;\n create(record: ApprovalRecord): boolean;\n get(approvalId: string): ApprovalRecord | undefined;\n decide(input: Parameters<ApprovalStore[\"decide\"]>[0]): boolean;\n consume(input: Parameters<ApprovalStore[\"consume\"]>[0]): ApprovalConsumeResult;\n list(): readonly ApprovalRecord[];\n}"
6066
6913
  },
6914
+ {
6915
+ "name": "MemoryAssureSink",
6916
+ "kind": "interface",
6917
+ "package": "@nifrajs/cli",
6918
+ "signature": "export interface MemoryAssureSink extends AssureSink {\n readonly bundles: readonly AssureBundle[];\n clear(): void;\n}"
6919
+ },
6067
6920
  {
6068
6921
  "name": "MemoryCache",
6069
6922
  "kind": "class",
@@ -6132,7 +6985,7 @@
6132
6985
  "name": "MemoryIdempotencyStore",
6133
6986
  "kind": "class",
6134
6987
  "package": "@nifrajs/middleware",
6135
- "signature": "export declare class MemoryIdempotencyStore implements IdempotencyStore {\n private readonly entries;\n constructor(options?: MemoryIdempotencyStoreOptions);\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n complete(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;\n release(key: string): Promise<void>;\n}",
6988
+ "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, record: IdempotencyRecord, ttlMs: number): Promise<void>;\n release(key: string): Promise<void>;\n}",
6136
6989
  "doc": "/** In-process store. Refuses to run in production unless explicitly allowed (per-instance ⇒ no cross-instance dedupe). */"
6137
6990
  },
6138
6991
  {
@@ -6145,7 +6998,7 @@
6145
6998
  "name": "MemoryIdempotencyStoreOptions",
6146
6999
  "kind": "interface",
6147
7000
  "package": "@nifrajs/middleware",
6148
- "signature": "export interface MemoryIdempotencyStoreOptions {\n /** Allow the in-memory store in production. Off by default - a per-instance store can't dedupe across instances. */\n readonly allowInProduction?: boolean;\n}"
7001
+ "signature": "export interface MemoryIdempotencyStoreOptions {\n /** Allow the in-memory store in production. Off by default - a per-instance store can't dedupe across instances. */\n readonly allowInProduction?: boolean;\n /** Maximum retained locks + records. Default `10_000`. */\n readonly maxEntries?: number;\n /** Maximum key length in UTF-8 bytes. Default `1024`. */\n readonly maxKeyBytes?: number;\n}"
6149
7002
  },
6150
7003
  {
6151
7004
  "name": "MemoryJobStore",
@@ -6222,6 +7075,18 @@
6222
7075
  "package": "@nifrajs/middleware",
6223
7076
  "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}"
6224
7077
  },
7078
+ {
7079
+ "name": "MemoryToolIdempotencyStore",
7080
+ "kind": "class",
7081
+ "package": "@nifrajs/core",
7082
+ "signature": "export declare class MemoryToolIdempotencyStore implements ToolIdempotencyStore {\n readonly durability: \"memory\";\n private readonly entries;\n private readonly maxEntries;\n private readonly ttlMs;\n private readonly now;\n constructor(options?: MemoryToolIdempotencyStoreOptions);\n begin(input: ToolIdempotencyBeginInput): ToolIdempotencyBeginResult;\n complete(input: {\n readonly namespace: string;\n readonly key: string;\n readonly reservation: string;\n }): boolean;\n abandon(input: {\n readonly namespace: string;\n readonly key: string;\n readonly reservation: string;\n }): boolean;\n sweep(): void;\n}"
7083
+ },
7084
+ {
7085
+ "name": "MemoryToolIdempotencyStoreOptions",
7086
+ "kind": "interface",
7087
+ "package": "@nifrajs/core",
7088
+ "signature": "export interface MemoryToolIdempotencyStoreOptions {\n readonly maxEntries?: number;\n readonly ttlMs?: number;\n readonly now?: () => number;\n}"
7089
+ },
6225
7090
  {
6226
7091
  "name": "mergeHeads",
6227
7092
  "kind": "function",
@@ -6250,6 +7115,13 @@
6250
7115
  "signature": "export interface MetaArgs<Data = unknown> {\n readonly data: Data;\n readonly params: Record<string, string>;\n /**\n * The site origin - scheme + host (+ port), e.g. `\"https://news.example.com\"`, **with no trailing\n * slash**. The single piece of server/env knowledge `meta()` otherwise can't see: it runs in BOTH\n * SSR and client navigation, so it has no `request`/`process.env`. The framework resolves it from the\n * request URL during SSR and from `location.origin` on client nav - and they match, so an absolute\n * `og:url`/`canonical`/`og:image` built from it never drifts between the server-rendered `<head>` and\n * a soft-nav. Use it for absolute URLs (`origin + \"/posts/\" + slug`) instead of threading `siteUrl`\n * through loader data. Empty string (`\"\"`) when the origin is unknown (e.g. a hand-built test render\n * with no request URL). A `meta()` that ignores `origin` is unchanged.\n */\n readonly origin: string;\n}",
6251
7116
  "doc": "/**\n * Args for a route's `meta` function: the loader's `data` + the route `params` + the request `origin`.\n * `meta()` runs in BOTH SSR and client navigation, so it has **no `request`/`process.env`/server access** -\n * `origin` is the only server-resolved fact it gets (so you needn't thread `siteUrl` through loader data\n * for absolute `og:url`/`canonical`/`og:image` URLs). See {@link origin}.\n */"
6252
7117
  },
7118
+ {
7119
+ "name": "MetaDescriptor",
7120
+ "kind": "interface",
7121
+ "package": "@nifrajs/web",
7122
+ "signature": "export interface MetaDescriptor {\n readonly charset?: string;\n readonly content?: string;\n readonly \"http-equiv\"?: string;\n readonly itemprop?: string;\n readonly media?: string;\n readonly name?: string;\n readonly property?: string;\n readonly scheme?: string;\n readonly [attr: `data-${string}`]: string | undefined;\n}",
7123
+ "doc": "/** One managed `<meta>` tag. Standard attributes and inert `data-*` metadata only. */"
7124
+ },
6253
7125
  {
6254
7126
  "name": "MetaInput",
6255
7127
  "kind": "type",
@@ -6273,7 +7145,7 @@
6273
7145
  "name": "methodOverride",
6274
7146
  "kind": "function",
6275
7147
  "package": "@nifrajs/middleware",
6276
- "signature": "export declare function methodOverride(options?: MethodOverrideOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
7148
+ "signature": "export declare function methodOverride(options?: MethodOverrideOptions): import(\"@nifrajs/core\").IdentityPlugin;",
6277
7149
  "doc": "/**\n * HTTP method override for clients that can only send `POST`. The middleware rewrites the request\n * before routing, so handlers, validation, and response hooks all see the overridden method.\n *\n * Header override is enabled by default; query override is opt-in. Form-body override is deliberately\n * not implemented because reading the body before routing would consume or buffer it for every write.\n */"
6278
7150
  },
6279
7151
  {
@@ -6300,7 +7172,7 @@
6300
7172
  "name": "metrics",
6301
7173
  "kind": "function",
6302
7174
  "package": "@nifrajs/otel",
6303
- "signature": "export declare function metrics(options?: MetricsOptions): NifraPlugin;",
7175
+ "signature": "export declare function metrics(options?: MetricsOptions): IdentityPlugin;",
6304
7176
  "doc": "/**\n * Enable RED metrics + a `/metrics` Prometheus endpoint. Records `nifra_http_requests_total`,\n * `nifra_http_request_duration_seconds`, and `nifra_http_requests_in_flight`, labeled by method,\n * matched route template, and status. Apply once (named-plugin dedupe).\n */"
6305
7177
  },
6306
7178
  {
@@ -6517,7 +7389,7 @@
6517
7389
  "name": "namedCombine",
6518
7390
  "kind": "function",
6519
7391
  "package": "@nifrajs/middleware",
6520
- "signature": "export declare function namedCombine(name: string, ...items: readonly Composable[]): NifraPlugin;",
7392
+ "signature": "export declare function namedCombine(name: string, ...items: readonly Composable[]): IdentityPlugin;",
6521
7393
  "doc": "/** Compose middleware/plugins into one idempotent named bundle. */"
6522
7394
  },
6523
7395
  {
@@ -6538,49 +7410,49 @@
6538
7410
  "name": "NavigateFunction",
6539
7411
  "kind": "interface",
6540
7412
  "package": "@nifrajs/web",
6541
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n }): void;\n}",
7413
+ "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
6542
7414
  "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
6543
7415
  },
6544
7416
  {
6545
7417
  "name": "NavigateFunction",
6546
7418
  "kind": "interface",
6547
7419
  "package": "@nifrajs/web-preact",
6548
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n }): void;\n}",
7420
+ "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
6549
7421
  "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
6550
7422
  },
6551
7423
  {
6552
7424
  "name": "NavigateFunction",
6553
7425
  "kind": "interface",
6554
7426
  "package": "@nifrajs/web-react",
6555
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n }): void;\n}",
7427
+ "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
6556
7428
  "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
6557
7429
  },
6558
7430
  {
6559
7431
  "name": "NavigateFunction",
6560
7432
  "kind": "interface",
6561
7433
  "package": "@nifrajs/web-solid",
6562
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n }): void;\n}",
7434
+ "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
6563
7435
  "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
6564
7436
  },
6565
7437
  {
6566
7438
  "name": "NavigateFunction",
6567
7439
  "kind": "interface",
6568
7440
  "package": "@nifrajs/web-svelte",
6569
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n }): void;\n}",
7441
+ "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
6570
7442
  "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
6571
7443
  },
6572
7444
  {
6573
7445
  "name": "NavigateFunction",
6574
7446
  "kind": "interface",
6575
7447
  "package": "@nifrajs/web-vue",
6576
- "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n }): void;\n}",
7448
+ "signature": "export interface NavigateFunction {\n (to: string | number, options?: NavigateOptions): void;\n <To extends string>(target: {\n readonly to: To;\n readonly search?: NavigateSearchOf<To>;\n readonly replace?: boolean;\n readonly state?: unknown;\n }): void;\n}",
6577
7449
  "doc": "/**\n * A programmatic navigate, shared by every adapter's `useNavigate`. Three forms: a string path (push, or\n * replace via `{ replace: true }`), a history delta (`-1`/`1`), or an object target `{ to, search, replace }`\n * whose `search` is typed against `to`'s route schema via {@link NavigateSearchOf} (a wrong shape for a\n * mapped route is a compile error; an unmapped path takes a loose `search`). The object form's `search` is\n * serialized onto `to`. A no-op on the server / before hydration.\n */"
6578
7450
  },
6579
7451
  {
6580
7452
  "name": "NavigateOptions",
6581
7453
  "kind": "interface",
6582
7454
  "package": "@nifrajs/web",
6583
- "signature": "export interface NavigateOptions {\n /** Replace the current history entry instead of pushing a new one (like `history.replaceState`). */\n readonly replace?: boolean;\n}",
7455
+ "signature": "export interface NavigateOptions {\n /** Replace the current history entry instead of pushing a new one (like `history.replaceState`). */\n readonly replace?: boolean;\n /**\n * Opaque per-entry state stored on the created history entry (under `history.state.nifraState`, so\n * it never collides with the router's own bookkeeping keys). Structured-cloneable only, like\n * `history.pushState`'s first argument. Read it back via `history.state.nifraState`; the browser\n * restores it automatically on back/forward. Ignored for history-delta navigations.\n */\n readonly state?: unknown;\n}",
6584
7456
  "doc": "/** Options for a programmatic navigation. */"
6585
7457
  },
6586
7458
  {
@@ -6601,7 +7473,7 @@
6601
7473
  "name": "NavigateTargetInput",
6602
7474
  "kind": "interface",
6603
7475
  "package": "@nifrajs/web",
6604
- "signature": "export interface NavigateTargetInput {\n readonly to: string;\n readonly search?: Record<string, unknown>;\n readonly replace?: boolean;\n}",
7476
+ "signature": "export interface NavigateTargetInput {\n readonly to: string;\n readonly search?: Record<string, unknown>;\n readonly replace?: boolean;\n readonly state?: unknown;\n}",
6605
7477
  "doc": "/** The runtime shape of an object-form navigate target (loose - the typed narrowing lives in\n * {@link NavigateFunction}'s generic call signature). `to` is a bare pathname; `search` is serialized\n * onto it; `replace` folds into the options. */"
6606
7478
  },
6607
7479
  {
@@ -6643,14 +7515,14 @@
6643
7515
  "name": "negotiateLocale",
6644
7516
  "kind": "function",
6645
7517
  "package": "@nifrajs/i18n",
6646
- "signature": "export declare function negotiateLocale(request: Request, options: NegotiateOptions): Locale;",
6647
- "doc": "/**\n * Negotiate the request's locale. Order: a valid {@link NegotiateOptions.cookie} value →\n * `Accept-Language` (each `q`-ranked tag, exact then base-subtag) → `defaultLocale`.\n */"
7518
+ "signature": "export declare function negotiateLocale(request: Request | LocaleParts, options: NegotiateOptions): Locale;",
7519
+ "doc": "/**\n * Negotiate the request's locale. Order: a valid {@link NegotiateOptions.queryParam} value → a\n * valid {@link NegotiateOptions.cookie} value → `Accept-Language` (each `q`-ranked tag, exact then\n * base-subtag) → `defaultLocale`. {@link resolveLocale} additionally reports the winning source.\n */"
6648
7520
  },
6649
7521
  {
6650
7522
  "name": "NegotiateOptions",
6651
7523
  "kind": "interface",
6652
7524
  "package": "@nifrajs/i18n",
6653
- "signature": "export interface NegotiateOptions {\n /** The locales the app supports, e.g. `[\"en\", \"fr\", \"de\"]`. Matched case-insensitively. */\n readonly locales: readonly Locale[];\n /** Returned when nothing matches. */\n readonly defaultLocale: Locale;\n /** A cookie name whose value (if a supported locale) wins over `Accept-Language` (a user's explicit\n * choice). Omit to skip the cookie. */\n readonly cookie?: string;\n}"
7525
+ "signature": "export interface NegotiateOptions {\n /** The locales the app supports, e.g. `[\"en\", \"fr\", \"de\"]`. Matched case-insensitively. */\n readonly locales: readonly Locale[];\n /** Returned when nothing matches. */\n readonly defaultLocale: Locale;\n /** A query parameter whose value (if a supported locale) wins over everything - a link carrying\n * `?lang=fr` is an explicit ask. Omit to skip the query string. */\n readonly queryParam?: string;\n /** A cookie name whose value (if a supported locale) wins over `Accept-Language` (a user's explicit\n * choice). Omit to skip the cookie. */\n readonly cookie?: string;\n}"
6654
7526
  },
6655
7527
  {
6656
7528
  "name": "NetlifyEvent",
@@ -6687,7 +7559,7 @@
6687
7559
  "name": "NIFRA_ASSURANCE",
6688
7560
  "kind": "const",
6689
7561
  "package": "@nifrajs/core",
6690
- "signature": "export declare const NIFRA_ASSURANCE: Readonly<{\n readonly AUTHENTICATED: \"nifra.authenticated\";\n readonly BODY_BOUNDED: \"nifra.body-bounded\";\n readonly CSRF: \"nifra.csrf\";\n readonly DURABLE_COMMAND: \"nifra.durable-command\";\n readonly IDEMPOTENCY_KEY: \"nifra.idempotency-key\";\n readonly IP_RESTRICTED: \"nifra.ip-restricted\";\n readonly RATE_LIMITED: \"nifra.rate-limited\";\n readonly SECURITY_HEADERS: \"nifra.security-headers\";\n}>;",
7562
+ "signature": "export declare const NIFRA_ASSURANCE: Readonly<{\n readonly AUTHENTICATED: \"nifra.authenticated\";\n readonly BODY_BOUNDED: \"nifra.body-bounded\";\n readonly CSRF: \"nifra.csrf\";\n readonly DURABLE_COMMAND: \"nifra.durable-command\";\n readonly IDEMPOTENCY_KEY: \"nifra.idempotency-key\";\n readonly IP_RESTRICTED: \"nifra.ip-restricted\";\n readonly RATE_LIMITED: \"nifra.rate-limited\";\n readonly SECURITY_HEADERS: \"nifra.security-headers\";\n readonly RESPONSE_CONTRACT: \"nifra.response-contract\";\n}>;",
6691
7563
  "doc": "/** Canonical evidence ids emitted by Nifra's official middleware modules. */"
6692
7564
  },
6693
7565
  {
@@ -6711,6 +7583,20 @@
6711
7583
  "signature": "export declare const NIFRA_DEADLINE_HEADER = \"x-nifra-deadline\";",
6712
7584
  "doc": "/** Canonical wire header carrying an absolute Unix epoch deadline in milliseconds. */"
6713
7585
  },
7586
+ {
7587
+ "name": "NifraFeatureVersion",
7588
+ "kind": "type",
7589
+ "package": "@nifrajs/core",
7590
+ "signature": "export type NifraFeatureVersion = FeatureVersionOf<Version>;",
7591
+ "doc": "/**\n * The feature version of the `@nifrajs/core` copy that declared these types, derived from the single\n * `VERSION` literal (type-only import - erased, so no runtime cycle with the package root).\n */"
7592
+ },
7593
+ {
7594
+ "name": "NifraFeatureVersion",
7595
+ "kind": "type",
7596
+ "package": "nifra",
7597
+ "signature": "export type NifraFeatureVersion = FeatureVersionOf<Version>;",
7598
+ "doc": "/**\n * The feature version of the `@nifrajs/core` copy that declared these types, derived from the single\n * `VERSION` literal (type-only import - erased, so no runtime cycle with the package root).\n */"
7599
+ },
6714
7600
  {
6715
7601
  "name": "NifraManifest",
6716
7602
  "kind": "interface",
@@ -6912,6 +7798,12 @@
6912
7798
  "signature": "export declare function normalizeRolldownPlugins(plugins: readonly unknown[], isRolldown: boolean): readonly unknown[];",
6913
7799
  "doc": "/**\n * Strip `optimizeDeps.rollupOptions.jsx` from a plugin's `config` hook output when running under\n * rolldown-vite - the source of the scary, harmless `Warning: Invalid input options … \"jsx\" Invalid\n * key: Expected never but received \"jsx\"` on `nifra dev`.\n *\n * Why it happens: `@vitejs/plugin-react@4.x` (and peers) target an *older* rolldown-vite optimizeDeps\n * API - they inject `optimizeDeps.rollupOptions.jsx` to tell the dep pre-bundler to transform JSX. Vite\n * 8's rolldown dep-optimizer renamed that surface to `optimizeDeps.rolldownOptions` (and moved jsx under\n * `transform.jsx`), so the stale `rollupOptions.jsx` is an unrecognized input option → the warning. It's\n * a version-skew artifact, not a real misconfig: the route source JSX transform runs through the\n * plugin's own `transform` hook (untouched here), and node_modules deps that get pre-bundled almost\n * never contain raw JSX - so dropping the dead key changes no behavior and keeps HMR/Fast Refresh\n * intact. We *strip* (rather than translate to `rolldownOptions`) so the fix is version-agnostic: a\n * plugin already emitting the correct `rolldownOptions` is left untouched, and a future plugin bump that\n * stops emitting `rollupOptions.jsx` makes this a no-op.\n *\n * Scoped narrowly: only the `optimizeDeps.rollupOptions.jsx` key is removed, only under rolldown-vite,\n * and only from the value a plugin's `config` hook returns. Non-rolldown Vite is passed through verbatim.\n *\n * FLATTEN FIRST: a Vite plugin factory may return an ARRAY of plugins - `@vitejs/plugin-react`'s `react()`\n * returns `[vite:react-babel, vite:react-refresh]`, and it's `react:react-babel`'s `config` hook that emits\n * the offending `optimizeDeps.rollupOptions.jsx`. `nifra.config.ts` writes `vitePlugins = [react()]`, so the\n * plugin list arrives NESTED (`[[babel, refresh]]`). Without flattening, `.map` sees the inner array (which\n * has no `config`), leaves it untouched, and Vite - which flattens plugin arrays itself before running them\n * - then executes the un-stripped babel hook, so the warning survives. Flattening here (Vite accepts a flat\n * list identically) is what lets the strip reach every real plugin.\n */"
6914
7800
  },
7801
+ {
7802
+ "name": "normalizeSeverity",
7803
+ "kind": "function",
7804
+ "package": "@nifrajs/cli",
7805
+ "signature": "export declare function normalizeSeverity(value: \"error\" | \"warning\" | \"warn\" | \"info\"): Severity;"
7806
+ },
6915
7807
  {
6916
7808
  "name": "notFound",
6917
7809
  "kind": "function",
@@ -7012,7 +7904,7 @@
7012
7904
  "name": "openapi",
7013
7905
  "kind": "function",
7014
7906
  "package": "@nifrajs/middleware",
7015
- "signature": "export declare function openapi(options?: OpenApiOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
7907
+ "signature": "export declare function openapi(options?: OpenApiOptions): IdentityPlugin;",
7016
7908
  "doc": "/**\n * Serve an OpenAPI 3.1 document (a structural subset - see {@link buildOpenApiDocument}) at\n * `options.path` (default `/openapi.json`), generated from the app's registered routes. Generation is\n * **lazy + memoized**: it reads `app.routes()` on the first request, by which point every route is\n * registered - so the plugin's own position in the chain doesn't matter.\n *\n * Pass `ui: true` (or `ui: { path, title, cdn }`) to also serve a Scalar API-reference page (default\n * `/reference`) that renders the spec. The page loads Scalar from a CDN; pin/self-host via `ui.cdn`,\n * and remember to allow that origin if you ship a `script-src` Content-Security-Policy.\n *\n * ```ts\n * app.use(openapi({ info: { title: \"My API\", version: \"1.0.0\" }, ui: true }))\n * ```\n */"
7017
7909
  },
7018
7910
  {
@@ -7089,7 +7981,7 @@
7089
7981
  "name": "OperationDef",
7090
7982
  "kind": "interface",
7091
7983
  "package": "@nifrajs/core",
7092
- "signature": "export interface OperationDef {\n readonly method: Method;\n readonly path: string;\n /** Optional path-params schema (validated + coercible at the boundary; see {@link RouteSchema.params}). */\n readonly params?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n readonly response?: StandardSchemaV1;\n /** Declared effect tokens, carried into route reflection and capability assurance. */\n readonly capabilities?: readonly string[];\n /** Dedupe retries of this operation on an `Idempotency-Key` header (see {@link RouteSchema.idempotency}). */\n readonly idempotency?: IdempotencyConfig;\n /** Highest data-sensitivity the response carries (see {@link RouteSchema.classification}). */\n readonly classification?: DataClassification;\n /** Inline route-assurance evidence this operation carries (see {@link RouteSchema.assurance}). */\n readonly assurance?: readonly string[];\n /** Mark this operation a dynamic route family (see {@link RouteSchema.family}). */\n readonly family?: boolean;\n /** Short summary (OpenAPI `summary`). */\n readonly summary?: string;\n /** Longer description (OpenAPI `description`, CommonMark). */\n readonly description?: string;\n /** Grouping tags (OpenAPI `tags`). */\n readonly tags?: readonly string[];\n /** Mark the operation deprecated. */\n readonly deprecated?: boolean;\n /** Security requirements (names ref `securitySchemes`); `[]` = explicitly public. Omit ⇒ inherit the document default. */\n readonly security?: ReadonlyArray<Readonly<Record<string, readonly string[]>>>;\n /** Request body content type. Default `application/json`. */\n readonly requestContentType?: string;\n /** Content type of the success (`200`) response. Default `application/json`. */\n readonly responseContentType?: string;\n /** Additional responses by status code, e.g. `{ \"404\": { description: \"Not found\" } }`. */\n readonly responses?: Readonly<Record<string, ResponseDef>>;\n}",
7984
+ "signature": "export interface OperationDef {\n readonly method: Method;\n readonly path: string;\n /** Optional path-params schema (validated + coercible at the boundary; see {@link RouteSchema.params}). */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema (header names are normalized to lower-case). */\n readonly headers?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n readonly response?: StandardSchemaV1;\n /** Declared effect tokens, carried into route reflection and capability assurance. */\n readonly capabilities?: readonly string[];\n /** Dedupe retries of this operation on an `Idempotency-Key` header (see {@link RouteSchema.idempotency}). */\n readonly idempotency?: IdempotencyConfig;\n /** Per-route transport body cap; see RouteSchema.bodyLimit. */\n readonly bodyLimit?: number | \"unlimited\";\n readonly bodyLimitReason?: string;\n /** Highest data-sensitivity the response carries (see {@link RouteSchema.classification}). */\n readonly classification?: DataClassification;\n /** Inline route-assurance evidence this operation carries (see {@link RouteSchema.assurance}). */\n readonly assurance?: readonly string[];\n /** Mark this operation a dynamic route family (see {@link RouteSchema.family}). */\n readonly family?: boolean;\n /** Short summary (OpenAPI `summary`). */\n readonly summary?: string;\n /** Longer description (OpenAPI `description`, CommonMark). */\n readonly description?: string;\n /** Grouping tags (OpenAPI `tags`). */\n readonly tags?: readonly string[];\n /** Mark the operation deprecated. */\n readonly deprecated?: boolean;\n /** Security requirements (names ref `securitySchemes`); `[]` = explicitly public. Omit ⇒ inherit the document default. */\n readonly security?: ReadonlyArray<Readonly<Record<string, readonly string[]>>>;\n /** Request body content type. Default `application/json`. */\n readonly requestContentType?: string;\n /** Content type of the success (`200`) response. Default `application/json`. */\n readonly responseContentType?: string;\n /** Additional responses by status code, e.g. `{ \"404\": { description: \"Not found\" } }`. */\n readonly responses?: Readonly<Record<string, ResponseDef>>;\n}",
7093
7985
  "doc": "/**\n * One operation in a contract. Input schemas are any Standard Schema; `response` is optional.\n *\n * The fields below `response` are **optional OpenAPI metadata** - they don't affect runtime\n * validation or the inferred handler types, they enrich the document `toOpenAPI` emits. A contract is\n * the natural home for them: it's the versionable description of the API, decoupled from the impl.\n */"
7094
7986
  },
7095
7987
  {
@@ -7210,6 +8102,13 @@
7210
8102
  "signature": "export declare function parseCausalityRecord(input: unknown): CausalityRecordParseResult;",
7211
8103
  "doc": "/** Parse an untrusted durable graph record. Unknown fields fail closed at every nesting level. */"
7212
8104
  },
8105
+ {
8106
+ "name": "parseCompatibleReplayFile",
8107
+ "kind": "function",
8108
+ "package": "@nifrajs/core",
8109
+ "signature": "export declare function parseCompatibleReplayFile(value: unknown): CompatibleReplayFile;",
8110
+ "doc": "/** Parse the unified format while preserving the two pre-existing token-only replay shapes. */"
8111
+ },
7213
8112
  {
7214
8113
  "name": "parseCookies",
7215
8114
  "kind": "function",
@@ -7328,6 +8227,18 @@
7328
8227
  "signature": "export declare function parseNifraManifestSignature(content: string, source?: string): NifraManifestSignature;",
7329
8228
  "doc": "/** Parse the detached sidecar before selecting its operator-controlled public key. */"
7330
8229
  },
8230
+ {
8231
+ "name": "parseReplayFile",
8232
+ "kind": "function",
8233
+ "package": "@nifrajs/core",
8234
+ "signature": "export declare function parseReplayFile(value: unknown): ReplayFile;"
8235
+ },
8236
+ {
8237
+ "name": "parseRulePacks",
8238
+ "kind": "function",
8239
+ "package": "@nifrajs/cli",
8240
+ "signature": "export declare function parseRulePacks(value: unknown): readonly RulePack[];"
8241
+ },
7331
8242
  {
7332
8243
  "name": "parseTraceparent",
7333
8244
  "kind": "function",
@@ -7367,6 +8278,12 @@
7367
8278
  "package": "@nifrajs/core",
7368
8279
  "signature": "export declare const plainJsonCodec: TransportCodec;"
7369
8280
  },
8281
+ {
8282
+ "name": "planProofs",
8283
+ "kind": "function",
8284
+ "package": "@nifrajs/cli",
8285
+ "signature": "export declare function planProofs(graph: WorkGraph, impact: ImpactReport, targetLevel?: number): ProofPlan;"
8286
+ },
7370
8287
  {
7371
8288
  "name": "Platform",
7372
8289
  "kind": "interface",
@@ -7400,6 +8317,20 @@
7400
8317
  "signature": "export type PluginBuilder = Parameters<BunPlugin[\"setup\"]>[0];",
7401
8318
  "doc": "/** The argument Bun passes to a plugin's `setup` - Bun doesn't export the type, so derive it. */"
7402
8319
  },
8320
+ {
8321
+ "name": "PluginTypeCollapsed",
8322
+ "kind": "interface",
8323
+ "package": "@nifrajs/core",
8324
+ "signature": "export interface PluginTypeCollapsed {\n readonly [COLLAPSED]: \"definePlugin erased the caller's server type: use defineContextPlugin (adds context) or defineRouterPlugin (routes/hooks only), or pin the input type\";\n}",
8325
+ "doc": "/**\n * What {@link definePlugin} returns when its `apply` argument never pinned the input server type -\n * the `definePlugin(\"x\", (app) => ...)` arrow, where `app` falls back to `AnyServer`.\n *\n * It is deliberately **not callable**, so `app.use(thatPlugin)` is a type error at the call site\n * instead of a silent widening to `Server<any, any>` that surfaces hundreds of lines away as\n * `Property 'x' does not exist on type 'Promise<Result<unknown, unknown>>'` in the typed client.\n *\n * The plugin still works at runtime. To fix the type, pick the definer that matches what it does:\n *\n * - adds context via `derive`/`decorate` -> {@link defineContextPlugin}\n * - mounts routes/hooks and adds NO context -> {@link defineRouterPlugin} ({@link defineIdentityPlugin})\n * - genuinely needs `definePlugin`: annotate the parameter (`(app: typeof api) => ...`) or pass\n * explicit type arguments (`definePlugin<typeof api, typeof api>(...)`).\n */"
8326
+ },
8327
+ {
8328
+ "name": "PluginTypeCollapsed",
8329
+ "kind": "interface",
8330
+ "package": "nifra",
8331
+ "signature": "export interface PluginTypeCollapsed {\n readonly [COLLAPSED]: \"definePlugin erased the caller's server type: use defineContextPlugin (adds context) or defineRouterPlugin (routes/hooks only), or pin the input type\";\n}",
8332
+ "doc": "/**\n * What {@link definePlugin} returns when its `apply` argument never pinned the input server type -\n * the `definePlugin(\"x\", (app) => ...)` arrow, where `app` falls back to `AnyServer`.\n *\n * It is deliberately **not callable**, so `app.use(thatPlugin)` is a type error at the call site\n * instead of a silent widening to `Server<any, any>` that surfaces hundreds of lines away as\n * `Property 'x' does not exist on type 'Promise<Result<unknown, unknown>>'` in the typed client.\n *\n * The plugin still works at runtime. To fix the type, pick the definer that matches what it does:\n *\n * - adds context via `derive`/`decorate` -> {@link defineContextPlugin}\n * - mounts routes/hooks and adds NO context -> {@link defineRouterPlugin} ({@link defineIdentityPlugin})\n * - genuinely needs `definePlugin`: annotate the parameter (`(app: typeof api) => ...`) or pass\n * explicit type arguments (`definePlugin<typeof api, typeof api>(...)`).\n */"
8333
+ },
7403
8334
  {
7404
8335
  "name": "PngRenderer",
7405
8336
  "kind": "type",
@@ -7562,7 +8493,7 @@
7562
8493
  "name": "prettyJson",
7563
8494
  "kind": "function",
7564
8495
  "package": "@nifrajs/middleware",
7565
- "signature": "export declare function prettyJson(options?: PrettyJsonOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
8496
+ "signature": "export declare function prettyJson(options?: PrettyJsonOptions): import(\"@nifrajs/core\").IdentityPlugin;",
7566
8497
  "doc": "/**\n * Pretty-print JSON responses for debugging and developer-facing APIs. It only touches JSON content,\n * skips encoded responses, caps inspection size, and leaves invalid JSON untouched.\n */"
7567
8498
  },
7568
8499
  {
@@ -7603,7 +8534,7 @@
7603
8534
  "name": "problemDetails",
7604
8535
  "kind": "function",
7605
8536
  "package": "@nifrajs/middleware",
7606
- "signature": "export declare function problemDetails(options?: ProblemDetailsOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
8537
+ "signature": "export declare function problemDetails(options?: ProblemDetailsOptions): import(\"@nifrajs/core\").IdentityPlugin;",
7607
8538
  "doc": "/**\n * Opt-in RFC 9457 formatting for Nifra's structured error envelope.\n *\n * The default `{ ok: false, error }` response remains unchanged. This plugin only converts that\n * framework envelope, so custom JSON errors and already-formatted problem documents pass through.\n * Raw JSON error Responses are supported through a capped clone; encoded responses are never drained.\n */"
7608
8539
  },
7609
8540
  {
@@ -7612,6 +8543,79 @@
7612
8543
  "package": "@nifrajs/middleware",
7613
8544
  "signature": "export interface ProblemDetailsOptions {\n /** Include only the request pathname as `instance`. Query strings are never included. Default false. */\n readonly includeInstance?: boolean;\n /** Prefix for code-specific problem types. Default `about:blank`. */\n readonly typeBase?: string;\n /** Maximum JSON error body inspected. Default 64 KiB. */\n readonly maxBytes?: number;\n}"
7614
8545
  },
8546
+ {
8547
+ "name": "ProjectEvidenceAssurance",
8548
+ "kind": "interface",
8549
+ "package": "@nifrajs/core",
8550
+ "signature": "export interface ProjectEvidenceAssurance {\n readonly ok: boolean;\n readonly routes: readonly ProjectEvidenceAssuranceRoute[];\n readonly findings: readonly AssuranceFinding[];\n}"
8551
+ },
8552
+ {
8553
+ "name": "ProjectEvidenceAssuranceRoute",
8554
+ "kind": "interface",
8555
+ "package": "@nifrajs/core",
8556
+ "signature": "export interface ProjectEvidenceAssuranceRoute {\n readonly method: string;\n readonly path: string;\n readonly rule?: string;\n readonly evidence: readonly AssuranceEvidence[];\n readonly missing: readonly string[];\n readonly forbidden: readonly string[];\n}"
8557
+ },
8558
+ {
8559
+ "name": "ProjectEvidenceCapabilities",
8560
+ "kind": "interface",
8561
+ "package": "@nifrajs/core",
8562
+ "signature": "export interface ProjectEvidenceCapabilities {\n readonly ok: boolean;\n readonly routes: readonly ProjectEvidenceCapabilityRoute[];\n readonly findings: readonly CapabilityFinding[];\n}"
8563
+ },
8564
+ {
8565
+ "name": "ProjectEvidenceCapabilityRoute",
8566
+ "kind": "interface",
8567
+ "package": "@nifrajs/core",
8568
+ "signature": "export interface ProjectEvidenceCapabilityRoute {\n readonly method: string;\n readonly path: string;\n readonly declared: readonly string[];\n readonly evidence: readonly CapabilityEvidence[];\n readonly unproven: readonly string[];\n readonly covered: boolean;\n readonly classification?: AssuredCapabilityRoute[\"classification\"];\n}"
8569
+ },
8570
+ {
8571
+ "name": "ProjectEvidenceOptions",
8572
+ "kind": "interface",
8573
+ "package": "@nifrajs/core",
8574
+ "signature": "export interface ProjectEvidenceOptions {\n readonly assurance?: AssuranceReport;\n readonly capabilities?: CapabilityAssuranceReport;\n /** Optional static source locations keyed by `${METHOD}\\n${path}`. */\n readonly sourceLocations?: ReadonlyMap<string, readonly ProjectEvidenceSourceLocation[]>;\n}"
8575
+ },
8576
+ {
8577
+ "name": "ProjectEvidenceRoute",
8578
+ "kind": "interface",
8579
+ "package": "@nifrajs/core",
8580
+ "signature": "export interface ProjectEvidenceRoute {\n readonly method: string;\n readonly path: string;\n readonly schema?: ProjectEvidenceSchema;\n readonly assurance?: readonly AssuranceEvidence[];\n readonly capabilities?: readonly string[];\n readonly family?: boolean;\n readonly classification?: ResponseClassification;\n readonly tool?: ReflectedRoute[\"tool\"];\n readonly source?: readonly ProjectEvidenceSourceLocation[];\n}"
8581
+ },
8582
+ {
8583
+ "name": "ProjectEvidenceSchema",
8584
+ "kind": "interface",
8585
+ "package": "@nifrajs/core",
8586
+ "signature": "export interface ProjectEvidenceSchema {\n readonly bodyLimit?: number | \"unlimited\";\n readonly bodyLimitReason?: string;\n readonly headers?: 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}"
8587
+ },
8588
+ {
8589
+ "name": "ProjectEvidenceSchemaPart",
8590
+ "kind": "interface",
8591
+ "package": "@nifrajs/core",
8592
+ "signature": "export interface ProjectEvidenceSchemaPart {\n readonly jsonSchema?: JsonSchema;\n readonly fields?: readonly ReflectedSchemaField[];\n}"
8593
+ },
8594
+ {
8595
+ "name": "ProjectEvidenceSnapshot",
8596
+ "kind": "interface",
8597
+ "package": "@nifrajs/core",
8598
+ "signature": "export interface ProjectEvidenceSnapshot {\n readonly version: 1;\n readonly routes: readonly ProjectEvidenceRoute[];\n readonly assurance?: ProjectEvidenceAssurance;\n readonly capabilities?: ProjectEvidenceCapabilities;\n}",
8599
+ "doc": "/** One deterministic, persistence-safe view of a project's public and trust-relevant facts. */"
8600
+ },
8601
+ {
8602
+ "name": "ProjectEvidenceSourceLocation",
8603
+ "kind": "interface",
8604
+ "package": "@nifrajs/core",
8605
+ "signature": "export interface ProjectEvidenceSourceLocation {\n readonly file: string;\n readonly line?: number;\n readonly column?: number;\n}"
8606
+ },
8607
+ {
8608
+ "name": "ProjectFacts",
8609
+ "kind": "interface",
8610
+ "package": "@nifrajs/cli",
8611
+ "signature": "export interface ProjectFacts {\n readonly [key: string]: unknown;\n}"
8612
+ },
8613
+ {
8614
+ "name": "ProjectWorkGraphResult",
8615
+ "kind": "interface",
8616
+ "package": "@nifrajs/cli",
8617
+ "signature": "export interface ProjectWorkGraphResult {\n readonly graph: WorkGraph;\n readonly impact: ImpactReport;\n readonly plan: ProofPlan;\n readonly evidence: EvidenceBundle;\n}"
8618
+ },
7615
8619
  {
7616
8620
  "name": "prompt",
7617
8621
  "kind": "function",
@@ -7688,6 +8692,36 @@
7688
8692
  "signature": "export interface PromptResponseFormat {\n readonly name: string;\n readonly strict: true;\n readonly schema: JsonSchema;\n}",
7689
8693
  "doc": "/** The structured-output format handed to the provider (OpenAI `json_schema` shape; trivially\n * adaptable to Anthropic tool-input or Gemini `responseSchema`). */"
7690
8694
  },
8695
+ {
8696
+ "name": "ProofEvidence",
8697
+ "kind": "interface",
8698
+ "package": "@nifrajs/cli",
8699
+ "signature": "export interface ProofEvidence {\n readonly id: string;\n readonly status: ProofStatus;\n readonly level: number;\n readonly nodeIds: readonly string[];\n readonly command: string;\n readonly fix?: string;\n}"
8700
+ },
8701
+ {
8702
+ "name": "ProofKind",
8703
+ "kind": "type",
8704
+ "package": "@nifrajs/cli",
8705
+ "signature": "export type ProofKind = \"typecheck\" | \"contract\" | \"assurance\" | \"suite\";"
8706
+ },
8707
+ {
8708
+ "name": "ProofPlan",
8709
+ "kind": "interface",
8710
+ "package": "@nifrajs/cli",
8711
+ "signature": "export interface ProofPlan {\n readonly steps: readonly ProofStep[];\n readonly targetLevel: number;\n}"
8712
+ },
8713
+ {
8714
+ "name": "ProofStatus",
8715
+ "kind": "type",
8716
+ "package": "@nifrajs/cli",
8717
+ "signature": "export type ProofStatus = \"pass\" | \"fail\" | \"skip\" | \"pending\";"
8718
+ },
8719
+ {
8720
+ "name": "ProofStep",
8721
+ "kind": "interface",
8722
+ "package": "@nifrajs/cli",
8723
+ "signature": "export interface ProofStep {\n readonly id: string;\n readonly kind: ProofKind;\n readonly level: number;\n readonly cost: number;\n readonly command: string;\n readonly nodeIds: readonly string[];\n readonly fix?: string;\n}"
8724
+ },
7691
8725
  {
7692
8726
  "name": "PROTOCOL_VERSION",
7693
8727
  "kind": "const",
@@ -7695,6 +8729,33 @@
7695
8729
  "signature": "export declare const PROTOCOL_VERSION = \"2025-06-18\";",
7696
8730
  "doc": "/** The protocol revision this server advertises by default. A handshake-era version - the HTTP transport\n * still uses `initialize`; current clients reach it through their backward-compatibility fallback.\n * `initialize` echoes the client's own requested version instead when it's one this server also speaks\n * ({@link SUPPORTED_PROTOCOL_VERSIONS}). */"
7697
8731
  },
8732
+ {
8733
+ "name": "proveIdempotency",
8734
+ "kind": "function",
8735
+ "package": "@nifrajs/testing",
8736
+ "signature": "export declare function proveIdempotency(options: {\n readonly run: () => Promise<EffectLedger> | EffectLedger;\n readonly runs?: number;\n}): Promise<IdempotencyProof>;",
8737
+ "doc": "/** Run a token-only effect workload repeatedly and report the first stable replay differences. */"
8738
+ },
8739
+ {
8740
+ "name": "ProxyContext",
8741
+ "kind": "interface",
8742
+ "package": "@nifrajs/proxy",
8743
+ "signature": "export interface ProxyContext {\n readonly req: Request;\n readonly clientIp?: string | undefined;\n readonly signal?: AbortSignal | undefined;\n}",
8744
+ "doc": "/** Structural slice of a nifra `Context` the proxy reads - a plain `Request` works too. */"
8745
+ },
8746
+ {
8747
+ "name": "ProxyHandler",
8748
+ "kind": "type",
8749
+ "package": "@nifrajs/proxy",
8750
+ "signature": "export type ProxyHandler = (input: Request | ProxyContext) => Promise<Response>;",
8751
+ "doc": "/** Forward a request (or a nifra context) to the configured upstream. */"
8752
+ },
8753
+ {
8754
+ "name": "ProxyOptions",
8755
+ "kind": "interface",
8756
+ "package": "@nifrajs/proxy",
8757
+ "signature": "export interface ProxyOptions {\n /**\n * The upstream to forward every request to, as a **bare origin** (`https://api.internal:8443`).\n * A path, query, fragment, or credentials in the URL throws at construction; only `http:` and\n * `https:` are accepted. The forwarded URL is this origin + the incoming path and query.\n */\n readonly upstream: string;\n /** Mount prefix to remove from the incoming path before forwarding (`/api` + request\n * `/api/users` → upstream `/users`). A path outside the prefix is forwarded unchanged. */\n readonly stripPrefix?: string;\n /**\n * Forward caller metadata upstream. Default **false**: `Forwarded` and `X-Forwarded-*` headers\n * are stripped, so a client-forged chain never reaches the upstream. When true, the inbound\n * `X-Forwarded-For` is kept with the observed caller IP appended (pass a `ProxyContext` so\n * `c.clientIp` - already filtered by the app's trust declaration - is what gets appended). With a\n * bare `Request`, forwarding metadata is suppressed rather than passed through.\n */\n readonly forwardClientIp?: boolean;\n /** Upstream response deadline in milliseconds. Default `30_000`; expiry answers `504`. */\n readonly timeoutMs?: number;\n /** Static headers to set on every forwarded request (after hygiene, so they always win). */\n readonly headers?: Readonly<Record<string, string>>;\n}"
8758
+ },
7698
8759
  {
7699
8760
  "name": "PublicDirCache",
7700
8761
  "kind": "interface",
@@ -7749,6 +8810,12 @@
7749
8810
  "signature": "export interface QueryHandle<T = unknown> {\n snapshot: () => QueryState<T>;\n subscribe: (listener: () => void) => () => void;\n /** Fetch when stale or absent (fresh ⇒ no-op); joins an in-flight fetch (dedup). Resolves to the\n * data, or rejects if the fetch threw. */\n fetch: () => Promise<T>;\n /** Refetch regardless of staleness (still joins an in-flight fetch). */\n refetch: () => Promise<T>;\n}",
7750
8811
  "doc": "/** A stable per-key handle: subscribe to its state, read a snapshot, trigger a fetch/refetch. */"
7751
8812
  },
8813
+ {
8814
+ "name": "queryImpact",
8815
+ "kind": "function",
8816
+ "package": "@nifrajs/cli",
8817
+ "signature": "export declare function queryImpact(graph: WorkGraph, changedFiles: readonly string[]): ImpactReport;"
8818
+ },
7752
8819
  {
7753
8820
  "name": "QueryOptions",
7754
8821
  "kind": "interface",
@@ -7995,6 +9062,19 @@
7995
9062
  "signature": "export declare function recordCapabilityOutcome(context: object, capability: string, options: CapabilityOutcomeOptions): void;",
7996
9063
  "doc": "/** Record the terminal outcome of an already-admitted capability without debiting admission twice. */"
7997
9064
  },
9065
+ {
9066
+ "name": "recordProof",
9067
+ "kind": "function",
9068
+ "package": "@nifrajs/cli",
9069
+ "signature": "export declare function recordProof(bundle: EvidenceBundle, proof: ProofEvidence): EvidenceBundle;"
9070
+ },
9071
+ {
9072
+ "name": "recordTrajectory",
9073
+ "kind": "const",
9074
+ "package": "@nifrajs/testing",
9075
+ "signature": "export declare const recordTrajectory: typeof createTrajectoryTranscript;",
9076
+ "doc": "/** Alias that reads naturally at a call site which has just completed a run. */"
9077
+ },
7998
9078
  {
7999
9079
  "name": "redactForEmission",
8000
9080
  "kind": "function",
@@ -8051,6 +9131,13 @@
8051
9131
  "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}",
8052
9132
  "doc": "/** Options for {@link redirect}. */"
8053
9133
  },
9134
+ {
9135
+ "name": "referenceFaultProfile",
9136
+ "kind": "const",
9137
+ "package": "@nifrajs/testing",
9138
+ "signature": "export declare const referenceFaultProfile: FaultProfile;",
9139
+ "doc": "/** A small smoke profile for consumers that only need to verify the harness wiring. */"
9140
+ },
8054
9141
  {
8055
9142
  "name": "reflectClassification",
8056
9143
  "kind": "function",
@@ -8068,7 +9155,7 @@
8068
9155
  "name": "ReflectedRouteSchema",
8069
9156
  "kind": "interface",
8070
9157
  "package": "@nifrajs/core",
8071
- "signature": "export interface ReflectedRouteSchema {\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}"
9158
+ "signature": "export interface ReflectedRouteSchema {\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 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}"
8072
9159
  },
8073
9160
  {
8074
9161
  "name": "ReflectedSchemaField",
@@ -8098,6 +9185,12 @@
8098
9185
  "signature": "export declare function registerBlocker(shouldBlock: BlockerFunction, onChange: (blocker: Blocker) => void): () => void;",
8099
9186
  "doc": "/**\n * Register a navigation guard, returning an unregister function. `onChange` is called with the current\n * {@link Blocker} whenever its state changes (so the adapter can re-render its confirmation UI). Before\n * `installHistory` has run (SSR, pre-hydration), there's no controller: registration is a no-op and the\n * caller stays on {@link IDLE_BLOCKER}, degrading to native navigation. Called by an adapter's\n * `useBlocker`, not by app code directly.\n */"
8100
9187
  },
9188
+ {
9189
+ "name": "registerFixRecipe",
9190
+ "kind": "function",
9191
+ "package": "@nifrajs/cli",
9192
+ "signature": "export declare function registerFixRecipe(recipe: FixRecipe): void;"
9193
+ },
8101
9194
  {
8102
9195
  "name": "registerFormat",
8103
9196
  "kind": "function",
@@ -8150,8 +9243,8 @@
8150
9243
  "name": "RenderAdapter",
8151
9244
  "kind": "interface",
8152
9245
  "package": "@nifrajs/web",
8153
- "signature": "export interface RenderAdapter {\n /**\n * Server: render a route's layout `chain` (outermost layout → page) to a **stream** of HTML\n * bytes, including the framework's hydration markers. The page (innermost) receives `props`\n * (the loader data); each layout wraps the child via its `children`. Returns (or resolves to)\n * a Web `ReadableStream<Uint8Array>`: a streaming renderer flushes the shell first and streams\n * Suspense boundaries as they resolve; a non-streaming renderer may return a one-chunk stream.\n * May be async - e.g. React resolves once the shell is renderable, so a shell-render throw can\n * still map to an error status before any byte is sent.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /**\n * Server (optional): render the chain to a complete HTML **string** in one pass, with the same\n * hydration markers `renderToStream` produces. When provided, `renderPage` uses it for any page\n * that does **not** `defer()` - buffering the document is faster than the streaming pipeline there,\n * because the framework's synchronous renderer (React `renderToString`, Solid `renderToString`,\n * Preact `render`, Vue `renderToString`, Svelte `render`) is markedly cheaper than its streaming\n * renderer - most visibly on Bun, where React Fizz / Solid `renderToStream` are the heaviest. Pages\n * that `defer()` keep the streaming path (progressive `<Await>` needs it). Markup MUST be\n * hydration-equivalent to `renderToStream`; a throw surfaces like the streaming shell-readiness\n * await (the `_error` boundary maps it to a status). Omit it to always stream.\n */\n renderToString?(chain: readonly unknown[], props: RenderProps): string | Promise<string>;\n /**\n * Server: per-document bootstrap markup injected into `<head>` that the client\n * `hydrate` requires (Solid: `generateHydrationScript()`). Empty string if none.\n */\n hydrationHead(nonce?: string): string;\n}",
8154
- "doc": "/**\n * The seam every render adapter implements. New adapters should prove these invariants with\n * {@link assertRenderAdapterConformance}; framework-specific behavior remains locally tested.\n */"
9246
+ "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.\n */\n renderToStream(chain: readonly unknown[], props: RenderProps): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;\n /** Render the chain to a complete HTML string when no content is deferred. */\n renderToString?(chain: readonly unknown[], props: RenderProps): string | Promise<string>;\n /** Per-document bootstrap markup injected into `<head>` for client hydration. */\n hydrationHead(nonce?: string): string;\n}",
9247
+ "doc": "/**\n * The seam every render adapter implements. New adapters should prove these invariants with\n * `assertRenderAdapterConformance`; framework-specific behavior remains locally tested.\n */"
8155
9248
  },
8156
9249
  {
8157
9250
  "name": "RenderAdapterConformanceError",
@@ -8224,8 +9317,8 @@
8224
9317
  "name": "RenderProps",
8225
9318
  "kind": "interface",
8226
9319
  "package": "@nifrajs/web",
8227
- "signature": "export interface RenderProps {\n readonly data: unknown;\n /**\n * Per-layout loader data, aligned index-for-index with the layout prefix of `chain`.\n *\n * Absent when no layout in the chain exports a `loader`, so a page-only app is byte-identical to\n * before. An adapter that does not read it renders exactly as it did; one that does passes\n * `layoutData[i]` to `chain[i]`.\n */\n readonly layoutData?: readonly unknown[];\n readonly actionData?: unknown;\n /** True while a client navigation or submit is in flight (client-only; absent/false on SSR). */\n readonly pending?: boolean;\n /** The path a client navigation is transitioning TO while `pending` (client-only; absent on SSR and\n * when idle). Lets an adapter tell a `NavLink` whether its own target is the one loading. */\n readonly pendingPath?: string;\n /** The in-flight client submit, for optimistic UI (client-only; absent on SSR + when idle). */\n readonly submission?: Submission;\n /** The matched route's decoded path params (`/users/:id` → `{ id: \"7\" }`). Threaded identically on\n * SSR (from the request match) and on client navigation (from router state) so an adapter's\n * `useParams` reads the same value on both, with no hydration mismatch. Absent ⇒ no params (`{}`). */\n readonly params?: Readonly<Record<string, string>>;\n /** The current URL's `pathname + search` (no hash - the hash never reaches the server). Threaded on\n * SSR and client alike so an adapter's `useLocation`/`useSearchParams` hydrate consistently. Absent\n * on adapters/callers that don't supply it (treated as `\"\"`). */\n readonly path?: string;\n /** The route's typed, validated search params (the value the loader also gets as `ctx.search`),\n * threaded to the adapter's `useSearch`. Derived identically on SSR (from the request) and on client\n * navigation (adapter mount) via the shared `searchOf`, so a component reading it hydrates with no\n * drift. Absent ⇒ no search context (`{}`). */\n readonly search?: Record<string, unknown>;\n}",
8228
- "doc": "/** The data handed to a route component. Opaque to the core. `actionData` is the return of a\n * route `action` after a POST (absent on plain GETs). `pending` + `submission` are client-only\n * (absent on SSR): they drive **optimistic UI** - render from `submission.formData` while `pending`. */"
9320
+ "signature": "export interface RenderProps {\n readonly data: unknown;\n /** Per-layout loader data, aligned index-for-index with the layout prefix of `chain`. */\n readonly layoutData?: readonly unknown[];\n readonly actionData?: unknown;\n /** True while a client navigation or submit is in flight (client-only; absent/false on SSR). */\n readonly pending?: boolean;\n /** The path a client navigation is transitioning TO while `pending` (client-only; absent on SSR). */\n readonly pendingPath?: string;\n /** The in-flight client submit, for optimistic UI (client-only; absent on SSR). */\n readonly submission?: Submission;\n /** The matched route's decoded path params. */\n readonly params?: Readonly<Record<string, string>>;\n /** The current URL's `pathname + search` (no hash). */\n readonly path?: string;\n /** The route's typed, validated search params. */\n readonly search?: Record<string, unknown>;\n}",
9321
+ "doc": "/** The data handed to a route component. */"
8229
9322
  },
8230
9323
  {
8231
9324
  "name": "renderRouteManifest",
@@ -8241,6 +9334,31 @@
8241
9334
  "signature": "export declare function renderSizeReport(report: SizeReport): string;",
8242
9335
  "doc": "/**\n * Render a {@link SizeReport} as a terse aligned table (biggest first) with a totals row - the text\n * `nifra build --report` prints. Pure (string in, string out) so the formatting is unit-testable.\n */"
8243
9336
  },
9337
+ {
9338
+ "name": "renderWorkGraphJson",
9339
+ "kind": "function",
9340
+ "package": "@nifrajs/cli",
9341
+ "signature": "export declare function renderWorkGraphJson(result: ProjectWorkGraphResult): string;"
9342
+ },
9343
+ {
9344
+ "name": "renderWorkGraphText",
9345
+ "kind": "function",
9346
+ "package": "@nifrajs/cli",
9347
+ "signature": "export declare function renderWorkGraphText(result: ProjectWorkGraphResult): string;"
9348
+ },
9349
+ {
9350
+ "name": "replayAgent",
9351
+ "kind": "function",
9352
+ "package": "@nifrajs/agent",
9353
+ "signature": "export declare function replayAgent<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(definition: AgentDefinition<InputSchema, OutputSchema>, input: AgentTurnInput, ports: Omit<AgentPorts, \"model\">, transcript: AgentTranscript, options: RunAgentOptions): Promise<AgentRunResult<NonNullable<OutputSchema[\"~standard\"][\"types\"]>[\"output\"]>>;"
9354
+ },
9355
+ {
9356
+ "name": "ReplayFile",
9357
+ "kind": "interface",
9358
+ "package": "@nifrajs/core",
9359
+ "signature": "export interface ReplayFile {\n readonly version: 1;\n readonly gate: string;\n readonly case: string;\n readonly seed: string;\n readonly inputsDigest: string;\n readonly meta: Readonly<Record<string, unknown>>;\n}",
9360
+ "doc": "/** Versioned, token-only replay metadata shared by verification tools. */"
9361
+ },
8244
9362
  {
8245
9363
  "name": "replayIncident",
8246
9364
  "kind": "function",
@@ -8254,6 +9372,19 @@
8254
9372
  "package": "@nifrajs/testing",
8255
9373
  "signature": "export interface ReplayIncidentOptions {\n readonly origin?: string;\n /** Also require the response body SHAPE to match the captured shape (not just status). Default false. */\n readonly assertShape?: boolean;\n}"
8256
9374
  },
9375
+ {
9376
+ "name": "replayTrajectory",
9377
+ "kind": "function",
9378
+ "package": "@nifrajs/testing",
9379
+ "signature": "export declare function replayTrajectory<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(definition: AgentDefinition<InputSchema, OutputSchema>, input: AgentTurnInput, ports: Omit<AgentPorts, \"model\">, transcript: TrajectoryTranscript, options: ReplayTrajectoryOptions): Promise<TrajectoryReplayResult<NonNullable<OutputSchema[\"~standard\"][\"types\"]>[\"output\"]>>;",
9380
+ "doc": "/**\n * Replay a recorded run with local model decisions and dry-run tools. The supplied model port is\n * never called. Fault schedules use the existing deterministic failure-lab controller.\n */"
9381
+ },
9382
+ {
9383
+ "name": "ReplayTrajectoryOptions",
9384
+ "kind": "interface",
9385
+ "package": "@nifrajs/testing",
9386
+ "signature": "export interface ReplayTrajectoryOptions {\n readonly state: AgentTurnState;\n readonly maxTurns?: number;\n readonly goal?: (output: unknown) => boolean;\n readonly faultProfile?: FaultProfile;\n readonly seed?: number;\n}"
9387
+ },
8257
9388
  {
8258
9389
  "name": "reproduciblePath",
8259
9390
  "kind": "function",
@@ -8272,8 +9403,8 @@
8272
9403
  "name": "requestId",
8273
9404
  "kind": "function",
8274
9405
  "package": "@nifrajs/middleware",
8275
- "signature": "export declare function requestId(options?: RequestIdOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").Server<any, any>>;",
8276
- "doc": "/**\n * A {@link definePlugin} plugin that gives every request a stable id: it reuses an inbound\n * `x-request-id` (or generates one), exposes it on the handler context as **`c.requestId`** (typed,\n * threaded by `derive`), and echoes it on the response header. Idempotent - applying it twice is a\n * no-op.\n *\n * ```ts\n * app.use(requestId()) // c.requestId available downstream; X-Request-Id on responses\n * ```\n */"
9406
+ "signature": "export declare function requestId(options?: RequestIdOptions): ContextPlugin<{\n requestId: string;\n}>;",
9407
+ "doc": "/**\n * A {@link defineContextPlugin} plugin that gives every request a stable id: it reuses an inbound\n * `x-request-id` (or generates one), exposes it on the handler context as **`c.requestId`** (typed,\n * threaded by `derive`), and echoes it on EVERY response leaving the app - handler-returned raw\n * `Response`s and redirects, `onRequest` short-circuits (an auth 401, an admission 429), and\n * framework-generated 404/405/422/timeout responses included. Core deliberately does not merge\n * `c.set.headers` onto a handler-returned `Response`, so the echo lives in an app-global\n * `onResponse` hook (paired with the derive through a `WeakMap` keyed on the request) with a node\n * twin, keeping the Node adapter on its direct writer with no request-walk cost. Idempotent -\n * applying it twice is a no-op.\n *\n * ```ts\n * app.use(requestId()) // c.requestId available downstream; X-Request-Id on responses\n * ```\n */"
8277
9408
  },
8278
9409
  {
8279
9410
  "name": "RequestIdOptions",
@@ -8381,6 +9512,12 @@
8381
9512
  "package": "@nifrajs/image",
8382
9513
  "signature": "export interface ResolvedImage {\n readonly src: string;\n readonly srcSet?: string;\n readonly sizes?: string;\n readonly width: number;\n readonly height: number;\n readonly alt: string;\n readonly loading: \"lazy\" | \"eager\";\n readonly decoding: \"async\";\n readonly fetchPriority?: \"high\";\n}"
8383
9514
  },
9515
+ {
9516
+ "name": "ResolvedLocale",
9517
+ "kind": "interface",
9518
+ "package": "@nifrajs/i18n",
9519
+ "signature": "export interface ResolvedLocale {\n /** Always a member of `locales` (or `defaultLocale`) - never raw request input. */\n readonly locale: Locale;\n readonly source: LocaleSource;\n /** The supported locale the request's cookie currently resolves to, when\n * {@link NegotiateOptions.cookie} is configured and the cookie holds a valid value. Lets a caller\n * persist a new choice only when it actually differs. */\n readonly cookie?: Locale;\n}"
9520
+ },
8384
9521
  {
8385
9522
  "name": "resolveImage",
8386
9523
  "kind": "function",
@@ -8388,6 +9525,13 @@
8388
9525
  "signature": "export declare function resolveImage(props: ImageProps, loader?: ImageLoader): ResolvedImage;",
8389
9526
  "doc": "/**\n * Resolve {@link ImageProps} + an {@link ImageLoader} into `<img>` attributes. CLS-safe (`width`/\n * `height` required + > 0, else a dev error), lazy + async-decoding by default, with a responsive\n * `srcSet` built from `widths` via the loader. If every width produces the same URL (e.g.\n * {@link identityLoader}), `srcSet` is omitted (it'd be redundant).\n */"
8390
9527
  },
9528
+ {
9529
+ "name": "resolveLocale",
9530
+ "kind": "function",
9531
+ "package": "@nifrajs/i18n",
9532
+ "signature": "export declare function resolveLocale(request: Request | LocaleParts, options: NegotiateOptions): ResolvedLocale;",
9533
+ "doc": "/**\n * Negotiate the request's locale and report which source chose it. Order: a valid\n * {@link NegotiateOptions.queryParam} value → a valid {@link NegotiateOptions.cookie} value →\n * `Accept-Language` (each `q`-ranked tag, exact then base-subtag) → `defaultLocale`.\n */"
9534
+ },
8391
9535
  {
8392
9536
  "name": "resolveMeta",
8393
9537
  "kind": "function",
@@ -8582,6 +9726,13 @@
8582
9726
  "signature": "export interface ResponseHeadersView {\n get(name: string): string | null;\n has(name: string): boolean;\n set(name: string, value: string): void;\n append(name: string, value: string): void;\n delete(name: string): void;\n}",
8583
9727
  "doc": "/**\n * The mutable, case-insensitive header surface a portable {@link ResponseHeadersHook} writes\n * through. Deliberately the subset of the Web `Headers` interface every runtime can satisfy\n * natively: on the Web paths the hook receives the response's own `Headers` object directly (which\n * structurally implements this), and on the Node direct-writer path it receives a thin view over\n * the outcome's plain header record - so ONE hook implementation is fast everywhere.\n */"
8584
9728
  },
9729
+ {
9730
+ "name": "ResponseStream",
9731
+ "kind": "interface",
9732
+ "package": "@nifrajs/aws-lambda",
9733
+ "signature": "export interface ResponseStream {\n write(chunk: Uint8Array | string): unknown;\n end(): unknown;\n once?(event: string, listener: () => void): unknown;\n}",
9734
+ "doc": "/** The Node `Writable`-shaped stream Lambda hands a streaming handler. Declared structurally. */"
9735
+ },
8585
9736
  {
8586
9737
  "name": "Result",
8587
9738
  "kind": "type",
@@ -8589,6 +9740,13 @@
8589
9740
  "signature": "export type Result<Data, Errors = unknown> = {\n readonly ok: true;\n readonly status: number;\n readonly data: Data;\n readonly error: null;\n} | ([Errors] extends [Record<number, unknown>] ? DeclaredFailures<Errors> | {\n readonly ok: false;\n readonly status: Exclude<ErrorStatus, Extract<keyof Errors, number>> | 0;\n readonly data: unknown;\n readonly error: ApiError;\n} : {\n readonly ok: false;\n readonly status: number;\n readonly data: Errors;\n readonly error: ApiError;\n});",
8590
9741
  "doc": "/**\n * The outcome of a client call. The client never throws - inspect `ok` to branch.\n *\n * On success, `data` is the route's response type. On failure the union is DISCRIMINATED BY\n * `status` when the route declares an `errors` record: `status === 404` narrows `data` to the\n * declared 404 body; every undeclared status (plus `0` for a transport error with no response)\n * falls into a fallback arm whose `data` is `unknown`. A route with no `errors` contract keeps a\n * single failure arm with `data: Errors` (`unknown`). `error` is always the server's normalized\n * `{ error, issues? }` summary on failure, `null` on success.\n */"
8591
9742
  },
9743
+ {
9744
+ "name": "resumeAgent",
9745
+ "kind": "function",
9746
+ "package": "@nifrajs/agent",
9747
+ "signature": "export declare function resumeAgent<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(definition: AgentDefinition<InputSchema, OutputSchema>, turnId: string, input: AgentTurnInput, ports: AgentPorts, options?: Omit<RunAgentOptions, \"state\">): Promise<AgentRunResult<NonNullable<OutputSchema[\"~standard\"][\"types\"]>[\"output\"]>>;",
9748
+ "doc": "/** Load a saved token-only state record and continue a bounded run. */"
9749
+ },
8592
9750
  {
8593
9751
  "name": "ResvgConstructor",
8594
9752
  "kind": "type",
@@ -8712,14 +9870,14 @@
8712
9870
  "kind": "const",
8713
9871
  "package": "@nifrajs/web",
8714
9872
  "signature": "export declare const ROOT_ATTRIBUTE = \"data-nifra-root\";",
8715
- "doc": "/**\n * Marker attribute on the app container, emitted ONLY when `rootId` is not the default.\n *\n * `rootId` is a per-RENDER option; the client entry is a per-BUILD artifact, so it cannot be\n * generated knowing which id a given render will use. The container therefore announces itself, and\n * the entry finds it by this attribute before falling back to `#root`. It has to be the DOM rather\n * than another `window.__NIFRA_*` global: a second copy of the id can drift from the markup, while\n * this is written by the same expression that writes the id and cannot.\n *\n * Absent on a default render, so an app that never sets `rootId` emits the same bytes it always has.\n */"
9873
+ "doc": "/** Marker attribute used to find a non-default hydration container. */"
8716
9874
  },
8717
9875
  {
8718
9876
  "name": "ROUTE_GLOBAL",
8719
9877
  "kind": "const",
8720
9878
  "package": "@nifrajs/web",
8721
9879
  "signature": "export declare const ROUTE_GLOBAL = \"__NIFRA_ROUTE__\";",
8722
- "doc": "/** Global the server writes the matched route id into; the client uses it to pick the chain. */"
9880
+ "doc": "/** Global the server writes the matched route id into. */"
8723
9881
  },
8724
9882
  {
8725
9883
  "name": "RouteBody",
@@ -8745,7 +9903,7 @@
8745
9903
  "name": "RouteChange",
8746
9904
  "kind": "interface",
8747
9905
  "package": "@nifrajs/core",
8748
- "signature": "export interface RouteChange {\n readonly severity: DiffSeverity;\n readonly method: string;\n readonly path: string;\n /** Which part of the contract changed; \"route\" for add/remove of the whole route. */\n readonly section: \"route\" | \"body\" | \"query\" | \"response\" | \"sse\" | \"errors\";\n /** The top-level field (or error status) the change is about, when field-granular. */\n readonly field?: string;\n readonly message: string;\n}"
9906
+ "signature": "export interface RouteChange {\n readonly severity: DiffSeverity;\n readonly method: string;\n readonly path: string;\n /** Which part of the contract changed; \"route\" for add/remove of the whole route. */\n readonly section: \"route\" | \"headers\" | \"body\" | \"query\" | \"response\" | \"sse\" | \"errors\";\n /** The top-level field (or error status) the change is about, when field-granular. */\n readonly field?: string;\n readonly message: string;\n}"
8749
9907
  },
8750
9908
  {
8751
9909
  "name": "routeClassification",
@@ -8772,14 +9930,14 @@
8772
9930
  "name": "RouteConfigErrorCode",
8773
9931
  "kind": "type",
8774
9932
  "package": "@nifrajs/core",
8775
- "signature": "export type RouteConfigErrorCode = \"DUPLICATE_ROUTE\" | \"DUPLICATE_PARAM\" | \"PARAM_NAME_CONFLICT\" | \"INVALID_PATH\" | \"INVALID_PARAM_NAME\" | \"WILDCARD_NOT_LAST\" | \"INVALID_METHOD\" | \"INVALID_ASSURANCE\" | \"INVALID_IDEMPOTENCY\";",
9933
+ "signature": "export type RouteConfigErrorCode = \"DUPLICATE_ROUTE\" | \"DUPLICATE_PARAM\" | \"PARAM_NAME_CONFLICT\" | \"INVALID_PATH\" | \"INVALID_PARAM_NAME\" | \"WILDCARD_NOT_LAST\" | \"INVALID_METHOD\" | \"INVALID_ASSURANCE\" | \"INVALID_IDEMPOTENCY\" | \"INVALID_BODY_LIMIT\";",
8776
9934
  "doc": "/** Stable codes for boot-time (L2) route configuration failures. */"
8777
9935
  },
8778
9936
  {
8779
9937
  "name": "RouteConfigErrorCode",
8780
9938
  "kind": "type",
8781
9939
  "package": "nifra",
8782
- "signature": "export type RouteConfigErrorCode = \"DUPLICATE_ROUTE\" | \"DUPLICATE_PARAM\" | \"PARAM_NAME_CONFLICT\" | \"INVALID_PATH\" | \"INVALID_PARAM_NAME\" | \"WILDCARD_NOT_LAST\" | \"INVALID_METHOD\" | \"INVALID_ASSURANCE\" | \"INVALID_IDEMPOTENCY\";",
9940
+ "signature": "export type RouteConfigErrorCode = \"DUPLICATE_ROUTE\" | \"DUPLICATE_PARAM\" | \"PARAM_NAME_CONFLICT\" | \"INVALID_PATH\" | \"INVALID_PARAM_NAME\" | \"WILDCARD_NOT_LAST\" | \"INVALID_METHOD\" | \"INVALID_ASSURANCE\" | \"INVALID_IDEMPOTENCY\" | \"INVALID_BODY_LIMIT\";",
8783
9941
  "doc": "/** Stable codes for boot-time (L2) route configuration failures. */"
8784
9942
  },
8785
9943
  {
@@ -8863,7 +10021,7 @@
8863
10021
  "name": "RouteModule",
8864
10022
  "kind": "interface",
8865
10023
  "package": "@nifrajs/web",
8866
- "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n readonly action?: Action;\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 * 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 `x-nifra-revalidate`\n * response header that `withISR` reads to set the page's cache TTL (overriding the wrapper's\n * default). Older-than-`revalidate` cached pages are served stale while regenerating.\n */\n readonly revalidate?: number;\n /** Optional bounded tags used by ISR on-demand invalidation (`?tag=...`). */\n readonly revalidateTags?: readonly string[];\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}",
10024
+ "signature": "export interface RouteModule {\n readonly default: unknown;\n readonly loader?: Loader;\n readonly action?: Action;\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 * 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 /** Optional bounded tags used by ISR on-demand invalidation (`?tag=...`). */\n readonly revalidateTags?: readonly string[];\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}",
8867
10025
  "doc": "/** A route module - the default component + optional loader / action / meta. */"
8868
10026
  },
8869
10027
  {
@@ -8944,14 +10102,14 @@
8944
10102
  "name": "RouteSchema",
8945
10103
  "kind": "interface",
8946
10104
  "package": "@nifrajs/core",
8947
- "signature": "export interface RouteSchema {\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `body`/`query` validation, before the handler runs. `kind` says\n * which input failed (`\"body\"` | `\"query\"`). Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\") => Response | unknown | Promise<Response | unknown>;\n}",
10105
+ "signature": "export interface RouteSchema {\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema. Header names are normalized to lower-case and the validated\n * output is exposed as `c.headers`; use lower-case keys because HTTP header names are\n * case-insensitive. */\n readonly headers?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\") => Response | unknown | Promise<Response | unknown>;\n}",
8948
10106
  "doc": "/** Per-route input schemas. Each is any Standard Schema (zod/valibot/arktype/…). */"
8949
10107
  },
8950
10108
  {
8951
10109
  "name": "RouteSchema",
8952
10110
  "kind": "interface",
8953
10111
  "package": "nifra",
8954
- "signature": "export interface RouteSchema {\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `body`/`query` validation, before the handler runs. `kind` says\n * which input failed (`\"body\"` | `\"query\"`). Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\") => Response | unknown | Promise<Response | unknown>;\n}",
10112
+ "signature": "export interface RouteSchema {\n /** Transport body cap for this route. Defaults to the server's maxBodyBytes. Use a finite\n * smaller/larger limit for a specific endpoint. The 'unlimited' value is an explicit\n * streaming/upload exemption and requires a non-empty bodyLimitReason for auditability. */\n readonly bodyLimit?: number | \"unlimited\";\n /** Required explanation when bodyLimit is 'unlimited' (for example, a streaming upload is\n * bounded by an upstream object-store protocol). */\n readonly bodyLimitReason?: string;\n /** Declared effect tokens. Reflected for assurance; never read by validation or serialization. */\n readonly capabilities?: readonly string[];\n /**\n * Dedupe retries of this (mutating) route on an `Idempotency-Key` header. The first request runs and\n * its response is stored; a retry with the same key replays that response without re-running the\n * handler, and a key reused with a different body is rejected (409). A missing key on an\n * idempotency-required route fails closed (400). Off the hot path - routes without it are unchanged.\n */\n readonly idempotency?: IdempotencyConfig;\n /**\n * Highest data-sensitivity this route's response body carries (`public` | `pii` | `secret`). A\n * declarative, compile-time + introspection fact - never validated at runtime. Reflected for tooling,\n * recorded in the capability lockfile (so a route that starts returning PII is a reviewable change),\n * and read by downstream policy (e.g. a partner-API surface refusing to expose `pii`/`secret`).\n */\n readonly classification?: DataClassification;\n /**\n * Inline **route-assurance evidence**: the enforcement posture this route carries, declared adjacent to\n * the handler (e.g. `[NIFRA_ASSURANCE.AUTHENTICATED]`). Each id becomes route-scoped `declared` evidence\n * in reflection, so a `nifra.assurance.ts` policy `require:` clause is satisfiable WITHOUT rewriting an\n * in-handler guard into a `withRouteAssurance`-marked middleware. Ids are lowercase dot/dash segments\n * (invalid ids throw at registration). Reflected for the assurance gate; never read on the hot path.\n *\n * This is an author ASSERTION (recorded as `source: \"declared\"`), not runtime proof - like every\n * assurance marker it is trusted by the static gate, which matches on the evidence id, not its source.\n * Declare an id only on a route whose guard actually enforces it; a false declaration silently satisfies\n * the policy. (`source` is retained in reflection, so a stricter policy or reviewer can still tell\n * declared evidence from enforcement-module evidence.)\n */\n readonly assurance?: readonly string[];\n /**\n * Mark this route a **dynamic route family**: a template (`/api/:slug/:resource`) whose concrete\n * resources are resolved at runtime (auto-CRUD over tenant-defined tables, a catch-all dispatcher).\n * Purely declarative - it does not change dispatch. It surfaces in reflection so the assurance gate and\n * tooling treat the one templated route as a deliberate family whose evidence covers every runtime-\n * resolved resource, instead of reading it as a single forgotten route.\n */\n readonly family?: boolean;\n /** Optional **path-params schema**. Path params arrive as strings (`/users/:id` -> `c.params.id`);\n * declaring a schema validates them at the boundary (a malformed `:id` is a `422` before the handler,\n * like `body`/`query`) and can coerce them (use `t.query({ id: t.integer() })` for a numeric param).\n * The schema must cover every path param; with the strict default an undeclared path param is rejected.\n * When omitted, `c.params` stays the path-inferred `Record<name, string>`. */\n readonly params?: StandardSchemaV1;\n /** Optional request-header schema. Header names are normalized to lower-case and the validated\n * output is exposed as `c.headers`; use lower-case keys because HTTP header names are\n * case-insensitive. */\n readonly headers?: StandardSchemaV1;\n readonly body?: StandardSchemaV1;\n readonly query?: StandardSchemaV1;\n /** Optional **response contract**. When declared: the handler's return is type-checked against it\n * (the implementation can't drift from the contract), the typed client sees THIS as the response type\n * (the contract - not the handler's incidental return), and it's emitted into OpenAPI/JSON-Schema so\n * tooling and coding agents can read the exact shape. It is **not** validated at runtime (zero\n * hot-path cost) - purely a compile-time + introspection contract. */\n readonly response?: StandardSchemaV1;\n /**\n * Optional **error-response contract**: a map of HTTP status code → the Standard Schema of that error's\n * body. Declares a route's failure modes so they flow into OpenAPI (as non-2xx `responses`), the\n * `/llms.txt` context, and other introspection - the whole contract, not just the happy path, is legible\n * to tooling and coding agents. Like `response`, it is **not** validated at runtime (zero hot-path cost);\n * it's a compile-time + introspection contract. Example: `{ 404: NotFound, 409: Conflict }`. */\n readonly errors?: Readonly<Record<number, StandardSchemaV1>>;\n /**\n * Optional **SSE event contract**: the Standard Schema of each event's `data` payload on a\n * streaming route (declared via `app.sse()`). Marks the route as a typed event stream - the\n * typed client grows a `.subscribe()` for it, and the schema flows into reflection. Like\n * `response`, it is **not** validated at runtime (zero hot-path cost); the server-side\n * `stream.send()` is compile-time-checked against it instead.\n */\n readonly sse?: StandardSchemaV1;\n /**\n * Hook fired when the request fails `headers`/`params`/`body`/`query` validation, before the handler\n * runs. `kind` says which input failed. Its return value selects one of three outcomes (may be async):\n * - a **`Response`** → returned as-is, short-circuiting the route (custom error envelope, redirect, …).\n * - **any other value** → treated as a repaired payload and **re-validated once** against the same\n * schema. If it now passes, the handler runs with it; if it still fails, the original `422` stands.\n * Re-validation means a bad return can't bypass the schema - the trust boundary holds.\n * - **`undefined`** → give up; the original validation `422` is returned unchanged.\n * A route hook **overrides** the app-wide default set via `server({ onValidationError })`; return\n * `undefined` to fall through to the plain `422` even when an app default exists. Typical uses: a custom\n * error envelope, coercing the input, or prompting an LLM to repair the payload (re-validated, so it can't\n * bypass the schema).\n */\n readonly onValidationError?: (issues: ReadonlyArray<StandardIssue>, ctx: Context, kind: \"body\" | \"query\" | \"params\" | \"headers\") => Response | unknown | Promise<Response | unknown>;\n}",
8955
10113
  "doc": "/** Per-route input schemas. Each is any Standard Schema (zod/valibot/arktype/…). */"
8956
10114
  },
8957
10115
  {
@@ -8978,7 +10136,7 @@
8978
10136
  "name": "RouteSnapshotSchema",
8979
10137
  "kind": "interface",
8980
10138
  "package": "@nifrajs/core",
8981
- "signature": "export interface RouteSnapshotSchema {\n readonly body?: SchemaSnapshot;\n readonly query?: SchemaSnapshot;\n readonly response?: SchemaSnapshot;\n readonly sse?: SchemaSnapshot;\n readonly errors?: Readonly<Record<string, SchemaSnapshot>>;\n}"
10139
+ "signature": "export interface RouteSnapshotSchema {\n readonly headers?: SchemaSnapshot;\n readonly body?: SchemaSnapshot;\n readonly query?: SchemaSnapshot;\n readonly response?: SchemaSnapshot;\n readonly sse?: SchemaSnapshot;\n readonly errors?: Readonly<Record<string, SchemaSnapshot>>;\n}"
8982
10140
  },
8983
10141
  {
8984
10142
  "name": "rpcError",
@@ -8992,6 +10150,18 @@
8992
10150
  "package": "@nifrajs/mcp",
8993
10151
  "signature": "export declare const rpcResult: (id: JsonRpcId, value: unknown) => JsonRpcResponse;"
8994
10152
  },
10153
+ {
10154
+ "name": "RuleContext",
10155
+ "kind": "interface",
10156
+ "package": "@nifrajs/cli",
10157
+ "signature": "export interface RuleContext {\n readonly root: string;\n readonly sources: SourceIndex;\n readonly project: ProjectFacts;\n}"
10158
+ },
10159
+ {
10160
+ "name": "RulePack",
10161
+ "kind": "interface",
10162
+ "package": "@nifrajs/cli",
10163
+ "signature": "export interface RulePack {\n readonly name: string;\n readonly rules: readonly CheckRule[];\n}"
10164
+ },
8995
10165
  {
8996
10166
  "name": "runAdversarialContract",
8997
10167
  "kind": "function",
@@ -8999,6 +10169,18 @@
8999
10169
  "signature": "export declare function runAdversarialContract(app: ContractTestApp, options?: AdversarialContractOptions): Promise<AdversarialContractReport>;",
9000
10170
  "doc": "/**\n * Execute contract-derived hostile inputs and declared-response conformance against a runtime matrix.\n * Runtime/request failures are captured in the report; inspect `report.ok`, `failures`, and `gaps`\n * (or use {@link assertAdversarialContract} for a throwing test assertion).\n */"
9001
10171
  },
10172
+ {
10173
+ "name": "runAgent",
10174
+ "kind": "function",
10175
+ "package": "@nifrajs/agent",
10176
+ "signature": "export declare function runAgent<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(definition: AgentDefinition<InputSchema, OutputSchema>, input: AgentTurnInput, ports: AgentPorts, options: RunAgentOptions): Promise<AgentRunResult<NonNullable<OutputSchema[\"~standard\"][\"types\"]>[\"output\"]>>;"
10177
+ },
10178
+ {
10179
+ "name": "RunAgentOptions",
10180
+ "kind": "interface",
10181
+ "package": "@nifrajs/agent",
10182
+ "signature": "export interface RunAgentOptions {\n readonly state: AgentTurnState;\n readonly maxTurns?: number;\n readonly goal?: (output: unknown) => boolean;\n}"
10183
+ },
9002
10184
  {
9003
10185
  "name": "runApp",
9004
10186
  "kind": "function",
@@ -9006,6 +10188,12 @@
9006
10188
  "signature": "export declare function runApp(app: AppLike, requests: readonly RequestSpec[], options?: RunOptions): Promise<RunResult[]>;",
9007
10189
  "doc": "/**\n * Run a batch of requests through the app, in order, and return a result per request. Never throws:\n * an app crash on any request is captured as that result's `error` and the run continues.\n */"
9008
10190
  },
10191
+ {
10192
+ "name": "runAssurance",
10193
+ "kind": "function",
10194
+ "package": "@nifrajs/cli",
10195
+ "signature": "export declare function runAssurance(cwd: string, options?: {\n readonly json?: boolean;\n readonly config?: string;\n readonly bundle?: boolean;\n readonly strict?: boolean;\n readonly out?: string;\n readonly hydration?: boolean;\n readonly interact?: boolean;\n}): Promise<boolean>;"
10196
+ },
9009
10197
  {
9010
10198
  "name": "runDurableExecutionAdapterConformance",
9011
10199
  "kind": "function",
@@ -9026,6 +10214,19 @@
9026
10214
  "signature": "export declare function runFailureScenario<Output>(scenario: FailureScenario<Output>, options: FailureLabOptions): Promise<FailureScenarioReport>;",
9027
10215
  "doc": "/** Run one scenario and evaluate its post-failure invariant without leaking its result or error text. */"
9028
10216
  },
10217
+ {
10218
+ "name": "runFaultProfile",
10219
+ "kind": "function",
10220
+ "package": "@nifrajs/testing",
10221
+ "signature": "export declare function runFaultProfile(profile: FaultProfile, options?: RunFaultProfileOptions): Promise<FaultProfileReport>;",
10222
+ "doc": "/** Run every profile scenario with the same deterministic seed and failure schedule. */"
10223
+ },
10224
+ {
10225
+ "name": "RunFaultProfileOptions",
10226
+ "kind": "interface",
10227
+ "package": "@nifrajs/testing",
10228
+ "signature": "export interface RunFaultProfileOptions {\n readonly seed?: number;\n readonly schedule?: readonly FailureDirective[];\n}"
10229
+ },
9029
10230
  {
9030
10231
  "name": "RunningServer",
9031
10232
  "kind": "interface",
@@ -9056,7 +10257,7 @@
9056
10257
  "name": "RunQueryOptions",
9057
10258
  "kind": "interface",
9058
10259
  "package": "@nifrajs/mcp-db",
9059
- "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 /** Max serialized result size in bytes (default 100 KB). */\n readonly maxResultBytes?: number;\n}"
10260
+ "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 /** Max serialized result size in bytes (default 100 KB). */\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}"
9060
10261
  },
9061
10262
  {
9062
10263
  "name": "runReconciliationWorker",
@@ -9078,6 +10279,12 @@
9078
10279
  "signature": "export interface RunResult {\n readonly label?: string;\n readonly method: string;\n readonly path: string;\n /** `true` when the app returned a 2xx response. `false` for non-2xx, or when `app.fetch` threw. */\n readonly ok: boolean;\n /** HTTP status - present when the app returned a response (absent when it threw). */\n readonly status?: number;\n readonly statusText?: string;\n readonly headers?: Readonly<Record<string, string>>;\n /** Parsed JSON when the response is JSON; otherwise the (possibly truncated) text. */\n readonly body?: unknown;\n /** The response body as text, truncated to `maxBodyChars`. */\n readonly bodyText?: string;\n /** `true` when `bodyText` was cut to the cap. */\n readonly truncated?: boolean;\n /** Wall-clock time for this request, milliseconds. */\n readonly durationMs: number;\n /** Set when `app.fetch` threw (the app crashed) rather than returning a response. */\n readonly error?: {\n readonly name: string;\n readonly message: string;\n readonly stack?: string;\n };\n}",
9079
10280
  "doc": "/** The captured outcome of one request. */"
9080
10281
  },
10282
+ {
10283
+ "name": "runRuleRegistry",
10284
+ "kind": "function",
10285
+ "package": "@nifrajs/cli",
10286
+ "signature": "export declare function runRuleRegistry(ctx: RuleContext, builtIns: readonly CheckRule[], packs?: readonly RulePack[]): Promise<Diagnostic[]>;"
10287
+ },
9081
10288
  {
9082
10289
  "name": "runSagaReconciliationWorker",
9083
10290
  "kind": "function",
@@ -9090,6 +10297,25 @@
9090
10297
  "package": "@nifrajs/testing",
9091
10298
  "signature": "export declare function runtimeAdapterCertificationProfile(): AdapterCertificationProfile<CertifiableRuntimeAdapter>;"
9092
10299
  },
10300
+ {
10301
+ "name": "runToolContractConformance",
10302
+ "kind": "function",
10303
+ "package": "@nifrajs/core",
10304
+ "signature": "export declare function runToolContractConformance(adapter: ToolAdapter, options: {\n readonly input: unknown;\n readonly capability: string;\n readonly approval: ToolApproval;\n readonly dryRun: ToolCallOptions;\n}): Promise<ToolConformanceResult>;",
10305
+ "doc": "/** Shared conformance assertions for adapters. It intentionally checks only public, token-only behavior. */"
10306
+ },
10307
+ {
10308
+ "name": "runTrajectory",
10309
+ "kind": "function",
10310
+ "package": "@nifrajs/testing",
10311
+ "signature": "export declare function runTrajectory<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(definition: AgentDefinition<InputSchema, OutputSchema>, input: AgentTurnInput, ports: AgentPorts, options: {\n readonly state: AgentTurnState;\n readonly maxTurns?: number;\n readonly goal?: (output: unknown) => boolean;\n}): Promise<TrajectoryRun<NonNullable<OutputSchema[\"~standard\"][\"types\"]>[\"output\"]>>;"
10312
+ },
10313
+ {
10314
+ "name": "runWorkGraph",
10315
+ "kind": "function",
10316
+ "package": "@nifrajs/cli",
10317
+ "signature": "export declare function runWorkGraph(cwd: string, options?: {\n readonly changedFiles?: readonly string[];\n readonly minLevel?: number;\n readonly json?: boolean;\n}): Promise<boolean>;"
10318
+ },
9093
10319
  {
9094
10320
  "name": "SagaAmbiguityResolution",
9095
10321
  "kind": "type",
@@ -9345,7 +10571,7 @@
9345
10571
  "name": "SecurityHeadersOptions",
9346
10572
  "kind": "interface",
9347
10573
  "package": "@nifrajs/middleware",
9348
- "signature": "export interface SecurityHeadersOptions {\n /** `Strict-Transport-Security`. Off by default - opt in once you're sure you're HTTPS-only. */\n readonly hsts?: {\n readonly maxAge: number;\n readonly includeSubDomains?: boolean;\n readonly preload?: boolean;\n };\n /** `Content-Security-Policy` value. Off by default (app-specific). */\n readonly contentSecurityPolicy?: string;\n /** `X-Frame-Options`. Default `\"DENY\"`. */\n readonly frameOptions?: \"DENY\" | \"SAMEORIGIN\";\n /** `Referrer-Policy`. Default `\"no-referrer\"`. */\n readonly referrerPolicy?: string;\n}"
10574
+ "signature": "export interface SecurityHeadersOptions {\n /** `Strict-Transport-Security`. Off by default - opt in once you're sure you're HTTPS-only. */\n readonly hsts?: {\n readonly maxAge: number;\n readonly includeSubDomains?: boolean;\n readonly preload?: boolean;\n };\n /** `Content-Security-Policy` value. Off by default (app-specific). */\n readonly contentSecurityPolicy?: string;\n /** `X-Frame-Options`. Default `\"DENY\"`. */\n readonly frameOptions?: \"DENY\" | \"SAMEORIGIN\";\n /** `Referrer-Policy`. Default `\"no-referrer\"`. */\n readonly referrerPolicy?: string;\n /** `Cross-Origin-Opener-Policy`. Off by default - isolates the browsing context group; opt in\n * when the app tolerates losing `window.opener` links from cross-origin pages. */\n readonly crossOriginOpenerPolicy?: \"same-origin\" | \"same-origin-allow-popups\" | \"unsafe-none\";\n /** `Cross-Origin-Embedder-Policy`. Off by default - `require-corp` breaks embedding of\n * cross-origin resources that do not opt in, so this is a deliberate decision. */\n readonly crossOriginEmbedderPolicy?: \"require-corp\" | \"credentialless\" | \"unsafe-none\";\n /** `Cross-Origin-Resource-Policy`. Off by default (app-specific: assets meant for other\n * origins need `cross-origin`). */\n readonly crossOriginResourcePolicy?: \"same-origin\" | \"same-site\" | \"cross-origin\";\n /** `Permissions-Policy` value, e.g. `\"camera=(), geolocation=()\"`. Off by default (app-specific). */\n readonly permissionsPolicy?: string;\n}"
9349
10575
  },
9350
10576
  {
9351
10577
  "name": "SecurityRequirement",
@@ -9379,14 +10605,14 @@
9379
10605
  "kind": "function",
9380
10606
  "package": "@nifrajs/core",
9381
10607
  "signature": "export declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;",
9382
- "doc": "/**\n * Serialize a `Set-Cookie` header value. Pure - applies **no** security defaults (the caller, e.g.\n * `c.set.cookie`, layers `HttpOnly`/`Secure`/`SameSite` on). Throws on an invalid cookie name, a\n * header-injecting `Path`/`Domain`, a non-integer `maxAge`, or an oversized result - a serialization\n * bug should fail loudly, not silently emit a cookie the browser drops.\n */"
10608
+ "doc": "/**\n * Serialize a `Set-Cookie` header value. Pure - applies **no** security defaults (the caller, e.g.\n * `c.set.cookie`, layers `HttpOnly`/`Secure`/`SameSite` on). Throws on an invalid cookie name, a\n * header-injecting `Path`/`Domain`, a non-integer `maxAge`, a `__Secure-`/`__Host-` name whose\n * attributes violate its prefix contract, or an oversized result - a serialization bug should fail\n * loudly, not silently emit a cookie the browser drops.\n */"
9383
10609
  },
9384
10610
  {
9385
10611
  "name": "serializeCookie",
9386
10612
  "kind": "function",
9387
10613
  "package": "nifra",
9388
10614
  "signature": "export declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;",
9389
- "doc": "/**\n * Serialize a `Set-Cookie` header value. Pure - applies **no** security defaults (the caller, e.g.\n * `c.set.cookie`, layers `HttpOnly`/`Secure`/`SameSite` on). Throws on an invalid cookie name, a\n * header-injecting `Path`/`Domain`, a non-integer `maxAge`, or an oversized result - a serialization\n * bug should fail loudly, not silently emit a cookie the browser drops.\n */"
10615
+ "doc": "/**\n * Serialize a `Set-Cookie` header value. Pure - applies **no** security defaults (the caller, e.g.\n * `c.set.cookie`, layers `HttpOnly`/`Secure`/`SameSite` on). Throws on an invalid cookie name, a\n * header-injecting `Path`/`Domain`, a non-integer `maxAge`, a `__Secure-`/`__Host-` name whose\n * attributes violate its prefix contract, or an oversized result - a serialization bug should fail\n * loudly, not silently emit a cookie the browser drops.\n */"
9390
10616
  },
9391
10617
  {
9392
10618
  "name": "serializeData",
@@ -9409,6 +10635,13 @@
9409
10635
  "signature": "export declare function serializeNifraManifestSignature(signature: NifraManifestSignature): string;",
9410
10636
  "doc": "/** Byte-stable serialization for the detached signature sidecar. */"
9411
10637
  },
10638
+ {
10639
+ "name": "serializeProjectEvidence",
10640
+ "kind": "function",
10641
+ "package": "@nifrajs/core",
10642
+ "signature": "export declare function serializeProjectEvidence(snapshot: ProjectEvidenceSnapshot): string;",
10643
+ "doc": "/** Stable JSON for logs, MCP, generated artifacts, and snapshot tests. */"
10644
+ },
9412
10645
  {
9413
10646
  "name": "serializeResponse",
9414
10647
  "kind": "function",
@@ -9459,7 +10692,7 @@
9459
10692
  "name": "ServeOptions",
9460
10693
  "kind": "interface",
9461
10694
  "package": "@nifrajs/node",
9462
- "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * `@nifrajs/node` creates a plain Node `http` server, so the safe default is `\"http\"`. Deployments behind\n * TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in,\n * mirroring nifra's Bun `listen({ gracefulSignals })`.\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly signals?: boolean;\n /**\n * Serve static files from disk for matching GET/HEAD requests *before* the app runs - non-matching\n * requests fall through to `app.fetch` with the node-direct fast path intact (no perf regression on\n * SSR/API routes). Replaces the hand-rolled `/assets/*` reader in self-hosted entries.\n */\n readonly static?: ServeStaticOptions;\n}"
10695
+ "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * `@nifrajs/node` creates a plain Node `http` server, so the safe default is `\"http\"`. Deployments behind\n * TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in,\n * mirroring nifra's Bun `listen({ gracefulSignals })`.\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly signals?: boolean;\n /**\n * Serve static files from disk for matching GET/HEAD requests *before* the app runs - non-matching\n * requests fall through to `app.fetch` with the node-direct fast path intact (no perf regression on\n * SSR/API routes). Replaces the hand-rolled `/assets/*` reader in self-hosted entries.\n */\n readonly static?: ServeStaticOptions;\n}"
9463
10696
  },
9464
10697
  {
9465
10698
  "name": "servePublicDir",
@@ -9492,14 +10725,14 @@
9492
10725
  "name": "Server",
9493
10726
  "kind": "class",
9494
10727
  "package": "@nifrajs/core",
9495
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext> {\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n private wsRouteCount;\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 private readonly maxBodyBytes;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\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 /** 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 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 /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private sealed;\n private readonly derives;\n 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 private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\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 /** `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 /** 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 /** Names of plugins/middleware already applied via `use` - 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 constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Add a per-request, computed context extension for subsequent routes. */\n derive<D extends object>(fn: (context: Context & Ctx) => MaybePromise<D>): Server<R, Ctx & D>;\n /** Add a static context value for subsequent routes. */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>>;\n /**\n * Run before routing on the raw request. Return a `Response` to short-circuit, or a replacement\n * `Request` to continue routing with a rewritten method/URL/headers. Global.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /** Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped. */\n beforeHandle(fn: (context: Context & Ctx) => MaybePromise<unknown>): this;\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 around(fn: <T>(context: Context & Ctx, next: () => MaybePromise<T>) => MaybePromise<T>): this;\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. */\n afterHandle(fn: (result: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500). Order-scoped. */\n onError(fn: (error: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\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. 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 /**\n * Register a response transform for raw/streamed Responses. Framework-serialized payloads stay on\n * the body tier; this hook is only entered for untagged Responses (streams, proxied fetches, and\n * framework-generated error responses). A no-op native twin keeps buffered JSON on the direct lane.\n */\n onResponseRaw(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Register a PORTABLE header-only response hook - one implementation, fast on every runtime.\n *\n * The hook receives a mutable case-insensitive header view, a minimal request view, and the\n * status. On the Web serving paths it runs inside the normal `onResponse` walk against the\n * response's own `Headers` (mutating in place - no clone). On Node it self-pairs as a native\n * response hook against the outcome's plain header record, so registering one NEVER forces the\n * Node adapter off its direct socket writer the way a full `onResponse(res: Response)` hook does.\n * Prefer this over `onResponse` whenever the middleware only reads/writes headers.\n */\n onResponseHeaders(fn: ResponseHeadersHook): this;\n /**\n * Register a PORTABLE post-serialization body hook - the payload tier. The hook receives the\n * FINAL framework-serialized bytes (plus the mutable header view and status) and may return\n * replacement bytes; `undefined` keeps the body. On the Node direct writer the bytes come\n * straight off the outcome record; on the Web serving paths they ride the framework-built\n * Response as a tag, so no body stream is ever drained on any runtime. A handler-returned raw\n * `Response` (proxied fetch, SSE, streamed SSR) is skipped by contract - transforming those is\n * what the full `onResponse` hook is for.\n */\n onResponseBody(fn: ResponseBodyHook): this;\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 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(plugin: IdentityPlugin): this;\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).\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): 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 named bundle already\n * applied is skipped (idempotent).\n */\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>>>, Ctx>;\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>>>, Ctx>;\n /**\n * Register a **typed SSE route** - a GET endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. 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`, extra headers). The\n * connection closes when the handler resolves, `stream.close()` runs, or the client disconnects\n * (`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, \"GET\", Path, RouteInfoFor<Path, S, Response>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>;\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>;\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 optional `handler.upgrade(c)` runs in the request context first and may\n * reject (return a `Response`) or seed per-connection `ws.data`. 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>): string extends Path ? Server<R, Ctx> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx>;\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: Method, 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 registerBatch(routes: readonly {\n readonly method: Method;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n private prepareRoute;\n /** Collapse route-invariant lifecycle decisions into one runner at registration. The request path\n * performs no eligibility ladder: it supplies request state to this already-selected plan. */\n private compileExecutionPlan;\n /** The idempotency lane's bridge back into the normal matched lanes, resolved to a concrete Response\n * (the lane buffers the body, then replays it through the route's real validation + handler). */\n private idempotencyRunLanes;\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 `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 `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): 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 * 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 group's request-level\n * hooks (`onRequest`/`onResponse`/`onResponseFinalized`) are appended to this server's. This\n * server's route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like\n * routes registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes is refused (register\n * those on the parent).\n */\n merge<R2 extends Registry, Ctx2>(other: Server<R2, Ctx2>): Server<R & R2, Ctx>;\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 * 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 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 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 async {@link runLifecycle}, unchanged.\n */\n private routeAndRun;\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 bare slice of {@link runLifecycle} (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 {@link runLifecycle}'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 /** 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 private bareError;\n private runWithAround;\n private runAround;\n private runBodyOnly;\n /** Shared bounded body framing/parser. Both body lanes use the same trust-boundary checks; only\n * the validation + handler continuation differs. */\n private readBodyInput;\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 /**\n * The post-match lifecycle: validate → derive → beforeHandle → handler → afterHandle, with onError.\n * Generic over the render: a success value goes through `finalize(result, set)` (a Web `Response`, or\n * node-direct primitives); an early/error `Response` (validation, thrown, 500) through `wrapResponse`.\n */\n /** Synchronous until a validator, lifecycle hook, handler, or contract check actually returns a Promise. */\n private runLifecycle;\n /** Registration-specialized query lifecycle: query validation (including recovery) → hooks. */\n private runLifecycleQuery;\n /** Registration-specialized body lifecycle: bounded body validation (including recovery) → hooks. */\n private runLifecycleBody;\n /** Registration-specialized body + query lifecycle: bounded body validation → query validation → hooks. */\n private runLifecycleBodyQuery;\n /** Registration-specialized no-body lifecycle: query validation (if present) → derives/hooks. */\n private runQueryAndLifecycle;\n private runQueryAndLifecycleResult;\n private runLifecycleAfterParamsResult;\n private runLifecycleAfterParams;\n private runLifecycleAfterParamsSettled;\n private runLifecycleAfterBody;\n private runLifecycleAfterQueryResult;\n private runLifecycleAfterQuery;\n private runLifecycleHooks;\n /** Registration-specialized derive → before → handler lifecycle. */\n private runLifecycleDeriveBefore;\n /** Finalize the specialized lane without rechecking its registration-proven invariants. */\n private finishSimpleLifecycleResult;\n private continueLifecycleAfterDerive;\n private runLifecycleHooksAsync;\n private continueLifecycleAfterBefore;\n private runLifecycleHandlerAsync;\n private finishLifecycleResult;\n private continueLifecycleAfterHandle;\n private finishLifecycleContract;\n private finishContractOutcome;\n private handleLifecycleError;\n /** Log an unhandled request error to the (redacting) logger - shared by {@link runLifecycle} 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 /**\n * Read the body as text, capped at `maxBodyBytes`. Rejects (`null`) on a\n * `Content-Length` over the cap *before* buffering, and aborts mid-stream once the\n * running byte count exceeds it - so a lying or absent length can't force us to\n * buffer an oversized payload.\n *\n * Fast path: when a non-chunked request carries a `Content-Length` within the cap,\n * a native `req.json()` is already bounded - under HTTP/1.1 + HTTP/2 framing the\n * runtime delivers at most `Content-Length` bytes - so we skip the manual stream\n * loop and a separate text decode. It trusts the wire\n * *framing*, not the header value: nifra only ever receives framed Requests from the\n * runtime's HTTP server, never a hand-built one with a mismatched length. Chunked or\n * length-less bodies fall through to the streaming byte-cap guard below.\n */\n private readBoundedJson;\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. Named wildcards also stay on the fallback until Bun exposes their raw\n * capture semantics; static and `:param` routes take the native lane. */\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 listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
10728
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext> {\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 private wsRouteCount;\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 private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n /** 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 /** 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 Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private sealed;\n private readonly derives;\n 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 private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\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 /** `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 /** 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 /** Names of plugins/middleware already applied via `use` - 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 constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /** Add a per-request, computed context extension for subsequent routes. */\n derive<D extends object>(fn: (context: Context & Ctx) => MaybePromise<D>): Server<R, Ctx & D>;\n /** Add a static context value for subsequent routes. */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>>;\n /**\n * Run before routing on the raw request. Return a `Response` to short-circuit, or a replacement\n * `Request` to continue routing with a rewritten method/URL/headers. Global.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /** Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped. */\n beforeHandle(fn: (context: Context & Ctx) => MaybePromise<unknown>): this;\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 around(fn: <T>(context: Context & Ctx, next: () => MaybePromise<T>) => MaybePromise<T>): this;\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. */\n afterHandle(fn: (result: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500). Order-scoped. */\n onError(fn: (error: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\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. 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 /**\n * Register a response transform for raw/streamed Responses. Framework-serialized payloads stay on\n * the body tier; this hook is only entered for untagged Responses (streams, proxied fetches, and\n * framework-generated error responses). A no-op native twin keeps buffered JSON on the direct lane.\n */\n onResponseRaw(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Register a PORTABLE header-only response hook - one implementation, fast on every runtime.\n *\n * The hook receives a mutable case-insensitive header view, a minimal request view, and the\n * status. On the Web serving paths it runs inside the normal `onResponse` walk against the\n * response's own `Headers` (mutating in place - no clone). On Node it self-pairs as a native\n * response hook against the outcome's plain header record, so registering one NEVER forces the\n * Node adapter off its direct socket writer the way a full `onResponse(res: Response)` hook does.\n * Prefer this over `onResponse` whenever the middleware only reads/writes headers.\n */\n onResponseHeaders(fn: ResponseHeadersHook): this;\n /**\n * Register a PORTABLE post-serialization body hook - the payload tier. The hook receives the\n * FINAL framework-serialized bytes (plus the mutable header view and status) and may return\n * replacement bytes; `undefined` keeps the body. On the Node direct writer the bytes come\n * straight off the outcome record; on the Web serving paths they ride the framework-built\n * Response as a tag, so no body stream is ever drained on any runtime. A handler-returned raw\n * `Response` (proxied fetch, SSE, streamed SSR) is skipped by contract - transforming those is\n * what the full `onResponse` hook is for.\n */\n onResponseBody(fn: ResponseBodyHook): this;\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 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(plugin: IdentityPlugin): this;\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>;\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).\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): 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 named bundle already\n * applied is skipped (idempotent).\n */\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>>>, Ctx>;\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>>>, Ctx>;\n /**\n * Register a **typed SSE route** - a GET endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. 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`, extra headers). The\n * connection closes when the handler resolves, `stream.close()` runs, or the client disconnects\n * (`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, \"GET\", Path, RouteInfoFor<Path, S, Response>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>;\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>;\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 optional `handler.upgrade(c)` runs in the request context first and may\n * reject (return a `Response`) or seed per-connection `ws.data`. 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>): string extends Path ? Server<R, Ctx> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx>;\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: Method, 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 registerBatch(routes: readonly {\n readonly method: Method;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n private prepareRoute;\n /** The idempotency lane's bridge back into the normal matched lanes, resolved to a concrete Response\n * (the lane buffers the body, then replays it through the route's real validation + handler). */\n private idempotencyRunLanes;\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 `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 `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): 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 * 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 (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 is refused (register\n * those on the parent).\n */\n merge<R2 extends Registry, Ctx2>(other: Server<R2, Ctx2>): Server<R & R2, Ctx>;\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 * 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 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 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 async {@link runLifecycle}, 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 bare slice of {@link runLifecycle} (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 {@link runLifecycle}'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 /** 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 private bareError;\n private runWithAround;\n private runAround;\n private runBodyOnly;\n /** Shared bounded body framing/parser. Both body lanes use the same trust-boundary checks; only\n * the validation + handler continuation differs. */\n private readBodyInput;\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 /**\n * The post-match lifecycle: validate → derive → beforeHandle → handler → afterHandle, with onError.\n * Generic over the render: a success value goes through `finalize(result, set)` (a Web `Response`, or\n * node-direct primitives); an early/error `Response` (validation, thrown, 500) through `wrapResponse`.\n */\n /** Synchronous until a validator, lifecycle hook, handler, or contract check actually returns a Promise. */\n private runLifecycle;\n private runLifecycleAfterHeadersResult;\n private runLifecycleAfterHeaders;\n /** Registration-specialized query lifecycle: query validation (including recovery) → hooks. */\n private runLifecycleQuery;\n /** Registration-specialized body lifecycle: bounded body validation (including recovery) → hooks. */\n private runLifecycleBody;\n /** Registration-specialized body + query lifecycle: bounded body validation → query validation → hooks. */\n private runLifecycleBodyQuery;\n /** Registration-specialized no-body lifecycle: query validation (if present) → derives/hooks. */\n private runQueryAndLifecycle;\n private runQueryAndLifecycleResult;\n private runLifecycleAfterParamsResult;\n private runLifecycleAfterParams;\n private runLifecycleAfterParamsSettled;\n private runLifecycleAfterBody;\n private runLifecycleAfterQueryResult;\n private runLifecycleAfterQuery;\n private runLifecycleHooks;\n /** Registration-specialized derive → before → handler lifecycle. */\n private runLifecycleDeriveBefore;\n /** Finalize the specialized lane without rechecking its registration-proven invariants. */\n private finishSimpleLifecycleResult;\n private continueLifecycleAfterDerive;\n private runLifecycleHooksAsync;\n private continueLifecycleAfterBefore;\n private runLifecycleHandlerAsync;\n private finishLifecycleResult;\n private continueLifecycleAfterHandle;\n private finishLifecycleContract;\n private finishContractOutcome;\n private handleLifecycleError;\n /** Log an unhandled request error to the (redacting) logger - shared by {@link runLifecycle} 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 /**\n * Read + parse the JSON body, capped at `maxBodyBytes` and screened by the server's\n * `protoPoisoning` policy. Rejects a `Content-Length` over the cap *before* buffering,\n * re-checks what was actually delivered after the read, and aborts a chunked or\n * length-less body mid-stream once the running byte count exceeds the cap - so a lying\n * or absent length can't force us to buffer an oversized payload.\n */\n private readBoundedJson;\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. Named wildcards also stay on the fallback until Bun exposes their raw\n * capture semantics; static and `:param` routes take the native lane. */\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 listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
9496
10729
  "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 */"
9497
10730
  },
9498
10731
  {
9499
10732
  "name": "Server",
9500
10733
  "kind": "class",
9501
10734
  "package": "nifra",
9502
- "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext> {\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n private wsRouteCount;\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 private readonly maxBodyBytes;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\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 /** 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 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 /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private sealed;\n private readonly derives;\n 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 private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\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 /** `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 /** 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 /** Names of plugins/middleware already applied via `use` - 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 constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Add a per-request, computed context extension for subsequent routes. */\n derive<D extends object>(fn: (context: Context & Ctx) => MaybePromise<D>): Server<R, Ctx & D>;\n /** Add a static context value for subsequent routes. */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>>;\n /**\n * Run before routing on the raw request. Return a `Response` to short-circuit, or a replacement\n * `Request` to continue routing with a rewritten method/URL/headers. Global.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /** Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped. */\n beforeHandle(fn: (context: Context & Ctx) => MaybePromise<unknown>): this;\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 around(fn: <T>(context: Context & Ctx, next: () => MaybePromise<T>) => MaybePromise<T>): this;\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. */\n afterHandle(fn: (result: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500). Order-scoped. */\n onError(fn: (error: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\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. 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 /**\n * Register a response transform for raw/streamed Responses. Framework-serialized payloads stay on\n * the body tier; this hook is only entered for untagged Responses (streams, proxied fetches, and\n * framework-generated error responses). A no-op native twin keeps buffered JSON on the direct lane.\n */\n onResponseRaw(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Register a PORTABLE header-only response hook - one implementation, fast on every runtime.\n *\n * The hook receives a mutable case-insensitive header view, a minimal request view, and the\n * status. On the Web serving paths it runs inside the normal `onResponse` walk against the\n * response's own `Headers` (mutating in place - no clone). On Node it self-pairs as a native\n * response hook against the outcome's plain header record, so registering one NEVER forces the\n * Node adapter off its direct socket writer the way a full `onResponse(res: Response)` hook does.\n * Prefer this over `onResponse` whenever the middleware only reads/writes headers.\n */\n onResponseHeaders(fn: ResponseHeadersHook): this;\n /**\n * Register a PORTABLE post-serialization body hook - the payload tier. The hook receives the\n * FINAL framework-serialized bytes (plus the mutable header view and status) and may return\n * replacement bytes; `undefined` keeps the body. On the Node direct writer the bytes come\n * straight off the outcome record; on the Web serving paths they ride the framework-built\n * Response as a tag, so no body stream is ever drained on any runtime. A handler-returned raw\n * `Response` (proxied fetch, SSE, streamed SSR) is skipped by contract - transforming those is\n * what the full `onResponse` hook is for.\n */\n onResponseBody(fn: ResponseBodyHook): this;\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 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(plugin: IdentityPlugin): this;\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).\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): 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 named bundle already\n * applied is skipped (idempotent).\n */\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>>>, Ctx>;\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>>>, Ctx>;\n /**\n * Register a **typed SSE route** - a GET endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. 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`, extra headers). The\n * connection closes when the handler resolves, `stream.close()` runs, or the client disconnects\n * (`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, \"GET\", Path, RouteInfoFor<Path, S, Response>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>;\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>;\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 optional `handler.upgrade(c)` runs in the request context first and may\n * reject (return a `Response`) or seed per-connection `ws.data`. 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>): string extends Path ? Server<R, Ctx> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx>;\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: Method, 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 registerBatch(routes: readonly {\n readonly method: Method;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n private prepareRoute;\n /** Collapse route-invariant lifecycle decisions into one runner at registration. The request path\n * performs no eligibility ladder: it supplies request state to this already-selected plan. */\n private compileExecutionPlan;\n /** The idempotency lane's bridge back into the normal matched lanes, resolved to a concrete Response\n * (the lane buffers the body, then replays it through the route's real validation + handler). */\n private idempotencyRunLanes;\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 `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 `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): 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 * 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 group's request-level\n * hooks (`onRequest`/`onResponse`/`onResponseFinalized`) are appended to this server's. This\n * server's route-scoped chains do NOT retroactively wrap merged routes (order-scoped, like\n * routes registered before a `derive`). Fail closed: a path+method collision throws\n * `RouteConfigError` at merge time, and a group with WebSocket routes is refused (register\n * those on the parent).\n */\n merge<R2 extends Registry, Ctx2>(other: Server<R2, Ctx2>): Server<R & R2, Ctx>;\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 * 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 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 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 async {@link runLifecycle}, unchanged.\n */\n private routeAndRun;\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 bare slice of {@link runLifecycle} (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 {@link runLifecycle}'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 /** 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 private bareError;\n private runWithAround;\n private runAround;\n private runBodyOnly;\n /** Shared bounded body framing/parser. Both body lanes use the same trust-boundary checks; only\n * the validation + handler continuation differs. */\n private readBodyInput;\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 /**\n * The post-match lifecycle: validate → derive → beforeHandle → handler → afterHandle, with onError.\n * Generic over the render: a success value goes through `finalize(result, set)` (a Web `Response`, or\n * node-direct primitives); an early/error `Response` (validation, thrown, 500) through `wrapResponse`.\n */\n /** Synchronous until a validator, lifecycle hook, handler, or contract check actually returns a Promise. */\n private runLifecycle;\n /** Registration-specialized query lifecycle: query validation (including recovery) → hooks. */\n private runLifecycleQuery;\n /** Registration-specialized body lifecycle: bounded body validation (including recovery) → hooks. */\n private runLifecycleBody;\n /** Registration-specialized body + query lifecycle: bounded body validation → query validation → hooks. */\n private runLifecycleBodyQuery;\n /** Registration-specialized no-body lifecycle: query validation (if present) → derives/hooks. */\n private runQueryAndLifecycle;\n private runQueryAndLifecycleResult;\n private runLifecycleAfterParamsResult;\n private runLifecycleAfterParams;\n private runLifecycleAfterParamsSettled;\n private runLifecycleAfterBody;\n private runLifecycleAfterQueryResult;\n private runLifecycleAfterQuery;\n private runLifecycleHooks;\n /** Registration-specialized derive → before → handler lifecycle. */\n private runLifecycleDeriveBefore;\n /** Finalize the specialized lane without rechecking its registration-proven invariants. */\n private finishSimpleLifecycleResult;\n private continueLifecycleAfterDerive;\n private runLifecycleHooksAsync;\n private continueLifecycleAfterBefore;\n private runLifecycleHandlerAsync;\n private finishLifecycleResult;\n private continueLifecycleAfterHandle;\n private finishLifecycleContract;\n private finishContractOutcome;\n private handleLifecycleError;\n /** Log an unhandled request error to the (redacting) logger - shared by {@link runLifecycle} 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 /**\n * Read the body as text, capped at `maxBodyBytes`. Rejects (`null`) on a\n * `Content-Length` over the cap *before* buffering, and aborts mid-stream once the\n * running byte count exceeds it - so a lying or absent length can't force us to\n * buffer an oversized payload.\n *\n * Fast path: when a non-chunked request carries a `Content-Length` within the cap,\n * a native `req.json()` is already bounded - under HTTP/1.1 + HTTP/2 framing the\n * runtime delivers at most `Content-Length` bytes - so we skip the manual stream\n * loop and a separate text decode. It trusts the wire\n * *framing*, not the header value: nifra only ever receives framed Requests from the\n * runtime's HTTP server, never a hand-built one with a mismatched length. Chunked or\n * length-less bodies fall through to the streaming byte-cap guard below.\n */\n private readBoundedJson;\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. Named wildcards also stay on the fallback until Bun exposes their raw\n * capture semantics; static and `:param` routes take the native lane. */\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 listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
10735
+ "signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext> {\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 private wsRouteCount;\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 private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n /** 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 /** 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 Node-direct renderer for direct `resolveNode()` callers; `undefined` until `.use(nodeDirect())`. */\n private nodeOutcomeRuntime;\n /** Installed streaming runtime for `.sse()` routes; `undefined` until `.use(streaming())`. */\n private sseRuntime;\n /** Installed WebSocket runtime for `.ws()` routes; `undefined` until `.use(websocket())`. */\n private wsRuntime;\n private readonly logger;\n /** How much of an unhandled error {@link logRequestError} records. See `ServerOptions.errorLogDetail`. */\n private readonly errorLogDetail;\n /** App-wide validation-error fallback; a route's own `schema.onValidationError` takes precedence. */\n private readonly defaultOnValidationError?;\n private bunServer;\n private sealed;\n private readonly derives;\n 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 private readonly onResponseHooks;\n private readonly onNodeResponseHooks;\n /** Registration-time eligibility for the Node response twin lane. */\n private nodeResponseHooksComplete;\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 /** `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 /** 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 /** Names of plugins/middleware already applied via `use` - 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 constructor(options?: ServerOptions);\n private assertConfigurable;\n /** Register a callback awaited after graceful drain and server stop. Hung callbacks are bounded. */\n onStop(fn: StopHook): this;\n /**\n * Mount a legacy fetch handler under a literal path prefix. Mounted handlers sit behind typed\n * routes, so routes can move one at a time while the remaining legacy surface stays live.\n * Mounted responses are outside Nifra's typed route and response-contract checks.\n */\n mountFetch(path: string, handler: FetchHandler<EnvOf<Ctx>>, options?: MountFetchOptions): this;\n /** Add a per-request, computed context extension for subsequent routes. */\n derive<D extends object>(fn: (context: Context & Ctx) => MaybePromise<D>): Server<R, Ctx & D>;\n /** Add a static context value for subsequent routes. */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>>;\n /**\n * Run before routing on the raw request. Return a `Response` to short-circuit, or a replacement\n * `Request` to continue routing with a rewritten method/URL/headers. Global.\n */\n onRequest(fn: (req: Request, platform?: Platform<EnvOf<Ctx>>) => MaybePromise<OnRequestResult>): this;\n /** Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped. */\n beforeHandle(fn: (context: Context & Ctx) => MaybePromise<unknown>): this;\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 around(fn: <T>(context: Context & Ctx, next: () => MaybePromise<T>) => MaybePromise<T>): this;\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. */\n afterHandle(fn: (result: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500). Order-scoped. */\n onError(fn: (error: unknown, context: Context & Ctx) => MaybePromise<unknown>): this;\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. 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 /**\n * Register a response transform for raw/streamed Responses. Framework-serialized payloads stay on\n * the body tier; this hook is only entered for untagged Responses (streams, proxied fetches, and\n * framework-generated error responses). A no-op native twin keeps buffered JSON on the direct lane.\n */\n onResponseRaw(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Register a PORTABLE header-only response hook - one implementation, fast on every runtime.\n *\n * The hook receives a mutable case-insensitive header view, a minimal request view, and the\n * status. On the Web serving paths it runs inside the normal `onResponse` walk against the\n * response's own `Headers` (mutating in place - no clone). On Node it self-pairs as a native\n * response hook against the outcome's plain header record, so registering one NEVER forces the\n * Node adapter off its direct socket writer the way a full `onResponse(res: Response)` hook does.\n * Prefer this over `onResponse` whenever the middleware only reads/writes headers.\n */\n onResponseHeaders(fn: ResponseHeadersHook): this;\n /**\n * Register a PORTABLE post-serialization body hook - the payload tier. The hook receives the\n * FINAL framework-serialized bytes (plus the mutable header view and status) and may return\n * replacement bytes; `undefined` keeps the body. On the Node direct writer the bytes come\n * straight off the outcome record; on the Web serving paths they ride the framework-built\n * Response as a tag, so no body stream is ever drained on any runtime. A handler-returned raw\n * `Response` (proxied fetch, SSE, streamed SSR) is skipped by contract - transforming those is\n * what the full `onResponse` hook is for.\n */\n onResponseBody(fn: ResponseBodyHook): this;\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 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(plugin: IdentityPlugin): this;\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>;\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).\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): 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 named bundle already\n * applied is skipped (idempotent).\n */\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>>>, Ctx>;\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>>>, Ctx>;\n /**\n * Register a **typed SSE route** - a GET endpoint streaming `text/event-stream` whose event\n * payloads are contracted by `schema.sse`. 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`, extra headers). The\n * connection closes when the handler resolves, `stream.close()` runs, or the client disconnects\n * (`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, \"GET\", Path, RouteInfoFor<Path, S, Response>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>>>, Ctx>;\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>;\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>;\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 optional `handler.upgrade(c)` runs in the request context first and may\n * reject (return a `Response`) or seed per-connection `ws.data`. 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>): string extends Path ? Server<R, Ctx> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx>;\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: Method, 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 registerBatch(routes: readonly {\n readonly method: Method;\n readonly path: string;\n readonly schema: RouteSchema | undefined;\n readonly handler: (context: never) => unknown;\n }[]): void;\n private prepareRoute;\n /** The idempotency lane's bridge back into the normal matched lanes, resolved to a concrete Response\n * (the lane buffers the body, then replays it through the route's real validation + handler). */\n private idempotencyRunLanes;\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 `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 `nodeDirect()` plugin. Off the public typed surface. */\n [INSTALL_NODE_DIRECT](runtime: NodeOutcomeRuntime): 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 * 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 (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 is refused (register\n * those on the parent).\n */\n merge<R2 extends Registry, Ctx2>(other: Server<R2, Ctx2>): Server<R & R2, Ctx>;\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 * 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 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 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 async {@link runLifecycle}, 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 bare slice of {@link runLifecycle} (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 {@link runLifecycle}'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 /** 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 private bareError;\n private runWithAround;\n private runAround;\n private runBodyOnly;\n /** Shared bounded body framing/parser. Both body lanes use the same trust-boundary checks; only\n * the validation + handler continuation differs. */\n private readBodyInput;\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 /**\n * The post-match lifecycle: validate → derive → beforeHandle → handler → afterHandle, with onError.\n * Generic over the render: a success value goes through `finalize(result, set)` (a Web `Response`, or\n * node-direct primitives); an early/error `Response` (validation, thrown, 500) through `wrapResponse`.\n */\n /** Synchronous until a validator, lifecycle hook, handler, or contract check actually returns a Promise. */\n private runLifecycle;\n private runLifecycleAfterHeadersResult;\n private runLifecycleAfterHeaders;\n /** Registration-specialized query lifecycle: query validation (including recovery) → hooks. */\n private runLifecycleQuery;\n /** Registration-specialized body lifecycle: bounded body validation (including recovery) → hooks. */\n private runLifecycleBody;\n /** Registration-specialized body + query lifecycle: bounded body validation → query validation → hooks. */\n private runLifecycleBodyQuery;\n /** Registration-specialized no-body lifecycle: query validation (if present) → derives/hooks. */\n private runQueryAndLifecycle;\n private runQueryAndLifecycleResult;\n private runLifecycleAfterParamsResult;\n private runLifecycleAfterParams;\n private runLifecycleAfterParamsSettled;\n private runLifecycleAfterBody;\n private runLifecycleAfterQueryResult;\n private runLifecycleAfterQuery;\n private runLifecycleHooks;\n /** Registration-specialized derive → before → handler lifecycle. */\n private runLifecycleDeriveBefore;\n /** Finalize the specialized lane without rechecking its registration-proven invariants. */\n private finishSimpleLifecycleResult;\n private continueLifecycleAfterDerive;\n private runLifecycleHooksAsync;\n private continueLifecycleAfterBefore;\n private runLifecycleHandlerAsync;\n private finishLifecycleResult;\n private continueLifecycleAfterHandle;\n private finishLifecycleContract;\n private finishContractOutcome;\n private handleLifecycleError;\n /** Log an unhandled request error to the (redacting) logger - shared by {@link runLifecycle} 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 /**\n * Read + parse the JSON body, capped at `maxBodyBytes` and screened by the server's\n * `protoPoisoning` policy. Rejects a `Content-Length` over the cap *before* buffering,\n * re-checks what was actually delivered after the read, and aborts a chunked or\n * length-less body mid-stream once the running byte count exceeds the cap - so a lying\n * or absent length can't force us to buffer an oversized payload.\n */\n private readBoundedJson;\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. Named wildcards also stay on the fallback until Bun exposes their raw\n * capture semantics; static and `:param` routes take the native lane. */\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 listen(port: number, options?: {\n readonly reusePort?: boolean;\n readonly hostname?: string;\n readonly idleTimeoutSec?: number;\n }): RunningServer;\n /**\n * Gracefully stop: wait for in-flight requests to finish (up to `drainMs`), then\n * issue a single terminal stop - graceful if everything drained, forced if\n * stragglers remain. Safe to call when not listening.\n *\n * The Bun semantics: poll `pendingRequests` (awaiting\n * `stop()`'s promise drops in-flight requests), and decide graceful-vs-forced in\n * ONE call (Bun can't escalate an already-graceful `stop()` to a forced close).\n * New connections may be accepted during the drain window; in a real deploy the\n * load balancer has already stopped routing here, and `drainMs` bounds it.\n */\n stop({ drainMs }?: {\n drainMs?: number;\n }): Promise<void>;\n private installSignalHandlers;\n}",
9503
10736
  "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 */"
9504
10737
  },
9505
10738
  {
@@ -9695,19 +10928,19 @@
9695
10928
  "name": "ServerOptions",
9696
10929
  "kind": "interface",
9697
10930
  "package": "@nifrajs/core",
9698
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), enforced **only when a route declares a body schema** - the cap\n * lives in the schema-validated read path. Default 1_000_000.\n *\n * A route WITHOUT a body schema (raw body, file upload, BYO-validation) that reads `c.req` directly\n * is not auto-bounded - use **`c.boundedBody(maxBytes?)`** / **`c.boundedJson(maxBytes?)`**, which\n * apply this same cap (override per route by passing `maxBytes` - larger for an upload endpoint,\n * smaller to tighten one).\n */\n readonly maxBodyBytes?: number;\n /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /**\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 /** When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false. */\n readonly gracefulSignals?: boolean;\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 * 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}"
10931
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Clean payloads\n * pay a substring pre-scan only - the deep walk runs solely on suspect text.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /**\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 /** When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false. */\n readonly gracefulSignals?: boolean;\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}"
9699
10932
  },
9700
10933
  {
9701
10934
  "name": "ServerOptions",
9702
10935
  "kind": "interface",
9703
10936
  "package": "nifra",
9704
- "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), enforced **only when a route declares a body schema** - the cap\n * lives in the schema-validated read path. Default 1_000_000.\n *\n * A route WITHOUT a body schema (raw body, file upload, BYO-validation) that reads `c.req` directly\n * is not auto-bounded - use **`c.boundedBody(maxBytes?)`** / **`c.boundedJson(maxBytes?)`**, which\n * apply this same cap (override per route by passing `maxBytes` - larger for an upload endpoint,\n * smaller to tighten one).\n */\n readonly maxBodyBytes?: number;\n /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /**\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 /** When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false. */\n readonly gracefulSignals?: boolean;\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 * 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}"
10937
+ "signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Clean payloads\n * pay a substring pre-scan only - the deep walk runs solely on suspect text.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /**\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 /** When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false. */\n readonly gracefulSignals?: boolean;\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}"
9705
10938
  },
9706
10939
  {
9707
10940
  "name": "ServeStaticOptions",
9708
10941
  "kind": "interface",
9709
10942
  "package": "@nifrajs/node",
9710
- "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 /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n}",
10943
+ "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 /** 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 * Set `\"allow\"` if the directory deliberately contains them (e.g. `/.well-known`).\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n}",
9711
10944
  "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 */"
9712
10945
  },
9713
10946
  {
@@ -9768,7 +11001,7 @@
9768
11001
  "name": "SessionOptions",
9769
11002
  "kind": "interface",
9770
11003
  "package": "@nifrajs/auth",
9771
- "signature": "export interface SessionOptions {\n /** Signing secret (≥ 16 chars). Rotating it invalidates all existing sessions. */\n readonly secret: string;\n /** Provide a store for **store mode**; omit for **cookie mode** (stateless). */\n readonly store?: SessionStore;\n /** Cookie name. Default `nifra_session`. */\n readonly cookieName?: string;\n /** Session lifetime in **seconds**. Default 7 days. */\n readonly maxAge?: number;\n /** Slide the expiry forward on every commit (default `true`); `false` = fixed absolute expiry. */\n readonly rolling?: boolean;\n /** Extra cookie attributes (the session cookie is always HttpOnly; `Secure`/`SameSite=Lax`/`Path=/`\n * default via `c.set.cookie`). Pass `{ secure: false }` for local http dev. */\n readonly cookie?: SessionCookieOptions;\n /** Clock (ms) - injected for testability; production passes `() => Date.now()` (the default). */\n readonly now?: () => number;\n}"
11004
+ "signature": "export interface SessionOptions {\n /** Signing secret (≥ 32 bytes), or a rotation list: the **first** secret signs new cookies and\n * any listed secret verifies, so rotating without invalidating live sessions is: prepend the new\n * secret, drop the old one after `maxAge` has elapsed. A bare secret swap (no list) invalidates\n * all existing sessions. */\n readonly secret: string | readonly string[];\n /** Provide a store for **store mode**; omit for **cookie mode** (stateless). */\n readonly store?: SessionStore;\n /** Cookie name. Default `nifra_session`. */\n readonly cookieName?: string;\n /** Session lifetime in **seconds**. Default 7 days. */\n readonly maxAge?: number;\n /** Slide the expiry forward on every commit (default `true`); `false` = fixed absolute expiry. */\n readonly rolling?: boolean;\n /** Extra cookie attributes (the session cookie is always HttpOnly; `Secure`/`SameSite=Lax`/`Path=/`\n * default via `c.set.cookie`). Pass `{ secure: false }` for local http dev. */\n readonly cookie?: SessionCookieOptions;\n /** Clock (ms) - injected for testability; production passes `() => Date.now()` (the default). */\n readonly now?: () => number;\n}"
9772
11005
  },
9773
11006
  {
9774
11007
  "name": "SessionRecord",
@@ -9858,7 +11091,20 @@
9858
11091
  "kind": "function",
9859
11092
  "package": "@nifrajs/web",
9860
11093
  "signature": "export declare function setSsrModuleLoader(load: SsrModuleLoader | undefined): void;",
9861
- "doc": "/**\n * Publishes the dev server's SSR module loader. Called by a dev server that owns SSR resolution\n * itself; pass `undefined` to clear it on shutdown.\n */"
11094
+ "doc": "/** Publish or clear the dev server's SSR module loader. */"
11095
+ },
11096
+ {
11097
+ "name": "Severity",
11098
+ "kind": "type",
11099
+ "package": "@nifrajs/cli",
11100
+ "signature": "export type Severity = \"error\" | \"warn\" | \"info\";",
11101
+ "doc": "/** Stable, machine-actionable diagnostics shared by CLI gates and MCP renderers. */"
11102
+ },
11103
+ {
11104
+ "name": "severityFails",
11105
+ "kind": "function",
11106
+ "package": "@nifrajs/cli",
11107
+ "signature": "export declare function severityFails(severity: Severity, strict?: boolean): boolean;"
9862
11108
  },
9863
11109
  {
9864
11110
  "name": "shapeOf",
@@ -9953,15 +11199,15 @@
9953
11199
  "name": "signValue",
9954
11200
  "kind": "function",
9955
11201
  "package": "@nifrajs/core",
9956
- "signature": "export declare function signValue(value: string, secret: string): Promise<string>;",
9957
- "doc": "/** Append an HMAC-SHA256 signature to a value → `value.signature` (base64url). For signed cookies. */"
11202
+ "signature": "export declare function signValue(value: string, secret: CookieSecret): Promise<string>;",
11203
+ "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. */"
9958
11204
  },
9959
11205
  {
9960
11206
  "name": "signValue",
9961
11207
  "kind": "function",
9962
11208
  "package": "nifra",
9963
- "signature": "export declare function signValue(value: string, secret: string): Promise<string>;",
9964
- "doc": "/** Append an HMAC-SHA256 signature to a value → `value.signature` (base64url). For signed cookies. */"
11209
+ "signature": "export declare function signValue(value: string, secret: CookieSecret): Promise<string>;",
11210
+ "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. */"
9965
11211
  },
9966
11212
  {
9967
11213
  "name": "silentLogger",
@@ -10024,6 +11270,13 @@
10024
11270
  "signature": "export declare function snapshotDataContract(contract: DataContract): DataContractSnapshot;",
10025
11271
  "doc": "/** Strip a contract to its token-only version/access snapshot for CI or adapter drift checks. */"
10026
11272
  },
11273
+ {
11274
+ "name": "snapshotProjectEvidence",
11275
+ "kind": "function",
11276
+ "package": "@nifrajs/core",
11277
+ "signature": "export declare function snapshotProjectEvidence(source: unknown, options?: ProjectEvidenceOptions): ProjectEvidenceSnapshot;",
11278
+ "doc": "/** Build the canonical snapshot from reflection and already-evaluated offline reports. */"
11279
+ },
10027
11280
  {
10028
11281
  "name": "snapshotRoutes",
10029
11282
  "kind": "function",
@@ -10066,6 +11319,24 @@
10066
11319
  "signature": "export declare function sortRoutesBySpecificity<T extends {\n readonly pattern: CompiledRoutePattern;\n}>(routes: T[]): T[];",
10067
11320
  "doc": "/**\n * Sort compiled routes most-specific-first - a static segment beats a dynamic one, the order the router\n * resolves a path in. The single home for that precedence: the web router, the mock server, and the\n * editor plugin all order routes through this one comparator, so which file a path resolves to can never\n * diverge between runtime, client, and editor. Sorts in place and returns the same array.\n */"
10068
11321
  },
11322
+ {
11323
+ "name": "SourceFile",
11324
+ "kind": "interface",
11325
+ "package": "@nifrajs/cli",
11326
+ "signature": "export interface SourceFile {\n readonly file: string;\n readonly content: string;\n}"
11327
+ },
11328
+ {
11329
+ "name": "sourceIndex",
11330
+ "kind": "function",
11331
+ "package": "@nifrajs/cli",
11332
+ "signature": "export declare function sourceIndex(files: readonly SourceFile[]): SourceIndex;"
11333
+ },
11334
+ {
11335
+ "name": "SourceIndex",
11336
+ "kind": "interface",
11337
+ "package": "@nifrajs/cli",
11338
+ "signature": "export interface SourceIndex {\n readonly files: readonly string[];\n read(file: string): string | undefined;\n}"
11339
+ },
10069
11340
  {
10070
11341
  "name": "SourceReader",
10071
11342
  "kind": "type",
@@ -10090,7 +11361,7 @@
10090
11361
  "name": "SqliteDatabaseLike",
10091
11362
  "kind": "interface",
10092
11363
  "package": "@nifrajs/mcp-db",
10093
- "signature": "export interface SqliteDatabaseLike {\n /** Prepare a statement; `all` runs it and returns row objects. */\n prepare(sql: string): {\n all(...params: unknown[]): unknown[];\n };\n /** Execute a statement for its side effect (used only for `PRAGMA query_only`). */\n run(sql: string): unknown;\n}",
11364
+ "signature": "export interface SqliteDatabaseLike {\n /** Prepare a statement; `all` runs it and returns row objects. */\n prepare(sql: string): {\n all(...params: unknown[]): unknown[];\n };\n /** Execute a statement for its side effect (used only for `PRAGMA query_only`). */\n run(sql: string): unknown;\n /** Optional path this database was opened from; a file-backed one can be reopened read-only in a\n * worker so `run_query` runs off the serving connection. `:memory:` and the empty anonymous\n * database cannot, and run in process. */\n readonly filename?: string;\n}",
10094
11365
  "doc": "/** The structural slice of `bun:sqlite`'s `Database` this package needs. */"
10095
11366
  },
10096
11367
  {
@@ -10182,14 +11453,20 @@
10182
11453
  "kind": "function",
10183
11454
  "package": "@nifrajs/web",
10184
11455
  "signature": "export declare function ssrModuleLoader(): SsrModuleLoader | undefined;",
10185
- "doc": "/**\n * The dev server's SSR module loader, or `undefined` when nothing owns SSR resolution but the runtime\n * - the Bun dev pipeline, and every production build, where the adapter's assets are compiled ahead\n * of time and a plain `import` is already the right thing.\n *\n * An adapter that must load a COMPILED asset at runtime (a `.svelte` component, say) has to prefer\n * this over a bare `import`, and has to take the framework's SERVER RENDERER from it as well, not\n * just the component. A component compiled by the dev server renders through the renderer the dev\n * server resolved; mixing the two puts two copies of the framework runtime in one component tree,\n * where context written by one half is invisible to the other.\n */"
11456
+ "doc": "/** Return the dev server's SSR module loader, when one owns SSR resolution. */"
10186
11457
  },
10187
11458
  {
10188
11459
  "name": "SsrModuleLoader",
10189
11460
  "kind": "type",
10190
11461
  "package": "@nifrajs/web",
10191
11462
  "signature": "export type SsrModuleLoader = (id: string) => Promise<unknown>;",
10192
- "doc": "/**\n * Loads a module through the DEV SERVER'S module graph rather than the runtime's. Takes an absolute\n * file path or a bare specifier; resolution, compilation and caching are the dev server's.\n */"
11463
+ "doc": "/** Loads a module through the dev server's module graph rather than the runtime's resolver. */"
11464
+ },
11465
+ {
11466
+ "name": "StaleBuildError",
11467
+ "kind": "class",
11468
+ "package": "@nifrajs/cli",
11469
+ "signature": "export declare class StaleBuildError extends Error {\n readonly freshness: BuildFreshness;\n constructor(freshness: BuildFreshness);\n}"
10193
11470
  },
10194
11471
  {
10195
11472
  "name": "StandardFailure",
@@ -10516,6 +11793,13 @@
10516
11793
  "signature": "export interface StoredResponse {\n readonly status: number;\n readonly headers: readonly (readonly [string, string])[];\n /** Base64-encoded response body; `\"\"` when the response had no body. */\n readonly body: string;\n}",
10517
11794
  "doc": "/** A serialized response held by a store. `body` is base64 so binary payloads round-trip intact. */"
10518
11795
  },
11796
+ {
11797
+ "name": "streamHandle",
11798
+ "kind": "function",
11799
+ "package": "@nifrajs/aws-lambda",
11800
+ "signature": "export declare function streamHandle(app: FetchHandler, options?: LambdaOptions): (event: LambdaEvent, responseStream: ResponseStream, context?: LambdaContext) => Promise<void>;",
11801
+ "doc": "/**\n * A streaming Lambda handler for Function URLs with `InvokeMode: RESPONSE_STREAM`, via the\n * runtime's `awslambda.streamifyResponse`. Response bytes flow as the app produces them - no\n * buffering, no base64. Requires the managed AWS Lambda Node runtime (the `awslambda` global);\n * API Gateway does not support response streaming - use {@link handle} there.\n */"
11802
+ },
10519
11803
  {
10520
11804
  "name": "streaming",
10521
11805
  "kind": "function",
@@ -10739,11 +12023,17 @@
10739
12023
  "package": "@nifrajs/testing",
10740
12024
  "signature": "export interface TestSessionOptions extends Omit<ClientOptions, \"fetch\"> {\n /** Origin used to resolve relative paths. Default `\"http://nifra.internal\"`. */\n readonly origin?: string;\n /** Reuse an existing jar (e.g. seed a session cookie, or share one across sessions). */\n readonly cookies?: CookieJar;\n}"
10741
12025
  },
12026
+ {
12027
+ "name": "testToolAdapter",
12028
+ "kind": "function",
12029
+ "package": "@nifrajs/testing",
12030
+ "signature": "export declare function testToolAdapter<Input, Output>(tool: ToolContract<Input, Output>, baseOptions?: ToolCallOptions): ToolAdapter;"
12031
+ },
10742
12032
  {
10743
12033
  "name": "timing",
10744
12034
  "kind": "function",
10745
12035
  "package": "@nifrajs/middleware",
10746
- "signature": "export declare function timing(options?: TimingOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").Server<any, any>>;",
12036
+ "signature": "export declare function timing(options?: TimingOptions): ContextPlugin<{\n timing: TimingControls;\n}>;",
10747
12037
  "doc": "/**\n * Adds a `Server-Timing` response header and typed `c.timing` controls for custom metrics.\n * Put request-rewriting middleware (for example `methodOverride`) before `timing()` so timing is\n * attached to the final routed request.\n */"
10748
12038
  },
10749
12039
  {
@@ -10771,6 +12061,13 @@
10771
12061
  "signature": "export declare function toBytes(data: StorageData): Uint8Array;",
10772
12062
  "doc": "/** Normalize any accepted payload to bytes. */"
10773
12063
  },
12064
+ {
12065
+ "name": "toCatalogEntry",
12066
+ "kind": "function",
12067
+ "package": "@nifrajs/core",
12068
+ "signature": "export declare function toCatalogEntry<Input, Output>(tool: ToolContract<Input, Output>): ToolCatalogEntry;",
12069
+ "doc": "/** Build the single descriptive projection shared by agent, MCP, and test adapters. */"
12070
+ },
10774
12071
  {
10775
12072
  "name": "toFetchHandler",
10776
12073
  "kind": "function",
@@ -10806,6 +12103,13 @@
10806
12103
  "signature": "export declare function toLambdaHandler<Env = unknown>(app: FetchApp<Env>): LambdaHandler;",
10807
12104
  "doc": "/** Adapt API Gateway HTTP API (v2) and REST API (v1) events to a Web-standard app. */"
10808
12105
  },
12106
+ {
12107
+ "name": "toMcpTool",
12108
+ "kind": "function",
12109
+ "package": "@nifrajs/mcp",
12110
+ "signature": "export declare function toMcpTool<Input, Output>(tool: ToolContract<Input, Output>, options?: McpToolContractOptions): McpTool;",
12111
+ "doc": "/** Adapt a contract to MCP without creating a second validation or enforcement path. */"
12112
+ },
10809
12113
  {
10810
12114
  "name": "toNetlifyHandler",
10811
12115
  "kind": "function",
@@ -10820,6 +12124,18 @@
10820
12124
  "signature": "export declare function toNetlifyHandler<Env = unknown>(app: FetchApp<Env>): NetlifyHandler;",
10821
12125
  "doc": "/** Adapt a Web-standard app to a Netlify Functions event handler. */"
10822
12126
  },
12127
+ {
12128
+ "name": "ToolAdapter",
12129
+ "kind": "interface",
12130
+ "package": "@nifrajs/core",
12131
+ "signature": "export interface ToolAdapter {\n readonly name: string;\n call(input: unknown, options?: ToolCallOptions): Promise<ToolAdapterResult>;\n}"
12132
+ },
12133
+ {
12134
+ "name": "ToolAdapterResult",
12135
+ "kind": "type",
12136
+ "package": "@nifrajs/core",
12137
+ "signature": "export type ToolAdapterResult<Output = unknown> = {\n readonly ok: true;\n readonly output?: Output;\n readonly dryRun: boolean;\n readonly evidence: readonly ToolEvidence[];\n} | {\n readonly ok: false;\n readonly dryRun: boolean;\n readonly error: ToolError;\n readonly evidence: readonly ToolEvidence[];\n};"
12138
+ },
10823
12139
  {
10824
12140
  "name": "ToolAnnotations",
10825
12141
  "kind": "interface",
@@ -10834,6 +12150,151 @@
10834
12150
  "signature": "export interface ToolAnnotations {\n /** Human-readable display title for the tool, distinct from the machine `name`. */\n readonly title?: string;\n /** The tool does not modify its environment (a pure read). */\n readonly readOnlyHint?: boolean;\n /** The tool may perform destructive updates - only meaningful when `readOnlyHint` is not `true`. */\n readonly destructiveHint?: boolean;\n /** Repeated calls with the same arguments have no additional effect beyond the first. */\n readonly idempotentHint?: boolean;\n /** The tool interacts with external entities (an \"open world\" beyond this server). */\n readonly openWorldHint?: boolean;\n}",
10835
12151
  "doc": "/**\n * MCP tool safety hints, surfaced in `tools/list`, that tell an agent how risky a `.tool()` call is - so it\n * can decide whether to auto-invoke or confirm first. All optional; an omitted hint means \"unknown\". Mirrors\n * the MCP spec's tool `annotations`.\n */"
10836
12152
  },
12153
+ {
12154
+ "name": "ToolApproval",
12155
+ "kind": "type",
12156
+ "package": "@nifrajs/core",
12157
+ "signature": "export type ToolApproval = {\n readonly granted: true;\n readonly level?: number;\n} | {\n readonly granted: false;\n readonly reason?: string;\n};"
12158
+ },
12159
+ {
12160
+ "name": "ToolApprovalPolicy",
12161
+ "kind": "type",
12162
+ "package": "@nifrajs/core",
12163
+ "signature": "export type ToolApprovalPolicy = {\n readonly kind: \"none\";\n} | {\n readonly kind: \"required\";\n} | {\n readonly kind: \"threshold\";\n readonly level: number;\n};"
12164
+ },
12165
+ {
12166
+ "name": "ToolBudget",
12167
+ "kind": "interface",
12168
+ "package": "@nifrajs/core",
12169
+ "signature": "export interface ToolBudget {\n readonly consume: (cost: EffectCost | undefined) => boolean;\n readonly snapshot: () => EffectCost;\n}"
12170
+ },
12171
+ {
12172
+ "name": "ToolCallOptions",
12173
+ "kind": "interface",
12174
+ "package": "@nifrajs/core",
12175
+ "signature": "export interface ToolCallOptions {\n readonly effectId?: string;\n readonly clock?: () => number;\n readonly signal?: AbortSignal;\n /** Wall-clock budget shared with the parent request, distinct from the cost `budget`. */\n readonly deadline?: RequestBudget;\n readonly capabilities?: readonly string[];\n readonly approval?: ToolApproval;\n readonly budget?: ToolBudget;\n readonly idempotency?: ToolIdempotencyStore;\n readonly namespace?: string;\n readonly dryRun?: boolean;\n readonly ledger?: RequestLedger;\n readonly executionPolicy?: ExecutionPolicyAdapter;\n}"
12176
+ },
12177
+ {
12178
+ "name": "ToolCallOptions",
12179
+ "kind": "interface",
12180
+ "package": "@nifrajs/mcp",
12181
+ "signature": "export interface ToolCallOptions {\n readonly effectId?: string;\n readonly clock?: () => number;\n readonly signal?: AbortSignal;\n /** Wall-clock budget shared with the parent request, distinct from the cost `budget`. */\n readonly deadline?: RequestBudget;\n readonly capabilities?: readonly string[];\n readonly approval?: ToolApproval;\n readonly budget?: ToolBudget;\n readonly idempotency?: ToolIdempotencyStore;\n readonly namespace?: string;\n readonly dryRun?: boolean;\n readonly ledger?: RequestLedger;\n readonly executionPolicy?: ExecutionPolicyAdapter;\n}"
12182
+ },
12183
+ {
12184
+ "name": "ToolCallResult",
12185
+ "kind": "type",
12186
+ "package": "@nifrajs/core",
12187
+ "signature": "export type ToolCallResult<Output> = {\n readonly ok: true;\n readonly output?: Output;\n readonly dryRun: boolean;\n readonly evidence: readonly ToolEvidence[];\n readonly ledger: SealedEffectLedger;\n} | {\n readonly ok: false;\n readonly dryRun: boolean;\n readonly output?: undefined;\n readonly error: ToolError;\n readonly evidence: readonly ToolEvidence[];\n readonly ledger: SealedEffectLedger;\n};"
12188
+ },
12189
+ {
12190
+ "name": "ToolCatalogEntry",
12191
+ "kind": "interface",
12192
+ "package": "@nifrajs/core",
12193
+ "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}",
12194
+ "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 */"
12195
+ },
12196
+ {
12197
+ "name": "ToolConformanceResult",
12198
+ "kind": "interface",
12199
+ "package": "@nifrajs/core",
12200
+ "signature": "export interface ToolConformanceResult {\n readonly adapter: string;\n readonly checks: readonly string[];\n}"
12201
+ },
12202
+ {
12203
+ "name": "ToolContract",
12204
+ "kind": "interface",
12205
+ "package": "@nifrajs/core",
12206
+ "signature": "export interface ToolContract<Input = unknown, Output = unknown> {\n readonly name: string;\n readonly description: string;\n readonly input: StandardSchemaV1<unknown, Input>;\n readonly output: StandardSchemaV1<unknown, Output>;\n readonly capability: string;\n readonly approval: ToolApprovalPolicy;\n readonly idempotency?: ToolIdempotencyPolicy<Input>;\n readonly cost?: EffectCost;\n readonly sensitivity: ToolSensitivity;\n readonly annotations: ToolAnnotations;\n readonly policy?: ExecutionPolicy;\n readonly execute: (input: Input, context: ToolExecutionContext) => Output | PromiseLike<Output>;\n}"
12207
+ },
12208
+ {
12209
+ "name": "ToolContract",
12210
+ "kind": "interface",
12211
+ "package": "@nifrajs/mcp",
12212
+ "signature": "export interface ToolContract<Input = unknown, Output = unknown> {\n readonly name: string;\n readonly description: string;\n readonly input: StandardSchemaV1<unknown, Input>;\n readonly output: StandardSchemaV1<unknown, Output>;\n readonly capability: string;\n readonly approval: ToolApprovalPolicy;\n readonly idempotency?: ToolIdempotencyPolicy<Input>;\n readonly cost?: EffectCost;\n readonly sensitivity: ToolSensitivity;\n readonly annotations: ToolAnnotations;\n readonly policy?: ExecutionPolicy;\n readonly execute: (input: Input, context: ToolExecutionContext) => Output | PromiseLike<Output>;\n}"
12213
+ },
12214
+ {
12215
+ "name": "ToolContractOptions",
12216
+ "kind": "interface",
12217
+ "package": "@nifrajs/core",
12218
+ "signature": "export interface ToolContractOptions<Input, Output, InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly name: string;\n readonly description: string;\n readonly input: InputSchema;\n readonly output: OutputSchema;\n readonly capability?: string;\n readonly approval?: ToolApprovalPolicy;\n readonly idempotency?: ToolIdempotencyPolicy<Input>;\n /** Dimensionless counters such as `{ calls: 1, ms: 20 }`; never prices. */\n readonly cost?: EffectCost;\n readonly sensitivity?: ToolSensitivity;\n readonly annotations?: ToolAnnotations;\n readonly policy?: ExecutionPolicy;\n readonly execute: (input: Input, context: ToolExecutionContext) => Output | PromiseLike<Output>;\n}"
12219
+ },
12220
+ {
12221
+ "name": "ToolError",
12222
+ "kind": "interface",
12223
+ "package": "@nifrajs/core",
12224
+ "signature": "export interface ToolError {\n readonly code: \"input_invalid\" | \"capability_denied\" | \"execution_policy_unsatisfied\" | \"approval_required\" | \"approval_denied\" | \"idempotency_store_missing\" | \"idempotency_durability\" | \"idempotency_duplicate\" | \"idempotency_in_flight\" | \"idempotency_capacity\" | \"budget_exceeded\" | \"cancelled\" | \"execution_failed\" | \"output_invalid\" | \"ledger_failed\";\n readonly stage: ToolEvidenceStage;\n readonly issues?: readonly StandardIssue[];\n}"
12225
+ },
12226
+ {
12227
+ "name": "ToolEvidence",
12228
+ "kind": "interface",
12229
+ "package": "@nifrajs/core",
12230
+ "signature": "export interface ToolEvidence {\n readonly seq: number;\n readonly stage: ToolEvidenceStage;\n readonly outcome: ToolEvidenceOutcome;\n readonly code?: string;\n}"
12231
+ },
12232
+ {
12233
+ "name": "ToolEvidenceOutcome",
12234
+ "kind": "type",
12235
+ "package": "@nifrajs/core",
12236
+ "signature": "export type ToolEvidenceOutcome = \"passed\" | \"denied\" | \"failed\" | \"skipped\" | \"committed\" | \"dry-run\";"
12237
+ },
12238
+ {
12239
+ "name": "ToolEvidenceStage",
12240
+ "kind": "type",
12241
+ "package": "@nifrajs/core",
12242
+ "signature": "export type ToolEvidenceStage = \"input\" | \"capability\" | \"policy\" | \"approval\" | \"idempotency\" | \"budget\" | \"execution\" | \"output\";"
12243
+ },
12244
+ {
12245
+ "name": "ToolExecutionContext",
12246
+ "kind": "interface",
12247
+ "package": "@nifrajs/core",
12248
+ "signature": "export interface ToolExecutionContext {\n readonly effectId: string;\n readonly signal: AbortSignal;\n /** Wall-clock budget shared with the parent request, when an agent supplies one. */\n readonly deadline?: RequestBudget;\n readonly dryRun: boolean;\n readonly policy?: ExecutionPolicy;\n}"
12249
+ },
12250
+ {
12251
+ "name": "ToolHttpOptions",
12252
+ "kind": "interface",
12253
+ "package": "@nifrajs/core",
12254
+ "signature": "export interface ToolHttpOptions extends Omit<ToolCallOptions, \"signal\" | \"ledger\"> {\n readonly method?: string;\n /** Prototype-poisoning policy for the JSON request body - mirrors the server option (this\n * handler is standalone, so it carries its own). Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Transport body cap in bytes for the JSON request body. Default {@link DEFAULT_TOOL_MAX_BYTES}\n * (1 MiB). `\"unlimited\"` removes the cap and requires a written {@link maxBytesReason}: the\n * mounting platform then owns the limit, and the exemption is reviewable rather than implicit. */\n readonly maxBytes?: number | \"unlimited\";\n /** Why this handler runs uncapped. Required with `maxBytes: \"unlimited\"`, rejected without it. */\n readonly maxBytesReason?: string;\n}"
12255
+ },
12256
+ {
12257
+ "name": "toolHttpResult",
12258
+ "kind": "function",
12259
+ "package": "@nifrajs/core",
12260
+ "signature": "export declare function toolHttpResult<Output>(result: ToolCallResult<Output>): Response;"
12261
+ },
12262
+ {
12263
+ "name": "ToolIdempotencyBeginInput",
12264
+ "kind": "interface",
12265
+ "package": "@nifrajs/core",
12266
+ "signature": "export interface ToolIdempotencyBeginInput {\n readonly namespace: string;\n readonly key: string;\n}"
12267
+ },
12268
+ {
12269
+ "name": "ToolIdempotencyBeginResult",
12270
+ "kind": "type",
12271
+ "package": "@nifrajs/core",
12272
+ "signature": "export type ToolIdempotencyBeginResult = {\n readonly state: \"new\";\n readonly reservation: string;\n} | {\n readonly state: \"duplicate\";\n} | {\n readonly state: \"in-flight\";\n} | {\n readonly state: \"capacity\";\n};"
12273
+ },
12274
+ {
12275
+ "name": "ToolIdempotencyPolicy",
12276
+ "kind": "interface",
12277
+ "package": "@nifrajs/core",
12278
+ "signature": "export interface ToolIdempotencyPolicy<Input = unknown> {\n readonly scope: Exclude<IdempotencyScope, \"none\">;\n /** Return an opaque bounded key. The key must not contain a request body or secret. */\n readonly key: (input: Input) => string | PromiseLike<string>;\n}"
12279
+ },
12280
+ {
12281
+ "name": "ToolIdempotencyStore",
12282
+ "kind": "interface",
12283
+ "package": "@nifrajs/core",
12284
+ "signature": "export interface ToolIdempotencyStore {\n readonly durability?: \"memory\" | \"durable\";\n begin(input: ToolIdempotencyBeginInput): ToolIdempotencyBeginResult | PromiseLike<ToolIdempotencyBeginResult>;\n complete(input: {\n readonly namespace: string;\n readonly key: string;\n readonly reservation: string;\n }): boolean | PromiseLike<boolean>;\n abandon(input: {\n readonly namespace: string;\n readonly key: string;\n readonly reservation: string;\n }): boolean | PromiseLike<boolean>;\n}"
12285
+ },
12286
+ {
12287
+ "name": "toolInputJsonSchema",
12288
+ "kind": "function",
12289
+ "package": "@nifrajs/core",
12290
+ "signature": "export declare function toolInputJsonSchema<Input, Output>(tool: ToolContract<Input, Output>): Record<string, unknown>;"
12291
+ },
12292
+ {
12293
+ "name": "ToolSensitivity",
12294
+ "kind": "type",
12295
+ "package": "@nifrajs/core",
12296
+ "signature": "export type ToolSensitivity = \"public\" | \"internal\" | \"sensitive\" | \"secret\";"
12297
+ },
10837
12298
  {
10838
12299
  "name": "toOpenAPI",
10839
12300
  "kind": "function",
@@ -10893,7 +12354,7 @@
10893
12354
  "name": "tracing",
10894
12355
  "kind": "function",
10895
12356
  "package": "@nifrajs/otel",
10896
- "signature": "export declare function tracing(options?: TracingOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").Server<any, any>>;",
12357
+ "signature": "export declare function tracing(options?: TracingOptions): ContextPlugin<TracingContext>;",
10897
12358
  "doc": "/**\n * Distributed-tracing plugin. Each request continues the inbound trace (or starts one), opens a\n * server span, and ends it on response with the status + HTTP attributes. Idempotent.\n *\n * ```ts\n * app.use(tracing({ exporter: myOtelExporter, serviceName: \"orders-api\" }))\n * // in a handler: fetch(url, { headers: traceHeaders(c.trace) }) // continue the trace downstream\n * ```\n */"
10898
12359
  },
10899
12360
  {
@@ -10908,6 +12369,48 @@
10908
12369
  "package": "@nifrajs/middleware",
10909
12370
  "signature": "export interface TrailingSlashOptions {\n /** Redirect (default) or route internally with a rewritten URL. */\n readonly mode?: \"redirect\" | \"rewrite\";\n /** Redirect status. Default `308` (method-preserving permanent redirect). */\n readonly status?: 301 | 302 | 307 | 308;\n /** Methods affected. Default `[\"GET\", \"HEAD\"]`; add write methods only when you want 308 redirects. */\n readonly methods?: readonly string[];\n /** Skip paths whose last segment looks like a file (`/app.css`). Default `true` for append mode. */\n readonly ignoreFileExtensions?: boolean;\n /** App-specific skip predicate. */\n readonly ignore?: (path: string, request: Request) => boolean;\n}"
10910
12371
  },
12372
+ {
12373
+ "name": "TrajectoryInvariantId",
12374
+ "kind": "type",
12375
+ "package": "@nifrajs/testing",
12376
+ "signature": "export type TrajectoryInvariantId = \"ledger-evidence\" | \"capability-admission\" | \"budget-monotonic\" | \"bounded-stop\" | \"resumable-suspension\";"
12377
+ },
12378
+ {
12379
+ "name": "TrajectoryInvariantOptions",
12380
+ "kind": "interface",
12381
+ "package": "@nifrajs/testing",
12382
+ "signature": "export interface TrajectoryInvariantOptions {\n readonly maxSteps?: number;\n /** Remaining budget snapshots, used when the caller owns a budget adapter. */\n readonly budgetSnapshots?: readonly Readonly<Record<string, number>>[];\n}"
12383
+ },
12384
+ {
12385
+ "name": "TrajectoryInvariantResult",
12386
+ "kind": "interface",
12387
+ "package": "@nifrajs/testing",
12388
+ "signature": "export interface TrajectoryInvariantResult {\n readonly id: TrajectoryInvariantId;\n readonly ok: boolean;\n readonly code?: string;\n}"
12389
+ },
12390
+ {
12391
+ "name": "trajectoryRegressionId",
12392
+ "kind": "function",
12393
+ "package": "@nifrajs/testing",
12394
+ "signature": "export declare function trajectoryRegressionId(transcript: TrajectoryTranscript, faultProfile: string, invariant: TrajectoryInvariantId): Promise<string>;"
12395
+ },
12396
+ {
12397
+ "name": "TrajectoryReplayResult",
12398
+ "kind": "interface",
12399
+ "package": "@nifrajs/testing",
12400
+ "signature": "export interface TrajectoryReplayResult<Output> {\n readonly result: AgentRunResult<Output>;\n readonly transcript: TrajectoryTranscript;\n readonly faults: readonly FailureEvidence[];\n readonly invariants: readonly TrajectoryInvariantResult[];\n readonly regressionIds: readonly string[];\n}"
12401
+ },
12402
+ {
12403
+ "name": "TrajectoryRun",
12404
+ "kind": "interface",
12405
+ "package": "@nifrajs/testing",
12406
+ "signature": "export interface TrajectoryRun<Output> {\n readonly result: AgentRunResult<Output>;\n readonly transcript: TrajectoryTranscript;\n}"
12407
+ },
12408
+ {
12409
+ "name": "TrajectoryTranscript",
12410
+ "kind": "interface",
12411
+ "package": "@nifrajs/testing",
12412
+ "signature": "export interface TrajectoryTranscript {\n readonly version: 1;\n readonly digest: string;\n readonly turn: AgentTranscript;\n readonly faultProfile?: string;\n readonly seed?: number;\n}"
12413
+ },
10911
12414
  {
10912
12415
  "name": "transformCssModule",
10913
12416
  "kind": "function",
@@ -10964,7 +12467,7 @@
10964
12467
  "name": "trimTrailingSlash",
10965
12468
  "kind": "function",
10966
12469
  "package": "@nifrajs/middleware",
10967
- "signature": "export declare function trimTrailingSlash(options?: TrailingSlashOptions): import(\"@nifrajs/core/server\").NifraPlugin<import(\"@nifrajs/core/server\").AnyServer, import(\"@nifrajs/core/server\").AnyServer>;",
12470
+ "signature": "export declare function trimTrailingSlash(options?: TrailingSlashOptions): import(\"@nifrajs/core\").IdentityPlugin;",
10968
12471
  "doc": "/**\n * Remove trailing slashes from non-root paths. Redirect mode is the production default because it\n * canonicalizes URLs for clients and caches; rewrite mode is available for compatibility migrations.\n */"
10969
12472
  },
10970
12473
  {
@@ -10980,6 +12483,12 @@
10980
12483
  "package": "@nifrajs/middleware",
10981
12484
  "signature": "export declare function tryVerifyJwt<C extends JwtClaims = JwtClaims>(token: string, options: VerifyJwtOptions): Promise<VerifyJwtResult<C>>;"
10982
12485
  },
12486
+ {
12487
+ "name": "turn",
12488
+ "kind": "function",
12489
+ "package": "@nifrajs/agent",
12490
+ "signature": "export declare function turn<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1>(definition: AgentDefinition<InputSchema, OutputSchema>, state: AgentTurnState, input: AgentTurnInput, ports: AgentPorts): Promise<AgentTurnResult<NonNullable<OutputSchema[\"~standard\"][\"types\"]>[\"output\"]>>;"
12491
+ },
10983
12492
  {
10984
12493
  "name": "TypedDataPort",
10985
12494
  "kind": "interface",
@@ -11060,15 +12569,15 @@
11060
12569
  "name": "unsignValue",
11061
12570
  "kind": "function",
11062
12571
  "package": "@nifrajs/core",
11063
- "signature": "export declare function unsignValue(signed: string, secret: string): Promise<string | null>;",
11064
- "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 */"
12572
+ "signature": "export declare function unsignValue(signed: string, secret: CookieSecret): Promise<string | null>;",
12573
+ "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 */"
11065
12574
  },
11066
12575
  {
11067
12576
  "name": "unsignValue",
11068
12577
  "kind": "function",
11069
12578
  "package": "nifra",
11070
- "signature": "export declare function unsignValue(signed: string, secret: string): Promise<string | null>;",
11071
- "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 */"
12579
+ "signature": "export declare function unsignValue(signed: string, secret: CookieSecret): Promise<string | null>;",
12580
+ "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 */"
11072
12581
  },
11073
12582
  {
11074
12583
  "name": "UnsupportedMockSchemaError",
@@ -11534,6 +13043,12 @@
11534
13043
  "signature": "export declare function useT(): Formatter;",
11535
13044
  "doc": "/** Read the current {@link Formatter} (`{ locale, t, n, d }`). Throws if no `<I18nProvider>` is above. */"
11536
13045
  },
13046
+ {
13047
+ "name": "validateRulePacks",
13048
+ "kind": "function",
13049
+ "package": "@nifrajs/cli",
13050
+ "signature": "export declare function validateRulePacks(packs: readonly RulePack[] | undefined): readonly RulePack[];"
13051
+ },
11537
13052
  {
11538
13053
  "name": "validateStandard",
11539
13054
  "kind": "function",
@@ -11629,7 +13144,7 @@
11629
13144
  "name": "verifyCsrfToken",
11630
13145
  "kind": "function",
11631
13146
  "package": "@nifrajs/middleware",
11632
- "signature": "export declare function verifyCsrfToken(token: string, secret: string | Uint8Array): Promise<boolean>;"
13147
+ "signature": "export declare function verifyCsrfToken(token: string, secret: CsrfSecret): Promise<boolean>;"
11633
13148
  },
11634
13149
  {
11635
13150
  "name": "verifyDownloadUrl",
@@ -11692,14 +13207,14 @@
11692
13207
  "name": "VERSION",
11693
13208
  "kind": "const",
11694
13209
  "package": "@nifrajs/core",
11695
- "signature": "export declare const VERSION: \"2.11.0\";",
13210
+ "signature": "export declare const VERSION: \"2.12.1\";",
11696
13211
  "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 */"
11697
13212
  },
11698
13213
  {
11699
13214
  "name": "VERSION",
11700
13215
  "kind": "const",
11701
13216
  "package": "nifra",
11702
- "signature": "export declare const VERSION: \"2.11.0\";",
13217
+ "signature": "export declare const VERSION: \"2.12.1\";",
11703
13218
  "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 */"
11704
13219
  },
11705
13220
  {
@@ -11870,14 +13385,14 @@
11870
13385
  "name": "WebSocketUpgradeOutcome",
11871
13386
  "kind": "type",
11872
13387
  "package": "@nifrajs/core",
11873
- "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n};",
13388
+ "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n readonly maxPayloadBytes?: number;\n};",
11874
13389
  "doc": "/**\n * The outcome of `app.resolveWebSocketUpgrade(req)` - for serving adapters:\n * - `pass` - not a WS upgrade for a registered WS route; handle as a normal HTTP request.\n * - `reject` - a WS route matched but `upgrade()` rejected (or the path was malformed); return `response`.\n * - `upgrade` - perform the runtime upgrade, then dispatch the native socket's events to `handler`,\n * seeding `ws.data` with `data`.\n */"
11875
13390
  },
11876
13391
  {
11877
13392
  "name": "WebSocketUpgradeOutcome",
11878
13393
  "kind": "type",
11879
13394
  "package": "nifra",
11880
- "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n};",
13395
+ "signature": "export type WebSocketUpgradeOutcome = {\n readonly kind: \"pass\";\n} | {\n readonly kind: \"reject\";\n readonly response: Response;\n} | {\n readonly kind: \"upgrade\";\n readonly handler: WebSocketHandler;\n readonly data: unknown;\n /** The app's pub/sub registry - the adapter wires `ws.subscribe` + close-cleanup to it. */\n readonly pubsub: TopicRegistry;\n /** The installed runtime's {@link attachWebSocket}, carried on the outcome so an adapter can wire\n * a standard socket without a static import of the WS implementation (which would defeat the\n * `.use(websocket())` tree-shaking). `@nifrajs/workers` may import `attachWebSocket` directly instead. */\n readonly attach: WsAttach;\n readonly maxPayloadBytes?: number;\n};",
11881
13396
  "doc": "/**\n * The outcome of `app.resolveWebSocketUpgrade(req)` - for serving adapters:\n * - `pass` - not a WS upgrade for a registered WS route; handle as a normal HTTP request.\n * - `reject` - a WS route matched but `upgrade()` rejected (or the path was malformed); return `response`.\n * - `upgrade` - perform the runtime upgrade, then dispatch the native socket's events to `handler`,\n * seeding `ws.data` with `data`.\n */"
11882
13397
  },
11883
13398
  {
@@ -11962,6 +13477,43 @@
11962
13477
  "package": "@nifrajs/jobs",
11963
13478
  "signature": "export interface WorkerOptions {\n /** Max jobs in flight at once. Default 1. */\n readonly concurrency?: number;\n /** How often to poll the store for due jobs (ms). Default 250. */\n readonly pollIntervalMs?: number;\n /** How long a leased job is hidden before it's considered abandoned and re-leased (ms). Default 30_000. */\n readonly leaseMs?: number;\n}"
11964
13479
  },
13480
+ {
13481
+ "name": "WorkGraph",
13482
+ "kind": "interface",
13483
+ "package": "@nifrajs/cli",
13484
+ "signature": "export interface WorkGraph {\n readonly version: 1;\n readonly digest: string;\n readonly nodes: readonly WorkGraphNode[];\n readonly edges: readonly WorkGraphEdge[];\n readonly freshness: BuildFreshness;\n}"
13485
+ },
13486
+ {
13487
+ "name": "WorkGraphBuildInput",
13488
+ "kind": "interface",
13489
+ "package": "@nifrajs/cli",
13490
+ "signature": "export interface WorkGraphBuildInput {\n readonly source: unknown;\n readonly files?: readonly WorkGraphSourceFile[];\n readonly freshness?: BuildFreshness;\n}"
13491
+ },
13492
+ {
13493
+ "name": "WorkGraphEdge",
13494
+ "kind": "interface",
13495
+ "package": "@nifrajs/cli",
13496
+ "signature": "export interface WorkGraphEdge {\n readonly from: string;\n readonly to: string;\n readonly relation: \"contains\" | \"declares\" | \"enforces\" | \"implements\" | \"tests\" | \"describes\";\n}"
13497
+ },
13498
+ {
13499
+ "name": "WorkGraphNode",
13500
+ "kind": "interface",
13501
+ "package": "@nifrajs/cli",
13502
+ "signature": "export interface WorkGraphNode {\n readonly id: string;\n readonly kind: WorkGraphNodeKind;\n readonly label: string;\n readonly digest: string;\n readonly files: readonly string[];\n}"
13503
+ },
13504
+ {
13505
+ "name": "WorkGraphNodeKind",
13506
+ "kind": "type",
13507
+ "package": "@nifrajs/cli",
13508
+ "signature": "export type WorkGraphNodeKind = \"route\" | \"schema\" | \"capability\" | \"assurance\" | \"test\" | \"file\" | \"manifest\";",
13509
+ "doc": "/**\n * Static verification work graph for agents.\n *\n * The graph is intentionally a compact, token-only description of project structure. It connects\n * reflected routes to schemas, capabilities, assurance evidence, source/test files, and static\n * manifests. It never probes a running application and never persists payloads.\n */"
13510
+ },
13511
+ {
13512
+ "name": "WorkGraphSourceFile",
13513
+ "kind": "interface",
13514
+ "package": "@nifrajs/cli",
13515
+ "signature": "export interface WorkGraphSourceFile {\n readonly path: string;\n readonly content: string;\n readonly kind?: \"source\" | \"test\" | \"manifest\";\n}"
13516
+ },
11965
13517
  {
11966
13518
  "name": "WrapOptions",
11967
13519
  "kind": "type",