@oscharko-dev/keiko 1.1.6 → 1.1.7

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 (211) hide show
  1. package/dist/ui/csp-hashes.json +7 -7
  2. package/dist/ui/static/404.html +1 -1
  3. package/dist/ui/static/__next.__PAGE__.txt +10 -10
  4. package/dist/ui/static/__next._full.txt +12 -12
  5. package/dist/ui/static/__next._tree.txt +1 -1
  6. package/dist/ui/static/_next/static/chunks/{1gb6os129fico.js → 01rp_j2a-73pp.js} +1 -1
  7. package/dist/ui/static/_next/static/chunks/02i0eppipph7e.js +1 -0
  8. package/dist/ui/static/_next/static/chunks/0hc828_gdkyek.js +3 -0
  9. package/dist/ui/static/_next/static/chunks/0hq0i12hw0ypm.js +1 -0
  10. package/dist/ui/static/_next/static/chunks/{0ak5o5brryicl.js → 18grpx4tuavds.js} +1 -1
  11. package/dist/ui/static/_next/static/chunks/1be0-x1mk56wu.js +1 -0
  12. package/dist/ui/static/_next/static/chunks/{0bbv42deftomm.js → 1c1gbfapof8m0.js} +1 -1
  13. package/dist/ui/static/_next/static/chunks/{3d-10944zk2o9.js → 1lj5se4u-t-e9.js} +1 -1
  14. package/dist/ui/static/_next/static/chunks/{1th8j9weqwhgx.js → 1o2cihsnxhmh6.js} +1 -1
  15. package/dist/ui/static/_next/static/chunks/22x3pxeia7hk_.js +1 -0
  16. package/dist/ui/static/_next/static/chunks/{0e6em7dg4gr6q.js → 25lgzefdnbdh6.js} +1 -1
  17. package/dist/ui/static/_next/static/chunks/{182b4sf3i-krz.js → 29p86cxry0h-l.js} +1 -1
  18. package/dist/ui/static/_next/static/chunks/{28mbnwl9g65al.js → 2ctd04x-fzbwc.js} +1 -1
  19. package/dist/ui/static/_next/static/chunks/2jfg687n_mvf8.js +1 -0
  20. package/dist/ui/static/_next/static/chunks/{2t2wftn5liinr.js → 2mnldrncbucm0.js} +1 -1
  21. package/dist/ui/static/_next/static/chunks/{21t1klb1thn76.js → 306ima8lxo17-.js} +1 -1
  22. package/dist/ui/static/_next/static/chunks/{2dpxapmdvqlh1.js → 36-tv3y56oau8.js} +1 -1
  23. package/dist/ui/static/_next/static/chunks/{0ks_l2sa4nfn0.js → 3aizxizjzdddj.js} +1 -1
  24. package/dist/ui/static/_next/static/chunks/{3doin5vaz4zjs.js → 3fuqgie3p2068.js} +1 -1
  25. package/dist/ui/static/_next/static/chunks/3k6g7nzn589fs.js +1 -0
  26. package/dist/ui/static/_next/static/chunks/3r4fz572q3l7s.js +1 -0
  27. package/dist/ui/static/_next/static/chunks/{1lb8ju8qa0d9m.js → 40g2_9ovqiuiu.js} +1 -1
  28. package/dist/ui/static/_not-found/__next._full.txt +9 -9
  29. package/dist/ui/static/_not-found/__next._not-found.__PAGE__.txt +8 -8
  30. package/dist/ui/static/_not-found/__next._tree.txt +1 -1
  31. package/dist/ui/static/_not-found.html +1 -1
  32. package/dist/ui/static/_not-found.txt +9 -9
  33. package/dist/ui/static/atlassian-connectors/__next._full.txt +13 -13
  34. package/dist/ui/static/atlassian-connectors/__next._tree.txt +1 -1
  35. package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.__PAGE__.txt +10 -10
  36. package/dist/ui/static/atlassian-connectors.html +1 -1
  37. package/dist/ui/static/atlassian-connectors.txt +13 -13
  38. package/dist/ui/static/index.html +1 -1
  39. package/dist/ui/static/index.txt +12 -12
  40. package/dist/ui/static/launch/__next._full.txt +12 -12
  41. package/dist/ui/static/launch/__next._tree.txt +1 -1
  42. package/dist/ui/static/launch/__next.launch.__PAGE__.txt +10 -10
  43. package/dist/ui/static/launch.html +1 -1
  44. package/dist/ui/static/launch.txt +12 -12
  45. package/dist/ui/static/local-knowledge/__next._full.txt +12 -12
  46. package/dist/ui/static/local-knowledge/__next._tree.txt +1 -1
  47. package/dist/ui/static/local-knowledge/__next.local-knowledge.__PAGE__.txt +10 -10
  48. package/dist/ui/static/local-knowledge/capsule/__next._full.txt +13 -13
  49. package/dist/ui/static/local-knowledge/capsule/__next._tree.txt +1 -1
  50. package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.__PAGE__.txt +10 -10
  51. package/dist/ui/static/local-knowledge/capsule.html +1 -1
  52. package/dist/ui/static/local-knowledge/capsule.txt +13 -13
  53. package/dist/ui/static/local-knowledge.html +1 -1
  54. package/dist/ui/static/local-knowledge.txt +12 -12
  55. package/node_modules/@oscharko-dev/keiko-cli/package.json +14 -14
  56. package/node_modules/@oscharko-dev/keiko-connectors/dist/version.d.ts +1 -1
  57. package/node_modules/@oscharko-dev/keiko-connectors/dist/version.js +1 -1
  58. package/node_modules/@oscharko-dev/keiko-connectors/package.json +3 -3
  59. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.d.ts +43 -3
  60. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.d.ts.map +1 -1
  61. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.js +79 -2
  62. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.d.ts +645 -18
  63. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.d.ts.map +1 -1
  64. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.js +768 -16
  65. package/node_modules/@oscharko-dev/keiko-contracts/dist/bff-wire.d.ts +7 -2
  66. package/node_modules/@oscharko-dev/keiko-contracts/dist/bff-wire.d.ts.map +1 -1
  67. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench-runtime-api-validation.js +2 -1
  68. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench-runtime-constants.d.ts +1 -1
  69. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench-runtime-constants.d.ts.map +1 -1
  70. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench.d.ts +1 -1
  71. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench.d.ts.map +1 -1
  72. package/node_modules/@oscharko-dev/keiko-contracts/dist/context-engineering.d.ts +3 -0
  73. package/node_modules/@oscharko-dev/keiko-contracts/dist/context-engineering.d.ts.map +1 -1
  74. package/node_modules/@oscharko-dev/keiko-contracts/dist/context-engineering.js +20 -4
  75. package/node_modules/@oscharko-dev/keiko-contracts/dist/version.d.ts +2 -2
  76. package/node_modules/@oscharko-dev/keiko-contracts/dist/version.js +2 -2
  77. package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
  78. package/node_modules/@oscharko-dev/keiko-evaluations/package.json +9 -9
  79. package/node_modules/@oscharko-dev/keiko-evidence/dist/version.d.ts +1 -1
  80. package/node_modules/@oscharko-dev/keiko-evidence/dist/version.js +1 -1
  81. package/node_modules/@oscharko-dev/keiko-evidence/package.json +4 -4
  82. package/node_modules/@oscharko-dev/keiko-git/dist/version.d.ts +1 -1
  83. package/node_modules/@oscharko-dev/keiko-git/dist/version.js +1 -1
  84. package/node_modules/@oscharko-dev/keiko-git/package.json +1 -1
  85. package/node_modules/@oscharko-dev/keiko-harness/dist/version.d.ts +1 -1
  86. package/node_modules/@oscharko-dev/keiko-harness/dist/version.js +1 -1
  87. package/node_modules/@oscharko-dev/keiko-harness/package.json +7 -7
  88. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.d.ts +1 -1
  89. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.js +1 -1
  90. package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +5 -5
  91. package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.d.ts +1 -1
  92. package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.js +1 -1
  93. package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +3 -3
  94. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.d.ts +1 -1
  95. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.js +1 -1
  96. package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +3 -3
  97. package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.d.ts +1 -1
  98. package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.js +1 -1
  99. package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +3 -3
  100. package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.d.ts +1 -1
  101. package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.js +1 -1
  102. package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +3 -3
  103. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.d.ts +1 -1
  104. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.js +1 -1
  105. package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +3 -3
  106. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/config.d.ts.map +1 -1
  107. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/config.js +4 -1
  108. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.d.ts.map +1 -1
  109. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.js +127 -23
  110. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.d.ts.map +1 -1
  111. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.js +32 -1
  112. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.d.ts.map +1 -1
  113. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.js +12 -3
  114. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/realtime-voice-adapter.d.ts.map +1 -1
  115. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/realtime-voice-adapter.js +3 -1
  116. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/rerank-adapter.d.ts.map +1 -1
  117. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/rerank-adapter.js +4 -1
  118. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.d.ts +9 -1
  119. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.d.ts.map +1 -1
  120. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.js +87 -5
  121. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/speech-to-text-adapter.d.ts +1 -0
  122. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/speech-to-text-adapter.d.ts.map +1 -1
  123. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/speech-to-text-adapter.js +158 -10
  124. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/text-to-speech-adapter.d.ts.map +1 -1
  125. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/text-to-speech-adapter.js +176 -12
  126. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.d.ts +1 -1
  127. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.js +1 -1
  128. package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +4 -4
  129. package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +3 -3
  130. package/node_modules/@oscharko-dev/keiko-sandbox/package.json +2 -2
  131. package/node_modules/@oscharko-dev/keiko-sdk/package.json +9 -9
  132. package/node_modules/@oscharko-dev/keiko-security/dist/errors/gateway.d.ts +7 -1
  133. package/node_modules/@oscharko-dev/keiko-security/dist/errors/gateway.d.ts.map +1 -1
  134. package/node_modules/@oscharko-dev/keiko-security/dist/errors/gateway.js +21 -0
  135. package/node_modules/@oscharko-dev/keiko-security/dist/version.d.ts +1 -1
  136. package/node_modules/@oscharko-dev/keiko-security/dist/version.js +1 -1
  137. package/node_modules/@oscharko-dev/keiko-security/package.json +2 -2
  138. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-gateway.d.ts +6 -0
  139. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-gateway.d.ts.map +1 -1
  140. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-gateway.js +299 -104
  141. package/node_modules/@oscharko-dev/keiko-server/dist/deps.d.ts +15 -0
  142. package/node_modules/@oscharko-dev/keiko-server/dist/deps.d.ts.map +1 -1
  143. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts +5 -1
  144. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts.map +1 -1
  145. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.js +11 -0
  146. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-readiness.d.ts +24 -2
  147. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-readiness.d.ts.map +1 -1
  148. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-readiness.js +215 -38
  149. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-route-deadline.d.ts +6 -0
  150. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-route-deadline.d.ts.map +1 -0
  151. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-route-deadline.js +27 -0
  152. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts +33 -0
  153. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts.map +1 -1
  154. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.js +256 -25
  155. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-tool-calling-probe.d.ts +2 -1
  156. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-tool-calling-probe.d.ts.map +1 -1
  157. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-tool-calling-probe.js +11 -4
  158. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitRoutes.d.ts +2 -1
  159. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitRoutes.d.ts.map +1 -1
  160. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitRoutes.js +221 -38
  161. package/node_modules/@oscharko-dev/keiko-server/package.json +22 -22
  162. package/node_modules/@oscharko-dev/keiko-tool-catalog/package.json +3 -3
  163. package/node_modules/@oscharko-dev/keiko-tools/dist/version.d.ts +1 -1
  164. package/node_modules/@oscharko-dev/keiko-tools/dist/version.js +1 -1
  165. package/node_modules/@oscharko-dev/keiko-tools/package.json +7 -7
  166. package/node_modules/@oscharko-dev/keiko-verification/package.json +5 -5
  167. package/node_modules/@oscharko-dev/keiko-workflows/package.json +10 -10
  168. package/node_modules/@oscharko-dev/keiko-workspace/dist/version.d.ts +1 -1
  169. package/node_modules/@oscharko-dev/keiko-workspace/dist/version.js +1 -1
  170. package/node_modules/@oscharko-dev/keiko-workspace/package.json +3 -3
  171. package/package.json +26 -26
  172. package/release-impact.catalog.json +78 -23
  173. package/vendor/{oscharko-dev-keiko-cli-1.1.6.tgz → oscharko-dev-keiko-cli-1.1.7.tgz} +0 -0
  174. package/vendor/{oscharko-dev-keiko-connectors-1.1.6.tgz → oscharko-dev-keiko-connectors-1.1.7.tgz} +0 -0
  175. package/vendor/oscharko-dev-keiko-contracts-1.1.7.tgz +0 -0
  176. package/vendor/{oscharko-dev-keiko-evaluations-1.1.6.tgz → oscharko-dev-keiko-evaluations-1.1.7.tgz} +0 -0
  177. package/vendor/{oscharko-dev-keiko-evidence-1.1.6.tgz → oscharko-dev-keiko-evidence-1.1.7.tgz} +0 -0
  178. package/vendor/{oscharko-dev-keiko-git-1.1.6.tgz → oscharko-dev-keiko-git-1.1.7.tgz} +0 -0
  179. package/vendor/{oscharko-dev-keiko-harness-1.1.6.tgz → oscharko-dev-keiko-harness-1.1.7.tgz} +0 -0
  180. package/vendor/{oscharko-dev-keiko-local-knowledge-1.1.6.tgz → oscharko-dev-keiko-local-knowledge-1.1.7.tgz} +0 -0
  181. package/vendor/{oscharko-dev-keiko-memory-capture-1.1.6.tgz → oscharko-dev-keiko-memory-capture-1.1.7.tgz} +0 -0
  182. package/vendor/{oscharko-dev-keiko-memory-consolidation-1.1.6.tgz → oscharko-dev-keiko-memory-consolidation-1.1.7.tgz} +0 -0
  183. package/vendor/{oscharko-dev-keiko-memory-governance-1.1.6.tgz → oscharko-dev-keiko-memory-governance-1.1.7.tgz} +0 -0
  184. package/vendor/{oscharko-dev-keiko-memory-retrieval-1.1.6.tgz → oscharko-dev-keiko-memory-retrieval-1.1.7.tgz} +0 -0
  185. package/vendor/{oscharko-dev-keiko-memory-vault-1.1.6.tgz → oscharko-dev-keiko-memory-vault-1.1.7.tgz} +0 -0
  186. package/vendor/oscharko-dev-keiko-model-gateway-1.1.7.tgz +0 -0
  187. package/vendor/{oscharko-dev-keiko-quality-intelligence-1.1.6.tgz → oscharko-dev-keiko-quality-intelligence-1.1.7.tgz} +0 -0
  188. package/vendor/{oscharko-dev-keiko-sandbox-1.1.6.tgz → oscharko-dev-keiko-sandbox-1.1.7.tgz} +0 -0
  189. package/vendor/{oscharko-dev-keiko-sdk-1.1.6.tgz → oscharko-dev-keiko-sdk-1.1.7.tgz} +0 -0
  190. package/vendor/oscharko-dev-keiko-security-1.1.7.tgz +0 -0
  191. package/vendor/oscharko-dev-keiko-server-1.1.7.tgz +0 -0
  192. package/vendor/{oscharko-dev-keiko-tool-catalog-1.1.6.tgz → oscharko-dev-keiko-tool-catalog-1.1.7.tgz} +0 -0
  193. package/vendor/{oscharko-dev-keiko-tools-1.1.6.tgz → oscharko-dev-keiko-tools-1.1.7.tgz} +0 -0
  194. package/vendor/{oscharko-dev-keiko-verification-1.1.6.tgz → oscharko-dev-keiko-verification-1.1.7.tgz} +0 -0
  195. package/vendor/{oscharko-dev-keiko-workflows-1.1.6.tgz → oscharko-dev-keiko-workflows-1.1.7.tgz} +0 -0
  196. package/vendor/{oscharko-dev-keiko-workspace-1.1.6.tgz → oscharko-dev-keiko-workspace-1.1.7.tgz} +0 -0
  197. package/dist/ui/static/_next/static/chunks/0c3w2ubla6ek6.js +0 -1
  198. package/dist/ui/static/_next/static/chunks/0gnizm29lk3ll.js +0 -1
  199. package/dist/ui/static/_next/static/chunks/19fesd0w1gjhp.js +0 -3
  200. package/dist/ui/static/_next/static/chunks/1k6f6m-u2q69-.js +0 -1
  201. package/dist/ui/static/_next/static/chunks/1pze64zkvx8vt.js +0 -1
  202. package/dist/ui/static/_next/static/chunks/2h_zvmb272ozs.js +0 -1
  203. package/dist/ui/static/_next/static/chunks/3-5_wuwrev-8c.js +0 -1
  204. package/dist/ui/static/_next/static/chunks/3-l-8qt163_y6.js +0 -1
  205. package/vendor/oscharko-dev-keiko-contracts-1.1.6.tgz +0 -0
  206. package/vendor/oscharko-dev-keiko-model-gateway-1.1.6.tgz +0 -0
  207. package/vendor/oscharko-dev-keiko-security-1.1.6.tgz +0 -0
  208. package/vendor/oscharko-dev-keiko-server-1.1.6.tgz +0 -0
  209. /package/dist/ui/static/_next/static/{ytpWXc-OicMB-rH2zX5b3 → nXnJJ05BP_rtUCiZsedfT}/_buildManifest.js +0 -0
  210. /package/dist/ui/static/_next/static/{ytpWXc-OicMB-rH2zX5b3 → nXnJJ05BP_rtUCiZsedfT}/_clientMiddlewareManifest.js +0 -0
  211. /package/dist/ui/static/_next/static/{ytpWXc-OicMB-rH2zX5b3 → nXnJJ05BP_rtUCiZsedfT}/_ssgManifest.js +0 -0
@@ -1,4 +1,6 @@
1
+ import { TimeoutError, TransportError } from "@oscharko-dev/keiko-security/errors/gateway";
1
2
  import { isConversationEligibleModel, listConfiguredCapabilities, requestGatewayReadinessChatCompletion, requestOpenAIEmbedding, toolCallingConfigurationFingerprint, vectorL2Norm, } from "@oscharko-dev/keiko-model-gateway";
3
+ import { GATEWAY_RETRIEVAL_TIMEOUT_FLOOR_MS } from "@oscharko-dev/keiko-model-gateway/internal/resilience";
2
4
  import { readJsonCapped, readSseStream } from "@oscharko-dev/keiko-model-gateway/internal/http";
3
5
  import { activityLogEvent, defineActivityLogOperation, } from "@oscharko-dev/keiko-contracts/runtime/observability";
4
6
  import { gatewayVerificationFromProbeOutcome } from "@oscharko-dev/keiko-contracts/runtime/gateway-verification";
@@ -10,7 +12,7 @@ import { newCorrelationId } from "./correlation.js";
10
12
  import { emitServerDiagnostic, serverDiagnosticFromError } from "./diagnostics-log.js";
11
13
  import { rerankSelection } from "./grounded-rerank-facade.js";
12
14
  import { readBoundedRequestBody, RequestBodyTooLargeError } from "./bounded-request-body.js";
13
- import { admittedGatewayProbeOutputLimit, probeGatewayToolCalling, probeUsage, reserveGatewayProbeSpend, settleGatewayProbeSpend, } from "./gateway-tool-calling-probe.js";
15
+ import { admittedGatewayProbeOutputLimit, probeGatewayToolCalling, probeUsage, reserveGatewayProbeSpend, settleGatewayProbeSpend, transientGatewayStatus, } from "./gateway-tool-calling-probe.js";
14
16
  import { reconcileGatewayContextWindowReadiness, reconcileGatewayToolCallingReadiness, } from "./gateway-setup.js";
15
17
  import { processServerLogSink } from "./process-log-sink.js";
16
18
  // #3557 review finding A: the one owning projection from a candidate model id to Activity Log
@@ -55,6 +57,18 @@ const MINI_PDF_DATA_URL = "data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8P
55
57
  const GATEWAY_READINESS_MODEL_ID_FIELDS = {
56
58
  modelIdDigest: { type: "string", dataClass: "digest", required: false, maxLength: 16 },
57
59
  };
60
+ // #3591 (1.1.7): the bound each probe of a run actually ran under, so an operator can tell from
61
+ // the start line which deadline governed a probe that timed out or took minutes. The probes
62
+ // against the selected chat provider share one bound, which a floor may raise above the
63
+ // configured timeout (`probeProvider`); the long-context probe carries its own, higher floor; the
64
+ // embedding and reranker probes run against their own providers under the retrieval floor. Each
65
+ // field is present only when its probe is part of the run and its provider is configured.
66
+ const GATEWAY_READINESS_PROBE_TIMEOUT_FIELDS = {
67
+ chatProbeTimeoutMs: { type: "integer", dataClass: "duration", required: false },
68
+ longContextProbeTimeoutMs: { type: "integer", dataClass: "duration", required: false },
69
+ embeddingProbeTimeoutMs: { type: "integer", dataClass: "duration", required: false },
70
+ rerankerProbeTimeoutMs: { type: "integer", dataClass: "duration", required: false },
71
+ };
58
72
  const GATEWAY_READINESS_AUTOMATIC_STARTED_OPERATION = defineActivityLogOperation({
59
73
  contractKind: "activity-log-operation",
60
74
  schemaVersion: 1,
@@ -64,6 +78,7 @@ const GATEWAY_READINESS_AUTOMATIC_STARTED_OPERATION = defineActivityLogOperation
64
78
  emitter: "gateway-readiness.logAutomaticReadinessStarted",
65
79
  fields: {
66
80
  ...GATEWAY_READINESS_MODEL_ID_FIELDS,
81
+ ...GATEWAY_READINESS_PROBE_TIMEOUT_FIELDS,
67
82
  probeCount: { type: "integer", dataClass: "count", required: true },
68
83
  },
69
84
  causal: "correlation",
@@ -92,6 +107,9 @@ const GATEWAY_READINESS_AUTOMATIC_COMPLETED_OPERATION = defineActivityLogOperati
92
107
  // Tokens the long-context probe proved. Present only when that probe ran and passed; a stored
93
108
  // context window below it is raised to it by the same run, so the raise is reconstructable.
94
109
  verifiedContextTokens: { type: "integer", dataClass: "count", required: false },
110
+ // #3591: probes that ended without a verdict (timed out, unreachable, or a transient gateway
111
+ // status). They decide the short re-probe cooldown, so the decision is reconstructable.
112
+ inconclusiveProbeCount: { type: "integer", dataClass: "count", required: false },
95
113
  },
96
114
  causal: "correlation",
97
115
  lifecycle: "end",
@@ -119,6 +137,7 @@ const GATEWAY_READINESS_STARTED_OPERATION = defineActivityLogOperation({
119
137
  required: true,
120
138
  values: ["settings"],
121
139
  },
140
+ ...GATEWAY_READINESS_PROBE_TIMEOUT_FIELDS,
122
141
  probeCount: { type: "integer", dataClass: "count", required: true },
123
142
  },
124
143
  causal: "correlation",
@@ -150,6 +169,7 @@ const GATEWAY_READINESS_COMPLETED_OPERATION = defineActivityLogOperation({
150
169
  values: ["ready", "partial", "failed"],
151
170
  },
152
171
  probeCount: { type: "integer", dataClass: "count", required: true },
172
+ inconclusiveProbeCount: { type: "integer", dataClass: "count", required: false },
153
173
  },
154
174
  causal: "correlation",
155
175
  lifecycle: "end",
@@ -292,11 +312,33 @@ function selectReadinessModelId(capabilities, requestedModelId, options, fallbac
292
312
  }
293
313
  return candidate.id;
294
314
  }
295
- function logAutomaticReadinessStarted(deps, correlationId, modelId, probeCount) {
296
- (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_AUTOMATIC_STARTED_OPERATION, { correlationId }, { ...modelIdEvidence(modelId), probeCount }));
315
+ function logAutomaticReadinessStarted(deps, correlationId, modelId, probeCount, timeouts) {
316
+ (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_AUTOMATIC_STARTED_OPERATION, { correlationId }, { ...modelIdEvidence(modelId), ...timeouts, probeCount }));
317
+ }
318
+ // The bounds the run's probes are about to run under: `probeProvider` for the chat-provider
319
+ // probes, and the retrieval floor the embedding and rerank adapters apply to the configured
320
+ // timeout of their own providers (`openai-embedding-adapter.ts`, `rerank-adapter.ts`).
321
+ export function probeTimeoutEvidence(config, provider, names, options) {
322
+ const evidence = {
323
+ chatProbeTimeoutMs: probeProvider(provider, "chat", options).timeoutMs,
324
+ };
325
+ if (names.includes("long_context")) {
326
+ evidence.longContextProbeTimeoutMs = probeProvider(provider, "long_context", options).timeoutMs;
327
+ }
328
+ const embedding = names.includes("embedding") ? chooseEmbeddingProvider(config) : undefined;
329
+ if (embedding !== undefined) {
330
+ evidence.embeddingProbeTimeoutMs = Math.max(embedding.timeoutMs, GATEWAY_RETRIEVAL_TIMEOUT_FLOOR_MS);
331
+ }
332
+ if (names.includes("reranker") && config.reranker !== undefined) {
333
+ evidence.rerankerProbeTimeoutMs = Math.max(config.reranker.timeoutMs, GATEWAY_RETRIEVAL_TIMEOUT_FLOOR_MS);
334
+ }
335
+ return evidence;
297
336
  }
298
337
  function logAutomaticReadinessCompleted(deps, correlationId, report) {
299
- logAutomaticReadinessOutcome(deps, correlationId, report.modelId, report.overallStatus, report.probes.length, report.verifiedCapabilities.testedContextTokens);
338
+ logAutomaticReadinessOutcome(deps, correlationId, report.modelId, report.overallStatus, report.probes.length, inconclusiveProbeCount(report), report.verifiedCapabilities.testedContextTokens);
339
+ }
340
+ function inconclusiveProbeCount(report) {
341
+ return report.probes.filter(probeInconclusive).length;
300
342
  }
301
343
  function logAutomaticReadinessJoined(deps, modelId, correlationId, probeCorrelationId, generation) {
302
344
  (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_AUTOMATIC_JOINED_OPERATION, {
@@ -311,16 +353,17 @@ function logAutomaticReadinessJoined(deps, modelId, correlationId, probeCorrelat
311
353
  loss: "none",
312
354
  }));
313
355
  }
314
- function logAutomaticReadinessOutcome(deps, correlationId, modelId, overallStatus, probeCount, verifiedContextTokens) {
356
+ function logAutomaticReadinessOutcome(deps, correlationId, modelId, overallStatus, probeCount, inconclusiveProbes, verifiedContextTokens) {
315
357
  (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_AUTOMATIC_COMPLETED_OPERATION, { correlationId }, {
316
358
  ...modelIdEvidence(modelId),
317
359
  overallStatus,
318
360
  probeCount,
361
+ inconclusiveProbeCount: inconclusiveProbes,
319
362
  ...(verifiedContextTokens === undefined ? {} : { verifiedContextTokens }),
320
363
  }));
321
364
  }
322
- function logReadinessStarted(deps, correlationId, trigger, modelId, probeCount) {
323
- (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_STARTED_OPERATION, { correlationId }, { ...modelIdEvidence(modelId), trigger, probeCount }));
365
+ function logReadinessStarted(deps, correlationId, trigger, modelId, probeCount, timeouts) {
366
+ (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_STARTED_OPERATION, { correlationId }, { ...modelIdEvidence(modelId), ...timeouts, trigger, probeCount }));
324
367
  }
325
368
  function logReadinessCompleted(deps, correlationId, trigger, report, durationMs) {
326
369
  (deps.activityLog ?? processServerLogSink()).write(activityLogEvent(GATEWAY_READINESS_COMPLETED_OPERATION, { correlationId, durationMs }, {
@@ -328,19 +371,29 @@ function logReadinessCompleted(deps, correlationId, trigger, report, durationMs)
328
371
  trigger,
329
372
  overallStatus: report.overallStatus,
330
373
  probeCount: report.probes.length,
374
+ inconclusiveProbeCount: inconclusiveProbeCount(report),
331
375
  }));
332
376
  }
333
377
  // One run's start line: the Coding Workbench's automatic run keeps its own operation, and a run
334
378
  // without a trigger is recorded by its caller (the on-demand probe logs the automatic operations
335
379
  // around it, so nothing here may log it twice).
336
- function logReadinessRunStarted(deps, run, modelId, probeCount) {
380
+ function logReadinessRunStarted(deps, run, selection, names, options) {
381
+ const modelId = selection.provider.modelId;
382
+ const timeouts = probeTimeoutEvidence(selection.config, selection.provider, names, options);
337
383
  if (run.automatic) {
338
- logAutomaticReadinessStarted(deps, run.correlationId, modelId, probeCount);
384
+ logAutomaticReadinessStarted(deps, run.correlationId, modelId, names.length, timeouts);
339
385
  return;
340
386
  }
341
387
  if (run.trigger === undefined)
342
388
  return;
343
- logReadinessStarted(deps, run.correlationId, run.trigger, modelId, probeCount);
389
+ logReadinessStarted(deps, run.correlationId, run.trigger, modelId, names.length, timeouts);
390
+ }
391
+ // The on-demand probe (one chat probe on the configured timeout) records its own start line.
392
+ function logOnDemandProbeStarted(deps, holder, modelId, correlationId) {
393
+ const selection = chooseProvider(holder.current(), modelId, ON_DEMAND_PROBE_OPTIONS);
394
+ logAutomaticReadinessStarted(deps, correlationId, modelId, 1, "status" in selection
395
+ ? {}
396
+ : probeTimeoutEvidence(selection.config, selection.provider, ["chat"], ON_DEMAND_PROBE_OPTIONS));
344
397
  }
345
398
  function logReadinessRunCompleted(deps, run, report) {
346
399
  if (run.automatic) {
@@ -502,11 +555,50 @@ function rejectedCapabilityResult(name, status, start, evidence, warning) {
502
555
  function skipped(name, evidence) {
503
556
  return { name, status: "skipped", latencyMs: 0, evidence };
504
557
  }
505
- function providerWarning(errorValue) {
506
- if (errorValue instanceof DOMException && errorValue.name === "TimeoutError") {
507
- return "The probe timed out before the provider answered.";
558
+ // #3591 (1.1.7): a probe the gateway never answered (timed out, aborted, unreachable) is
559
+ // INCONCLUSIVE — it proves nothing about the model and must not be held against it the way an
560
+ // answered failure is. The two sentences are this module's own closed vocabulary; the Workbench
561
+ // re-probe policy reads them back through `probeInconclusive`.
562
+ const PROBE_TIMED_OUT_WARNING = "The probe timed out before the provider answered.";
563
+ const PROBE_UNREACHABLE_WARNING = "The provider could not be reached for this probe.";
564
+ // A gateway at peak load answers 429/503 for a while; that is no verdict on the model either
565
+ // (#3591 review). 408 and every other 5xx but 501 (not implemented) count the same way.
566
+ export const PROBE_GATEWAY_BUSY_WARNING = "The gateway answered with a transient overload or timeout status.";
567
+ const INCONCLUSIVE_PROBE_WARNINGS = new Set([
568
+ PROBE_TIMED_OUT_WARNING,
569
+ PROBE_UNREACHABLE_WARNING,
570
+ PROBE_GATEWAY_BUSY_WARNING,
571
+ ]);
572
+ function transientStatusWarning(response) {
573
+ return transientGatewayStatus(response.status) ? PROBE_GATEWAY_BUSY_WARNING : undefined;
574
+ }
575
+ function inconclusiveProbeError(errorValue) {
576
+ if (errorValue instanceof TimeoutError)
577
+ return PROBE_TIMED_OUT_WARNING;
578
+ if (errorValue instanceof DOMException) {
579
+ if (errorValue.name === "TimeoutError")
580
+ return PROBE_TIMED_OUT_WARNING;
581
+ if (errorValue.name === "AbortError")
582
+ return PROBE_UNREACHABLE_WARNING;
508
583
  }
509
- return "The provider could not complete this probe. Chat configuration was not changed.";
584
+ if (errorValue instanceof TransportError || isFetchNetworkFailure(errorValue)) {
585
+ return PROBE_UNREACHABLE_WARNING;
586
+ }
587
+ return undefined;
588
+ }
589
+ // Node's fetch reports a connection-level failure as `TypeError: fetch failed`; any other
590
+ // TypeError is a programming fault and must keep the ordinary (long) cooldown (#3591 review).
591
+ function isFetchNetworkFailure(errorValue) {
592
+ return errorValue instanceof TypeError && errorValue.message === "fetch failed";
593
+ }
594
+ export function probeInconclusive(probe) {
595
+ return (probe.status === "failed" &&
596
+ probe.warning !== undefined &&
597
+ INCONCLUSIVE_PROBE_WARNINGS.has(probe.warning));
598
+ }
599
+ function providerWarning(errorValue) {
600
+ return (inconclusiveProbeError(errorValue) ??
601
+ "The provider could not complete this probe. Chat configuration was not changed.");
510
602
  }
511
603
  // Every probe's `catch` used to collapse an actionable cause — an auth rejection, a DNS/TLS failure,
512
604
  // a missing model — into the same two operator-facing sentences, and nothing anywhere else recorded
@@ -599,7 +691,7 @@ async function probeChat(deps, config, provider, correlationId) {
599
691
  ],
600
692
  });
601
693
  if (!response.ok) {
602
- return result("chat", "failed", start, unsuccessfulEvidence("Basic chat", response));
694
+ return result("chat", "failed", start, unsuccessfulEvidence("Basic chat", response), transientStatusWarning(response));
603
695
  }
604
696
  // Mirror the production floor exactly (openai-adapter assertUsableAssistantResponse +
605
697
  // normalize textFromContent): the extracted assistant text must be non-empty, and
@@ -654,6 +746,9 @@ async function probeToolCalling(deps, config, provider, correlationId) {
654
746
  if (status === "verified") {
655
747
  return result("tool_calling", "passed", start, "OpenAI-compatible tool call returned the expected function name.");
656
748
  }
749
+ if (status === "transient") {
750
+ return result("tool_calling", "failed", start, "Tool calling could not be verified: the gateway answered with a transient status.", PROBE_GATEWAY_BUSY_WARNING);
751
+ }
657
752
  return toolCallingResult(status === "unsupported" ? "unsupported" : "failed", start, provider);
658
753
  }
659
754
  function toolCallingResult(status, start, provider) {
@@ -857,7 +952,7 @@ async function probeLongContext(deps, config, provider, capability, options, cor
857
952
  const response = await providerRequest(deps, config, provider, correlationId, body);
858
953
  if (!response.ok) {
859
954
  const status = unsupportedStatus(response) ? "unsupported" : "failed";
860
- return result("long_context", status, start, `${tokens.toString()} approximate tokens were not accepted.`);
955
+ return result("long_context", status, start, `${tokens.toString()} approximate tokens were not accepted.`, transientStatusWarning(response));
861
956
  }
862
957
  return longContextPayloadResult(start, tokens, sentinel, await readProviderJson(response));
863
958
  }
@@ -865,8 +960,33 @@ async function probeLongContext(deps, config, provider, capability, options, cor
865
960
  return probeFailure(deps, correlationId, "long_context", start, "Long-context input could not be verified.", probeError);
866
961
  }
867
962
  }
963
+ // #3591 (1.1.7): the long-context probe carries 21k–32k prompt tokens and the Workbench's
964
+ // automatic probes run while an operator waits; at peak load the field customer's gateway needs
965
+ // minutes for that prefill. The setup default of 30 s is a guess for a chat turn, not a probe
966
+ // budget, and a probe that abandons a slow gateway proves nothing and used to lock the Workbench
967
+ // out for six hours. The floors below are lower bounds on the configured provider timeout.
968
+ export const LONG_CONTEXT_PROBE_TIMEOUT_FLOOR_MS = 300_000;
969
+ export const WORKBENCH_PROBE_TIMEOUT_FLOOR_MS = 120_000;
970
+ function probeTimeoutFloorMs(name, options) {
971
+ if (name === "long_context")
972
+ return LONG_CONTEXT_PROBE_TIMEOUT_FLOOR_MS;
973
+ if (options?.purpose === "coding-workbench-auto" || options?.purpose === "on-demand") {
974
+ return WORKBENCH_PROBE_TIMEOUT_FLOOR_MS;
975
+ }
976
+ return 0;
977
+ }
978
+ export function probeProvider(provider, name, options) {
979
+ const floor = probeTimeoutFloorMs(name, options);
980
+ return provider.timeoutMs >= floor ? provider : { ...provider, timeoutMs: floor };
981
+ }
982
+ // The on-demand chat probe gates chat create/send for a model without a current observation. It
983
+ // runs with the same floor as the automatic Workbench probes: a probe that gives up on a slow
984
+ // gateway before it answers proves nothing and would refuse every chat until its cooldown ends
985
+ // (#3591 review). An operator-started settings check keeps the configured timeout.
986
+ const ON_DEMAND_PROBE_OPTIONS = { probes: [], purpose: "on-demand" };
868
987
  async function runProbe(name, deps, selection, options, correlationId) {
869
- const { config, provider } = selection;
988
+ const { config } = selection;
989
+ const provider = probeProvider(selection.provider, name, options);
870
990
  if (name === "chat")
871
991
  return probeChat(deps, config, provider, correlationId);
872
992
  if (name === "streaming")
@@ -1056,7 +1176,7 @@ trigger) {
1056
1176
  trigger,
1057
1177
  startedAtMs: Date.now(),
1058
1178
  };
1059
- logReadinessRunStarted(deps, run, selection.provider.modelId, names.length);
1179
+ logReadinessRunStarted(deps, run, selection, names, request.options);
1060
1180
  const probes = [];
1061
1181
  const chat = await runProbe("chat", deps, selection, request.options, correlationId);
1062
1182
  probes.push(chat);
@@ -1119,6 +1239,10 @@ function reconcileContextWindowReadiness(deps, report, correlationId) {
1119
1239
  // that really is short-context, or a gateway that is down, is not probed on every read — and a
1120
1240
  // model that never claimed tool calling is never probed from here at all.
1121
1241
  const WORKBENCH_REPROBE_COOLDOWN_MS = 6 * 60 * 60 * 1_000;
1242
+ // #3591 (1.1.7): a probe the gateway never answered is not a verdict. It used to hold the six-hour
1243
+ // cooldown, so one slow answer at peak load locked the Workbench out with no operator remedy but
1244
+ // a restart. An inconclusive run is retried on the next Workbench read after this much quiet.
1245
+ export const WORKBENCH_INCONCLUSIVE_REPROBE_COOLDOWN_MS = 60_000;
1122
1246
  const workbenchProbes = new Map();
1123
1247
  // ONE run at a time. Persisting a conclusion bumps the configuration generation, and a readiness
1124
1248
  // run that started under the previous generation has its conclusion discarded as stale: probing
@@ -1150,9 +1274,39 @@ function workbenchProbeTargets(config) {
1150
1274
  }
1151
1275
  // Keyed by the deployment's identity, not the configuration generation: every conclusion this
1152
1276
  // persists bumps the generation, which would otherwise lift the cooldown of every other model.
1277
+ // The configured timeout is part of the key (#3591): an operator who raises it after a timed-out
1278
+ // probe has changed what the probe can prove and gets a fresh attempt at once.
1153
1279
  function workbenchProbeKey(config, modelId) {
1154
1280
  const provider = config.providers.find((candidate) => candidate.modelId === modelId);
1155
- return provider === undefined ? modelId : toolCallingConfigurationFingerprint(provider);
1281
+ return provider === undefined
1282
+ ? modelId
1283
+ : `${toolCallingConfigurationFingerprint(provider)}:${String(provider.timeoutMs)}`;
1284
+ }
1285
+ /**
1286
+ * Whether the Workbench's automatic verification of this model is still open: the probe is
1287
+ * running, or it ended without a verdict (the gateway never answered) and runs again after its
1288
+ * short cooldown. Only a verdict — proven or refuted — closes it, so a Workbench that re-reads its
1289
+ * profile while this holds keeps reading until the gateway has actually answered.
1290
+ */
1291
+ export function isCodingWorkbenchProbePending(config, modelId) {
1292
+ const entry = workbenchProbes.get(workbenchProbeKey(config, modelId));
1293
+ return entry !== undefined && (!entry.settled || entry.outcome === "inconclusive");
1294
+ }
1295
+ /** Whether any model the Workbench could still elect has its verification open. */
1296
+ export function isAnyCodingWorkbenchProbePending(config) {
1297
+ return workbenchProbeTargets(config).some((target) => isCodingWorkbenchProbePending(config, target.modelId));
1298
+ }
1299
+ function workbenchProbeOutcome(report, target) {
1300
+ if ("status" in report)
1301
+ return "inconclusive";
1302
+ const results = target.probes.map((name) => report.probes.find((probe) => probe.name === name));
1303
+ if (results.every((probe) => probe?.status === "passed"))
1304
+ return "proven";
1305
+ // The gating chat probe runs first and a target probe is skipped when it fails: a gateway that
1306
+ // never answered the chat probe has not refuted anything either.
1307
+ if (report.probes.some(probeInconclusive))
1308
+ return "inconclusive";
1309
+ return results.includes(undefined) ? "inconclusive" : "refuted";
1156
1310
  }
1157
1311
  async function runWorkbenchProbe(deps, target, key, correlationId) {
1158
1312
  try {
@@ -1160,16 +1314,16 @@ async function runWorkbenchProbe(deps, target, key, correlationId) {
1160
1314
  modelId: target.modelId,
1161
1315
  options: { probes: target.probes, purpose: "coding-workbench-auto" },
1162
1316
  }, deps, correlationId);
1163
- const proven = !("status" in report) &&
1164
- target.probes.every((name) => report.probes.some((probe) => probe.name === name && probe.status === "passed"));
1317
+ const outcome = workbenchProbeOutcome(report, target);
1165
1318
  const config = deps.gatewayConfig?.current();
1166
1319
  const stillNeeded = config !== undefined &&
1167
1320
  workbenchProbeTargets(config).some((pending) => pending.modelId === target.modelId);
1168
1321
  // Proven, yet not stored: the configuration changed under the run and the conclusion was
1169
1322
  // discarded as stale. Lift the cooldown so the next read proves it again instead of leaving
1170
1323
  // the model unusable for hours.
1171
- if (proven && stillNeeded)
1324
+ if (outcome === "proven" && stillNeeded)
1172
1325
  workbenchProbes.delete(key);
1326
+ return outcome;
1173
1327
  }
1174
1328
  catch (error) {
1175
1329
  emitServerDiagnostic(deps.diagnostics, serverDiagnosticFromError({
@@ -1180,18 +1334,33 @@ async function runWorkbenchProbe(deps, target, key, correlationId) {
1180
1334
  summary: "A gateway readiness probe could not be completed.",
1181
1335
  redact: (message) => String(deps.redactor(message)),
1182
1336
  }));
1337
+ return "inconclusive";
1183
1338
  }
1184
1339
  }
1185
1340
  function enqueueWorkbenchProbe(deps, config, target, correlationId) {
1186
1341
  const key = workbenchProbeKey(config, target.modelId);
1187
1342
  const known = workbenchProbes.get(key);
1188
- if (known !== undefined && Date.now() - known.at < WORKBENCH_REPROBE_COOLDOWN_MS) {
1343
+ if (known !== undefined && Date.now() - known.at < known.cooldownMs) {
1189
1344
  return known.promise;
1190
1345
  }
1191
- const promise = workbenchProbeQueue.then(() => runWorkbenchProbe(deps, target, key, correlationId));
1192
- workbenchProbeQueue = promise;
1193
- workbenchProbes.set(key, { promise, at: Date.now() });
1194
- return promise;
1346
+ const entry = {
1347
+ promise: workbenchProbeQueue.then(async () => {
1348
+ const outcome = await runWorkbenchProbe(deps, target, key, correlationId);
1349
+ entry.settled = true;
1350
+ entry.outcome = outcome;
1351
+ entry.at = Date.now();
1352
+ entry.cooldownMs =
1353
+ outcome === "inconclusive"
1354
+ ? WORKBENCH_INCONCLUSIVE_REPROBE_COOLDOWN_MS
1355
+ : WORKBENCH_REPROBE_COOLDOWN_MS;
1356
+ }),
1357
+ at: Date.now(),
1358
+ cooldownMs: WORKBENCH_REPROBE_COOLDOWN_MS,
1359
+ settled: false,
1360
+ };
1361
+ workbenchProbeQueue = entry.promise;
1362
+ workbenchProbes.set(key, entry);
1363
+ return entry.promise;
1195
1364
  }
1196
1365
  export async function ensureCodingWorkbenchContextWindows(deps, electedModelId, correlationId) {
1197
1366
  const config = deps.gatewayConfig?.current();
@@ -1260,19 +1429,21 @@ export async function ensureOnDemandConversationReadiness(deps, modelId, correla
1260
1429
  onDemandReadinessProbes.set(key, { promise: probe, correlationId: probeCorrelationId });
1261
1430
  await probe;
1262
1431
  }
1263
- async function runOnDemandReadinessProbe(deps, holder, modelId, correlationId) {
1264
- const generation = holder.generation();
1265
- const probeCorrelationId = correlationId ?? newCorrelationId();
1266
- let overallStatus = "failed";
1267
- logAutomaticReadinessStarted(deps, probeCorrelationId, modelId, 1);
1432
+ // Runs the one chat probe and records its completed line whatever happens: a failure lands as a
1433
+ // redacted operator diagnostic with the correlation id, never silently, and the route still
1434
+ // answers with the honest unready result.
1435
+ async function observeOnDemandProbe(deps, modelId, probeCorrelationId) {
1436
+ let outcome = { overallStatus: "failed", inconclusiveProbes: 0 };
1268
1437
  try {
1269
- const report = await runGatewayReadiness({ modelId, options: { probes: [] } }, deps, probeCorrelationId);
1270
- if (!("status" in report))
1271
- overallStatus = report.overallStatus;
1438
+ const report = await runGatewayReadiness({ modelId, options: ON_DEMAND_PROBE_OPTIONS }, deps, probeCorrelationId);
1439
+ if (!("status" in report)) {
1440
+ outcome = {
1441
+ overallStatus: report.overallStatus,
1442
+ inconclusiveProbes: inconclusiveProbeCount(report),
1443
+ };
1444
+ }
1272
1445
  }
1273
1446
  catch (error) {
1274
- // The route still answers with the honest unready result — but never silently: the
1275
- // underlying failure lands as a redacted operator diagnostic with a correlation id.
1276
1447
  emitServerDiagnostic(deps.diagnostics, serverDiagnosticFromError({
1277
1448
  correlationId: probeCorrelationId,
1278
1449
  operation: "gateway.readiness",
@@ -1283,8 +1454,14 @@ async function runOnDemandReadinessProbe(deps, holder, modelId, correlationId) {
1283
1454
  }));
1284
1455
  }
1285
1456
  finally {
1286
- logAutomaticReadinessOutcome(deps, probeCorrelationId, modelId, overallStatus, 1);
1457
+ logAutomaticReadinessOutcome(deps, probeCorrelationId, modelId, outcome.overallStatus, 1, outcome.inconclusiveProbes);
1287
1458
  }
1459
+ }
1460
+ async function runOnDemandReadinessProbe(deps, holder, modelId, correlationId) {
1461
+ const generation = holder.generation();
1462
+ const probeCorrelationId = correlationId ?? newCorrelationId();
1463
+ logOnDemandProbeStarted(deps, holder, modelId, probeCorrelationId);
1464
+ await observeOnDemandProbe(deps, modelId, probeCorrelationId);
1288
1465
  // A failed report CLEARS the capability entry; without a current-generation observation
1289
1466
  // every subsequent chat attempt would probe the provider again. Persist an explicit
1290
1467
  // not-ready so retries hit the guard instead of the wire (the settings probe replaces it).
@@ -0,0 +1,6 @@
1
+ import type { GatewayConfig } from "@oscharko-dev/keiko-model-gateway";
2
+ export declare const GATEWAY_ROUTE_DEADLINE_GRACE_MS = 1000;
3
+ export declare const UNCONFIGURED_MODEL_ROUTE_DEADLINE_MS = 30000;
4
+ export type GatewayCallShape = "buffered" | "streamed";
5
+ export declare function gatewayRouteDeadlineMs(config: GatewayConfig, modelId: string, shapes: readonly [GatewayCallShape, ...GatewayCallShape[]]): number;
6
+ //# sourceMappingURL=gateway-route-deadline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway-route-deadline.d.ts","sourceRoot":"","sources":["../src/gateway-route-deadline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAevE,eAAO,MAAM,+BAA+B,OAAQ,CAAC;AAGrD,eAAO,MAAM,oCAAoC,QAAS,CAAC;AAO3D,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAC;AAQvD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,CAAC,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC,GACzD,MAAM,CAaR"}
@@ -0,0 +1,27 @@
1
+ import { codingWorkbenchProviderTimeoutMs, providerRequestBudgetMs, streamRequestBudgetMs, } from "@oscharko-dev/keiko-model-gateway/internal/resilience";
2
+ import { MAX_TIMER_DELAY_MS } from "./abort-race.js";
3
+ // A route's deadline around a gateway call is a backstop BEHIND the gateway's own end-to-end
4
+ // budget, never the budget itself. Armed before the gateway starts its clock, a shorter deadline
5
+ // aborts the retry the gateway has just scheduled, so a provider timeout surfaces as a cancellation
6
+ // nobody asked for (coding run 23, 2026-09-11 on the Coding Workbench route; the commit draft's
7
+ // fixed 300 s backstop under the 600 s buffered attempt, PR #3602 review). The grace lets the
8
+ // gateway settle its own timeout or exhausted-retry error first. One derivation for every route
9
+ // that awaits a coding-workbench-profiled gateway call.
10
+ export const GATEWAY_ROUTE_DEADLINE_GRACE_MS = 1_000;
11
+ // An unconfigured model is refused before any provider call; this only bounds that refusal.
12
+ export const UNCONFIGURED_MODEL_ROUTE_DEADLINE_MS = 30_000;
13
+ function gatewayCallBudgetMs(provider, shape) {
14
+ return shape === "streamed" ? streamRequestBudgetMs(provider) : providerRequestBudgetMs(provider);
15
+ }
16
+ export function gatewayRouteDeadlineMs(config, modelId, shapes) {
17
+ const provider = config.providers.find((candidate) => candidate.modelId === modelId);
18
+ const raised = provider === undefined
19
+ ? undefined
20
+ : { ...provider, timeoutMs: codingWorkbenchProviderTimeoutMs(provider.timeoutMs) };
21
+ const budget = raised === undefined
22
+ ? UNCONFIGURED_MODEL_ROUTE_DEADLINE_MS
23
+ : Math.max(...shapes.map((shape) => gatewayCallBudgetMs(raised, shape)));
24
+ // Armed with AbortSignal.timeout, which fires at once past 2^31 - 1 ms: an absurd budget must not
25
+ // turn the backstop into an immediate abort.
26
+ return Math.min(budget + GATEWAY_ROUTE_DEADLINE_GRACE_MS, MAX_TIMER_DELAY_MS);
27
+ }
@@ -4,6 +4,8 @@ import type { EnvSource, GatewayConfig } from "@oscharko-dev/keiko-model-gateway
4
4
  import type { RouteContext, RouteResult } from "./routes.js";
5
5
  import type { GatewayDiscoveredModels, UiHandlerDeps } from "./deps.js";
6
6
  export declare const MAX_DISCOVERED_MODELS = 100;
7
+ export declare const DISCOVERED_MODEL_SMOKE_TIMEOUT_MS = 120000;
8
+ export declare const CHAT_SMOKE_ROUND_DEADLINE_MS = 600000;
7
9
  export declare function stripTrailingSlashes(value: string): string;
8
10
  export declare function rawConfigFromCurrent(config: GatewayConfig, figmaAccessToken: string | undefined, timeoutMs?: number): Record<string, unknown>;
9
11
  export declare function isExplicitlyNonChatModel(item: Record<string, unknown>): boolean;
@@ -12,7 +14,37 @@ export declare function parseModelDiscovery(payload: unknown): GatewayDiscovered
12
14
  export declare function parseModelList(payload: unknown): readonly string[];
13
15
  export declare function normalizeDiscoveryPayload(payload: unknown): readonly string[];
14
16
  export declare function normalizeDiscoveryPayloadForSetup(payload: unknown): GatewayDiscoveredModels;
17
+ /**
18
+ * Classification evidence captured from a swallowed per-model probe failure — exactly the
19
+ * code/status pair `setupCandidateError` reads, never probe messages or response bodies
20
+ * (LiteLLM production audit: an all-probes auth failure must classify as a credential failure
21
+ * instead of the generic body-free 502).
22
+ */
23
+ interface ProbeFailureEvidence {
24
+ readonly code: string | undefined;
25
+ readonly httpStatus: number | undefined;
26
+ }
15
27
  export declare function smokeTestCandidates(candidates: readonly string[], probe: (modelId: string) => Promise<void>, concurrency: number): Promise<readonly string[]>;
28
+ interface ChatSmokeAdmission {
29
+ /** Answered the smoke probe successfully. */
30
+ readonly tested: readonly string[];
31
+ /** The probe never got an answer (timeout, abort, transport/proxy/TLS failure), the gateway
32
+ * answered with a transient failure (rate limit or an overloaded-gateway status — 408/429/5xx
33
+ * except 501, `transientGatewayStatus`), or the round's own patience budget ran out before this
34
+ * candidate's probe was even started (`CHAT_SMOKE_ROUND_DEADLINE_MS`) — KEPT, unverified: a
35
+ * slow or momentarily overloaded gateway is not a broken one (#3591). */
36
+ readonly unverifiedKept: readonly string[];
37
+ /** The gateway ANSWERED and rejected the candidate (4xx/5xx, or a malformed/unusable answer) —
38
+ * real evidence the candidate does not work, so it is dropped. */
39
+ readonly droppedRejected: readonly string[];
40
+ /** Classification evidence for EVERY failed candidate (both buckets above), for
41
+ * `allProbesFailedError` — used only when NOTHING was tested (see `defaultGatewaySetupTester`). */
42
+ readonly allFailures: readonly ProbeFailureEvidence[];
43
+ /** The candidates in `unverifiedKept` the round deadline skipped without probing them. */
44
+ readonly skippedByDeadline: readonly string[];
45
+ }
46
+ export declare function admitChatSmokeCandidates(candidates: readonly string[], probe: (modelId: string) => Promise<void>, concurrency: number, deps: UiHandlerDeps, correlationId: string | undefined, now?: () => number): Promise<ChatSmokeAdmission>;
47
+ export declare function candidateSmokeDeadlineMs(config: GatewayConfig, modelId: string): number;
16
48
  export declare function defaultGatewayEmbeddingProbe(config: GatewayConfig, candidateModelIds: readonly string[], env: EnvSource, correlationId: string): Promise<readonly string[]>;
17
49
  export declare function gatewaySetupTargetClass(baseUrl: string): GatewaySetupTargetClass;
18
50
  export declare function handleGatewaySetup(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
@@ -28,4 +60,5 @@ export declare function reconcileGatewayToolCallingReadiness(deps: UiHandlerDeps
28
60
  export declare function reconcileGatewayContextWindowReadiness(deps: UiHandlerDeps, report: GatewayReadinessReport, observedGeneration: number | undefined, correlationId?: string): void;
29
61
  /** Applies only generation-current live observations after an explicit, human-confirmed request. */
30
62
  export declare function handleApplyGatewayVerifiedCapabilities(ctx: RouteContext, deps: UiHandlerDeps): Promise<RouteResult>;
63
+ export {};
31
64
  //# sourceMappingURL=gateway-setup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-setup.d.ts","sourceRoot":"","sources":["../src/gateway-setup.ts"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EAIV,uBAAuB,EAGxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAMrF,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAQd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,KAAK,EAEV,uBAAuB,EAKvB,aAAa,EAEd,MAAM,WAAW,CAAC;AAkCnB,eAAO,MAAM,qBAAqB,MAAM,CAAC;AA6IzC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM1D;AAkyBD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AA+LD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAO/E;AAgHD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,O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