@nifrajs/core 1.12.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +10 -1
  2. package/dist/assurance.d.ts +11 -2
  3. package/dist/assurance.d.ts.map +1 -1
  4. package/dist/assurance.js +20 -0
  5. package/dist/assurance.js.map +1 -1
  6. package/dist/effect-ledger.d.ts +9 -0
  7. package/dist/effect-ledger.d.ts.map +1 -0
  8. package/dist/effect-ledger.js +8 -0
  9. package/dist/effect-ledger.js.map +1 -0
  10. package/dist/idempotency-plugin.d.ts +8 -0
  11. package/dist/idempotency-plugin.d.ts.map +1 -0
  12. package/dist/idempotency-plugin.js +8 -0
  13. package/dist/idempotency-plugin.js.map +1 -0
  14. package/dist/index.d.ts +6 -34
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +6 -30
  17. package/dist/index.js.map +1 -1
  18. package/dist/mcp.d.ts +7 -0
  19. package/dist/mcp.d.ts.map +1 -0
  20. package/dist/mcp.js +56 -0
  21. package/dist/mcp.js.map +1 -0
  22. package/dist/node-direct.d.ts +5 -0
  23. package/dist/node-direct.d.ts.map +1 -0
  24. package/dist/node-direct.js +27 -0
  25. package/dist/node-direct.js.map +1 -0
  26. package/dist/reflection.d.ts +5 -0
  27. package/dist/reflection.d.ts.map +1 -1
  28. package/dist/reflection.js +2 -0
  29. package/dist/reflection.js.map +1 -1
  30. package/dist/router/pattern.d.ts +42 -0
  31. package/dist/router/pattern.d.ts.map +1 -0
  32. package/dist/router/pattern.js +127 -0
  33. package/dist/router/pattern.js.map +1 -0
  34. package/dist/router/router.d.ts +2 -1
  35. package/dist/router/router.d.ts.map +1 -1
  36. package/dist/router/router.js +11 -48
  37. package/dist/router/router.js.map +1 -1
  38. package/dist/server/client-ip.d.ts +35 -0
  39. package/dist/server/client-ip.d.ts.map +1 -0
  40. package/dist/server/client-ip.js +42 -0
  41. package/dist/server/client-ip.js.map +1 -0
  42. package/dist/server/context.d.ts +47 -2
  43. package/dist/server/context.d.ts.map +1 -1
  44. package/dist/server/contract.d.ts +37 -10
  45. package/dist/server/contract.d.ts.map +1 -1
  46. package/dist/server/contract.js +33 -8
  47. package/dist/server/contract.js.map +1 -1
  48. package/dist/server/http.d.ts +14 -0
  49. package/dist/server/http.d.ts.map +1 -0
  50. package/dist/server/http.js +45 -0
  51. package/dist/server/http.js.map +1 -0
  52. package/dist/server/idempotency-lane.d.ts +44 -0
  53. package/dist/server/idempotency-lane.d.ts.map +1 -0
  54. package/dist/server/idempotency-lane.js +181 -0
  55. package/dist/server/idempotency-lane.js.map +1 -0
  56. package/dist/server/install.d.ts +21 -0
  57. package/dist/server/install.d.ts.map +1 -0
  58. package/dist/server/install.js +21 -0
  59. package/dist/server/install.js.map +1 -0
  60. package/dist/server/ledger-lane.d.ts +53 -0
  61. package/dist/server/ledger-lane.d.ts.map +1 -0
  62. package/dist/server/ledger-lane.js +82 -0
  63. package/dist/server/ledger-lane.js.map +1 -0
  64. package/dist/server/mcp-hook.d.ts +28 -0
  65. package/dist/server/mcp-hook.d.ts.map +1 -0
  66. package/dist/server/mcp-hook.js +2 -0
  67. package/dist/server/mcp-hook.js.map +1 -0
  68. package/dist/server/node-outcome-hook.d.ts +9 -0
  69. package/dist/server/node-outcome-hook.d.ts.map +1 -0
  70. package/dist/server/node-outcome-hook.js +2 -0
  71. package/dist/server/node-outcome-hook.js.map +1 -0
  72. package/dist/server/node-outcome.d.ts +37 -0
  73. package/dist/server/node-outcome.d.ts.map +1 -0
  74. package/dist/server/node-outcome.js +75 -0
  75. package/dist/server/node-outcome.js.map +1 -0
  76. package/dist/server/plugin.d.ts +78 -0
  77. package/dist/server/plugin.d.ts.map +1 -0
  78. package/dist/server/plugin.js +57 -0
  79. package/dist/server/plugin.js.map +1 -0
  80. package/dist/server/query.d.ts +18 -0
  81. package/dist/server/query.d.ts.map +1 -0
  82. package/dist/server/query.js +102 -0
  83. package/dist/server/query.js.map +1 -0
  84. package/dist/server/registry.d.ts +31 -6
  85. package/dist/server/registry.d.ts.map +1 -1
  86. package/dist/server/request-context.d.ts +51 -0
  87. package/dist/server/request-context.d.ts.map +1 -0
  88. package/dist/server/request-context.js +184 -0
  89. package/dist/server/request-context.js.map +1 -0
  90. package/dist/server/respond.d.ts +17 -0
  91. package/dist/server/respond.d.ts.map +1 -0
  92. package/dist/server/respond.js +81 -0
  93. package/dist/server/respond.js.map +1 -0
  94. package/dist/server/runtime-core.d.ts +36 -0
  95. package/dist/server/runtime-core.d.ts.map +1 -0
  96. package/dist/server/runtime-core.js +51 -0
  97. package/dist/server/runtime-core.js.map +1 -0
  98. package/dist/server/server-types.d.ts +203 -0
  99. package/dist/server/server-types.d.ts.map +1 -0
  100. package/dist/server/server-types.js +2 -0
  101. package/dist/server/server-types.js.map +1 -0
  102. package/dist/server/server.d.ts +135 -358
  103. package/dist/server/server.d.ts.map +1 -1
  104. package/dist/server/server.js +476 -1065
  105. package/dist/server/server.js.map +1 -1
  106. package/dist/server/sse-hook.d.ts +10 -0
  107. package/dist/server/sse-hook.d.ts.map +1 -0
  108. package/dist/server/sse-hook.js +2 -0
  109. package/dist/server/sse-hook.js.map +1 -0
  110. package/dist/server/sse.d.ts +7 -23
  111. package/dist/server/sse.d.ts.map +1 -1
  112. package/dist/server/sse.js +18 -0
  113. package/dist/server/sse.js.map +1 -1
  114. package/dist/server/websocket.d.ts +17 -1
  115. package/dist/server/websocket.d.ts.map +1 -1
  116. package/dist/server/websocket.js.map +1 -1
  117. package/dist/server/ws-hook.d.ts +8 -11
  118. package/dist/server/ws-hook.d.ts.map +1 -1
  119. package/dist/server/ws-hook.js +7 -14
  120. package/dist/server/ws-hook.js.map +1 -1
  121. package/dist/server.d.ts +21 -0
  122. package/dist/server.d.ts.map +1 -0
  123. package/dist/server.js +16 -0
  124. package/dist/server.js.map +1 -0
  125. package/dist/ws.d.ts +16 -7
  126. package/dist/ws.d.ts.map +1 -1
  127. package/dist/ws.js +25 -10
  128. package/dist/ws.js.map +1 -1
  129. package/package.json +82 -6
  130. package/src/assurance.ts +36 -1
  131. package/src/effect-ledger.ts +9 -0
  132. package/src/idempotency-plugin.ts +7 -0
  133. package/src/index.ts +6 -132
  134. package/src/mcp.ts +65 -0
  135. package/src/node-direct.ts +37 -0
  136. package/src/reflection.ts +7 -0
  137. package/src/router/pattern.ts +176 -0
  138. package/src/router/router.ts +11 -69
  139. package/src/server/client-ip.ts +60 -0
  140. package/src/server/context.ts +50 -2
  141. package/src/server/contract.ts +68 -25
  142. package/src/server/http.ts +58 -0
  143. package/src/server/idempotency-lane.ts +287 -0
  144. package/src/server/install.ts +28 -0
  145. package/src/server/ledger-lane.ts +125 -0
  146. package/src/server/mcp-hook.ts +41 -0
  147. package/src/server/node-outcome-hook.ts +9 -0
  148. package/src/server/node-outcome.ts +112 -0
  149. package/src/server/plugin.ts +92 -0
  150. package/src/server/query.ts +119 -0
  151. package/src/server/registry.ts +36 -6
  152. package/src/server/request-context.ts +271 -0
  153. package/src/server/respond.ts +93 -0
  154. package/src/server/runtime-core.ts +74 -0
  155. package/src/server/server-types.ts +204 -0
  156. package/src/server/server.ts +863 -1657
  157. package/src/server/sse-hook.ts +14 -0
  158. package/src/server/sse.ts +26 -0
  159. package/src/server/websocket.ts +20 -0
  160. package/src/server/ws-hook.ts +8 -19
  161. package/src/server.ts +92 -0
  162. package/src/ws.ts +33 -10
  163. package/dist/invariants.d.ts +0 -70
  164. package/dist/invariants.d.ts.map +0 -1
  165. package/dist/invariants.js +0 -487
  166. package/dist/invariants.js.map +0 -1
  167. package/src/invariants.ts +0 -604
@@ -0,0 +1,184 @@
1
+ import { drainCapped, parseContentLength, readBoundedBytes } from "./body.js";
2
+ import { parseCookies, serializeCookie } from "./cookies.js";
3
+ import { jsonError } from "./http.js";
4
+ import { searchOf } from "./query.js";
5
+ import { CONTEXT_SEARCH, CONTEXT_SET, fallbackWaitUntil, getNeverAbortSignal, getUnboundedRequestBudget, headerOf, requestOf, TEXT_DECODER, } from "./runtime-core.js";
6
+ /** A fixed past instant for cookie deletion (`Expires`). A literal epoch - deterministic, unlike an
7
+ * argless `new Date()`. */
8
+ const EPOCH = new Date(0);
9
+ class LazyResponseControls {
10
+ status;
11
+ _headers;
12
+ _cookies;
13
+ get headers() {
14
+ this._headers ??= {};
15
+ return this._headers;
16
+ }
17
+ cookie(name, value, options) {
18
+ // Secure-by-default: HttpOnly + Secure + SameSite=Lax + Path=/, overridable per call.
19
+ const merged = {
20
+ httpOnly: true,
21
+ secure: true,
22
+ sameSite: "lax",
23
+ path: "/",
24
+ ...options,
25
+ };
26
+ this._cookies ??= [];
27
+ this._cookies.push(serializeCookie(name, value, merged));
28
+ }
29
+ deleteCookie(name, options) {
30
+ // Expire immediately; default Path=/, and match the original path/domain or the browser keeps it.
31
+ this._cookies ??= [];
32
+ this._cookies.push(serializeCookie(name, "", { path: "/", ...options, maxAge: 0, expires: EPOCH }));
33
+ }
34
+ }
35
+ /** Coerce `c.json`/`c.text`'s second arg - a status number (the common case) or a full `ResponseInit`. */
36
+ function statusInit(init) {
37
+ return typeof init === "number" ? { status: init } : init;
38
+ }
39
+ export class RequestContext {
40
+ constructor(source, params, searchOrMaxBodyBytes, signal, budget, platform, maxBodyBytes) {
41
+ this.source = source;
42
+ this.params = params;
43
+ if (typeof searchOrMaxBodyBytes === "number") {
44
+ this.maxBodyBytes = searchOrMaxBodyBytes;
45
+ return;
46
+ }
47
+ if (searchOrMaxBodyBytes !== undefined)
48
+ this.searchValue = searchOrMaxBodyBytes;
49
+ this.signalValue = signal;
50
+ this.budgetValue = budget;
51
+ if (platform !== undefined)
52
+ this.platformValue = platform;
53
+ this.maxBodyBytes = maxBodyBytes;
54
+ }
55
+ static native(source, params, maxBodyBytes) {
56
+ return new RequestContext(source, params, maxBodyBytes);
57
+ }
58
+ [CONTEXT_SET]() {
59
+ return this.setValue;
60
+ }
61
+ get [CONTEXT_SEARCH]() {
62
+ this.searchValue ??= searchOf(this.source.url);
63
+ return this.searchValue;
64
+ }
65
+ get set() {
66
+ this.setValue ??= new LazyResponseControls();
67
+ return this.setValue;
68
+ }
69
+ get signal() {
70
+ return this.signalValue ?? getNeverAbortSignal();
71
+ }
72
+ get budget() {
73
+ return this.budgetValue ?? getUnboundedRequestBudget();
74
+ }
75
+ get env() {
76
+ return this.platformValue?.env;
77
+ }
78
+ get clientIp() {
79
+ // The server resolves the trust declaration into `platform.clientIp` before the context is built,
80
+ // so this getter just surfaces the already-derived value (raw socket peer by default).
81
+ return this.platformValue?.clientIp;
82
+ }
83
+ get waitUntil() {
84
+ return this.platformValue?.waitUntil ?? fallbackWaitUntil;
85
+ }
86
+ get req() {
87
+ return requestOf(this.source);
88
+ }
89
+ get request() {
90
+ return requestOf(this.source);
91
+ }
92
+ json(body, init) {
93
+ return Response.json(body, statusInit(init));
94
+ }
95
+ text(body, init) {
96
+ const i = statusInit(init);
97
+ // Default to text/plain; if the caller passes their own headers, they own the content-type.
98
+ if (i?.headers !== undefined)
99
+ return new Response(body, i);
100
+ return new Response(body, { ...i, headers: { "content-type": "text/plain; charset=utf-8" } });
101
+ }
102
+ get query() {
103
+ if (!this.queryReady) {
104
+ this.queryValue = new URLSearchParams(this[CONTEXT_SEARCH]);
105
+ this.queryReady = true;
106
+ }
107
+ return this.queryValue;
108
+ }
109
+ set query(v) {
110
+ this.queryValue = v;
111
+ this.queryReady = true;
112
+ }
113
+ get cookies() {
114
+ this.cookiesValue ??= parseCookies(headerOf(this.source, "cookie"));
115
+ return this.cookiesValue;
116
+ }
117
+ boundedBody(maxBytes) {
118
+ return readBoundedBodyOrThrow(this.source, this.maxBodyBytes, maxBytes);
119
+ }
120
+ boundedJson(maxBytes) {
121
+ return readBoundedJsonBodyOrThrow(this.source, this.maxBodyBytes, maxBytes);
122
+ }
123
+ }
124
+ /** Backs `c.boundedBody`: bounded byte read that throws a flat 413/400 `Response` (caught by
125
+ * `runLifecycle` as control flow, like `throw redirect(...)`), so a handler can't ignore the cap.
126
+ * The byte-cap itself lives in `./body.ts` (shared with the schema path and `verifyWebhook`). */
127
+ async function readBoundedBodyOrThrow(req, maxBodyBytes, maxBytes) {
128
+ const r = await readBoundedBytes(req, maxBytes ?? maxBodyBytes);
129
+ if (r.ok)
130
+ return r.bytes;
131
+ throw r.status === 413
132
+ ? jsonError(413, "payload_too_large")
133
+ : jsonError(400, "invalid_content_length");
134
+ }
135
+ /** Backs `c.boundedJson`: `readBoundedBodyOrThrow` + `JSON.parse`, throwing a flat 400 on bad JSON. */
136
+ async function readBoundedJsonBodyOrThrow(req, maxBodyBytes, maxBytes) {
137
+ const parsed = await readBoundedJsonSource(req, maxBytes ?? maxBodyBytes);
138
+ if (parsed instanceof Response)
139
+ throw parsed;
140
+ return parsed;
141
+ }
142
+ /**
143
+ * Read a JSON body with the same byte cap used by schema validation and `c.boundedJson`.
144
+ * Non-chunked, framed requests with an in-cap `Content-Length` use the runtime-native `req.json()`;
145
+ * chunked or length-less requests fall back to the streaming byte-cap guard.
146
+ */
147
+ export async function readBoundedJsonSource(req, maxBytes) {
148
+ const declared = headerOf(req, "content-length");
149
+ if (declared !== null) {
150
+ // A present Content-Length must be a non-negative integer (HTTP grammar: `1*DIGIT`). A
151
+ // non-numeric / negative / fractional / exponential value (`Number()` would happily accept
152
+ // "abc"->NaN, "-5", "1.5", "1e3", "0x10") is malformed -> 400, rather than silently falling
153
+ // through to the streaming guard - which is an UPPER-bound cap only, so a lying SMALLER length
154
+ // would otherwise be read in full. Real HTTP servers only hand us a valid framed length; this
155
+ // hardens hand-built Requests (tests, the in-process client) and crafted input.
156
+ const length = parseContentLength(declared);
157
+ if (length === undefined)
158
+ return jsonError(400, "invalid_content_length");
159
+ if (length > maxBytes)
160
+ return jsonError(413, "payload_too_large");
161
+ const chunked = headerOf(req, "transfer-encoding") !== null;
162
+ if (!chunked) {
163
+ try {
164
+ return await req.json();
165
+ }
166
+ catch {
167
+ return jsonError(400, "invalid_json");
168
+ }
169
+ }
170
+ }
171
+ const body = req.body;
172
+ if (body === null)
173
+ return jsonError(400, "invalid_json");
174
+ const drained = await drainCapped(body, maxBytes);
175
+ if (!drained.ok)
176
+ return jsonError(413, "payload_too_large");
177
+ try {
178
+ return JSON.parse(TEXT_DECODER.decode(drained.bytes));
179
+ }
180
+ catch {
181
+ return jsonError(400, "invalid_json");
182
+ }
183
+ }
184
+ //# sourceMappingURL=request-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../src/server/request-context.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAE7E,OAAO,EAAsB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,mBAAmB,CAAA;AAG1B;2BAC2B;AAC3B,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAA;AAEzB,MAAM,oBAAoB;IACxB,MAAM,CAAS;IACf,QAAQ,CAAyB;IACjC,QAAQ,CAAW;IAEnB,IAAI,OAAO;QACT,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAA;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,IAAY,EAAE,KAAa,EAAE,OAAuB;QACzD,sFAAsF;QACtF,MAAM,MAAM,GAAkB;YAC5B,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,GAAG;YACT,GAAG,OAAO;SACX,CAAA;QACD,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAA;QACpB,IAAI,CA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AC;YACb,IAAI,CAAC;gBACH,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;YACzB,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IACxD,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IAC3D,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IACvC,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Response construction from a handler's return value: the header/cookie init, the fused-lane
3
+ * responders, the fast JSON path, and cookie append. Imports only the runtime-core primitives + the
4
+ * spine types, so the wire-response format lives in one module distinct from the request engine.
5
+ */
6
+ import { type HandlerResult } from "./runtime-core.js";
7
+ import type { CtxSet, RawContext } from "./server.js";
8
+ /** Fused-lane respond when `c.set` is untouched. Bun 1.3's native `Response.json` now beats the
9
+ * older hand-inlined stringify + Response construction on this lane while preserving the exact
10
+ * body/content-type contract; keep the generic fallback for non-JSON values. */
11
+ export declare function fusedRespondNoSet(result: unknown): Response;
12
+ /** Fused-lane respond with a context: read `c.set` once; untouched (the common case) -> the fast
13
+ * JSON respond; touched -> the generic `toResponse` with those controls (statuses, headers, cookies). */
14
+ export declare function fusedRespond(result: unknown, ctx: RawContext): Response;
15
+ export declare function toResponse(result: HandlerResult, set: CtxSet): Response;
16
+ export declare function appendCookiesToResponse(response: Response, set: CtxSet): Response;
17
+ //# sourceMappingURL=respond.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"respond.d.ts","sourceRoot":"","sources":["../../src/server/respond.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAqBrD;;gFAEgF;AAChF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAW3D;AAED;yGACyG;AACzG,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,QAAQ,CAIvE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAwBvE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAUjF"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Response construction from a handler's return value: the header/cookie init, the fused-lane
3
+ * responders, the fast JSON path, and cookie append. Imports only the runtime-core primitives + the
4
+ * spine types, so the wire-response format lives in one module distinct from the request engine.
5
+ */
6
+ import { CONTEXT_SET, EMPTY_RESPONSE_CONTROLS, isResponseResult, } from "./runtime-core.js";
7
+ /** Build the response headers init. The common path (no `c.set`) returns `undefined` so `Response`
8
+ * gets no `headers` at all. Cookies force a `Headers` object - multiple `Set-Cookie`s can't live in a
9
+ * `Record<string,string>` (the 2nd would overwrite the 1st), so they're `append`ed individually. */
10
+ function headersInit(set) {
11
+ const cookies = set._cookies;
12
+ if (cookies === undefined || cookies.length === 0)
13
+ return set._headers;
14
+ const headers = new Headers(set._headers);
15
+ for (const cookie of cookies)
16
+ headers.append("set-cookie", cookie);
17
+ return headers;
18
+ }
19
+ // Keep the fast JSON respond path byte-identical to `Response.json` without probing it at module
20
+ // scope: workerd forbids `Response.json()` during startup. A shared `Headers` is safe to reuse
21
+ // across responses: the Response constructor copies `init.headers` into its own list.
22
+ const JSON_CT_HEADERS = new Headers({
23
+ "content-type": "application/json;charset=utf-8",
24
+ });
25
+ const JSON_INIT_200 = { status: 200, headers: JSON_CT_HEADERS };
26
+ /** Fused-lane respond when `c.set` is untouched. Bun 1.3's native `Response.json` now beats the
27
+ * older hand-inlined stringify + Response construction on this lane while preserving the exact
28
+ * body/content-type contract; keep the generic fallback for non-JSON values. */
29
+ export function fusedRespondNoSet(result) {
30
+ if (result !== undefined &&
31
+ !(result instanceof Response) &&
32
+ typeof result === "object" &&
33
+ result !== null &&
34
+ !isResponseResult(result)) {
35
+ return Response.json(result);
36
+ }
37
+ return toResponse(result, EMPTY_RESPONSE_CONTROLS);
38
+ }
39
+ /** Fused-lane respond with a context: read `c.set` once; untouched (the common case) -> the fast
40
+ * JSON respond; touched -> the generic `toResponse` with those controls (statuses, headers, cookies). */
41
+ export function fusedRespond(result, ctx) {
42
+ const set = ctx[CONTEXT_SET]();
43
+ if (set === undefined)
44
+ return fusedRespondNoSet(result);
45
+ return toResponse(result, set);
46
+ }
47
+ export function toResponse(result, set) {
48
+ if (isResponseResult(result)) {
49
+ return appendCookiesToResponse(result.toResponse(), set);
50
+ }
51
+ if (result instanceof Response) {
52
+ return appendCookiesToResponse(result, set);
53
+ }
54
+ const headers = headersInit(set);
55
+ const status = set.status ?? (result === undefined ? 204 : 200);
56
+ if (headers === undefined && result !== undefined) {
57
+ // Fast respond (profiled ~50 ns/req faster on every plain-JSON return): `JSON.stringify` + a
58
+ // prebuilt init beats `Response.json`'s internal init handling. Output is byte-identical -
59
+ // same body bytes, same probed content-type. `undefined` from stringify (a function/symbol
60
+ // result) delegates to Response.json so its TypeError contract stays the single source.
61
+ const body = JSON.stringify(result);
62
+ if (body !== undefined) {
63
+ return new Response(body, status === 200 ? JSON_INIT_200 : { status, headers: JSON_CT_HEADERS });
64
+ }
65
+ }
66
+ const init = headers === undefined ? { status } : { status, headers };
67
+ return result === undefined ? new Response(null, init) : Response.json(result, init);
68
+ }
69
+ export function appendCookiesToResponse(response, set) {
70
+ // A handler may queue cookies (`c.set.cookie` - e.g. a session cookie) AND return its own Response
71
+ // (e.g. `redirect("/")` after login). Cookies accumulate additively, so append them to the
72
+ // returned Response - otherwise the canonical set-session-then-redirect pattern would silently drop
73
+ // the cookie. (Other `c.set` fields stay the returned Response's own concern.)
74
+ const cookies = set._cookies;
75
+ if (cookies !== undefined && cookies.length > 0) {
76
+ for (const cookie of cookies)
77
+ response.headers.append("set-cookie", cookie);
78
+ }
79
+ return response;
80
+ }
81
+ //# sourceMappingURL=respond.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"respond.js","sourceRoot":"","sources":["../../src/server/respond.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,EACX,uBAAuB,EAEvB,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAG1B;;oGAEoG;AACpG,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAA;IAC5B,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC,QAAQ,CAAA;IACtE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACzC,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IAClE,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,iGAAiG;AACjG,+FAA+F;AAC/F,sFAAsF;AACtF,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC;IAClC,cAAc,EAAE,gCAAgC;CACjD,CAAC,CAAA;AACF,MAAM,aAAa,GAAiB,E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SAAS,EAAE,CAAC;QAClD,6FAA6F;QAC7F,2FAA2F;QAC3F,2FAA2F;QAC3F,wFAAwF;QACxF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAuB,CAAA;QACzD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,IAAI,QAAQ,CACjB,IAAI,EACJ,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,CACtE,CAAA;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAiB,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IACnF,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACtF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAkB,EAAE,GAAW;IACrE,mGAAmG;IACnG,2FAA2F;IAC3F,oGAAoG;IACpG,+EAA+E;IAC/E,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAA;IAC5B,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IAC7E,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Runtime-core: the small primitives shared across the server's request/response modules - the context
3
+ * symbols, the `ResponseResult` marker, the lazy never-abort signal / unbounded budget singletons, and
4
+ * the request-source accessors. Kept in one leaf (it only type-imports the server's spine types, never
5
+ * its values) so `request-context`, `respond`, `node-outcome`, and the kernel form a cycle-free graph.
6
+ */
7
+ import { type RequestBudget } from "../budget.js";
8
+ import type { CtxSet, RequestSource } from "./server.js";
9
+ /** A handler returns a `Response` (used as-is) or any value (serialized to JSON). */
10
+ export type HandlerResult = Response | unknown;
11
+ export declare const RESPONSE_RESULT: unique symbol;
12
+ export declare const CONTEXT_SET: unique symbol;
13
+ export declare const CONTEXT_SEARCH: unique symbol;
14
+ export interface ResponseResult {
15
+ readonly [RESPONSE_RESULT]: true;
16
+ toResponse(): Response;
17
+ toNodeBody?(): {
18
+ readonly status: number;
19
+ readonly headers: Readonly<Record<string, string | readonly string[]>> | undefined;
20
+ readonly body: string | Uint8Array;
21
+ };
22
+ }
23
+ export declare function isResponseResult(value: unknown): value is ResponseResult;
24
+ /** The concrete `Request` for a source - itself when a real `Request` was passed (the Web path), or the
25
+ * lazily-built one (the Node adapter). A real `Request` IS a `RequestSource`, so no wrapper is allocated
26
+ * on the Web hot path. */
27
+ export declare function requestOf(source: RequestSource): Request;
28
+ export declare function headerOf(source: RequestSource, name: string): string | null;
29
+ /** Off-edge `waitUntil`: run the background work fire-and-forget, never leaking an unhandled
30
+ * rejection. Edge runtimes pass their own (Workers `ctx.waitUntil`) via the platform arg. */
31
+ export declare const fallbackWaitUntil: (promise: Promise<unknown>) => void;
32
+ export declare const EMPTY_RESPONSE_CONTROLS: CtxSet;
33
+ export declare const TEXT_DECODER: TextDecoder;
34
+ export declare const getNeverAbortSignal: () => AbortSignal;
35
+ export declare const getUnboundedRequestBudget: () => RequestBudget;
36
+ //# sourceMappingURL=runtime-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-core.d.ts","sourceRoot":"","sources":["../../src/server/runtime-core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAExD,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE9C,eAAO,MAAM,eAAe,eAAsC,CAAA;AAClE,eAAO,MAAM,WAAW,eAA8B,CAAA;AACtD,eAAO,MAAM,cAAc,eAAiC,CAAA;AAE5D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;IAChC,UAAU,IAAI,QAAQ,CAAA;IACtB,UAAU,CAAC,IAAI;QACb,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAA;QAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;KACnC,CAAA;CACF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAOxE;AAED;;0BAE0B;AAC1B,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAExD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3E;AAED;6FAC6F;AAC7F,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,CAAC,OAAO,CAAC,KAAG,IAE7D,CAAA;AAID,eAAO,MAAM,uBAAuB,EAAwB,MAAM,CAAA;AAElE,eAAO,MAAM,YAAY,aAAoB,CAAA;AAU7C,eAAO,MAAM,mBAAmB,QAAO,WAGtC,CAAA;AACD,eAAO,MAAM,yBAAyB,QAAO,aAG5C,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Runtime-core: the small primitives shared across the server's request/response modules - the context
3
+ * symbols, the `ResponseResult` marker, the lazy never-abort signal / unbounded budget singletons, and
4
+ * the request-source accessors. Kept in one leaf (it only type-imports the server's spine types, never
5
+ * its values) so `request-context`, `respond`, `node-outcome`, and the kernel form a cycle-free graph.
6
+ */
7
+ import { createUnboundedRequestBudget } from "../budget.js";
8
+ export const RESPONSE_RESULT = Symbol.for("nifra.response.result");
9
+ export const CONTEXT_SET = Symbol("nifra.context.set");
10
+ export const CONTEXT_SEARCH = Symbol("nifra.context.search");
11
+ export function isResponseResult(value) {
12
+ return (typeof value === "object" &&
13
+ value !== null &&
14
+ value[RESPONSE_RESULT] === true &&
15
+ typeof value.toResponse === "function");
16
+ }
17
+ /** The concrete `Request` for a source - itself when a real `Request` was passed (the Web path), or the
18
+ * lazily-built one (the Node adapter). A real `Request` IS a `RequestSource`, so no wrapper is allocated
19
+ * on the Web hot path. */
20
+ export function requestOf(source) {
21
+ return source.request ?? source;
22
+ }
23
+ export function headerOf(source, name) {
24
+ return source.header?.(name) ?? source.headers.get(name);
25
+ }
26
+ /** Off-edge `waitUntil`: run the background work fire-and-forget, never leaking an unhandled
27
+ * rejection. Edge runtimes pass their own (Workers `ctx.waitUntil`) via the platform arg. */
28
+ export const fallbackWaitUntil = (promise) => {
29
+ void promise.catch(() => { });
30
+ };
31
+ // Finalization only reads `status`, `_headers`, and `_cookies`. The user-visible mutator methods
32
+ // live on `LazyResponseControls`, created by the `c.set` getter only when user code touches it.
33
+ export const EMPTY_RESPONSE_CONTROLS = Object.freeze({});
34
+ export const TEXT_DECODER = new TextDecoder();
35
+ /**
36
+ * Shared never-aborting signal for `ctx.signal` when no timeout is armed - created lazily and
37
+ * cached. NOT a module-scope `new AbortController()`: edge runtimes (Cloudflare workerd) forbid
38
+ * constructing one in global scope; the first request builds it inside the handler, then it's
39
+ * reused at zero per-request cost.
40
+ */
41
+ let neverAbortSignal;
42
+ let unboundedRequestBudget;
43
+ export const getNeverAbortSignal = () => {
44
+ neverAbortSignal ??= new AbortController().signal;
45
+ return neverAbortSignal;
46
+ };
47
+ export const getUnboundedRequestBudget = () => {
48
+ unboundedRequestBudget ??= createUnboundedRequestBudget(getNeverAbortSignal());
49
+ return unboundedRequestBudget;
50
+ };
51
+ //# sourceMappingURL=runtime-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-core.js","sourceRoot":"","sources":["../../src/server/runtime-core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,4BAA4B,EAAsB,MAAM,cAAc,CAAA;AAM/E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAA;AAY5D,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAkD,CAAC,eAAe,CAAC,KAAK,IAAI;QAC7E,OAAQ,KAA2C,CAAC,UAAU,KAAK,UAAU,CAC9E,CAAA;AACH,CAAC;AAED;;0BAE0B;AAC1B,MAAM,UAAU,SAAS,CAAC,MAAqB;IAC7C,OAAO,MAAM,CAAC,OAAO,IAAK,MAA6B,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,MAAqB,EAAE,IAAY;IAC1D,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC1D,CAAC;AAED;6FAC6F;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAyB,EAAQ,EAAE;IACnE,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED,iGAAiG;AACjG,gGAAgG;AAChG,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAW,CAAA;AAElE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAA;AAE7C;;;;;GAKG;AACH,IAAI,gBAAyC,CAAA;AAC7C,IAAI,sBAAiD,CAAA;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAgB,EAAE;IACnD,gBAAgB,KAAK,IAAI,eAAe,EAAE,CAAC,MAAM,CAAA;IACjD,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAkB,EAAE;IAC3D,sBAAsB,KAAK,4BAA4B,CAAC,mBAAmB,EAAE,CAAC,CAAA;IAC9E,OAAO,sBAAsB,CAAA;AAC/B,CAAC,CAAA"}
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Public API-surface types for the server: construction options, the capacity-admission contract,
3
+ * route/tool/MCP descriptors, and the middleware bundle shape. Pure types (no runtime), split out of
4
+ * the server kernel so the descriptor/option vocabulary is one file, distinct from the engine.
5
+ */
6
+ import type { CapabilityUseEvent } from "../internal/capability-runtime.js";
7
+ import type { AssuranceEvidence } from "../internal/route-assurance.js";
8
+ import type { Method } from "../router/router.js";
9
+ import type { ClientIpTrust } from "./client-ip.js";
10
+ import type { Context, Platform, RouteSchema } from "./context.js";
11
+ import type { Logger } from "./logger.js";
12
+ import type { MaybePromise, OnRequestResult } from "./server.js";
13
+ /**
14
+ * The outcome of a capacity-admission decision. `admitted` requests carry a `release` the server calls
15
+ * exactly once when the response is finalized; a shed request carries a ready `429` Response.
16
+ */
17
+ export type AdmissionDecision = {
18
+ readonly admitted: true;
19
+ release(): void;
20
+ } | {
21
+ readonly admitted: false;
22
+ readonly response: Response;
23
+ };
24
+ /**
25
+ * A capacity-admission gate. Decides, per request, whether the instance has capacity to run it now -
26
+ * bounding *concurrency*, which rate limits (frequency) and deadlines (duration) do not. Provide an
27
+ * implementation (see `@nifrajs/middleware`'s `createAdmissionController`) as {@link ServerOptions.admission}.
28
+ *
29
+ * Enabling it trades the fused native-route lane for native matching + this gate (the gate cannot be a
30
+ * per-request `onRequest` hook without disabling native routes entirely); when unset, the request path
31
+ * is untouched.
32
+ */
33
+ export interface AdmissionController {
34
+ admit(req: Request): AdmissionDecision | Promise<AdmissionDecision>;
35
+ }
36
+ export interface ServerOptions {
37
+ /**
38
+ * Max request body size (bytes), enforced **only when a route declares a body schema** - the cap
39
+ * lives in the schema-validated read path. Default 1_000_000.
40
+ *
41
+ * A route WITHOUT a body schema (raw body, file upload, BYO-validation) that reads `c.req` directly
42
+ * is not auto-bounded - use **`c.boundedBody(maxBytes?)`** / **`c.boundedJson(maxBytes?)`**, which
43
+ * apply this same cap (override per route by passing `maxBytes` - larger for an upload endpoint,
44
+ * smaller to tighten one).
45
+ */
46
+ readonly maxBodyBytes?: number;
47
+ /** Max inbound WebSocket message size (bytes) when `listen()`ing on Bun - frames over this are rejected
48
+ * by the runtime before reaching your handler (so a huge frame can't be JSON-parsed into memory).
49
+ * Default: `maxBodyBytes` (1 MB). */
50
+ readonly wsMaxPayloadBytes?: number;
51
+ /** Per-request timeout (ms): a slower request gets a 503 and `ctx.signal` aborts. 0 disables (default). */
52
+ readonly requestTimeoutMs?: number;
53
+ /**
54
+ * How to derive `c.clientIp` behind a reverse proxy or CDN. Omit (default) to trust only the raw
55
+ * socket peer and never believe a forwarded header. Set `{ trustedHops: n }` when the app sits
56
+ * behind `n` proxies you operate (the caller is read from `X-Forwarded-For` past those hops), or
57
+ * `{ header: name }` to trust one edge-set header's first value. Declaring trust the app can't
58
+ * actually enforce lets clients forge their IP, so leave it unset unless a proxy really fronts you.
59
+ */
60
+ readonly clientIp?: ClientIpTrust;
61
+ /**
62
+ * Admit the public `x-nifra-deadline` header and let it shorten local work. Disabled by default:
63
+ * services that participate in trusted cross-service deadline propagation opt in explicitly,
64
+ * while ordinary/public HTTP routes pay no header-admission tax and ignore hostile client values.
65
+ */
66
+ readonly acceptInboundDeadlines?: boolean;
67
+ /**
68
+ * Maximum time accepted from an inbound `x-nifra-deadline`, in milliseconds. An incoming absolute
69
+ * deadline may shorten this cap (and `requestTimeoutMs`, when configured), never extend it.
70
+ * Default 30_000; applies only when `acceptInboundDeadlines` is enabled and the header is present.
71
+ */
72
+ readonly maxInboundDeadlineMs?: number;
73
+ /** When `listen()`ing, install SIGTERM/SIGINT handlers that gracefully `stop()`. Default false. */
74
+ readonly gracefulSignals?: boolean;
75
+ /**
76
+ * Capacity-admission gate (see {@link AdmissionController}). Bounds concurrent in-flight work so a
77
+ * healthy instance sheds load (`429` + `Retry-After`) instead of accepting more than it can finish.
78
+ * Off by default. Enabling it disables the fused native-route fast path (requests route through the
79
+ * shared matched lane where the gate runs); when unset, the request path pays nothing.
80
+ */
81
+ readonly admission?: AdmissionController;
82
+ /**
83
+ * Optional token-only observation hook called by `useCapability(c, id)`. It receives no request,
84
+ * parameters, body, tenant, or values. Routes without capability declarations keep the old hot path.
85
+ */
86
+ readonly onCapabilityUse?: (event: CapabilityUseEvent) => void;
87
+ /** Structured logger for framework events (redacts secrets). Default: JSON to stderr. */
88
+ readonly logger?: Logger;
89
+ /**
90
+ * App-wide fallback fired when a route **without its own `onValidationError`** fails body/query
91
+ * validation. Same contract as the per-route hook (`(issues, ctx, kind) => Response | repaired-value |
92
+ * undefined`): a route's own hook takes precedence, and a route can fall through to the plain `422` by
93
+ * returning `undefined`. Use it for one app-wide error envelope (like tRPC's `errorFormatter` /
94
+ * Fastify's `setErrorHandler`) instead of repeating a formatter per route.
95
+ */
96
+ readonly onValidationError?: RouteSchema["onValidationError"];
97
+ }
98
+ /**
99
+ * MCP tool safety hints, surfaced in `tools/list`, that tell an agent how risky a `.tool()` call is - so it
100
+ * can decide whether to auto-invoke or confirm first. All optional; an omitted hint means "unknown". Mirrors
101
+ * the MCP spec's tool `annotations`.
102
+ */
103
+ export interface ToolAnnotations {
104
+ /** Human-readable display title for the tool, distinct from the machine `name`. */
105
+ readonly title?: string;
106
+ /** The tool does not modify its environment (a pure read). */
107
+ readonly readOnlyHint?: boolean;
108
+ /** The tool may perform destructive updates - only meaningful when `readOnlyHint` is not `true`. */
109
+ readonly destructiveHint?: boolean;
110
+ /** Repeated calls with the same arguments have no additional effect beyond the first. */
111
+ readonly idempotentHint?: boolean;
112
+ /** The tool interacts with external entities (an "open world" beyond this server). */
113
+ readonly openWorldHint?: boolean;
114
+ }
115
+ /**
116
+ * A registered route's public descriptor - method, path, and input schemas. The
117
+ * router trie discards the original patterns, so this flat list is what lets tools
118
+ * (e.g. `toOpenAPI`) enumerate routes after registration.
119
+ */
120
+ export interface RouteDescriptor {
121
+ readonly method: Method;
122
+ readonly path: string;
123
+ readonly schema: RouteSchema | undefined;
124
+ /** Effective enforcement evidence, populated only during reflection/introspection. */
125
+ readonly assurance?: readonly AssuranceEvidence[];
126
+ /** Normalized declared effect tokens, populated only when the route declares any. */
127
+ readonly capabilities?: readonly string[];
128
+ /** Set when the route is a declared dynamic route family (`schema.family`). */
129
+ readonly family?: boolean;
130
+ readonly tool?: {
131
+ readonly name: string;
132
+ readonly description: string;
133
+ readonly annotations?: ToolAnnotations;
134
+ };
135
+ }
136
+ /** A message in an MCP prompt's rendered output (see {@link Server.prompt}). */
137
+ export interface PromptMessage {
138
+ readonly role: "user" | "assistant";
139
+ readonly content: {
140
+ readonly type: "text";
141
+ readonly text: string;
142
+ };
143
+ }
144
+ /** One declared argument of an MCP prompt, surfaced in `prompts/list`. */
145
+ export interface PromptArgument {
146
+ readonly name: string;
147
+ readonly description?: string;
148
+ readonly required?: boolean;
149
+ }
150
+ /** An app-declared MCP resource - read-only data an agent can fetch through `nifra mcp`. */
151
+ export interface McpResourceDescriptor {
152
+ readonly uri: string;
153
+ readonly name: string;
154
+ readonly description?: string;
155
+ readonly mimeType?: string;
156
+ readonly read: () => MaybePromise<string | {
157
+ readonly text: string;
158
+ readonly mimeType?: string;
159
+ }>;
160
+ }
161
+ /** An app-declared MCP prompt - a reusable prompt template an agent can fetch through `nifra mcp`. */
162
+ export interface McpPromptDescriptor {
163
+ readonly name: string;
164
+ readonly description: string;
165
+ readonly arguments?: readonly PromptArgument[];
166
+ readonly handler: (args: Record<string, string>) => MaybePromise<readonly PromptMessage[]>;
167
+ }
168
+ /**
169
+ * The handle `listen()` returns - the slice of Bun's server nifra holds and exposes.
170
+ * Declared explicitly (rather than `ReturnType<typeof Bun.serve>`) so the public type
171
+ * surface doesn't leak the ambient `Bun` global into consumers' `.d.ts` resolution.
172
+ */
173
+ export interface RunningServer {
174
+ readonly port: number;
175
+ readonly hostname: string;
176
+ readonly pendingRequests: number;
177
+ stop(closeActiveConnections?: boolean): void;
178
+ }
179
+ /**
180
+ * A bundle of lifecycle hooks applied together via {@link Server.use} - the unit
181
+ * `@nifrajs/middleware` ships (cors, security headers, rate-limit). Every hook is
182
+ * optional and wired to its lifecycle point. Middleware is context-agnostic (sees
183
+ * the base `Context`); `use` does no context-type merging - the full type-merging
184
+ * plugin system is deferred, and `.use` is reserved as its future entry point.
185
+ */
186
+ export interface Middleware {
187
+ readonly name?: string;
188
+ readonly onRequest?: (req: Request, platform?: Platform) => MaybePromise<OnRequestResult>;
189
+ readonly around?: <T>(context: Context, next: () => MaybePromise<T>) => MaybePromise<T>;
190
+ readonly beforeHandle?: (context: Context) => MaybePromise<unknown>;
191
+ readonly afterHandle?: (result: unknown, context: Context) => MaybePromise<unknown>;
192
+ readonly onResponse?: (response: Response, req: Request) => MaybePromise<Response>;
193
+ readonly onResponseFinalized?: (outcome: ResponseFinalization, req: Request) => MaybePromise<void>;
194
+ readonly onError?: (error: unknown, context: Context) => MaybePromise<unknown>;
195
+ }
196
+ /** The terminal response-pipeline outcome observed after every transforming `onResponse` hook. */
197
+ export interface ResponseFinalization {
198
+ /** The final response, or the last response available when a transformation failed. */
199
+ readonly response: Response;
200
+ /** A response-hook failure. Terminal observers run fail-open before the error is rethrown. */
201
+ readonly error?: unknown;
202
+ }
203
+ //# sourceMappingURL=server-types.d.ts.map
@@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