omnicell-router 0.8.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/README.md +26 -7
  2. package/README.zh-CN.md +18 -5
  3. package/backend/dist/auth/api-keys.js +11 -0
  4. package/backend/dist/auth/key-models.d.ts +36 -0
  5. package/backend/dist/auth/key-models.js +99 -0
  6. package/backend/dist/capture/recorder.d.ts +4 -10
  7. package/backend/dist/capture/recorder.js +6 -58
  8. package/backend/dist/cli/clients/activity.js +2 -0
  9. package/backend/dist/cli/clients/base.d.ts +36 -11
  10. package/backend/dist/cli/clients/base.js +31 -15
  11. package/backend/dist/cli/clients/claude.d.ts +9 -0
  12. package/backend/dist/cli/clients/claude.js +6 -0
  13. package/backend/dist/cli/clients/codex.d.ts +78 -0
  14. package/backend/dist/cli/clients/codex.js +475 -57
  15. package/backend/dist/cli/clients/core-adapters.d.ts +1 -1
  16. package/backend/dist/cli/clients/core-adapters.js +1 -1
  17. package/backend/dist/cli/clients/dsh.d.ts +8 -0
  18. package/backend/dist/cli/clients/dsh.js +5 -0
  19. package/backend/dist/cli/clients/follow-catalog-sync.d.ts +62 -0
  20. package/backend/dist/cli/clients/follow-catalog-sync.js +435 -0
  21. package/backend/dist/cli/clients/grok.d.ts +15 -1
  22. package/backend/dist/cli/clients/grok.js +16 -2
  23. package/backend/dist/cli/clients/index.d.ts +13 -1
  24. package/backend/dist/cli/clients/index.js +97 -19
  25. package/backend/dist/cli/clients/kimi.d.ts +6 -0
  26. package/backend/dist/cli/clients/kimi.js +3 -0
  27. package/backend/dist/cli/clients/launcher.d.ts +1 -1
  28. package/backend/dist/cli/clients/model-meta.js +6 -3
  29. package/backend/dist/cli/clients/omp.d.ts +6 -0
  30. package/backend/dist/cli/clients/omp.js +3 -0
  31. package/backend/dist/cli/clients/openclaw.d.ts +6 -0
  32. package/backend/dist/cli/clients/openclaw.js +3 -0
  33. package/backend/dist/cli/clients/opencode.d.ts +8 -0
  34. package/backend/dist/cli/clients/opencode.js +8 -2
  35. package/backend/dist/cli/clients/pi.d.ts +6 -0
  36. package/backend/dist/cli/clients/pi.js +3 -0
  37. package/backend/dist/cli/clients/reserved.js +2 -0
  38. package/backend/dist/cli/clients/update-check.d.ts +37 -0
  39. package/backend/dist/cli/clients/update-check.js +309 -0
  40. package/backend/dist/cli/clients/workbuddy.d.ts +19 -0
  41. package/backend/dist/cli/clients/workbuddy.js +66 -0
  42. package/backend/dist/cli/index.js +5 -4
  43. package/backend/dist/cli/paths.js +8 -0
  44. package/backend/dist/cli/types.d.ts +101 -16
  45. package/backend/dist/config/comments-en.js +34 -25
  46. package/backend/dist/config/comments-zh.js +33 -24
  47. package/backend/dist/config/defaults.d.ts +280 -22
  48. package/backend/dist/config/defaults.js +279 -21
  49. package/backend/dist/config/env.d.ts +10 -0
  50. package/backend/dist/config/env.js +3 -2
  51. package/backend/dist/config/index.d.ts +22 -1
  52. package/backend/dist/config/index.js +218 -43
  53. package/backend/dist/config/migrations/v0-to-v1.d.ts +2 -2
  54. package/backend/dist/config/migrations/v10-to-v11.d.ts +38 -0
  55. package/backend/dist/config/migrations/v10-to-v11.js +43 -0
  56. package/backend/dist/config/migrations/v4-to-v5.d.ts +36 -0
  57. package/backend/dist/config/migrations/v4-to-v5.js +42 -0
  58. package/backend/dist/config/migrations/v5-to-v6.d.ts +27 -0
  59. package/backend/dist/config/migrations/v5-to-v6.js +29 -0
  60. package/backend/dist/config/migrations/v6-to-v7.d.ts +45 -0
  61. package/backend/dist/config/migrations/v6-to-v7.js +97 -0
  62. package/backend/dist/config/migrations/v7-to-v8.d.ts +36 -0
  63. package/backend/dist/config/migrations/v7-to-v8.js +43 -0
  64. package/backend/dist/config/migrations/v8-to-v9.d.ts +38 -0
  65. package/backend/dist/config/migrations/v8-to-v9.js +43 -0
  66. package/backend/dist/config/migrations/v9-to-v10.d.ts +51 -0
  67. package/backend/dist/config/migrations/v9-to-v10.js +71 -0
  68. package/backend/dist/config/runtime.js +1 -1
  69. package/backend/dist/config/schema.d.ts +3 -3
  70. package/backend/dist/config/schema.js +18 -4
  71. package/backend/dist/config/types.d.ts +221 -41
  72. package/backend/dist/egress-proxy/asset-download.d.ts +54 -0
  73. package/backend/dist/egress-proxy/asset-download.js +420 -0
  74. package/backend/dist/egress-proxy/manual-node-spec.d.ts +92 -0
  75. package/backend/dist/egress-proxy/manual-node-spec.js +408 -0
  76. package/backend/dist/egress-proxy/mihomo-binary.d.ts +54 -0
  77. package/backend/dist/egress-proxy/mihomo-binary.js +278 -0
  78. package/backend/dist/egress-proxy/mihomo-client.d.ts +94 -0
  79. package/backend/dist/egress-proxy/mihomo-client.js +308 -0
  80. package/backend/dist/egress-proxy/mihomo-config.d.ts +40 -0
  81. package/backend/dist/egress-proxy/mihomo-config.js +161 -0
  82. package/backend/dist/egress-proxy/mihomo-geo.d.ts +87 -0
  83. package/backend/dist/egress-proxy/mihomo-geo.js +213 -0
  84. package/backend/dist/egress-proxy/mihomo-logs.d.ts +43 -0
  85. package/backend/dist/egress-proxy/mihomo-logs.js +84 -0
  86. package/backend/dist/egress-proxy/mihomo-pac.d.ts +37 -0
  87. package/backend/dist/egress-proxy/mihomo-pac.js +75 -0
  88. package/backend/dist/egress-proxy/mihomo-rules-import.d.ts +43 -0
  89. package/backend/dist/egress-proxy/mihomo-rules-import.js +193 -0
  90. package/backend/dist/egress-proxy/mihomo-sidecar.d.ts +81 -0
  91. package/backend/dist/egress-proxy/mihomo-sidecar.js +637 -0
  92. package/backend/dist/forward-proxy/egress.d.ts +50 -11
  93. package/backend/dist/forward-proxy/egress.js +63 -17
  94. package/backend/dist/forward-proxy/h2-forward.js +42 -15
  95. package/backend/dist/forward-proxy/index.d.ts +11 -8
  96. package/backend/dist/forward-proxy/index.js +27 -60
  97. package/backend/dist/forward-proxy/interceptor.d.ts +3 -2
  98. package/backend/dist/forward-proxy/interceptor.js +4 -4
  99. package/backend/dist/forward-proxy/relay.js +3 -3
  100. package/backend/dist/forward-proxy/rules.d.ts +4 -4
  101. package/backend/dist/forward-proxy/rules.js +25 -4
  102. package/backend/dist/forward-proxy/server.d.ts +12 -16
  103. package/backend/dist/forward-proxy/server.js +237 -171
  104. package/backend/dist/harness/host/hosts.js +3 -2
  105. package/backend/dist/index.js +59 -19
  106. package/backend/dist/ingress-proxy/access-log.d.ts +176 -0
  107. package/backend/dist/ingress-proxy/access-log.js +774 -0
  108. package/backend/dist/ingress-proxy/ca-inventory.d.ts +106 -0
  109. package/backend/dist/ingress-proxy/ca-inventory.js +525 -0
  110. package/backend/dist/ingress-proxy/ca-trust.d.ts +96 -0
  111. package/backend/dist/ingress-proxy/ca-trust.js +315 -0
  112. package/backend/dist/ingress-proxy/ca.d.ts +104 -0
  113. package/backend/dist/ingress-proxy/ca.js +273 -0
  114. package/backend/dist/ingress-proxy/data-dir.d.ts +28 -0
  115. package/backend/dist/ingress-proxy/data-dir.js +45 -0
  116. package/backend/dist/ingress-proxy/egress.d.ts +151 -0
  117. package/backend/dist/ingress-proxy/egress.js +364 -0
  118. package/backend/dist/ingress-proxy/h2-forward.d.ts +66 -0
  119. package/backend/dist/ingress-proxy/h2-forward.js +561 -0
  120. package/backend/dist/ingress-proxy/index.d.ts +24 -0
  121. package/backend/dist/ingress-proxy/index.js +144 -0
  122. package/backend/dist/ingress-proxy/interceptor.d.ts +25 -0
  123. package/backend/dist/ingress-proxy/interceptor.js +52 -0
  124. package/backend/dist/ingress-proxy/ordered-relay.d.ts +29 -0
  125. package/backend/dist/ingress-proxy/ordered-relay.js +46 -0
  126. package/backend/dist/ingress-proxy/relay.d.ts +54 -0
  127. package/backend/dist/ingress-proxy/relay.js +188 -0
  128. package/backend/dist/ingress-proxy/rules.d.ts +195 -0
  129. package/backend/dist/ingress-proxy/rules.js +348 -0
  130. package/backend/dist/ingress-proxy/server.d.ts +153 -0
  131. package/backend/dist/ingress-proxy/server.js +2065 -0
  132. package/backend/dist/ingress-proxy/sni.d.ts +35 -0
  133. package/backend/dist/ingress-proxy/sni.js +124 -0
  134. package/backend/dist/ingress-proxy/status.d.ts +32 -0
  135. package/backend/dist/ingress-proxy/status.js +15 -0
  136. package/backend/dist/ingress-proxy/system-proxy.d.ts +112 -0
  137. package/backend/dist/ingress-proxy/system-proxy.js +481 -0
  138. package/backend/dist/ingress-proxy/traffic-delete.d.ts +21 -0
  139. package/backend/dist/ingress-proxy/traffic-delete.js +64 -0
  140. package/backend/dist/ingress-proxy/traffic-delete.worker.d.ts +44 -0
  141. package/backend/dist/ingress-proxy/traffic-delete.worker.js +228 -0
  142. package/backend/dist/ingress-proxy/traffic-files.d.ts +10 -0
  143. package/backend/dist/ingress-proxy/traffic-files.js +10 -0
  144. package/backend/dist/ingress-proxy/upstream-tls.d.ts +46 -0
  145. package/backend/dist/ingress-proxy/upstream-tls.js +105 -0
  146. package/backend/dist/ingress-proxy/ws-frames.d.ts +45 -0
  147. package/backend/dist/ingress-proxy/ws-frames.js +153 -0
  148. package/backend/dist/ir/adapters/anthropic-messages-stream.js +6 -1
  149. package/backend/dist/ir/adapters/anthropic-messages.js +12 -5
  150. package/backend/dist/ir/adapters/google-gemini-stream.js +7 -2
  151. package/backend/dist/ir/adapters/google-gemini.js +5 -2
  152. package/backend/dist/ir/adapters/openai-chat-stream.js +5 -1
  153. package/backend/dist/ir/adapters/openai-chat.d.ts +25 -0
  154. package/backend/dist/ir/adapters/openai-chat.js +50 -6
  155. package/backend/dist/ir/adapters/openai-responses-output.d.ts +1 -0
  156. package/backend/dist/ir/adapters/openai-responses-output.js +67 -21
  157. package/backend/dist/ir/adapters/openai-responses-stream.d.ts +13 -0
  158. package/backend/dist/ir/adapters/openai-responses-stream.js +34 -1
  159. package/backend/dist/ir/adapters/openai-responses.d.ts +92 -1
  160. package/backend/dist/ir/adapters/openai-responses.js +163 -12
  161. package/backend/dist/ir/capabilities.js +4 -0
  162. package/backend/dist/ir/media.d.ts +20 -0
  163. package/backend/dist/ir/media.js +41 -0
  164. package/backend/dist/ir/tool-identity.d.ts +35 -0
  165. package/backend/dist/ir/tool-identity.js +40 -0
  166. package/backend/dist/ir/types.d.ts +9 -1
  167. package/backend/dist/ir/validate.d.ts +24 -0
  168. package/backend/dist/ir/validate.js +113 -63
  169. package/backend/dist/local/build-jobs.d.ts +66 -0
  170. package/backend/dist/local/build-jobs.js +243 -0
  171. package/backend/dist/local/detect.d.ts +32 -0
  172. package/backend/dist/local/detect.js +145 -0
  173. package/backend/dist/local/draft-match.d.ts +58 -0
  174. package/backend/dist/local/draft-match.js +124 -0
  175. package/backend/dist/local/engine-runtime.d.ts +522 -0
  176. package/backend/dist/local/engine-runtime.js +1 -0
  177. package/backend/dist/local/engines.d.ts +241 -0
  178. package/backend/dist/local/engines.js +651 -0
  179. package/backend/dist/local/gguf.d.ts +35 -0
  180. package/backend/dist/local/gguf.js +314 -0
  181. package/backend/dist/local/hf.d.ts +120 -0
  182. package/backend/dist/local/hf.js +304 -0
  183. package/backend/dist/local/install.d.ts +90 -0
  184. package/backend/dist/local/install.js +421 -0
  185. package/backend/dist/local/llamacpp.d.ts +55 -0
  186. package/backend/dist/local/llamacpp.js +177 -0
  187. package/backend/dist/local/local-provider.d.ts +81 -0
  188. package/backend/dist/local/local-provider.js +301 -0
  189. package/backend/dist/local/machine-stats.d.ts +87 -0
  190. package/backend/dist/local/machine-stats.js +332 -0
  191. package/backend/dist/local/model-store.d.ts +347 -0
  192. package/backend/dist/local/model-store.js +1215 -0
  193. package/backend/dist/local/part-sweep.d.ts +32 -0
  194. package/backend/dist/local/part-sweep.js +156 -0
  195. package/backend/dist/local/plan.d.ts +65 -0
  196. package/backend/dist/local/plan.js +146 -0
  197. package/backend/dist/local/resources.d.ts +49 -0
  198. package/backend/dist/local/resources.js +64 -0
  199. package/backend/dist/local/run-stats.d.ts +95 -0
  200. package/backend/dist/local/run-stats.js +195 -0
  201. package/backend/dist/local/runner.d.ts +235 -0
  202. package/backend/dist/local/runner.js +1392 -0
  203. package/backend/dist/local/settings.d.ts +79 -0
  204. package/backend/dist/local/settings.js +180 -0
  205. package/backend/dist/local/strata-catalog.d.ts +30 -0
  206. package/backend/dist/local/strata-catalog.js +511 -0
  207. package/backend/dist/local/strata-drafting.d.ts +46 -0
  208. package/backend/dist/local/strata-drafting.js +265 -0
  209. package/backend/dist/local/strata.d.ts +278 -0
  210. package/backend/dist/local/strata.js +1392 -0
  211. package/backend/dist/local/tar.d.ts +20 -0
  212. package/backend/dist/local/tar.js +367 -0
  213. package/backend/dist/local/transport.d.ts +35 -0
  214. package/backend/dist/local/transport.js +89 -0
  215. package/backend/dist/local/tune.d.ts +58 -0
  216. package/backend/dist/local/tune.js +324 -0
  217. package/backend/dist/observability/http-exchange.d.ts +2 -2
  218. package/backend/dist/opencode/catalog/auto-pull.d.ts +14 -3
  219. package/backend/dist/opencode/catalog/auto-pull.js +284 -77
  220. package/backend/dist/opencode/catalog/ocr-store.d.ts +7 -6
  221. package/backend/dist/opencode/catalog/ocr-store.js +4 -2
  222. package/backend/dist/opencode/catalog/overrides-store.d.ts +15 -4
  223. package/backend/dist/opencode/catalog/overrides-store.js +28 -19
  224. package/backend/dist/opencode/catalog/reasoning-declaration.d.ts +35 -0
  225. package/backend/dist/opencode/catalog/reasoning-declaration.js +66 -0
  226. package/backend/dist/opencode/catalog/repository.js +28 -5
  227. package/backend/dist/opencode/catalog/sources/models-dev.d.ts +3 -3
  228. package/backend/dist/opencode/catalog/sources/models-dev.js +42 -14
  229. package/backend/dist/opencode/catalog/types.d.ts +42 -12
  230. package/backend/dist/opencode/catalog/types.js +38 -1
  231. package/backend/dist/opencode/credentials/def-materialize.js +27 -21
  232. package/backend/dist/opencode/credentials/ocr-store.js +11 -2
  233. package/backend/dist/opencode/credentials/sync.js +12 -3
  234. package/backend/dist/opencode/credentials/types.d.ts +31 -4
  235. package/backend/dist/opencode/credentials/types.js +25 -0
  236. package/backend/dist/opencode/migrate/engine.d.ts +20 -0
  237. package/backend/dist/opencode/migrate/engine.js +71 -0
  238. package/backend/dist/opencode/migrate/migrator.d.ts +11 -0
  239. package/backend/dist/opencode/migrate/migrator.js +6 -0
  240. package/backend/dist/opencode/migrate/steps/overrides-v1-to-v2.d.ts +6 -0
  241. package/backend/dist/opencode/migrate/steps/overrides-v1-to-v2.js +31 -0
  242. package/backend/dist/opencode/migrate/steps/providers-v1-to-v2.d.ts +6 -0
  243. package/backend/dist/opencode/migrate/steps/providers-v1-to-v2.js +62 -0
  244. package/backend/dist/opencode/probe.d.ts +21 -4
  245. package/backend/dist/opencode/probe.js +34 -10
  246. package/backend/dist/opencode/provider-def-adapters.d.ts +12 -11
  247. package/backend/dist/opencode/provider-def-adapters.js +43 -27
  248. package/backend/dist/opencode/provider-defs.d.ts +10 -16
  249. package/backend/dist/opencode/provider-defs.js +45 -45
  250. package/backend/dist/opencode/user-config.d.ts +23 -26
  251. package/backend/dist/opencode/user-config.js +95 -77
  252. package/backend/dist/pipeline/directives.d.ts +9 -4
  253. package/backend/dist/pipeline/directives.js +14 -10
  254. package/backend/dist/pipeline/orchestrator.d.ts +42 -13
  255. package/backend/dist/pipeline/orchestrator.js +514 -172
  256. package/backend/dist/plugins/builtin/model-gateway.js +38 -12
  257. package/backend/dist/plugins/environment-ack.d.ts +51 -0
  258. package/backend/dist/plugins/environment-ack.js +81 -0
  259. package/backend/dist/plugins/gateways.d.ts +6 -6
  260. package/backend/dist/plugins/gateways.js +2 -2
  261. package/backend/dist/plugins/host.d.ts +100 -16
  262. package/backend/dist/plugins/host.js +637 -99
  263. package/backend/dist/plugins/install-run.d.ts +27 -0
  264. package/backend/dist/plugins/install-run.js +99 -0
  265. package/backend/dist/plugins/manifest.d.ts +84 -32
  266. package/backend/dist/plugins/manifest.js +149 -45
  267. package/backend/dist/plugins/market-install.d.ts +18 -0
  268. package/backend/dist/plugins/market-install.js +111 -0
  269. package/backend/dist/plugins/market-source.d.ts +100 -0
  270. package/backend/dist/plugins/market-source.js +449 -0
  271. package/backend/dist/plugins/market-updates.d.ts +70 -0
  272. package/backend/dist/plugins/market-updates.js +97 -0
  273. package/backend/dist/plugins/market.d.ts +677 -0
  274. package/backend/dist/plugins/market.js +2113 -0
  275. package/backend/dist/plugins/source-index.d.ts +155 -0
  276. package/backend/dist/plugins/source-index.js +217 -0
  277. package/backend/dist/plugins/types.d.ts +402 -37
  278. package/backend/dist/projects/worktrees.d.ts +88 -0
  279. package/backend/dist/projects/worktrees.js +220 -0
  280. package/backend/dist/providers/boot-direct.d.ts +41 -7
  281. package/backend/dist/providers/boot-direct.js +284 -44
  282. package/backend/dist/providers/compat/tool-markup-recovery.js +31 -6
  283. package/backend/dist/providers/dial-wire.d.ts +17 -0
  284. package/backend/dist/providers/dial-wire.js +49 -0
  285. package/backend/dist/providers/executors/dispatch.d.ts +17 -7
  286. package/backend/dist/providers/executors/dispatch.js +28 -9
  287. package/backend/dist/providers/executors/openai-chat.js +14 -2
  288. package/backend/dist/providers/executors/plugin-adapter.d.ts +23 -1
  289. package/backend/dist/providers/executors/plugin-adapter.js +59 -3
  290. package/backend/dist/providers/member-match.d.ts +32 -9
  291. package/backend/dist/providers/member-match.js +65 -21
  292. package/backend/dist/providers/model-resolution.d.ts +62 -0
  293. package/backend/dist/providers/model-resolution.js +62 -0
  294. package/backend/dist/providers/price-order.d.ts +51 -0
  295. package/backend/dist/providers/price-order.js +54 -0
  296. package/backend/dist/providers/protocols-field.d.ts +24 -0
  297. package/backend/dist/providers/protocols-field.js +66 -0
  298. package/backend/dist/providers/provider-takedown.d.ts +5 -2
  299. package/backend/dist/providers/registry.d.ts +87 -26
  300. package/backend/dist/providers/registry.js +232 -121
  301. package/backend/dist/providers/selection.d.ts +91 -0
  302. package/backend/dist/providers/selection.js +158 -0
  303. package/backend/dist/providers/virtual-meta.d.ts +33 -2
  304. package/backend/dist/providers/virtual-meta.js +74 -18
  305. package/backend/dist/quota/cli-login.d.ts +25 -4
  306. package/backend/dist/quota/cli-login.js +38 -6
  307. package/backend/dist/quota/coverage-generation.d.ts +24 -0
  308. package/backend/dist/quota/coverage-generation.js +29 -0
  309. package/backend/dist/quota/declarations.js +8 -4
  310. package/backend/dist/quota/engine.js +2 -2
  311. package/backend/dist/quota/prober.d.ts +43 -2
  312. package/backend/dist/quota/prober.js +97 -22
  313. package/backend/dist/ratelimit/rate-limiter.d.ts +1 -1
  314. package/backend/dist/resilience/error-classifier.js +29 -0
  315. package/backend/dist/router/index.d.ts +1 -1
  316. package/backend/dist/router/index.js +17 -1
  317. package/backend/dist/router/layer2-decision.d.ts +1 -1
  318. package/backend/dist/router/layer2-decision.js +2 -2
  319. package/backend/dist/routes/console.js +1043 -405
  320. package/backend/dist/routes/environments.js +1 -1
  321. package/backend/dist/routes/local-models.d.ts +2 -0
  322. package/backend/dist/routes/local-models.js +1414 -0
  323. package/backend/dist/routes/mihomo.d.ts +2 -2
  324. package/backend/dist/routes/mihomo.js +20 -11
  325. package/backend/dist/routes/projects.js +121 -0
  326. package/backend/dist/server.js +409 -15
  327. package/backend/dist/session/session-manager.d.ts +42 -5
  328. package/backend/dist/session/session-manager.js +64 -11
  329. package/backend/dist/session/session-row.d.ts +29 -8
  330. package/backend/dist/session/session-row.js +18 -13
  331. package/backend/dist/snapshot/bundle.d.ts +40 -0
  332. package/backend/dist/snapshot/bundle.js +177 -0
  333. package/backend/dist/snapshot/handoff/compress.d.ts +46 -0
  334. package/backend/dist/snapshot/handoff/compress.js +77 -0
  335. package/backend/dist/snapshot/handoff/index.d.ts +119 -0
  336. package/backend/dist/snapshot/handoff/index.js +160 -0
  337. package/backend/dist/snapshot/handoff/jsonl-writer.d.ts +78 -0
  338. package/backend/dist/snapshot/handoff/jsonl-writer.js +175 -0
  339. package/backend/dist/snapshot/handoff/opencode-writer.d.ts +51 -0
  340. package/backend/dist/snapshot/handoff/opencode-writer.js +214 -0
  341. package/backend/dist/snapshot/handoff/summarize.d.ts +39 -0
  342. package/backend/dist/snapshot/handoff/summarize.js +118 -0
  343. package/backend/dist/snapshot/handoff/transcript.d.ts +71 -0
  344. package/backend/dist/snapshot/handoff/transcript.js +167 -0
  345. package/backend/dist/snapshot/media-fs.d.ts +10 -0
  346. package/backend/dist/snapshot/media-fs.js +50 -0
  347. package/backend/dist/snapshot/media.d.ts +32 -0
  348. package/backend/dist/snapshot/media.js +87 -0
  349. package/backend/dist/snapshot/store.d.ts +226 -0
  350. package/backend/dist/snapshot/store.js +887 -0
  351. package/backend/dist/snapshot/tree.d.ts +112 -0
  352. package/backend/dist/snapshot/tree.js +207 -0
  353. package/backend/dist/snapshot/types.d.ts +212 -0
  354. package/backend/dist/snapshot/types.js +14 -0
  355. package/backend/dist/snapshot/view.d.ts +19 -0
  356. package/backend/dist/snapshot/view.js +57 -0
  357. package/backend/dist/snapshot/write-worker.d.ts +67 -0
  358. package/backend/dist/snapshot/write-worker.js +129 -0
  359. package/backend/dist/surfaces/anthropic.js +4 -1
  360. package/backend/dist/surfaces/body-admission.d.ts +344 -0
  361. package/backend/dist/surfaces/body-admission.js +818 -0
  362. package/backend/dist/surfaces/chat-pipeline.js +8 -0
  363. package/backend/dist/surfaces/decision-pipeline.js +10 -7
  364. package/backend/dist/surfaces/gateway-catalog.d.ts +26 -0
  365. package/backend/dist/surfaces/gateway-catalog.js +202 -0
  366. package/backend/dist/surfaces/gateway-chat.d.ts +7 -11
  367. package/backend/dist/surfaces/gateway-chat.js +50 -12
  368. package/backend/dist/surfaces/ocr-headers.d.ts +6 -4
  369. package/backend/dist/surfaces/ocr-headers.js +11 -7
  370. package/backend/dist/surfaces/systemone.js +1 -1
  371. package/backend/dist/surfaces/transport-fastify.js +32 -5
  372. package/backend/dist/surfaces/transport-node-http.d.ts +51 -6
  373. package/backend/dist/surfaces/transport-node-http.js +76 -16
  374. package/backend/dist/surfaces/types.d.ts +11 -3
  375. package/backend/dist/trace/persist.js +21 -1
  376. package/backend/dist/trace/tracker.d.ts +35 -3
  377. package/backend/dist/trace/tracker.js +23 -0
  378. package/backend/dist/types/openai.d.ts +8 -0
  379. package/backend/dist/types/router.d.ts +17 -6
  380. package/backend/dist/types/router.js +14 -2
  381. package/backend/dist/utils/client-families.d.ts +66 -0
  382. package/backend/dist/utils/client-families.js +127 -0
  383. package/backend/dist/utils/event-ring.d.ts +1 -1
  384. package/backend/dist/utils/event-ring.js +1 -1
  385. package/backend/dist/utils/proxy-node.js +1 -1
  386. package/backend/dist/utils/proxy.d.ts +135 -11
  387. package/backend/dist/utils/proxy.js +144 -29
  388. package/backend/dist/utils/run-command.d.ts +21 -1
  389. package/backend/dist/utils/run-command.js +64 -4
  390. package/backend/dist/utils/server-liveness.d.ts +28 -0
  391. package/backend/dist/utils/server-liveness.js +32 -0
  392. package/backend/dist/utils/session-file.d.ts +28 -0
  393. package/backend/dist/utils/session-file.js +34 -0
  394. package/frontend/dist/assets/antigravity.color-DXFfVr6X.svg +39 -0
  395. package/frontend/dist/assets/gemini-cli.color-BfquLd1p.svg +1 -0
  396. package/frontend/dist/assets/index-CTZNvn1d.js +1707 -0
  397. package/frontend/dist/assets/{index-DxZ9MHKB.css → index-CqDSOPQ0.css} +1 -1
  398. package/frontend/dist/index.html +2 -2
  399. package/package.json +3 -1
  400. package/frontend/dist/assets/index-55VVwfFQ.js +0 -1521
@@ -1,7 +1,15 @@
1
1
  import { capabilitiesFor } from './capabilities.js';
2
2
  import { IrUnsupportedError } from './errors.js';
3
- function fail(protocol, code, detail) {
4
- throw new IrUnsupportedError(code, `${detail} Target protocol: ${protocol}.`, protocol);
3
+ /** Default fix when a capability is simply missing on the dialed wire. */
4
+ const GENERIC_HINT = 'Omit this field or use a protocol that supports it';
5
+ /**
6
+ * Client-visible unsupported_parameter body. One voice for the gate and adapters:
7
+ * feature + dialed protocol + actionable hint. Dial context (model / protocols[])
8
+ * is layered on by `withDialContext` in the registry.
9
+ */
10
+ export function formatUnsupported(protocol, feature, hint = GENERIC_HINT) {
11
+ const tip = hint.trim().replace(/\.$/, '');
12
+ return `Unsupported on outbound protocol '${protocol}': ${feature}. ${tip}.`;
5
13
  }
6
14
  /** Carrier shape family. The chat family is the DEFAULT: the three typed
7
15
  * carriers are named, and every other protocol id (systemone, an OCR-native
@@ -9,56 +17,94 @@ function fail(protocol, code, detail) {
9
17
  function isChatProtocol(protocol) {
10
18
  return protocol !== 'openai-responses' && protocol !== 'anthropic-messages' && protocol !== 'google-gemini';
11
19
  }
12
- function validateCache(cache, protocol, supported, code, detail, strip) {
20
+ function fail(protocol, code, feature, hint = GENERIC_HINT) {
21
+ throw new IrUnsupportedError(code, formatUnsupported(protocol, feature, hint), protocol);
22
+ }
23
+ /**
24
+ * Operator-facing copy when a wire rejects non-function tools.
25
+ * OpenAI Platform Chat Completions added `type:"custom"` in 2025-08, but OCR's
26
+ * `openai-chat` id is the *portable* Chat Completions contract used by Xiaomi /
27
+ * DeepSeek / Kimi-style compat endpoints — those accept function tools, not
28
+ * OpenAI's freeform/grammar custom dialect or Responses builtins.
29
+ */
30
+ export function unsupportedToolKindMessage(protocol, kind, forChoice) {
31
+ const feature = forChoice ? `Forcing a ${kind} tool (tool_choice)` : `${kind} tools`;
32
+ const responsesHint = `Add 'openai-responses' to the model's protocols[] if the vendor can serve it, or use a model whose protocols admit ${kind} tools`;
33
+ if (isChatProtocol(protocol) && (kind === 'custom' || kind === 'builtin')) {
34
+ const chatHint = kind === 'custom'
35
+ ? `Portable openai-chat carries function tools only; ${responsesHint}`
36
+ : `Portable openai-chat cannot carry builtin/hosted tools; ${responsesHint}`;
37
+ return formatUnsupported(protocol, feature, chatHint);
38
+ }
39
+ if (kind === 'custom' || kind === 'builtin') {
40
+ return formatUnsupported(protocol, feature, responsesHint);
41
+ }
42
+ return formatUnsupported(protocol, feature);
43
+ }
44
+ /**
45
+ * Layer dial facts onto a gate/adapter refusal so the client sees which model
46
+ * and protocols[] were in play. Same code/protocol; message only.
47
+ */
48
+ export function withDialContext(err, opts) {
49
+ if (err.message.startsWith('Request for model '))
50
+ return err;
51
+ const list = opts.protocols && opts.protocols.length > 0
52
+ ? opts.protocols.join(', ')
53
+ : opts.dialWire;
54
+ const message = `Request for model '${opts.modelId}' (declared protocols: ${list}): ${err.message}`;
55
+ return new IrUnsupportedError(err.code, message, err.protocol ?? opts.dialWire);
56
+ }
57
+ function validateCache(cache, protocol, supported, code, feature, strip, hint = GENERIC_HINT) {
13
58
  if (strip)
14
59
  return;
15
60
  if (!supported)
16
- fail(protocol, code, detail);
61
+ fail(protocol, code, feature, hint);
17
62
  // Responses breakpoints are opaque objects; Anthropic only accepts its own
18
63
  // typed cache_control marker. Replaying a foreign marker is not passthrough.
19
64
  if (protocol === 'anthropic-messages' && cache.raw && !cache.type) {
20
- fail(protocol, code, 'Protocol cannot translate a foreign raw cache breakpoint.');
65
+ fail(protocol, code, 'Foreign raw cache breakpoints', 'Use an Anthropic cache_control marker');
21
66
  }
22
67
  if (protocol === 'openai-responses' && cache.type && !cache.raw) {
23
- fail(protocol, code, 'Protocol cannot translate an Anthropic cache_control breakpoint.');
68
+ fail(protocol, code, 'Anthropic cache_control breakpoints', 'Use a Responses prompt_cache breakpoint');
24
69
  }
25
70
  }
26
71
  function validatePart(part, protocol, caps, stripCarrierExtensions = false) {
27
72
  if (part.type === 'extension') {
28
- if (part.protocol !== protocol)
29
- fail(protocol, 'extension_part', `Cannot convert ${part.protocol} extension content.`);
73
+ if (part.protocol !== protocol) {
74
+ fail(protocol, 'extension_part', `${part.protocol} extension content`, 'Keep same-carrier extensions only');
75
+ }
30
76
  return;
31
77
  }
32
78
  if (!caps.parts[part.type])
33
- fail(protocol, `${part.type}_part`, `Protocol cannot carry ${part.type} content.`);
79
+ fail(protocol, `${part.type}_part`, `${part.type} content parts`);
34
80
  if ('cache' in part && part.cache) {
35
- validateCache(part.cache, protocol, caps.cache.part_breakpoint === true, 'cache_part_breakpoint', 'Protocol cannot carry a content cache breakpoint.', stripCarrierExtensions);
81
+ validateCache(part.cache, protocol, caps.cache.part_breakpoint === true, 'cache_part_breakpoint', 'Content cache breakpoints', stripCarrierExtensions);
36
82
  }
37
83
  if ('source' in part) {
38
84
  const allowed = caps.sources[part.type] ?? [];
39
85
  if (!allowed.includes(part.source.kind)) {
40
- fail(protocol, `${part.type}_source`, `Protocol cannot carry a ${part.source.kind} ${part.type} source.`);
86
+ fail(protocol, `${part.type}_source`, `${part.source.kind} ${part.type} sources`);
41
87
  }
42
88
  }
43
89
  if ((part.type === 'text' || part.type === 'image' || part.type === 'file' || part.type === 'audio') && part.signature) {
44
90
  if (!caps.reasoningSignature)
45
- fail(protocol, 'content_signature', 'Protocol cannot replay signed content.');
91
+ fail(protocol, 'content_signature', 'Signed content replay');
46
92
  }
47
93
  if (part.type === 'text' && part.annotations?.length && !caps.annotations) {
48
- fail(protocol, 'annotations', 'Protocol cannot carry text annotations.');
94
+ fail(protocol, 'annotations', 'Text annotations');
49
95
  }
50
96
  if (part.type === 'text' && part.logprobs?.length && !caps.logprobs) {
51
- fail(protocol, 'logprobs', 'Protocol cannot carry token log probabilities.');
97
+ fail(protocol, 'logprobs', 'Token log probabilities on content');
52
98
  }
53
99
  }
54
100
  function validateToolChoice(choice, protocol, caps) {
55
101
  if (!choice)
56
102
  return;
57
103
  if (choice.type === 'custom' && !caps.toolKinds.custom) {
58
- fail(protocol, 'tool_choice', 'Protocol cannot force a custom tool.');
104
+ throw new IrUnsupportedError('tool_choice', unsupportedToolKindMessage(protocol, 'custom', true), protocol);
59
105
  }
60
106
  if (choice.type === 'allowed' && !caps.allowedToolChoice) {
61
- fail(protocol, 'allowed_tools', 'Protocol cannot represent allowed_tools.');
107
+ fail(protocol, 'allowed_tools', 'allowed_tools tool_choice');
62
108
  }
63
109
  }
64
110
  /**
@@ -73,127 +119,131 @@ export function assertCanonicalRequestSupported(ir, protocol, options = {}) {
73
119
  validateItem(item, protocol, caps, strip, 'request');
74
120
  for (const tool of ir.tools ?? []) {
75
121
  if (tool.type === 'extension') {
76
- if (tool.protocol !== protocol)
77
- fail(protocol, 'extension_tool', `Cannot convert ${tool.protocol} tool definition.`);
122
+ if (tool.protocol !== protocol) {
123
+ fail(protocol, 'extension_tool', `${tool.protocol} tool definitions`, 'Keep same-carrier tools only');
124
+ }
78
125
  continue;
79
126
  }
80
- if (!caps.toolKinds[tool.type])
81
- fail(protocol, 'tool_type', `Protocol cannot carry ${tool.type} tools.`);
127
+ if (!caps.toolKinds[tool.type]) {
128
+ throw new IrUnsupportedError('tool_type', unsupportedToolKindMessage(protocol, tool.type, false), protocol);
129
+ }
82
130
  if (tool.type === 'function' && tool.function.strict === true && !caps.toolStrict) {
83
- fail(protocol, 'tool_strict', 'Protocol cannot enforce strict function schemas.');
131
+ fail(protocol, 'tool_strict', 'Strict function schemas');
84
132
  }
85
133
  const cache = tool.type === 'function' ? tool.function.cache : tool.type === 'custom' ? tool.cache : undefined;
86
134
  if (cache) {
87
- validateCache(cache, protocol, caps.cache.tool_breakpoint === true, 'cache_tool_breakpoint', 'Protocol cannot carry a tool cache breakpoint.', strip);
135
+ validateCache(cache, protocol, caps.cache.tool_breakpoint === true, 'cache_tool_breakpoint', 'Tool cache breakpoints', strip);
88
136
  }
89
137
  }
90
138
  validateToolChoice(ir.toolChoice, protocol, caps);
91
139
  if (ir.parallelToolCalls === false && !caps.parallelToolCalls) {
92
- fail(protocol, 'parallel_tool_calls', 'Protocol cannot disable parallel tool calls.');
140
+ fail(protocol, 'parallel_tool_calls', 'Disabling parallel tool calls');
93
141
  }
94
142
  if (ir.text?.format && ir.text.format.type !== 'text' && !caps.responseFormat[ir.text.format.type]) {
95
- fail(protocol, 'response_format', `Protocol cannot enforce ${ir.text.format.type}.`);
143
+ fail(protocol, 'response_format', `${ir.text.format.type} response format`);
96
144
  }
97
145
  if (ir.text?.verbosity && !caps.textVerbosity)
98
- fail(protocol, 'text_verbosity', 'Protocol cannot control text verbosity.');
146
+ fail(protocol, 'text_verbosity', 'text.verbosity');
99
147
  if (ir.reasoning?.budgetTokens !== undefined && !caps.reasoningBudget) {
100
- fail(protocol, 'reasoning_budget', 'Protocol cannot enforce a thinking-token budget.');
148
+ fail(protocol, 'reasoning_budget', 'Thinking-token budgets');
101
149
  }
102
150
  if (ir.reasoning?.summary && !caps.reasoningSummary) {
103
- fail(protocol, 'reasoning_summary', 'Protocol cannot request reasoning summaries.');
151
+ fail(protocol, 'reasoning_summary', 'Reasoning summaries');
104
152
  }
105
153
  if (ir.n !== undefined && ir.n !== 1 && !caps.candidates) {
106
- fail(protocol, 'candidates', 'Protocol cannot return multiple candidates.');
154
+ fail(protocol, 'candidates', 'Multiple candidates (n > 1)');
107
155
  }
108
156
  if ((ir.logprobs === true || ir.topLogprobs !== undefined) && !caps.logprobs) {
109
- fail(protocol, 'logprobs', 'Protocol cannot return log probabilities.');
157
+ fail(protocol, 'logprobs', 'Log probabilities');
110
158
  }
111
159
  if (ir.logitBias !== undefined && !isChatProtocol(protocol)) {
112
- fail(protocol, 'logit_bias', 'Protocol cannot honor token logit bias.');
160
+ fail(protocol, 'logit_bias', 'Token logit bias');
113
161
  }
114
162
  if (ir.include !== undefined && protocol !== 'openai-responses') {
115
- fail(protocol, 'include', 'Protocol cannot honor Responses include controls.');
163
+ fail(protocol, 'include', 'Responses include controls');
116
164
  }
117
165
  if (ir.store !== undefined || ir.previousResponseId || ir.conversation || ir.prompt) {
118
166
  if (!caps.stateful)
119
- fail(protocol, 'stateful_request', 'Protocol cannot carry server-side response state controls.');
167
+ fail(protocol, 'stateful_request', 'Server-side response state controls');
120
168
  }
121
169
  if (ir.background && !caps.background)
122
- fail(protocol, 'background', 'Protocol cannot execute background responses.');
170
+ fail(protocol, 'background', 'Background responses');
123
171
  if (ir.truncation === 'auto' && !caps.stateful)
124
- fail(protocol, 'truncation', 'Protocol cannot perform server-side truncation.');
172
+ fail(protocol, 'truncation', 'Server-side truncation');
125
173
  if (ir.metadata && !caps.metadata)
126
- fail(protocol, 'metadata', 'Protocol cannot carry opaque request metadata.');
174
+ fail(protocol, 'metadata', 'Opaque request metadata');
127
175
  if (ir.serviceTier && !caps.serviceTier)
128
- fail(protocol, 'service_tier', 'Protocol cannot select a service tier.');
176
+ fail(protocol, 'service_tier', 'Service tier selection');
129
177
  if (ir.safetyIdentifier && !caps.safetyIdentifier) {
130
- fail(protocol, 'safety_identifier', 'Protocol cannot carry a safety identifier.');
178
+ fail(protocol, 'safety_identifier', 'Safety identifiers');
131
179
  }
132
180
  if (ir.user && !caps.user)
133
- fail(protocol, 'user', 'Protocol cannot carry end-user attribution.');
181
+ fail(protocol, 'user', 'End-user attribution');
134
182
  // streamOptions controls the northbound Chat encoder; it is not an upstream field.
135
183
  for (const key of ['key', 'retention', 'options']) {
136
184
  if (ir.cache?.[key] !== undefined && !caps.cache[key] && !(strip && key !== 'key')) {
137
- fail(protocol, `cache_${key}`, `Protocol cannot honor cache.${key}.`);
185
+ fail(protocol, `cache_${key}`, `cache.${key}`);
138
186
  }
139
187
  }
140
188
  if (!strip && ir.vendor?.anthropic?.systemCache && typeof ir.vendor.anthropic.systemCache === 'object') {
141
- validateCache(ir.vendor.anthropic.systemCache, protocol, caps.cache.item_breakpoint === true, 'cache_system_breakpoint', 'Protocol cannot carry Anthropic system cache breakpoints.', strip);
189
+ validateCache(ir.vendor.anthropic.systemCache, protocol, caps.cache.item_breakpoint === true, 'cache_system_breakpoint', 'Anthropic system cache breakpoints', strip);
142
190
  }
143
191
  if (ir.reasoning?.include && protocol !== 'openai-responses') {
144
- fail(protocol, 'reasoning_include', 'Protocol cannot return encrypted reasoning content.');
192
+ fail(protocol, 'reasoning_include', 'Encrypted reasoning content');
145
193
  }
146
194
  for (const key of Object.keys(ir.generation ?? {})) {
147
195
  if (ir.generation?.[key] !== undefined && !caps.generation[key]) {
148
- fail(protocol, `generation_${key}`, `Protocol cannot honor generation.${key}.`);
196
+ fail(protocol, `generation_${key}`, `generation.${key}`);
149
197
  }
150
198
  }
151
199
  }
152
200
  function validateItem(item, protocol, caps, stripCarrierExtensions = false, direction = 'request') {
153
201
  if (item.type === 'extension') {
154
- if (item.protocol !== protocol)
155
- fail(protocol, 'extension_item', `Cannot convert ${item.protocol} extension item.`);
202
+ if (item.protocol !== protocol) {
203
+ fail(protocol, 'extension_item', `${item.protocol} extension items`, 'Keep same-carrier extensions only');
204
+ }
156
205
  return;
157
206
  }
158
207
  if (item.type === 'item_reference') {
159
208
  if (!caps.itemReference)
160
- fail(protocol, 'item_reference', 'Protocol cannot resolve stored item references.');
209
+ fail(protocol, 'item_reference', 'Stored item references');
161
210
  return;
162
211
  }
163
212
  if (item.type === 'reasoning') {
164
213
  if ((item.signature || item.encrypted) && !caps.reasoningSignature) {
165
- fail(protocol, 'reasoning_signature', 'Protocol cannot replay signed or encrypted reasoning.');
214
+ fail(protocol, 'reasoning_signature', 'Signed or encrypted reasoning replay');
166
215
  }
167
216
  // Responses replays `encrypted_content` on the request wire and may echo a
168
217
  // `signature` on northbound output, but a foreign signature has no request
169
218
  // field — reject here so the matrix matches `itemToWire`, not only the adapter.
170
219
  if (direction === 'request' && protocol === 'openai-responses' && item.signature) {
171
- fail(protocol, 'reasoning_signature', 'Responses cannot replay a foreign reasoning signature.');
220
+ fail(protocol, 'reasoning_signature', 'Foreign reasoning signatures', 'Strip signatures before dialing Responses, or stay on the signing carrier');
172
221
  }
173
222
  if (direction === 'request' && protocol === 'google-gemini' && item.encrypted) {
174
- fail(protocol, 'reasoning_signature', 'Gemini reasoning replay cannot carry encrypted OpenAI/Anthropic thought blobs.');
223
+ fail(protocol, 'reasoning_signature', 'Encrypted OpenAI/Anthropic thought blobs', 'Strip encrypted reasoning before dialing Gemini');
175
224
  }
176
225
  if (item.summary?.length && !caps.reasoningSummary) {
177
- fail(protocol, 'reasoning_summary', 'Protocol cannot replay structured reasoning summaries.');
226
+ fail(protocol, 'reasoning_summary', 'Structured reasoning summaries');
178
227
  }
179
228
  return;
180
229
  }
181
230
  if (item.type === 'tool_call') {
182
- if (item.signature && !caps.reasoningSignature)
183
- fail(protocol, 'tool_call_signature', 'Protocol cannot replay signed calls.');
231
+ if (item.signature && !caps.reasoningSignature) {
232
+ fail(protocol, 'tool_call_signature', 'Signed tool-call replay');
233
+ }
184
234
  if (direction === 'request' && protocol === 'openai-responses' && item.signature) {
185
- fail(protocol, 'tool_call_signature', 'Responses cannot replay a foreign tool-call signature.');
235
+ fail(protocol, 'tool_call_signature', 'Foreign tool-call signatures', 'Strip signatures before dialing Responses, or stay on the signing carrier');
186
236
  }
187
237
  if (item.cache) {
188
- validateCache(item.cache, protocol, caps.cache.item_breakpoint === true, 'cache_item_breakpoint', 'Protocol cannot carry an item-level cache breakpoint.', stripCarrierExtensions);
238
+ validateCache(item.cache, protocol, caps.cache.item_breakpoint === true, 'cache_item_breakpoint', 'Item-level cache breakpoints', stripCarrierExtensions);
189
239
  }
190
240
  return;
191
241
  }
192
242
  if (item.type === 'tool_result' && item.isError && protocol !== 'anthropic-messages') {
193
- fail(protocol, 'tool_result_error', 'Protocol cannot preserve the tool result error marker.');
243
+ fail(protocol, 'tool_result_error', 'Tool-result error markers');
194
244
  }
195
245
  if ('cache' in item && item.cache) {
196
- validateCache(item.cache, protocol, caps.cache.item_breakpoint === true, 'cache_item_breakpoint', 'Protocol cannot carry an item-level cache breakpoint.', stripCarrierExtensions);
246
+ validateCache(item.cache, protocol, caps.cache.item_breakpoint === true, 'cache_item_breakpoint', 'Item-level cache breakpoints', stripCarrierExtensions);
197
247
  }
198
248
  for (const part of item.content)
199
249
  validatePart(part, protocol, caps, stripCarrierExtensions);
@@ -201,22 +251,22 @@ function validateItem(item, protocol, caps, stripCarrierExtensions = false, dire
201
251
  function validateOutputPart(part, protocol, caps) {
202
252
  validatePart(part, protocol, caps);
203
253
  if (part.type !== 'extension' && part.type !== 'text' && part.type !== 'refusal') {
204
- fail(protocol, 'output_part', `Protocol output adapter cannot emit ${part.type} content.`);
254
+ fail(protocol, 'output_part', `${part.type} output content`);
205
255
  }
206
256
  if (part.type !== 'text')
207
257
  return;
208
258
  for (const annotation of part.annotations ?? []) {
209
259
  if (annotation.type === 'extension' && annotation.protocol !== protocol) {
210
- fail(protocol, 'annotation', `Protocol cannot convert ${annotation.protocol} annotations.`);
260
+ fail(protocol, 'annotation', `${annotation.protocol} annotations`);
211
261
  }
212
262
  if (protocol === 'anthropic-messages' && (annotation.type !== 'extension' || annotation.protocol !== protocol)) {
213
- fail(protocol, 'annotation', 'Anthropic output requires carrier-native citation payloads.');
263
+ fail(protocol, 'annotation', 'Non-native annotations', 'Anthropic output requires carrier-native citation payloads');
214
264
  }
215
265
  }
216
266
  // Chat logprobs have a token-aligned stream shape that this output adapter
217
267
  // does not synthesize from Responses-span data. Reject instead of dropping.
218
268
  if (isChatProtocol(protocol) && part.logprobs?.length) {
219
- fail(protocol, 'output_logprobs', 'Chat output cannot preserve Responses token log probabilities.');
269
+ fail(protocol, 'output_logprobs', 'Responses token log probabilities on Chat output');
220
270
  }
221
271
  }
222
272
  function validateOutputItem(item, protocol, caps) {
@@ -233,7 +283,7 @@ export function assertCanonicalResponseSupported(response, protocol) {
233
283
  index: 0, status: response.status, ...(response.reason ? { reason: response.reason } : {}), output: response.output,
234
284
  }];
235
285
  if (candidates.length > 1 && !caps.candidates) {
236
- fail(protocol, 'candidates', 'Protocol cannot return multiple candidates.');
286
+ fail(protocol, 'candidates', 'Multiple candidates');
237
287
  }
238
288
  for (const candidate of candidates) {
239
289
  for (const item of candidate.output)
@@ -244,7 +294,7 @@ export function assertCanonicalResponseSupported(response, protocol) {
244
294
  export function assertCanonicalStreamEventSupported(event, protocol) {
245
295
  const caps = capabilitiesFor(protocol);
246
296
  if ((event.candidateIndex ?? 0) !== 0 && !caps.candidates) {
247
- fail(protocol, 'candidates', 'Protocol cannot stream multiple candidates.');
297
+ fail(protocol, 'candidates', 'Streaming multiple candidates');
248
298
  }
249
299
  if (event.type === 'response.output_item.added' || event.type === 'response.output_item.done') {
250
300
  validateOutputItem(event.item, protocol, caps);
@@ -263,10 +313,10 @@ export function assertCanonicalStreamEventSupported(event, protocol) {
263
313
  return;
264
314
  }
265
315
  if ((event.type === 'response.refusal.delta' || event.type === 'response.refusal.done') && !caps.parts.refusal) {
266
- fail(protocol, 'refusal_part', 'Protocol cannot stream refusal content.');
316
+ fail(protocol, 'refusal_part', 'Streaming refusal content');
267
317
  return;
268
318
  }
269
319
  if (event.type.startsWith('response.reasoning_summary') && !caps.reasoningSummary) {
270
- fail(protocol, 'reasoning_summary', 'Protocol cannot stream structured reasoning summaries.');
320
+ fail(protocol, 'reasoning_summary', 'Streaming structured reasoning summaries');
271
321
  }
272
322
  }
@@ -0,0 +1,66 @@
1
+ import { type LocalRunLogLine, type LocalRunSpawnLike } from './runner.js';
2
+ export type BuildJobStatus = 'building' | 'done' | 'failed';
3
+ export interface BuildJob {
4
+ id: string;
5
+ modelId: string;
6
+ engine: string;
7
+ status: BuildJobStatus;
8
+ startedAt: number;
9
+ finishedAt?: number;
10
+ error?: string;
11
+ /** Machine-readable error class for `error` (`build-leg-exited`), so the
12
+ * console localizes instead of showing the backend sentence raw — the same
13
+ * `code` + `error` pair `LocalRun.lastErrorCode` carries (ADR-0046). */
14
+ errorCode?: string;
15
+ }
16
+ /** Test seam, mirroring setLocalRunnerDepsForTests. */
17
+ export declare function setBuildJobDepsForTests(deps: {
18
+ spawnImpl?: LocalRunSpawnLike;
19
+ } | null): void;
20
+ export declare function appendBuildLog(id: string, stream: LocalRunLogLine['stream'], raw: string): void;
21
+ export declare function buildLogs(id: string, limit?: number): LocalRunLogLine[];
22
+ /** Newest first; finished history is capped, building jobs are always listed. */
23
+ export declare function listBuildJobs(): BuildJob[];
24
+ export declare function getBuildJob(id: string): BuildJob | null;
25
+ export type StartBuildResult = {
26
+ ok: true;
27
+ job: BuildJob;
28
+ } | {
29
+ ok: false;
30
+ code: string;
31
+ error: string;
32
+ };
33
+ /**
34
+ * Start one build for one (model, engine). The legs come from the engine's
35
+ * runtime; a refusal (incomplete workspace, missing tool) surfaces as the
36
+ * error rather than spawning something half-formed.
37
+ */
38
+ export declare function startBuildJob(opts: {
39
+ modelId: string;
40
+ engine: string;
41
+ }): Promise<StartBuildResult>;
42
+ /**
43
+ * What a catalog download does next, once its files are on disk.
44
+ *
45
+ * "Downloaded" is not "runnable": a model whose launch input the ENGINE derives
46
+ * (a pack, or the in-place tokenizer) is still `serves: false` until that input
47
+ * exists. Asking the engine's own verdict (`buildable`) is what keeps this
48
+ * engine-agnostic — the gateway never decides by name that a model "needs a
49
+ * pack". `null` means nothing to do: the model already runs, or no engine can
50
+ * derive what it is missing (the console's Pack button covers that case).
51
+ *
52
+ * A start that fails is returned, not thrown, and it changes nothing about the
53
+ * model: `startBuildJob` only registers a job on success, so a failure leaves
54
+ * the model `buildable` and its Pack button in place — that IS the retry path.
55
+ */
56
+ export declare function prepareAfterDownload(model: {
57
+ id: string;
58
+ filePath: string;
59
+ }, engineId: string): Promise<{
60
+ status: 'started';
61
+ jobId: string;
62
+ } | {
63
+ status: 'refused';
64
+ code: string;
65
+ error: string;
66
+ } | undefined>;