@apifuse/provider-sdk 2.2.0-beta.2 → 2.2.0-beta.21

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 (291) hide show
  1. package/AUTHORING.md +487 -0
  2. package/CHANGELOG.md +90 -0
  3. package/README.md +49 -3
  4. package/SUBMISSION.md +1 -1
  5. package/bin/apifuse-check.ts +44 -59
  6. package/bin/apifuse-create.ts +1 -1
  7. package/bin/apifuse-dev.ts +27 -52
  8. package/bin/apifuse-pack-check.ts +14 -0
  9. package/bin/apifuse-pack-smoke.ts +36 -81
  10. package/bin/apifuse-pack-types.ts +305 -0
  11. package/bin/apifuse-perf.ts +45 -127
  12. package/bin/apifuse-record.ts +659 -111
  13. package/bin/apifuse-submit-check.ts +546 -48
  14. package/bin/apifuse-sync-assets.ts +117 -0
  15. package/bin/apifuse.ts +1 -1
  16. package/bin/submit-check-delimited-text.ts +50 -0
  17. package/bin/submit-check-xml-semantics.ts +204 -0
  18. package/bin/submit-check-xml.ts +134 -0
  19. package/dist/auth-turn/index.d.ts +3 -3
  20. package/dist/auth.d.ts +2 -2
  21. package/dist/auth.js +9 -18
  22. package/dist/ceremonies/index.d.ts +9 -1
  23. package/dist/ceremonies/index.js +65 -18
  24. package/dist/cli/commands.d.ts +1 -1
  25. package/dist/cli/commands.js +8 -0
  26. package/dist/cli/create.d.ts +3 -0
  27. package/dist/cli/create.js +34 -35
  28. package/dist/cli/prompt-assets.d.ts +80 -0
  29. package/dist/cli/prompt-assets.js +743 -0
  30. package/dist/cli/templates/provider/AGENTS.md.tpl +17 -8
  31. package/dist/config/loader.d.ts +176 -8
  32. package/dist/config/loader.js +424 -95
  33. package/dist/contract-serialization.d.ts +2 -2
  34. package/dist/contract-serialization.js +3 -6
  35. package/dist/contract-types.d.ts +2 -2
  36. package/dist/contract.d.ts +3 -3
  37. package/dist/contract.js +4 -6
  38. package/dist/define.d.ts +9 -1
  39. package/dist/define.js +304 -119
  40. package/dist/dev.d.ts +1 -1
  41. package/dist/dev.js +1 -1
  42. package/dist/error-resolution.d.ts +2 -0
  43. package/dist/error-resolution.js +90 -0
  44. package/dist/errors.d.ts +22 -1
  45. package/dist/errors.js +88 -0
  46. package/dist/fixture-sanitization.d.ts +26 -0
  47. package/dist/fixture-sanitization.js +216 -0
  48. package/dist/i18n/catalog.d.ts +2 -2
  49. package/dist/i18n/catalog.js +4 -10
  50. package/dist/i18n/index.d.ts +2 -2
  51. package/dist/i18n/index.js +2 -2
  52. package/dist/i18n/keys.d.ts +2 -2
  53. package/dist/index.d.ts +46 -42
  54. package/dist/index.js +41 -37
  55. package/dist/lint.d.ts +1 -1
  56. package/dist/lint.js +8 -15
  57. package/dist/native-address.d.ts +43 -0
  58. package/dist/native-address.js +281 -0
  59. package/dist/native-egress-policy.d.ts +31 -0
  60. package/dist/native-egress-policy.js +288 -0
  61. package/dist/observability.d.ts +5 -2
  62. package/dist/observability.js +48 -1
  63. package/dist/provider.d.ts +12 -11
  64. package/dist/provider.js +10 -9
  65. package/dist/public-schema-field-lint.d.ts +1 -1
  66. package/dist/recipes/gov-api.js +1 -1
  67. package/dist/runtime/auth-flow.d.ts +2 -1
  68. package/dist/runtime/auth-flow.js +4 -3
  69. package/dist/runtime/browser.d.ts +1 -1
  70. package/dist/runtime/browser.js +15 -29
  71. package/dist/runtime/cache.d.ts +1 -1
  72. package/dist/runtime/cache.js +4 -8
  73. package/dist/runtime/choice.d.ts +1 -1
  74. package/dist/runtime/choice.js +31 -35
  75. package/dist/runtime/credential.d.ts +1 -1
  76. package/dist/runtime/credential.js +1 -1
  77. package/dist/runtime/env.d.ts +1 -1
  78. package/dist/runtime/executor.d.ts +1 -1
  79. package/dist/runtime/executor.js +31 -4
  80. package/dist/runtime/http.d.ts +2 -2
  81. package/dist/runtime/http.js +387 -47
  82. package/dist/runtime/insights.d.ts +1 -1
  83. package/dist/runtime/insights.js +6 -13
  84. package/dist/runtime/instrumentation.d.ts +2 -2
  85. package/dist/runtime/instrumentation.js +345 -22
  86. package/dist/runtime/keyring.js +1 -1
  87. package/dist/runtime/namespace.js +1 -1
  88. package/dist/runtime/native-network.d.ts +127 -0
  89. package/dist/runtime/native-network.js +1298 -0
  90. package/dist/runtime/otlp.d.ts +1 -1
  91. package/dist/runtime/perf.d.ts +1 -1
  92. package/dist/runtime/provider.d.ts +1 -1
  93. package/dist/runtime/provider.js +1 -2
  94. package/dist/runtime/proxy-errors.d.ts +1 -1
  95. package/dist/runtime/proxy-errors.js +9 -7
  96. package/dist/runtime/proxy-nodemaven.d.ts +56 -0
  97. package/dist/runtime/proxy-nodemaven.js +146 -0
  98. package/dist/runtime/proxy-retry-policy.d.ts +2 -2
  99. package/dist/runtime/proxy-retry-policy.js +2 -2
  100. package/dist/runtime/proxy-telemetry.d.ts +2 -1
  101. package/dist/runtime/proxy-telemetry.js +55 -52
  102. package/dist/runtime/redirects.d.ts +29 -0
  103. package/dist/runtime/redirects.js +36 -0
  104. package/dist/runtime/redis.d.ts +1 -1
  105. package/dist/runtime/redis.js +2 -4
  106. package/dist/runtime/request-options.d.ts +68 -1
  107. package/dist/runtime/request-options.js +548 -0
  108. package/dist/runtime/secrets.d.ts +27 -0
  109. package/dist/runtime/secrets.js +51 -0
  110. package/dist/runtime/state.d.ts +2 -2
  111. package/dist/runtime/state.js +238 -26
  112. package/dist/runtime/stealth.d.ts +5 -3
  113. package/dist/runtime/stealth.js +423 -143
  114. package/dist/runtime/stt.d.ts +1 -1
  115. package/dist/runtime/stt.js +11 -15
  116. package/dist/runtime/trace.d.ts +2 -2
  117. package/dist/runtime/trace.js +2 -4
  118. package/dist/runtime/waterfall.d.ts +1 -1
  119. package/dist/schema.d.ts +1 -1
  120. package/dist/schema.js +7 -15
  121. package/dist/serve.d.ts +1 -1
  122. package/dist/serve.js +1 -1
  123. package/dist/server/index.d.ts +7 -7
  124. package/dist/server/index.js +6 -6
  125. package/dist/server/self-test-input-tokens.d.ts +2 -1
  126. package/dist/server/self-test-input-tokens.js +18 -14
  127. package/dist/server/self-test-redaction.d.ts +1 -1
  128. package/dist/server/self-test-redaction.js +1 -1
  129. package/dist/server/self-test.d.ts +104 -3
  130. package/dist/server/self-test.js +673 -115
  131. package/dist/server/serve.d.ts +116 -4
  132. package/dist/server/serve.js +799 -128
  133. package/dist/server/types.d.ts +34 -9
  134. package/dist/server/types.js +8 -1
  135. package/dist/stateful/errors.d.ts +14 -0
  136. package/dist/stateful/errors.js +14 -0
  137. package/dist/stateful/http-provider-event-emitter.d.ts +40 -0
  138. package/dist/stateful/http-provider-event-emitter.js +237 -0
  139. package/dist/stateful/http-session-owner-registry.d.ts +44 -0
  140. package/dist/stateful/http-session-owner-registry.js +210 -0
  141. package/dist/stateful/index.d.ts +18 -0
  142. package/dist/stateful/index.js +18 -0
  143. package/dist/stateful/provider-event-delivery-failures.d.ts +32 -0
  144. package/dist/stateful/provider-event-delivery-failures.js +43 -0
  145. package/dist/stateful/provider-event-pipeline-metrics.d.ts +46 -0
  146. package/dist/stateful/provider-event-pipeline-metrics.js +48 -0
  147. package/dist/stateful/provider-event-pipeline.d.ts +50 -0
  148. package/dist/stateful/provider-event-pipeline.js +1 -0
  149. package/dist/stateful/provider-events.d.ts +101 -0
  150. package/dist/stateful/provider-events.js +289 -0
  151. package/dist/stateful/session-key.d.ts +15 -0
  152. package/dist/stateful/session-key.js +86 -0
  153. package/dist/stateful/stateful-provider-adapter-context.d.ts +5 -0
  154. package/dist/stateful/stateful-provider-adapter-context.js +42 -0
  155. package/dist/stateful/stateful-provider-adapter-metrics.d.ts +15 -0
  156. package/dist/stateful/stateful-provider-adapter-metrics.js +21 -0
  157. package/dist/stateful/stateful-provider-adapter.d.ts +98 -0
  158. package/dist/stateful/stateful-provider-adapter.js +287 -0
  159. package/dist/stateful/stateful-provider-observability.d.ts +62 -0
  160. package/dist/stateful/stateful-provider-observability.js +161 -0
  161. package/dist/stateful/stateful-provider-owner-forwarder.d.ts +41 -0
  162. package/dist/stateful/stateful-provider-owner-forwarder.js +215 -0
  163. package/dist/stateful/stateful-provider-runtime-context.d.ts +32 -0
  164. package/dist/stateful/stateful-provider-runtime-context.js +60 -0
  165. package/dist/stateful/stateful-provider-runtime-executor.d.ts +34 -0
  166. package/dist/stateful/stateful-provider-runtime-executor.js +52 -0
  167. package/dist/stateful/stateful-provider-session-routing.d.ts +71 -0
  168. package/dist/stateful/stateful-provider-session-routing.js +353 -0
  169. package/dist/stateful/stateful-provider-session-runtime.d.ts +98 -0
  170. package/dist/stateful/stateful-provider-session-runtime.js +245 -0
  171. package/dist/stateful-signing.d.ts +18 -0
  172. package/dist/stateful-signing.js +27 -0
  173. package/dist/stealth/profiles.d.ts +1 -1
  174. package/dist/stealth/profiles.js +5 -14
  175. package/dist/stream-evidence.d.ts +74 -0
  176. package/dist/stream-evidence.js +785 -0
  177. package/dist/stream.d.ts +1 -1
  178. package/dist/testing/index.d.ts +2 -2
  179. package/dist/testing/index.js +2 -2
  180. package/dist/testing/run.d.ts +32 -2
  181. package/dist/testing/run.js +478 -28
  182. package/dist/types.d.ts +342 -14
  183. package/dist/types.js +1 -0
  184. package/dist/user-input.d.ts +30 -0
  185. package/dist/user-input.js +66 -0
  186. package/package.json +16 -5
  187. package/src/auth-turn/index.ts +1 -1
  188. package/src/auth.ts +28 -86
  189. package/src/ceremonies/index.ts +103 -78
  190. package/src/cli/commands.ts +10 -0
  191. package/src/cli/create.ts +42 -35
  192. package/src/cli/prompt-assets.ts +865 -0
  193. package/src/cli/templates/provider/AGENTS.md.tpl +17 -8
  194. package/src/config/loader.ts +652 -204
  195. package/src/contract-serialization.ts +5 -11
  196. package/src/contract-types.ts +2 -2
  197. package/src/contract.ts +12 -28
  198. package/src/define.ts +499 -498
  199. package/src/dev.ts +4 -9
  200. package/src/error-resolution.ts +91 -0
  201. package/src/errors.ts +110 -5
  202. package/src/fixture-sanitization.ts +247 -0
  203. package/src/i18n/catalog.ts +10 -32
  204. package/src/i18n/index.ts +2 -2
  205. package/src/i18n/keys.ts +5 -11
  206. package/src/index.ts +112 -42
  207. package/src/lint.ts +88 -152
  208. package/src/native-address.ts +340 -0
  209. package/src/native-egress-policy.ts +358 -0
  210. package/src/observability.ts +51 -1
  211. package/src/provider.ts +66 -11
  212. package/src/public-schema-field-lint.ts +7 -33
  213. package/src/recipes/gov-api.ts +2 -5
  214. package/src/runtime/auth-flow.ts +7 -7
  215. package/src/runtime/browser.ts +64 -187
  216. package/src/runtime/cache.ts +20 -67
  217. package/src/runtime/choice.ts +79 -132
  218. package/src/runtime/credential.ts +2 -2
  219. package/src/runtime/env.ts +1 -1
  220. package/src/runtime/executor.ts +43 -20
  221. package/src/runtime/http.ts +494 -57
  222. package/src/runtime/insights.ts +15 -53
  223. package/src/runtime/instrumentation.ts +495 -66
  224. package/src/runtime/keyring.ts +7 -19
  225. package/src/runtime/namespace.ts +2 -7
  226. package/src/runtime/native-network.ts +1686 -0
  227. package/src/runtime/otlp.ts +12 -23
  228. package/src/runtime/perf.ts +1 -1
  229. package/src/runtime/provider.ts +4 -9
  230. package/src/runtime/proxy-errors.ts +29 -42
  231. package/src/runtime/proxy-nodemaven.ts +221 -0
  232. package/src/runtime/proxy-retry-policy.ts +3 -3
  233. package/src/runtime/proxy-telemetry.ts +79 -77
  234. package/src/runtime/redirects.ts +66 -0
  235. package/src/runtime/redis.ts +4 -12
  236. package/src/runtime/request-options.ts +679 -9
  237. package/src/runtime/secrets.ts +64 -0
  238. package/src/runtime/state.ts +353 -133
  239. package/src/runtime/stealth.ts +505 -154
  240. package/src/runtime/stt.ts +38 -94
  241. package/src/runtime/trace.ts +14 -44
  242. package/src/runtime/waterfall.ts +5 -18
  243. package/src/schema.ts +23 -84
  244. package/src/serve.ts +1 -1
  245. package/src/server/index.ts +29 -7
  246. package/src/server/self-test-input-tokens.ts +29 -14
  247. package/src/server/self-test-redaction.ts +2 -2
  248. package/src/server/self-test.ts +857 -132
  249. package/src/server/serve.ts +1151 -328
  250. package/src/server/types.ts +12 -13
  251. package/src/stateful/README.md +146 -0
  252. package/src/stateful/errors.ts +23 -0
  253. package/src/stateful/http-provider-event-emitter.ts +314 -0
  254. package/src/stateful/http-session-owner-registry.ts +306 -0
  255. package/src/stateful/index.ts +18 -0
  256. package/src/stateful/provider-event-delivery-failures.ts +80 -0
  257. package/src/stateful/provider-event-pipeline-metrics.ts +95 -0
  258. package/src/stateful/provider-event-pipeline.ts +61 -0
  259. package/src/stateful/provider-events.ts +462 -0
  260. package/src/stateful/session-key.ts +111 -0
  261. package/src/stateful/stateful-provider-adapter-context.ts +59 -0
  262. package/src/stateful/stateful-provider-adapter-metrics.ts +48 -0
  263. package/src/stateful/stateful-provider-adapter.ts +562 -0
  264. package/src/stateful/stateful-provider-observability.ts +261 -0
  265. package/src/stateful/stateful-provider-owner-forwarder.ts +287 -0
  266. package/src/stateful/stateful-provider-runtime-context.ts +92 -0
  267. package/src/stateful/stateful-provider-runtime-executor.ts +96 -0
  268. package/src/stateful/stateful-provider-session-routing.ts +555 -0
  269. package/src/stateful/stateful-provider-session-runtime.ts +403 -0
  270. package/src/stateful-signing.ts +46 -0
  271. package/src/stealth/profiles.ts +10 -26
  272. package/src/stream-evidence.ts +988 -0
  273. package/src/stream.ts +8 -19
  274. package/src/testing/index.ts +10 -2
  275. package/src/testing/run.ts +653 -74
  276. package/src/types.ts +408 -28
  277. package/src/user-input.ts +118 -0
  278. package/dist/cli/templates/provider/CLAUDE.md.tpl +0 -1
  279. package/src/cli/templates/provider/CLAUDE.md.tpl +0 -1
  280. /package/dist/cli/templates/provider/{skills → .agents/skills}/fixtures-and-recording/SKILL.md.tpl +0 -0
  281. /package/dist/cli/templates/provider/{skills → .agents/skills}/health-checks-and-fail-closed/SKILL.md.tpl +0 -0
  282. /package/dist/cli/templates/provider/{skills → .agents/skills}/normalization-standards/SKILL.md.tpl +0 -0
  283. /package/dist/cli/templates/provider/{skills → .agents/skills}/pagination-and-counts/SKILL.md.tpl +0 -0
  284. /package/dist/cli/templates/provider/{skills → .agents/skills}/upstream-contract-verification/SKILL.md.tpl +0 -0
  285. /package/dist/cli/templates/provider/{skills → .agents/skills}/upstream-notes/README.md.tpl +0 -0
  286. /package/src/cli/templates/provider/{skills → .agents/skills}/fixtures-and-recording/SKILL.md.tpl +0 -0
  287. /package/src/cli/templates/provider/{skills → .agents/skills}/health-checks-and-fail-closed/SKILL.md.tpl +0 -0
  288. /package/src/cli/templates/provider/{skills → .agents/skills}/normalization-standards/SKILL.md.tpl +0 -0
  289. /package/src/cli/templates/provider/{skills → .agents/skills}/pagination-and-counts/SKILL.md.tpl +0 -0
  290. /package/src/cli/templates/provider/{skills → .agents/skills}/upstream-contract-verification/SKILL.md.tpl +0 -0
  291. /package/src/cli/templates/provider/{skills → .agents/skills}/upstream-notes/README.md.tpl +0 -0
@@ -1,4 +1,4 @@
1
- import type { ProviderSttConfig, SttContext, SttTranscribeRequest, SttVerificationCodeOptions, VerificationCodeExtractionResult } from "../types";
1
+ import type { ProviderSttConfig, SttContext, SttTranscribeRequest, SttVerificationCodeOptions, VerificationCodeExtractionResult } from "../types.js";
2
2
  export declare const APIFUSE__STT__BACKEND_ENV = "APIFUSE__STT__BACKEND";
3
3
  export declare const APIFUSE__STT__MODEL_ENV = "APIFUSE__STT__MODEL";
4
4
  export declare const CLOUDFLARE_ACCOUNT_ID_ENV = "APIFUSE__CLOUDFLARE__ACCOUNT_ID";
@@ -1,4 +1,4 @@
1
- import { ProviderError, TransportError, ValidationError } from "../errors";
1
+ import { ProviderError, TransportError, ValidationError } from "../errors.js";
2
2
  export const APIFUSE__STT__BACKEND_ENV = "APIFUSE__STT__BACKEND";
3
3
  export const APIFUSE__STT__MODEL_ENV = "APIFUSE__STT__MODEL";
4
4
  export const CLOUDFLARE_ACCOUNT_ID_ENV = "APIFUSE__CLOUDFLARE__ACCOUNT_ID";
@@ -59,17 +59,12 @@ export function createSttClientFromEnv(config, env = process.env) {
59
59
  return createCloudflareWorkersAiSttClient({
60
60
  accountId,
61
61
  apiToken,
62
- model: normalizedEnvValue(env, APIFUSE__STT__MODEL_ENV) ??
63
- DEFAULT_CLOUDFLARE_WORKERS_AI_STT_MODEL,
62
+ model: normalizedEnvValue(env, APIFUSE__STT__MODEL_ENV) ?? DEFAULT_CLOUDFLARE_WORKERS_AI_STT_MODEL,
64
63
  });
65
64
  }
66
65
  function base64ByteLength(data) {
67
66
  const normalized = data.trim();
68
- const padding = normalized.endsWith("==")
69
- ? 2
70
- : normalized.endsWith("=")
71
- ? 1
72
- : 0;
67
+ const padding = normalized.endsWith("==") ? 2 : normalized.endsWith("=") ? 1 : 0;
73
68
  return Math.floor((normalized.length * 3) / 4) - padding;
74
69
  }
75
70
  function assertBase64Audio(audio, maxAudioBytes) {
@@ -80,9 +75,7 @@ function assertBase64Audio(audio, maxAudioBytes) {
80
75
  });
81
76
  }
82
77
  const data = audio.data.trim();
83
- if (data.length === 0 ||
84
- data.length % 4 !== 0 ||
85
- !BASE64_AUDIO_PATTERN.test(data)) {
78
+ if (data.length === 0 || data.length % 4 !== 0 || !BASE64_AUDIO_PATTERN.test(data)) {
86
79
  throw new ValidationError("STT audio.data must be a base64-encoded string", {
87
80
  code: "INVALID_STT_AUDIO",
88
81
  });
@@ -90,7 +83,9 @@ function assertBase64Audio(audio, maxAudioBytes) {
90
83
  const bytes = base64ByteLength(data);
91
84
  const maxBytes = maxAudioBytes ?? DEFAULT_STT_MAX_AUDIO_BYTES;
92
85
  if (bytes > maxBytes) {
93
- throw new ValidationError(`STT audio exceeds maxAudioBytes (${bytes} > ${maxBytes})`, { code: "STT_AUDIO_TOO_LARGE" });
86
+ throw new ValidationError(`STT audio exceeds maxAudioBytes (${bytes} > ${maxBytes})`, {
87
+ code: "STT_AUDIO_TOO_LARGE",
88
+ });
94
89
  }
95
90
  return bytes;
96
91
  }
@@ -227,8 +222,7 @@ export function createCloudflareWorkersAiSttClient(options) {
227
222
  return {
228
223
  async transcribe(request) {
229
224
  const warnings = [];
230
- if (request.initialPrompt &&
231
- effectivePromptPolicy(request) !== "custom-hint") {
225
+ if (request.initialPrompt && effectivePromptPolicy(request) !== "custom-hint") {
232
226
  const warning = warnOrThrowUnsupportedOption(request, "initialPrompt is honored only when promptPolicy is custom-hint");
233
227
  if (warning)
234
228
  warnings.push(warning);
@@ -350,7 +344,9 @@ function lengthSet(codeLengths) {
350
344
  }
351
345
  function validCodeLength(value) {
352
346
  if (!Number.isInteger(value) || value < 1 || value > 32) {
353
- throw new ValidationError("STT verification code length must be an integer between 1 and 32", { code: "INVALID_STT_VERIFICATION_CODE_OPTIONS" });
347
+ throw new ValidationError("STT verification code length must be an integer between 1 and 32", {
348
+ code: "INVALID_STT_VERIFICATION_CODE_OPTIONS",
349
+ });
354
350
  }
355
351
  return value;
356
352
  }
@@ -1,5 +1,5 @@
1
- import type { TraceContext as BaseTraceContext, TraceAttributeValue, TraceConfig, TraceSpan } from "../types";
2
- import { type OTLPExportOptions } from "./otlp";
1
+ import type { TraceContext as BaseTraceContext, TraceAttributeValue, TraceConfig, TraceSpan } from "../types.js";
2
+ import { type OTLPExportOptions } from "./otlp.js";
3
3
  export type SpanAttributeValue = TraceAttributeValue;
4
4
  export type Span = TraceSpan;
5
5
  export interface TraceContext extends BaseTraceContext {
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
- import { exportSpansOTLP } from "./otlp";
2
+ import { exportSpansOTLP } from "./otlp.js";
3
3
  export const TRACE_RECORDER = Symbol.for("@apifuse/provider-sdk/runtime/trace-recorder");
4
4
  function buildOTLPExportOptions(config) {
5
5
  if (config?.exporter !== "otlp") {
@@ -23,9 +23,7 @@ export function resolveTraceContextOptions(config) {
23
23
  };
24
24
  }
25
25
  function normalizeAttributeValue(value) {
26
- if (typeof value === "string" ||
27
- typeof value === "number" ||
28
- typeof value === "boolean") {
26
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
29
27
  return value;
30
28
  }
31
29
  if (value === null || value === undefined) {
@@ -1,4 +1,4 @@
1
- import type { Span } from "./trace";
1
+ import type { Span } from "./trace.js";
2
2
  export type WaterfallRequest = {
3
3
  method: string;
4
4
  path: string;
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type ZodString, type ZodType, z } from "zod";
2
- import type { InferSchemaOutput, ProviderLocaleKey, SchemaLike } from "./types";
2
+ import type { InferSchemaOutput, ProviderLocaleKey, SchemaLike } from "./types.js";
3
3
  export { z };
4
4
  export type SchemaValidationResult<TSchema extends SchemaLike> = {
5
5
  success: true;
package/dist/schema.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { ValidationError } from "./errors";
3
- import { providerLocaleKey } from "./i18n/keys";
2
+ import { ValidationError } from "./errors.js";
3
+ import { providerLocaleKey } from "./i18n/keys.js";
4
4
  export { z };
5
5
  function isFailureResult(result) {
6
6
  return "issues" in result;
@@ -99,21 +99,15 @@ export function field(schema, options = {}) {
99
99
  const metadata = described.meta() ?? {};
100
100
  return described.meta({
101
101
  ...metadata,
102
- ...((options.sensitive ?? true)
103
- ? { [APIFUSE_SENSITIVE_META_KEY]: true }
104
- : {}),
105
- ...(options.kind
106
- ? { [APIFUSE_SENSITIVE_KIND_META_KEY]: options.kind }
107
- : {}),
102
+ ...((options.sensitive ?? true) ? { [APIFUSE_SENSITIVE_META_KEY]: true } : {}),
103
+ ...(options.kind ? { [APIFUSE_SENSITIVE_KIND_META_KEY]: options.kind } : {}),
108
104
  });
109
105
  }
110
106
  export function sensitive(schema, kind) {
111
107
  return field(schema, { sensitive: true, kind });
112
108
  }
113
109
  function sensitiveString(kind, description, options = {}) {
114
- const schema = options.minLength === undefined
115
- ? z.string()
116
- : z.string().min(options.minLength);
110
+ const schema = options.minLength === undefined ? z.string() : z.string().min(options.minLength);
117
111
  return field(schema, {
118
112
  kind,
119
113
  description: options.description ?? description,
@@ -132,8 +126,7 @@ export const fields = {
132
126
  };
133
127
  export function isSensitiveSchema(schema) {
134
128
  const metadata = readZodMetadata(schema);
135
- return (metadata !== undefined &&
136
- Reflect.get(metadata, APIFUSE_SENSITIVE_META_KEY) === true);
129
+ return metadata !== undefined && Reflect.get(metadata, APIFUSE_SENSITIVE_META_KEY) === true;
137
130
  }
138
131
  export function collectSensitivePaths(schema) {
139
132
  const out = [];
@@ -217,8 +210,7 @@ function pathMatches(path, patterns) {
217
210
  }
218
211
  function isReservedSensitiveKey(key) {
219
212
  const normalized = key.toLowerCase().replace(/[-_\s]/g, "");
220
- return (RESERVED_SENSITIVE_KEYS.has(normalized) ||
221
- RESERVED_SENSITIVE_KEYS.has(key.toLowerCase()));
213
+ return RESERVED_SENSITIVE_KEYS.has(normalized) || RESERVED_SENSITIVE_KEYS.has(key.toLowerCase());
222
214
  }
223
215
  function readZodMetadata(schema) {
224
216
  if (!schema || typeof schema !== "object" || !("meta" in schema)) {
package/dist/serve.d.ts CHANGED
@@ -1 +1 @@
1
- export { createServerApp, type ServeOptions, serve } from "./server/serve";
1
+ export { createServerApp, type ServeOptions, serve } from "./server/serve.js";
package/dist/serve.js CHANGED
@@ -1 +1 @@
1
- export { createServerApp, serve } from "./server/serve";
1
+ export { createServerApp, serve } from "./server/serve.js";
@@ -1,7 +1,7 @@
1
- export { createServerApp, type ServeOptions, serve } from "./serve";
2
- export { computeSelfTestPlanDigest, createSelfTestApp, createSelfTestInvoke, DEFAULT_SELF_TEST_REQUEST_BUDGET_MS, isSelfTestReadOnlyOperation, PROVIDER_RUNTIME_SELF_TEST_REQUEST_BUDGET_MS_ENV, resolveSelfTestPort, SELF_TEST_HEALTHZ_PATH, SELF_TEST_PATH, SELF_TEST_SCHEMA_VERSION, type SelfTestAppOptions, type SelfTestCaseResult, type SelfTestCaseStatus, type SelfTestOperationInvoke, type SelfTestRequest, SelfTestRequestSchema, type SelfTestResponse, } from "./self-test";
3
- export { resolveHealthCheckInputDateTokens } from "./self-test-input-tokens";
4
- export { collectSelfTestSensitiveValues, redactSelfTestText, SELF_TEST_MAX_TEXT_LENGTH, SELF_TEST_REDACTED_PLACEHOLDER, } from "./self-test-redaction";
5
- export { DEFAULT_SELF_TEST_PORT, deriveSelfTestToken, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_ENV, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_PREVIOUS_ENV, PROVIDER_RUNTIME_SELF_TEST_PORT_ENV, resolveSelfTestMasterSecrets, type SelfTestMasterSecrets, verifySelfTestAuthorization, } from "./self-test-token";
6
- export type { AuthFlowRequest, AuthFlowResponse, AuthFlowSuccessResponse, ConnectionMode, OperationConnection, OperationErrorResponse, OperationRequest, OperationResponse, OperationSuccessResponse, } from "./types";
7
- export { AuthFlowRequestSchema, AuthFlowSuccessResponseSchema, ConnectionModeSchema, ErrorEnvelopeSchema, OperationConnectionSchema, OperationErrorResponseSchema, OperationRequestSchema, OperationSuccessResponseSchema, } from "./types";
1
+ export { createServerApp, ERROR_OBSERVABILITY_HEADER, type ErrorObservabilityDetails, type ProviderServerCloseOptions, type ProviderServerHandle, type ProviderServerLogEvent, type ProviderServerLogger, type ProviderServerOperationExecutor, type ProviderServerOperationExecutorInput, type ProviderServerOptions, type ProviderServerStatefulForwardEnvelope, type ServeOptions, serve, } from "./serve.js";
2
+ export { computeSelfTestPlanDigest, createSelfTestApp, createSelfTestAuthFlowInvoke, createSelfTestInvoke, DEFAULT_SELF_TEST_REQUEST_BUDGET_MS, isSelfTestReadOnlyOperation, PROVIDER_RUNTIME_SELF_TEST_REQUEST_BUDGET_MS_ENV, resolveSelfTestPort, SELF_TEST_AUTH_FLOW_MULTI_TURN_SKIP_REASON, SELF_TEST_AUTH_FLOW_REJECTED_SKIP_REASON, SELF_TEST_HEALTHZ_PATH, SELF_TEST_PATH, SELF_TEST_SCHEMA_VERSION, type SelfTestAppOptions, type SelfTestAuthFlowInvoke, type SelfTestAuthFlowRoute, type SelfTestCaseResult, type SelfTestCaseStatus, type SelfTestOperationInvoke, type SelfTestRequest, SelfTestRequestSchema, type SelfTestResponse, } from "./self-test.js";
3
+ export { type InputDateTokenCalendar, resolveHealthCheckInputDateTokens, } from "./self-test-input-tokens.js";
4
+ export { collectSelfTestSensitiveValues, redactSelfTestText, SELF_TEST_MAX_TEXT_LENGTH, SELF_TEST_REDACTED_PLACEHOLDER, } from "./self-test-redaction.js";
5
+ export { DEFAULT_SELF_TEST_PORT, deriveSelfTestToken, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_ENV, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_PREVIOUS_ENV, PROVIDER_RUNTIME_SELF_TEST_PORT_ENV, resolveSelfTestMasterSecrets, type SelfTestMasterSecrets, verifySelfTestAuthorization, } from "./self-test-token.js";
6
+ export type { AuthFlowRequest, AuthFlowResponse, AuthFlowSuccessResponse, ConnectionMode, OperationConnection, OperationErrorResponse, OperationRequest, OperationResponse, OperationSuccessResponse, } from "./types.js";
7
+ export { AuthFlowRequestSchema, AuthFlowSuccessResponseSchema, ConnectionModeSchema, ErrorEnvelopeSchema, OperationConnectionSchema, OperationErrorResponseSchema, OperationRequestSchema, OperationSuccessResponseSchema, } from "./types.js";
@@ -1,6 +1,6 @@
1
- export { createServerApp, serve } from "./serve";
2
- export { computeSelfTestPlanDigest, createSelfTestApp, createSelfTestInvoke, DEFAULT_SELF_TEST_REQUEST_BUDGET_MS, isSelfTestReadOnlyOperation, PROVIDER_RUNTIME_SELF_TEST_REQUEST_BUDGET_MS_ENV, resolveSelfTestPort, SELF_TEST_HEALTHZ_PATH, SELF_TEST_PATH, SELF_TEST_SCHEMA_VERSION, SelfTestRequestSchema, } from "./self-test";
3
- export { resolveHealthCheckInputDateTokens } from "./self-test-input-tokens";
4
- export { collectSelfTestSensitiveValues, redactSelfTestText, SELF_TEST_MAX_TEXT_LENGTH, SELF_TEST_REDACTED_PLACEHOLDER, } from "./self-test-redaction";
5
- export { DEFAULT_SELF_TEST_PORT, deriveSelfTestToken, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_ENV, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_PREVIOUS_ENV, PROVIDER_RUNTIME_SELF_TEST_PORT_ENV, resolveSelfTestMasterSecrets, verifySelfTestAuthorization, } from "./self-test-token";
6
- export { AuthFlowRequestSchema, AuthFlowSuccessResponseSchema, ConnectionModeSchema, ErrorEnvelopeSchema, OperationConnectionSchema, OperationErrorResponseSchema, OperationRequestSchema, OperationSuccessResponseSchema, } from "./types";
1
+ export { createServerApp, ERROR_OBSERVABILITY_HEADER, serve, } from "./serve.js";
2
+ export { computeSelfTestPlanDigest, createSelfTestApp, createSelfTestAuthFlowInvoke, createSelfTestInvoke, DEFAULT_SELF_TEST_REQUEST_BUDGET_MS, isSelfTestReadOnlyOperation, PROVIDER_RUNTIME_SELF_TEST_REQUEST_BUDGET_MS_ENV, resolveSelfTestPort, SELF_TEST_AUTH_FLOW_MULTI_TURN_SKIP_REASON, SELF_TEST_AUTH_FLOW_REJECTED_SKIP_REASON, SELF_TEST_HEALTHZ_PATH, SELF_TEST_PATH, SELF_TEST_SCHEMA_VERSION, SelfTestRequestSchema, } from "./self-test.js";
3
+ export { resolveHealthCheckInputDateTokens, } from "./self-test-input-tokens.js";
4
+ export { collectSelfTestSensitiveValues, redactSelfTestText, SELF_TEST_MAX_TEXT_LENGTH, SELF_TEST_REDACTED_PLACEHOLDER, } from "./self-test-redaction.js";
5
+ export { DEFAULT_SELF_TEST_PORT, deriveSelfTestToken, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_ENV, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_PREVIOUS_ENV, PROVIDER_RUNTIME_SELF_TEST_PORT_ENV, resolveSelfTestMasterSecrets, verifySelfTestAuthorization, } from "./self-test-token.js";
6
+ export { AuthFlowRequestSchema, AuthFlowSuccessResponseSchema, ConnectionModeSchema, ErrorEnvelopeSchema, OperationConnectionSchema, OperationErrorResponseSchema, OperationRequestSchema, OperationSuccessResponseSchema, } from "./types.js";
@@ -1 +1,2 @@
1
- export declare function resolveHealthCheckInputDateTokens(value: unknown, now?: Date): unknown;
1
+ export type InputDateTokenCalendar = "KST" | "UTC";
2
+ export declare function resolveHealthCheckInputDateTokens(value: unknown, now?: Date, calendar?: InputDateTokenCalendar): unknown;
@@ -1,20 +1,20 @@
1
1
  /**
2
- * Relative-KST date token resolution for health-check case inputs, ported from
3
- * the monorepo health-monitor (`apps/health-monitor/src/lib/health-check-input.ts`)
4
- * so provider self-tests resolve durable probe inputs identically.
2
+ * Relative date-token resolution for health-check case inputs and fixture
3
+ * requests. The calendar defaults to KST; callers that need UTC must opt in
4
+ * explicitly so UTC and KST do not silently disagree from 15:00–23:59 UTC.
5
5
  *
6
- * Supported token: `+<days>d` or `+<days>d:YYYYMMDD` (1..365 days ahead, KST).
6
+ * Supported token: `+<days>d` or `+<days>d:YYYYMMDD` (1..365 days ahead).
7
7
  */
8
- const RELATIVE_KST_DATE_TOKEN = /^\+(\d{1,3})d(?::(YYYYMMDD))?$/i;
9
- function dateFromKstDaysAhead(daysAhead, now = new Date(), format = "YYYY-MM-DD") {
10
- const kstNow = new Date(now.getTime() + 9 * 60 * 60 * 1000);
11
- const date = new Date(Date.UTC(kstNow.getUTCFullYear(), kstNow.getUTCMonth(), kstNow.getUTCDate() + daysAhead));
8
+ const RELATIVE_DATE_TOKEN = /^\+(\d{1,3})d(?::(YYYYMMDD))?$/i;
9
+ function dateFromDaysAhead(daysAhead, now = new Date(), format = "YYYY-MM-DD", calendar = "KST") {
10
+ const calendarNow = new Date(now.getTime() + (calendar === "KST" ? 9 * 60 * 60 * 1000 : 0));
11
+ const date = new Date(Date.UTC(calendarNow.getUTCFullYear(), calendarNow.getUTCMonth(), calendarNow.getUTCDate() + daysAhead));
12
12
  const isoDate = date.toISOString().slice(0, 10);
13
13
  return format === "YYYYMMDD" ? isoDate.replace(/-/g, "") : isoDate;
14
14
  }
15
- export function resolveHealthCheckInputDateTokens(value, now = new Date()) {
15
+ export function resolveHealthCheckInputDateTokens(value, now = new Date(), calendar = "KST") {
16
16
  if (typeof value === "string") {
17
- const relative = value.match(RELATIVE_KST_DATE_TOKEN);
17
+ const relative = value.match(RELATIVE_DATE_TOKEN);
18
18
  if (!relative)
19
19
  return value;
20
20
  const daysAhead = Number(relative[1]);
@@ -22,16 +22,20 @@ export function resolveHealthCheckInputDateTokens(value, now = new Date()) {
22
22
  return value;
23
23
  }
24
24
  const format = relative[2]?.toUpperCase() === "YYYYMMDD" ? "YYYYMMDD" : "YYYY-MM-DD";
25
- return dateFromKstDaysAhead(daysAhead, now, format);
25
+ return dateFromDaysAhead(daysAhead, now, format, calendar);
26
26
  }
27
27
  if (Array.isArray(value)) {
28
- return value.map((entry) => resolveHealthCheckInputDateTokens(entry, now));
28
+ const resolved = value.map((entry) => resolveHealthCheckInputDateTokens(entry, now, calendar));
29
+ return resolved.some((entry, index) => entry !== value[index]) ? resolved : value;
29
30
  }
30
31
  if (value && typeof value === "object") {
31
- return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
32
+ const resolved = Object.fromEntries(Object.entries(value).map(([key, entry]) => [
32
33
  key,
33
- resolveHealthCheckInputDateTokens(entry, now),
34
+ resolveHealthCheckInputDateTokens(entry, now, calendar),
34
35
  ]));
36
+ return Object.entries(resolved).some(([key, entry]) => entry !== Reflect.get(value, key))
37
+ ? resolved
38
+ : value;
35
39
  }
36
40
  return value;
37
41
  }
@@ -1,4 +1,4 @@
1
- import type { ProviderDefinition } from "../types";
1
+ import type { ProviderDefinition } from "../types.js";
2
2
  export declare const SELF_TEST_REDACTED_PLACEHOLDER = "[REDACTED]";
3
3
  /** Maximum length of any string echoed in a self-test response. */
4
4
  export declare const SELF_TEST_MAX_TEXT_LENGTH = 300;
@@ -1,4 +1,4 @@
1
- import { PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_ENV, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_PREVIOUS_ENV, } from "./self-test-token";
1
+ import { PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_ENV, PROVIDER_RUNTIME_SELF_TEST_MASTER_SECRET_PREVIOUS_ENV, } from "./self-test-token.js";
2
2
  export const SELF_TEST_REDACTED_PLACEHOLDER = "[REDACTED]";
3
3
  /** Maximum length of any string echoed in a self-test response. */
4
4
  export const SELF_TEST_MAX_TEXT_LENGTH = 300;
@@ -1,8 +1,8 @@
1
1
  import { Hono } from "hono";
2
2
  import { z } from "zod";
3
- import type { OperationDefinition, ProviderDefinition } from "../types";
4
- import { type SelfTestMasterSecrets } from "./self-test-token";
5
- import type { OperationConnection } from "./types";
3
+ import type { OperationDefinition, ProviderDefinition } from "../types.js";
4
+ import { type SelfTestMasterSecrets } from "./self-test-token.js";
5
+ import type { OperationConnection } from "./types.js";
6
6
  export declare const SELF_TEST_SCHEMA_VERSION: 1;
7
7
  export declare const SELF_TEST_PATH = "/internal/health/self-test";
8
8
  export declare const SELF_TEST_HEALTHZ_PATH = "/healthz";
@@ -61,11 +61,53 @@ export type SelfTestOperationInvoke = (args: {
61
61
  data: unknown;
62
62
  meta?: Record<string, unknown>;
63
63
  }>;
64
+ export type SelfTestAuthFlowRoute = "start" | "continue";
65
+ /**
66
+ * In-process driver for the tenant app's /auth pipeline. Self-test uses it to
67
+ * materialize `requiresConnection` credentials through the provider's declared
68
+ * auth flow — the exact path production connections take — instead of
69
+ * injecting raw credential inputs as connection secrets.
70
+ */
71
+ export type SelfTestAuthFlowInvoke = (args: {
72
+ route: SelfTestAuthFlowRoute;
73
+ requestId: string;
74
+ flowId: string;
75
+ /** Stable per-credential connection id — keeps login on the probe's affinity. */
76
+ connectionId?: string;
77
+ /** The probe connection's externalRef — flows reading ctx.externalRef see the same identity. */
78
+ externalRef?: string;
79
+ input?: Record<string, unknown>;
80
+ context?: Record<string, unknown>;
81
+ }) => Promise<{
82
+ status: number;
83
+ body: unknown;
84
+ }>;
85
+ /**
86
+ * Skip reason reported when a declared auth flow does not complete in a single
87
+ * continue (OTP, retry loop). Cross-repo contract: the health-monitor maps
88
+ * this exact string to `self_test_incapable`; never vary it.
89
+ */
90
+ export declare const SELF_TEST_AUTH_FLOW_MULTI_TURN_SKIP_REASON = "auth_flow_multi_turn";
91
+ /**
92
+ * A `retry` turn after credential submission: the flow REJECTED the
93
+ * configured inputs (bad password, exchange failure). Distinct from the
94
+ * multi-turn gap so monitoring surfaces it as a real credential outage, and
95
+ * memoized like multi-turn so the probe does not re-submit rejected
96
+ * credentials every cycle (lockout safety).
97
+ */
98
+ export declare const SELF_TEST_AUTH_FLOW_REJECTED_SKIP_REASON = "auth_flow_rejected";
64
99
  export interface SelfTestAppOptions {
65
100
  /** Derived-token verification secrets; without them every self-test route 404s. */
66
101
  secrets?: SelfTestMasterSecrets;
67
102
  /** In-process invoke bound to the tenant-facing app's /v1 pipeline. */
68
103
  invoke: SelfTestOperationInvoke;
104
+ /**
105
+ * In-process auth-flow driver bound to the tenant-facing app's /auth
106
+ * pipeline. Required for providers that declare `auth.mode: "credentials"`
107
+ * with a flow; without it their requiresConnection cases report a visible
108
+ * auth_flow_unavailable error instead of probing with raw inputs.
109
+ */
110
+ authFlow?: SelfTestAuthFlowInvoke;
69
111
  /** Overall request budget; defaults to env / 120s. */
70
112
  requestBudgetMs?: number;
71
113
  /** Env override for secret collection + budget resolution (tests). */
@@ -88,6 +130,65 @@ export declare function isSelfTestReadOnlyOperation(operation: OperationDefiniti
88
130
  export declare function createSelfTestInvoke(app: {
89
131
  request: (input: string, requestInit?: RequestInit) => Response | Promise<Response>;
90
132
  }): SelfTestOperationInvoke;
133
+ /** Binds the self-test auth-flow driver to a tenant app's /auth pipeline in-process. */
134
+ export declare function createSelfTestAuthFlowInvoke(app: {
135
+ request: (input: string, requestInit?: RequestInit) => Response | Promise<Response>;
136
+ }): SelfTestAuthFlowInvoke;
137
+ /**
138
+ * How long a memoized multi-turn flow outcome suppresses re-driving the auth
139
+ * flow. Generous on purpose: a multi-turn ceremony (OTP, device approval) is a
140
+ * provider property that changes on the timescale of releases, not probe
141
+ * cycles, and every re-drive is a REAL upstream login submission. The cache is
142
+ * in-process, so a pod restart also clears the entry.
143
+ */
144
+ export declare const SELF_TEST_MULTI_TURN_RETRY_AFTER_MS: number;
145
+ /**
146
+ * Age bound for POSITIVE cached credentials. Expiry modes that never produce
147
+ * a 401/403 (a 200 login page, an assertion failure) would otherwise replay
148
+ * the same stale session until pod restart — one re-login per day is the
149
+ * upstream-safe recovery for them.
150
+ */
151
+ export declare const SELF_TEST_CREDENTIAL_MAX_AGE_MS: number;
152
+ export type SelfTestCredentialSessionEntry =
153
+ /** Flow-materialized credential reused across probe cycles. */
154
+ {
155
+ kind: "credential";
156
+ credential: Record<string, string>;
157
+ cachedAtMs: number;
158
+ }
159
+ /**
160
+ * Negative entry: the flow did not complete in a single continue turn
161
+ * (`auth_flow_multi_turn`). Memoized so subsequent cycles report the skip
162
+ * WITHOUT contacting the upstream again — the first attempt already
163
+ * submitted real credentials (and may have triggered an OTP send).
164
+ */
165
+ | {
166
+ kind: "multi_turn";
167
+ cachedAtMs: number;
168
+ }
169
+ /**
170
+ * Negative entry: the flow REJECTED the submitted credential inputs
171
+ * (`retry` turn after continue — bad password, exchange failure).
172
+ * Memoized so the probe does not re-submit rejected credentials every
173
+ * cycle; a new entry is attempted when the inputs rotate (new hash),
174
+ * the TTL lapses, or the process restarts.
175
+ */
176
+ | {
177
+ kind: "rejected";
178
+ cachedAtMs: number;
179
+ };
180
+ /**
181
+ * In-process cache of per-(providerId + stable hash of credentialInputs) auth
182
+ * flow outcomes, so consecutive probe cycles reuse the session — or the
183
+ * memoized multi-turn skip — instead of logging in every cycle (upstream
184
+ * account safety, DR-7). Credential entries are invalidated on a probe auth
185
+ * failure, at most once; multi-turn entries expire after
186
+ * `SELF_TEST_MULTI_TURN_RETRY_AFTER_MS` or on process restart. Flow ERRORS
187
+ * (transport/protocol failures, thrown start/continue) are deliberately NEVER
188
+ * cached: they are typically transient, and retrying a failed request next
189
+ * cycle is not a repeated login submission.
190
+ */
191
+ export type SelfTestCredentialSessionCache = Map<string, SelfTestCredentialSessionEntry>;
91
192
  export declare function resolveSelfTestPort(env?: Readonly<Record<string, string | undefined>>): number;
92
193
  /**
93
194
  * Builds the internal self-test Hono app. This app is served on a SEPARATE