@nifrajs/cli 3.3.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check-diagnostics.d.ts +3 -15
- package/dist/check-diagnostics.d.ts.map +1 -1
- package/dist/check-diagnostics.js +149 -713
- package/dist/check-diagnostics.js.map +1 -1
- package/dist/check-scan.d.ts +9 -0
- package/dist/check-scan.d.ts.map +1 -1
- package/dist/check-scan.js +32 -0
- package/dist/check-scan.js.map +1 -1
- package/dist/check.d.ts +1 -0
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +63 -8
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +46 -7
- package/dist/cli.js.map +1 -1
- package/dist/command-catalog.d.ts +4 -1
- package/dist/command-catalog.d.ts.map +1 -1
- package/dist/command-catalog.js +28 -7
- package/dist/command-catalog.js.map +1 -1
- package/dist/contracts.d.ts +3 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +4 -3
- package/dist/contracts.js.map +1 -1
- package/dist/diagnostics.d.ts +86 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +85 -0
- package/dist/diagnostics.js.map +1 -1
- package/dist/introspect.d.ts +1 -3
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +1 -47
- package/dist/introspect.js.map +1 -1
- package/dist/load.d.ts +5 -0
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js.map +1 -1
- package/dist/mcp-context.d.ts.map +1 -1
- package/dist/mcp-context.js +4 -5
- package/dist/mcp-context.js.map +1 -1
- package/dist/mcp-exec.d.ts +1 -0
- package/dist/mcp-exec.d.ts.map +1 -1
- package/dist/mcp-exec.js +133 -25
- package/dist/mcp-exec.js.map +1 -1
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +4 -1
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-io.d.ts +12 -0
- package/dist/mcp-io.d.ts.map +1 -1
- package/dist/mcp-io.js +68 -0
- package/dist/mcp-io.js.map +1 -1
- package/dist/mcp-path.d.ts +10 -0
- package/dist/mcp-path.d.ts.map +1 -0
- package/dist/mcp-path.js +51 -0
- package/dist/mcp-path.js.map +1 -0
- package/dist/mcp-reflect.d.ts.map +1 -1
- package/dist/mcp-reflect.js +2 -2
- package/dist/mcp-reflect.js.map +1 -1
- package/dist/mcp-render.d.ts.map +1 -1
- package/dist/mcp-render.js +62 -43
- package/dist/mcp-render.js.map +1 -1
- package/dist/mcp-root.d.ts.map +1 -1
- package/dist/mcp-root.js +14 -2
- package/dist/mcp-root.js.map +1 -1
- package/dist/mcp-run.d.ts.map +1 -1
- package/dist/mcp-run.js +82 -51
- package/dist/mcp-run.js.map +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +84 -29
- package/dist/mcp.js.map +1 -1
- package/dist/project-facts.d.ts +23 -4
- package/dist/project-facts.d.ts.map +1 -1
- package/dist/project-facts.js +12 -2
- package/dist/project-facts.js.map +1 -1
- package/dist/review.d.ts +21 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +819 -0
- package/dist/review.js.map +1 -0
- package/dist/rules/legacy.d.ts +3 -1
- package/dist/rules/legacy.d.ts.map +1 -1
- package/dist/rules/legacy.js +796 -34
- package/dist/rules/legacy.js.map +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +23 -4
- package/dist/scaffold.js.map +1 -1
- package/dist/verification-plan.d.ts.map +1 -1
- package/dist/verification-plan.js +4 -0
- package/dist/verification-plan.js.map +1 -1
- package/dist/work-graph.d.ts +3 -0
- package/dist/work-graph.d.ts.map +1 -1
- package/dist/work-graph.js +4 -3
- package/dist/work-graph.js.map +1 -1
- package/docs/llms-full.txt +369 -21
- package/docs/types.json +1121 -80
- package/package.json +10 -9
- package/src/check-diagnostics.ts +181 -796
- package/src/check-scan.ts +36 -0
- package/src/check.ts +65 -12
- package/src/cli.ts +53 -7
- package/src/command-catalog.ts +33 -7
- package/src/contracts.ts +12 -3
- package/src/diagnostics.ts +179 -0
- package/src/introspect.ts +3 -55
- package/src/load.ts +5 -0
- package/src/mcp-context.ts +4 -6
- package/src/mcp-exec.ts +142 -30
- package/src/mcp-http.ts +4 -1
- package/src/mcp-io.ts +73 -0
- package/src/mcp-path.ts +50 -0
- package/src/mcp-reflect.ts +3 -2
- package/src/mcp-render.ts +70 -40
- package/src/mcp-root.ts +13 -2
- package/src/mcp-run.ts +90 -50
- package/src/mcp.ts +87 -27
- package/src/project-facts.ts +37 -8
- package/src/review.ts +983 -0
- package/src/rules/legacy.ts +915 -35
- package/src/scaffold.ts +29 -4
- package/src/verification-plan.ts +14 -0
- package/src/work-graph.ts +13 -3
package/docs/types.json
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"name": "AdapterCertificationReport",
|
|
101
101
|
"kind": "interface",
|
|
102
102
|
"package": "@nifrajs/testing",
|
|
103
|
-
"signature": "export interface AdapterCertificationReport {\n readonly schemaVersion: 1;\n readonly ok: boolean;\n readonly profile: {\n readonly id: string;\n readonly version: number;\n };\n readonly adapterId: string;\n readonly checks: readonly CertificationCheckEvidence[];\n readonly capabilities: readonly CertificationCapabilityEvidence[];\n readonly evidenceHash: string;\n}"
|
|
103
|
+
"signature": "export interface AdapterCertificationReport {\n readonly schemaVersion: 1;\n readonly ok: boolean;\n readonly profile: {\n readonly id: string;\n readonly version: number;\n };\n readonly adapterId: string;\n readonly target?: CertificationTarget;\n readonly checks: readonly CertificationCheckEvidence[];\n readonly capabilities: readonly CertificationCapabilityEvidence[];\n readonly evidenceHash: string;\n}"
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"name": "Admission",
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"name": "AGENT_APP_FEATURES",
|
|
218
218
|
"kind": "const",
|
|
219
219
|
"package": "@nifrajs/agent-app",
|
|
220
|
-
"signature": "export declare const AGENT_APP_FEATURES: readonly [\"approvals\", \"checkpoint\", \"fork\", \"handoff\", \"inbox\", \"reload\", \"resume\", \"workflows\"];",
|
|
220
|
+
"signature": "export declare const AGENT_APP_FEATURES: readonly [\"approvals\", \"checkpoint\", \"fork\", \"handoff\", \"inbox\", \"reload\", \"resume\", \"run-studio\", \"workflows\"];",
|
|
221
221
|
"doc": "/** Interaction features the client knows how to drive. A host grants the subset it supports. */"
|
|
222
222
|
},
|
|
223
223
|
{
|
|
@@ -318,12 +318,25 @@
|
|
|
318
318
|
"package": "@nifrajs/coding-agent",
|
|
319
319
|
"signature": "export type AgentCapability = \"filesystem.read\" | \"filesystem.write\" | \"process.exec\" | \"network.request\" | \"credentials.read\";"
|
|
320
320
|
},
|
|
321
|
+
{
|
|
322
|
+
"name": "AgentCapability",
|
|
323
|
+
"kind": "interface",
|
|
324
|
+
"package": "@nifrajs/webmcp",
|
|
325
|
+
"signature": "export interface AgentCapability<Input, Output, State = unknown> {\n readonly tool: ToolContract<Input, Output>;\n readonly surface: AgentSurfaceDescriptor;\n readonly predict?: AgentSurfacePredictor<Input, State>;\n readonly reconcile?: AgentSurfaceReconciler<Input, Output, State>;\n}"
|
|
326
|
+
},
|
|
321
327
|
{
|
|
322
328
|
"name": "AgentCapabilityManifest",
|
|
323
329
|
"kind": "interface",
|
|
324
330
|
"package": "@nifrajs/coding-agent",
|
|
325
331
|
"signature": "export interface AgentCapabilityManifest {\n readonly version: typeof AGENT_CAPABILITY_MANIFEST_VERSION;\n readonly requested: readonly AgentCapability[];\n readonly trusted: readonly AgentCapability[];\n readonly reason?: string;\n}"
|
|
326
332
|
},
|
|
333
|
+
{
|
|
334
|
+
"name": "AgentCapabilityReference",
|
|
335
|
+
"kind": "type",
|
|
336
|
+
"package": "@nifrajs/webmcp",
|
|
337
|
+
"signature": "export type AgentCapabilityReference = {\n readonly tool: Omit<ToolContract, \"input\" | \"output\" | \"execute\" | \"idempotency\" | \"cost\" | \"policy\"> & {\n readonly input: StandardSchemaV1;\n readonly output: StandardSchemaV1;\n readonly execute: (...args: never[]) => unknown | PromiseLike<unknown>;\n readonly idempotency?: unknown;\n readonly cost?: unknown;\n readonly policy?: unknown;\n };\n readonly surface: AgentSurfaceDescriptor;\n};",
|
|
338
|
+
"doc": "/**\n * The erased, read-only handle accepted by capability registries.\n *\n * A real application commonly registers tools with unrelated input and output types. Registry\n * boundaries therefore use this structural view instead of pretending the whole array has one\n * homogeneous generic type. Individual calls remain validated and typed at their capability's\n * `tool` boundary.\n */"
|
|
339
|
+
},
|
|
327
340
|
{
|
|
328
341
|
"name": "agentCard",
|
|
329
342
|
"kind": "function",
|
|
@@ -746,6 +759,78 @@
|
|
|
746
759
|
"package": "@nifrajs/agent",
|
|
747
760
|
"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}"
|
|
748
761
|
},
|
|
762
|
+
{
|
|
763
|
+
"name": "AgentSurfaceAuthoritativeState",
|
|
764
|
+
"kind": "interface",
|
|
765
|
+
"package": "@nifrajs/webmcp",
|
|
766
|
+
"signature": "export interface AgentSurfaceAuthoritativeState<State> {\n readonly state: State;\n readonly version: string;\n}"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"name": "AgentSurfaceConformanceCase",
|
|
770
|
+
"kind": "interface",
|
|
771
|
+
"package": "@nifrajs/webmcp",
|
|
772
|
+
"signature": "export interface AgentSurfaceConformanceCase {\n readonly capability: AgentCapabilityReference;\n readonly input: unknown;\n readonly assert?: (result: unknown) => void | PromiseLike<void>;\n}"
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
"name": "AgentSurfaceConformanceOptions",
|
|
776
|
+
"kind": "interface",
|
|
777
|
+
"package": "@nifrajs/webmcp",
|
|
778
|
+
"signature": "export interface AgentSurfaceConformanceOptions {\n readonly target?: WebMcpTarget;\n readonly registration?: WebMcpExecutionOptions;\n readonly cases?: readonly AgentSurfaceConformanceCase[];\n}"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"name": "AgentSurfaceConformanceResult",
|
|
782
|
+
"kind": "interface",
|
|
783
|
+
"package": "@nifrajs/webmcp",
|
|
784
|
+
"signature": "export interface AgentSurfaceConformanceResult {\n readonly supported: boolean;\n readonly registered: readonly string[];\n readonly failed: readonly WebMcpRegistrationFailure[];\n readonly checks: readonly string[];\n}"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
"name": "AgentSurfaceDescriptor",
|
|
788
|
+
"kind": "interface",
|
|
789
|
+
"package": "@nifrajs/webmcp",
|
|
790
|
+
"signature": "export interface AgentSurfaceDescriptor {\n readonly scope: AgentSurfaceScope;\n readonly reads: readonly string[];\n readonly writes: readonly string[];\n readonly reconciliation: ReconciliationMode;\n}"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"name": "AgentSurfacePrediction",
|
|
794
|
+
"kind": "interface",
|
|
795
|
+
"package": "@nifrajs/webmcp",
|
|
796
|
+
"signature": "export interface AgentSurfacePrediction {\n readonly baseVersion: string;\n readonly patch: readonly PredictionPatchOperation[];\n readonly expiresAt?: number;\n}"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"name": "AgentSurfacePredictionContext",
|
|
800
|
+
"kind": "interface",
|
|
801
|
+
"package": "@nifrajs/webmcp",
|
|
802
|
+
"signature": "export interface AgentSurfacePredictionContext<State, Input> {\n readonly input: Input;\n readonly snapshot: State;\n readonly version: string;\n readonly now: number;\n}"
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
"name": "AgentSurfacePredictor",
|
|
806
|
+
"kind": "type",
|
|
807
|
+
"package": "@nifrajs/webmcp",
|
|
808
|
+
"signature": "export type AgentSurfacePredictor<Input, State> = (context: AgentSurfacePredictionContext<State, Input>) => AgentSurfacePrediction | PromiseLike<AgentSurfacePrediction>;"
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
"name": "AgentSurfaceReconcileContext",
|
|
812
|
+
"kind": "interface",
|
|
813
|
+
"package": "@nifrajs/webmcp",
|
|
814
|
+
"signature": "export interface AgentSurfaceReconcileContext<Input, Output, State> {\n readonly input: Input;\n readonly output: Output;\n readonly previous: AgentSurfaceSnapshot<State>;\n readonly prediction: AgentSurfacePrediction;\n readonly now: number;\n}"
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"name": "AgentSurfaceReconciler",
|
|
818
|
+
"kind": "type",
|
|
819
|
+
"package": "@nifrajs/webmcp",
|
|
820
|
+
"signature": "export type AgentSurfaceReconciler<Input, Output, State> = (context: AgentSurfaceReconcileContext<Input, Output, State>) => AgentSurfaceAuthoritativeState<State> | PromiseLike<AgentSurfaceAuthoritativeState<State>>;"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
"name": "AgentSurfaceScope",
|
|
824
|
+
"kind": "type",
|
|
825
|
+
"package": "@nifrajs/webmcp",
|
|
826
|
+
"signature": "export type AgentSurfaceScope = \"page\" | \"session\" | \"server\";"
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
"name": "AgentSurfaceSnapshot",
|
|
830
|
+
"kind": "interface",
|
|
831
|
+
"package": "@nifrajs/webmcp",
|
|
832
|
+
"signature": "export interface AgentSurfaceSnapshot<State> {\n readonly state: State;\n readonly version: string;\n}"
|
|
833
|
+
},
|
|
749
834
|
{
|
|
750
835
|
"name": "agentTelemetry",
|
|
751
836
|
"kind": "function",
|
|
@@ -1145,6 +1230,13 @@
|
|
|
1145
1230
|
"package": "@nifrajs/core",
|
|
1146
1231
|
"signature": "export declare class ApprovalTokenReplayError extends Error {\n constructor();\n}"
|
|
1147
1232
|
},
|
|
1233
|
+
{
|
|
1234
|
+
"name": "approximateContextTokens",
|
|
1235
|
+
"kind": "function",
|
|
1236
|
+
"package": "@nifrajs/agent",
|
|
1237
|
+
"signature": "export declare function approximateContextTokens(text: string): number;",
|
|
1238
|
+
"doc": "/** A deterministic, provider-free token estimate suitable for local reference behavior. */"
|
|
1239
|
+
},
|
|
1148
1240
|
{
|
|
1149
1241
|
"name": "AroundCapabilityOptions",
|
|
1150
1242
|
"kind": "interface",
|
|
@@ -1193,6 +1285,13 @@
|
|
|
1193
1285
|
"signature": "export interface ArtifactRef {\n /** Caller-namespaced id. Opaque to nifra. */\n readonly id: string;\n /** SHA-256 hex of the payload, for integrity and correlation. Content-free. */\n readonly digest: string;\n readonly bytes: number;\n readonly mediaType: string;\n /** Optional caller-opaque locator (e.g. a private URI). nifra never dereferences it. */\n readonly locator?: string;\n}",
|
|
1194
1286
|
"doc": "/** A content-free pointer to a payload the caller chose to retain out of band. */"
|
|
1195
1287
|
},
|
|
1288
|
+
{
|
|
1289
|
+
"name": "assembleContext",
|
|
1290
|
+
"kind": "function",
|
|
1291
|
+
"package": "@nifrajs/agent",
|
|
1292
|
+
"signature": "export declare function assembleContext(items: readonly ContextItem[], options: ContextAssemblyOptions): ContextAssembly;",
|
|
1293
|
+
"doc": "/** Assemble already-collected items under a hard budget without mutating caller data. */"
|
|
1294
|
+
},
|
|
1196
1295
|
{
|
|
1197
1296
|
"name": "assertAdapterCertification",
|
|
1198
1297
|
"kind": "function",
|
|
@@ -1239,6 +1338,13 @@
|
|
|
1239
1338
|
"signature": "export declare function assertBudgetRemaining(budget: RequestBudget, requiredMs?: number): void;",
|
|
1240
1339
|
"doc": "/** Fail before starting work that cannot fit inside the remaining time. */"
|
|
1241
1340
|
},
|
|
1341
|
+
{
|
|
1342
|
+
"name": "assertCssLoadingCompatible",
|
|
1343
|
+
"kind": "function",
|
|
1344
|
+
"package": "@nifrajs/web",
|
|
1345
|
+
"signature": "export declare function assertCssLoadingCompatible(cssCodeSplit: boolean, cssLoading: CssLoadingMode): void;",
|
|
1346
|
+
"doc": "/**\n * Guard the only Vite combination that would claim to solve the stylesheet-insertion regression while\n * leaving the cause in place. A deferred split build can still attach CSS when a prefetched lazy chunk\n * evaluates, so it must fail closed instead of producing a misleadingly healthy deployment.\n */"
|
|
1347
|
+
},
|
|
1242
1348
|
{
|
|
1243
1349
|
"name": "assertDeploymentAuthorityMonotonic",
|
|
1244
1350
|
"kind": "function",
|
|
@@ -1267,6 +1373,13 @@
|
|
|
1267
1373
|
"signature": "export declare function assertIncidentReplays(app: AppLike, capsule: IncidentCapsule, options?: ReplayIncidentOptions): Promise<void>;",
|
|
1268
1374
|
"doc": "/** Assert a captured incident still reproduces against the current app. Throws {@link IncidentReplayError}. */"
|
|
1269
1375
|
},
|
|
1376
|
+
{
|
|
1377
|
+
"name": "assertPredictionLab",
|
|
1378
|
+
"kind": "function",
|
|
1379
|
+
"package": "@nifrajs/testing",
|
|
1380
|
+
"signature": "export declare function assertPredictionLab(options?: PredictionLabOptions): Promise<PredictionLabReport>;",
|
|
1381
|
+
"doc": "/** Run the lab and throw a joined error on failure - the `assertAdversarialContract` shape. */"
|
|
1382
|
+
},
|
|
1270
1383
|
{
|
|
1271
1384
|
"name": "assertRenderAdapterConformance",
|
|
1272
1385
|
"kind": "function",
|
|
@@ -1301,6 +1414,12 @@
|
|
|
1301
1414
|
"package": "@nifrajs/testing",
|
|
1302
1415
|
"signature": "export declare function assertTrajectoryInvariants(result: AgentRunResult<unknown>, options?: TrajectoryInvariantOptions): void;"
|
|
1303
1416
|
},
|
|
1417
|
+
{
|
|
1418
|
+
"name": "assertTransportByteLimit",
|
|
1419
|
+
"kind": "function",
|
|
1420
|
+
"package": "@nifrajs/agent-protocol",
|
|
1421
|
+
"signature": "export declare function assertTransportByteLimit(value: number, options?: TransportByteLimitOptions): void;"
|
|
1422
|
+
},
|
|
1304
1423
|
{
|
|
1305
1424
|
"name": "assertTransportTextBounded",
|
|
1306
1425
|
"kind": "function",
|
|
@@ -2099,6 +2218,12 @@
|
|
|
2099
2218
|
"package": "@nifrajs/coding-agent",
|
|
2100
2219
|
"signature": "export interface BoundedText {\n readonly text: string;\n readonly truncated: boolean;\n}"
|
|
2101
2220
|
},
|
|
2221
|
+
{
|
|
2222
|
+
"name": "BoundedTransportRead",
|
|
2223
|
+
"kind": "type",
|
|
2224
|
+
"package": "@nifrajs/agent-protocol",
|
|
2225
|
+
"signature": "export type BoundedTransportRead = {\n readonly ok: true;\n readonly bytes: Uint8Array;\n} | {\n readonly ok: false;\n readonly reason: \"too-large\" | \"read-error\";\n readonly error?: unknown;\n};"
|
|
2226
|
+
},
|
|
2102
2227
|
{
|
|
2103
2228
|
"name": "bridgeScript",
|
|
2104
2229
|
"kind": "function",
|
|
@@ -2151,7 +2276,7 @@
|
|
|
2151
2276
|
"name": "BuildClientViteOptions",
|
|
2152
2277
|
"kind": "interface",
|
|
2153
2278
|
"package": "@nifrajs/web",
|
|
2154
|
-
"signature": "export interface BuildClientViteOptions extends Omit<BuildClientOptions, \"plugins\"> {\n /** Vite plugins for the app's client transforms (e.g. `react()`, `vue()`). */\n readonly vitePlugins?: readonly unknown[];\n /** Vite project root (default: the parent of `routesDir`). Manifest keys are relative to it. */\n readonly root?: string;\n}",
|
|
2279
|
+
"signature": "export interface BuildClientViteOptions extends Omit<BuildClientOptions, \"plugins\"> {\n /** Vite plugins for the app's client transforms (e.g. `react()`, `vue()`). */\n readonly vitePlugins?: readonly unknown[];\n /** Vite project root (default: the parent of `routesDir`). Manifest keys are relative to it. */\n readonly root?: string;\n /**\n * Vite's CSS output strategy (default `true`). Set to `false` to emit one aggregate stylesheet for\n * the whole client, preventing lazy-route prefetch from attaching additional stylesheets.\n */\n readonly cssCodeSplit?: boolean;\n /**\n * Activation policy for framework-owned SSR stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * fetches with `media=\"print\"` and the generated client promotes the links before mounting. It must\n * be paired with `cssCodeSplit: false`; split lazy chunks can otherwise attach CSS during prefetch.\n */\n readonly cssLoading?: CssLoadingMode;\n}",
|
|
2155
2280
|
"doc": "/** Options for {@link buildClientVite} - the Bun {@link BuildClientOptions} minus Bun-plugin specifics,\n * plus the Vite plugin list the app injects for its transforms. */"
|
|
2156
2281
|
},
|
|
2157
2282
|
{
|
|
@@ -2205,7 +2330,7 @@
|
|
|
2205
2330
|
"name": "BuildManifest",
|
|
2206
2331
|
"kind": "interface",
|
|
2207
2332
|
"package": "@nifrajs/web",
|
|
2208
|
-
"signature": "export interface BuildManifest {\n /** URL of the client entry module (content-hashed). */\n readonly entry: string;\n /** URLs of every emitted asset (entry + chunks) - for serving + preloading. */\n readonly assets: readonly string[];\n /** `routeId → [layout chunk URLs…, own chunk URL]` - the chunks a route needs, for `createWebApp`'s\n * `routePreload` (`<link rel=\"modulepreload\">` the matched route alongside the entry). Each route +\n * layout is also a build entrypoint, so it gets a named chunk the bootstrap's lazy import dedupes to. */\n readonly routes: Readonly<Record<string, readonly string[]>>;\n /** URL paths copied from `publicDir`, sorted. Lets the server entry serve them without scanning a\n * directory per request, and lets an adapter that needs a file list (CDN upload, platform static\n * assets) consume one. Omitted when there is no `public/`. */\n readonly publicFiles?: readonly string[];\n /** The app's bundled, content-hashed stylesheet(s) - the bootstrap's **aggregate** CSS (every\n * `import './x.css'` reachable from the app). The complete stylesheet regardless of which file\n * imported the CSS; the always-safe fallback `createWebApp` links when a route has no per-route entry\n * in {@link routeStyles}. Omitted when the app imports no CSS. */\n readonly css?: readonly string[];\n /** `routeId → [chain CSS URLs]` - only the stylesheets the matched route's layout chain + own file\n * actually use (Bun emits a per-entrypoint CSS bundle per route/layout, with shared-component CSS\n * inlined into each consumer). `createWebApp` links these instead of the aggregate, so a page ships\n * only its own CSS. A route is omitted (→ aggregate fallback) when its `[name]` collides with another\n * route's basename (ambiguous CSS↔route) or the build emitted orphan shared-chunk CSS - correctness\n * over minimality. Absent entirely when the app imports no CSS. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n}"
|
|
2333
|
+
"signature": "export interface BuildManifest {\n /** URL of the client entry module (content-hashed). */\n readonly entry: string;\n /** URLs of every emitted asset (entry + chunks) - for serving + preloading. */\n readonly assets: readonly string[];\n /** `routeId → [layout chunk URLs…, own chunk URL]` - the chunks a route needs, for `createWebApp`'s\n * `routePreload` (`<link rel=\"modulepreload\">` the matched route alongside the entry). Each route +\n * layout is also a build entrypoint, so it gets a named chunk the bootstrap's lazy import dedupes to. */\n readonly routes: Readonly<Record<string, readonly string[]>>;\n /** URL paths copied from `publicDir`, sorted. Lets the server entry serve them without scanning a\n * directory per request, and lets an adapter that needs a file list (CDN upload, platform static\n * assets) consume one. Omitted when there is no `public/`. */\n readonly publicFiles?: readonly string[];\n /** The app's bundled, content-hashed stylesheet(s) - the bootstrap's **aggregate** CSS (every\n * `import './x.css'` reachable from the app). The complete stylesheet regardless of which file\n * imported the CSS; the always-safe fallback `createWebApp` links when a route has no per-route entry\n * in {@link routeStyles}. Omitted when the app imports no CSS. */\n readonly css?: readonly string[];\n /** Whether the Vite client build kept CSS split by entry/chunk. Absent for the native Bun build. */\n readonly cssCodeSplit?: boolean;\n /** How framework-owned SSR stylesheet links should become active. Defaults to `blocking`. */\n readonly cssLoading?: CssLoadingMode;\n /** `routeId → [chain CSS URLs]` - only the stylesheets the matched route's layout chain + own file\n * actually use (Bun emits a per-entrypoint CSS bundle per route/layout, with shared-component CSS\n * inlined into each consumer). `createWebApp` links these instead of the aggregate, so a page ships\n * only its own CSS. A route is omitted (→ aggregate fallback) when its `[name]` collides with another\n * route's basename (ambiguous CSS↔route) or the build emitted orphan shared-chunk CSS - correctness\n * over minimality. Absent entirely when the app imports no CSS. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n}"
|
|
2209
2334
|
},
|
|
2210
2335
|
{
|
|
2211
2336
|
"name": "buildNifraManifest",
|
|
@@ -2251,7 +2376,7 @@
|
|
|
2251
2376
|
"name": "BuildServerOptions",
|
|
2252
2377
|
"kind": "interface",
|
|
2253
2378
|
"package": "@nifrajs/web",
|
|
2254
|
-
"signature": "export interface BuildServerOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** The worker entry module (absolute path) - your `worker.ts`. It imports `{ manifest, clientEntry }`\n * from the generated `./server-manifest`, builds `createWebApp`, and `export default toFetchHandler(app)`. */\n readonly serverEntry: string;\n /** Output directory for the bundled worker (absolute path). */\n readonly outDir: string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest) - **baked** into the generated\n * server manifest, since a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked into the generated\n * manifest so the server entry hands them to `createWebApp` (→ `<link rel=\"stylesheet\">`). Omit ⇒ no CSS\n * link (the built SSR page would otherwise render unstyled). */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked alongside `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** Route/layout file → import specifier in the generated manifest (default: a relative path from the\n * manifest's location - written next to `serverEntry` - to `routesDir`). */\n readonly resolve?: (file: string) => string;\n /** Filename for the generated server-manifest module, written next to `serverEntry` (default\n * `\"server-manifest.ts\"`); your `serverEntry` imports it as `./server-manifest`. */\n readonly manifestFile?: string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"ssr\")` - Solid routes need their SSR transform at\n * build time; React's JSX is Bun-native and needs none). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` resolution conditions (default `[\"workerd\", \"edge-light\", \"browser\"]`) - selects each\n * dependency's edge build. */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (default `{ \"process.env.NODE_ENV\": '\"production\"' }` → production\n * React/Solid on the edge). Pass an explicit object to override (e.g. `{}` to opt out). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** `Bun.build` target (default `\"browser\"` - the right shape for edge runtimes: Cloudflare Workers,\n * Vercel Edge, Deno, Deno Deploy). Use `\"node\"` for a `@nifrajs/node` server (so `node:*` built-ins\n * stay external), or `\"bun\"` for a Bun server. The default `conditions` + the edge resolve shims\n * only apply to the `\"browser\"` target; `\"node\"`/`\"bun\"` resolve their own renderer builds via the\n * matching condition. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** **Lazy/code-split routes** (default `false`): emit `() => import(route)` loaders + bundle with\n * `splitting`, so each route is its own chunk loaded on first request (smaller cold-start parse)\n * instead of all parsed at boot. The output becomes the worker entry **+ chunk files** in `outDir`\n * - on Cloudflare, ship them with wrangler's `no_bundle` + `find_additional_modules` + an ESModule\n * `rule` (Node/Deno import the chunks natively). Eager (one self-contained file) stays the default. */\n readonly lazy?: boolean;\n}"
|
|
2379
|
+
"signature": "export interface BuildServerOptions {\n /** The `routes/` directory to discover (absolute path). */\n readonly routesDir: string;\n /** The worker entry module (absolute path) - your `worker.ts`. It imports `{ manifest, clientEntry }`\n * from the generated `./server-manifest`, builds `createWebApp`, and `export default toFetchHandler(app)`. */\n readonly serverEntry: string;\n /** Output directory for the bundled worker (absolute path). */\n readonly outDir: string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest) - **baked** into the generated\n * server manifest, since a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked into the generated\n * manifest so the server entry hands them to `createWebApp` (→ `<link rel=\"stylesheet\">`). Omit ⇒ no CSS\n * link (the built SSR page would otherwise render unstyled). */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked alongside `styles`. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n /** Route/layout file → import specifier in the generated manifest (default: a relative path from the\n * manifest's location - written next to `serverEntry` - to `routesDir`). */\n readonly resolve?: (file: string) => string;\n /** Filename for the generated server-manifest module, written next to `serverEntry` (default\n * `\"server-manifest.ts\"`); your `serverEntry` imports it as `./server-manifest`. */\n readonly manifestFile?: string;\n /** Adapter build plugins (e.g. `solidBunPlugin(\"ssr\")` - Solid routes need their SSR transform at\n * build time; React's JSX is Bun-native and needs none). */\n readonly plugins?: readonly BunPlugin[];\n /** `Bun.build` resolution conditions (default `[\"workerd\", \"edge-light\", \"browser\"]`) - selects each\n * dependency's edge build. */\n readonly conditions?: readonly string[];\n /** Compile-time replacements (default `{ \"process.env.NODE_ENV\": '\"production\"' }` → production\n * React/Solid on the edge). Pass an explicit object to override (e.g. `{}` to opt out). */\n readonly define?: Readonly<Record<string, string>>;\n /** Minify the output (default `true`). */\n readonly minify?: boolean;\n /** `Bun.build` target (default `\"browser\"` - the right shape for edge runtimes: Cloudflare Workers,\n * Vercel Edge, Deno, Deno Deploy). Use `\"node\"` for a `@nifrajs/node` server (so `node:*` built-ins\n * stay external), or `\"bun\"` for a Bun server. The default `conditions` + the edge resolve shims\n * only apply to the `\"browser\"` target; `\"node\"`/`\"bun\"` resolve their own renderer builds via the\n * matching condition. */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** **Lazy/code-split routes** (default `false`): emit `() => import(route)` loaders + bundle with\n * `splitting`, so each route is its own chunk loaded on first request (smaller cold-start parse)\n * instead of all parsed at boot. The output becomes the worker entry **+ chunk files** in `outDir`\n * - on Cloudflare, ship them with wrangler's `no_bundle` + `find_additional_modules` + an ESModule\n * `rule` (Node/Deno import the chunks natively). Eager (one self-contained file) stays the default. */\n readonly lazy?: boolean;\n}"
|
|
2255
2380
|
},
|
|
2256
2381
|
{
|
|
2257
2382
|
"name": "buildServerVite",
|
|
@@ -2264,7 +2389,7 @@
|
|
|
2264
2389
|
"name": "BuildServerViteOptions",
|
|
2265
2390
|
"kind": "interface",
|
|
2266
2391
|
"package": "@nifrajs/web",
|
|
2267
|
-
"signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n}",
|
|
2392
|
+
"signature": "export interface BuildServerViteOptions {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly styles?: readonly string[] | undefined;\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before hydration (default `\"blocking\"`). */\n readonly cssLoading?: CssLoadingMode;\n readonly resolve?: (file: string) => string;\n readonly manifestFile?: string;\n readonly vitePlugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly minify?: boolean;\n /** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */\n readonly target?: \"browser\" | \"node\" | \"bun\";\n /** Vite project root (default: the parent of `routesDir`). */\n readonly root?: string;\n}",
|
|
2268
2393
|
"doc": "/** Options for {@link buildServerVite} - the same surface as `buildServer` minus Bun-plugin specifics. */"
|
|
2269
2394
|
},
|
|
2270
2395
|
{
|
|
@@ -2284,7 +2409,7 @@
|
|
|
2284
2409
|
"name": "BuildTargetOptions",
|
|
2285
2410
|
"kind": "interface",
|
|
2286
2411
|
"package": "@nifrajs/web",
|
|
2287
|
-
"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}"
|
|
2412
|
+
"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 /**\n * Vite-only CSS output policy. `false` emits one aggregate stylesheet. The native Bun build does not\n * support this switch and fails closed if it is supplied instead of silently ignoring it.\n */\n readonly cssCodeSplit?: boolean;\n /**\n * Activation policy for framework-owned SSR stylesheet links. Defaults to `\"blocking\"`; `\"deferred\"`\n * fetches with `media=\"print\"` and promotes before hydration. With Vite, pair it with\n * `cssCodeSplit: false`; the native Bun build supports the activation policy but keeps its existing\n * CSS output strategy.\n */\n readonly cssLoading?: CssLoadingMode;\n /** Document `<title>` for the generated server entry. */\n readonly title?: string;\n}"
|
|
2288
2413
|
},
|
|
2289
2414
|
{
|
|
2290
2415
|
"name": "BuildTargetPlan",
|
|
@@ -2330,7 +2455,7 @@
|
|
|
2330
2455
|
"name": "Bundler",
|
|
2331
2456
|
"kind": "interface",
|
|
2332
2457
|
"package": "@nifrajs/web",
|
|
2333
|
-
"signature": "export interface Bundler {\n /** Build the client bundle → the shared {@link BuildManifest}. */\n buildClient(input: {\n readonly routesDir: string;\n readonly outDir: string;\n readonly clientModule: string;\n readonly plugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly publicDir?: string | false;\n readonly publicEnvPrefix?: string;\n /** Project root (Vite needs it; the Bun strategy ignores it). */\n readonly root?: string;\n }): Promise<BuildManifest>;\n /** Build the server worker → the shared {@link ServerBuild}. */\n buildServer(input: {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly target: \"browser\" | \"node\" | \"bun\";\n readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n readonly root?: string;\n }): Promise<ServerBuild>;\n}",
|
|
2458
|
+
"signature": "export interface Bundler {\n /** Build the client bundle → the shared {@link BuildManifest}. */\n buildClient(input: {\n readonly routesDir: string;\n readonly outDir: string;\n readonly clientModule: string;\n readonly plugins?: readonly unknown[];\n readonly conditions?: readonly string[];\n readonly define?: Readonly<Record<string, string>>;\n readonly publicDir?: string | false;\n readonly publicEnvPrefix?: string;\n /** Vite CSS splitting policy; the Bun strategy rejects `false` and otherwise preserves its native behavior. */\n readonly cssCodeSplit?: boolean;\n /** Framework-owned stylesheet activation policy; supported by both server strategies. */\n readonly cssLoading?: CssLoadingMode;\n /** Project root (Vite needs it; the Bun strategy ignores it). */\n readonly root?: string;\n }): Promise<BuildManifest>;\n /** Build the server worker → the shared {@link ServerBuild}. */\n buildServer(input: {\n readonly routesDir: string;\n readonly serverEntry: string;\n readonly outDir: string;\n readonly clientEntry: string;\n readonly target: \"browser\" | \"node\" | \"bun\";\n /** The client build's aggregate stylesheet URLs to bake into the server manifest. */\n readonly styles?: readonly string[];\n /** The client build's per-route stylesheet map to bake into the server manifest. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>>;\n readonly plugins?: readonly unknown[];\n readonly define?: Readonly<Record<string, string>>;\n /** CSS activation policy to bake into the generated server manifest. */\n readonly cssLoading?: CssLoadingMode;\n readonly root?: string;\n }): Promise<ServerBuild>;\n}",
|
|
2334
2459
|
"doc": "/**\n * A build-tool STRATEGY for {@link buildTargetWith} - the two bundling steps, and nothing else. Everything\n * around them (server-entry codegen, deploy assembly, prerender, size report) is bundler-agnostic and\n * lives in `buildTargetWith`, so a second bundler (Vite) is this interface, not a second orchestrator.\n *\n * Plugin lists are `readonly unknown[]` because a Bun plugin and a Vite plugin are different types; each\n * strategy casts to its own. `buildTargetWith` only forwards them.\n */"
|
|
2335
2460
|
},
|
|
2336
2461
|
{
|
|
@@ -2477,6 +2602,13 @@
|
|
|
2477
2602
|
"signature": "export declare function canonicalizeIdempotencyBody(body: Uint8Array, contentType: string | null): Uint8Array;",
|
|
2478
2603
|
"doc": "/** Canonicalize JSON bodies so whitespace/property-order retries bind to the same semantic request. */"
|
|
2479
2604
|
},
|
|
2605
|
+
{
|
|
2606
|
+
"name": "canonicalizeReviewReport",
|
|
2607
|
+
"kind": "function",
|
|
2608
|
+
"package": "@nifrajs/agent-review",
|
|
2609
|
+
"signature": "export declare function canonicalizeReviewReport(report: ReviewReport): string;",
|
|
2610
|
+
"doc": "/**\n * Return the stable UTF-8 text that identifies a review report's structural result.\n *\n * The report digest and check duration are omitted. Arrays are copied into their contract-defined\n * order, while object keys are sorted recursively. No caller-owned object is mutated.\n */"
|
|
2611
|
+
},
|
|
2480
2612
|
{
|
|
2481
2613
|
"name": "canonicalJson",
|
|
2482
2614
|
"kind": "function",
|
|
@@ -3053,13 +3185,13 @@
|
|
|
3053
3185
|
"name": "CertificationCheck",
|
|
3054
3186
|
"kind": "interface",
|
|
3055
3187
|
"package": "@nifrajs/testing",
|
|
3056
|
-
"signature": "export interface CertificationCheck<Adapter> {\n readonly id: string;\n readonly capability: string;\n readonly run: (adapter: Adapter, context: CertificationContext) => void | Promise<void>;\n}"
|
|
3188
|
+
"signature": "export interface CertificationCheck<Adapter> {\n readonly id: string;\n readonly capability: string;\n readonly target?: CertificationTarget;\n readonly run: (adapter: Adapter, context: CertificationContext) => void | Promise<void>;\n}"
|
|
3057
3189
|
},
|
|
3058
3190
|
{
|
|
3059
3191
|
"name": "CertificationCheckEvidence",
|
|
3060
3192
|
"kind": "interface",
|
|
3061
3193
|
"package": "@nifrajs/testing",
|
|
3062
|
-
"signature": "export interface CertificationCheckEvidence {\n readonly id: string;\n readonly capability: string;\n readonly ok: boolean;\n /** Error class only. Messages may contain credentials/provider payloads and are never evidence. */\n readonly errorName?: string;\n}"
|
|
3194
|
+
"signature": "export interface CertificationCheckEvidence {\n readonly id: string;\n readonly capability: string;\n readonly ok: boolean;\n readonly target?: CertificationTarget;\n /** Error class only. Messages may contain credentials/provider payloads and are never evidence. */\n readonly errorName?: string;\n}"
|
|
3063
3195
|
},
|
|
3064
3196
|
{
|
|
3065
3197
|
"name": "CertificationContext",
|
|
@@ -3068,11 +3200,18 @@
|
|
|
3068
3200
|
"signature": "export interface CertificationContext {\n /** Deterministic per-check key safe for shared test backends and stable re-runs. */\n readonly key: (suffix: string) => string;\n}",
|
|
3069
3201
|
"doc": "/**\n * Profile-based adapter certification. Profiles are structural and dependency-free: an adapter package\n * uses this only in its test/CI surface, while the resulting capability matrix is portable JSON evidence.\n */"
|
|
3070
3202
|
},
|
|
3203
|
+
{
|
|
3204
|
+
"name": "CertificationTarget",
|
|
3205
|
+
"kind": "interface",
|
|
3206
|
+
"package": "@nifrajs/testing",
|
|
3207
|
+
"signature": "export interface CertificationTarget {\n /** Published adapter/package name, for example `@nifrajs/node`. */\n readonly adapter?: string;\n /** Runtime that executed the witness, for example `node`, `deno`, or `workerd`. */\n readonly runtime?: string;\n /** Checked-in or built artifact path, when the witness exercises one. */\n readonly artifact?: string;\n /** Source path that owns the behavior, when it differs from the artifact. */\n readonly source?: string;\n /** Stable category of witness, useful when one report mixes several targets. */\n readonly witnessKind?: string;\n}",
|
|
3208
|
+
"doc": "/** Portable identity for the artifact, runtime, and witness that produced one check result. */"
|
|
3209
|
+
},
|
|
3071
3210
|
{
|
|
3072
3211
|
"name": "certifyAdapter",
|
|
3073
3212
|
"kind": "function",
|
|
3074
3213
|
"package": "@nifrajs/testing",
|
|
3075
|
-
"signature": "export declare function certifyAdapter<Adapter>(options: {\n readonly profile: AdapterCertificationProfile<Adapter>;\n readonly adapterId: string;\n /** A fresh adapter per check prevents one failed check from contaminating the next. */\n readonly createAdapter: () => Adapter | Promise<Adapter>;\n readonly cleanup?: (adapter: Adapter) => void | Promise<void>;\n}): Promise<AdapterCertificationReport>;"
|
|
3214
|
+
"signature": "export declare function certifyAdapter<Adapter>(options: {\n readonly profile: AdapterCertificationProfile<Adapter>;\n readonly adapterId: string;\n /** Optional identity shared by all checks; a check target can add or override its fields. */\n readonly target?: CertificationTarget;\n /** A fresh adapter per check prevents one failed check from contaminating the next. */\n readonly createAdapter: () => Adapter | Promise<Adapter>;\n readonly cleanup?: (adapter: Adapter) => void | Promise<void>;\n}): Promise<AdapterCertificationReport>;"
|
|
3076
3215
|
},
|
|
3077
3216
|
{
|
|
3078
3217
|
"name": "ChannelCloseReason",
|
|
@@ -3221,7 +3360,7 @@
|
|
|
3221
3360
|
"name": "ClientAction",
|
|
3222
3361
|
"kind": "type",
|
|
3223
3362
|
"package": "@nifrajs/web",
|
|
3224
|
-
"signature": "export type ClientAction = (args: ClientActionArgs) => ClientActionResult |
|
|
3363
|
+
"signature": "export type ClientAction = (args: ClientActionArgs) => ClientActionResult | undefined | Promise<ClientActionResult | undefined>;",
|
|
3225
3364
|
"doc": "/** A client-only action wrapper; it never replaces the server action. */"
|
|
3226
3365
|
},
|
|
3227
3366
|
{
|
|
@@ -3375,7 +3514,7 @@
|
|
|
3375
3514
|
"name": "CodingAgentRpcServer",
|
|
3376
3515
|
"kind": "class",
|
|
3377
3516
|
"package": "@nifrajs/coding-agent",
|
|
3378
|
-
"signature": "export declare class CodingAgentRpcServer {\n readonly host: CodingAgentHost;\n private readonly options;\n private readonly token;\n private readonly maxBodyBytes;\n private listener;\n constructor(options: CodingAgentRpcServerOptions);\n start(): Promise<CodingAgentRpcServerHandle>;\n stop(): Promise<void>;\n private fetch;\n private dispatch;\n private requireSnapshot;\n private protocolError;\n private readRequest;\n}",
|
|
3517
|
+
"signature": "export declare class CodingAgentRpcServer {\n readonly host: CodingAgentHost;\n private readonly options;\n private readonly token;\n private readonly maxBodyBytes;\n private readonly maxResponseBytes;\n private listener;\n private authFailures;\n private authLastFailureAt;\n private authBackoffUntil;\n constructor(options: CodingAgentRpcServerOptions);\n start(): Promise<CodingAgentRpcServerHandle>;\n stop(): Promise<void>;\n private fetch;\n private dispatch;\n private requireSnapshot;\n private authBackoffMs;\n private noteAuthFailure;\n private noteAuthSuccess;\n private response;\n private protocolError;\n private readRequest;\n}",
|
|
3379
3518
|
"doc": "/**\n * Minimal loopback RPC surface for the CLI, Workbench, CI clients, and a future mobile companion.\n * Turn output is SSE so clients do not need a WebSocket dependency; every event is still a versioned\n * protocol event from the backend.\n */"
|
|
3380
3519
|
},
|
|
3381
3520
|
{
|
|
@@ -3388,7 +3527,7 @@
|
|
|
3388
3527
|
"name": "CodingAgentRpcServerOptions",
|
|
3389
3528
|
"kind": "interface",
|
|
3390
3529
|
"package": "@nifrajs/coding-agent",
|
|
3391
|
-
"signature": "export interface CodingAgentRpcServerOptions {\n readonly backend: AgentBackend;\n readonly cwd: string;\n readonly hostname?: string;\n /** Remote binding is opt-in; the default only permits loopback hosts. */\n readonly allowRemote?: boolean;\n readonly port?: number;\n /** A random token is generated when omitted. Use an explicit token only for managed local launchers. */\n readonly authToken?: string;\n /** Include bounded exception stacks in RPC failures only for trusted loopback debugging. */\n readonly exposeErrorStacks?: boolean;\n readonly maxBodyBytes?: number;\n readonly sessionStore?: SessionStore;\n readonly contextWindow?: ContextWindowOptions;\n readonly extensions?: ExtensionHost;\n readonly ui?: UiExtensionHost;\n readonly verifyAfterTurn?: readonly (\"check\" | \"assure\" | \"test\")[];\n readonly maxRepairAttempts?: number;\n readonly verification?: CodingAgentHostOptions[\"verification\"];\n}"
|
|
3530
|
+
"signature": "export interface CodingAgentRpcServerOptions {\n readonly backend: AgentBackend;\n readonly cwd: string;\n readonly hostname?: string;\n /** Remote binding is opt-in; the default only permits loopback hosts. */\n readonly allowRemote?: boolean;\n readonly port?: number;\n /** A random token is generated when omitted. Use an explicit token only for managed local launchers. */\n readonly authToken?: string;\n /** Include bounded exception stacks in RPC failures only for trusted loopback debugging. */\n readonly exposeErrorStacks?: boolean;\n readonly maxBodyBytes?: number;\n /** Maximum UTF-8 bytes in one non-streaming JSON response. Defaults to 4 MiB. */\n readonly maxResponseBytes?: number;\n readonly sessionStore?: SessionStore;\n readonly contextWindow?: ContextWindowOptions;\n readonly extensions?: ExtensionHost;\n readonly ui?: UiExtensionHost;\n readonly verifyAfterTurn?: readonly (\"check\" | \"assure\" | \"test\")[];\n readonly maxRepairAttempts?: number;\n readonly verification?: CodingAgentHostOptions[\"verification\"];\n}"
|
|
3392
3531
|
},
|
|
3393
3532
|
{
|
|
3394
3533
|
"name": "collectAssuranceReport",
|
|
@@ -3402,6 +3541,13 @@
|
|
|
3402
3541
|
"package": "@nifrajs/cli",
|
|
3403
3542
|
"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>;"
|
|
3404
3543
|
},
|
|
3544
|
+
{
|
|
3545
|
+
"name": "collectContext",
|
|
3546
|
+
"kind": "function",
|
|
3547
|
+
"package": "@nifrajs/agent",
|
|
3548
|
+
"signature": "export declare function collectContext<Input>(input: Input, sources: readonly ContextSource<Input>[], options: ContextAssemblyOptions): Promise<ContextAssembly>;",
|
|
3549
|
+
"doc": "/** Collect source-owned items in source order, then apply the same deterministic assembly rules. */"
|
|
3550
|
+
},
|
|
3405
3551
|
{
|
|
3406
3552
|
"name": "Collection",
|
|
3407
3553
|
"kind": "interface",
|
|
@@ -3599,6 +3745,13 @@
|
|
|
3599
3745
|
"signature": "export declare function composeRegistrySnapshot(descriptors: readonly CapabilityDescriptor[]): Promise<RegistrySnapshot>;",
|
|
3600
3746
|
"doc": "/**\n * Compose a deterministic registry snapshot. Descriptors are validated, checked for identity\n * collisions, canonically ordered, and digested. Two descriptors that share a (kind, name) identity\n * fail `descriptor_collision` when their schema digests agree and `schema_drift` when they differ -\n * a drifted schema is a distinct, addressable failure from a duplicate registration. Because the set\n * is sorted before it is digested, the snapshot digest is independent of the input order.\n */"
|
|
3601
3747
|
},
|
|
3748
|
+
{
|
|
3749
|
+
"name": "composeReviewReport",
|
|
3750
|
+
"kind": "function",
|
|
3751
|
+
"package": "@nifrajs/agent-review",
|
|
3752
|
+
"signature": "export declare function composeReviewReport(input: ReviewReportDraft): Promise<ReviewReport>;",
|
|
3753
|
+
"doc": "/**\n * Compose a report from already-sanitized structural values. This function has no repository,\n * collector, CLI, filesystem, provider, or persistence access. The parser is run once more over\n * the assembled value so the returned report has the same boundary guarantees as external input.\n */"
|
|
3754
|
+
},
|
|
3602
3755
|
{
|
|
3603
3756
|
"name": "compression",
|
|
3604
3757
|
"kind": "function",
|
|
@@ -3692,7 +3845,7 @@
|
|
|
3692
3845
|
"name": "Content",
|
|
3693
3846
|
"kind": "const",
|
|
3694
3847
|
"package": "@nifrajs/web-vue",
|
|
3695
|
-
"signature": "export declare const Content: import(\"vue\").DefineComponent<import(\"vue\").ExtractPropTypes<{\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n html: {\n type:
|
|
3848
|
+
"signature": "export declare const Content: import(\"vue\").DefineComponent<import(\"vue\").ExtractPropTypes<{\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n html: {\n type: () => TrustedHtml;\n required: true;\n };\n /** Wrapper element (default `\"div\"`). */\n as: {\n type: StringConstructor;\n default: string;\n };\n}>, () => import(\"vue\").VNode<import(\"vue\").RendererNode, import(\"vue\").RendererElement, {\n [key: string]: any;\n}>, {}, {}, {}, import(\"vue\").ComponentOptionsMixin, import(\"vue\").ComponentOptionsMixin, {}, string, import(\"vue\").PublicProps, Readonly<import(\"vue\").ExtractPropTypes<{\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n html: {\n type: () => TrustedHtml;\n required: true;\n };\n /** Wrapper element (default `\"div\"`). */\n as: {\n type: StringConstructor;\n default: string;\n };\n}>> & Readonly<{}>, {\n as: string;\n}, {}, {}, {}, string, import(\"vue\").ComponentProvideOptions, true, {}, any>;",
|
|
3696
3849
|
"doc": "/** Render trusted HTML into a wrapper element. `inheritAttrs: false` + manual attr spread so passthrough\n * (`class`, `id`, `style`, …) lands on the wrapper exactly once. */"
|
|
3697
3850
|
},
|
|
3698
3851
|
{
|
|
@@ -3718,25 +3871,25 @@
|
|
|
3718
3871
|
"name": "ContentProps",
|
|
3719
3872
|
"kind": "interface",
|
|
3720
3873
|
"package": "@nifrajs/web-preact",
|
|
3721
|
-
"signature": "export interface ContentProps extends Omit<JSX.HTMLAttributes<HTMLElement>, \"dangerouslySetInnerHTML\"> {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n readonly html:
|
|
3874
|
+
"signature": "export interface ContentProps extends Omit<JSX.HTMLAttributes<HTMLElement>, \"dangerouslySetInnerHTML\"> {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n readonly html: TrustedHtml;\n /** Wrapper element (default `\"div\"`). */\n readonly as?: string;\n}"
|
|
3722
3875
|
},
|
|
3723
3876
|
{
|
|
3724
3877
|
"name": "ContentProps",
|
|
3725
3878
|
"kind": "interface",
|
|
3726
3879
|
"package": "@nifrajs/web-react",
|
|
3727
|
-
"signature": "export interface ContentProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"dangerouslySetInnerHTML\" | \"children\"> {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n readonly html:
|
|
3880
|
+
"signature": "export interface ContentProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"dangerouslySetInnerHTML\" | \"children\"> {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n readonly html: TrustedHtml;\n /** Wrapper element (default `\"div\"`). */\n readonly as?: ElementType;\n}"
|
|
3728
3881
|
},
|
|
3729
3882
|
{
|
|
3730
3883
|
"name": "ContentProps",
|
|
3731
3884
|
"kind": "interface",
|
|
3732
3885
|
"package": "@nifrajs/web-solid",
|
|
3733
|
-
"signature": "export interface ContentProps {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n readonly html:
|
|
3886
|
+
"signature": "export interface ContentProps {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n readonly html: TrustedHtml;\n /** Wrapper element (default `\"div\"`). */\n readonly as?: string;\n /** DOM passthrough (`class`, `style`, `id`, `data-*`, handlers). */\n readonly [key: string]: unknown;\n}"
|
|
3734
3887
|
},
|
|
3735
3888
|
{
|
|
3736
3889
|
"name": "ContentProps",
|
|
3737
3890
|
"kind": "interface",
|
|
3738
3891
|
"package": "@nifrajs/web-svelte",
|
|
3739
|
-
"signature": "export interface ContentProps {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n html:
|
|
3892
|
+
"signature": "export interface ContentProps {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n html: TrustedHtml\n /** Wrapper element (default `\"div\"`). */\n as?: string\n /** DOM passthrough (`class`, `style`, `id`, `data-*`, …). */\n [key: string]: unknown\n}",
|
|
3740
3893
|
"doc": "/**\n * Hand-written types for `Content.svelte` (svelte-package would generate this). Consumers resolve this\n * through the `./content` export's `types` condition.\n */"
|
|
3741
3894
|
},
|
|
3742
3895
|
{
|
|
@@ -3753,6 +3906,30 @@
|
|
|
3753
3906
|
"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}",
|
|
3754
3907
|
"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 */"
|
|
3755
3908
|
},
|
|
3909
|
+
{
|
|
3910
|
+
"name": "ContextAssembly",
|
|
3911
|
+
"kind": "interface",
|
|
3912
|
+
"package": "@nifrajs/agent",
|
|
3913
|
+
"signature": "export interface ContextAssembly {\n readonly version: 1;\n readonly text: string;\n readonly items: readonly ContextItem[];\n readonly includedIds: readonly string[];\n readonly omittedIds: readonly string[];\n readonly tokens: number;\n readonly budget: {\n readonly maxTokens: number;\n readonly reserveTokens: number;\n readonly availableTokens: number;\n };\n}"
|
|
3914
|
+
},
|
|
3915
|
+
{
|
|
3916
|
+
"name": "ContextAssemblyOptions",
|
|
3917
|
+
"kind": "interface",
|
|
3918
|
+
"package": "@nifrajs/agent",
|
|
3919
|
+
"signature": "export interface ContextAssemblyOptions {\n readonly budget: ContextBudget;\n /** Defaults to a bounded deterministic chars/4 estimate. */\n readonly tokenCounter?: ContextTokenCounter;\n /** Separator inserted between selected item contents. Defaults to two newlines. */\n readonly separator?: string;\n}"
|
|
3920
|
+
},
|
|
3921
|
+
{
|
|
3922
|
+
"name": "ContextBudget",
|
|
3923
|
+
"kind": "interface",
|
|
3924
|
+
"package": "@nifrajs/agent",
|
|
3925
|
+
"signature": "export interface ContextBudget {\n /** Absolute budget for the assembled context, including separators. */\n readonly maxTokens: number;\n /** Tokens reserved for caller-owned content outside this assembly. */\n readonly reserveTokens?: number;\n}"
|
|
3926
|
+
},
|
|
3927
|
+
{
|
|
3928
|
+
"name": "ContextBudgetError",
|
|
3929
|
+
"kind": "class",
|
|
3930
|
+
"package": "@nifrajs/agent",
|
|
3931
|
+
"signature": "export declare class ContextBudgetError extends Error {\n readonly requiredTokens: number;\n readonly availableTokens: number;\n readonly code: \"context_budget_exceeded\";\n constructor(requiredTokens: number, availableTokens: number);\n}"
|
|
3932
|
+
},
|
|
3756
3933
|
{
|
|
3757
3934
|
"name": "ContextForOp",
|
|
3758
3935
|
"kind": "type",
|
|
@@ -3760,6 +3937,13 @@
|
|
|
3760
3937
|
"signature": "export type ContextForOp<O extends OperationDef> = Context<O[\"path\"], SchemaForOp<O> & RouteSchema>;",
|
|
3761
3938
|
"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 */"
|
|
3762
3939
|
},
|
|
3940
|
+
{
|
|
3941
|
+
"name": "ContextItem",
|
|
3942
|
+
"kind": "interface",
|
|
3943
|
+
"package": "@nifrajs/agent",
|
|
3944
|
+
"signature": "export interface ContextItem {\n /** Stable caller-owned identity used in inclusion/omission reports. */\n readonly id: string;\n /** Caller-defined category such as `memory`, `retrieval`, `conversation`, or `tools`. */\n readonly kind: string;\n /** Transient text inserted into the assembled context. */\n readonly content: string;\n /** Required items are admitted before optional items and fail closed when they do not fit. */\n readonly required?: boolean;\n /** Higher-priority optional items are admitted first. */\n readonly priority?: number;\n /** Optional tie-breaker for recency-aware sources. */\n readonly recency?: number;\n /** Stable source label; it is metadata, not an authorization decision. */\n readonly source?: string;\n}",
|
|
3945
|
+
"doc": "/**\n * Provider-neutral context assembly.\n *\n * The assembler owns deterministic selection and token accounting only. Items are transient\n * caller data: this module does not persist, embed, redact, or log their contents. Durable memory,\n * retrieval indexes, and provider-specific tokenizers belong behind caller-owned adapters.\n */"
|
|
3946
|
+
},
|
|
3763
3947
|
{
|
|
3764
3948
|
"name": "ContextPlugin",
|
|
3765
3949
|
"kind": "type",
|
|
@@ -3780,6 +3964,12 @@
|
|
|
3780
3964
|
"package": "@nifrajs/coding-agent",
|
|
3781
3965
|
"signature": "export interface ContextRecord {\n readonly kind: string;\n readonly content: string;\n readonly pinned?: boolean;\n}"
|
|
3782
3966
|
},
|
|
3967
|
+
{
|
|
3968
|
+
"name": "ContextSource",
|
|
3969
|
+
"kind": "interface",
|
|
3970
|
+
"package": "@nifrajs/agent",
|
|
3971
|
+
"signature": "export interface ContextSource<Input = unknown> {\n /** Stable source identity used for diagnostics and default item attribution. */\n readonly id: string;\n load(input: Input): readonly ContextItem[] | PromiseLike<readonly ContextItem[]>;\n}"
|
|
3972
|
+
},
|
|
3783
3973
|
{
|
|
3784
3974
|
"name": "contextStorage",
|
|
3785
3975
|
"kind": "function",
|
|
@@ -3787,6 +3977,12 @@
|
|
|
3787
3977
|
"signature": "export declare function contextStorage(): Middleware;",
|
|
3788
3978
|
"doc": "/**\n * Store the current nifra `Context` in `AsyncLocalStorage` for helpers that run away from the handler\n * argument, e.g. repository/logger functions called deep in the stack.\n *\n * Import from `@nifrajs/middleware/context-storage` so ordinary `@nifrajs/middleware` imports stay\n * node-compat-free on edge runtimes. The runtime must support `node:async_hooks` AsyncLocalStorage.\n */"
|
|
3789
3979
|
},
|
|
3980
|
+
{
|
|
3981
|
+
"name": "ContextTokenCounter",
|
|
3982
|
+
"kind": "type",
|
|
3983
|
+
"package": "@nifrajs/agent",
|
|
3984
|
+
"signature": "export type ContextTokenCounter = (text: string) => number;"
|
|
3985
|
+
},
|
|
3790
3986
|
{
|
|
3791
3987
|
"name": "ContextWindow",
|
|
3792
3988
|
"kind": "class",
|
|
@@ -4220,7 +4416,7 @@
|
|
|
4220
4416
|
"name": "CreateMcpServerOptions",
|
|
4221
4417
|
"kind": "interface",
|
|
4222
4418
|
"package": "@nifrajs/mcp",
|
|
4223
|
-
"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.
|
|
4419
|
+
"signature": "export interface CreateMcpServerOptions {\n readonly name: string;\n readonly version: string;\n readonly tools?: readonly McpTool[];\n /** MCP Apps widgets - their resources are registered and the UI capability is advertised. */\n readonly widgets?: readonly McpWidget[];\n /** Extra (non-widget) resources to expose. */\n readonly resources?: readonly McpResource[];\n readonly prompts?: readonly McpPrompt[];\n /** GET health-page text. */\n readonly health?: string;\n /** Max JSON-RPC body size in bytes (default 1 MB). */\n readonly maxBodyBytes?: number;\n /** Max serialized JSON-RPC response or SSE frame size (default 1 MB). */\n readonly maxResponseBytes?: number;\n /** Natural-language guidance for LLMs, surfaced in the modern `server/discover` result (2026-07-28). */\n readonly instructions?: string;\n /** Explicitly allow browser clients from any origin. Omit for the secure same-origin default. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. Set it to permit exact cross-origin clients. */\n readonly allowedOrigins?: readonly string[];\n /** Shared state for one authenticated MCP session; prefer `resolveState` for multi-session hosts. */\n readonly state?: McpProtocolState;\n /** Resolve a session-scoped request registry after per-message authorization. */\n readonly resolveState?: McpHttpOptions[\"resolveState\"];\n /**\n * Per-message authorization, applied after the message parses and before any tool runs. Return\n * `false` to answer 403 with a JSON-RPC `unauthorized` error (`MCP_ERROR.UNAUTHORIZED`) and no result.\n *\n * This is the seam for \"this caller may list tools but may not call the write ones\" - the HTTP\n * layer above only sees one opaque POST, so a route guard cannot make that distinction.\n * `fetch(request, { authorizeMessage })` overrides it per request when the decision depends on\n * something the surrounding handler resolved (a session, a tenant).\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
|
|
4224
4420
|
},
|
|
4225
4421
|
{
|
|
4226
4422
|
"name": "createMemoryAgentEvidenceLog",
|
|
@@ -4312,6 +4508,13 @@
|
|
|
4312
4508
|
"signature": "export declare function createPngRasterizer(render: PngRenderer): OgImageRasterizer;",
|
|
4313
4509
|
"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 */"
|
|
4314
4510
|
},
|
|
4511
|
+
{
|
|
4512
|
+
"name": "createPredictionStore",
|
|
4513
|
+
"kind": "function",
|
|
4514
|
+
"package": "@nifrajs/webmcp",
|
|
4515
|
+
"signature": "export declare function createPredictionStore<State>(initial: AgentSurfaceAuthoritativeState<State>): PredictionStore<State>;",
|
|
4516
|
+
"doc": "/**\n * An atomic, defensive prediction store. Predictions are overlays over authoritative state; a server\n * commit replaces the base and remaining overlays are replayed or conflict-dropped.\n */"
|
|
4517
|
+
},
|
|
4315
4518
|
{
|
|
4316
4519
|
"name": "createPresetSpec",
|
|
4317
4520
|
"kind": "function",
|
|
@@ -4541,7 +4744,7 @@
|
|
|
4541
4744
|
"name": "CreateWebAppOptions",
|
|
4542
4745
|
"kind": "interface",
|
|
4543
4746
|
"package": "@nifrajs/web",
|
|
4544
|
-
"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 /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow - 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}"
|
|
4747
|
+
"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 * Resolve a fresh CSP nonce for each document request. The value is applied to every\n * framework-owned executable script; return `undefined` to keep the default nonce-free output.\n * Nonce-bearing documents are marked `private, no-store` so the request-specific value is not\n * replayed by browser, CDN, or ISR caches. The resolver does not declare a CSP header because the\n * policy's allowed sources are app-specific.\n */\n readonly nonce?: NonceResolver<Env>;\n /**\n * 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, platform?: Platform<Env>): 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 /**\n * Activation policy for framework-owned stylesheet links (default `\"blocking\"`). `\"deferred\"`\n * emits `media=\"print\"` links; the generated client waits for them and switches them to `all` before\n * mounting. Pair with an aggregate Vite stylesheet (`cssCodeSplit: false`) to prevent lazy-prefetch\n * CSS insertion. Non-hydrated pages always keep their stylesheet links blocking.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set (e.g. `enumerateStaticRoutes(routes).paths` or the build's\n * `prerendered.json`). 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 /** In-memory reference cache for explicitly `static` boundary values. It never persists payloads\n * across processes; operated/durable cache implementations stay outside the public framework. */\n readonly staticBoundaryCache?: import(\"../boundary.js\").StaticBoundaryCache;\n /** Observe every loader/action failure - for error-reporting plugins (Sentry-style). Called for\n * real throws (not control-flow `Response`s like `redirect`), **before** the nearest `_error`\n * boundary renders / a soft-nav 500 / a rethrow - 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}"
|
|
4545
4748
|
},
|
|
4546
4749
|
{
|
|
4547
4750
|
"name": "createWebSocketHub",
|
|
@@ -4596,6 +4799,13 @@
|
|
|
4596
4799
|
"package": "@nifrajs/middleware",
|
|
4597
4800
|
"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}"
|
|
4598
4801
|
},
|
|
4802
|
+
{
|
|
4803
|
+
"name": "CssLoadingMode",
|
|
4804
|
+
"kind": "type",
|
|
4805
|
+
"package": "@nifrajs/web",
|
|
4806
|
+
"signature": "export type CssLoadingMode = \"blocking\" | \"deferred\";",
|
|
4807
|
+
"doc": "/**\n * How framework-owned stylesheets are made active during the first document load.\n *\n * `blocking` is the backwards-compatible default. `deferred` is intended for an aggregate\n * stylesheet: the document fetches it with `media=\"print\"`, then the generated client promotes it\n * to `media=\"all\"` after the resource settles and before mounting the app.\n */"
|
|
4808
|
+
},
|
|
4599
4809
|
{
|
|
4600
4810
|
"name": "CssModuleResult",
|
|
4601
4811
|
"kind": "interface",
|
|
@@ -4799,6 +5009,20 @@
|
|
|
4799
5009
|
"signature": "export type DataScope = RlsScope;",
|
|
4800
5010
|
"doc": "/** Backward-compatible name for the request scope carried by every data operation. */"
|
|
4801
5011
|
},
|
|
5012
|
+
{
|
|
5013
|
+
"name": "DeadLetterRecord",
|
|
5014
|
+
"kind": "interface",
|
|
5015
|
+
"package": "@nifrajs/jobs",
|
|
5016
|
+
"signature": "export interface DeadLetterRecord {\n readonly id: string;\n readonly name: string;\n readonly error: string;\n}",
|
|
5017
|
+
"doc": "/** The store-side shape this projects. Structural so durable adapters need no jobs import. */"
|
|
5018
|
+
},
|
|
5019
|
+
{
|
|
5020
|
+
"name": "DeadLetterView",
|
|
5021
|
+
"kind": "interface",
|
|
5022
|
+
"package": "@nifrajs/jobs",
|
|
5023
|
+
"signature": "export interface DeadLetterView {\n readonly id: string;\n readonly name: string;\n /** FNV-1a 32-bit hex of the error text. This is grouping metadata, not a confidentiality boundary. */\n readonly errorFingerprint: string;\n}",
|
|
5024
|
+
"doc": "/** What leaves the server: identity plus a grouping key. Never the error text. */"
|
|
5025
|
+
},
|
|
4802
5026
|
{
|
|
4803
5027
|
"name": "DeadlineAdmission",
|
|
4804
5028
|
"kind": "type",
|
|
@@ -4897,6 +5121,13 @@
|
|
|
4897
5121
|
"package": "@nifrajs/cli",
|
|
4898
5122
|
"signature": "export declare const DEFAULT_ASSURANCE_CONFIG = \"nifra.assurance.ts\";"
|
|
4899
5123
|
},
|
|
5124
|
+
{
|
|
5125
|
+
"name": "DEFAULT_CSS_LOADING",
|
|
5126
|
+
"kind": "const",
|
|
5127
|
+
"package": "@nifrajs/web",
|
|
5128
|
+
"signature": "export declare const DEFAULT_CSS_LOADING: CssLoadingMode;",
|
|
5129
|
+
"doc": "/** The default remains the ordinary render-blocking stylesheet link. */"
|
|
5130
|
+
},
|
|
4900
5131
|
{
|
|
4901
5132
|
"name": "DEFAULT_DEV_PORT",
|
|
4902
5133
|
"kind": "const",
|
|
@@ -4958,6 +5189,19 @@
|
|
|
4958
5189
|
"signature": "export interface Deferred<T> {\n readonly __nifra_deferred: true;\n readonly id: number;\n readonly promise: Promise<T>;\n}",
|
|
4959
5190
|
"doc": "/**\n * A loader value marked to stream in after the shell. The component consumes it with the adapter's\n * `<Await resolve={...}>`; until the promise settles the shell shows the `<Suspense>` fallback.\n * `id` is assigned by the server at serialization time - the streamed resolve script keys off it.\n */"
|
|
4960
5191
|
},
|
|
5192
|
+
{
|
|
5193
|
+
"name": "defineAgentCapability",
|
|
5194
|
+
"kind": "function",
|
|
5195
|
+
"package": "@nifrajs/webmcp",
|
|
5196
|
+
"signature": "export declare function defineAgentCapability<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1, State = unknown>(options: DefineAgentCapabilityOptions<InputSchema, OutputSchema, State>): AgentCapability<InferOutput<InputSchema>, InferOutput<OutputSchema>, State>;",
|
|
5197
|
+
"doc": "/** Create a capability from the same core tool contract used by Nifra's other adapters. */"
|
|
5198
|
+
},
|
|
5199
|
+
{
|
|
5200
|
+
"name": "DefineAgentCapabilityOptions",
|
|
5201
|
+
"kind": "type",
|
|
5202
|
+
"package": "@nifrajs/webmcp",
|
|
5203
|
+
"signature": "export type DefineAgentCapabilityOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1, State> = ToolContractOptions<InferOutput<InputSchema>, InferOutput<OutputSchema>, InputSchema, OutputSchema> & {\n readonly scope?: AgentSurfaceScope;\n readonly reads?: readonly string[];\n readonly writes?: readonly string[];\n readonly reconciliation?: ReconciliationMode;\n readonly predict?: AgentSurfacePredictor<InferOutput<InputSchema>, State>;\n readonly reconcile?: AgentSurfaceReconciler<InferOutput<InputSchema>, InferOutput<OutputSchema>, State>;\n};"
|
|
5204
|
+
},
|
|
4961
5205
|
{
|
|
4962
5206
|
"name": "defineAgentEvalSuite",
|
|
4963
5207
|
"kind": "function",
|
|
@@ -5535,6 +5779,20 @@
|
|
|
5535
5779
|
"signature": "export declare const DIAGNOSTIC_CATALOG: readonly CatalogEntry[];",
|
|
5536
5780
|
"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 */"
|
|
5537
5781
|
},
|
|
5782
|
+
{
|
|
5783
|
+
"name": "DiagnosticCompatibility",
|
|
5784
|
+
"kind": "interface",
|
|
5785
|
+
"package": "@nifrajs/cli",
|
|
5786
|
+
"signature": "export interface DiagnosticCompatibility {\n /** The pre-registry rule name used by the human/legacy check result. */\n readonly rule: string;\n /** The old human-facing fix text, when the rule had one. */\n readonly fix?: string;\n /** A richer legacy suggestion (diff, command, or manual steps). */\n readonly suggestion?: DiagnosticSuggestion;\n /** The import path evidence used by the legacy server-only-import view. */\n readonly chain?: readonly string[];\n /** Preserve the old optional `CheckDiagnostic.code` field exactly where it existed. */\n readonly includeCode?: boolean;\n}",
|
|
5787
|
+
"doc": "/**\n * The richer compatibility view used by the original `nifra check` renderer. It is deliberately\n * kept out of the enumerable diagnostic shape: SARIF, MCP structured output, and JSON consumers get\n * the small stable diagnostic contract, while the legacy text view can still explain an exact edit.\n */"
|
|
5788
|
+
},
|
|
5789
|
+
{
|
|
5790
|
+
"name": "diagnosticCompatibilityOf",
|
|
5791
|
+
"kind": "function",
|
|
5792
|
+
"package": "@nifrajs/cli",
|
|
5793
|
+
"signature": "export declare function diagnosticCompatibilityOf(value: Diagnostic): DiagnosticCompatibility | undefined;",
|
|
5794
|
+
"doc": "/** Read legacy-only rendering metadata. Undefined means the diagnostic has no compatibility view. */"
|
|
5795
|
+
},
|
|
5538
5796
|
{
|
|
5539
5797
|
"name": "DiagnosticFix",
|
|
5540
5798
|
"kind": "interface",
|
|
@@ -5548,6 +5806,19 @@
|
|
|
5548
5806
|
"signature": "export interface DiagnosticFrame {\n readonly raw: string;\n readonly file?: string;\n readonly line?: number;\n readonly column?: number;\n}",
|
|
5549
5807
|
"doc": "/** One parsed stack frame. `file`/`line`/`column` are present only when the frame could be located. */"
|
|
5550
5808
|
},
|
|
5809
|
+
{
|
|
5810
|
+
"name": "DiagnosticSuggestion",
|
|
5811
|
+
"kind": "interface",
|
|
5812
|
+
"package": "@nifrajs/cli",
|
|
5813
|
+
"signature": "export interface DiagnosticSuggestion {\n readonly kind: \"edit\" | \"command\" | \"manual\";\n readonly title: string;\n readonly diff?: string;\n readonly command?: readonly string[];\n readonly steps?: readonly string[];\n}"
|
|
5814
|
+
},
|
|
5815
|
+
{
|
|
5816
|
+
"name": "diagnosticWithCompatibility",
|
|
5817
|
+
"kind": "function",
|
|
5818
|
+
"package": "@nifrajs/cli",
|
|
5819
|
+
"signature": "export declare function diagnosticWithCompatibility(value: Diagnostic, compatibility: DiagnosticCompatibility): Diagnostic;",
|
|
5820
|
+
"doc": "/** Attach legacy-only rendering metadata without widening the serialized diagnostic protocol. */"
|
|
5821
|
+
},
|
|
5551
5822
|
{
|
|
5552
5823
|
"name": "diffDataContract",
|
|
5553
5824
|
"kind": "function",
|
|
@@ -5569,6 +5840,13 @@
|
|
|
5569
5840
|
"signature": "export declare function diffNifraManifests(before: NifraManifest, after: NifraManifest): NifraManifestDiff;",
|
|
5570
5841
|
"doc": "/** Contract changes reuse the route-diff engine; governance changes fail closed on expanded risk. */"
|
|
5571
5842
|
},
|
|
5843
|
+
{
|
|
5844
|
+
"name": "diffOpenApiInventory",
|
|
5845
|
+
"kind": "function",
|
|
5846
|
+
"package": "@nifrajs/schema",
|
|
5847
|
+
"signature": "export declare function diffOpenApiInventory(expected: ImportedApiInventory, actual: ImportedApiInventory): readonly OpenApiInventoryDrift[];",
|
|
5848
|
+
"doc": "/** Compare two inventories. Empty means the export/import cycle preserved the route table. */"
|
|
5849
|
+
},
|
|
5572
5850
|
{
|
|
5573
5851
|
"name": "diffRouteSnapshots",
|
|
5574
5852
|
"kind": "function",
|
|
@@ -5589,6 +5867,13 @@
|
|
|
5589
5867
|
"signature": "export declare function digestProjectEvidence(snapshot: ProjectEvidenceSnapshot): Promise<string>;",
|
|
5590
5868
|
"doc": "/** SHA-256 of the canonical snapshot, useful as a cheap freshness/reference token. */"
|
|
5591
5869
|
},
|
|
5870
|
+
{
|
|
5871
|
+
"name": "digestReviewReport",
|
|
5872
|
+
"kind": "function",
|
|
5873
|
+
"package": "@nifrajs/agent-review",
|
|
5874
|
+
"signature": "export declare function digestReviewReport(report: ReviewReport): Promise<string>;",
|
|
5875
|
+
"doc": "/** Compute a lowercase Web Crypto SHA-256 digest of the canonical report representation. */"
|
|
5876
|
+
},
|
|
5592
5877
|
{
|
|
5593
5878
|
"name": "digestRunPlan",
|
|
5594
5879
|
"kind": "function",
|
|
@@ -6338,6 +6623,13 @@
|
|
|
6338
6623
|
"signature": "export declare const examplesWidget: import(\"@nifrajs/mcp\").McpWidget;",
|
|
6339
6624
|
"doc": "/** The widget: renders `structuredContent.examples` as a filterable list of example cards. */"
|
|
6340
6625
|
},
|
|
6626
|
+
{
|
|
6627
|
+
"name": "executeAgentCapability",
|
|
6628
|
+
"kind": "function",
|
|
6629
|
+
"package": "@nifrajs/webmcp",
|
|
6630
|
+
"signature": "export declare function executeAgentCapability<Input, Output, State>(capability: AgentCapability<Input, Output, State>, input: unknown, options?: ToolCallOptions): Promise<ToolCallResult<Output>>;",
|
|
6631
|
+
"doc": "/** Execute through Nifra's existing validation, policy, approval, idempotency, and evidence path. */"
|
|
6632
|
+
},
|
|
6341
6633
|
{
|
|
6342
6634
|
"name": "executeCapability",
|
|
6343
6635
|
"kind": "function",
|
|
@@ -6345,6 +6637,19 @@
|
|
|
6345
6637
|
"signature": "export declare function executeCapability<T>(context: object, capability: string, options: CapabilityExecutionOptions, executor: CapabilityExecutor<T>): Promise<T>;",
|
|
6346
6638
|
"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 */"
|
|
6347
6639
|
},
|
|
6640
|
+
{
|
|
6641
|
+
"name": "executePredicted",
|
|
6642
|
+
"kind": "function",
|
|
6643
|
+
"package": "@nifrajs/webmcp",
|
|
6644
|
+
"signature": "export declare function executePredicted<Input, Output, State>(capability: AgentCapability<Input, Output, State>, input: unknown, store: PredictionStore<State>, options?: ExecutePredictedOptions): Promise<PredictedExecutionResult<Output, State>>;",
|
|
6645
|
+
"doc": "/** Apply a pure prediction, execute the core tool, then commit or roll it back atomically. */"
|
|
6646
|
+
},
|
|
6647
|
+
{
|
|
6648
|
+
"name": "ExecutePredictedOptions",
|
|
6649
|
+
"kind": "interface",
|
|
6650
|
+
"package": "@nifrajs/webmcp",
|
|
6651
|
+
"signature": "export interface ExecutePredictedOptions extends Omit<ToolCallOptions, \"capabilities\"> {\n readonly capabilities?: readonly string[];\n readonly predictionId?: string;\n readonly now?: () => number;\n}"
|
|
6652
|
+
},
|
|
6348
6653
|
{
|
|
6349
6654
|
"name": "executeTool",
|
|
6350
6655
|
"kind": "function",
|
|
@@ -6712,14 +7017,14 @@
|
|
|
6712
7017
|
"name": "FetchHandler",
|
|
6713
7018
|
"kind": "interface",
|
|
6714
7019
|
"package": "@nifrajs/deno",
|
|
6715
|
-
"signature": "export interface FetchHandler {\n fetch(request: Request, platform?: {\n readonly clientIp?: string;\n }): Response | Promise<Response>;\n /** A nifra app also exposes this WS-upgrade seam; present → this adapter serves `app.ws()` routes\n * via `Deno.upgradeWebSocket`. Absent (a plain `{ fetch }` handler) → HTTP only. */\n resolveWebSocketUpgrade?(request: Request): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
|
|
7020
|
+
"signature": "export interface FetchHandler {\n fetch(request: Request, platform?: {\n readonly clientIp?: string;\n }): Response | Promise<Response>;\n /** A nifra app also exposes this WS-upgrade seam; present → this adapter serves `app.ws()` routes\n * via `Deno.upgradeWebSocket`. Absent (a plain `{ fetch }` handler) → HTTP only. */\n resolveWebSocketUpgrade?(request: Request, platform?: {\n readonly clientIp?: string;\n }): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
|
|
6716
7021
|
"doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
|
|
6717
7022
|
},
|
|
6718
7023
|
{
|
|
6719
7024
|
"name": "FetchHandler",
|
|
6720
7025
|
"kind": "interface",
|
|
6721
7026
|
"package": "@nifrajs/node",
|
|
6722
|
-
"signature": "export interface FetchHandler {\n fetch(request: Request, platform?: NodePlatform): Response | Promise<Response>;\n /** Nifra apps also expose this WS-upgrade seam; present → this adapter serves `app.ws()` routes via\n * the optional `ws` package (lazy-imported on the first upgrade). Absent (a plain `{ fetch }`\n * handler) → HTTP only, and an upgrade request gets a 404. */\n resolveWebSocketUpgrade?(request: Request): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
|
|
7027
|
+
"signature": "export interface FetchHandler {\n fetch(request: Request, platform?: NodePlatform): Response | Promise<Response>;\n /** Nifra apps also expose this WS-upgrade seam; present → this adapter serves `app.ws()` routes via\n * the optional `ws` package (lazy-imported on the first upgrade). Absent (a plain `{ fetch }`\n * handler) → HTTP only, and an upgrade request gets a 404. */\n resolveWebSocketUpgrade?(request: Request, platform?: NodePlatform): WsUpgradeOutcome | Promise<WsUpgradeOutcome>;\n}",
|
|
6723
7028
|
"doc": "/** Anything exposing a Web `fetch` handler - a nifra `app`, for instance. */"
|
|
6724
7029
|
},
|
|
6725
7030
|
{
|
|
@@ -6787,14 +7092,14 @@
|
|
|
6787
7092
|
"name": "FileSessionStore",
|
|
6788
7093
|
"kind": "class",
|
|
6789
7094
|
"package": "@nifrajs/coding-agent",
|
|
6790
|
-
"signature": "export declare class FileSessionStore implements SessionStore {\n private readonly root;\n private readonly maxEntryBytes;\n private readonly sequences;\n constructor(options: FileSessionStoreOptions);\n append(sessionId: string, type: string, payload?: unknown, options?: {\n readonly pinned?: boolean;\n }): Promise<SessionLogEntry>;\n read(sessionId: string): Promise<readonly SessionLogEntry[]>;\n checkpoint(sessionId: string, payload: unknown): Promise<void>;\n fork(sessionId: string, targetSessionId?: string): Promise<string>;\n private pathFor;\n private nextSequence;\n}",
|
|
7095
|
+
"signature": "export declare class FileSessionStore implements SessionStore {\n private readonly root;\n private readonly maxEntryBytes;\n private readonly maxEntries;\n private readonly maxBytes;\n private readonly sequences;\n private readonly locks;\n constructor(options: FileSessionStoreOptions);\n append(sessionId: string, type: string, payload?: unknown, options?: {\n readonly pinned?: boolean;\n }): Promise<SessionLogEntry>;\n read(sessionId: string, limit?: number): Promise<readonly SessionLogEntry[]>;\n checkpoint(sessionId: string, payload: unknown): Promise<void>;\n fork(sessionId: string, targetSessionId?: string): Promise<string>;\n private pathFor;\n private nextSequence;\n private compactIfNeeded;\n private readTailText;\n private readUnlocked;\n private withSessionLock;\n}",
|
|
6791
7096
|
"doc": "/**\n * Small append-only JSONL store. It stores redacted, bounded event evidence rather than raw model\n * transcripts, so session recovery is useful without turning the agent into a memory sink.\n */"
|
|
6792
7097
|
},
|
|
6793
7098
|
{
|
|
6794
7099
|
"name": "FileSessionStoreOptions",
|
|
6795
7100
|
"kind": "interface",
|
|
6796
7101
|
"package": "@nifrajs/coding-agent",
|
|
6797
|
-
"signature": "export interface FileSessionStoreOptions {\n readonly root: string;\n readonly maxEntryBytes?: number;\n}"
|
|
7102
|
+
"signature": "export interface FileSessionStoreOptions {\n readonly root: string;\n readonly maxEntryBytes?: number;\n /** Maximum retained JSONL entries per session. Defaults to 4,096. */\n readonly maxEntries?: number;\n /** Maximum retained JSONL bytes per session. Defaults to 8 MiB. */\n readonly maxBytes?: number;\n}"
|
|
6798
7103
|
},
|
|
6799
7104
|
{
|
|
6800
7105
|
"name": "FileStorage",
|
|
@@ -7139,7 +7444,7 @@
|
|
|
7139
7444
|
"name": "GenerateServerManifestOptions",
|
|
7140
7445
|
"kind": "interface",
|
|
7141
7446
|
"package": "@nifrajs/web",
|
|
7142
|
-
"signature": "export interface GenerateServerManifestOptions {\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier -\n * same contract as `generateClientEntry`'s `resolve`. */\n readonly resolve: (file: string) => string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest), **baked** into the emitted\n * module - a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked as\n * `export const styles` so the server entry can hand them to `createWebApp` (→ `<link rel=\"stylesheet\">`\n * in `<head>`). Without this the built SSR page ships no CSS link and renders unstyled. */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked as\n * `export const routeStyles` so a page links only the CSS its route chain uses. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** Emit **lazy** per-route loaders (`() => import(\"./routes/x\")`, a static specifier) instead of\n * eager `import * as`, so a bundler with code-splitting emits one chunk per route - loaded on the\n * first request to it, not all at boot (smaller cold-start parse). Default `false` (eager). Both\n * modes are fs-free with statically-analyzable specifiers; only the *when* differs. */\n readonly lazy?: boolean;\n}"
|
|
7447
|
+
"signature": "export interface GenerateServerManifestOptions {\n /** Turn a route/layout source file (relative to the routes dir) into an import specifier -\n * same contract as `generateClientEntry`'s `resolve`. */\n readonly resolve: (file: string) => string;\n /** The content-hashed client entry URL (from `buildClient`'s manifest), **baked** into the emitted\n * module - a disk-less worker can't read `manifest.json` at runtime. */\n readonly clientEntry: string;\n /** The app's aggregate stylesheet URLs (`buildClient`'s `BuildManifest.css`) - baked as\n * `export const styles` so the server entry can hand them to `createWebApp` (→ `<link rel=\"stylesheet\">`\n * in `<head>`). Without this the built SSR page ships no CSS link and renders unstyled. */\n readonly styles?: readonly string[] | undefined;\n /** Per-route stylesheet URLs (`buildClient`'s `BuildManifest.routeStyles`) - baked as\n * `export const routeStyles` so a page links only the CSS its route chain uses. */\n readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;\n /** How framework-owned stylesheet links should activate before the generated client mounts. */\n readonly cssLoading?: CssLoadingMode;\n /** Emit **lazy** per-route loaders (`() => import(\"./routes/x\")`, a static specifier) instead of\n * eager `import * as`, so a bundler with code-splitting emits one chunk per route - loaded on the\n * first request to it, not all at boot (smaller cold-start parse). Default `false` (eager). Both\n * modes are fs-free with statically-analyzable specifiers; only the *when* differs. */\n readonly lazy?: boolean;\n}"
|
|
7143
7448
|
},
|
|
7144
7449
|
{
|
|
7145
7450
|
"name": "generateServiceWorker",
|
|
@@ -7241,7 +7546,7 @@
|
|
|
7241
7546
|
"name": "GraphqlHttpOptions",
|
|
7242
7547
|
"kind": "interface",
|
|
7243
7548
|
"package": "@nifrajs/graphql",
|
|
7244
|
-
"signature": "export interface GraphqlHttpOptions<Context = unknown, Env = unknown> {\n /** The executable schema (types + resolvers), e.g. from `graphql`'s `buildSchema` or a schema builder. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the request (and nifra context when mounted). */\n readonly context?: GraphqlContextBuilder<Context, Env>;\n /** The nifra route context, when the caller has one (supplied by `mountGraphql`). */\n readonly nifra?: NifraContextLike<Env>;\n /** Maximum request body size in bytes. Default 1 MB. Rejected bodies answer 413. */\n readonly maxBodyBytes?: number;\n /** Prototype-pollution policy for the parsed JSON body. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Optional root value passed to the executor. */\n readonly rootValue?: unknown;\n /**\n * Origin allowlist for the CORS `access-control-allow-origin` header. Omit to reflect any origin\n * (`*`) - correct for a public API; set it to lock the browser callers down.\n */\n readonly allowedOrigins?: readonly string[];\n /**\n * Per-request authorization, run after the body parses and before execution. Return `false` to answer\n * `401` with a GraphQL error envelope and skip execution entirely.\n */\n readonly authorize?: (request: Request) => boolean | Promise<boolean>;\n /** Emit the legacy always-200 `application/json` response shape instead of `application/graphql-response+json`. */\n readonly legacyJsonResponse?: boolean;\n}"
|
|
7549
|
+
"signature": "export interface GraphqlHttpOptions<Context = unknown, Env = unknown> {\n /** The executable schema (types + resolvers), e.g. from `graphql`'s `buildSchema` or a schema builder. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the request (and nifra context when mounted). */\n readonly context?: GraphqlContextBuilder<Context, Env>;\n /** The nifra route context, when the caller has one (supplied by `mountGraphql`). */\n readonly nifra?: NifraContextLike<Env>;\n /** Maximum request body size in bytes. Default 1 MB. Rejected bodies answer 413. */\n readonly maxBodyBytes?: number;\n /** Maximum UTF-8 query size. Default 64 KiB, applied to POST and GET. */\n readonly maxQueryBytes?: number;\n /** Maximum UTF-8 serialized variables size. Default 256 KiB. */\n readonly maxVariablesBytes?: number;\n /** Maximum expanded field depth. Default 20. */\n readonly maxDepth?: number;\n /** Maximum aliases in one document. Default 100. */\n readonly maxAliases?: number;\n /** Maximum simple field complexity in one document. Default 1,000. */\n readonly maxComplexity?: number;\n /** Maximum operation definitions in one document. Default 10. */\n readonly maxOperations?: number;\n /** Maximum asynchronous resolver execution time. Default 10 seconds. */\n readonly executionTimeoutMs?: number;\n /** Prototype-pollution policy for the parsed JSON body. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Optional root value passed to the executor. */\n readonly rootValue?: unknown;\n /**\n * Origin allowlist for the CORS `access-control-allow-origin` header. Omit to reflect any origin\n * (`*`) - correct for a public API; set it to lock the browser callers down.\n */\n readonly allowedOrigins?: readonly string[];\n /**\n * Per-request authorization, run after the body parses and before execution. Return `false` to answer\n * `401` with a GraphQL error envelope and skip execution entirely.\n */\n readonly authorize?: (request: Request) => boolean | Promise<boolean>;\n /** Emit the legacy always-200 `application/json` response shape instead of `application/graphql-response+json`. */\n readonly legacyJsonResponse?: boolean;\n /** Format request/execution errors. The default masks resolver messages and preserves request errors. */\n readonly formatError?: (error: GraphQLError, phase: \"request\" | \"execution\") => unknown;\n}"
|
|
7245
7550
|
},
|
|
7246
7551
|
{
|
|
7247
7552
|
"name": "GraphqlPubSub",
|
|
@@ -7261,7 +7566,7 @@
|
|
|
7261
7566
|
"name": "GraphqlWsOptions",
|
|
7262
7567
|
"kind": "interface",
|
|
7263
7568
|
"package": "@nifrajs/graphql",
|
|
7264
|
-
"signature": "export interface GraphqlWsOptions<Context extends Record<string, unknown> = Record<string, unknown>> {\n /** The executable schema. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the upgrade request. Shared with the HTTP transport. */\n readonly context?: GraphqlContextBuilder<Context>;\n /**\n * Called once per connection with the client's `connection_init` payload; return `false` (or throw)\n * to reject the connection. The seam for authenticating a socket from an init token.\n */\n readonly onConnect?: (payload: ConnectionInitMessage[\"payload\"], request: Request) => boolean | Promise<boolean>;\n /** Additional raw `graphql-ws` server options merged last (advanced escape hatch). */\n readonly serverOptions?: Partial<ServerOptions>;\n}"
|
|
7569
|
+
"signature": "export interface GraphqlWsOptions<Context extends Record<string, unknown> = Record<string, unknown>> {\n /** The executable schema. */\n readonly schema: GraphQLSchema;\n /** Build the resolver `contextValue` from the upgrade request. Shared with the HTTP transport. */\n readonly context?: GraphqlContextBuilder<Context>;\n /**\n * Called once per connection with the client's `connection_init` payload; return `false` (or throw)\n * to reject the connection. The seam for authenticating a socket from an init token.\n */\n readonly onConnect?: (payload: ConnectionInitMessage[\"payload\"], request: Request) => boolean | Promise<boolean>;\n /** Additional raw `graphql-ws` server options merged last (advanced escape hatch). */\n readonly serverOptions?: Partial<ServerOptions>;\n /** Same query/complexity limits as the HTTP transport. */\n readonly maxQueryBytes?: number;\n readonly maxVariablesBytes?: number;\n readonly maxDepth?: number;\n readonly maxAliases?: number;\n readonly maxComplexity?: number;\n readonly maxOperations?: number;\n /** Maximum concurrent subscription operation ids per connection. Default 20. */\n readonly maxSubscriptions?: number;\n /** Maximum time for initial execute/subscribe setup. Default 10 seconds. */\n readonly executionTimeoutMs?: number;\n}"
|
|
7265
7570
|
},
|
|
7266
7571
|
{
|
|
7267
7572
|
"name": "GuardOptions",
|
|
@@ -7380,6 +7685,20 @@
|
|
|
7380
7685
|
"signature": "export interface HandoffView {\n readonly requestId: string;\n readonly runId: string;\n readonly nodeId: string;\n readonly capability: string;\n readonly vector: number;\n readonly expiresAt: number;\n readonly state: HandoffLifecycleState;\n /** Opaque origin role. */\n readonly from: string;\n /** Opaque owner role once assigned. */\n readonly to?: string;\n}",
|
|
7381
7686
|
"doc": "/** Content-free projection of one handoff boundary for a list/inspect view. */"
|
|
7382
7687
|
},
|
|
7688
|
+
{
|
|
7689
|
+
"name": "hasDuplicateCookie",
|
|
7690
|
+
"kind": "function",
|
|
7691
|
+
"package": "@nifrajs/core",
|
|
7692
|
+
"signature": "export declare function hasDuplicateCookie(header: string | null | undefined, targetName: string): boolean;",
|
|
7693
|
+
"doc": "/** True when a raw Cookie header contains the same exact cookie name more than once. */"
|
|
7694
|
+
},
|
|
7695
|
+
{
|
|
7696
|
+
"name": "hasDuplicateCookie",
|
|
7697
|
+
"kind": "function",
|
|
7698
|
+
"package": "nifra",
|
|
7699
|
+
"signature": "export declare function hasDuplicateCookie(header: string | null | undefined, targetName: string): boolean;",
|
|
7700
|
+
"doc": "/** True when a raw Cookie header contains the same exact cookie name more than once. */"
|
|
7701
|
+
},
|
|
7383
7702
|
{
|
|
7384
7703
|
"name": "hash8",
|
|
7385
7704
|
"kind": "function",
|
|
@@ -7473,6 +7792,13 @@
|
|
|
7473
7792
|
"signature": "export interface HtmlImageAttrs {\n readonly src: string;\n readonly width: number;\n readonly height: number;\n readonly alt: string;\n readonly loading: \"lazy\" | \"eager\";\n readonly decoding: \"async\";\n readonly srcset?: string;\n readonly sizes?: string;\n readonly fetchpriority?: \"high\";\n}",
|
|
7474
7793
|
"doc": "/** Plain lowercase HTML `<img>` attributes (`srcset`/`fetchpriority`, not React's camelCase). */"
|
|
7475
7794
|
},
|
|
7795
|
+
{
|
|
7796
|
+
"name": "HtmlSanitizer",
|
|
7797
|
+
"kind": "type",
|
|
7798
|
+
"package": "@nifrajs/web",
|
|
7799
|
+
"signature": "export type HtmlSanitizer = (value: string) => string;",
|
|
7800
|
+
"doc": "/** The only contract a project-specific, allowlist-based HTML sanitizer must satisfy. */"
|
|
7801
|
+
},
|
|
7476
7802
|
{
|
|
7477
7803
|
"name": "HtmlValue",
|
|
7478
7804
|
"kind": "type",
|
|
@@ -7484,14 +7810,14 @@
|
|
|
7484
7810
|
"name": "HttpAgentTransport",
|
|
7485
7811
|
"kind": "class",
|
|
7486
7812
|
"package": "@nifrajs/agent-app",
|
|
7487
|
-
"signature": "export declare class HttpAgentTransport implements AgentTransport {\n private readonly url;\n private readonly authorize;\n private readonly fetchImpl;\n constructor(options: HttpAgentTransportOptions);\n private headers;\n command<T = unknown>(request: AgentTransportRequest): Promise<CommandOutcome<T>>;\n stream(request: AgentTransportRequest): AsyncIterable<AgentEvent>;\n}",
|
|
7813
|
+
"signature": "export declare class HttpAgentTransport implements AgentTransport {\n private readonly url;\n private readonly authorize;\n private readonly fetchImpl;\n private readonly maxResponseBytes;\n constructor(options: HttpAgentTransportOptions);\n private headers;\n command<T = unknown>(request: AgentTransportRequest): Promise<CommandOutcome<T>>;\n stream(request: AgentTransportRequest): AsyncIterable<AgentEvent>;\n}",
|
|
7488
7814
|
"doc": "/** Web `fetch` + SSE transport. Browser- and Bun-compatible; depends on no Node or framework code. */"
|
|
7489
7815
|
},
|
|
7490
7816
|
{
|
|
7491
7817
|
"name": "HttpAgentTransportOptions",
|
|
7492
7818
|
"kind": "interface",
|
|
7493
7819
|
"package": "@nifrajs/agent-app",
|
|
7494
|
-
"signature": "export interface HttpAgentTransportOptions {\n /** RPC origin, e.g. `http://127.0.0.1:8787`. The `/rpc` path is appended. */\n readonly endpoint: string;\n /** Per-request bearer-token source. Never stored; only the header value is used and discarded. */\n readonly authorize?: AuthProvider;\n /** Injectable fetch for tests and non-DOM hosts. Defaults to the ambient `fetch`. */\n readonly fetch?: typeof fetch;\n}"
|
|
7820
|
+
"signature": "export interface HttpAgentTransportOptions {\n /** RPC origin, e.g. `http://127.0.0.1:8787`. The `/rpc` path is appended. */\n readonly endpoint: string;\n /** Per-request bearer-token source. Never stored; only the header value is used and discarded. */\n readonly authorize?: AuthProvider;\n /** Injectable fetch for tests and non-DOM hosts. Defaults to the ambient `fetch`. */\n readonly fetch?: typeof fetch;\n /** Maximum response bytes retained by command and SSE reads. Defaults to 8 MiB. */\n readonly maxResponseBytes?: number;\n}"
|
|
7495
7821
|
},
|
|
7496
7822
|
{
|
|
7497
7823
|
"name": "httpToolAdapter",
|
|
@@ -7670,7 +7996,7 @@
|
|
|
7670
7996
|
"name": "IdempotencyClaim",
|
|
7671
7997
|
"kind": "type",
|
|
7672
7998
|
"package": "@nifrajs/middleware",
|
|
7673
|
-
"signature": "export type IdempotencyClaim = {\n readonly state: \"new\";\n} | {\n readonly state: \"in_flight\";\n} | {\n readonly state: \"replay\";\n readonly record: IdempotencyRecord;\n};"
|
|
7999
|
+
"signature": "export type IdempotencyClaim = {\n readonly state: \"new\";\n readonly reservation: string;\n} | {\n readonly state: \"in_flight\";\n} | {\n readonly state: \"replay\";\n readonly record: IdempotencyRecord;\n};"
|
|
7674
8000
|
},
|
|
7675
8001
|
{
|
|
7676
8002
|
"name": "IdempotencyClass",
|
|
@@ -7754,7 +8080,7 @@
|
|
|
7754
8080
|
"name": "IdempotencyStore",
|
|
7755
8081
|
"kind": "interface",
|
|
7756
8082
|
"package": "@nifrajs/middleware",
|
|
7757
|
-
"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
|
|
8083
|
+
"signature": "export interface IdempotencyStore {\n /**\n * Atomically claim `key`: `\"replay\"` if a completed response is stored, `\"in_flight\"` if another\n * request holds the lock, else `\"new\"` (the caller now owns the lock and must `complete`/`release`).\n * The in-flight lock expires after `lockTtlMs` so a crashed handler can't wedge the key forever.\n */\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n /** Store the completed response only when `reservation` still owns the lock (kept for `ttlMs`). */\n complete(key: string, reservation: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;\n /** Release only the lock owned by `reservation` (handler errored / response not cacheable). */\n release(key: string, reservation: string): Promise<boolean>;\n}",
|
|
7758
8084
|
"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 */"
|
|
7759
8085
|
},
|
|
7760
8086
|
{
|
|
@@ -7943,6 +8269,37 @@
|
|
|
7943
8269
|
"signature": "export declare function implement<const C extends ContractShape, H extends HandlersFor<C, Ctx>, R extends Registry = EmptyRegistry, Ctx = NonNullable<unknown>, HookOutput = never>(contract: C, handlers: H, app?: Server<R, Ctx, HookOutput>): Server<R & RegistryFromImpl<C, H, Ctx, HookOutput>, Ctx, HookOutput>;",
|
|
7944
8270
|
"doc": "/**\n * Bind handlers to a contract, producing a real {@link Server} you can `.listen()`\n * or `.fetch()`. Each op is registered through the same path as the inline\n * builder, so the result is identical to writing the routes inline - handlers\n * lift over **unchanged** (\"graduation\"), and body/query schemas validate at the\n * request boundary exactly as in inline mode.\n *\n * Pass a pre-configured `app` to give the contract's routes a middleware chain. A route captures the\n * server's `derive`/`decorate`/assurance chain **at registration**, so anything applied to the\n * returned server afterwards reaches the contract's routes not at all - the app must already carry it:\n *\n * ```ts\n * const app = implement(contract, handlers, server().use(auth).derive(sessionOf))\n * ```\n *\n * That is also the seam that lets `nifra assure` prove rather than merely classify a contract-first\n * app: the plugin that installs the enforcement is what declares the evidence\n * ({@link withRouteAssurance}), and only a plugin installed *before* registration is captured. Handlers\n * then see the app's `Ctx`, and the returned server keeps any routes the app already had.\n */"
|
|
7945
8271
|
},
|
|
8272
|
+
{
|
|
8273
|
+
"name": "ImportedApiInventory",
|
|
8274
|
+
"kind": "interface",
|
|
8275
|
+
"package": "@nifrajs/schema",
|
|
8276
|
+
"signature": "export interface ImportedApiInventory {\n readonly title: string;\n readonly version: string;\n readonly routes: readonly ImportedRoute[];\n readonly warnings: readonly string[];\n}"
|
|
8277
|
+
},
|
|
8278
|
+
{
|
|
8279
|
+
"name": "ImportedRoute",
|
|
8280
|
+
"kind": "interface",
|
|
8281
|
+
"package": "@nifrajs/schema",
|
|
8282
|
+
"signature": "export interface ImportedRoute {\n /** Lowercase HTTP method as it appears in the document. */\n readonly method: string;\n /** Nifra-templated path (`/users/:id`). */\n readonly path: string;\n readonly operationId?: string;\n /** Template parameter names in path order. */\n readonly pathParams: readonly string[];\n readonly query: readonly ImportedRouteQuery[];\n readonly hasBody: boolean;\n readonly requestBodyRequired: boolean;\n /** Response status keys (`\"200\"`, `\"404\"`, `\"default\"`). */\n readonly responseStatuses: readonly string[];\n /** Per-route degradations (wildcard rewrites). */\n readonly notes: readonly string[];\n}"
|
|
8283
|
+
},
|
|
8284
|
+
{
|
|
8285
|
+
"name": "ImportedRouteQuery",
|
|
8286
|
+
"kind": "interface",
|
|
8287
|
+
"package": "@nifrajs/schema",
|
|
8288
|
+
"signature": "export interface ImportedRouteQuery {\n readonly name: string;\n readonly required: boolean;\n}"
|
|
8289
|
+
},
|
|
8290
|
+
{
|
|
8291
|
+
"name": "importOpenAPI",
|
|
8292
|
+
"kind": "function",
|
|
8293
|
+
"package": "@nifrajs/schema",
|
|
8294
|
+
"signature": "export declare function importOpenAPI(document: unknown, options?: ImportOpenAPIOptions): ImportedApiInventory;",
|
|
8295
|
+
"doc": "/** Parse an OpenAPI 3.0/3.1 document into a canonical route inventory. Throws on invalid input. */"
|
|
8296
|
+
},
|
|
8297
|
+
{
|
|
8298
|
+
"name": "ImportOpenAPIOptions",
|
|
8299
|
+
"kind": "interface",
|
|
8300
|
+
"package": "@nifrajs/schema",
|
|
8301
|
+
"signature": "export interface ImportOpenAPIOptions {\n /** Maximum entries under `paths`. Default 5000. */\n readonly maxPaths?: number;\n /** Maximum operations on one path item. Default 8. */\n readonly maxOperationsPerPath?: number;\n /** Maximum merged parameters per operation. Default 100. */\n readonly maxParameters?: number;\n}"
|
|
8302
|
+
},
|
|
7946
8303
|
{
|
|
7947
8304
|
"name": "IncidentCapsule",
|
|
7948
8305
|
"kind": "interface",
|
|
@@ -8202,7 +8559,8 @@
|
|
|
8202
8559
|
"name": "isAgentEvent",
|
|
8203
8560
|
"kind": "function",
|
|
8204
8561
|
"package": "@nifrajs/agent-protocol",
|
|
8205
|
-
"signature": "export declare function isAgentEvent(value: unknown): value is AgentEvent;"
|
|
8562
|
+
"signature": "export declare function isAgentEvent(value: unknown): value is AgentEvent;",
|
|
8563
|
+
"doc": "/** Validate the complete discriminated event union before a projection or UI consumer sees it. */"
|
|
8206
8564
|
},
|
|
8207
8565
|
{
|
|
8208
8566
|
"name": "isAllowedFontUrl",
|
|
@@ -8239,6 +8597,20 @@
|
|
|
8239
8597
|
"signature": "export declare function isDraftEnabled(request: Request, secret: string): Promise<boolean>;",
|
|
8240
8598
|
"doc": "/**\n * Whether `request` carries a **valid** signed draft cookie (constant-time verify via `unsignValue`).\n * `createWebApp` uses it to set `ctx.draft`; `withISR` uses it to bypass the cache for editors. A\n * missing, forged, or tampered cookie returns `false`.\n */"
|
|
8241
8599
|
},
|
|
8600
|
+
{
|
|
8601
|
+
"name": "isJsonRpcRequest",
|
|
8602
|
+
"kind": "function",
|
|
8603
|
+
"package": "@nifrajs/mcp",
|
|
8604
|
+
"signature": "export declare function isJsonRpcRequest(value: unknown): value is JsonRpcRequest;",
|
|
8605
|
+
"doc": "/** Validate a JSON-RPC request/notification before any transport or method-specific access. */"
|
|
8606
|
+
},
|
|
8607
|
+
{
|
|
8608
|
+
"name": "isJsonRpcResponse",
|
|
8609
|
+
"kind": "function",
|
|
8610
|
+
"package": "@nifrajs/mcp",
|
|
8611
|
+
"signature": "export declare function isJsonRpcResponse(value: unknown): value is JsonRpcResponse;",
|
|
8612
|
+
"doc": "/** Validate a JSON-RPC response received by a transport-side client hook. Responses are not accepted\n * by {@link handleRpc}; this guard exists for the stdio roots/list answer, which is the one server-\n * initiated request response the CLI consumes itself. */"
|
|
8613
|
+
},
|
|
8242
8614
|
{
|
|
8243
8615
|
"name": "island",
|
|
8244
8616
|
"kind": "function",
|
|
@@ -8427,6 +8799,13 @@
|
|
|
8427
8799
|
"signature": "export interface ISRPlatform {\n readonly waitUntil?: (promise: Promise<unknown>) => void;\n}",
|
|
8428
8800
|
"doc": "/** Minimal platform shape `withISR` needs - just `waitUntil` (edge runtimes extend the response\n * lifetime so background regeneration finishes). Off-edge it's absent and regen runs fire-and-forget. */"
|
|
8429
8801
|
},
|
|
8802
|
+
{
|
|
8803
|
+
"name": "isSafeReviewDiff",
|
|
8804
|
+
"kind": "function",
|
|
8805
|
+
"package": "@nifrajs/coding-agent",
|
|
8806
|
+
"signature": "export declare function isSafeReviewDiff(value: unknown): value is string;",
|
|
8807
|
+
"doc": "/** Validate the only repository selector exposed by the host review RPC. */"
|
|
8808
|
+
},
|
|
8430
8809
|
{
|
|
8431
8810
|
"name": "isSameOriginPath",
|
|
8432
8811
|
"kind": "function",
|
|
@@ -9193,6 +9572,13 @@
|
|
|
9193
9572
|
"signature": "export declare const MAX_MEDIA_QUERY_LENGTH = 256;",
|
|
9194
9573
|
"doc": "/** The maximum media-query length accepted from an HTML data attribute. */"
|
|
9195
9574
|
},
|
|
9575
|
+
{
|
|
9576
|
+
"name": "MAX_TRANSPORT_BYTES",
|
|
9577
|
+
"kind": "const",
|
|
9578
|
+
"package": "@nifrajs/agent-protocol",
|
|
9579
|
+
"signature": "export declare const MAX_TRANSPORT_BYTES: number;",
|
|
9580
|
+
"doc": "/**\n * Protocol-neutral byte limits for HTTP adapters.\n *\n * MCP's HTTP server and the Agent App browser transport have different wire protocols, but both need\n * the same fail-closed rules when reading an untrusted stream. Keeping this small policy here avoids\n * coupling either adapter to the other while making the limit and cancellation semantics identical.\n */"
|
|
9581
|
+
},
|
|
9196
9582
|
{
|
|
9197
9583
|
"name": "maxClassification",
|
|
9198
9584
|
"kind": "function",
|
|
@@ -9258,7 +9644,7 @@
|
|
|
9258
9644
|
"name": "McpAppBridge",
|
|
9259
9645
|
"kind": "interface",
|
|
9260
9646
|
"package": "@nifrajs/mcp",
|
|
9261
|
-
"signature": "export interface McpAppBridge {\n /** Latest `structuredContent` the host pushed (or `null` before the first result). */\n data: unknown;\n /** Register a callback for `structuredContent` - fired immediately if data already arrived, then on\n * every later `ui/notifications/tool-result`. The common case: `mcpApp.onData(render)`. */\n onData(cb: (data: unknown) => void): void;\n /** Register a callback for the raw tool-call arguments (`ui/notifications/tool-input`). */\n onInput(cb: (args: unknown) => void): void;\n /** Latest theme the host pushed (`{ mode, tokens }`), or `null` before the first push. */\n theme: unknown;\n /** Register a callback for host theme pushes. The bridge ALSO auto-applies the tokens to the document\n * root (shadcn semantic vars + `color-scheme`/`data-theme`), so most widgets need no theme code. */\n onTheme(cb: (theme: unknown) => void): void;\n /** Invoke a tool back through the host; resolves with the tools/call result. */\n callTool(name: string, args?: Record<string, unknown>): Promise<unknown>;\n}",
|
|
9647
|
+
"signature": "export interface McpAppBridge {\n /** Latest `structuredContent` the host pushed (or `null` before the first result). */\n data: unknown;\n /** Register a callback for `structuredContent` - fired immediately if data already arrived, then on\n * every later `ui/notifications/tool-result`. The common case: `mcpApp.onData(render)`. */\n onData(cb: (data: unknown) => void): void;\n /** Register a callback for the raw tool-call arguments (`ui/notifications/tool-input`). */\n onInput(cb: (args: unknown) => void): void;\n /** Latest theme the host pushed (`{ mode, tokens }`), or `null` before the first push. */\n theme: unknown;\n /** Register a callback for host theme pushes. The bridge ALSO auto-applies the tokens to the document\n * root (shadcn semantic vars + `color-scheme`/`data-theme`), so most widgets need no theme code. */\n onTheme(cb: (theme: unknown) => void): void;\n /** Invoke a tool back through the host; resolves with the tools/call result. */\n callTool(name: string, args?: Record<string, unknown>): Promise<unknown>;\n /** Reject pending calls when the embedding host tears down the widget. */\n disconnect(reason?: string): void;\n}",
|
|
9262
9648
|
"doc": "/** The author-facing global injected into a widget. Kept minimal and stable. */"
|
|
9263
9649
|
},
|
|
9264
9650
|
{
|
|
@@ -9298,13 +9684,13 @@
|
|
|
9298
9684
|
"name": "McpHttpOptions",
|
|
9299
9685
|
"kind": "interface",
|
|
9300
9686
|
"package": "@nifrajs/cli",
|
|
9301
|
-
"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
|
|
9687
|
+
"signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Maximum serialized JSON-RPC response or SSE frame size. Default 1 MB. */\n readonly maxResponseBytes?: number;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /** Explicitly expose a secret-free, unauthenticated server to browser clients from any origin. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. When set, only exact origins are accepted. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Shared request registry for one authenticated MCP session. Pass the same state to the\n * request that starts a tool call and its `notifications/cancelled` request. Do not share one\n * state across unrelated callers unless the surrounding authorization boundary makes their\n * request-id namespace exclusive.\n */\n readonly state?: McpProtocolState;\n /**\n * Resolve a session-scoped request registry after authorization. This is the preferred seam for\n * multi-user HTTP hosts: bind the returned state to the authenticated caller/session and return\n * `undefined` for stateless requests. A resolver failure fails closed with a generic denial.\n */\n readonly resolveState?: (request: Request, message: JsonRpcRequest) => McpProtocolState | undefined | Promise<McpProtocolState | undefined>;\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
|
|
9302
9688
|
},
|
|
9303
9689
|
{
|
|
9304
9690
|
"name": "McpHttpOptions",
|
|
9305
9691
|
"kind": "interface",
|
|
9306
9692
|
"package": "@nifrajs/mcp",
|
|
9307
|
-
"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
|
|
9693
|
+
"signature": "export interface McpHttpOptions {\n /** Maximum JSON-RPC request body size in bytes. Default 1 MB. */\n readonly maxBodyBytes?: number;\n /** Maximum serialized JSON-RPC response or SSE frame size. Default 1 MB. */\n readonly maxResponseBytes?: number;\n /** Resources / prompts / the MCP Apps UI extension served alongside the tools. */\n readonly features?: McpServerFeatures;\n /** Shown on the GET health page so each host can describe itself. */\n readonly health?: string;\n /** Explicitly expose a secret-free, unauthenticated server to browser clients from any origin. */\n readonly allowAnyOrigin?: boolean;\n /** Origin allowlist for the DNS-rebinding guard. When set, only exact origins are accepted. */\n readonly allowedOrigins?: readonly string[];\n /**\n * Shared request registry for one authenticated MCP session. Pass the same state to the\n * request that starts a tool call and its `notifications/cancelled` request. Do not share one\n * state across unrelated callers unless the surrounding authorization boundary makes their\n * request-id namespace exclusive.\n */\n readonly state?: McpProtocolState;\n /**\n * Resolve a session-scoped request registry after authorization. This is the preferred seam for\n * multi-user HTTP hosts: bind the returned state to the authenticated caller/session and return\n * `undefined` for stateless requests. A resolver failure fails closed with a generic denial.\n */\n readonly resolveState?: (request: Request, message: JsonRpcRequest) => McpProtocolState | undefined | Promise<McpProtocolState | undefined>;\n /**\n * Optional authorization, run once per request against the parsed message - after the body has been\n * read under the size cap, so it never costs a second read of the stream. Returning `false` answers\n * `403` with a JSON-RPC error (`MCP_ERROR.UNAUTHORIZED`) and the handler never sees the message.\n */\n readonly authorizeMessage?: (message: JsonRpcRequest, request: Request) => boolean | Promise<boolean>;\n}"
|
|
9308
9694
|
},
|
|
9309
9695
|
{
|
|
9310
9696
|
"name": "mcpJson",
|
|
@@ -9375,7 +9761,7 @@
|
|
|
9375
9761
|
"name": "McpServer",
|
|
9376
9762
|
"kind": "interface",
|
|
9377
9763
|
"package": "@nifrajs/mcp",
|
|
9378
|
-
"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 /**\n * Release server-owned resources, when the implementation has any (for example a database worker).\n * Calling it more than once is safe. The base MCP server has nothing to release and omits this hook.\n */\n readonly close?: () => Promise<void>;\n}"
|
|
9764
|
+
"signature": "export interface McpServer {\n readonly tools: McpTool[];\n readonly features: McpServerFeatures;\n readonly serverInfo: {\n name: string;\n version: string;\n };\n /** Web `fetch` handler - mount at `POST /mcp` (GET is a health page, OPTIONS the CORS preflight). */\n fetch(request: Request, overrides?: Pick<McpHttpOptions, \"authorizeMessage\" | \"state\" | \"resolveState\">): Promise<Response>;\n /** Dispatch one JSON-RPC message directly (no HTTP) - for headless verification and unit tests. */\n handle(message: JsonRpcRequest): Promise<JsonRpcResponse | null>;\n /**\n * Release server-owned resources, when the implementation has any (for example a database worker).\n * Calling it more than once is safe. The base MCP server has nothing to release and omits this hook.\n */\n readonly close?: () => Promise<void>;\n}"
|
|
9379
9765
|
},
|
|
9380
9766
|
{
|
|
9381
9767
|
"name": "McpServerConfig",
|
|
@@ -9608,7 +9994,7 @@
|
|
|
9608
9994
|
"name": "MemoryIdempotencyStore",
|
|
9609
9995
|
"kind": "class",
|
|
9610
9996
|
"package": "@nifrajs/middleware",
|
|
9611
|
-
"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<
|
|
9997
|
+
"signature": "export declare class MemoryIdempotencyStore implements IdempotencyStore {\n private readonly entries;\n private readonly maxEntries;\n private readonly maxKeyBytes;\n constructor(options?: MemoryIdempotencyStoreOptions);\n private validateKey;\n private maintain;\n private reserve;\n begin(key: string, lockTtlMs: number): Promise<IdempotencyClaim>;\n complete(key: string, reservation: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;\n release(key: string, reservation: string): Promise<boolean>;\n}",
|
|
9612
9998
|
"doc": "/** In-process store. Refuses to run in production unless explicitly allowed (per-instance ⇒ no cross-instance dedupe). */"
|
|
9613
9999
|
},
|
|
9614
10000
|
{
|
|
@@ -10057,7 +10443,7 @@
|
|
|
10057
10443
|
"name": "MountA2AOptions",
|
|
10058
10444
|
"kind": "interface",
|
|
10059
10445
|
"package": "@nifrajs/a2a",
|
|
10060
|
-
"signature": "export interface MountA2AOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n readonly card: A2ACardInfo;\n /** JSON-RPC endpoint path. Default `/a2a`. */\n readonly path?: string;\n /** Agent card path. Default `/.well-known/agent-card.json`. */\n readonly cardPath?: string;\n /** Bounded run length passed to the runner. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /**\n * Build the ports for one request - the model, durable state store, approval transport,\n * capabilities, and budgets. Receives the route context so the caller can scope every port to the\n * request subject.\n */\n readonly ports: (c: A2ARouteContext) => AgentPorts | Promise<AgentPorts>;\n}"
|
|
10446
|
+
"signature": "export interface MountA2AOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n readonly card: A2ACardInfo;\n /** JSON-RPC endpoint path. Default `/a2a`. */\n readonly path?: string;\n /** Agent card path. Default `/.well-known/agent-card.json`. */\n readonly cardPath?: string;\n /** Bounded run length passed to the runner. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Maximum total UTF-8 bytes emitted by one response. Default 4 MiB. */\n readonly maxOutputBytes?: number;\n /**\n * Build the ports for one request - the model, durable state store, approval transport,\n * capabilities, and budgets. Receives the route context so the caller can scope every port to the\n * request subject.\n */\n readonly ports: (c: A2ARouteContext) => AgentPorts | Promise<AgentPorts>;\n}"
|
|
10061
10447
|
},
|
|
10062
10448
|
{
|
|
10063
10449
|
"name": "mountAgent",
|
|
@@ -10083,7 +10469,7 @@
|
|
|
10083
10469
|
"name": "MountAgUIOptions",
|
|
10084
10470
|
"kind": "interface",
|
|
10085
10471
|
"package": "@nifrajs/ag-ui",
|
|
10086
|
-
"signature": "export interface MountAgUIOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n /** Endpoint path. Default `/agui`. */\n readonly path?: string;\n /** Bounded run length passed to the runner. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /**\n * Build the ports for one request - the model, durable state store, approval transport,\n * capabilities, and budgets. Receives the route context so the caller can scope every port to\n * the request subject, and the run context carrying the turn id and the shared UI state channel.\n */\n readonly ports: (c: AgUIRouteContext, run: AgUIRunContext) => AgentPorts | Promise<AgentPorts>;\n /**\n * Evidence log making the SSE stream resumable via `Last-Event-ID`. The in-memory reference\n * (`createMemoryAgentEvidenceLog`) is single-process; a durable log is an adapter concern.\n */\n readonly evidenceLog?: AgentEvidenceLog;\n /**\n * Emit a `MESSAGES_SNAPSHOT` (the request's `messages` plus the assistant output message)\n * before `RUN_FINISHED` on a successful completion. Default `false`: the snapshot echoes\n * client-sent message payloads, and terminal events are persisted to the evidence log when one\n * is configured - leave it off unless the client relies on an authoritative snapshot.\n */\n readonly emitMessagesSnapshot?: boolean;\n}"
|
|
10472
|
+
"signature": "export interface MountAgUIOptions<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1> {\n readonly agent: AgentDefinition<InputSchema, OutputSchema>;\n /** Endpoint path. Default `/agui`. */\n readonly path?: string;\n /** Bounded run length passed to the runner. */\n readonly maxTurns?: number;\n /** Maximum request body size in bytes. Default 1_000_000. */\n readonly maxBodyBytes?: number;\n /** Prototype-poisoning policy for the framing lane. Default `\"reject\"`. */\n readonly protoPoisoning?: ProtoPoisoning;\n /** Maximum total UTF-8 bytes emitted by one SSE response. Default 4 MiB. */\n readonly maxOutputBytes?: number;\n /**\n * Build the ports for one request - the model, durable state store, approval transport,\n * capabilities, and budgets. Receives the route context so the caller can scope every port to\n * the request subject, and the run context carrying the turn id and the shared UI state channel.\n */\n readonly ports: (c: AgUIRouteContext, run: AgUIRunContext) => AgentPorts | Promise<AgentPorts>;\n /**\n * Evidence log making the SSE stream resumable via `Last-Event-ID`. The in-memory reference\n * (`createMemoryAgentEvidenceLog`) is single-process; a durable log is an adapter concern.\n */\n readonly evidenceLog?: AgentEvidenceLog;\n /**\n * Emit a `MESSAGES_SNAPSHOT` (the request's `messages` plus the assistant output message)\n * before `RUN_FINISHED` on a successful completion. Default `false`: the snapshot echoes\n * client-sent message payloads, and terminal events are persisted to the evidence log when one\n * is configured - leave it off unless the client relies on an authoritative snapshot.\n */\n readonly emitMessagesSnapshot?: boolean;\n}"
|
|
10087
10473
|
},
|
|
10088
10474
|
{
|
|
10089
10475
|
"name": "mountGraphql",
|
|
@@ -10528,7 +10914,7 @@
|
|
|
10528
10914
|
"name": "NifraBackend",
|
|
10529
10915
|
"kind": "class",
|
|
10530
10916
|
"package": "@nifrajs/coding-agent",
|
|
10531
|
-
"signature": "export declare class NifraBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly sessions;\n private readonly pendingApprovals;\n constructor(options: NifraBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean, reason?: string): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private run;\n private consumeModel;\n private finish;\n private requestApproval;\n private settleApproval;\n private emit;\n private update;\n private requireSession;\n private now;\n}",
|
|
10917
|
+
"signature": "export declare class NifraBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly sessions;\n private readonly pendingApprovals;\n constructor(options: NifraBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean, reason?: string): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private run;\n private consumeModel;\n private finish;\n private requestApproval;\n private settleApproval;\n private cancelTurn;\n private clearTurnSignal;\n private clearTurn;\n private isCurrentTurn;\n private assertCurrentTurn;\n private emit;\n private update;\n private requireSession;\n private now;\n}",
|
|
10532
10918
|
"doc": "/**\n * Small provider port for a future Nifra-native backend.\n *\n * It deliberately knows only messages, tools, and the protocol. Provider SDKs, credentials, UI,\n * and framework packages stay outside this module. A model may return one response or stream\n * deltas followed by a final response.\n */"
|
|
10533
10919
|
},
|
|
10534
10920
|
{
|
|
@@ -10785,6 +11171,13 @@
|
|
|
10785
11171
|
"package": "@nifrajs/node",
|
|
10786
11172
|
"signature": "export interface NodeServer {\n /** The bound port (resolved when `port: 0` is requested). */\n readonly port: number;\n /**\n * Stop accepting connections, let in-flight requests drain (up to `drainMs`), then\n * force-close stragglers + idle keep-alives. Mirrors nifra's Bun `stop()`.\n */\n stop(options?: {\n drainMs?: number;\n }): Promise<void>;\n}"
|
|
10787
11173
|
},
|
|
11174
|
+
{
|
|
11175
|
+
"name": "NonceResolver",
|
|
11176
|
+
"kind": "type",
|
|
11177
|
+
"package": "@nifrajs/web",
|
|
11178
|
+
"signature": "export type NonceResolver<Env = unknown> = (ctx: {\n readonly request: Request;\n readonly env: Env;\n}) => string | undefined | Promise<string | undefined>;",
|
|
11179
|
+
"doc": "/** Resolve the CSP nonce for one document request. Return `undefined` to omit nonce attributes. */"
|
|
11180
|
+
},
|
|
10788
11181
|
{
|
|
10789
11182
|
"name": "noopArtifactPort",
|
|
10790
11183
|
"kind": "function",
|
|
@@ -10792,6 +11185,13 @@
|
|
|
10792
11185
|
"signature": "export declare function noopArtifactPort(): ArtifactPort;",
|
|
10793
11186
|
"doc": "/**\n * Hashes the payload for a content-free {@link ArtifactRef}, then discards the bytes. The default\n * port: public code sees only the digest, size, and coordinates - never the payload.\n */"
|
|
10794
11187
|
},
|
|
11188
|
+
{
|
|
11189
|
+
"name": "normalizeCssLoading",
|
|
11190
|
+
"kind": "function",
|
|
11191
|
+
"package": "@nifrajs/web",
|
|
11192
|
+
"signature": "export declare function normalizeCssLoading(value: unknown): CssLoadingMode;",
|
|
11193
|
+
"doc": "/** Runtime validation for JavaScript callers, generated manifests, and hand-authored integrations. */"
|
|
11194
|
+
},
|
|
10795
11195
|
{
|
|
10796
11196
|
"name": "normalizeEffectMetadata",
|
|
10797
11197
|
"kind": "function",
|
|
@@ -10928,6 +11328,13 @@
|
|
|
10928
11328
|
"package": "@nifrajs/schema",
|
|
10929
11329
|
"signature": "export interface OpenAPIDocument {\n readonly openapi: \"3.1.0\";\n readonly info: OpenAPIInfo;\n readonly paths: Record<string, Record<string, OpenAPIOperation>>;\n readonly servers?: readonly OpenAPIServer[];\n readonly tags?: readonly OpenAPITag[];\n readonly security?: readonly SecurityRequirement[];\n readonly components?: OpenAPIComponents;\n}"
|
|
10930
11330
|
},
|
|
11331
|
+
{
|
|
11332
|
+
"name": "OpenAPIImportError",
|
|
11333
|
+
"kind": "class",
|
|
11334
|
+
"package": "@nifrajs/schema",
|
|
11335
|
+
"signature": "export declare class OpenAPIImportError extends Error {\n constructor(message: string);\n}",
|
|
11336
|
+
"doc": "/**\n * OpenAPI 3.x inventory import - the structural half of an export/import roundtrip.\n *\n * `toOpenAPI` renders a Nifra app (or contract) as an OpenAPI 3.1 document. This module reads such\n * a document back into a canonical route inventory: method, Nifra-templated path (`{id}` back to\n * `:id`), required query names, body presence, and response statuses. `diffOpenApiInventory` then\n * compares two inventories, so `export -> import -> diff` proves the cycle survives in CI.\n *\n * Deliberate boundaries, all fail-closed or explicitly documented:\n *\n * - Offline and ref-opaque. `$ref`s are never resolved and nothing is fetched. A `$ref` parameter\n * cannot yield a name without resolution, so it throws with the location; `$ref` bodies and\n * response schemas only assert presence, which needs no resolution.\n * - No schema reconstruction. JSON Schema is not turned back into `t` builders here - that is a\n * separate codegen step needing consumer evidence. The inventory proves the route table survived;\n * field-level types ride along in the source document, not in this comparison.\n * - No auth interpretation. `security`, `securitySchemes`, and `servers` are never read. Importing\n * an API must not silently adopt its auth model.\n * - Templated paths degrade conservatively. `/files/*path` exports as `/files/{path}`, indistinguishable\n * from a single-segment `:path`. Import yields `:path` and records a note for every OpenAPI template;\n * a greedy remainder needs a manual `*path` rewrite.\n * - Nifra parameter names follow `/^[A-Za-z_][A-Za-z0-9_]*$/`; `__proto__`, `constructor`, and\n * `prototype` are rejected. Mixed templates are converted only when their boundaries are representable.\n * - Bounded. Path/operation/parameter counts are capped (`ImportOpenAPIOptions`); a document over\n * the caps throws rather than allocating.\n */"
|
|
11337
|
+
},
|
|
10931
11338
|
{
|
|
10932
11339
|
"name": "OpenApiInfo",
|
|
10933
11340
|
"kind": "interface",
|
|
@@ -10941,6 +11348,12 @@
|
|
|
10941
11348
|
"signature": "export interface OpenAPIInfo {\n readonly title: string;\n readonly version: string;\n readonly description?: string;\n}",
|
|
10942
11349
|
"doc": "/**\n * OpenAPI 3.1 generation. We model a practical slice of the spec - enough to feed Swagger UI / codegen\n * and to validate structurally: paths, parameters, request bodies, responses (incl. non-200 and\n * non-JSON), tags, security, servers, and `$ref` reuse via `components.schemas`.\n *\n * Schemas carry full detail only for `t`/TypeBox inputs (they expose a JSON Schema); a BYO Standard\n * Schema validates at runtime but exposes no JSON Schema, so its route is emitted without body/response\n * detail. A **contract** is richest - its operations carry `response`, `tags`, `security`, additional\n * `responses`, etc.; an **app** emits request shapes + a generic `200` (an inline handler has no\n * response *schema* to serialize), enrichable via `options.operations`.\n */"
|
|
10943
11350
|
},
|
|
11351
|
+
{
|
|
11352
|
+
"name": "OpenApiInventoryDrift",
|
|
11353
|
+
"kind": "interface",
|
|
11354
|
+
"package": "@nifrajs/schema",
|
|
11355
|
+
"signature": "export interface OpenApiInventoryDrift {\n /** `METHOD /path`, or `inventory` for route-set level drift. */\n readonly route: string;\n readonly message: string;\n}"
|
|
11356
|
+
},
|
|
10944
11357
|
{
|
|
10945
11358
|
"name": "OpenApiOptions",
|
|
10946
11359
|
"kind": "interface",
|
|
@@ -11235,14 +11648,14 @@
|
|
|
11235
11648
|
"kind": "function",
|
|
11236
11649
|
"package": "@nifrajs/core",
|
|
11237
11650
|
"signature": "export declare function parseCookies(header: string | null | undefined): Record<string, string>;",
|
|
11238
|
-
"doc": "/** Parse a request `Cookie` header into a name→value map (values URL-decoded). Unparseable pairs are\n * skipped rather than throwing - a junk `Cookie` header shouldn't fail the request.\n *\n * Hand-rolled index walk instead of `split(\";\")` + `trim()` chains: those allocated an array + up\n * to three substrings per pair and showed up at ~6% of a realistic (auth + cookie) request. Same\n * semantics, two slices per pair, no intermediate array. */"
|
|
11651
|
+
"doc": "/** Parse a request `Cookie` header into a name→value map (values URL-decoded). Unparseable pairs are\n * skipped rather than throwing - a junk `Cookie` header shouldn't fail the request.\n *\n * Hand-rolled index walk instead of `split(\";\")` + `trim()` chains: those allocated an array + up\n * to three substrings per pair and showed up at ~6% of a realistic (auth + cookie) request. Same\n * semantics, two slices per pair, no intermediate array. Duplicate names use the first value\n * deterministically; security-sensitive callers can use {@link hasDuplicateCookie} and fail closed. */"
|
|
11239
11652
|
},
|
|
11240
11653
|
{
|
|
11241
11654
|
"name": "parseCookies",
|
|
11242
11655
|
"kind": "function",
|
|
11243
11656
|
"package": "nifra",
|
|
11244
11657
|
"signature": "export declare function parseCookies(header: string | null | undefined): Record<string, string>;",
|
|
11245
|
-
"doc": "/** Parse a request `Cookie` header into a name→value map (values URL-decoded). Unparseable pairs are\n * skipped rather than throwing - a junk `Cookie` header shouldn't fail the request.\n *\n * Hand-rolled index walk instead of `split(\";\")` + `trim()` chains: those allocated an array + up\n * to three substrings per pair and showed up at ~6% of a realistic (auth + cookie) request. Same\n * semantics, two slices per pair, no intermediate array. */"
|
|
11658
|
+
"doc": "/** Parse a request `Cookie` header into a name→value map (values URL-decoded). Unparseable pairs are\n * skipped rather than throwing - a junk `Cookie` header shouldn't fail the request.\n *\n * Hand-rolled index walk instead of `split(\";\")` + `trim()` chains: those allocated an array + up\n * to three substrings per pair and showed up at ~6% of a realistic (auth + cookie) request. Same\n * semantics, two slices per pair, no intermediate array. Duplicate names use the first value\n * deterministically; security-sensitive callers can use {@link hasDuplicateCookie} and fail closed. */"
|
|
11246
11659
|
},
|
|
11247
11660
|
{
|
|
11248
11661
|
"name": "parseCron",
|
|
@@ -11309,7 +11722,7 @@
|
|
|
11309
11722
|
"name": "parseEventStream",
|
|
11310
11723
|
"kind": "function",
|
|
11311
11724
|
"package": "@nifrajs/agent-app",
|
|
11312
|
-
"signature": "export declare function parseEventStream(body: ReadableStream<Uint8Array>, method: string): AsyncIterable<AgentEvent>;",
|
|
11725
|
+
"signature": "export declare function parseEventStream(body: ReadableStream<Uint8Array>, method: string, maxFrameBytes?: number): AsyncIterable<AgentEvent>;",
|
|
11313
11726
|
"doc": "/** Parse an SSE body into protocol events, skipping any frame whose data is not a valid event. */"
|
|
11314
11727
|
},
|
|
11315
11728
|
{
|
|
@@ -11347,6 +11760,13 @@
|
|
|
11347
11760
|
"signature": "export declare function parseManifestClientEntry(source: string): string | undefined;",
|
|
11348
11761
|
"doc": "/** The baked `clientEntry` URL in a committed server-manifest, or `undefined` if absent. Pure. */"
|
|
11349
11762
|
},
|
|
11763
|
+
{
|
|
11764
|
+
"name": "parseManifestCssLoading",
|
|
11765
|
+
"kind": "function",
|
|
11766
|
+
"package": "@nifrajs/web",
|
|
11767
|
+
"signature": "export declare function parseManifestCssLoading(source: string): CssLoadingMode | undefined;",
|
|
11768
|
+
"doc": "/** The baked framework stylesheet activation mode, or `undefined` for an older manifest. Pure. */"
|
|
11769
|
+
},
|
|
11350
11770
|
{
|
|
11351
11771
|
"name": "parseManifestRouteFiles",
|
|
11352
11772
|
"kind": "function",
|
|
@@ -11402,6 +11822,13 @@
|
|
|
11402
11822
|
"package": "@nifrajs/core",
|
|
11403
11823
|
"signature": "export declare function parseReplayFile(value: unknown): ReplayFile;"
|
|
11404
11824
|
},
|
|
11825
|
+
{
|
|
11826
|
+
"name": "parseReviewReport",
|
|
11827
|
+
"kind": "function",
|
|
11828
|
+
"package": "@nifrajs/agent-review",
|
|
11829
|
+
"signature": "export declare function parseReviewReport(input: unknown): Promise<ReviewReport>;",
|
|
11830
|
+
"doc": "/** Parse a JSON string or unknown value into a bounded, deeply frozen review report. */"
|
|
11831
|
+
},
|
|
11405
11832
|
{
|
|
11406
11833
|
"name": "parseRubricVerdict",
|
|
11407
11834
|
"kind": "function",
|
|
@@ -11503,6 +11930,13 @@
|
|
|
11503
11930
|
"signature": "export declare function parseTraceparent(header: string | null | undefined): ParsedTraceparent | null;",
|
|
11504
11931
|
"doc": "/**\n * Parse a `traceparent` header, or `null` if it's absent/malformed/version-unknown - per the spec,\n * a bad header means \"start a fresh trace\", never an error. Only version `00` is accepted.\n */"
|
|
11505
11932
|
},
|
|
11933
|
+
{
|
|
11934
|
+
"name": "parseTransportContentLength",
|
|
11935
|
+
"kind": "function",
|
|
11936
|
+
"package": "@nifrajs/agent-protocol",
|
|
11937
|
+
"signature": "export declare function parseTransportContentLength(value: string | null): number | undefined;",
|
|
11938
|
+
"doc": "/** Parse a decimal Content-Length without allowing malformed or unsafe values to pass as a size. */"
|
|
11939
|
+
},
|
|
11506
11940
|
{
|
|
11507
11941
|
"name": "pathnameOf",
|
|
11508
11942
|
"kind": "function",
|
|
@@ -11532,27 +11966,27 @@
|
|
|
11532
11966
|
"name": "PiBackend",
|
|
11533
11967
|
"kind": "class",
|
|
11534
11968
|
"package": "@nifrajs/coding-agent",
|
|
11535
|
-
"signature": "export declare class PiBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly sessions;\n constructor(options?: PiBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private requireSession;\n private spawnProcess;\n private attachProcess;\n private readStdout;\n private readStderr;\n private consumeText;\n private consumeRecord;\n private emit;\n private updateSnapshot;\n private failActive;\n private finishTurn;\n}",
|
|
11969
|
+
"signature": "export declare class PiBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly maxRecordBytes;\n private readonly maxMessageChars;\n private readonly sessions;\n constructor(options?: PiBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private requireSession;\n private spawnProcess;\n private attachProcess;\n private readStdout;\n private readStderr;\n private consumeText;\n private consumeRecord;\n private emit;\n private updateSnapshot;\n private failActive;\n private finishTurn;\n private cancelTurn;\n private clearTurnSignal;\n private clearTurn;\n}",
|
|
11536
11970
|
"doc": "/**\n * Spawn Pi in its documented JSONL RPC mode and translate its events into the Nifra protocol.\n *\n * This adapter intentionally talks to the public Pi process protocol instead of importing Pi into\n * any Nifra framework package. A future SDK adapter can implement the same AgentBackend contract.\n */"
|
|
11537
11971
|
},
|
|
11538
11972
|
{
|
|
11539
11973
|
"name": "PiBackend",
|
|
11540
11974
|
"kind": "class",
|
|
11541
11975
|
"package": "@nifrajs/pi",
|
|
11542
|
-
"signature": "export declare class PiBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly sessions;\n constructor(options?: PiBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private requireSession;\n private spawnProcess;\n private attachProcess;\n private readStdout;\n private readStderr;\n private consumeText;\n private consumeRecord;\n private emit;\n private updateSnapshot;\n private failActive;\n private finishTurn;\n}",
|
|
11976
|
+
"signature": "export declare class PiBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly options;\n private readonly maxRecordBytes;\n private readonly maxMessageChars;\n private readonly sessions;\n constructor(options?: PiBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n resolveApproval(sessionId: string, approvalId: string, approved: boolean): Promise<boolean | undefined>;\n close(sessionId: string): Promise<void>;\n private requireSession;\n private spawnProcess;\n private attachProcess;\n private readStdout;\n private readStderr;\n private consumeText;\n private consumeRecord;\n private emit;\n private updateSnapshot;\n private failActive;\n private finishTurn;\n private cancelTurn;\n private clearTurnSignal;\n private clearTurn;\n}",
|
|
11543
11977
|
"doc": "/**\n * Spawn Pi in its documented JSONL RPC mode and translate its events into the Nifra protocol.\n *\n * This adapter intentionally talks to the public Pi process protocol instead of importing Pi into\n * any Nifra framework package. A future SDK adapter can implement the same AgentBackend contract.\n */"
|
|
11544
11978
|
},
|
|
11545
11979
|
{
|
|
11546
11980
|
"name": "PiBackendOptions",
|
|
11547
11981
|
"kind": "interface",
|
|
11548
11982
|
"package": "@nifrajs/coding-agent",
|
|
11549
|
-
"signature": "export interface PiBackendOptions {\n /** Defaults to `pi`, resolved through PATH. */\n readonly command?: string;\n /** Extra arguments appended after `--mode rpc`. */\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string | undefined>>;\n readonly sessionDir?: string;\n readonly noSession?: boolean;\n /** Override the generated Pi flags for a test double or a compatible RPC executable. */\n readonly rpcArgs?: readonly string[];\n /**\n * Reload transport. Pi's documented RPC protocol uses a slash command bridged by a tiny\n * extension; compatible RPC implementations may opt into their legacy top-level command.\n */\n readonly reloadCommand?: \"restart\" | \"prompt\" | \"rpc\";\n /** Load the tiny public-API reload bridge. Defaults to true for generated Pi processes. */\n readonly enableReloadBridge?: boolean;\n readonly maxEventQueueSize?: number;\n /** Optional project instructions passed through Pi's documented append-system-prompt flag. */\n readonly appendSystemPrompt?: string;\n /** Opt-in loading of the separately packaged Nifra verification tools extension. */\n readonly enableNifraTools?: boolean;\n}"
|
|
11983
|
+
"signature": "export interface PiBackendOptions {\n /** Defaults to `pi`, resolved through PATH. */\n readonly command?: string;\n /** Extra arguments appended after `--mode rpc`. */\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string | undefined>>;\n readonly sessionDir?: string;\n readonly noSession?: boolean;\n /** Override the generated Pi flags for a test double or a compatible RPC executable. */\n readonly rpcArgs?: readonly string[];\n /**\n * Reload transport. Pi's documented RPC protocol uses a slash command bridged by a tiny\n * extension; compatible RPC implementations may opt into their legacy top-level command.\n */\n readonly reloadCommand?: \"restart\" | \"prompt\" | \"rpc\";\n /** Load the tiny public-API reload bridge. Defaults to true for generated Pi processes. */\n readonly enableReloadBridge?: boolean;\n readonly maxEventQueueSize?: number;\n /** Maximum UTF-8 bytes accepted for one Pi JSONL record. Defaults to 1 MiB. */\n readonly maxRecordBytes?: number;\n /** Maximum prompt characters accepted by the adapter. Defaults to 64 KiB. */\n readonly maxMessageChars?: number;\n /** Optional project instructions passed through Pi's documented append-system-prompt flag. */\n readonly appendSystemPrompt?: string;\n /** Opt-in loading of the separately packaged Nifra verification tools extension. */\n readonly enableNifraTools?: boolean;\n}"
|
|
11550
11984
|
},
|
|
11551
11985
|
{
|
|
11552
11986
|
"name": "PiBackendOptions",
|
|
11553
11987
|
"kind": "interface",
|
|
11554
11988
|
"package": "@nifrajs/pi",
|
|
11555
|
-
"signature": "export interface PiBackendOptions {\n /** Defaults to `pi`, resolved through PATH. */\n readonly command?: string;\n /** Extra arguments appended after `--mode rpc`. */\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string | undefined>>;\n readonly sessionDir?: string;\n readonly noSession?: boolean;\n /** Override the generated Pi flags for a test double or a compatible RPC executable. */\n readonly rpcArgs?: readonly string[];\n /**\n * Reload transport. Pi's documented RPC protocol uses a slash command bridged by a tiny\n * extension; compatible RPC implementations may opt into their legacy top-level command.\n */\n readonly reloadCommand?: \"restart\" | \"prompt\" | \"rpc\";\n /** Load the tiny public-API reload bridge. Defaults to true for generated Pi processes. */\n readonly enableReloadBridge?: boolean;\n readonly maxEventQueueSize?: number;\n /** Optional project instructions passed through Pi's documented append-system-prompt flag. */\n readonly appendSystemPrompt?: string;\n /** Opt-in loading of the separately packaged Nifra verification tools extension. */\n readonly enableNifraTools?: boolean;\n}"
|
|
11989
|
+
"signature": "export interface PiBackendOptions {\n /** Defaults to `pi`, resolved through PATH. */\n readonly command?: string;\n /** Extra arguments appended after `--mode rpc`. */\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string | undefined>>;\n readonly sessionDir?: string;\n readonly noSession?: boolean;\n /** Override the generated Pi flags for a test double or a compatible RPC executable. */\n readonly rpcArgs?: readonly string[];\n /**\n * Reload transport. Pi's documented RPC protocol uses a slash command bridged by a tiny\n * extension; compatible RPC implementations may opt into their legacy top-level command.\n */\n readonly reloadCommand?: \"restart\" | \"prompt\" | \"rpc\";\n /** Load the tiny public-API reload bridge. Defaults to true for generated Pi processes. */\n readonly enableReloadBridge?: boolean;\n readonly maxEventQueueSize?: number;\n /** Maximum UTF-8 bytes accepted for one Pi JSONL record. Defaults to 1 MiB. */\n readonly maxRecordBytes?: number;\n /** Maximum prompt characters accepted by the adapter. Defaults to 64 KiB. */\n readonly maxMessageChars?: number;\n /** Optional project instructions passed through Pi's documented append-system-prompt flag. */\n readonly appendSystemPrompt?: string;\n /** Opt-in loading of the separately packaged Nifra verification tools extension. */\n readonly enableNifraTools?: boolean;\n}"
|
|
11556
11990
|
},
|
|
11557
11991
|
{
|
|
11558
11992
|
"name": "pickLanguage",
|
|
@@ -11813,24 +12247,111 @@
|
|
|
11813
12247
|
"signature": "export declare const preactDedupePlugin: (from: string) => BunPlugin;"
|
|
11814
12248
|
},
|
|
11815
12249
|
{
|
|
11816
|
-
"name": "
|
|
12250
|
+
"name": "PredictedExecutionResult",
|
|
11817
12251
|
"kind": "interface",
|
|
11818
|
-
"package": "@nifrajs/
|
|
11819
|
-
"signature": "export interface
|
|
11820
|
-
"doc": "/** Minimal app surface the driver needs - just a fetch handler (a built `createWebApp`). */"
|
|
12252
|
+
"package": "@nifrajs/webmcp",
|
|
12253
|
+
"signature": "export interface PredictedExecutionResult<Output, State> {\n readonly outcome: \"committed\" | \"rolled-back\" | \"conflicted\" | \"expired\" | \"stale\" | \"invalid\" | \"executed\";\n readonly predictionId?: string;\n readonly prediction?: AgentSurfacePrediction;\n readonly tool?: ToolCallResult<Output>;\n readonly snapshot: PredictionStoreSnapshot<State>;\n}"
|
|
11821
12254
|
},
|
|
11822
12255
|
{
|
|
11823
|
-
"name": "
|
|
11824
|
-
"kind": "
|
|
11825
|
-
"package": "@nifrajs/
|
|
11826
|
-
"signature": "export
|
|
11827
|
-
"doc": "/** Minimal app surface `buildTarget`'s static path needs - a fetch handler (a built `createWebApp`). */"
|
|
12256
|
+
"name": "PREDICTION_LAB_SEED",
|
|
12257
|
+
"kind": "const",
|
|
12258
|
+
"package": "@nifrajs/testing",
|
|
12259
|
+
"signature": "export declare const PREDICTION_LAB_SEED = 1347568964;"
|
|
11828
12260
|
},
|
|
11829
12261
|
{
|
|
11830
|
-
"name": "
|
|
11831
|
-
"kind": "
|
|
11832
|
-
"package": "@nifrajs/
|
|
11833
|
-
"signature": "export
|
|
12262
|
+
"name": "predictionLabCaseIds",
|
|
12263
|
+
"kind": "const",
|
|
12264
|
+
"package": "@nifrajs/testing",
|
|
12265
|
+
"signature": "export declare const predictionLabCaseIds: readonly string[];",
|
|
12266
|
+
"doc": "/** Stable case IDs in run order. */"
|
|
12267
|
+
},
|
|
12268
|
+
{
|
|
12269
|
+
"name": "PredictionLabContext",
|
|
12270
|
+
"kind": "interface",
|
|
12271
|
+
"package": "@nifrajs/testing",
|
|
12272
|
+
"signature": "export interface PredictionLabContext {\n readonly seed: number;\n readonly caseId: string;\n readonly target: PredictionLabTarget;\n readonly mutation?: string;\n}"
|
|
12273
|
+
},
|
|
12274
|
+
{
|
|
12275
|
+
"name": "PredictionLabOptions",
|
|
12276
|
+
"kind": "interface",
|
|
12277
|
+
"package": "@nifrajs/testing",
|
|
12278
|
+
"signature": "export interface PredictionLabOptions {\n /** Replayable seed. Prediction IDs and clocks derive from it deterministically. */\n readonly seed?: number;\n /** Replay only these stable case IDs. */\n readonly only?: string | readonly string[];\n}"
|
|
12279
|
+
},
|
|
12280
|
+
{
|
|
12281
|
+
"name": "PredictionLabReplay",
|
|
12282
|
+
"kind": "interface",
|
|
12283
|
+
"package": "@nifrajs/testing",
|
|
12284
|
+
"signature": "export interface PredictionLabReplay {\n readonly seed: number;\n readonly caseId: string;\n}"
|
|
12285
|
+
},
|
|
12286
|
+
{
|
|
12287
|
+
"name": "PredictionLabReport",
|
|
12288
|
+
"kind": "interface",
|
|
12289
|
+
"package": "@nifrajs/testing",
|
|
12290
|
+
"signature": "export interface PredictionLabReport {\n readonly ok: boolean;\n readonly seed: number;\n readonly results: readonly PredictionLabResult[];\n readonly failures: readonly PredictionLabResult[];\n readonly counts: {\n readonly passed: number;\n readonly failed: number;\n };\n}"
|
|
12291
|
+
},
|
|
12292
|
+
{
|
|
12293
|
+
"name": "PredictionLabResult",
|
|
12294
|
+
"kind": "interface",
|
|
12295
|
+
"package": "@nifrajs/testing",
|
|
12296
|
+
"signature": "export interface PredictionLabResult {\n readonly id: string;\n readonly target: PredictionLabTarget;\n readonly mutation?: string;\n readonly ok: boolean;\n readonly message: string;\n readonly replay: PredictionLabReplay;\n}"
|
|
12297
|
+
},
|
|
12298
|
+
{
|
|
12299
|
+
"name": "PredictionLabTarget",
|
|
12300
|
+
"kind": "type",
|
|
12301
|
+
"package": "@nifrajs/testing",
|
|
12302
|
+
"signature": "export type PredictionLabTarget = \"prediction\" | \"projection\";",
|
|
12303
|
+
"doc": "/**\n * Seeded hostile corpus for predictions and projections - the prediction-side sibling of\n * `adversarial.ts`.\n *\n * `adversarial.ts` proves HTTP body/query/response contracts with validator-proven hostile\n * mutations. This module proves the same shaped guarantees one layer up: the `@nifrajs/webmcp`\n * prediction store (stale versions, expiry, prototype-grafting patches, non-atomic patches,\n * commit conflicts, reconcile/tool rollback) and the WebMCP-plus-MCP projection of one\n * capability (the same witness accepted or rejected identically on both surfaces).\n *\n * Every case has a stable ID, every run carries its replay seed, and every clock is injected -\n * nothing reads `Date.now` or `crypto.randomUUID` implicitly. `only` replays a subset by ID.\n *\n * Deliberately out of scope: A2A and AG-UI projections. Neither package exposes a same-contract\n * projection from a tool/capability (`a2a` has `agentCard`/`mountA2A` at the protocol level; there\n * is no `capability -> a2a/ag-ui` seam), so a parity case here would invent the seam it claims to\n * test. Proposing such a seam needs consumer evidence first (N7), not a lab that assumes it.\n */"
|
|
12304
|
+
},
|
|
12305
|
+
{
|
|
12306
|
+
"name": "PredictionPatchOperation",
|
|
12307
|
+
"kind": "type",
|
|
12308
|
+
"package": "@nifrajs/webmcp",
|
|
12309
|
+
"signature": "export type PredictionPatchOperation = {\n readonly op: \"add\" | \"replace\";\n readonly path: string;\n readonly value: unknown;\n} | {\n readonly op: \"remove\";\n readonly path: string;\n};",
|
|
12310
|
+
"doc": "/** The safe RFC 6902 subset accepted for speculative UI updates. */"
|
|
12311
|
+
},
|
|
12312
|
+
{
|
|
12313
|
+
"name": "PredictionStore",
|
|
12314
|
+
"kind": "interface",
|
|
12315
|
+
"package": "@nifrajs/webmcp",
|
|
12316
|
+
"signature": "export interface PredictionStore<State> {\n readonly snapshot: () => PredictionStoreSnapshot<State>;\n readonly predict: (predictionId: string, prediction: AgentSurfacePrediction, now?: number) => PredictionStoreResult<State>;\n readonly commit: (predictionId: string, authoritative: AgentSurfaceAuthoritativeState<State>, now?: number) => PredictionStoreResult<State>;\n readonly rollback: (predictionId: string) => PredictionStoreResult<State>;\n readonly expire: (now?: number) => readonly string[];\n readonly subscribe: (listener: (event: PredictionStoreEvent<State>) => void) => () => void;\n}"
|
|
12317
|
+
},
|
|
12318
|
+
{
|
|
12319
|
+
"name": "PredictionStoreEvent",
|
|
12320
|
+
"kind": "type",
|
|
12321
|
+
"package": "@nifrajs/webmcp",
|
|
12322
|
+
"signature": "export type PredictionStoreEvent<State> = {\n readonly type: \"predicted\";\n readonly predictionId: string;\n readonly snapshot: PredictionStoreSnapshot<State>;\n} | {\n readonly type: \"committed\";\n readonly predictionId: string;\n readonly snapshot: PredictionStoreSnapshot<State>;\n} | {\n readonly type: \"rolled-back\";\n readonly predictionId: string;\n readonly snapshot: PredictionStoreSnapshot<State>;\n} | {\n readonly type: \"conflicted\";\n readonly predictionId: string;\n readonly snapshot: PredictionStoreSnapshot<State>;\n} | {\n readonly type: \"expired\";\n readonly predictionId: string;\n readonly snapshot: PredictionStoreSnapshot<State>;\n};"
|
|
12323
|
+
},
|
|
12324
|
+
{
|
|
12325
|
+
"name": "PredictionStoreResult",
|
|
12326
|
+
"kind": "type",
|
|
12327
|
+
"package": "@nifrajs/webmcp",
|
|
12328
|
+
"signature": "export type PredictionStoreResult<State> = {\n readonly outcome: \"predicted\" | \"committed\" | \"rolled-back\" | \"conflicted\" | \"expired\" | \"stale\" | \"invalid\" | \"missing\";\n readonly predictionId: string;\n readonly snapshot: PredictionStoreSnapshot<State>;\n};"
|
|
12329
|
+
},
|
|
12330
|
+
{
|
|
12331
|
+
"name": "PredictionStoreSnapshot",
|
|
12332
|
+
"kind": "interface",
|
|
12333
|
+
"package": "@nifrajs/webmcp",
|
|
12334
|
+
"signature": "export interface PredictionStoreSnapshot<State> extends AgentSurfaceSnapshot<State> {\n readonly authoritativeVersion: string;\n readonly activePredictionIds: readonly string[];\n}"
|
|
12335
|
+
},
|
|
12336
|
+
{
|
|
12337
|
+
"name": "PrerenderApp",
|
|
12338
|
+
"kind": "interface",
|
|
12339
|
+
"package": "@nifrajs/web",
|
|
12340
|
+
"signature": "export interface PrerenderApp {\n fetch(req: Request): Response | Promise<Response>;\n}",
|
|
12341
|
+
"doc": "/** Minimal app surface the driver needs - just a fetch handler (a built `createWebApp`). */"
|
|
12342
|
+
},
|
|
12343
|
+
{
|
|
12344
|
+
"name": "PrerenderAppLike",
|
|
12345
|
+
"kind": "interface",
|
|
12346
|
+
"package": "@nifrajs/web",
|
|
12347
|
+
"signature": "export interface PrerenderAppLike {\n fetch(req: Request): Response | Promise<Response>;\n}",
|
|
12348
|
+
"doc": "/** Minimal app surface `buildTarget`'s static path needs - a fetch handler (a built `createWebApp`). */"
|
|
12349
|
+
},
|
|
12350
|
+
{
|
|
12351
|
+
"name": "PrerenderEntry",
|
|
12352
|
+
"kind": "interface",
|
|
12353
|
+
"package": "@nifrajs/web",
|
|
12354
|
+
"signature": "export interface PrerenderEntry {\n /** The route pattern that was prerendered (e.g. `/`, `/about`). */\n readonly path: string;\n /** The written file, relative to `outDir` (e.g. `index.html`, `about/index.html`). */\n readonly file: string;\n /** Byte length of the written HTML. */\n readonly bytes: number;\n /** The loader-data file written alongside (`<path>/_data.json`) so a client soft-nav INTO this\n * route skips the worker. Absent when the data-mode response is NDJSON (a deferred loader). */\n readonly dataFile?: string;\n}"
|
|
11834
12355
|
},
|
|
11835
12356
|
{
|
|
11836
12357
|
"name": "PrerenderOptions",
|
|
@@ -11966,7 +12487,7 @@
|
|
|
11966
12487
|
"name": "ProjectEvidenceOptions",
|
|
11967
12488
|
"kind": "interface",
|
|
11968
12489
|
"package": "@nifrajs/core",
|
|
11969
|
-
"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}"
|
|
12490
|
+
"signature": "export interface ProjectEvidenceOptions {\n readonly assurance?: AssuranceReport;\n readonly capabilities?: CapabilityAssuranceReport;\n /**\n * An existing reflection pass. Supplying it lets several offline projections share one pass\n * without asking the runtime source for `.routes()` again. Validators are consumed only while\n * building the token-only snapshot and never cross this seam.\n */\n readonly routes?: readonly ReflectedRoute[];\n /** Optional static source locations keyed by `${METHOD}\\n${path}`. */\n readonly sourceLocations?: ReadonlyMap<string, readonly ProjectEvidenceSourceLocation[]>;\n}"
|
|
11970
12491
|
},
|
|
11971
12492
|
{
|
|
11972
12493
|
"name": "ProjectEvidenceRoute",
|
|
@@ -12003,7 +12524,7 @@
|
|
|
12003
12524
|
"name": "ProjectFacts",
|
|
12004
12525
|
"kind": "interface",
|
|
12005
12526
|
"package": "@nifrajs/cli",
|
|
12006
|
-
"signature": "export interface ProjectFacts {\n readonly source: SourceIndex;\n readonly routes: readonly StaticRouteFinding[];\n readonly importGraph: readonly TransitiveServerImportFinding[];\n readonly packages: ProjectPackageFacts;\n readonly pipeline?: PipelineReport;\n readonly policies: ProjectPolicyFacts;\n readonly
|
|
12527
|
+
"signature": "export interface ProjectFacts {\n readonly source: SourceIndex;\n readonly routes: readonly StaticRouteFinding[];\n readonly importGraph: readonly TransitiveServerImportFinding[];\n readonly packages: ProjectPackageFacts;\n readonly pipeline?: PipelineReport;\n readonly policies: ProjectPolicyFacts;\n readonly check: ProjectCheckFacts;\n readonly sourceFindings: ProjectSourceFindings;\n}"
|
|
12007
12528
|
},
|
|
12008
12529
|
{
|
|
12009
12530
|
"name": "ProjectWorkGraphResult",
|
|
@@ -12293,6 +12814,13 @@
|
|
|
12293
12814
|
"package": "@nifrajs/jobs",
|
|
12294
12815
|
"signature": "export interface Queue {\n /** Register a typed job. Throws now (not at run time) on a duplicate name. */\n define<Payload>(name: string, definition: JobDefinition<Payload>): JobHandle<Payload>;\n /** Enqueue by name (the {@link JobHandle} is the typed alternative). */\n enqueue(name: string, payload: unknown, options?: EnqueueOptions): Promise<string>;\n /** Run ONE poll round: lease up to `concurrency` due jobs, run them, await them. Returns the count run.\n * Re-entrant-safe (a concurrent call returns the in-flight round). Used by `start()` and by Workers. */\n process(): Promise<number>;\n /** Process repeatedly until no job is due (one-shot batch drain). */\n drain(): Promise<number>;\n /** Start the background worker (Bun/Node/Deno). */\n start(options?: WorkerOptions): Worker;\n /** Current store counts. */\n counts(): JobCounts | Promise<JobCounts>;\n /** The underlying store (for dead-letter inspection, custom drivers). */\n readonly store: JobStore;\n}"
|
|
12295
12816
|
},
|
|
12817
|
+
{
|
|
12818
|
+
"name": "QueueHealth",
|
|
12819
|
+
"kind": "interface",
|
|
12820
|
+
"package": "@nifrajs/jobs",
|
|
12821
|
+
"signature": "export interface QueueHealth {\n readonly pending: number;\n readonly active: number;\n readonly dead: number;\n}",
|
|
12822
|
+
"doc": "/** Queue health counters. A straight passthrough of `JobStore.counts()` - counters are safe. */"
|
|
12823
|
+
},
|
|
12296
12824
|
{
|
|
12297
12825
|
"name": "QueueOptions",
|
|
12298
12826
|
"kind": "interface",
|
|
@@ -12446,6 +12974,13 @@
|
|
|
12446
12974
|
"package": "@nifrajs/coding-agent",
|
|
12447
12975
|
"signature": "export declare function readBoundedText(stream: ReadableStream<Uint8Array> | null | undefined | number, maxBytes: number): Promise<BoundedText>;"
|
|
12448
12976
|
},
|
|
12977
|
+
{
|
|
12978
|
+
"name": "readBoundedTransportBytes",
|
|
12979
|
+
"kind": "function",
|
|
12980
|
+
"package": "@nifrajs/agent-protocol",
|
|
12981
|
+
"signature": "export declare function readBoundedTransportBytes(body: ReadableStream<Uint8Array>, maxBytes: number): Promise<BoundedTransportRead>;",
|
|
12982
|
+
"doc": "/** Read a Web stream under one byte cap, canceling the source as soon as the cap is exceeded. */"
|
|
12983
|
+
},
|
|
12449
12984
|
{
|
|
12450
12985
|
"name": "readCausalityHeaders",
|
|
12451
12986
|
"kind": "function",
|
|
@@ -12523,6 +13058,12 @@
|
|
|
12523
13058
|
"package": "@nifrajs/core",
|
|
12524
13059
|
"signature": "export interface ReconciliationLeaseStore {\n readonly durability?: \"memory\" | \"durable\";\n acquire(input: {\n readonly name: string;\n readonly owner: string;\n readonly now: number;\n readonly leaseMs: number;\n }): ReconciliationLease | undefined | Promise<ReconciliationLease | undefined>;\n renew(input: {\n readonly name: string;\n readonly owner: string;\n readonly token: string;\n readonly now: number;\n readonly leaseMs: number;\n }): boolean | Promise<boolean>;\n checkpoint(input: {\n readonly name: string;\n readonly owner: string;\n readonly token: string;\n readonly cursor?: string;\n }): boolean | Promise<boolean>;\n release(input: {\n readonly name: string;\n readonly owner: string;\n readonly token: string;\n }): boolean | Promise<boolean>;\n}"
|
|
12525
13060
|
},
|
|
13061
|
+
{
|
|
13062
|
+
"name": "ReconciliationMode",
|
|
13063
|
+
"kind": "type",
|
|
13064
|
+
"package": "@nifrajs/webmcp",
|
|
13065
|
+
"signature": "export type ReconciliationMode = \"accept-server-state\" | \"reload\" | \"manual\";"
|
|
13066
|
+
},
|
|
12526
13067
|
{
|
|
12527
13068
|
"name": "ReconciliationPage",
|
|
12528
13069
|
"kind": "interface",
|
|
@@ -12680,6 +13221,13 @@
|
|
|
12680
13221
|
"package": "@nifrajs/core",
|
|
12681
13222
|
"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}"
|
|
12682
13223
|
},
|
|
13224
|
+
{
|
|
13225
|
+
"name": "reflectedRoutesFromEvidence",
|
|
13226
|
+
"kind": "function",
|
|
13227
|
+
"package": "@nifrajs/core",
|
|
13228
|
+
"signature": "export declare function reflectedRoutesFromEvidence(evidence: ProjectEvidenceSnapshot): readonly ReflectedRoute[];",
|
|
13229
|
+
"doc": "/**\n * Adapt the canonical token-only snapshot to the runtime-reflection shape used by projections.\n * The returned schemas deliberately have no `standard` validator: this adapter is for offline\n * contract views, not request validation or mock generation.\n */"
|
|
13230
|
+
},
|
|
12683
13231
|
{
|
|
12684
13232
|
"name": "ReflectedSchemaField",
|
|
12685
13233
|
"kind": "interface",
|
|
@@ -12728,6 +13276,13 @@
|
|
|
12728
13276
|
"signature": "export declare function registerSingleCopy(options?: SingleCopyOptions): SingleCopyPlan;",
|
|
12729
13277
|
"doc": "/**\n * Install the plugin into the Bun RUNTIME. Import `@nifrajs/core/single-copy/register` from a\n * `bunfig.toml` preload rather than calling this from application code: a resolver installed from\n * inside a module cannot affect the imports that module already resolved.\n */"
|
|
12730
13278
|
},
|
|
13279
|
+
{
|
|
13280
|
+
"name": "registerWebMcpTools",
|
|
13281
|
+
"kind": "function",
|
|
13282
|
+
"package": "@nifrajs/webmcp",
|
|
13283
|
+
"signature": "export declare function registerWebMcpTools(capabilities: readonly AgentCapabilityReference[], target?: WebMcpTarget | undefined, options?: WebMcpExecutionOptions): Promise<WebMcpRegistrationReport>;",
|
|
13284
|
+
"doc": "/** Register an explicit allowlist of capabilities, safely degrading on ordinary browsers. */"
|
|
13285
|
+
},
|
|
12731
13286
|
{
|
|
12732
13287
|
"name": "Registry",
|
|
12733
13288
|
"kind": "type",
|
|
@@ -12880,7 +13435,7 @@
|
|
|
12880
13435
|
"name": "RenderPageOptions",
|
|
12881
13436
|
"kind": "interface",
|
|
12882
13437
|
"package": "@nifrajs/web",
|
|
12883
|
-
"signature": "export interface RenderPageOptions {\n readonly adapter: RenderAdapter;\n /** The layout chain to render - outermost layout → page (opaque; the adapter renders it). */\n readonly chain: readonly unknown[];\n /** The loader output for this request. */\n readonly data: unknown;\n /** An action's data return (POST only) - surfaced to the page as `actionData` + serialized\n * for the client so post-POST hydration matches. Omit on GETs. */\n readonly actionData?: unknown;\n /**\n * URL of the built client entry (loaded as a module script).\n *\n * Optional ONLY on a `hydrate: false` page, where there is no client takeover to feed and this value\n * reaches no output at all. The union below is what enforces that: omitting it on a hydrating page\n * stays a compile error rather than rendering `src=\"\"`.\n */\n readonly clientEntry?: string;\n /** Chunk URLs for the **matched** route (its layout chain + own chunk) to `modulepreload` in the\n * shell - so the route code downloads in parallel with the entry instead of after it\n * (`buildClient`'s per-route map). Empty/omitted ⇒ only the entry is preloaded (unchanged). */\n readonly preload?: readonly string[];\n /** Stylesheet URLs for the **matched** route (its layout chain + own CSS, from `buildClient`'s\n * `BuildManifest.css`) - injected as `<link rel=\"stylesheet\">` in `<head>` so styles arrive with the\n * first paint (no FOUC). Rendered even on non-hydrated pages. Empty/omitted ⇒ none (unchanged). */\n readonly styles?: readonly string[];\n /** SSG: the prerendered-path set, serialized to `window.__NIFRA_PRERENDERED__` so the client fetches\n * a static `_data.json` on soft-nav into a prerendered route. Empty/omitted ⇒ not injected. */\n readonly prerenderedPaths?: readonly string[];\n /** ISR: route freshness in seconds, emitted as the `x-nifra-isr-revalidate` header for a `withISR`\n * wrapper to read. Omit ⇒ no header (the wrapper's default TTL applies). */\n readonly revalidate?: number;\n /** ISR invalidation tags emitted as a bounded `x-nifra-isr-tags` header. */\n readonly revalidateTags?: readonly string[];\n /** Matched route id; written to `window.__NIFRA_ROUTE__` so the client hydrates this chain. */\n readonly routeId?: string;\n /** The matched route's decoded path params - surfaced to the page as `params` (via {@link RenderProps})\n * so an adapter's `useParams` is SSR-correct. Omit ⇒ `{}` (a route with no dynamic segments, or an\n * error/404 render). */\n readonly params?: Readonly<Record<string, string>>;\n /** The request's `pathname + search` - surfaced as `path` (via {@link RenderProps}) so an adapter's\n * `useLocation`/`useSearchParams` render the right URL server-side and hydrate without drift. Omit ⇒\n * `\"\"`. */\n readonly path?: string;\n /** The route's validated search (`searchOf(mod.searchSchema, url.search)`, the same value handed to\n * the loader as `ctx.search`), surfaced as `search` (via {@link RenderProps}) so an adapter's\n * `useSearch` is SSR-correct. Omit ⇒ `{}` (a render with no search context). */\n readonly search?: Record<string, unknown>;\n /** Per-layout loader data, forwarded to the adapter as `RenderProps.layoutData`. Aligned with the\n * chain's layout prefix; omitted when no layout in the chain has a loader. */\n readonly layoutData?: readonly unknown[];\n /** Dynamic-boundary states, forwarded to the adapter and serialized for hydration when present. */\n readonly boundaries?: BoundaryStates;\n /** HTTP status for the response (default 200; e.g. 404 for a not-found page). */\n readonly status?: number;\n /** Extra response headers - e.g. the `cache-control` a terminal status page wants. `content-type`\n * is ignored (the document is always HTML) and the ISR freshness header is applied after these,\n * so neither can be overridden from here. */\n readonly headers?: HeadersLike;\n /** Document title (fallback when `head.title` is unset). */\n readonly title?: string;\n /** Resolved route head - `title` overrides `title` above; `meta`/`link` render as managed\n * (`data-nifra`) tags the client updates on navigation.\n *\n * **Head contract (the layout chain contributes).** `createWebApp` resolves this via\n * {@link mergeHeads}: a route's head is its **layout chain's** `meta`/`head` exports merged with the\n * page's. A `_layout.tsx` may `export const meta` (or `export function meta(args)`) - its tags land\n * on every page below it (the home for `hreflang`, `preconnect`, a section-default `<title>`). The\n * merge is **nearest-wins for scalars** (the page's `title` overrides an inner layout's, which\n * overrides an outer one; an undefined page title keeps the layout's) and **concatenated for the\n * `meta`/`link` arrays** (outermost layout first, page last). `<meta>`/`<link>` attributes pass a\n * shared tag-specific allowlist (including inert `data-*` metadata) and values are escaped. */\n readonly head?: Meta;\n /** Id of the container wrapping the app markup (default `\"root\"`). A non-default id also gets\n * {@link ROOT_ATTRIBUTE}, which is how the generated client entry finds the container to hydrate -\n * the entry is built once and cannot know what a given render chose. */\n readonly rootId?: string;\n /** When `false`, emit a complete but **non-hydrated** document - no client entry script, data\n * globals, or modulepreloads. Used for server-rendered `_error` pages: a terminal state that needs no\n * client takeover, and it sidesteps an SSR/hydrate mismatch (the server rendered the boundary, not\n * the page the client manifest maps this route id to). Default `true`. */\n readonly hydrate?: boolean;\n /** Island client bundles (`@nifrajs/web/islands`) to load as `<script type=\"module\">` in the document\n * tail - emitted **regardless of `hydrate`**, so a static (`hydrate: false`) page can still mount\n * no-framework islands. URLs are attribute-escaped. Empty/omitted ⇒ none (unchanged output). */\n readonly islandScripts?: readonly string[];\n /** CSP nonce applied to every framework-owned executable script in this document. */\n readonly nonce?: string;\n /**\n * Advanced: a per-route slot the renderer fills with the request-invariant document pieces (shell\n * prefix/suffix, tail statics) on the first render and reuses afterwards, skipping their re-assembly.\n *\n * Only pass a cache when every shell-shaping input is IDENTICAL across the requests sharing it:\n * same `head` content (a static meta chain - never a `meta(data)` function), `title`, `styles`,\n * `preload`, `islandScripts`, `clientEntry`, `rootId`, `hydrate`, and `prerenderedPaths
|
|
13438
|
+
"signature": "export interface RenderPageOptions {\n readonly adapter: RenderAdapter;\n /** The layout chain to render - outermost layout → page (opaque; the adapter renders it). */\n readonly chain: readonly unknown[];\n /** The loader output for this request. */\n readonly data: unknown;\n /** An action's data return (POST only) - surfaced to the page as `actionData` + serialized\n * for the client so post-POST hydration matches. Omit on GETs. */\n readonly actionData?: unknown;\n /**\n * URL of the built client entry (loaded as a module script).\n *\n * Optional ONLY on a `hydrate: false` page, where there is no client takeover to feed and this value\n * reaches no output at all. The union below is what enforces that: omitting it on a hydrating page\n * stays a compile error rather than rendering `src=\"\"`.\n */\n readonly clientEntry?: string;\n /** Chunk URLs for the **matched** route (its layout chain + own chunk) to `modulepreload` in the\n * shell - so the route code downloads in parallel with the entry instead of after it\n * (`buildClient`'s per-route map). Empty/omitted ⇒ only the entry is preloaded (unchanged). */\n readonly preload?: readonly string[];\n /** Stylesheet URLs for the **matched** route (its layout chain + own CSS, from `buildClient`'s\n * `BuildManifest.css`) - injected as `<link rel=\"stylesheet\">` in `<head>` so styles arrive with the\n * first paint (no FOUC). Rendered even on non-hydrated pages. Empty/omitted ⇒ none (unchanged). */\n readonly styles?: readonly string[];\n /**\n * Activation policy for these framework-owned stylesheet links (default `\"blocking\"`). In\n * `\"deferred\"` mode, hydrating pages fetch with `media=\"print\"` and the generated client promotes\n * them to `media=\"all\"` after load/error/timeout. Non-hydrated pages remain blocking so JS-off pages\n * and terminal documents are styled.\n */\n readonly cssLoading?: CssLoadingMode;\n /** SSG: the prerendered-path set, serialized to `window.__NIFRA_PRERENDERED__` so the client fetches\n * a static `_data.json` on soft-nav into a prerendered route. Empty/omitted ⇒ not injected. */\n readonly prerenderedPaths?: readonly string[];\n /** ISR: route freshness in seconds, emitted as the `x-nifra-isr-revalidate` header for a `withISR`\n * wrapper to read. Omit ⇒ no header (the wrapper's default TTL applies). */\n readonly revalidate?: number;\n /** ISR invalidation tags emitted as a bounded `x-nifra-isr-tags` header. */\n readonly revalidateTags?: readonly string[];\n /** Matched route id; written to `window.__NIFRA_ROUTE__` so the client hydrates this chain. */\n readonly routeId?: string;\n /** The matched route's decoded path params - surfaced to the page as `params` (via {@link RenderProps})\n * so an adapter's `useParams` is SSR-correct. Omit ⇒ `{}` (a route with no dynamic segments, or an\n * error/404 render). */\n readonly params?: Readonly<Record<string, string>>;\n /** The request's `pathname + search` - surfaced as `path` (via {@link RenderProps}) so an adapter's\n * `useLocation`/`useSearchParams` render the right URL server-side and hydrate without drift. Omit ⇒\n * `\"\"`. */\n readonly path?: string;\n /** The route's validated search (`searchOf(mod.searchSchema, url.search)`, the same value handed to\n * the loader as `ctx.search`), surfaced as `search` (via {@link RenderProps}) so an adapter's\n * `useSearch` is SSR-correct. Omit ⇒ `{}` (a render with no search context). */\n readonly search?: Record<string, unknown>;\n /** Per-layout loader data, forwarded to the adapter as `RenderProps.layoutData`. Aligned with the\n * chain's layout prefix; omitted when no layout in the chain has a loader. */\n readonly layoutData?: readonly unknown[];\n /** Dynamic-boundary states, forwarded to the adapter and serialized for hydration when present. */\n readonly boundaries?: BoundaryStates;\n /** HTTP status for the response (default 200; e.g. 404 for a not-found page). */\n readonly status?: number;\n /** Extra response headers - e.g. the `cache-control` a terminal status page wants. `content-type`\n * is ignored (the document is always HTML) and the ISR freshness header is applied after these,\n * so neither can be overridden from here. */\n readonly headers?: HeadersLike;\n /** Document title (fallback when `head.title` is unset). */\n readonly title?: string;\n /** Resolved route head - `title` overrides `title` above; `meta`/`link` render as managed\n * (`data-nifra`) tags the client updates on navigation.\n *\n * **Head contract (the layout chain contributes).** `createWebApp` resolves this via\n * {@link mergeHeads}: a route's head is its **layout chain's** `meta`/`head` exports merged with the\n * page's. A `_layout.tsx` may `export const meta` (or `export function meta(args)`) - its tags land\n * on every page below it (the home for `hreflang`, `preconnect`, a section-default `<title>`). The\n * merge is **nearest-wins for scalars** (the page's `title` overrides an inner layout's, which\n * overrides an outer one; an undefined page title keeps the layout's) and **concatenated for the\n * `meta`/`link` arrays** (outermost layout first, page last). `<meta>`/`<link>` attributes pass a\n * shared tag-specific allowlist (including inert `data-*` metadata) and values are escaped. */\n readonly head?: Meta;\n /** Id of the container wrapping the app markup (default `\"root\"`). A non-default id also gets\n * {@link ROOT_ATTRIBUTE}, which is how the generated client entry finds the container to hydrate -\n * the entry is built once and cannot know what a given render chose. */\n readonly rootId?: string;\n /** When `false`, emit a complete but **non-hydrated** document - no client entry script, data\n * globals, or modulepreloads. Used for server-rendered `_error` pages: a terminal state that needs no\n * client takeover, and it sidesteps an SSR/hydrate mismatch (the server rendered the boundary, not\n * the page the client manifest maps this route id to). Default `true`. */\n readonly hydrate?: boolean;\n /** Island client bundles (`@nifrajs/web/islands`) to load as `<script type=\"module\">` in the document\n * tail - emitted **regardless of `hydrate`**, so a static (`hydrate: false`) page can still mount\n * no-framework islands. URLs are attribute-escaped. Empty/omitted ⇒ none (unchanged output). */\n readonly islandScripts?: readonly string[];\n /** CSP nonce applied to every framework-owned executable script in this document. Nonce-bearing\n * documents are marked `private, no-store` so a request-specific nonce is never replayed. */\n readonly nonce?: string;\n /**\n * Advanced: a per-route slot the renderer fills with the request-invariant document pieces (shell\n * prefix/suffix, tail statics) on the first render and reuses afterwards, skipping their re-assembly.\n *\n * Only pass a cache when every shell-shaping input is IDENTICAL across the requests sharing it:\n * same `head` content (a static meta chain - never a `meta(data)` function), `title`, `styles`,\n * `cssLoading`, `preload`, `islandScripts`, `clientEntry`, `rootId`, `hydrate`, and `prerenderedPaths`.\n * Per-request\n * values (`data`, `params`, `search`, `actionData`, `layoutData`, deferred state) are always assembled\n * fresh and safe. A per-request `nonce` disables the cache automatically. `createWebApp` wires this\n * per route, gated on the route + layout metas being static.\n */\n readonly assemblyCache?: RenderAssemblyCache;\n}"
|
|
12884
13439
|
},
|
|
12885
13440
|
{
|
|
12886
13441
|
"name": "renderPageResult",
|
|
@@ -12943,7 +13498,7 @@
|
|
|
12943
13498
|
"name": "ReplayBackend",
|
|
12944
13499
|
"kind": "class",
|
|
12945
13500
|
"package": "@nifrajs/coding-agent",
|
|
12946
|
-
"signature": "export declare class ReplayBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n private readonly events;\n private readonly delayMs;\n private readonly sessions;\n constructor(options: ReplayBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n close(sessionId: string): Promise<void>;\n private replay;\n private push;\n private requireSession;\n}",
|
|
13501
|
+
"signature": "export declare class ReplayBackend implements AgentBackend {\n readonly info: AgentBackendInfo;\n /** Serialized immutable source records; parsing per replay prevents caller/consumer mutation leaks. */\n private readonly events;\n private readonly delayMs;\n private readonly sessions;\n constructor(options: ReplayBackendOptions);\n createSession(input: CreateSessionInput): Promise<AgentSessionSnapshot>;\n send(input: SendMessageInput): AsyncIterable<AgentEvent>;\n cancel(sessionId: string, reason?: string): Promise<void>;\n snapshot(sessionId: string): Promise<AgentSessionSnapshot>;\n reload(sessionId: string): Promise<ReloadResult>;\n close(sessionId: string): Promise<void>;\n private replay;\n private cancelTurn;\n private isCurrentTurn;\n private clearTurn;\n private push;\n private requireSession;\n}",
|
|
12947
13502
|
"doc": "/** Deterministic protocol backend for demos, CI, and UI regression tests. */"
|
|
12948
13503
|
},
|
|
12949
13504
|
{
|
|
@@ -13607,6 +14162,243 @@
|
|
|
13607
14162
|
"signature": "export interface RevalidateResult<T> {\n readonly __nifraRevalidate: readonly string[];\n readonly data: T;\n}",
|
|
13608
14163
|
"doc": "/** The wrapper `revalidate()` returns: the action's `data` plus the paths it changed. A plain tagged\n * shape (not a class) so `@nifrajs/client`'s `ActionData` can unwrap it structurally without importing\n * from `@nifrajs/web`. `createWebApp` strips the wrapper - the client receives `data` as the body and\n * the paths via the `X-Nifra-Revalidate` header. */"
|
|
13609
14164
|
},
|
|
14165
|
+
{
|
|
14166
|
+
"name": "REVIEW_MAX_ARRAY_ITEMS",
|
|
14167
|
+
"kind": "const",
|
|
14168
|
+
"package": "@nifrajs/agent-review",
|
|
14169
|
+
"signature": "export declare const REVIEW_MAX_ARRAY_ITEMS = 1024;"
|
|
14170
|
+
},
|
|
14171
|
+
{
|
|
14172
|
+
"name": "REVIEW_MAX_BYTES",
|
|
14173
|
+
"kind": "const",
|
|
14174
|
+
"package": "@nifrajs/agent-review",
|
|
14175
|
+
"signature": "export declare const REVIEW_MAX_BYTES: number;"
|
|
14176
|
+
},
|
|
14177
|
+
{
|
|
14178
|
+
"name": "REVIEW_MAX_CODE_BYTES",
|
|
14179
|
+
"kind": "const",
|
|
14180
|
+
"package": "@nifrajs/agent-review",
|
|
14181
|
+
"signature": "export declare const REVIEW_MAX_CODE_BYTES = 64;"
|
|
14182
|
+
},
|
|
14183
|
+
{
|
|
14184
|
+
"name": "REVIEW_MAX_DEPTH",
|
|
14185
|
+
"kind": "const",
|
|
14186
|
+
"package": "@nifrajs/agent-review",
|
|
14187
|
+
"signature": "export declare const REVIEW_MAX_DEPTH = 8;"
|
|
14188
|
+
},
|
|
14189
|
+
{
|
|
14190
|
+
"name": "REVIEW_MAX_ID_BYTES",
|
|
14191
|
+
"kind": "const",
|
|
14192
|
+
"package": "@nifrajs/agent-review",
|
|
14193
|
+
"signature": "export declare const REVIEW_MAX_ID_BYTES = 128;"
|
|
14194
|
+
},
|
|
14195
|
+
{
|
|
14196
|
+
"name": "REVIEW_MAX_OBJECT_KEYS",
|
|
14197
|
+
"kind": "const",
|
|
14198
|
+
"package": "@nifrajs/agent-review",
|
|
14199
|
+
"signature": "export declare const REVIEW_MAX_OBJECT_KEYS = 32;"
|
|
14200
|
+
},
|
|
14201
|
+
{
|
|
14202
|
+
"name": "REVIEW_MAX_PATH_BYTES",
|
|
14203
|
+
"kind": "const",
|
|
14204
|
+
"package": "@nifrajs/agent-review",
|
|
14205
|
+
"signature": "export declare const REVIEW_MAX_PATH_BYTES = 512;"
|
|
14206
|
+
},
|
|
14207
|
+
{
|
|
14208
|
+
"name": "REVIEW_MAX_REF_BYTES",
|
|
14209
|
+
"kind": "const",
|
|
14210
|
+
"package": "@nifrajs/agent-review",
|
|
14211
|
+
"signature": "export declare const REVIEW_MAX_REF_BYTES = 256;"
|
|
14212
|
+
},
|
|
14213
|
+
{
|
|
14214
|
+
"name": "REVIEW_REPORT_VERSION",
|
|
14215
|
+
"kind": "const",
|
|
14216
|
+
"package": "@nifrajs/agent-review",
|
|
14217
|
+
"signature": "export declare const REVIEW_REPORT_VERSION: 1;",
|
|
14218
|
+
"doc": "/** Stable version of the content-free review report contract. */"
|
|
14219
|
+
},
|
|
14220
|
+
{
|
|
14221
|
+
"name": "ReviewCategory",
|
|
14222
|
+
"kind": "type",
|
|
14223
|
+
"package": "@nifrajs/agent-review",
|
|
14224
|
+
"signature": "export type ReviewCategory = \"correctness\" | \"security\" | \"boundary\" | \"assurance\" | \"capability\" | \"contract\" | \"dependency\" | \"hydration\" | \"coverage\" | \"configuration\" | \"operational\";"
|
|
14225
|
+
},
|
|
14226
|
+
{
|
|
14227
|
+
"name": "ReviewCheckId",
|
|
14228
|
+
"kind": "type",
|
|
14229
|
+
"package": "@nifrajs/agent-review",
|
|
14230
|
+
"signature": "export type ReviewCheckId = \"typecheck\" | \"typed-client\" | \"server-boundary\" | \"route-boundary\" | \"pipeline\" | \"security\" | \"route-assurance\" | \"capability-provenance\" | \"manifest\" | \"dependency\" | \"contract-witness\" | \"coverage\" | \"hydration\" | \"configuration\";"
|
|
14231
|
+
},
|
|
14232
|
+
{
|
|
14233
|
+
"name": "ReviewCheckResult",
|
|
14234
|
+
"kind": "interface",
|
|
14235
|
+
"package": "@nifrajs/agent-review",
|
|
14236
|
+
"signature": "export interface ReviewCheckResult {\n readonly id: ReviewCheckId;\n readonly required: boolean;\n readonly status: ReviewCheckStatus;\n /** Display-only timing bucket. It is deliberately excluded from report digests. */\n readonly duration: ReviewDurationBucket;\n readonly counts: ReviewCounts;\n readonly findingIds: readonly string[];\n readonly evidence: readonly ReviewEvidenceRef[];\n readonly reasonCode?: ReviewReasonCode;\n}"
|
|
14237
|
+
},
|
|
14238
|
+
{
|
|
14239
|
+
"name": "ReviewCheckStatus",
|
|
14240
|
+
"kind": "type",
|
|
14241
|
+
"package": "@nifrajs/agent-review",
|
|
14242
|
+
"signature": "export type ReviewCheckStatus = \"pass\" | \"fail\" | \"skipped\" | \"unavailable\" | \"error\";"
|
|
14243
|
+
},
|
|
14244
|
+
{
|
|
14245
|
+
"name": "ReviewCounts",
|
|
14246
|
+
"kind": "interface",
|
|
14247
|
+
"package": "@nifrajs/agent-review",
|
|
14248
|
+
"signature": "export interface ReviewCounts {\n readonly findings: number;\n readonly errors: number;\n readonly warnings: number;\n readonly info: number;\n readonly outOfScope: number;\n}"
|
|
14249
|
+
},
|
|
14250
|
+
{
|
|
14251
|
+
"name": "ReviewDurationBucket",
|
|
14252
|
+
"kind": "type",
|
|
14253
|
+
"package": "@nifrajs/agent-review",
|
|
14254
|
+
"signature": "export type ReviewDurationBucket = \"none\" | \"fast\" | \"standard\" | \"slow\" | \"timeout\";"
|
|
14255
|
+
},
|
|
14256
|
+
{
|
|
14257
|
+
"name": "ReviewEvidenceRef",
|
|
14258
|
+
"kind": "interface",
|
|
14259
|
+
"package": "@nifrajs/agent-review",
|
|
14260
|
+
"signature": "export interface ReviewEvidenceRef {\n readonly source: ReviewEvidenceSource;\n readonly token: string;\n readonly digest: string;\n readonly path?: string;\n}"
|
|
14261
|
+
},
|
|
14262
|
+
{
|
|
14263
|
+
"name": "ReviewEvidenceSource",
|
|
14264
|
+
"kind": "type",
|
|
14265
|
+
"package": "@nifrajs/agent-review",
|
|
14266
|
+
"signature": "export type ReviewEvidenceSource = \"check\" | \"assurance\" | \"capability\" | \"manifest\" | \"contract\" | \"coverage\" | \"git-scope\" | \"collector\";"
|
|
14267
|
+
},
|
|
14268
|
+
{
|
|
14269
|
+
"name": "ReviewExecutionErrorCode",
|
|
14270
|
+
"kind": "type",
|
|
14271
|
+
"package": "@nifrajs/coding-agent",
|
|
14272
|
+
"signature": "export type ReviewExecutionErrorCode = \"timeout\" | \"output-truncated\" | \"invalid-report\" | \"spawn-failed\";"
|
|
14273
|
+
},
|
|
14274
|
+
{
|
|
14275
|
+
"name": "ReviewExecutionResult",
|
|
14276
|
+
"kind": "interface",
|
|
14277
|
+
"package": "@nifrajs/coding-agent",
|
|
14278
|
+
"signature": "export interface ReviewExecutionResult {\n readonly name: \"review\";\n readonly ok: boolean;\n readonly status: number | null;\n /** A parsed, content-free ReviewReport. Raw stdout/stderr is intentionally never returned. */\n readonly report?: unknown;\n readonly errorCode?: ReviewExecutionErrorCode;\n}"
|
|
14279
|
+
},
|
|
14280
|
+
{
|
|
14281
|
+
"name": "ReviewFinding",
|
|
14282
|
+
"kind": "interface",
|
|
14283
|
+
"package": "@nifrajs/agent-review",
|
|
14284
|
+
"signature": "export interface ReviewFinding {\n readonly id: string;\n readonly check: ReviewCheckId;\n readonly code: string;\n readonly severity: ReviewSeverity;\n readonly category: ReviewCategory;\n readonly location?: ReviewLocation;\n readonly evidence: readonly ReviewEvidenceRef[];\n readonly fix?: ReviewFixRef;\n}"
|
|
14285
|
+
},
|
|
14286
|
+
{
|
|
14287
|
+
"name": "ReviewFixRecipeId",
|
|
14288
|
+
"kind": "type",
|
|
14289
|
+
"package": "@nifrajs/agent-review",
|
|
14290
|
+
"signature": "export type ReviewFixRecipeId = \"manifest.sync\" | \"workspace-dist.rebuild\";"
|
|
14291
|
+
},
|
|
14292
|
+
{
|
|
14293
|
+
"name": "ReviewFixRef",
|
|
14294
|
+
"kind": "interface",
|
|
14295
|
+
"package": "@nifrajs/agent-review",
|
|
14296
|
+
"signature": "export interface ReviewFixRef {\n readonly recipe: ReviewFixRecipeId;\n}"
|
|
14297
|
+
},
|
|
14298
|
+
{
|
|
14299
|
+
"name": "ReviewFixResult",
|
|
14300
|
+
"kind": "interface",
|
|
14301
|
+
"package": "@nifrajs/agent-review",
|
|
14302
|
+
"signature": "export interface ReviewFixResult {\n readonly recipe: ReviewFixRecipeId;\n readonly status: ReviewFixStatus;\n readonly changedPaths?: readonly string[];\n readonly reasonCode?: ReviewReasonCode;\n}"
|
|
14303
|
+
},
|
|
14304
|
+
{
|
|
14305
|
+
"name": "ReviewFixStatus",
|
|
14306
|
+
"kind": "type",
|
|
14307
|
+
"package": "@nifrajs/agent-review",
|
|
14308
|
+
"signature": "export type ReviewFixStatus = \"planned\" | \"changed\" | \"no-op\" | \"failed\";"
|
|
14309
|
+
},
|
|
14310
|
+
{
|
|
14311
|
+
"name": "ReviewLocation",
|
|
14312
|
+
"kind": "interface",
|
|
14313
|
+
"package": "@nifrajs/agent-review",
|
|
14314
|
+
"signature": "export interface ReviewLocation {\n readonly path: string;\n readonly line?: number;\n readonly column?: number;\n}"
|
|
14315
|
+
},
|
|
14316
|
+
{
|
|
14317
|
+
"name": "ReviewOptions",
|
|
14318
|
+
"kind": "interface",
|
|
14319
|
+
"package": "@nifrajs/coding-agent",
|
|
14320
|
+
"signature": "export interface ReviewOptions {\n readonly cwd: string;\n readonly command?: string;\n readonly commandArgs?: readonly string[];\n readonly strict?: boolean;\n readonly diff?: string;\n readonly timeoutMs?: number;\n readonly maxOutputBytes?: number;\n readonly env?: Readonly<Record<string, string | undefined>>;\n}"
|
|
14321
|
+
},
|
|
14322
|
+
{
|
|
14323
|
+
"name": "ReviewParserError",
|
|
14324
|
+
"kind": "class",
|
|
14325
|
+
"package": "@nifrajs/agent-review",
|
|
14326
|
+
"signature": "export declare class ReviewParserError extends Error {\n readonly code: ReviewParserErrorCode;\n readonly path?: string;\n constructor(code: ReviewParserErrorCode, path?: string);\n}",
|
|
14327
|
+
"doc": "/** Error raised for every malformed, unsafe, or payload-bearing report. */"
|
|
14328
|
+
},
|
|
14329
|
+
{
|
|
14330
|
+
"name": "ReviewParserErrorCode",
|
|
14331
|
+
"kind": "type",
|
|
14332
|
+
"package": "@nifrajs/agent-review",
|
|
14333
|
+
"signature": "export type ReviewParserErrorCode = \"invalid-root\" | \"unknown-key\" | \"forbidden-content\" | \"invalid-type\" | \"invalid-enum\" | \"invalid-id\" | \"invalid-reference\" | \"invalid-path\" | \"invalid-digest\" | \"duplicate-id\" | \"missing-required\" | \"oversized\" | \"derived-field-mismatch\" | \"non-canonical\";"
|
|
14334
|
+
},
|
|
14335
|
+
{
|
|
14336
|
+
"name": "ReviewReasonCode",
|
|
14337
|
+
"kind": "type",
|
|
14338
|
+
"package": "@nifrajs/agent-review",
|
|
14339
|
+
"signature": "export type ReviewReasonCode = \"not-configured\" | \"config-missing\" | \"config-invalid\" | \"collector-error\" | \"collector-unavailable\" | \"diagnostics-truncated\" | \"missing-typescript\" | \"invalid-target\" | \"invalid-git-ref\" | \"invalid-git-scope\" | \"filtered-out-of-scope\" | \"fix-failed\" | \"fix-no-op\" | \"unsupported\";"
|
|
14340
|
+
},
|
|
14341
|
+
{
|
|
14342
|
+
"name": "ReviewReport",
|
|
14343
|
+
"kind": "interface",
|
|
14344
|
+
"package": "@nifrajs/agent-review",
|
|
14345
|
+
"signature": "export interface ReviewReport {\n readonly version: typeof REVIEW_REPORT_VERSION;\n readonly strict: boolean;\n readonly scope: ReviewScope;\n readonly checks: readonly ReviewCheckResult[];\n readonly findings: readonly ReviewFinding[];\n readonly fixes?: readonly ReviewFixResult[];\n readonly blocking: number;\n readonly ok: boolean;\n readonly status: ReviewStatus;\n /** Lowercase SHA-256 of the canonical report without this field or display-only durations. */\n readonly digest: string;\n}"
|
|
14346
|
+
},
|
|
14347
|
+
{
|
|
14348
|
+
"name": "ReviewReportDraft",
|
|
14349
|
+
"kind": "interface",
|
|
14350
|
+
"package": "@nifrajs/agent-review",
|
|
14351
|
+
"signature": "export interface ReviewReportDraft {\n readonly strict: boolean;\n readonly scope: ReviewScope;\n readonly checks: readonly ReviewCheckResult[];\n readonly findings: readonly ReviewFinding[];\n readonly fixes?: readonly ReviewFixResult[];\n}",
|
|
14352
|
+
"doc": "/** Sanitized structural inputs accepted by the deterministic composer. */"
|
|
14353
|
+
},
|
|
14354
|
+
{
|
|
14355
|
+
"name": "ReviewScope",
|
|
14356
|
+
"kind": "interface",
|
|
14357
|
+
"package": "@nifrajs/agent-review",
|
|
14358
|
+
"signature": "export interface ReviewScope {\n readonly kind: \"project\" | \"diff\";\n readonly state: \"valid\" | \"invalid\";\n readonly gitRef?: string;\n readonly changedPaths: readonly string[];\n /** SHA-256 of the canonical changed-path list. */\n readonly pathDigest: string;\n readonly outOfScopeCount: number;\n readonly reasonCode?: ReviewReasonCode;\n}"
|
|
14359
|
+
},
|
|
14360
|
+
{
|
|
14361
|
+
"name": "ReviewSeverity",
|
|
14362
|
+
"kind": "type",
|
|
14363
|
+
"package": "@nifrajs/agent-review",
|
|
14364
|
+
"signature": "export type ReviewSeverity = \"error\" | \"warning\" | \"info\";"
|
|
14365
|
+
},
|
|
14366
|
+
{
|
|
14367
|
+
"name": "ReviewStatus",
|
|
14368
|
+
"kind": "type",
|
|
14369
|
+
"package": "@nifrajs/agent-review",
|
|
14370
|
+
"signature": "export type ReviewStatus = \"pass\" | \"fail\" | \"inconclusive\";"
|
|
14371
|
+
},
|
|
14372
|
+
{
|
|
14373
|
+
"name": "ReviewView",
|
|
14374
|
+
"kind": "interface",
|
|
14375
|
+
"package": "@nifrajs/agent-app",
|
|
14376
|
+
"signature": "export interface ReviewView {\n readonly version: 1;\n readonly status: ReviewViewStatus;\n readonly ok: boolean;\n readonly strict: boolean;\n readonly blocking: number;\n readonly digest?: string;\n readonly processStatus?: number | null;\n readonly reasonCode?: \"invalid-report\" | \"unavailable\" | \"process-failed\";\n readonly scope?: {\n readonly kind: \"project\" | \"diff\";\n readonly state: \"valid\" | \"invalid\";\n readonly pathDigest: string;\n readonly changedPathCount: number;\n readonly outOfScopeCount: number;\n };\n readonly checks: readonly ReviewViewCheck[];\n readonly findings: readonly ReviewViewFinding[];\n readonly fixes: readonly {\n readonly recipe: string;\n readonly status: \"planned\" | \"changed\" | \"no-op\" | \"failed\";\n }[];\n}"
|
|
14377
|
+
},
|
|
14378
|
+
{
|
|
14379
|
+
"name": "ReviewViewCheck",
|
|
14380
|
+
"kind": "interface",
|
|
14381
|
+
"package": "@nifrajs/agent-app",
|
|
14382
|
+
"signature": "export interface ReviewViewCheck {\n readonly id: string;\n readonly required: boolean;\n readonly status: \"pass\" | \"fail\" | \"skipped\" | \"unavailable\" | \"error\";\n readonly findings: number;\n readonly errors: number;\n readonly warnings: number;\n readonly info: number;\n readonly outOfScope: number;\n readonly reasonCode?: string;\n}"
|
|
14383
|
+
},
|
|
14384
|
+
{
|
|
14385
|
+
"name": "ReviewViewEvidence",
|
|
14386
|
+
"kind": "interface",
|
|
14387
|
+
"package": "@nifrajs/agent-app",
|
|
14388
|
+
"signature": "export interface ReviewViewEvidence {\n readonly source: string;\n readonly token: string;\n readonly digest: string;\n readonly path?: string;\n}"
|
|
14389
|
+
},
|
|
14390
|
+
{
|
|
14391
|
+
"name": "ReviewViewFinding",
|
|
14392
|
+
"kind": "interface",
|
|
14393
|
+
"package": "@nifrajs/agent-app",
|
|
14394
|
+
"signature": "export interface ReviewViewFinding {\n readonly id: string;\n readonly check: string;\n readonly code: string;\n readonly severity: \"error\" | \"warning\" | \"info\";\n readonly category: string;\n readonly location?: {\n readonly path: string;\n readonly line?: number;\n };\n readonly evidence: readonly ReviewViewEvidence[];\n readonly fix?: {\n readonly recipe: string;\n };\n}"
|
|
14395
|
+
},
|
|
14396
|
+
{
|
|
14397
|
+
"name": "ReviewViewStatus",
|
|
14398
|
+
"kind": "type",
|
|
14399
|
+
"package": "@nifrajs/agent-app",
|
|
14400
|
+
"signature": "export type ReviewViewStatus = \"pass\" | \"fail\" | \"inconclusive\" | \"unavailable\";"
|
|
14401
|
+
},
|
|
13610
14402
|
{
|
|
13611
14403
|
"name": "rewriteSsrImports",
|
|
13612
14404
|
"kind": "function",
|
|
@@ -13697,7 +14489,7 @@
|
|
|
13697
14489
|
"name": "RouteChange",
|
|
13698
14490
|
"kind": "interface",
|
|
13699
14491
|
"package": "@nifrajs/core",
|
|
13700
|
-
"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}"
|
|
14492
|
+
"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\" | \"params\" | \"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}"
|
|
13701
14493
|
},
|
|
13702
14494
|
{
|
|
13703
14495
|
"name": "routeClassification",
|
|
@@ -13944,7 +14736,7 @@
|
|
|
13944
14736
|
"name": "RouteSnapshotSchema",
|
|
13945
14737
|
"kind": "interface",
|
|
13946
14738
|
"package": "@nifrajs/core",
|
|
13947
|
-
"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}"
|
|
14739
|
+
"signature": "export interface RouteSnapshotSchema {\n readonly headers?: SchemaSnapshot;\n readonly body?: SchemaSnapshot;\n readonly query?: SchemaSnapshot;\n readonly params?: SchemaSnapshot;\n readonly response?: SchemaSnapshot;\n readonly sse?: SchemaSnapshot;\n readonly errors?: Readonly<Record<string, SchemaSnapshot>>;\n}"
|
|
13948
14740
|
},
|
|
13949
14741
|
{
|
|
13950
14742
|
"name": "rpcError",
|
|
@@ -14052,6 +14844,13 @@
|
|
|
14052
14844
|
"package": "@nifrajs/agent",
|
|
14053
14845
|
"signature": "export interface RunAgentOptions {\n readonly state: AgentTurnState;\n readonly maxTurns?: number;\n readonly goal?: (output: unknown) => boolean;\n}"
|
|
14054
14846
|
},
|
|
14847
|
+
{
|
|
14848
|
+
"name": "runAgentSurfaceConformance",
|
|
14849
|
+
"kind": "function",
|
|
14850
|
+
"package": "@nifrajs/webmcp",
|
|
14851
|
+
"signature": "export declare function runAgentSurfaceConformance(capabilities: readonly AgentCapabilityReference[], options?: AgentSurfaceConformanceOptions): Promise<AgentSurfaceConformanceResult>;",
|
|
14852
|
+
"doc": "/** Run deterministic host-independent checks over the WebMCP projection and optional calls. */"
|
|
14853
|
+
},
|
|
14055
14854
|
{
|
|
14056
14855
|
"name": "runApp",
|
|
14057
14856
|
"kind": "function",
|
|
@@ -14282,6 +15081,13 @@
|
|
|
14282
15081
|
"signature": "export declare function runNifraContext(options: NifraContextOptions): Promise<NifraContextResult>;",
|
|
14283
15082
|
"doc": "/** Project discovery kept outside the framework runtime; it is only spawned when an agent asks for it. */"
|
|
14284
15083
|
},
|
|
15084
|
+
{
|
|
15085
|
+
"name": "runNifraReview",
|
|
15086
|
+
"kind": "function",
|
|
15087
|
+
"package": "@nifrajs/coding-agent",
|
|
15088
|
+
"signature": "export declare function runNifraReview(options: ReviewOptions): Promise<ReviewExecutionResult>;",
|
|
15089
|
+
"doc": "/** Run `nifra review --json` with the same bounded process discipline as the existing gates. */"
|
|
15090
|
+
},
|
|
14285
15091
|
{
|
|
14286
15092
|
"name": "runNifraVerification",
|
|
14287
15093
|
"kind": "function",
|
|
@@ -14378,6 +15184,12 @@
|
|
|
14378
15184
|
"signature": "export interface RunPlanRef {\n readonly id: string;\n /** SHA-256 hex of the canonical plan. Content-free. */\n readonly digest: string;\n readonly nodeCount: number;\n}",
|
|
14379
15185
|
"doc": "/** A content-free pointer to the plan a run is executing. */"
|
|
14380
15186
|
},
|
|
15187
|
+
{
|
|
15188
|
+
"name": "runPredictionLab",
|
|
15189
|
+
"kind": "function",
|
|
15190
|
+
"package": "@nifrajs/testing",
|
|
15191
|
+
"signature": "export declare function runPredictionLab(options?: PredictionLabOptions): Promise<PredictionLabReport>;"
|
|
15192
|
+
},
|
|
14381
15193
|
{
|
|
14382
15194
|
"name": "RunQueryOptions",
|
|
14383
15195
|
"kind": "interface",
|
|
@@ -14676,6 +15488,64 @@
|
|
|
14676
15488
|
"package": "@nifrajs/core",
|
|
14677
15489
|
"signature": "export interface SagaStore {\n readonly durability?: \"memory\" | \"durable\";\n create(record: SagaRecord): boolean | Promise<boolean>;\n get(sagaId: string): SagaRecord | undefined | Promise<SagaRecord | undefined>;\n /** Atomic version compare-and-set; this is the saga engine's crash/concurrency boundary. */\n compareAndSet(input: {\n readonly sagaId: string;\n readonly version: number;\n readonly record: SagaRecord;\n }): boolean | Promise<boolean>;\n /** Bounded operational scan. Transition-only stores do not need to implement reconciliation. */\n scan?(input: ReconciliationScanOptions<SagaState>): ReconciliationScanPage<SagaRecord> | Promise<ReconciliationScanPage<SagaRecord>>;\n /** @deprecated Compatibility fallback; production reconciliation should implement `scan`. */\n list?(): readonly SagaRecord[] | Promise<readonly SagaRecord[]>;\n}"
|
|
14678
15490
|
},
|
|
15491
|
+
{
|
|
15492
|
+
"name": "sanitizedHtml",
|
|
15493
|
+
"kind": "const",
|
|
15494
|
+
"package": "@nifrajs/web",
|
|
15495
|
+
"signature": "export declare const sanitizedHtml: typeof sanitizeHtml;",
|
|
15496
|
+
"doc": "/** Explicit sanitized-content vocabulary for callers and security audits. */"
|
|
15497
|
+
},
|
|
15498
|
+
{
|
|
15499
|
+
"name": "SanitizedHtml",
|
|
15500
|
+
"kind": "type",
|
|
15501
|
+
"package": "@nifrajs/web",
|
|
15502
|
+
"signature": "export type SanitizedHtml = TrustedHtml & {\n readonly [SANITIZED_HTML_BRAND]: \"sanitized-html\";\n};",
|
|
15503
|
+
"doc": "/** HTML returned by an explicit, caller-supplied sanitizer. It is also trusted by the adapters. */"
|
|
15504
|
+
},
|
|
15505
|
+
{
|
|
15506
|
+
"name": "sanitizeHtml",
|
|
15507
|
+
"kind": "function",
|
|
15508
|
+
"package": "@nifrajs/web",
|
|
15509
|
+
"signature": "export declare function sanitizeHtml(value: string, sanitizer: HtmlSanitizer): SanitizedHtml;",
|
|
15510
|
+
"doc": "/**\n * Run untrusted markup through an explicit sanitizer before it reaches a raw-HTML adapter.\n *\n * Nifra deliberately does not bundle a sanitizer: applications choose the maintained allowlist\n * appropriate to their runtime and content policy. Requiring the sanitizer as an argument prevents\n * `sanitizedHtml(value)` from silently becoming an alias for the unsafe trust operation.\n */"
|
|
15511
|
+
},
|
|
15512
|
+
{
|
|
15513
|
+
"name": "SarifLocation",
|
|
15514
|
+
"kind": "interface",
|
|
15515
|
+
"package": "@nifrajs/cli",
|
|
15516
|
+
"signature": "export interface SarifLocation {\n readonly physicalLocation: {\n readonly artifactLocation: {\n readonly uri: string;\n readonly uriBaseId?: string;\n };\n readonly region?: {\n readonly startLine: number;\n };\n };\n}"
|
|
15517
|
+
},
|
|
15518
|
+
{
|
|
15519
|
+
"name": "SarifLog",
|
|
15520
|
+
"kind": "interface",
|
|
15521
|
+
"package": "@nifrajs/cli",
|
|
15522
|
+
"signature": "export interface SarifLog {\n readonly $schema: \"https://json.schemastore.org/sarif-2.1.0.json\";\n readonly version: \"2.1.0\";\n readonly runs: readonly SarifRun[];\n}",
|
|
15523
|
+
"doc": "/** The subset of SARIF 2.1.0 emitted by {@link toSarifLog}. */"
|
|
15524
|
+
},
|
|
15525
|
+
{
|
|
15526
|
+
"name": "SarifProjectionOptions",
|
|
15527
|
+
"kind": "interface",
|
|
15528
|
+
"package": "@nifrajs/cli",
|
|
15529
|
+
"signature": "export interface SarifProjectionOptions {\n /** Name shown by external review tools in the SARIF run metadata. Defaults to `nifra`. */\n readonly toolName?: string;\n /** Optional CLI/framework version shown by external review tools. */\n readonly toolVersion?: string;\n /** Base URI identifier for relative diagnostic file paths. */\n readonly uriBaseId?: string;\n}"
|
|
15530
|
+
},
|
|
15531
|
+
{
|
|
15532
|
+
"name": "SarifResult",
|
|
15533
|
+
"kind": "interface",
|
|
15534
|
+
"package": "@nifrajs/cli",
|
|
15535
|
+
"signature": "export interface SarifResult {\n readonly ruleId: string;\n readonly level: \"error\" | \"warning\" | \"note\";\n readonly message: {\n readonly text: string;\n };\n readonly locations?: readonly SarifLocation[];\n readonly properties?: Readonly<Record<string, string | readonly string[]>>;\n}"
|
|
15536
|
+
},
|
|
15537
|
+
{
|
|
15538
|
+
"name": "SarifRule",
|
|
15539
|
+
"kind": "interface",
|
|
15540
|
+
"package": "@nifrajs/cli",
|
|
15541
|
+
"signature": "export interface SarifRule {\n readonly id: string;\n readonly shortDescription: {\n readonly text: string;\n };\n}"
|
|
15542
|
+
},
|
|
15543
|
+
{
|
|
15544
|
+
"name": "SarifRun",
|
|
15545
|
+
"kind": "interface",
|
|
15546
|
+
"package": "@nifrajs/cli",
|
|
15547
|
+
"signature": "export interface SarifRun {\n readonly tool: {\n readonly driver: {\n readonly name: string;\n readonly version?: string;\n readonly rules: readonly SarifRule[];\n };\n };\n readonly results: readonly SarifResult[];\n}"
|
|
15548
|
+
},
|
|
14679
15549
|
{
|
|
14680
15550
|
"name": "SassCompiler",
|
|
14681
15551
|
"kind": "interface",
|
|
@@ -15050,14 +15920,14 @@
|
|
|
15050
15920
|
"name": "Server",
|
|
15051
15921
|
"kind": "class",
|
|
15052
15922
|
"package": "@nifrajs/core",
|
|
15053
|
-
"signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n 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 /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, or with a validated-send route. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n /** 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 /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` 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 /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500).\n * Order-scoped: captured by routes declared *after* this call, none before; one added after the last\n * route reaches nothing (see {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe).\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - 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, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`; the 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, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: 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 response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `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, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n /**\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 compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n /**\n * Same shape as `buildFusedDeriveBefore`, plus one `afterHandle` step. The closure runs (validate) →\n * derive → before → handler → after in one frame, the shape the realistic middleware route lands on\n * when it also wants a response transform (e.g. attaching a request id to a successful payload's\n * headers). `LifecycleExecutionLane` and `selectRouteLanes` guarantee `afterHandle === 1`, the\n * throw contract is the same as the generic program, and the `after` step is the final transform +\n * respond the generic program already does.\n */\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade. 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}",
|
|
15923
|
+
"signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n 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 /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, or with a validated-send route. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly fetchMounts;\n /** 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 /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` 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 /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500).\n * Order-scoped: captured by routes declared *after* this call, none before; one added after the last\n * route reaches nothing (see {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe).\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - 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, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`; the 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, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: 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 response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `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, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n /**\n * Same shape as `buildFusedDeriveBefore`, plus one `afterHandle` step. The closure runs (validate) →\n * derive → before → handler → after in one frame, the shape the realistic middleware route lands on\n * when it also wants a response transform (e.g. attaching a request id to a successful payload's\n * headers). `LifecycleExecutionLane` and `selectRouteLanes` guarantee `afterHandle === 1`, the\n * throw contract is the same as the generic program, and the `after` step is the final transform +\n * respond the generic program already does.\n */\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade. 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}",
|
|
15054
15924
|
"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 */"
|
|
15055
15925
|
},
|
|
15056
15926
|
{
|
|
15057
15927
|
"name": "Server",
|
|
15058
15928
|
"kind": "class",
|
|
15059
15929
|
"package": "nifra",
|
|
15060
|
-
"signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n 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 /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, or with a validated-send route. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n /** 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 /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` 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 /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500).\n * Order-scoped: captured by routes declared *after* this call, none before; one added after the last\n * route reaches nothing (see {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe).\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - 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, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`; the 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, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: 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 response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `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, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n /**\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 compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n /**\n * Same shape as `buildFusedDeriveBefore`, plus one `afterHandle` step. The closure runs (validate) →\n * derive → before → handler → after in one frame, the shape the realistic middleware route lands on\n * when it also wants a response transform (e.g. attaching a request id to a successful payload's\n * headers). `LifecycleExecutionLane` and `selectRouteLanes` guarantee `afterHandle === 1`, the\n * throw contract is the same as the generic program, and the `after` step is the final transform +\n * respond the generic program already does.\n */\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade. 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}",
|
|
15930
|
+
"signature": "export declare class Server<R extends Registry = EmptyRegistry, Ctx = EmptyContext, HookOutput = never> {\n /**\n * Which copy of `@nifrajs/core` declared this type. Two copies in one build (a linked sibling repo,\n * a hoisting split) produce two unrelated `Server` types whose assignment error is a wall of\n * missing internals; the brand puts the feature version in the type itself, so `typeof app` on\n * hover - and `NifraFeatureVersion` in an assertion - says which core an app is talking to.\n * `nifra doctor` is the diagnosis that names both install paths.\n *\n * `declare` = type-only: no field is emitted, nothing is allocated per server.\n */\n readonly __nifraCoreVersion: NifraFeatureVersion;\n private readonly catalog;\n /** WebSocket routes, matched separately at upgrade time (a GET + `Upgrade: websocket`). */\n private readonly wsRouter;\n 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 /** True once any `app.ws()` route sets `validateSend: true` - the one case where a broadcast frame\n * is validated (and possibly dropped) per socket, so `app.publish` must stay on the JS registry loop\n * rather than delegate to Bun's native `server.publish`. */\n private wsHasValidatedSend;\n /** Bun's native topic broadcast, bound by `listen()` in native-pubsub mode; `app.publish` uses it\n * instead of the JS registry. `undefined` off Bun, before `listen()`, or with a validated-send route. */\n private nativePublish;\n private readonly maxBodyBytes;\n private readonly protoPoisoning;\n /** `trustBodyFraming`: mark every `app.fetch` request as runtime-framed (see ServerOptions). */\n private readonly trustBodyFraming;\n private readonly wsMaxPayloadBytes;\n private readonly requestTimeoutMs;\n private readonly wsUpgradeTimeoutMs;\n /** Installed by the `responseContract()` plugin; `undefined` = not installed, which is the default\n * and the state in which a declared `response` schema stays a compile-time contract only. */\n private responseContractRuntime;\n /** Opt-in caller-IP trust declaration; `undefined` = socket peer only, no forwarded header believed. */\n private readonly clientIpTrust;\n private readonly acceptInboundDeadlines;\n private readonly maxInboundDeadlineMs;\n private readonly deadlineAdmissionOptions;\n private readonly gracefulSignals;\n private readonly stopHooks;\n private readonly fetchMounts;\n /** 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 /**\n * Add a per-request, computed context extension. Order-scoped: it is snapshotted into every route\n * declared *after* this call, and reaches none declared before. One added after the last route\n * (e.g. on the app returned by a route-registering factory) covers nothing - see\n * {@link ServerOptions.unusedScopedHooks}.\n *\n * Returning a `status(...)` (or a `Response`) instead of an extension ends the request there - the\n * guard shape, and the cheap one: it renders as plain data on the same lane a handler's return\n * takes, where `throw new Response(...)` pays ~40% of the rejection lane to build the object. That\n * branch is control flow, so it does not widen the derived context type.\n */\n derive<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx & ContextExtensionOf<ReturnType<H>>, HookOutput | StatusResponseOf<Awaited<ReturnType<H>>>>;\n /**\n * Add a static context value. Order-scoped: captured by every route declared *after* this call, and\n * by none before; one added after the last route reaches nothing\n * (see {@link ServerOptions.unusedScopedHooks}).\n */\n decorate<const K extends string, V>(key: K, value: V): Server<R, Ctx & Record<K, V>, HookOutput>;\n /**\n * Run before routing on the raw request. Return a `Response` 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 /**\n * Run after validation, before the handler; a non-`undefined` return short-circuits. Order-scoped:\n * it is snapshotted into every route declared *after* this call and covers none declared before, so\n * one added after the last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n beforeHandle<H extends (context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Wrap the matched route lifecycle for subsequent routes. This is intentionally generic over the\n * route output, so wrappers like async context storage do not force Node's direct JSON path through\n * a Web `Response`. The first registered wrapper is outermost.\n *\n * Order-scoped: captured by every route declared *after* this call, none before; one added after the\n * last route reaches nothing (see {@link ServerOptions.unusedScopedHooks}).\n */\n around<H extends (context: Context & Ctx, next: () => MaybePromise<unknown>) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /**\n * Asynchronously admit each subsequent `executeCapability()` call before its owned effect runs.\n * Interceptors receive token-only metadata plus an abort signal and must call `next()` exactly once\n * to admit. Returning without `next()`, timing out, aborting, or throwing fails the effect closed.\n */\n aroundCapability(interceptor: CapabilityInterceptor, options?: AroundCapabilityOptions): this;\n /** Observe token-only admission/execution lifecycle events for subsequent capability routes. */\n observeCapability(observer: EffectLifecycleObserver): this;\n /** Transform the handler's result before it is serialized. Order-scoped: captured by routes declared\n * *after* this call, none before; one added after the last route reaches nothing (see\n * {@link ServerOptions.unusedScopedHooks}). */\n afterHandle<H extends (result: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Handle a thrown error; a non-`undefined` return becomes the response (else the default 500).\n * Order-scoped: captured by routes declared *after* this call, none before; one added after the last\n * route reaches nothing (see {@link ServerOptions.unusedScopedHooks}). */\n onError<H extends (error: unknown, context: Context & Ctx) => MaybePromise<unknown>>(fn: H): Server<R, Ctx, HookOutput | HookOutputOf<ReturnType<H>>>;\n /** Transform every outgoing response - success, error, 404, 405, short-circuit. Global. */\n onResponse(fn: (response: Response, req: Request) => MaybePromise<Response>): this;\n /**\n * Declare response headers with NO per-request decision behind them - and pay nothing for them on\n * the request path.\n *\n * These are not a hook. Because the values are known at wire-up, they are folded into response\n * construction (one prebuilt init for JSON renders, one record merge where the request set its own\n * headers), so an app whose only response middleware is static keeps every fused and native lane -\n * `onResponse`/`onResponseHeaders` disable Bun's fused native routes and, for a full `onResponse`,\n * the Node direct writer. They apply to EVERY response, exactly as a response hook would: success,\n * error, 404/405, timeout, and short-circuit alike.\n *\n * app.responseHeaders({ \"x-frame-options\": \"DENY\", \"referrer-policy\": \"no-referrer\" })\n *\n * They are DEFAULTS: a value the request itself produced (`c.set.headers`, or a response hook)\n * wins, whatever casing it used. Names are lowercased once here; a non-string value, an invalid\n * name, `__proto__`, or a name the render owns (`content-type`, `content-length`,\n * `transfer-encoding`, `set-cookie`) throws a `TypeError` at wire-up.\n *\n * ORDERING: declarations made before any response hook fold into one static record. One made AFTER\n * a response hook cannot - the hook may already have written that name and must keep winning - so\n * it registers as an ordinary `onResponseHeaders` hook instead, preserving registration order at\n * the cost of the static tier's speed. Declare static headers first.\n */\n responseHeaders(record: Readonly<Record<string, string>>): this;\n /** Wire an already-validated lowercase record into the static tier, or - once a dynamic response\n * hook owns part of the header state - into a hook that runs in the right order. */\n private addStaticResponseHeaders;\n private enableResponseBodyTagging;\n private responseObserverMethods;\n /** Observe the terminal response after all transformations. Observers are ordered and fail-open. */\n onResponseFinalized(fn: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>): this;\n /** Enable the opt-in portable response observer methods. */\n use(plugin: ResponseObserverPlugin): this & ResponseObserverMethods;\n /**\n * Apply a **context** plugin ({@link ContextPlugin}, from {@link defineContextPlugin}) - it adds `D`\n * to the handler context and changes nothing else, so the route registry `R` and the existing context\n * `Ctx` thread through untouched. Like the identity overload above, this exists because the generic\n * `(app: this) => Out` overload below cannot infer through a *generic* plugin signature: it erases the\n * plugin's own type parameters to their constraints, which silently widens `R` to `Registry`.\n */\n use<D extends object>(plugin: ContextPlugin<D>): Server<R, Ctx & D, HookOutput>;\n /**\n * Apply a type-**identity** plugin ({@link IdentityPlugin}, from {@link defineIdentityPlugin}) - it\n * registers routes/hooks but doesn't change the types, so this returns `this` with the route registry\n * and context fully intact. This overload exists specifically so a named identity plugin (e.g.\n * `@nifrajs/better-auth`) threads the registry: its `& { pluginName }` intersection would otherwise\n * defeat the generic inference of the transforming overload below and collapse the result to `any`.\n */\n use<AddedHookOutput = never>(plugin: IdentityPlugin<AddedHookOutput>): Server<R, Ctx, HookOutput | AddedHookOutput>;\n /**\n * Apply a **plugin function** - `(app) => app`, typically built with {@link definePlugin}. It's\n * called with `this` and its result is returned, so an inline plugin's `derive`/`decorate` thread\n * the added context to handlers defined after `use` (the overload is generic over the concrete\n * `this`). A named plugin already applied is skipped (idempotent dedupe).\n *\n * If the plugin's return type is unpinned - `Server<any, any>`, as a hand-rolled `(app) => app` or a\n * `NifraPlugin<AnyServer, AnyServer>` infers (e.g. an auth plugin whose own types collapsed) - this\n * returns the non-callable {@link PluginTypeCollapsed} instead of silently widening the whole typed\n * client to `any`. `.get()`/`.post()` then fail right here rather than surfacing as `any` hundreds of\n * lines away. Fix at the plugin: build it with {@link defineIdentityPlugin}/{@link defineContextPlugin},\n * or pin its input server type. This mirrors the guard {@link definePlugin} already applies.\n */\n use<Out extends AnyServer>(plugin: (app: this) => Out): [ServerTypeUnpinned<Out>] extends [true] ? PluginTypeCollapsed : Out;\n /**\n * Apply a {@link Middleware} bundle - wire each hook it provides to its lifecycle point. Returns\n * `this` (no context-type merging); call it before the routes its `beforeHandle`/`afterHandle`\n * should cover (those are order-scoped; `onRequest`/`onResponse` are global). A bundle applied after\n * the last route reaches nothing - {@link ServerOptions.unusedScopedHooks} logs that at seal. A named\n * bundle already applied is skipped (idempotent).\n */\n use<M extends Middleware>(mw: M): Server<R, Ctx, HookOutput | MiddlewareOutputOf<M>>;\n use(mw: Middleware): this;\n get<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n get<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"GET\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Register a **typed SSE route** - 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, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n post<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"POST\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n put<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PUT\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n patch<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"PATCH\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, S extends RouteSchema, H extends Handler<Path, S, Ctx>>(path: Path, schema: S, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, S, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n delete<Path extends string, H extends Handler<Path, RouteSchema, Ctx>>(path: Path, handler: H): Server<AddRoute<R, \"DELETE\", Path, RouteInfoFor<Path, Record<never, never>, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an **MCP tool** an agent can call (via `nifra mcp`, or a mounted MCP endpoint): a typed\n * `POST /_nifra/tool/<name>` route whose `input`/`output` schemas contract the call and surface in\n * `tools/list`. Requires `.use(mcp())` - without it, `.tool()` is a registration error, so an\n * ordinary HTTP app never bundles the MCP wiring. Siblings: {@link resource}, {@link prompt}.\n *\n * import { mcp } from \"@nifrajs/core/mcp\"\n * const app = server().use(mcp()).tool(\n * \"search\",\n * { description: \"Search posts\", input: t.object({ q: t.string() }) },\n * ({ q }) => findPosts(q),\n * )\n */\n tool<Name extends string, S extends {\n description: string;\n input: StandardSchemaV1;\n output?: StandardSchemaV1;\n annotations?: ToolAnnotations;\n }, H extends (input: InferOutput<S[\"input\"]>, ctx: Context & Ctx) => MaybePromise<S[\"output\"] extends StandardSchemaV1 ? InferOutput<S[\"output\"]> : unknown>>(name: Name, config: S, handler: H): Server<AddRoute<R, \"POST\", `/_nifra/tool/${Name}`, RouteInfoFor<`/_nifra/tool/${Name}`, S[\"output\"] extends StandardSchemaV1 ? {\n body: S[\"input\"];\n response: S[\"output\"];\n } : {\n body: S[\"input\"];\n }, OutputOf<H>, HookOutput>>, Ctx, HookOutput>;\n /**\n * Declare an MCP **resource** - read-only data an agent can fetch through `nifra mcp` (app config, a\n * generated document, …). `read` runs in the app process, so capture whatever app state it needs in the\n * closure. `uri` is the MCP resource identifier (e.g. `\"myapp://config\"`). The sibling of {@link tool}\n * for the resource half of MCP.\n */\n resource(uri: string, config: {\n readonly name: string;\n readonly description?: string;\n readonly mimeType?: string;\n }, read: McpResourceDescriptor[\"read\"]): Server<R, Ctx, HookOutput>;\n /**\n * Declare an MCP **prompt** - a reusable prompt template an agent can fetch through `nifra mcp`.\n * `handler` receives the caller's arguments and returns the rendered messages.\n */\n prompt(name: string, config: {\n readonly description: string;\n readonly arguments?: readonly PromptArgument[];\n }, handler: McpPromptDescriptor[\"handler\"]): Server<R, Ctx, HookOutput>;\n /** The MCP resources declared via {@link resource} - enumerated by `nifra mcp`. */\n mcpResources(): readonly McpResourceDescriptor[];\n /** The MCP prompts declared via {@link prompt} - enumerated by `nifra mcp`. */\n mcpPrompts(): readonly McpPromptDescriptor[];\n /**\n * Register a **WebSocket** route. The connection upgrades on a `GET` to `path` carrying\n * `Upgrade: websocket`; the 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, HookOutput> : Server<AddRoute<R, \"WS\", Path, WsRouteInfoFor<Path, Schema, Send>>, Ctx, HookOutput>;\n /**\n * Broadcast `data` to every WebSocket connection subscribed to `topic` (via `ws.subscribe(topic)`).\n * In-process and **single-instance** (see {@link TopicRegistry}) - a multi-instance deploy must bridge\n * an external fan-out (Redis, a Durable Object) to this. A no-op when nobody is subscribed.\n */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n private route;\n /**\n * Low-level route registration shared by the inline builder and `implement()`.\n * Captures the server's current `derive`/`decorate` chain into the route - this\n * is the \"compiled\", order-scoped per-route chain.\n */\n register(method: 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 response observer plugin. */\n [INSTALL_RESPONSE_OBSERVER](runtime: ResponseObserverRuntime): ResponseObserverMethods;\n /** @internal Symbol-keyed install seam for the `idempotency()` plugin. Off the public typed surface. */\n [INSTALL_IDEMPOTENCY](runtime: IdempotencyRuntime): void;\n /** @internal Symbol-keyed install seam for the `mcp()` plugin. Off the public typed surface. */\n [INSTALL_MCP](runtime: McpRuntime): void;\n /** @internal Symbol-keyed install seam for the `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, HookOutput2>(other: Server<R2, Ctx2, HookOutput2>): Server<R & R2, Ctx, HookOutput>;\n /** A fused renderer closes over runtime services to keep its seven-argument JSC fast path. Merging\n * rebinds that closure once to the executing server; generic plans already receive the runtime. */\n private bindFusedRuntime;\n /**\n * Enumerate the registered routes (method, path, input schemas), in registration\n * order. Powers `toOpenAPI` and other introspection; the router trie itself no\n * longer holds the original patterns.\n */\n routes(): ReadonlyArray<RouteDescriptor>;\n /**\n * Resolve a `Request` to a `Response` - the whole lifecycle, testable without a port. The\n * optional `platform` carries edge inputs (`env`, `waitUntil`); edge adapters pass it, and\n * Bun/Node/Deno omit it (then `c.env` is `undefined` and `c.waitUntil` runs fire-and-forget).\n */\n fetch(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<Response>;\n private fetchSource;\n private fetchSourceInner;\n /** Web response path when Bun already matched the route. The lifecycle and response hooks remain\n * exactly the same as {@link fetchSource}; only portable URL scanning + trie lookup are skipped. */\n private fetchMatched;\n private fetchMatchedInner;\n /**\n * Run `produce` under the capacity gate: admit → run → release exactly once when the response is\n * produced (or the run throws). Only reached when {@link capacityGate} is set, so the off path pays\n * nothing. The slot is held for the duration of handler execution, not the streaming of the body -\n * capacity here bounds concurrent *work*, matching how in-flight is counted.\n */\n private admitGated;\n private runAdmitted;\n /**\n * Select a mounted handler's native Node lane without materializing a Web Request. This is an\n * adapter seam, not a second lifecycle: any app-wide behavior that the ordinary mount path would\n * run makes the capability ineligible and the caller falls back to `resolveNodeSource`. Typed\n * routes keep precedence exactly as `routeAndRun` does, including the existing mount behavior for\n * a path whose registered route rejects this method.\n */\n [RESOLVE_NODE_MOUNT](source: RequestSource): NativeMountSelection | undefined;\n /**\n * Like {@link fetch}, but renders a plain-data result **without** building a Web `Response` - the\n * `@nifrajs/node` adapter serializes the returned primitives straight to the socket, skipping the undici\n * `Response` build + body drain (the bulk of the Node bridge cost, measured ≈4µs/req). A handler that\n * returns a `Response`, an error/short-circuit, or a response hook that replaces/consumes the buffered\n * body stays on the full Web path; an in-place response hook can still use the direct writer. Same\n * lifecycle as {@link fetch} (body cap, validation, hooks all run); only the final render differs.\n */\n resolveNode(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<NodeServeOutcome>;\n resolveNodeSource(source: RequestSource, platform?: Platform<EnvOf<Ctx>>, suppliedRuntime?: NodeOutcomeRuntime): MaybePromise<NodeServeOutcome>;\n /** Run generic Web response middleware while retaining direct writes for untouched buffered bodies. */\n private finishNodeWebResponse;\n /** True only when every transforming Web response hook has a header-only Node equivalent. */\n private canUseNodeResponseHooks;\n /** Apply paired native hooks to data outcomes; preserve the complete Web hook pipeline for Response outcomes. */\n private finishNodeResponse;\n private withNodeResponseHeaders;\n /** Synchronous until a native response hook actually returns a Promise. */\n private applyNodeResponseHooks;\n private continueNodeResponseHooks;\n /**\n * Resolve a WebSocket upgrade - the seam every serving adapter uses. Returns `pass` (not a WS\n * upgrade for a registered route → handle as normal HTTP), `reject` (a WS route matched but\n * `upgrade()` rejected, or the path was malformed → return `response`), or `upgrade` (perform the\n * runtime upgrade, then dispatch the native socket's events to `handler`, seeding `ws.data` with\n * `data`). Runs the route's `upgrade(c)` guard in a real request context. Synchronous unless\n * `upgrade()` is async; a throw rejects with a flat 500 (no detail leaked).\n */\n private runWebSocketRequestHooks;\n private continueWebSocketRequestHooks;\n resolveWebSocketUpgrade(req: Request, platform?: Platform<EnvOf<Ctx>>): MaybePromise<WebSocketUpgradeOutcome>;\n /** Bun `fetch` when WS routes exist: try a WS upgrade first, else run the normal HTTP lifecycle.\n * `undefined` ⇒ Bun owns the upgraded socket; a `Response` ⇒ a normal reply or a rejected upgrade.\n * (The socket dispatch itself lives in `ws-bun.ts`, loaded via `@nifrajs/core/ws`.) */\n private bunFetchWithWebSocket;\n /**\n * The shared lifecycle, generic over how the final value is rendered: `finalize` turns a handler's\n * result + `set` into the output `T` (`toResponse` → a Web `Response`; `toNodeOutcome` → node-direct\n * primitives), `wrapResponse` lifts an early/error `Response` into that same `T`, and `onTimeout`\n * produces the 503. The Web `fetch` and `resolveNode` are thin callers over this one routing +\n * context + lifecycle implementation - no duplication across the trust boundary.\n */\n /** Apply the `clientIp` trust declaration to the adapter's raw socket peer, returning a platform\n * whose `clientIp` is the derived caller. Only called when a trust declaration is configured. */\n private deriveClientIp;\n private dispatch;\n /** Node-native request hook walk. A header-only hook can inspect the lazy source without forcing a\n * Web `Request`; arbitrary request rewrites and full Web hooks use {@link runWithOnRequest}. */\n private runWithNodeRequest;\n private continueNodeRequest;\n private canUseNodeRequestHooks;\n /**\n * onRequest short-circuit path. Synchronous as long as every hook returns synchronously (the\n * common case - e.g. CORS returning `undefined` for a non-preflight request): an `async` version\n * here put EVERY request of any app with one onRequest hook onto the promise machinery, profiled\n * at ~13% of a realistic request. The first hook that returns a Promise hands the REMAINING\n * hooks to the async continuation; behavior is identical.\n */\n private runWithOnRequest;\n /** Async tail of {@link runWithOnRequest}: applies the first awaited hook's outcome, then runs\n * the remaining hooks (awaiting freely - we're already async here). */\n private continueOnRequest;\n private takeResponseRequest;\n /**\n * The NodeRequestContext for a source, MEMOIZED per source so the request twins and the response\n * twins receive the exact same object within one request - that identity is the documented\n * contract stateful twins key their WeakMaps on. An adapter source (which already speaks the\n * interface) is returned as-is; a plain `Request` source (a direct `resolveNode` caller) gets one\n * cached wrapper.\n */\n private nodeRequestContextOf;\n /** Preserve the request visible to generic onRequest hooks for paired native response hooks. */\n private takeNodeResponseRequest;\n /**\n * Route → build context → run. Synchronous through to the handler for a **bare** route\n * (selected by its compiled plan), so a sync handler produces its result with zero promise allocations;\n * routes with validation/hooks keep the full compiled route program, unchanged.\n */\n private routeAndRun;\n private fetchMount;\n /** Run a route that has already been matched by the runtime or Nifra's portable router. */\n private runMatched;\n /** Supply request-specific deadline state to the route's precompiled execution plan. */\n private runMatchedLanes;\n /** @internal Symbol-keyed install seam for the `effectLedger()` plugin. Off the public typed surface. */\n [INSTALL_EFFECT_LEDGER](runtime: EffectLedgerRuntime): void;\n /** The narrowest bare route: a syntactic `() => ...` handler cannot observe the context argument, so\n * successful requests can skip allocating `RequestContext`. Errors still allocate one for logging. */\n private runContextlessBare;\n private contextlessBareError;\n /**\n * The synchronous fast path selected by a route's execution plan: apply static decorations, call the\n * handler, render the result - **no `await`** unless the handler itself returns a promise. It mirrors\n * the same error boundary as the compiled route program (which a bare route would otherwise no-op through) and shares\n * {@link logRequestError}; a bare route has no `onError` hooks, so error handling is fully synchronous\n * (a thrown `Response` is control flow; anything else is a logged flat 500). This is where nifra skips\n * the per-request async-frame tax - the same win codegen routers get, but without `eval`.\n */\n private runBare;\n /** Bare-route error rendering - identical to the compiled route program's catch minus the (absent) onError\n * loop: a thrown `Response` is returned as deliberate control flow; anything else is logged + 500. */\n /**\n * Build a route's fused Web renderer. Composition happens once at\n * registration; the returned closure is what every request to the route runs. Behavior is\n * byte-identical to the generic `runBare`/`runContextlessBare` + `toResponse` pair - same\n * decoration order, same error routing (thrown `Response` = control flow; anything else logs and\n * 500s), same respond semantics (the lifecycle parity suite pins it).\n */\n private buildFusedWeb;\n /** Compile the eligible body-only route's parser → validator → handler continuation once. The\n * bounded parser remains shared with the generic lane; only the route-invariant entry lookups and\n * lifecycle dispatch disappear from the common synchronous-validator/synchronous-handler case. */\n private buildFusedBodyRunner;\n /** Web adapter wrapper for the shared body runner. Node passes its native finalizer directly through\n * the execution plan, while Web needs the live context to preserve lazy `c.set` controls. */\n private buildFusedBodyWeb;\n /** The fused Web lane for a route whose only lifecycle step is a query schema: parse + validate +\n * handler + respond in one closure, no lifecycle promise when the validator and handler are sync.\n * Eligibility is decided at registration (see `fusedQuery` in {@link register}); the semantics here\n * are exactly `runQueryOnly`'s for that eligible shape - invalid input returns\n * `validationError(issues)` (recovery hooks disqualify the route from this lane), a thrown\n * `Response` passes through, anything else logs and returns a flat 500, and an async validator\n * falls to a then-chain with the same steps. */\n private buildFusedQueryWeb;\n /**\n * Compile a route's `derive + before` lifecycle to a single closure: the per-request walk through\n * `runSync` → `runHooksSync` is a stack of 3 frames and 2 `Object.assign`s for what is by far the\n * most common middleware shape (auth/trace/id derivation, an auth/policy `beforeHandle`). Folding\n * the same steps into one closure hits the same monomorphic inline-cache site as `buildFusedWeb`,\n * and `Object.assign(ctx, deriveResult)` becomes one extra property write on the context's already\n * hot hidden class. Behavior is byte-identical to the compiled route program: the same thrown-value\n * contract (`Response` is control flow, anything else logs + 500), the same `c.set` semantics, the\n * same `fusedRespond` for the rendered body. The `LifecycleExecutionLane` guarantee\n * (`schema.params === undefined && schema.headers === undefined && derives === 1 &&\n * beforeHandle === 1 && afterHandle === 0 && onError === 0 && !hasResponseContract &&\n * !hasDecorations`) is enforced by `selectRouteLanes`; this lane is selected ONLY when all of those\n * hold. A `query` schema (the route declares `{ query }` alongside the hooks) is validated FIRST,\n * mirroring the compiled route program's stage order; the fused builder runs validate → derive →\n * before → handler in one frame.\n */\n private buildFusedDeriveBefore;\n /**\n * Same shape as `buildFusedDeriveBefore`, plus one `afterHandle` step. The closure runs (validate) →\n * derive → before → handler → after in one frame, the shape the realistic middleware route lands on\n * when it also wants a response transform (e.g. attaching a request id to a successful payload's\n * headers). `LifecycleExecutionLane` and `selectRouteLanes` guarantee `afterHandle === 1`, the\n * throw contract is the same as the generic program, and the `after` step is the final transform +\n * respond the generic program already does.\n */\n private buildFusedDeriveBeforeAfter;\n /**\n * Body + lifecycle hooks fused: parse → validate → derive → before → handler → (after) in one\n * closure, the same win `buildFusedBodyRunner` gives for the no-hooks body shape. The shape is\n * `lifecycleHookLane` PLUS a body schema with no other validation conflicts; the lane is selected\n * ONLY when `schema.body !== undefined && schema.query/params/headers === undefined &&\n * schema.onValidationError === undefined && !defaultOnValidationError && !hasIdempotency &&\n * !hasLedger && derives === 1 && beforeHandle === 1 && afterHandle <= 1 && onError === 0 &&\n * !hasResponseContract && !hasDecorations && around === 0`. The same single `querySchema === undefined`\n * trick used in the no-body lane lets the build path stay simple: a query + body route falls back\n * to the generic program (this is rare in practice - validated query + validated body is usually a\n * \"search results\" route with a middleware chain on top, and the generic lane is fine there).\n */\n private buildFusedBodyDeriveBeforeAfter;\n private bareError;\n /**\n * Keep the ordinary thrown-error response independent from the caught value. Deliberate Response\n * control flow is handled by `renderBareError`; every other throw gets this fixed public envelope.\n */\n private internalErrorResponse;\n private runWithAround;\n /** Execute the registration-compiled general stage program. */\n private runProgram;\n /** Bind a compiled validation stage to its stable schema and the existing recovery contract. */\n private validateProgramStage;\n /** Preserve the existing bounded body reader and its fail-closed framing/prototype checks. */\n private readProgramBody;\n /** Keep thrown Response/status and redacted 500 semantics in one existing error boundary. */\n private handleProgramError;\n /** Finish a successful program result through response-contract enforcement and finalization. */\n private finishProgramResult;\n private runAround;\n private runBodyOnly;\n /** Validate + run the handler for the bodyOnly path - shared by the inline fast path and the\n * streaming fallback. A method (not per-request closures) so the hot path allocates nothing\n * beyond the one `.then` continuation. */\n private finishBodyOnly;\n private executeHandler;\n private handleValidationErrorRecovery;\n private applyBodyValidation;\n private runQueryOnly;\n /** Validate-result → set `ctx.query` → run handler. A method (not a per-request closure), the\n * query analogue of {@link applyBodyValidation}. */\n private applyQueryValidation;\n /**\n * Thread the response through each global `onResponse` hook. Stays SYNCHRONOUS until a hook\n * actually returns a Promise - an `async` version forced a promise + microtask on EVERY response\n * of any app with an onResponse hook (cors/securityHeaders/etag/timing all use onResponse), the\n * same ~13%/req tax the onRequest walk was de-async'd to avoid. The first async hook hands the\n * rest to {@link continueOnResponse}.\n */\n private applyOnResponse;\n private applyOnResponseAndFinalize;\n private completeResponseFinalization;\n private failResponseFinalization;\n /** Notify terminal observers in order while isolating both sync and async failures. */\n private notifyResponseFinalized;\n /** Async tail of {@link applyOnResponse}: runs the remaining hooks once one has gone async. */\n private continueOnResponse;\n /**\n * Bound the response time. On timeout we abort `ctx.signal` (so cancellation-aware\n * handlers can bail) and return 503; the in-flight work keeps running but its\n * result is discarded - JS can't forcibly cancel a promise.\n */\n private withTimeout;\n private finishLifecycleContract;\n private finishContractOutcome;\n /** Synchronous by design, and `MaybePromise` rather than `Promise` for the same reason: control flow\n * out of a lifecycle stage must not cost a promise. An `async` method allocates one and defers the\n * result a microtask even when every branch it takes returns immediately, which is the common case\n * here - a thrown `status(...)`/`Response`, or a route with no `onError` hook at all. Only the hook\n * loop, which may await, drops into {@link runErrorHooks}. */\n private handleLifecycleError;\n /** The `onError` chain, split off {@link handleLifecycleError} so its `await` costs only the routes\n * that registered a hook. A hook may return a custom response; otherwise the default 500 stands. */\n private runErrorHooks;\n /** Log an unhandled request error to the (redacting) logger - shared by the compiled route program and the\n * bare fast path ({@link bareError}) so both record the same fields. Never throws; never leaks. */\n private logRequestError;\n private readAndValidateBody;\n /** Apply validation and its recovery hook on the generic lifecycle lane. Recovery is completed\n * before derives/beforeHandle run, matching the body-only and query-only execution lanes. */\n private applyLifecycleValidation;\n private finishLifecycleValidationRecovery;\n /** Adapt one route's compiled execution plan to Bun's already-matched request shape. Route\n * semantics remain in the plan; this closure only supplies native params and deadline fallback. */\n private compileBunNativeHandler;\n /** Compile portable route registrations into Bun's native route table. Apps with request-rewrite\n * hooks or WebSockets retain the single portable dispatcher because those features must run before\n * route selection/upgrade. 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}",
|
|
15061
15931
|
"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 */"
|
|
15062
15932
|
},
|
|
15063
15933
|
{
|
|
@@ -15265,13 +16135,13 @@
|
|
|
15265
16135
|
"name": "ServerOptions",
|
|
15266
16136
|
"kind": "interface",
|
|
15267
16137
|
"package": "@nifrajs/core",
|
|
15268
|
-
"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 /**\n * What to do when an order-scoped hook (`derive`/`beforeHandle`/`around`/`aroundCapability`/\n * `afterHandle`/`onError`/`decorate`) covers no route because it was added after the last route was\n * registered. `register()` snapshots the current chain into each route as it is declared, so a hook\n * appended after every route reaches nothing and is silently dead. `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
|
|
16138
|
+
"signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Clean payloads\n * pay a substring pre-scan only - the deep walk runs solely on suspect text.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /** 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 /**\n * What to do when an order-scoped hook (`derive`/`beforeHandle`/`around`/`aroundCapability`/\n * `afterHandle`/`onError`/`decorate`) covers no route because it was added after the last route was\n * registered. `register()` snapshots the current chain into each route as it is declared, so a hook\n * appended after every route reaches nothing and is silently dead. `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
|
|
15269
16139
|
},
|
|
15270
16140
|
{
|
|
15271
16141
|
"name": "ServerOptions",
|
|
15272
16142
|
"kind": "interface",
|
|
15273
16143
|
"package": "nifra",
|
|
15274
|
-
"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 /**\n * What to do when an order-scoped hook (`derive`/`beforeHandle`/`around`/`aroundCapability`/\n * `afterHandle`/`onError`/`decorate`) covers no route because it was added after the last route was\n * registered. `register()` snapshots the current chain into each route as it is declared, so a hook\n * appended after every route reaches nothing and is silently dead. `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
|
|
16144
|
+
"signature": "export interface ServerOptions {\n /**\n * Max request body size (bytes), the default transport cap for every route. Default 1_000_000.\n * A route can choose a finite `schema.bodyLimit` of its own; an explicit `'unlimited'` route\n * requires `schema.bodyLimitReason` and is intended only for a separately bounded streaming or\n * upload integration.\n *\n * Framework readers (the body-schema lane, `c.boundedJson`) enforce the cap when they read. A\n * route WITHOUT a body schema (raw body, file upload, BYO-validation) is covered too: direct\n * `c.req` reads (`json()`, `arrayBuffer()`, the raw `body` stream, ...) are capped in place -\n * lazily, nothing is buffered until code actually reads - and answer 413 past the limit.\n * `c.boundedBody(n)` states its own explicit per-read limit, above or below the route's cap.\n */\n readonly maxBodyBytes?: number;\n /**\n * Prototype-poisoning policy for JSON bodies (the schema path and `c.boundedJson`). An own\n * `__proto__` key, or a `constructor` carrying a `prototype`, is the payload shape that turns a\n * later innocent merge/assign into prototype pollution. `\"reject\"` (default) answers the same\n * flat 400 as malformed JSON; `\"strip\"` removes the offending keys and continues; `\"ignore\"`\n * parses as-is (only for routes that never merge body input into other objects). Clean payloads\n * pay a substring pre-scan only - the deep walk runs solely on suspect text.\n */\n readonly protoPoisoning?: \"reject\" | \"strip\" | \"ignore\";\n /**\n * Declare that every `Request` reaching `app.fetch` was framed by a runtime HTTP parser, so its\n * `Content-Length` is an exact transport boundary rather than a hint. Set this ONLY when the\n * runtime's own request object is handed through untouched with no adapter in between to mark it -\n * a bare `export default app` on an edge runtime. Every supported ingress already marks itself:\n * `listen()` on Bun, `toFetchHandler(app)` on Workers/edge, `@nifrajs/deno`, and `@nifrajs/node`\n * (which reads exact bytes and never needs the mark). Reach for this option only for an ingress\n * nifra does not ship an adapter for.\n *\n * Left off (default), the JSON body lane copies the body out and enforces the cap on DELIVERED\n * bytes, because an unmarked request may have been rebuilt by an adapter that kept a caller's\n * `content-length` while decoding a payload of a different size. That check costs an extra pass\n * over the body, which is why an edge deployment that cannot be lied to may opt out of it.\n *\n * Do not set this on an app whose `fetch` is also called with `Request`s assembled from\n * untrusted input.\n */\n readonly trustBodyFraming?: boolean;\n /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected\n * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).\n * Default: `maxBodyBytes` (1 MB). */\n readonly wsMaxPayloadBytes?: number;\n /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */\n readonly requestTimeoutMs?: number;\n /** WebSocket upgrade admission/guard timeout (ms). Default 10_000; set to 0 only for a deliberate unbounded guard. */\n readonly wsUpgradeTimeoutMs?: number;\n /**\n * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw\n * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits\n * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or\n * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't\n * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.\n */\n readonly clientIp?: ClientIpTrust;\n /**\n * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:\n * services that participate in trusted cross-service deadline propagation opt in explicitly,\n * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.\n */\n readonly acceptInboundDeadlines?: boolean;\n /**\n * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute\n * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.\n * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.\n */\n readonly maxInboundDeadlineMs?: number;\n /** 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 /**\n * What to do when an order-scoped hook (`derive`/`beforeHandle`/`around`/`aroundCapability`/\n * `afterHandle`/`onError`/`decorate`) covers no route because it was added after the last route was\n * registered. `register()` snapshots the current chain into each route as it is declared, so a hook\n * appended after every route reaches nothing and is silently dead. `\"warn\"` (default) logs once at\n * seal (first `listen()`/`fetch`/`resolveNode`); `\"error\"` throws a `FrameworkError`\n * (`UNUSED_SCOPED_HOOKS`); `\"off\"` skips the bookkeeping entirely, including the one-frame stack\n * capture. App-global hooks (`onRequest`/`onResponse`/...) are unaffected in every mode.\n *\n * This is a development-time diagnostic: the whole audit is guarded by `process.env.NODE_ENV !==\n * \"production\"`, so any bundler that defines `NODE_ENV` (vite/esbuild/webpack/next, `bun build\n * --production`) dead-code-eliminates it, leaving zero bytes and zero per-request cost in the shipped\n * bundle. It fires in development, test, and CI - where you catch the mistake - not in production.\n */\n readonly unusedScopedHooks?: \"warn\" | \"error\" | \"off\";\n}"
|
|
15275
16145
|
},
|
|
15276
16146
|
{
|
|
15277
16147
|
"name": "ServeStaticOptions",
|
|
@@ -15318,7 +16188,7 @@
|
|
|
15318
16188
|
"name": "SessionContext",
|
|
15319
16189
|
"kind": "interface",
|
|
15320
16190
|
"package": "@nifrajs/auth",
|
|
15321
|
-
"signature": "export interface SessionContext {\n readonly cookies: Readonly<Record<string, string>>;\n readonly set: {\n cookie(name: string, value: string, options?: CookieOptions): void;\n deleteCookie(name: string, options?: {\n readonly path?: string;\n readonly domain?: string;\n }): void;\n };\n}",
|
|
16191
|
+
"signature": "export interface SessionContext {\n readonly cookies: Readonly<Record<string, string>>;\n /** Optional raw request, used to reject ambiguous duplicate session cookies. */\n readonly request?: Request;\n readonly set: {\n cookie(name: string, value: string, options?: CookieOptions): void;\n deleteCookie(name: string, options?: {\n readonly path?: string;\n readonly domain?: string;\n }): void;\n };\n}",
|
|
15322
16192
|
"doc": "/** The cookie + response surface the manager needs - a structural subset of nifra's `Context`, so any\n * `c` satisfies it and it's testable with a stub. */"
|
|
15323
16193
|
},
|
|
15324
16194
|
{
|
|
@@ -15409,7 +16279,7 @@
|
|
|
15409
16279
|
"name": "SessionStore",
|
|
15410
16280
|
"kind": "interface",
|
|
15411
16281
|
"package": "@nifrajs/coding-agent",
|
|
15412
|
-
"signature": "export interface SessionStore {\n append(sessionId: string, type: string, payload?: unknown, options?: {\n readonly pinned?: boolean;\n }): Promise<SessionLogEntry>;\n read(sessionId: string): Promise<readonly SessionLogEntry[]>;\n checkpoint(sessionId: string, payload: unknown): Promise<void>;\n fork(sessionId: string, targetSessionId?: string): Promise<string>;\n}"
|
|
16282
|
+
"signature": "export interface SessionStore {\n append(sessionId: string, type: string, payload?: unknown, options?: {\n readonly pinned?: boolean;\n }): Promise<SessionLogEntry>;\n /** Read at most `limit` retained entries from the tail of the session log. */\n read(sessionId: string, limit?: number): Promise<readonly SessionLogEntry[]>;\n checkpoint(sessionId: string, payload: unknown): Promise<void>;\n fork(sessionId: string, targetSessionId?: string): Promise<string>;\n}"
|
|
15413
16283
|
},
|
|
15414
16284
|
{
|
|
15415
16285
|
"name": "SessionUserOf",
|
|
@@ -15787,6 +16657,13 @@
|
|
|
15787
16657
|
"signature": "export declare function snapshotRoutes(source: unknown): readonly RouteSnapshot[];",
|
|
15788
16658
|
"doc": "/**\n * Snapshot an app's routes (anything `reflectRoutes` accepts) as plain JSON. Validators are\n * dropped; only introspectable JSON Schema metadata is kept, so the result round-trips through\n * `JSON.stringify` unchanged.\n */"
|
|
15789
16659
|
},
|
|
16660
|
+
{
|
|
16661
|
+
"name": "snapshotRoutesFromEvidence",
|
|
16662
|
+
"kind": "function",
|
|
16663
|
+
"package": "@nifrajs/core",
|
|
16664
|
+
"signature": "export declare function snapshotRoutesFromEvidence(evidence: ProjectEvidenceSnapshot): readonly RouteSnapshot[];",
|
|
16665
|
+
"doc": "/** Snapshot routes from an existing canonical project-evidence pass. */"
|
|
16666
|
+
},
|
|
15790
16667
|
{
|
|
15791
16668
|
"name": "solidAdapter",
|
|
15792
16669
|
"kind": "const",
|
|
@@ -16795,6 +17672,13 @@
|
|
|
16795
17672
|
"signature": "export declare function toCatalogEntry<Input, Output>(tool: ToolContract<Input, Output>): ToolCatalogEntry;",
|
|
16796
17673
|
"doc": "/** Build the single descriptive projection shared by agent, MCP, and test adapters. */"
|
|
16797
17674
|
},
|
|
17675
|
+
{
|
|
17676
|
+
"name": "toDeadLetterView",
|
|
17677
|
+
"kind": "function",
|
|
17678
|
+
"package": "@nifrajs/jobs",
|
|
17679
|
+
"signature": "export declare function toDeadLetterView(records: readonly DeadLetterRecord[]): readonly DeadLetterView[];",
|
|
17680
|
+
"doc": "/** Project dead-letter records to content-free views. Throws on malformed input, never partial. */"
|
|
17681
|
+
},
|
|
16798
17682
|
{
|
|
16799
17683
|
"name": "toEvalComparisonView",
|
|
16800
17684
|
"kind": "function",
|
|
@@ -16922,6 +17806,12 @@
|
|
|
16922
17806
|
"package": "@nifrajs/core",
|
|
16923
17807
|
"signature": "export type ToolApproval = {\n readonly granted: true;\n readonly level?: number;\n} | {\n readonly granted: false;\n readonly reason?: string;\n};"
|
|
16924
17808
|
},
|
|
17809
|
+
{
|
|
17810
|
+
"name": "ToolApproval",
|
|
17811
|
+
"kind": "type",
|
|
17812
|
+
"package": "@nifrajs/webmcp",
|
|
17813
|
+
"signature": "export type ToolApproval = {\n readonly granted: true;\n readonly level?: number;\n} | {\n readonly granted: false;\n readonly reason?: string;\n};"
|
|
17814
|
+
},
|
|
16925
17815
|
{
|
|
16926
17816
|
"name": "ToolApprovalPolicy",
|
|
16927
17817
|
"kind": "type",
|
|
@@ -16946,12 +17836,24 @@
|
|
|
16946
17836
|
"package": "@nifrajs/mcp",
|
|
16947
17837
|
"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}"
|
|
16948
17838
|
},
|
|
17839
|
+
{
|
|
17840
|
+
"name": "ToolCallOptions",
|
|
17841
|
+
"kind": "interface",
|
|
17842
|
+
"package": "@nifrajs/webmcp",
|
|
17843
|
+
"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}"
|
|
17844
|
+
},
|
|
16949
17845
|
{
|
|
16950
17846
|
"name": "ToolCallResult",
|
|
16951
17847
|
"kind": "type",
|
|
16952
17848
|
"package": "@nifrajs/core",
|
|
16953
17849
|
"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};"
|
|
16954
17850
|
},
|
|
17851
|
+
{
|
|
17852
|
+
"name": "ToolCallResult",
|
|
17853
|
+
"kind": "type",
|
|
17854
|
+
"package": "@nifrajs/webmcp",
|
|
17855
|
+
"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};"
|
|
17856
|
+
},
|
|
16955
17857
|
{
|
|
16956
17858
|
"name": "ToolCatalogEntry",
|
|
16957
17859
|
"kind": "interface",
|
|
@@ -16983,12 +17885,24 @@
|
|
|
16983
17885
|
"package": "@nifrajs/mcp",
|
|
16984
17886
|
"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}"
|
|
16985
17887
|
},
|
|
17888
|
+
{
|
|
17889
|
+
"name": "ToolContract",
|
|
17890
|
+
"kind": "interface",
|
|
17891
|
+
"package": "@nifrajs/webmcp",
|
|
17892
|
+
"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}"
|
|
17893
|
+
},
|
|
16986
17894
|
{
|
|
16987
17895
|
"name": "ToolContractOptions",
|
|
16988
17896
|
"kind": "interface",
|
|
16989
17897
|
"package": "@nifrajs/core",
|
|
16990
17898
|
"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}"
|
|
16991
17899
|
},
|
|
17900
|
+
{
|
|
17901
|
+
"name": "ToolContractOptions",
|
|
17902
|
+
"kind": "interface",
|
|
17903
|
+
"package": "@nifrajs/webmcp",
|
|
17904
|
+
"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}"
|
|
17905
|
+
},
|
|
16992
17906
|
{
|
|
16993
17907
|
"name": "ToolDeltaView",
|
|
16994
17908
|
"kind": "interface",
|
|
@@ -17007,12 +17921,24 @@
|
|
|
17007
17921
|
"package": "@nifrajs/core",
|
|
17008
17922
|
"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}"
|
|
17009
17923
|
},
|
|
17924
|
+
{
|
|
17925
|
+
"name": "ToolError",
|
|
17926
|
+
"kind": "interface",
|
|
17927
|
+
"package": "@nifrajs/webmcp",
|
|
17928
|
+
"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}"
|
|
17929
|
+
},
|
|
17010
17930
|
{
|
|
17011
17931
|
"name": "ToolEvidence",
|
|
17012
17932
|
"kind": "interface",
|
|
17013
17933
|
"package": "@nifrajs/core",
|
|
17014
17934
|
"signature": "export interface ToolEvidence {\n readonly seq: number;\n readonly stage: ToolEvidenceStage;\n readonly outcome: ToolEvidenceOutcome;\n readonly code?: string;\n}"
|
|
17015
17935
|
},
|
|
17936
|
+
{
|
|
17937
|
+
"name": "ToolEvidence",
|
|
17938
|
+
"kind": "interface",
|
|
17939
|
+
"package": "@nifrajs/webmcp",
|
|
17940
|
+
"signature": "export interface ToolEvidence {\n readonly seq: number;\n readonly stage: ToolEvidenceStage;\n readonly outcome: ToolEvidenceOutcome;\n readonly code?: string;\n}"
|
|
17941
|
+
},
|
|
17016
17942
|
{
|
|
17017
17943
|
"name": "ToolEvidenceOutcome",
|
|
17018
17944
|
"kind": "type",
|
|
@@ -17092,11 +18018,18 @@
|
|
|
17092
18018
|
"signature": "export declare function toOpenAPI(input: ContractShape | Server, options?: ToOpenAPIOptions): OpenAPIDocument;",
|
|
17093
18019
|
"doc": "/** Generate an OpenAPI 3.1 document from a contract or a running app. See the module doc for the detail model. */"
|
|
17094
18020
|
},
|
|
18021
|
+
{
|
|
18022
|
+
"name": "toOpenAPIFromEvidence",
|
|
18023
|
+
"kind": "function",
|
|
18024
|
+
"package": "@nifrajs/schema",
|
|
18025
|
+
"signature": "export declare function toOpenAPIFromEvidence(evidence: ProjectEvidenceSnapshot, options?: Omit<ToOpenAPIOptions, \"evidence\">): OpenAPIDocument;",
|
|
18026
|
+
"doc": "/** Generate OpenAPI from an existing canonical project-evidence snapshot without loading a server. */"
|
|
18027
|
+
},
|
|
17095
18028
|
{
|
|
17096
18029
|
"name": "ToOpenAPIOptions",
|
|
17097
18030
|
"kind": "interface",
|
|
17098
18031
|
"package": "@nifrajs/schema",
|
|
17099
|
-
"signature": "export interface ToOpenAPIOptions {\n readonly title?: string;\n readonly version?: string;\n readonly description?: string;\n /** Server URLs the API is served from (OpenAPI `servers`). */\n readonly servers?: readonly OpenAPIServer[];\n /** Tag definitions (OpenAPI top-level `tags`) - names referenced by an operation's `tags`. */\n readonly tags?: readonly OpenAPITag[];\n /** Reusable security schemes → `components.securitySchemes` (e.g. `{ bearer: { type: \"http\", scheme: \"bearer\" } }`). */\n readonly securitySchemes?: Readonly<Record<string, Record<string, unknown>>>;\n /** Document-wide security requirement; a per-operation `security` (incl. `[]` for public) overrides it. */\n readonly security?: readonly SecurityRequirement[];\n /**\n * Per-operation overrides, shallow-merged over the generated operation. Keyed by `operationId`\n * (contract op name) or `\"METHOD /path\"` (e.g. `\"GET /users/:id\"`). The escape hatch for detail that\n * can't be introspected - richer response bodies, examples, app-route tags/security.\n */\n readonly operations?: Readonly<Record<string, Record<string, unknown>>>;\n /**\n * Optional build-time response schemas inferred from TypeScript declarations. Keys are\n * `METHOD /path` (for example `GET /users/:id`), and explicit route/contract schemas always win.\n * This is inert OpenAPI metadata: it never enables runtime response validation.\n */\n readonly inferredResponses?: Readonly<Record<string, Readonly<Record<string, {\n readonly description?: string;\n readonly schema?: JsonSchema;\n readonly contentType?: string;\n }>>>>;\n}"
|
|
18032
|
+
"signature": "export interface ToOpenAPIOptions {\n readonly title?: string;\n readonly version?: string;\n readonly description?: string;\n /** Server URLs the API is served from (OpenAPI `servers`). */\n readonly servers?: readonly OpenAPIServer[];\n /** Tag definitions (OpenAPI top-level `tags`) - names referenced by an operation's `tags`. */\n readonly tags?: readonly OpenAPITag[];\n /** Reusable security schemes → `components.securitySchemes` (e.g. `{ bearer: { type: \"http\", scheme: \"bearer\" } }`). */\n readonly securitySchemes?: Readonly<Record<string, Record<string, unknown>>>;\n /** Document-wide security requirement; a per-operation `security` (incl. `[]` for public) overrides it. */\n readonly security?: readonly SecurityRequirement[];\n /**\n * Reuse a canonical token-only route-evidence pass. This is useful for build artifacts and CLI\n * projections that already evaluated the project; it never supplies runtime validators.\n */\n readonly evidence?: ProjectEvidenceSnapshot;\n /**\n * Per-operation overrides, shallow-merged over the generated operation. Keyed by `operationId`\n * (contract op name) or `\"METHOD /path\"` (e.g. `\"GET /users/:id\"`). The escape hatch for detail that\n * can't be introspected - richer response bodies, examples, app-route tags/security.\n */\n readonly operations?: Readonly<Record<string, Record<string, unknown>>>;\n /**\n * Optional build-time response schemas inferred from TypeScript declarations. Keys are\n * `METHOD /path` (for example `GET /users/:id`), and explicit route/contract schemas always win.\n * This is inert OpenAPI metadata: it never enables runtime response validation.\n */\n readonly inferredResponses?: Readonly<Record<string, Readonly<Record<string, {\n readonly description?: string;\n readonly schema?: JsonSchema;\n readonly contentType?: string;\n }>>>>;\n}"
|
|
17100
18033
|
},
|
|
17101
18034
|
{
|
|
17102
18035
|
"name": "TopicRegistry",
|
|
@@ -17105,6 +18038,12 @@
|
|
|
17105
18038
|
"signature": "export declare class TopicRegistry {\n private readonly topics;\n private readonly memberships;\n subscribe(topic: string, ws: NifraWebSocket): void;\n unsubscribe(topic: string, ws: NifraWebSocket): void;\n /** Drop every subscription for a connection - called on close so a registry never leaks dead sockets. */\n unsubscribeAll(ws: NifraWebSocket): void;\n /** Send `data` to every connection subscribed to `topic`. Per-socket send errors are isolated. */\n publish(topic: string, data: string | ArrayBufferView | ArrayBuffer): void;\n}",
|
|
17106
18039
|
"doc": "/**\n * In-process pub/sub for `ws.subscribe(topic)` + `app.publish(topic, data)`. **Single-instance only** -\n * topics live in this process's memory, so a multi-instance deploy (multiple servers behind a load\n * balancer) needs an external fan-out (Redis pub/sub, a Cloudflare Durable Object, NATS, …) bridged to\n * `app.publish`. The same registry instance is shared by an app's connections and its `publish`.\n */"
|
|
17107
18040
|
},
|
|
18041
|
+
{
|
|
18042
|
+
"name": "toPredictionLabContext",
|
|
18043
|
+
"kind": "function",
|
|
18044
|
+
"package": "@nifrajs/testing",
|
|
18045
|
+
"signature": "export declare function toPredictionLabContext(seed: number, labCase: {\n readonly id: string;\n readonly target: PredictionLabTarget;\n readonly mutation?: string;\n}): PredictionLabContext;"
|
|
18046
|
+
},
|
|
17108
18047
|
{
|
|
17109
18048
|
"name": "topUserFrame",
|
|
17110
18049
|
"kind": "function",
|
|
@@ -17112,6 +18051,13 @@
|
|
|
17112
18051
|
"signature": "export declare function topUserFrame(frames: readonly DiagnosticFrame[], root: string | undefined): DiagnosticFrame | undefined;",
|
|
17113
18052
|
"doc": "/** The first frame that points at the user's own source - what the codeframe should show. */"
|
|
17114
18053
|
},
|
|
18054
|
+
{
|
|
18055
|
+
"name": "toQueueHealth",
|
|
18056
|
+
"kind": "function",
|
|
18057
|
+
"package": "@nifrajs/jobs",
|
|
18058
|
+
"signature": "export declare function toQueueHealth(counts: {\n readonly pending: number;\n readonly active: number;\n readonly dead: number;\n}): QueueHealth;",
|
|
18059
|
+
"doc": "/** Project store counts to a health snapshot. Non-negative integers only; anything else throws. */"
|
|
18060
|
+
},
|
|
17115
18061
|
{
|
|
17116
18062
|
"name": "toRegistryCapabilityView",
|
|
17117
18063
|
"kind": "function",
|
|
@@ -17125,6 +18071,13 @@
|
|
|
17125
18071
|
"package": "@nifrajs/core",
|
|
17126
18072
|
"signature": "export declare function toResponse(result: HandlerResult, set: CtxSet, tagResponseBody?: ResponseBodyTagOption, statics?: StaticResponseHeaders): Response;"
|
|
17127
18073
|
},
|
|
18074
|
+
{
|
|
18075
|
+
"name": "toReviewView",
|
|
18076
|
+
"kind": "function",
|
|
18077
|
+
"package": "@nifrajs/agent-app",
|
|
18078
|
+
"signature": "export declare function toReviewView(value: unknown): ReviewView | undefined;",
|
|
18079
|
+
"doc": "/** Project a review report or host RPC result into a bounded, content-free browser view. */"
|
|
18080
|
+
},
|
|
17128
18081
|
{
|
|
17129
18082
|
"name": "toRunStudioView",
|
|
17130
18083
|
"kind": "function",
|
|
@@ -17138,6 +18091,13 @@
|
|
|
17138
18091
|
"package": "@nifrajs/agent-app",
|
|
17139
18092
|
"signature": "export declare function toRunView(snapshot: RunSnapshot): RunView;"
|
|
17140
18093
|
},
|
|
18094
|
+
{
|
|
18095
|
+
"name": "toSarifLog",
|
|
18096
|
+
"kind": "function",
|
|
18097
|
+
"package": "@nifrajs/cli",
|
|
18098
|
+
"signature": "export declare function toSarifLog(diagnostics: readonly Diagnostic[], options?: SarifProjectionOptions): SarifLog;",
|
|
18099
|
+
"doc": "/**\n * Project stable Nifra diagnostics into SARIF for code-host and external review surfaces.\n *\n * This is deliberately a pure projection: it does not run checks, read files, or reinterpret policy.\n * Relative file names remain relative so callers can choose the review tool's checkout base through\n * {@link SarifProjectionOptions.uriBaseId}.\n */"
|
|
18100
|
+
},
|
|
17141
18101
|
{
|
|
17142
18102
|
"name": "toSessionView",
|
|
17143
18103
|
"kind": "function",
|
|
@@ -17158,6 +18118,13 @@
|
|
|
17158
18118
|
"signature": "export declare function toVercelHandler<Env = unknown>(app: FetchApp<Env>): VercelHandler;",
|
|
17159
18119
|
"doc": "/** Adapt a Web-standard app to a Vercel Edge Function default export. */"
|
|
17160
18120
|
},
|
|
18121
|
+
{
|
|
18122
|
+
"name": "toWebMcpTool",
|
|
18123
|
+
"kind": "function",
|
|
18124
|
+
"package": "@nifrajs/webmcp",
|
|
18125
|
+
"signature": "export declare function toWebMcpTool<Input, Output, State>(capability: AgentCapability<Input, Output, State>, options?: WebMcpExecutionOptions): WebMcpToolDefinition;",
|
|
18126
|
+
"doc": "/** Adapt one canonical capability to the proposed WebMCP tool shape. */"
|
|
18127
|
+
},
|
|
17161
18128
|
{
|
|
17162
18129
|
"name": "traceAgentRun",
|
|
17163
18130
|
"kind": "function",
|
|
@@ -17253,6 +18220,12 @@
|
|
|
17253
18220
|
"signature": "export declare function transformCssModule(source: string, filePath: string): CssModuleResult;",
|
|
17254
18221
|
"doc": "/**\n * Pure core (no I/O): scope a CSS-module source. Same `(source, filePath)` in → byte-identical out, so\n * the `\"dom\"` and `\"ssr\"` plugin forms produce the same class map. Exposed for direct testing.\n */"
|
|
17255
18222
|
},
|
|
18223
|
+
{
|
|
18224
|
+
"name": "TransportByteLimitOptions",
|
|
18225
|
+
"kind": "interface",
|
|
18226
|
+
"package": "@nifrajs/agent-protocol",
|
|
18227
|
+
"signature": "export interface TransportByteLimitOptions {\n readonly minimum?: number;\n readonly maximum?: number;\n readonly label?: string;\n}"
|
|
18228
|
+
},
|
|
17256
18229
|
{
|
|
17257
18230
|
"name": "TransportCodec",
|
|
17258
18231
|
"kind": "interface",
|
|
@@ -17311,6 +18284,19 @@
|
|
|
17311
18284
|
"signature": "export declare function trimTrailingSlash(options?: TrailingSlashOptions): import(\"@nifrajs/core\").IdentityPlugin<never>;",
|
|
17312
18285
|
"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 */"
|
|
17313
18286
|
},
|
|
18287
|
+
{
|
|
18288
|
+
"name": "TrustedHtml",
|
|
18289
|
+
"kind": "type",
|
|
18290
|
+
"package": "@nifrajs/web",
|
|
18291
|
+
"signature": "export type TrustedHtml = string & {\n readonly [TRUSTED_HTML_BRAND]: \"trusted-html\";\n};"
|
|
18292
|
+
},
|
|
18293
|
+
{
|
|
18294
|
+
"name": "trustHtml",
|
|
18295
|
+
"kind": "function",
|
|
18296
|
+
"package": "@nifrajs/web",
|
|
18297
|
+
"signature": "export declare function trustHtml(value: string): TrustedHtml;",
|
|
18298
|
+
"doc": "/** Mark already-sanitized or application-owned HTML for an intentional raw-HTML adapter sink. */"
|
|
18299
|
+
},
|
|
17314
18300
|
{
|
|
17315
18301
|
"name": "tryGetContext",
|
|
17316
18302
|
"kind": "function",
|
|
@@ -18148,14 +19134,14 @@
|
|
|
18148
19134
|
"name": "VERSION",
|
|
18149
19135
|
"kind": "const",
|
|
18150
19136
|
"package": "@nifrajs/core",
|
|
18151
|
-
"signature": "export declare const VERSION: \"3.
|
|
19137
|
+
"signature": "export declare const VERSION: \"3.5.0\";",
|
|
18152
19138
|
"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 */"
|
|
18153
19139
|
},
|
|
18154
19140
|
{
|
|
18155
19141
|
"name": "VERSION",
|
|
18156
19142
|
"kind": "const",
|
|
18157
19143
|
"package": "nifra",
|
|
18158
|
-
"signature": "export declare const VERSION: \"3.
|
|
19144
|
+
"signature": "export declare const VERSION: \"3.5.0\";",
|
|
18159
19145
|
"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 */"
|
|
18160
19146
|
},
|
|
18161
19147
|
{
|
|
@@ -18233,6 +19219,20 @@
|
|
|
18233
19219
|
"signature": "export declare function vueSvgComponentBunPlugin(generate: \"dom\" | \"ssr\"): BunPlugin;",
|
|
18234
19220
|
"doc": "/** The Vue SVG-component plugin. `generate` selects Vue's client/SSR render, matching `vueBunPlugin`. */"
|
|
18235
19221
|
},
|
|
19222
|
+
{
|
|
19223
|
+
"name": "waitForStyles",
|
|
19224
|
+
"kind": "function",
|
|
19225
|
+
"package": "@nifrajs/web",
|
|
19226
|
+
"signature": "export declare function waitForStyles(options?: WaitForStylesOptions): Promise<void>;",
|
|
19227
|
+
"doc": "/**\n * Wait for the framework-owned deferred stylesheet links in the initial document, then promote them to\n * `media=\"all\"`. It is safe to call more than once: repeated calls for one document share the same\n * per-link waits, and duplicate framework links are removed before waiting. Blocking links are not\n * touched.\n *\n * This function lives in the browser-only `@nifrajs/web/client` entry. It is nevertheless defensive\n * when imported in a non-DOM environment so an accidental import cannot crash a server process.\n */"
|
|
19228
|
+
},
|
|
19229
|
+
{
|
|
19230
|
+
"name": "WaitForStylesOptions",
|
|
19231
|
+
"kind": "interface",
|
|
19232
|
+
"package": "@nifrajs/web",
|
|
19233
|
+
"signature": "export interface WaitForStylesOptions {\n /**\n * Maximum time to wait for one framework-owned deferred stylesheet before hydrating anyway.\n * Defaults to 4000 ms and is capped at 30000 ms so a bad value cannot leave the app inert forever.\n */\n readonly timeoutMs?: number;\n}",
|
|
19234
|
+
"doc": "/** Options for {@link waitForStyles}. */"
|
|
19235
|
+
},
|
|
18236
19236
|
{
|
|
18237
19237
|
"name": "wasmImageBackend",
|
|
18238
19238
|
"kind": "function",
|
|
@@ -18266,6 +19266,48 @@
|
|
|
18266
19266
|
"signature": "export type WebhookResult = {\n readonly ok: true;\n readonly payload: string;\n} | {\n readonly ok: false;\n readonly reason: WebhookFailureReason;\n};",
|
|
18267
19267
|
"doc": "/** Verified ⇒ the raw `payload` text (parse it with your schema). Rejected ⇒ a stable `reason`. */"
|
|
18268
19268
|
},
|
|
19269
|
+
{
|
|
19270
|
+
"name": "WebMcpExecutionOptions",
|
|
19271
|
+
"kind": "interface",
|
|
19272
|
+
"package": "@nifrajs/webmcp",
|
|
19273
|
+
"signature": "export interface WebMcpExecutionOptions extends Omit<ToolCallOptions, \"signal\" | \"capabilities\"> {\n /** Extra capability tokens may be supplied by an embedding host; the tool's own token is always added. */\n readonly capabilities?: readonly string[];\n /** A page-local authorization check. Server authorization remains mandatory for remote writes. */\n readonly authorize?: (input: unknown) => boolean | PromiseLike<boolean>;\n /** Return the Nifra receipt envelope (default) or only the typed output on success. */\n readonly resultMode?: \"receipt\" | \"output\";\n /** Maximum JSON-encoded output bytes retained in the default receipt. */\n readonly maxReceiptBytes?: number;\n}"
|
|
19274
|
+
},
|
|
19275
|
+
{
|
|
19276
|
+
"name": "WebMcpModelContext",
|
|
19277
|
+
"kind": "interface",
|
|
19278
|
+
"package": "@nifrajs/webmcp",
|
|
19279
|
+
"signature": "export interface WebMcpModelContext {\n readonly registerTool: (tool: WebMcpToolDefinition) => void | PromiseLike<void>;\n readonly unregisterTool?: (name: string) => void | PromiseLike<void>;\n}"
|
|
19280
|
+
},
|
|
19281
|
+
{
|
|
19282
|
+
"name": "WebMcpReceipt",
|
|
19283
|
+
"kind": "interface",
|
|
19284
|
+
"package": "@nifrajs/webmcp",
|
|
19285
|
+
"signature": "export interface WebMcpReceipt<Output = unknown> {\n readonly ok: boolean;\n readonly outcome: \"committed\" | \"dry-run\" | \"failed\" | \"denied\";\n readonly dryRun: boolean;\n readonly output?: Output;\n readonly outputTruncated?: true;\n readonly error?: {\n readonly code: ToolError[\"code\"];\n readonly stage: ToolError[\"stage\"];\n };\n readonly evidence: readonly ToolEvidence[];\n}"
|
|
19286
|
+
},
|
|
19287
|
+
{
|
|
19288
|
+
"name": "WebMcpRegistrationFailure",
|
|
19289
|
+
"kind": "interface",
|
|
19290
|
+
"package": "@nifrajs/webmcp",
|
|
19291
|
+
"signature": "export interface WebMcpRegistrationFailure {\n readonly name: string;\n readonly error: string;\n}"
|
|
19292
|
+
},
|
|
19293
|
+
{
|
|
19294
|
+
"name": "WebMcpRegistrationReport",
|
|
19295
|
+
"kind": "interface",
|
|
19296
|
+
"package": "@nifrajs/webmcp",
|
|
19297
|
+
"signature": "export interface WebMcpRegistrationReport {\n readonly supported: boolean;\n readonly registered: readonly string[];\n readonly failed: readonly WebMcpRegistrationFailure[];\n readonly cleanup: () => Promise<void>;\n}"
|
|
19298
|
+
},
|
|
19299
|
+
{
|
|
19300
|
+
"name": "WebMcpTarget",
|
|
19301
|
+
"kind": "interface",
|
|
19302
|
+
"package": "@nifrajs/webmcp",
|
|
19303
|
+
"signature": "export interface WebMcpTarget {\n readonly modelContext?: WebMcpModelContext;\n}"
|
|
19304
|
+
},
|
|
19305
|
+
{
|
|
19306
|
+
"name": "WebMcpToolDefinition",
|
|
19307
|
+
"kind": "interface",
|
|
19308
|
+
"package": "@nifrajs/webmcp",
|
|
19309
|
+
"signature": "export interface WebMcpToolDefinition {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: Record<string, unknown>;\n readonly annotations: AgentCapability<unknown, unknown>[\"tool\"][\"annotations\"];\n readonly execute: (input: unknown) => unknown | PromiseLike<unknown>;\n}"
|
|
19310
|
+
},
|
|
18269
19311
|
{
|
|
18270
19312
|
"name": "websocket",
|
|
18271
19313
|
"kind": "function",
|
|
@@ -18454,7 +19496,7 @@
|
|
|
18454
19496
|
"name": "WorkflowRunner",
|
|
18455
19497
|
"kind": "class",
|
|
18456
19498
|
"package": "@nifrajs/coding-agent",
|
|
18457
|
-
"signature": "export declare class WorkflowRunner {\n private readonly options;\n private readonly values;\n private readonly completed;\n private steps;\n constructor(options?: WorkflowRunnerOptions);\n run(step: WorkflowStep): Promise<WorkflowResult>;\n private context;\n private execute;\n private single;\n private parallel;\n private emit;\n}",
|
|
19499
|
+
"signature": "export declare class WorkflowRunner {\n private readonly options;\n private readonly signal;\n private readonly values;\n private readonly completed;\n private steps;\n constructor(options?: WorkflowRunnerOptions);\n run(step: WorkflowStep): Promise<WorkflowResult>;\n private context;\n private execute;\n private single;\n private parallel;\n private emit;\n}",
|
|
18458
19500
|
"doc": "/** Bounded orchestration primitives. The kernel knows no provider, UI, or framework package. */"
|
|
18459
19501
|
},
|
|
18460
19502
|
{
|
|
@@ -18485,7 +19527,7 @@
|
|
|
18485
19527
|
"name": "WorkGraphBuildInput",
|
|
18486
19528
|
"kind": "interface",
|
|
18487
19529
|
"package": "@nifrajs/cli",
|
|
18488
|
-
"signature": "export interface WorkGraphBuildInput {\n readonly source: unknown;\n readonly files?: readonly WorkGraphSourceFile[];\n readonly freshness?: BuildFreshness;\n}"
|
|
19530
|
+
"signature": "export interface WorkGraphBuildInput {\n readonly source: unknown;\n /** Reuse a canonical route-evidence pass when the caller already has one. */\n readonly evidence?: ProjectEvidenceSnapshot;\n readonly files?: readonly WorkGraphSourceFile[];\n readonly freshness?: BuildFreshness;\n}"
|
|
18489
19531
|
},
|
|
18490
19532
|
{
|
|
18491
19533
|
"name": "WorkGraphEdge",
|
|
@@ -18503,8 +19545,7 @@
|
|
|
18503
19545
|
"name": "WorkGraphNodeKind",
|
|
18504
19546
|
"kind": "type",
|
|
18505
19547
|
"package": "@nifrajs/cli",
|
|
18506
|
-
"signature": "export type WorkGraphNodeKind = \"route\" | \"schema\" | \"capability\" | \"assurance\" | \"test\" | \"file\" | \"manifest\";"
|
|
18507
|
-
"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 */"
|
|
19548
|
+
"signature": "export type WorkGraphNodeKind = \"route\" | \"schema\" | \"capability\" | \"assurance\" | \"test\" | \"file\" | \"manifest\";"
|
|
18508
19549
|
},
|
|
18509
19550
|
{
|
|
18510
19551
|
"name": "WorkGraphSourceFile",
|