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
@@ -6,7 +6,8 @@ import type { ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse
6
6
  import type { ClientAdapter } from '../cli/clients/base.js';
7
7
  import type { QuotaAdapterContext, QuotaProbeOutcome } from '../quota/types.js';
8
8
  import type { ProviderConfig } from '../config/types.js';
9
- import type { AccessTap } from '../forward-proxy/access-log.js';
9
+ import type { AccessTap } from '../ingress-proxy/access-log.js';
10
+ import type { EgressVerdict, PluginEgressMode } from '../utils/proxy.js';
10
11
  /**
11
12
  * OCR plugin system: vendor-specific protocol knowledge (native
12
13
  * transports, signing chains, vendored vendor binaries) lives in USER-INSTALLED
@@ -32,10 +33,19 @@ import type { AccessTap } from '../forward-proxy/access-log.js';
32
33
  */
33
34
  /** The three extension axes a plugin can occupy (ADR-0017 / ADR-0027). */
34
35
  export type PluginType = 'model-service' | 'client-gateway' | 'client-adapter';
35
- /** The outbound leg a gateway declares for the hosts it claims (ADR-0018
36
+ /** The outbound leg a package declares for the traffic it owns (ADR-0018
36
37
  * precedence step 3). `inherit` — the spelling of "absent" — means the
37
- * catch-all row still decides, so declaring a claim changes no routing. */
38
- export type PluginClaimEgress = 'inherit' | 'proxy' | 'direct';
38
+ * catch-all row / the provider-model split still decides, so declaring a leg
39
+ * changes no routing.
40
+ *
41
+ * Same three-state choice the operator's settings switch and a model-service
42
+ * package's `host.fetch` argument speak; there is ONE type for all of them
43
+ * (`PluginEgressMode`), because a second structural declaration would drift the
44
+ * moment either side grew a member (the rule `GatewayRelayTap` follows). The
45
+ * word "claim" is deliberately absent from this name: only a client-gateway
46
+ * claims hosts (ADR-0017), while every package that owns traffic declares a
47
+ * leg. */
48
+ export type PluginDeclaredEgress = PluginEgressMode;
39
49
  /**
40
50
  * One slot a package fills. `wires` belongs to a model-service part, `hosts`
41
51
  * and `egress` to a client-gateway part; a client-adapter part carries none of
@@ -46,14 +56,14 @@ export interface PluginPart {
46
56
  /** Wire names this part provides executors for (e.g. ['qoder']).
47
57
  * Required non-empty on a model-service part, rejected elsewhere. */
48
58
  wires?: string[];
49
- /** SNI hosts this part claims on the forward proxy. Required non-empty on a
59
+ /** SNI hosts this part claims on the ingress proxy. Required non-empty on a
50
60
  * client-gateway part, rejected elsewhere. */
51
61
  hosts?: string[];
52
62
  /** Where the bytes of EXACTLY these hosts leave the machine. Vendor knowledge
53
63
  * ("this endpoint is unreachable direct here"), never an address: the
54
64
  * outbound proxy it means is the operator's `config.proxy`. Rejected on a
55
65
  * wildcard claim, which would pin every host on the machine. */
56
- egress?: PluginClaimEgress;
66
+ egress?: PluginDeclaredEgress;
57
67
  }
58
68
  export interface PluginManifest {
59
69
  id: string;
@@ -80,12 +90,12 @@ export interface PluginManifest {
80
90
  /** Wire names this plugin provides executors for (e.g. ['qoder']).
81
91
  * Single-part form of `parts[].wires`; model-service only. */
82
92
  wires?: string[];
83
- /** SNI hosts this client-gateway claims on the forward proxy (display
93
+ /** SNI hosts this client-gateway claims on the ingress proxy (display
84
94
  * metadata only — the runtime truth is the module's `hosts`). Single-part
85
95
  * form of `parts[].hosts`. */
86
96
  hosts?: string[];
87
97
  /** Outbound leg for the claimed hosts. Single-part form of `parts[].egress`. */
88
- egress?: PluginClaimEgress;
98
+ egress?: PluginDeclaredEgress;
89
99
  /** Plain string, or a locale map ({"zh-CN": …, "en-US": …}) — the console
90
100
  * picks by current UI locale and falls back to en-US / the raw value. */
91
101
  description?: string | Record<string, string>;
@@ -105,6 +115,24 @@ export interface PluginManifest {
105
115
  * (`utils/popularity.ts`) stays host/core-only. */
106
116
  clientRank?: number;
107
117
  logo?: string;
118
+ /** Files/directories THIS package writes under `<ocrHome>/`, relative to that
119
+ * directory (`plugins/workbuddy-auth.json`, `opencode-gateway.env-meta.json`).
120
+ * The uninstall sweep deletes exactly these, so a package can be removed
121
+ * without leaving login tokens, session maps or sidecars behind — and without
122
+ * core guessing at name prefixes.
123
+ *
124
+ * Enumerated by the AUTHOR because only the package knows what it wrote.
125
+ * Accepted: a path inside `plugins/`, or a TOP-LEVEL entry whose name starts
126
+ * with `<id>.` / `<id>-`; a path escaping `<ocrHome>` (`..`, absolute) or a
127
+ * top-level name not prefixed with this id is a manifest error, so a
128
+ * declaration can never reach outside what uninstall owns. A path UNDER
129
+ * `plugins/` that another loaded package ALSO declares (`plugins/clients`,
130
+ * the shared launcher dir every gateway writes its scripts into) is left in
131
+ * place on uninstall — the sweep never deletes a sibling's live state. Keep
132
+ * the legacy-named artifact listed when a file was renamed on disk: an
133
+ * operator state file renamed would orphan a live login (AGENTS.md "plugin
134
+ * ids" rule). */
135
+ state?: string[];
108
136
  /** Provider presets this plugin can pre-provision (shown on the plugins page). */
109
137
  presets?: PluginProviderPreset[];
110
138
  /** Release history shown by the console's Plugins page. Entries
@@ -138,6 +166,61 @@ export interface PluginEntryResult {
138
166
  gateway?: ClientGatewayPlugin;
139
167
  /** The 'client-adapter' part (Client Hub hook). */
140
168
  clientAdapter?: ClientAdapter;
169
+ /**
170
+ * Environment prerequisites THIS package needs in order to be USEFUL on this
171
+ * machine (ADR-0042) — an installed client at a supported version, a vendor
172
+ * CLI, a JBR `keytool`. Optional; absent means "nothing to check".
173
+ *
174
+ * This is the ONLY environment question the host asks, and it answers with
175
+ * FACTS, not a verdict: it never decides whether the package may load, and it
176
+ * is why the report is a list of codes rather than a boolean. Reporting
177
+ * `unknown` for something the probe could not determine is REQUIRED — the
178
+ * alternative (guessing `missing`) is how a probe turns an operator's
179
+ * perfectly good install into a permanent red badge.
180
+ *
181
+ * Every judgment — WHICH binary, where it lives, whether a version is old
182
+ * enough to matter — belongs to the package. The engine contributes only the
183
+ * execution bound, the cache and the rendering, because it holds no
184
+ * vendor knowledge and must not grow any: a path table or a minimum version
185
+ * in core is a fact that only the package can keep true.
186
+ *
187
+ * Codes resolve through the owning manifest's `warningLabels` (each report
188
+ * carries the `params` its `{name}` slots need), so a probe's copy travels
189
+ * with the package like every other piece of its operator-facing text.
190
+ *
191
+ * Probes run on a console read or an explicit refresh — NEVER during
192
+ * `loadInstalledPlugins()`. They are also read-only: looking at local state
193
+ * only. A probe that dials, starts a daemon or mutates anything is a bug.
194
+ */
195
+ environment?(): Promise<PluginEnvironmentReport[]>;
196
+ }
197
+ /**
198
+ * One prerequisite's state on this machine (ADR-0042). `unknown` is a
199
+ * first-class answer and the DEFAULT a caller must assume when a probe fails,
200
+ * times out or returns nothing: it renders as "not checked", never as a
201
+ * failure, so a slow machine can never be mistaken for a broken install.
202
+ *
203
+ * `outdated` exists so "installed but not good enough" never has to be spelled
204
+ * `missing`: the two carry different remedies (upgrade vs install), and
205
+ * collapsing them tells the operator to install something that is already
206
+ * there.
207
+ */
208
+ export interface PluginEnvironmentReport {
209
+ /** A key of the owning manifest's `warningLabels`. */
210
+ code: string;
211
+ /** Defaults to `unknown` when the package omits it. */
212
+ status?: 'present' | 'missing' | 'outdated' | 'unsupported' | 'unknown';
213
+ /** `{name}` slots for the label text. */
214
+ params?: Record<string, string>;
215
+ }
216
+ /** One advisory as the console receives it (ADR-0042): the package's report
217
+ * plus the operator's acknowledgement state. Soft by construction — nothing
218
+ * here can stop a package from loading. */
219
+ export interface PluginEnvironmentAdvisory extends PluginEnvironmentReport {
220
+ /** The operator dismissed this code for the installed VERSION. The badge stops
221
+ * counting it; the answer itself is still delivered (the panel lists it as
222
+ * ignored), so an acknowledgement hides a warning without hiding the fact. */
223
+ acknowledged?: boolean;
141
224
  }
142
225
  /** One group of operator-facing fields. `advanced` moves the whole group behind
143
226
  * a collapsed disclosure: hidden fields keep their values (the same rule as
@@ -155,10 +238,10 @@ export interface PluginConfigSection {
155
238
  * a control, never a layout, ordering or markup: 'text' is the default for a
156
239
  * `string`, 'textarea' a multi-line box, 'model' a single model-ref picker
157
240
  * bound to the gateway catalog, 'models' a multi-pick list of model refs,
158
- * 'aliases' a row table of `client=target[#label]` mapping specs (a client's
241
+ * 'mappings' a row table of `client=target[#label]` mapping specs (a client's
159
242
  * own model id on the left, an OCR model on the right).
160
243
  * A control that cannot drive the field's type fails the manifest. */
161
- export type PluginConfigControl = 'text' | 'textarea' | 'model' | 'models' | 'aliases' | 'segmented' | 'apiKey';
244
+ export type PluginConfigControl = 'text' | 'textarea' | 'model' | 'models' | 'mappings' | 'segmented' | 'apiKey';
162
245
  /** One flat field of a plugin's operator-facing configuration. Primitives
163
246
  * only: the console renders string/number/boolean/string[]/enum inputs
164
247
  * generically. `title`/`desc` follow the manifest locale-map convention. */
@@ -306,11 +389,27 @@ export interface ChatPluginProvider {
306
389
  export interface ModelServicePlugin {
307
390
  /** Build the versioned Chat executor for one declared plugin wire. */
308
391
  createProvider(config: ProviderConfig): ChatPluginProvider;
392
+ /**
393
+ * Declares that EVERY upstream this wire dials goes through `host.fetch`
394
+ * (ADR-0022). The core then resolves the model-scoped proxy split for the
395
+ * wire exactly as it does for the four built-in transports, so the trace can
396
+ * stamp `egress` honestly instead of leaving it UNKNOWN.
397
+ *
398
+ * Absent = UNKNOWN, never `direct`: a plugin that owns its own socket (a
399
+ * spawned vendor daemon, a child process) is not redirected by the core, so
400
+ * the core must not claim a direction for it.
401
+ *
402
+ * Asking for this declaration is not a contract change — it is a new OPTIONAL
403
+ * member, so a package written before it keeps loading and keeps reporting
404
+ * UNKNOWN.
405
+ */
406
+ dialsViaHostFetch?: boolean;
309
407
  /** Model-catalog pull in PullResult shape (auto-pull.ts contract). */
310
408
  pullModels?(id: string, opts: {
311
409
  pattern?: string;
312
410
  ids?: string[];
313
411
  dryRun?: boolean;
412
+ apiKey?: string;
314
413
  }): Promise<{
315
414
  httpStatus: number;
316
415
  body: Record<string, unknown>;
@@ -324,6 +423,18 @@ export interface ModelServicePlugin {
324
423
  httpStatus?: number;
325
424
  authHint?: boolean;
326
425
  upstreamBody?: string;
426
+ /**
427
+ * Where this probe's bytes left (ADR-0018 / ADR-0022 vocabulary), read from
428
+ * `host.egressProxyFor` — the no-dial twin of the `host.fetch` the probe
429
+ * already dialed with. Omitting it is legal (UNKNOWN) but pointless for an
430
+ * in-process wire: the core cannot see the hop, so the plugin is the only
431
+ * party that can report it without guessing. A plugin whose child process
432
+ * owns the socket must leave BOTH unset — the core never claims a direction
433
+ * for a dial it did not make.
434
+ */
435
+ egress?: 'direct' | 'proxy';
436
+ /** Redacted `scheme://host:port`; only with `egress: 'proxy'`. */
437
+ egressProxy?: string;
327
438
  }>;
328
439
  /** Web authorization (device flow) driven from the console connect card —
329
440
  * the plugin is the ONLY owner of its vendor's login protocol; core just
@@ -336,27 +447,51 @@ export interface ModelServicePlugin {
336
447
  authUrl: string;
337
448
  }>;
338
449
  /** Poll the in-flight session once. done+token = login finished and the
339
- * plugin has already persisted its long-lived token bundle. */
450
+ * plugin has already persisted its long-lived token bundle.
451
+ *
452
+ * `label` is the vendor account's display name, when the plugin can read
453
+ * it from the account it just authorized. Core uses it ONLY as the initial
454
+ * name of a NEW credential row (ADR-0006 amendment): a dedup hit keeps the
455
+ * row's existing label, including an operator-cleared one, and the fixed
456
+ * machine-login name is never touched. Advisory and best-effort — a login
457
+ * without it still succeeds, and the row simply stays unnamed. */
340
458
  poll(opts: PluginWebLoginOptions): Promise<{
341
459
  done: boolean;
342
460
  error?: string;
343
461
  token?: string;
462
+ label?: string;
344
463
  }>;
345
464
  /** Optional manual completion for off-box authorization: the operator
346
465
  * opens the authorize URL on another machine (or copies a token from the
347
466
  * vendor console) and pastes the resulting token/code back. Absent = the
348
467
  * vendor flow has no user-visible token — the console hides the paste
349
- * box and relies on poll alone. */
468
+ * box and relies on poll alone. `label` follows the same contract as the
469
+ * poll result above. */
350
470
  submit?(opts: PluginWebLoginOptions & {
351
471
  code: string;
352
472
  }): Promise<{
353
473
  ok: boolean;
354
474
  error?: string;
355
475
  token?: string;
476
+ label?: string;
356
477
  }>;
357
478
  };
358
479
  /** Ordered credential methods for the console connect card (see PluginAuthType). */
359
480
  authTypes?: PluginAuthType[];
481
+ /**
482
+ * Optional: is the login this plugin OWNS usable on this machine right now, and
483
+ * what command would fix it?
484
+ *
485
+ * Only meaningful for a plugin that declares `none` (its own login is a door).
486
+ * The console asks this BEFORE rendering that door's connect action, so an
487
+ * unusable login is stated up front instead of after a write. It must be CHEAP —
488
+ * a stat or a cached read, never a network round trip or a spawned process: it
489
+ * runs while a dialog opens.
490
+ */
491
+ localLogin?(providerId: string): {
492
+ available: boolean;
493
+ command?: string;
494
+ };
360
495
  /**
361
496
  * Quota-check capability (ADR-0009 L-e — plugin knowledge layer). A plugin
362
497
  * that knows its vendor's usage endpoint declares it here; the quota
@@ -445,6 +580,19 @@ export interface ModelServicePluginHost {
445
580
  errorBody?: string;
446
581
  provider?: string;
447
582
  };
583
+ /**
584
+ * The client-fault refusal for a request this wire cannot represent
585
+ * faithfully (ADR prompt-integrity gate): `400 unsupported_parameter` on
586
+ * every surface, never a silent drop. The class identity matters — the
587
+ * orchestrator's pool/explicit error paths test `instanceof`, so a plugin
588
+ * MUST throw this injected class rather than an object shaped like it.
589
+ */
590
+ IrUnsupportedError: new (code: string, message: string, protocol?: string) => Error & {
591
+ readonly code: string;
592
+ readonly statusCode: number;
593
+ readonly protocol?: string;
594
+ readonly name: string;
595
+ };
448
596
  /** Capture-plane emitters — same contract as observability/upstream-events.ts. */
449
597
  upstream: {
450
598
  requestOnce(ctx: unknown, args: {
@@ -476,7 +624,9 @@ export interface ModelServicePluginHost {
476
624
  failureGuard(ctx: unknown, exchangeId: string | undefined, url: string, method: string, fn: () => Promise<unknown>, model?: string): Promise<unknown>;
477
625
  };
478
626
  constants: {
479
- /** Per-attempt upstream wall-clock cap (config default). */
627
+ /** Per-STEP upstream wall-clock cap for plugin wires (config default). The
628
+ * plugin enforces it with no progress renewal, so it tracks the streamed
629
+ * leg cap (60 min), never the smaller buffered one. */
480
630
  providerTimeoutMs: number;
481
631
  };
482
632
  /** Operator configuration, merged (defaults ← stored artifact, validated).
@@ -493,10 +643,10 @@ export interface ModelServicePluginHost {
493
643
  * must resolve them from here (ADR-0017 §6). */
494
644
  pluginDir(): string;
495
645
  /**
496
- * Egress-aware `fetch` — the ONLY way a model-service plugin may reach its
497
- * upstream (ADR-0022). Wraps the core's `proxiedFetch`, so the operator's
498
- * `proxy.includes` / `proxy.excludes` split, `proxy.enabled`, the
499
- * `manual`/`mihomo` endpoint choice and the loopback bypass all apply to
646
+ * Egress-aware `fetch` — the ONLY way a model-service plugin may DIAL its
647
+ * upstream through the core (ADR-0022). Wraps the core's `proxiedFetch`, so
648
+ * the operator's `proxy.includes` / `proxy.excludes` split, `proxy.enabled`,
649
+ * the `manual`/`mihomo` endpoint choice and the loopback bypass all apply to
500
650
  * plugin wires exactly as they do to the four core transports.
501
651
  *
502
652
  * A plugin that calls the global `fetch` itself bypasses every one of those:
@@ -506,21 +656,70 @@ export interface ModelServicePluginHost {
506
656
  * this seam instead.
507
657
  *
508
658
  * `match` carries the logical caller so the include/exclude lists can
509
- * evaluate provider- and model-scoped patterns. Omitting it makes the split
510
- * answer `undefined` (allowlist needs a match), which is why every real call
511
- * passes one.
659
+ * evaluate provider- and model-scoped patterns. Omitting it answers DIRECT
660
+ * with `reason: 'no-target'` (an allowlist needs a caller to test), which is
661
+ * why every real call passes one.
662
+ *
663
+ * `egress` is this package's own answer about the leg, applied BEFORE the
664
+ * split is read (ADR-0022 amendment). Omit it (`inherit`) and the split
665
+ * decides alone — that is the default, and what every call written before
666
+ * this argument existed gets. `'proxy'` names the operator's outbound proxy
667
+ * (the endpoint an `includes` hit would resolve to, never an address); with
668
+ * no usable endpoint it is a REFUSAL (502), never a silent direct dial.
669
+ * `'direct'` states the package needs no proxy.
512
670
  */
513
671
  fetch: (url: string, init?: RequestInit, match?: {
514
672
  provider?: string;
515
673
  model?: string;
516
- }) => Promise<Response>;
517
- /** Resolve the proxy this plugin WOULD take for `url`, without dialing —
518
- * `undefined` means direct. Lets a plugin report its egress in a `probe()`
519
- * result without duplicating the matching rules core-side. */
520
- resolveProxy: (url: string, match?: {
674
+ }, egress?: PluginEgressMode) => Promise<Response>;
675
+ /**
676
+ * The operator's outbound leg for ONE target, as FACTS: whether the split
677
+ * selects the proxy, why it did or did not, and where that proxy is. The
678
+ * plugin decides how to dial — a vendor daemon the core cannot reach can be
679
+ * pointed at `url` by the plugin that owns it, while an in-process wire keeps
680
+ * handing its requests to `fetch` above.
681
+ *
682
+ * The `For` suffix is the host SDK's convention for "compute X for y": this
683
+ * method takes a discriminant (`target` + `match` + `egress`) that decides
684
+ * which leg comes back, while the no-argument getters beside it
685
+ * (`ocrHome`, `pluginDir`, `config`, `ingressProxy`) name the value itself.
686
+ * It also keeps the METHOD distinct from the `egressProxy: string` field a
687
+ * `probe()` reports.
688
+ *
689
+ * Not to be confused with `ClientAdapterHost.ingressProxy()`, which is the
690
+ * INBOUND listener's endpoint handed to a Client Hub hook. The two are not an
691
+ * "inbound/outbound" pair and live on different SDKs: `ingressProxy()` says
692
+ * which socket THIS gateway opens, while this method answers where one of the
693
+ * package's OWN dials exits (see ADR-0036 Amendment 2 for the full plane
694
+ * breakdown). The ingress proxy's real `ingress` / `egress` pair (ADR-0018)
695
+ * describes ONE transit connection and is unrelated to either method.
696
+ *
697
+ * Never returns "unknown": `mode` is always decided, and `reason` names the
698
+ * single cause, so a `probe()` reports a true leg instead of inferring one
699
+ * from an absent field. `reason: 'plugin'` marks a leg the plugin-level
700
+ * answer decided, which lets the console tell "the split named me" from "the
701
+ * switch did".
702
+ *
703
+ * `egress` is the same optional answer `fetch` takes, with the same
704
+ * precedence, and it defaults to FOLLOW — this method is the NO-DIAL twin, and
705
+ * a daemon-backed plugin has no other way to ask (ADR-0022: "the leg as FACTS
706
+ * so the plugin can point it at the operator's proxy itself").
707
+ *
708
+ * `url` is the DIALABLE endpoint, userinfo included. It is never persisted,
709
+ * never logged (use `origin`), and never handed to a process OCR does not own
710
+ * — a credential-bearing proxy URL written into a third-party child process
711
+ * escapes the key lifecycle in ADR-0006, so that combination is documented as
712
+ * unsupported, never silently attempted.
713
+ *
714
+ * This is the provider/model axis only. Host-mapped rules (`ingressProxy.rules`)
715
+ * govern traffic that passes THROUGH the gateway, and `reject` is an admission
716
+ * verdict on that path — neither reaches a plugin's own dial, which is why the
717
+ * answer here is advisory rather than a gate the core can enforce.
718
+ */
719
+ egressProxyFor(target: string, match?: {
521
720
  provider?: string;
522
721
  model?: string;
523
- }) => string | undefined;
722
+ }, egress?: PluginEgressMode): EgressVerdict;
524
723
  /** Model-pull services (the auto-pull.ts seams, host-implemented). */
525
724
  pull: {
526
725
  getProviderNode(id: string): {
@@ -544,7 +743,7 @@ export interface ModelServicePluginHost {
544
743
  /**
545
744
  * Client-gateway plugin contract (the second plugin type, ADR-0017).
546
745
  *
547
- * A gateway claims whole SNI hosts on the inbound forward proxy and handles
746
+ * A gateway claims whole SNI hosts on the inbound ingress proxy and handles
548
747
  * the DECRYPTED traffic of those hosts itself — native Connect/protobuf
549
748
  * wires (Cursor) etc. It sees node-http req/res on the h1 leg and the
550
749
  * http2 compatibility API (same shape) on the h2 leg; `handle` owns the
@@ -611,7 +810,7 @@ export interface ClientGatewayPlugin {
611
810
  */
612
811
  egressFor?(info: {
613
812
  host: string;
614
- }): PluginClaimEgress | undefined;
813
+ }): PluginDeclaredEgress | undefined;
615
814
  }
616
815
  /** One decrypted `Upgrade:` handshake handed to a client gateway. */
617
816
  export interface ClientGatewayUpgradeContext {
@@ -657,6 +856,57 @@ export type GatewayRelayTap = AccessTap;
657
856
  * (same rule as ModelServicePluginHost: a packaged plugin never imports
658
857
  * backend modules by path).
659
858
  */
859
+ /**
860
+ * A client-gateway plugin's view of ONE addressed id's capabilities.
861
+ *
862
+ * The catalog is where a vendor client learns what a model can do before it
863
+ * shows a picker — its context budget, whether a thinking level exists, which
864
+ * levels, whether it takes an image. A gateway that fabricates those rows from
865
+ * constants lies to the client: a 1M-context model is advertised at 200K (so
866
+ * the client compacts early) and a reasoning model exposes no level at all (so
867
+ * the operator cannot pick one). Every field here is OPTIONAL and `undefined`
868
+ * means "not stated" — never "false", never a default to invent.
869
+ */
870
+ export interface GatewayCatalogCapabilities {
871
+ /** Prompt window in tokens (models.dev `limit.context`). */
872
+ contextWindow?: number;
873
+ /** Max output tokens (models.dev `limit.output`). */
874
+ maxOutputTokens?: number;
875
+ /** Accepts image input. */
876
+ vision?: boolean;
877
+ /**
878
+ * The model reasons at all (models.dev `reasoning`, or a declared
879
+ * `reasoning_options` table). DISTINCT from `supportedEfforts`: a reasoning
880
+ * model can have no level control (toggle-only) and still think. `undefined`
881
+ * = not stated; `false` = the catalog says it does not reason.
882
+ */
883
+ thinking?: boolean;
884
+ /**
885
+ * The effort levels this id will actually serve, ascending. Absent = the id
886
+ * has no explicit level control (a non-reasoning model, or one that only
887
+ * toggles on/off); a non-empty array means a picker may offer exactly these.
888
+ * `none` is included ONLY when the vendor allows thinking-off.
889
+ */
890
+ supportedEfforts?: readonly string[];
891
+ /**
892
+ * Pinned effort siblings (`<id>-<variant>` / `<id>#<variant>`) the registry
893
+ * exposes. Each is routable on its own and pins its level, so a client that
894
+ * renders per-configuration rows can offer them without a level control —
895
+ * the same shape real vendor catalogs publish.
896
+ */
897
+ variants?: Array<{
898
+ id: string;
899
+ effort: string;
900
+ }>;
901
+ /**
902
+ * The level this id serves when the client sends NONE — the registration's
903
+ * `defaultEffort` pin, clamped onto `supportedEfforts` exactly as the
904
+ * pipeline would clamp it. Absent = no pin (the vendor's own default
905
+ * governs), which is distinct from "the lowest level": a picker that has to
906
+ * pre-select something must not invent a level the operator never chose.
907
+ */
908
+ defaultEffort?: string;
909
+ }
660
910
  /** Routing surface exposed to a client-gateway plugin. */
661
911
  export interface GatewayCatalog {
662
912
  /** Virtual model ids in canonical order (auto/lite/plus/pro/ultra). */
@@ -666,6 +916,41 @@ export interface GatewayCatalog {
666
916
  id: string;
667
917
  label?: string;
668
918
  }[];
919
+ /**
920
+ * Capabilities keyed by gateway-visible id (virtual ids and registered ids
921
+ * alike). ONE map, not a field on each entry: the advertised id is the
922
+ * lookup key at request time, and a virtual alias has no entry of its own in
923
+ * `models`. An id absent from the map is "not stated".
924
+ */
925
+ capabilities?: Record<string, GatewayCatalogCapabilities>;
926
+ }
927
+ /**
928
+ * What a gateway-visible id means to the routing ladder, WITHOUT selecting a
929
+ * member or advancing a rotation cursor (`resolveModel`, ADR-0003).
930
+ *
931
+ * Explicit kinds (`registered` / `variant` / `legacy`) name one physical model.
932
+ * Virtual kinds (`tier` / `combo` / `auto`) resolve their member per request,
933
+ * so they carry no `modelId` until the reservation seam lands.
934
+ */
935
+ export interface GatewayModelResolution {
936
+ kind: 'registered' | 'variant' | 'legacy' | 'tier' | 'combo' | 'auto' | 'unresolved' | 'unknown';
937
+ /** The id the caller asked for, echoed verbatim. */
938
+ rawModelId?: string;
939
+ /** Physical model id (what the ladder expanded the ref to) — explicit kinds only. */
940
+ factModelId?: string;
941
+ provider?: string;
942
+ wire?: string;
943
+ /**
944
+ * Catalog display name (`models.dev` `name`) looked up by `factModelId` in
945
+ * the provider defs, when the catalog states one. Absent = not stated —
946
+ * never a guess. Lets a gateway recognize a model whose ids are both opaque
947
+ * deployment aliases.
948
+ */
949
+ factModelName?: string;
950
+ /** Variant id when `kind === 'variant'`. */
951
+ variantId?: string;
952
+ /** Human-readable reason when the id is malformed or its combo is unusable. */
953
+ error?: string;
669
954
  }
670
955
  export interface ClientGatewayHost {
671
956
  log(...args: unknown[]): void;
@@ -685,9 +970,17 @@ export interface ClientGatewayHost {
685
970
  chat(body: Record<string, unknown>, sink: GatewayChatSink, signal?: AbortSignal): Promise<void>;
686
971
  /** Current routing surface for AvailableModels-style fabrication. */
687
972
  catalog(): GatewayCatalog;
973
+ /**
974
+ * Describe what a gateway-visible id addresses, using the SAME ladder the
975
+ * chat pipeline executes. Pure and draw-free: it reads the registry and
976
+ * never advances a tier/combo rotation cursor. Optional so a plugin stays
977
+ * loadable against a host that predates it (callers fall back to the
978
+ * vendor-neutral metadata pair).
979
+ */
980
+ resolveModel?(modelId: string): GatewayModelResolution;
688
981
  /**
689
982
  * Relay a decrypted exchange upstream through the CORE transport policy:
690
- * `forwardProxy.rules` egress (direct / `proxy.url`) and upstream TLS trust
983
+ * `ingressProxy.rules` egress (direct / `proxy.url`) and upstream TLS trust
691
984
  * (ADR-0019), re-originating h2 faithfully with an h1 fallback. The gateway
692
985
  * owns capture via `tap`; it must never dial an origin itself.
693
986
  *
@@ -731,7 +1024,7 @@ export interface ClientGatewayHost {
731
1024
  * A client adapter is the Client Hub hook for ONE client — the thing that
732
1025
  * writes a proxy env, a launcher script or a config file so a tool talks to the
733
1026
  * gateway. It is self-contained runtime code plus the small facts only the host
734
- * knows: where OCR lives, what the LIVE forward-proxy endpoint is, and where
1027
+ * knows: where OCR lives, what the LIVE ingress-proxy endpoint is, and where
735
1028
  * the MITM CA sits. Everything else (spawning the client's CLI, parsing its
736
1029
  * output, sidecar files) the plugin does itself, which is what makes a third
737
1030
  * party able to add a client without a core release.
@@ -750,26 +1043,31 @@ export interface ClientAdapterHost {
750
1043
  /** Operator configuration, merged and validated (defaults ← stored artifact). */
751
1044
  config(): Record<string, unknown>;
752
1045
  /**
753
- * The INBOUND forward-proxy endpoint from the runtime config snapshot, or
754
- * `null` when `forwardProxy` is disabled. Resolved from the live snapshot,
1046
+ * The INBOUND ingress-proxy endpoint from the runtime config snapshot, or
1047
+ * `null` when `ingressProxy` is disabled. Resolved from the live snapshot,
755
1048
  * never a fresh config read, so the advertised port is the one the running
756
1049
  * proxy actually listens on.
1050
+ *
1051
+ * There is deliberately NO credential field (ADR-0008 §3): the inbound proxy
1052
+ * authenticates nobody and binds loopback only, so a launcher must never
1053
+ * embed a key in the proxy URL. The retired `requireCredential` was removed
1054
+ * outright rather than pinned to `false` — a package still branching on it
1055
+ * fails `typecheck-plugins` with the exact line, which is the point.
757
1056
  */
758
- forwardProxy(): {
1057
+ ingressProxy(): {
759
1058
  url: string;
760
1059
  port: number;
761
1060
  caPath: string;
762
- requireCredential: boolean;
763
1061
  } | null;
764
1062
  /** The MITM CA path this install uses, resolved even when the proxy is off. */
765
1063
  caCertPath(): string;
766
1064
  /**
767
- * Is the inbound forward proxy LISTENING right now? A hook is only usable
1065
+ * Is the inbound ingress proxy LISTENING right now? A hook is only usable
768
1066
  * while it is, and the answer is runtime state the host owns (the proxy's
769
1067
  * module singleton). A packaged adapter cannot derive it from the endpoint:
770
- * `forwardProxy()` reports configuration, not liveness.
1068
+ * `ingressProxy()` reports configuration, not liveness.
771
1069
  */
772
- forwardProxyStatus(): {
1070
+ ingressProxyStatus(): {
773
1071
  running: boolean;
774
1072
  port?: number;
775
1073
  host?: string;
@@ -831,6 +1129,45 @@ export interface ClientAdapterHost {
831
1129
  }): {
832
1130
  key: string;
833
1131
  } | null;
1132
+ /**
1133
+ * Egress-aware `fetch` — the ONLY way a hook may DIAL an external host
1134
+ * (ADR-0022, same contract as `ModelServicePluginHost.fetch`).
1135
+ *
1136
+ * A hook that downloads a vendor artifact (a JetBrains agent archive, a
1137
+ * client bundle) makes a REAL outbound request, and the global `fetch` it
1138
+ * would otherwise reach for ignores every part of the operator's egress
1139
+ * policy: `proxy.enabled`, the provider/model split, and this package's own
1140
+ * leg switch. On a filtered network that is the difference between "setup
1141
+ * works" and an unexplainable timeout, and the console has no way to see the
1142
+ * hop the core never made.
1143
+ *
1144
+ * `match` carries the logical caller for the include/exclude lists (absent =
1145
+ * no provider-scoped rule matches, so only the switch can select the proxy);
1146
+ * `egress` is this package's own answer about the leg, applied before the
1147
+ * split is read. Omitting both reproduces the historical behavior.
1148
+ *
1149
+ * OPTIONAL, so a hook written before this seam keeps working on any host:
1150
+ * a package must fall back to the global `fetch` when it is absent (an older
1151
+ * gateway), and the call site should say why in a comment. Adding it is
1152
+ * additive — `PLUGIN_ENGINE_VERSION` does not move.
1153
+ */
1154
+ fetch?(url: string, init?: RequestInit, match?: {
1155
+ provider?: string;
1156
+ model?: string;
1157
+ }, egress?: PluginEgressMode): Promise<Response>;
1158
+ /**
1159
+ * The gateway catalog with per-id capabilities — the same snapshot the
1160
+ * gateway half of a multi-part package sees (`ClientGatewayHost.catalog()`).
1161
+ *
1162
+ * A client-adapter hook that materializes model files into a vendor client
1163
+ * (the jetbrains Junie profiles) needs the declared window per gateway id:
1164
+ * the vendor stores ONE `maxContextLength`, and a blanket default truncates
1165
+ * a 1M-context rung. OPTIONAL like `fetch?`: absent (an older gateway, or a
1166
+ * package whose runtime host is adapter-only) means fall back to the
1167
+ * package default, never a crash. Additive — `PLUGIN_ENGINE_VERSION` does not
1168
+ * move.
1169
+ */
1170
+ catalog?(): GatewayCatalog;
834
1171
  }
835
1172
  /** Text or locale map — the same shape `description` / `warningLabels` use;
836
1173
  * `{param}` placeholders interpolate like the warning labels do. */
@@ -883,5 +1220,33 @@ export interface PluginView {
883
1220
  * but the cause and the remedy differ: the fix is a newer gateway or a
884
1221
  * newer package, never the disable switch. */
885
1222
  incompatible?: boolean;
1223
+ /**
1224
+ * What this package's `environment()` reported on the last probe (ADR-0042) —
1225
+ * a SEPARATE axis from `incompatible`, deliberately:
1226
+ *
1227
+ * - `incompatible` is a fact about CODE (the package and this engine
1228
+ * disagree about the plugin surface). It is decided from the manifest
1229
+ * before any import, the fix is an upgrade of one side, and the row is
1230
+ * DISABLED.
1231
+ * - this is a fact about THIS MACHINE (a client is not installed, a vendor
1232
+ * CLI is missing). The package loads and works for whatever does not need
1233
+ * the missing piece; the fix is an operator action on the machine, and the
1234
+ * row stays LOADED.
1235
+ *
1236
+ * Absent means "not probed yet" as well as "nothing to report" — the console
1237
+ * renders the badge from `reports` only, so the two need no distinction.
1238
+ */
1239
+ environment?: PluginEnvironmentState;
1240
+ }
1241
+ /** One package's last environment answer (ADR-0042). `checkedAt` is what makes
1242
+ * a stale report honest: the console can say "checked 12 minutes ago" instead
1243
+ * of presenting a cached fact as live truth. */
1244
+ export interface PluginEnvironmentState {
1245
+ reports: PluginEnvironmentAdvisory[];
1246
+ /** Wall-clock ms of the probe that produced `reports`. */
1247
+ checkedAt: number;
1248
+ /** True when the answer came from cache after a failed/expired refresh
1249
+ * (stale-while-revalidate): the values are the previous probe's. */
1250
+ stale?: boolean;
886
1251
  }
887
1252
  export type { CallCredential };