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
package/README.md CHANGED
@@ -127,20 +127,20 @@ ocr restart # Restart gateway daemon
127
127
  # Client integrations (one-command setup)
128
128
  ocr setup claude # Hook Claude Code to route via OCR
129
129
  ocr setup codex # Hook Codex / OpenAI CLI to route via OCR
130
- ocr setup cursor-proxy # Hook Cursor via the OCR forward proxy + the cursor-gateway plugin (install it from the console first)
130
+ ocr setup cursor-proxy # Hook Grok Build (formerly Cursor) via the OCR ingress proxy + the cursor-gateway plugin (install it from the console first)
131
131
  ocr setup dsh # Hook DeepSeek Harness to route via OCR
132
132
  ocr setup opencode # Hook OpenCode to route via OCR
133
133
  ocr setup pi # Hook Pi coding agent to route via OCR
134
134
  ocr setup openclaw # Hook OpenClaw to route via OCR
135
135
  ocr setup omp # Hook OMP (oh-my-pi) to route via OCR
136
136
  ocr setup kimi # Hook Kimi Code CLI to route via OCR
137
- ocr setup grok # Hook Grok CLI to route via OCR
137
+ ocr setup grok # Hook Grok Build CLI to route via OCR
138
138
  ocr setup workbuddy # Hook WorkBuddy (models.json custom models) to route via OCR
139
- ocr setup qoder-proxy # Hook Qoder via the OCR forward proxy + the qoder-gateway plugin (install it from the console first)
139
+ ocr setup qoder-proxy # Hook Qoder via the OCR ingress proxy + the qoder-gateway plugin (install it from the console first)
140
140
 
141
141
  # Launch through the OCR-managed launchers (after setup)
142
- ocr cursor # Start the Cursor IDE with the proxy env applied
143
- ocr cursor-agent # Run the cursor-agent CLI with the proxy env applied
142
+ ocr cursor # Start the Grok Build desktop app (formerly Cursor) with the proxy env applied
143
+ ocr cursor-agent # Run the Grok Build CLI (legacy `cursor-agent`) with the proxy env applied
144
144
  ocr qoder # Start the Qoder desktop app with the proxy env applied
145
145
  ocr qoder-cli # Run the Qoder CLI with the proxy env applied
146
146
 
@@ -149,7 +149,7 @@ ocr teardown opencode # Restore OpenCode to direct connection
149
149
  ocr teardown claude # Restore Claude to direct connection
150
150
  ```
151
151
 
152
- Plugins are **optional and never distributed** with the app: the forward-proxy integrations
152
+ Plugins are **optional and never distributed** with the app: the ingress-proxy integrations
153
153
  (`cursor-gateway`, `qoder-gateway`, `jetbrains-gateway`, OpenCode proxy mode) and the model
154
154
  services (`qoder-models`, `workbuddy-models`) are installed from the console's **Plugins** page
155
155
  (upload the zip from `bun run plugins:build` -> `.plugin-dist/`), never shipped in the installer
@@ -256,7 +256,7 @@ Clients can request models through four distinct addressing modalities (ADR-0003
256
256
  | **`plus`** | Forced Virtual Tier | Serves exclusively from the `plus` workhorse pool (~$2.00 ~ $3.00 / M tokens). Default general-purpose engineering baseline. |
257
257
  | **`pro`** | Forced Virtual Tier | Serves exclusively from the `pro` reasoning specialist pool (~$3.00 ~ $8.00 / M tokens) for deep mathematical proofs and complex refactors. |
258
258
  | **`ultra`** | Forced Virtual Tier | Serves from the `ultra` frontier tier (≥ $8.00 / M tokens) for large-scale multi-file codebases and complex autonomous agent loops. |
259
- | *Custom Combos* | Virtual Model Sets | Composed model groups with configured selection strategies (`priority`, `weighted`, `round_robin`). Fails over strictly within combo members. |
259
+ | *Custom Combos* | Virtual Model Sets | Composed model groups with configured selection strategies (`priority` = config-order head, `weighted_round_robin` = smooth weighted rotation, `round_robin` = equal rotation ignoring weights). Fails over strictly within combo members. |
260
260
  | *Direct Physical Models* | Direct Passthrough | Any registered upstream physical identifier (e.g. `deepseek-chat`, `claude-3-7-sonnet-20250219`). Bypasses tier arbitration. |
261
261
 
262
262
  ---
@@ -357,6 +357,25 @@ Every proxied response carries diagnostic metadata:
357
357
 
358
358
  ---
359
359
 
360
+ ## Plugins: Installing and Publishing
361
+
362
+ OCR ships no plugins (ADR-0032) — an integration is something the operator adds.
363
+ The console's **Plugin Market** reads a registry of GitHub repositories, shows one
364
+ card per plugin, and installs the package that repository publishes (or builds it
365
+ from source, per the entry's `method`). Installed plugins are monitored against
366
+ their repositories, and upgrades land through the same install pipeline.
367
+
368
+ If you are writing a plugin, or want your own repository listed in the market:
369
+
370
+ **→ [Writing a Plugin and Publishing It to the Plugin Market](docs/design/plugin-authoring.md)**
371
+ ([中文](docs/design/zh-CN/plugin-authoring.md))
372
+
373
+ That guide covers the manifest contract, the packaged-entry rules, the two
374
+ acquisition methods (`release` / `code`), and how to propose a `plugins/registry.json`
375
+ entry.
376
+
377
+ ---
378
+
360
379
  ## Frequently Asked Questions
361
380
 
362
381
  ### Q1: Does OmniCellRouter require duplicating API keys across configs?
package/README.zh-CN.md CHANGED
@@ -117,20 +117,20 @@ ocr restart # 重启后台网关
117
117
  # 一键挂载各大客户端代理
118
118
  ocr setup claude # 将 Claude Code / Claude Desktop 接入 OCR
119
119
  ocr setup codex # 将 Codex / OpenAI CLI 接入 OCR
120
- ocr setup cursor-proxy # 通过 OCR 前置代理 + Cursor Gateway 插件接入 Cursor
120
+ ocr setup cursor-proxy # 通过 OCR 前置代理 + cursor-gateway 插件接入 Grok Build(原 Cursor)
121
121
  ocr setup dsh # 将 DeepSeek Harness 接入 OCR
122
122
  ocr setup opencode # 将 OpenCode 路由无缝接入 OCR
123
123
  ocr setup pi # 将 Pi 接入 OCR
124
124
  ocr setup openclaw # 将 OpenClaw 接入 OCR
125
125
  ocr setup omp # 将 OMP (oh-my-pi) 接入 OCR
126
126
  ocr setup kimi # 将 Kimi Code CLI 接入 OCR
127
- ocr setup grok # 将 Grok CLI 接入 OCR
127
+ ocr setup grok # 将 Grok Build CLI 接入 OCR
128
128
  ocr setup workbuddy # 将 WorkBuddy(models.json 自定义模型)接入 OCR
129
129
  ocr setup qoder-proxy # 通过 OCR 前置代理 + qoder-gateway 插件接入 Qoder
130
130
 
131
131
  # 通过 OCR 托管的启动脚本运行(setup 之后)
132
- ocr cursor # 以代理环境启动 Cursor IDE
133
- ocr cursor-agent # 以代理环境运行 cursor-agent CLI
132
+ ocr cursor # 以代理环境启动 Grok Build 桌面版(原 Cursor)
133
+ ocr cursor-agent # 以代理环境运行 Grok Build CLI(旧名 cursor-agent)
134
134
  ocr qoder # 以代理环境启动 Qoder 桌面版
135
135
  ocr qoder-cli # 以代理环境运行 qodercli CLI
136
136
 
@@ -247,7 +247,7 @@ main();
247
247
  | **`auto-plus`** | 强制主力梯队 | 强制路由至 `plus` 标准主力池(~$2.00 ~ $3.00 / M tokens),默认通用工程代码主力基准线。 |
248
248
  | **`auto-pro`** | 强制专家梯队 | 强制路由至 `pro` 深度推理专家池(~$3.00 ~ $8.00 / M tokens),解决数学推演、长上下文架构重构。 |
249
249
  | **`auto-ultra`** | 强制前沿梯队 | 强制路由至 `ultra` 前沿顶尖池(≥ $8.00 / M tokens),支撑多文件全自主智能体长循环。 |
250
- | *Custom Combos* | 自定义组合池 | 依照设定策略(`priority`, `weighted`, `round_robin`)在组合成员内分发,成员故障严格在池内故障转移。 |
250
+ | *Custom Combos* | 自定义组合池 | 依照设定策略(`priority` = 配置序链首, `weighted_round_robin` = 平滑加权轮转, `round_robin` = 等权轮转且忽略权重)在组合成员内分发,成员故障严格在池内故障转移。 |
251
251
  | *物理模型* | 直连穿透调用 | 任意已注册物理模型名(如 `deepseek-chat`, `kimi-k2.7-code`),绕过梯队仲裁直接透传上游。 |
252
252
 
253
253
  ---
@@ -348,6 +348,19 @@ main();
348
348
 
349
349
  ---
350
350
 
351
+ ## 插件:安装与投稿
352
+
353
+ OCR **不随发行携带任何插件**(ADR-0032)——集成是运维方自己添加的。控制台的**插件市场**读取一份 GitHub 仓库注册表,每个插件一张卡片,安装该仓库发布的包(或按条目声明的 `method` 从源码构建)。已安装插件会与其仓库比对监测,升级走同一条安装管线。
354
+
355
+ 如果你在编写插件,或想把自己的仓库列入市场:
356
+
357
+ **→ [编写插件并把自有插件仓库注册到 OCR 插件市场](docs/design/zh-CN/plugin-authoring.md)**
358
+ ([English](docs/design/plugin-authoring.md))
359
+
360
+ 该指南涵盖清单契约、打包入口规则、两种获取方式(`release` / `code`),以及如何提交 `plugins/registry.json` 条目。
361
+
362
+ ---
363
+
351
364
  ## 常见问题
352
365
 
353
366
  ### Q1: OmniCellRouter 需要在配置文件中重复填写各大厂商 API Key 吗?
@@ -168,6 +168,14 @@ export function updateApiKey(id, updates) {
168
168
  if (!saveResult.success) {
169
169
  return { success: false, error: saveResult.error || 'Failed to persist API Key changes' };
170
170
  }
171
+ // Follow catalogs snapshot this key's allowed model ids — only a modelAccess
172
+ // change rewrites that list. enabled / expiresAt affect auth usability only
173
+ // (calls already fail); same rationale as deleteApiKey (no sync).
174
+ if (updates.modelAccess !== undefined) {
175
+ void import('../cli/clients/follow-catalog-sync.js')
176
+ .then((m) => m.requestFollowCatalogSync({ reason: 'key', keyId: id }))
177
+ .catch(() => { });
178
+ }
171
179
  return { success: true, data: updated };
172
180
  }
173
181
  /**
@@ -184,5 +192,8 @@ export function deleteApiKey(id) {
184
192
  if (!saveResult.success) {
185
193
  return { success: false, error: saveResult.error || 'Failed to remove API Key from config' };
186
194
  }
195
+ // No follow-catalog sync on delete: inbound calls already fail at auth, and
196
+ // the sync pass cannot rewrite a catalog without a usable key — it would only
197
+ // paint card issues. Operator tears down / re-hooks when ready.
187
198
  return { success: true };
188
199
  }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Effective model view for ONE API key — what the key can see & use right now.
3
+ * Shared by the admin preview (`GET /api/admin/api-keys/:id/models`) and the
4
+ * follow-catalog auto-resync path so both snapshots stay identical.
5
+ */
6
+ import type { ProviderRegistry } from '../providers/registry.js';
7
+ export type KeyModelRow = {
8
+ id: string;
9
+ kind: 'auto' | 'tier' | 'combo' | 'model' | 'variant';
10
+ provider: string;
11
+ tiers?: string[];
12
+ tier?: string;
13
+ virtual: boolean;
14
+ allowed: boolean;
15
+ };
16
+ export type KeyModelsView = {
17
+ status: 'ok';
18
+ mode: string;
19
+ policyModels: string[];
20
+ models: KeyModelRow[];
21
+ };
22
+ export type KeyModelsLookupError = {
23
+ status: 'error';
24
+ message: string;
25
+ };
26
+ /**
27
+ * Build the effective catalog for `keyId`. Returns an error shape when the key
28
+ * is unknown so callers can map to 404 without re-implementing the lookup.
29
+ */
30
+ export declare function buildKeyModelsView(keyId: string, registry: ProviderRegistry): KeyModelsView | KeyModelsLookupError;
31
+ /** Allowed concrete / virtual ids for a follow-mode snapshot. */
32
+ export declare function allowedFollowLists(view: KeyModelsView): {
33
+ extraModels: string[];
34
+ virtualModels: string[];
35
+ allAllowedIds: string[];
36
+ };
@@ -0,0 +1,99 @@
1
+ import { listApiKeys } from './api-keys.js';
2
+ import { getModelAccessPolicy, isAutoEntryUsable, isModelAllowed, isModelAllowedInTiers, tierFromVirtualEntry, } from './model-access.js';
3
+ /**
4
+ * Build the effective catalog for `keyId`. Returns an error shape when the key
5
+ * is unknown so callers can map to 404 without re-implementing the lookup.
6
+ */
7
+ export function buildKeyModelsView(keyId, registry) {
8
+ const key = listApiKeys(false).find((k) => k.id === keyId);
9
+ if (!key) {
10
+ return { status: 'error', message: `API Key '${keyId}' not found` };
11
+ }
12
+ const policy = getModelAccessPolicy(key);
13
+ const registered = registry.getAllModels().map((m) => ({
14
+ id: m.id,
15
+ kind: 'model',
16
+ provider: m.provider,
17
+ // FULL membership set (pools are a per-tier projection — a model may
18
+ // belong to several tiers): tierAllowed counts every pool the model can
19
+ // route toward, so auto-X viability never misses a multi-pool member.
20
+ tiers: registry.tiersOf(m),
21
+ virtual: false,
22
+ allowed: isModelAllowedInTiers(m.id, policy, registry.tiersOf(m)),
23
+ }));
24
+ const tierAllowed = (t) => registered.some((m) => m.tiers?.includes(t) && m.allowed);
25
+ // Virtual auto* rows honor runtime viability (mirrors /v1/models): bare
26
+ // `auto` needs an allowed model in ANY tier, auto-X in tier X.
27
+ const virtual = ['auto', 'lite', 'plus', 'pro', 'ultra'].map((id) => ({
28
+ id,
29
+ kind: (id === 'auto' ? 'auto' : 'tier'),
30
+ provider: 'omnicell-router',
31
+ tier: tierFromVirtualEntry(id),
32
+ virtual: true,
33
+ allowed: isAutoEntryUsable(id, policy, tierAllowed),
34
+ }));
35
+ // Combo rows (mirrors /v1/models): routable virtual ids, but concrete
36
+ // selectable entries — NOT auto*-virtual, so follow-mode snapshots keep
37
+ // them. A combo passes only when EVERY member is allowed (the inference
38
+ // entry gate; no silent composition change).
39
+ const combos = registry.getCombos().map((c) => ({
40
+ id: c.id,
41
+ kind: 'combo',
42
+ provider: 'omnicell-router',
43
+ tier: '',
44
+ virtual: false,
45
+ allowed: registry.resolveCombo(c.id).every((mem) => isModelAllowed(mem.id, policy, mem.tier)),
46
+ }));
47
+ // Variant rows (mirrors /v1/models): `base-variant` ids resolve to the
48
+ // base model with a pinned reasoning effort; the policy verdict inherits
49
+ // from the base id.
50
+ const variants = registry.getVariantExposures().map(({ id, base }) => ({
51
+ id,
52
+ kind: 'variant',
53
+ provider: base.provider,
54
+ tiers: registry.tiersOf(base),
55
+ virtual: false,
56
+ allowed: isModelAllowedInTiers(base.id, policy, registry.tiersOf(base)),
57
+ }));
58
+ // Order mirrors the /v1/models wire body EXACTLY (the console list is a
59
+ // pure re-rendering of that payload — same rows, same sequence). The wire
60
+ // builds a provider map whose insertion order IS the display order: the
61
+ // omnicell-router virtual provider (auto alias → tier aliases → combos)
62
+ // first, then concrete providers in registry first-appearance order, each
63
+ // carrying its concrete models then its variant siblings.
64
+ const providerRows = new Map();
65
+ const ensureProviderRows = (pid) => {
66
+ let rows = providerRows.get(pid);
67
+ if (!rows) {
68
+ rows = [];
69
+ providerRows.set(pid, rows);
70
+ }
71
+ return rows;
72
+ };
73
+ for (const m of registry.getAllModels()) {
74
+ ensureProviderRows(m.provider).push(registered.find((r) => r.id === m.id));
75
+ }
76
+ for (const v of variants)
77
+ ensureProviderRows(v.provider).push(v);
78
+ const models = [
79
+ ...virtual,
80
+ ...combos,
81
+ ...[...providerRows.entries()].filter(([pid]) => pid !== 'omnicell-router').flatMap(([, rows]) => rows),
82
+ ];
83
+ return {
84
+ status: 'ok',
85
+ mode: policy?.mode ?? 'none',
86
+ policyModels: policy?.models ?? [],
87
+ models,
88
+ };
89
+ }
90
+ /** Allowed concrete / virtual ids for a follow-mode snapshot. */
91
+ export function allowedFollowLists(view) {
92
+ const extraModels = view.models.filter((m) => !m.virtual && m.allowed).map((m) => m.id);
93
+ const virtualModels = view.models.filter((m) => m.virtual && m.allowed).map((m) => m.id);
94
+ return {
95
+ extraModels,
96
+ virtualModels,
97
+ allAllowedIds: [...virtualModels, ...extraModels],
98
+ };
99
+ }
@@ -150,7 +150,7 @@ export interface CaptureEvent {
150
150
  * the credential deny-list in `observability/http-exchange.ts` (the raw
151
151
  * Authorization / x-api-key header values stay `[REDACTED]`).
152
152
  * Absent (`undefined`) when the leg has no key identity: keyless /v1 calls
153
- * or MITM forward-proxy tunnels (CONNECT-authenticated), plus requests
153
+ * or MITM ingress-proxy tunnels (CONNECT-authenticated), plus requests
154
154
  * archived before this field existed.
155
155
  */
156
156
  apiKey?: CaptureKeyIdentity;
@@ -761,15 +761,9 @@ export declare class CaptureRecorder {
761
761
  private ensureDir;
762
762
  /**
763
763
  * Filesystem-safe archive file name for a (client-controlled) session id.
764
- * Single source of truth for write AND read naming (findBySession calls
765
- * this verbatim) — names match by construction, no per-side normalization.
766
- * HASH_NAME_RE (see definition) forces literal `h_<16hex>` ids through the
767
- * hash branch so they can never alias another session's hashed archive.
768
- * Migration: archives written before that guard for a literal `h_<16hex>`
769
- * id keep their old verbatim name and become read-side orphans (findBySession
770
- * now resolves that id to the hash-of-hash name). They stay visible and
771
- * deletable through the captures directory browser, and the retention sweep
772
- * backstops them — existing files are never rewritten or migrated.
764
+ * Delegates to the ONE shared sanitizer (`utils/session-file.ts`) so the
765
+ * capture archive and the session-snapshot store cannot name one session
766
+ * two different files. See that module for the alias-collision guard.
773
767
  */
774
768
  static sessionFileName(sessionId: string): string;
775
769
  /**
@@ -9,6 +9,8 @@ import { redactUpstreamBody } from '../observability/upstream-body-redaction.js'
9
9
  import { displayPromptText, firstDisplayText } from '../utils/client-envelope.js';
10
10
  import { harnessProfileOf } from '../utils/harness-profiles.js';
11
11
  import { NO_TURN } from './turn-boundary.js';
12
+ import { sessionFileName } from '../utils/session-file.js';
13
+ import { BASE64_SHAPE_RE, EXT_TO_MIME, MEDIA_FILE_RE, MEDIA_HASH_RE, MIME_TO_EXT } from '../ir/media.js';
12
14
  import { migrateArchiveRoot } from './migrate/index.js';
13
15
  /**
14
16
  * Header a client uses to DECLARE its human prompt (envelope layer 0) instead
@@ -56,17 +58,6 @@ const RE_CAPTURE_PROMPT_SUMMARY = /"promptSummary":("(?:[^"\\]|\\.)*")/;
56
58
  const RE_CAPTURE_TURN_INDEX = /"turnIndex":(\d+)/;
57
59
  const RE_CAPTURE_IS_PROMPT_START = /"isPromptStart":true/;
58
60
  const DATE_DIR_RE = /^\d{4}-\d{2}-\d{2}$/;
59
- // Session ids that are already filesystem-safe are kept verbatim for
60
- // browsability; anything else (path traversal, separators, excess length)
61
- // falls back to a stable content hash.
62
- const SAFE_SESSION_RE = /^[\w.@:-]{1,80}$/;
63
- // Reserves the hash output namespace: ids literally shaped like sessionFileName()'s
64
- // own digest output go through the hash branch (hash-of-hash), never verbatim —
65
- // closing the alias-collision vector where a crafted id `h_<16hex>` would name
66
- // the same archive as some unsafe id's hash. Case-insensitive because the
67
- // verbatim branch accepts uppercase hex, which aliases the lowercase digest
68
- // file on case-insensitive filesystems (Windows/macOS).
69
- const HASH_NAME_RE = /^h_[0-9a-f]{16}$/i;
70
61
  const JSONL_SUFFIX = '.jsonl';
71
62
  const TRUNCATION_SUFFIX = '...[TRUNCATED]';
72
63
  // Binary-media offload sub-directory inside each date archive (content-
@@ -83,40 +74,6 @@ const MEDIA_SUBDIR = 'media';
83
74
  // later. The hourly sweep keeps the quiet window — by then the recorder IS
84
75
  // appending, and a recently written shard is simply retried next hour.
85
76
  const BOOT_MIGRATION_HOT_MS = 0;
86
- // Reader-side shape of the stored file name: `<64hex>.<ext>` — the route
87
- // accepts the bare hash (16–64 hex) and prefix-matches it against this.
88
- const MEDIA_FILE_RE = /^[0-9a-f]{16,64}\.[a-z0-9]{1,8}$/;
89
- // A bare (no data-URL prefix) base64 payload worth scrubbing: ≥256 chars of
90
- // strict alphabet. Prose, code, or paths carry spaces/punctuation and never
91
- // match — the guard's false-positive class is "long base64-ish token", which
92
- // is exactly what image/audio/document blobs look like.
93
- const BASE64_SHAPE_RE = /^[A-Za-z0-9+/]{256,}={0,2}$/;
94
- /** media_type → file extension for the offloaded payload (unknown → bin). */
95
- const MIME_TO_EXT = {
96
- 'image/png': 'png',
97
- 'image/jpeg': 'jpg',
98
- 'image/jpg': 'jpg',
99
- 'image/gif': 'gif',
100
- 'image/webp': 'webp',
101
- 'image/svg+xml': 'svg',
102
- 'image/bmp': 'bmp',
103
- 'image/avif': 'avif',
104
- 'application/pdf': 'pdf',
105
- 'text/plain': 'txt',
106
- };
107
- /** Reverse map for the read route's Content-Type. */
108
- const EXT_TO_MIME = {
109
- png: 'image/png',
110
- jpg: 'image/jpeg',
111
- gif: 'image/gif',
112
- webp: 'image/webp',
113
- svg: 'image/svg+xml',
114
- bmp: 'image/bmp',
115
- avif: 'image/avif',
116
- pdf: 'application/pdf',
117
- txt: 'text/plain',
118
- };
119
- const MEDIA_HASH_RE = /^[0-9a-f]{16,64}$/;
120
77
  /** `1.2 MB` style size for the placeholder's human-readable field. */
121
78
  function humanBytes(n) {
122
79
  if (n < 1024)
@@ -1843,21 +1800,12 @@ export class CaptureRecorder {
1843
1800
  }
1844
1801
  /**
1845
1802
  * Filesystem-safe archive file name for a (client-controlled) session id.
1846
- * Single source of truth for write AND read naming (findBySession calls
1847
- * this verbatim) — names match by construction, no per-side normalization.
1848
- * HASH_NAME_RE (see definition) forces literal `h_<16hex>` ids through the
1849
- * hash branch so they can never alias another session's hashed archive.
1850
- * Migration: archives written before that guard for a literal `h_<16hex>`
1851
- * id keep their old verbatim name and become read-side orphans (findBySession
1852
- * now resolves that id to the hash-of-hash name). They stay visible and
1853
- * deletable through the captures directory browser, and the retention sweep
1854
- * backstops them — existing files are never rewritten or migrated.
1803
+ * Delegates to the ONE shared sanitizer (`utils/session-file.ts`) so the
1804
+ * capture archive and the session-snapshot store cannot name one session
1805
+ * two different files. See that module for the alias-collision guard.
1855
1806
  */
1856
1807
  static sessionFileName(sessionId) {
1857
- if (SAFE_SESSION_RE.test(sessionId) && !HASH_NAME_RE.test(sessionId))
1858
- return sessionId + JSONL_SUFFIX;
1859
- const hash = crypto.createHash('sha256').update(sessionId).digest('hex').slice(0, 16);
1860
- return `h_${hash}${JSONL_SUFFIX}`;
1808
+ return sessionFileName(sessionId, JSONL_SUFFIX);
1861
1809
  }
1862
1810
  /**
1863
1811
  * First user-message text from a captured request body — what makes a
@@ -30,6 +30,8 @@ const lastSetupAt = new Map();
30
30
  const UA_MATCHERS = [
31
31
  { match: /claude-cli\//i, client: 'claude' },
32
32
  { match: /opencode\//i, client: 'opencode' },
33
+ // ChatGPT Desktop and Codex CLI share the one Codex card / ~/.codex hook.
34
+ { match: /chatgpt/i, client: 'codex' },
33
35
  { match: /codex/i, client: 'codex' },
34
36
  ];
35
37
  /** Record that `name` was hooked (setup succeeded) at `at`. */
@@ -1,4 +1,4 @@
1
- import { ClientHookKind, ClientHookStatus } from '../types.js';
1
+ import { ClientHookKind, ClientHookStatus, ClientUpdateSource, ClientVersionState } from '../types.js';
2
2
  import type { ClientLaunchVerb } from './launcher.js';
3
3
  /** Last-resort fallback URL when config is unreadable; mirrors the config default. */
4
4
  export declare const OCR_DEFAULT_PORT = 4000;
@@ -116,6 +116,15 @@ export interface ClientAdapter {
116
116
  minVersion?: string;
117
117
  /** Command whose output reports the installed CLI version (e.g. `['kimi', '--version']`). */
118
118
  versionCmd?: string[];
119
+ /**
120
+ * Where the NEWEST PUBLISHED version of this client can be read. Declared by
121
+ * the hook, because "where does this vendor publish releases" is vendor
122
+ * knowledge — the engine only knows how to read a release source it is
123
+ * given, and a vendor changing channels must be a hook/package release
124
+ * (ADR-0042's split). Absent = this client has no verifiable release channel
125
+ * and the console shows no update chip at all, rather than guessing one.
126
+ */
127
+ updateSource?: ClientUpdateSource;
119
128
  getConfigPath(): string;
120
129
  /** Async by contract: adapters may probe external processes (e.g. `opencode service get env`); never block the event loop. */
121
130
  getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
@@ -158,7 +167,7 @@ export interface ClientAdapter {
158
167
  }): Promise<ClientActionResult>;
159
168
  /**
160
169
  * Passthrough launch verbs this hook publishes (`ocr cursor`,
161
- * `ocr cursor-agent`) — see `launcher.ts`. Declared here, not in the CLI: a
170
+ * `ocr antigravity-cli`) — see `launcher.ts`. Declared here, not in the CLI: a
162
171
  * packaged adapter must be able to add a launch command, and the console's
163
172
  * copy hint plus the generated help text both read THIS list.
164
173
  * Absent = this hook publishes no runnable script.
@@ -182,23 +191,39 @@ export interface ClientAdapter {
182
191
  */
183
192
  refreshModelSurface?(): Promise<ClientActionResult>;
184
193
  }
194
+ /** One version probe's answer: the version (when it could be read) plus what
195
+ * the probe actually learned. See `ClientVersionState`. */
196
+ export interface ClientVersionProbe {
197
+ state: ClientVersionState;
198
+ version: string | null;
199
+ }
185
200
  /**
186
201
  * Probe the installed CLI version by running the adapter's version command.
187
202
  * Returns the first `major[.minor[.patch…]]` token in the output (CLI banners
188
- * are prose — "kimi version 2.4.1"), or null when the command fails/times out
189
- * (absent client, non-zero exit).
203
+ * are prose — "kimi version 2.4.1") plus what the probe actually learned:
204
+ * `missing` (no such command) / `unknown` (it ran and told us nothing).
205
+ */
206
+ export declare function probeClientVersionState(cmd: string[]): Promise<ClientVersionProbe>;
207
+ /**
208
+ * The installed version or null — the shape `ClientAdapterHost.probeVersion`
209
+ * has always returned, so a package written against it keeps working. Callers
210
+ * that must tell "not installed" from "could not tell" use
211
+ * {@link probeClientVersionState}.
190
212
  */
191
213
  export declare function probeClientVersion(cmd: string[]): Promise<string | null>;
192
- /** Client-facing forward-proxy endpoint derived from the runtime config snapshot. */
193
- export interface ForwardProxyEndpoint {
214
+ /**
215
+ * Client-facing ingress-proxy endpoint derived from the runtime config
216
+ * snapshot. It carries no credential: the inbound proxy authenticates nobody
217
+ * and binds loopback only (ADR-0008 §3), so there is nothing to authenticate
218
+ * and a launcher must never embed a key in the proxy URL.
219
+ */
220
+ export interface IngressProxyEndpoint {
194
221
  url: string;
195
222
  port: number;
196
223
  caPath: string;
197
- /** `forwardProxy.requireCredential`: launchers must carry the key in the URL. */
198
- requireCredential: boolean;
199
224
  }
200
225
  /**
201
- * Effective forward-proxy endpoint from the runtime config snapshot; null
202
- * when the forward proxy is disabled or the config is unreadable.
226
+ * Effective ingress-proxy endpoint from the runtime config snapshot; null
227
+ * when the ingress proxy is disabled or the config is unreadable.
203
228
  */
204
- export declare function resolveForwardProxyEndpoint(): ForwardProxyEndpoint | null;
229
+ export declare function resolveIngressProxyEndpoint(): IngressProxyEndpoint | null;
@@ -1,9 +1,9 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { loadConfig, getRuntimeConfigRef } from '../../config/index.js';
4
- import { DEFAULT_FORWARD_PROXY_PORT, DEFAULT_GATEWAY_PORT } from '../../config/defaults.js';
4
+ import { DEFAULT_INGRESS_PROXY_PORT, DEFAULT_GATEWAY_PORT } from '../../config/defaults.js';
5
5
  import { renameWithRetry } from '../../utils/atomic-write.js';
6
- import { caCertPath } from '../../forward-proxy/ca.js';
6
+ import { caCertPath } from '../../ingress-proxy/ca.js';
7
7
  import { runCommand } from '../../utils/run-command.js';
8
8
  import { getOcrHomeDir } from '../paths.js';
9
9
  /** Last-resort fallback URL when config is unreadable; mirrors the config default. */
@@ -180,19 +180,27 @@ const versionProbeCache = new Map();
180
180
  const VERSION_PROBE_TTL_MS = 10 * 60 * 1000;
181
181
  function runVersionProbe(cmd) {
182
182
  return (async () => {
183
- const { ok, stdout } = await runCommand(cmd[0], cmd.slice(1), 5000);
183
+ const { ok, stdout, notFound } = await runCommand(cmd[0], cmd.slice(1), 5000);
184
184
  const version = ok ? stdout.match(/\d+(?:\.\d+)+/)?.[0] ?? null : null;
185
- versionProbeCache.set(cmd.join(' '), { version, at: Date.now() });
186
- return version;
185
+ // A command that is simply not there is the ONLY thing that may be called
186
+ // "not installed"; a broken install (a shim whose package is gone), a
187
+ // deadline or a non-zero exit all leave the question open.
188
+ const probe = version
189
+ ? { state: 'ok', version }
190
+ : notFound
191
+ ? { state: 'missing', version: null }
192
+ : { state: 'unknown', version: null };
193
+ versionProbeCache.set(cmd.join(' '), { probe, at: Date.now() });
194
+ return probe;
187
195
  })();
188
196
  }
189
197
  /**
190
198
  * Probe the installed CLI version by running the adapter's version command.
191
199
  * Returns the first `major[.minor[.patch…]]` token in the output (CLI banners
192
- * are prose — "kimi version 2.4.1"), or null when the command fails/times out
193
- * (absent client, non-zero exit).
200
+ * are prose — "kimi version 2.4.1") plus what the probe actually learned:
201
+ * `missing` (no such command) / `unknown` (it ran and told us nothing).
194
202
  */
195
- export function probeClientVersion(cmd) {
203
+ export function probeClientVersionState(cmd) {
196
204
  const key = cmd.join(' ');
197
205
  const hit = versionProbeCache.get(key);
198
206
  if (!hit)
@@ -202,13 +210,22 @@ export function probeClientVersion(cmd) {
202
210
  // while one background probe runs.
203
211
  hit.probing = runVersionProbe(cmd).finally(() => { hit.probing = undefined; });
204
212
  }
205
- return Promise.resolve(hit.version);
213
+ return Promise.resolve(hit.probe);
206
214
  }
207
215
  /**
208
- * Effective forward-proxy endpoint from the runtime config snapshot; null
209
- * when the forward proxy is disabled or the config is unreadable.
216
+ * The installed version or null — the shape `ClientAdapterHost.probeVersion`
217
+ * has always returned, so a package written against it keeps working. Callers
218
+ * that must tell "not installed" from "could not tell" use
219
+ * {@link probeClientVersionState}.
210
220
  */
211
- export function resolveForwardProxyEndpoint() {
221
+ export async function probeClientVersion(cmd) {
222
+ return (await probeClientVersionState(cmd)).version;
223
+ }
224
+ /**
225
+ * Effective ingress-proxy endpoint from the runtime config snapshot; null
226
+ * when the ingress proxy is disabled or the config is unreadable.
227
+ */
228
+ export function resolveIngressProxyEndpoint() {
212
229
  let cfg;
213
230
  try {
214
231
  cfg = getRuntimeConfigRef() || loadConfig();
@@ -216,10 +233,10 @@ export function resolveForwardProxyEndpoint() {
216
233
  catch {
217
234
  return null;
218
235
  }
219
- const fp = cfg?.forwardProxy;
236
+ const fp = cfg?.ingressProxy;
220
237
  if (!fp || fp.enabled !== true)
221
238
  return null;
222
- const port = Number.isFinite(fp.port) && fp.port > 0 ? fp.port : DEFAULT_FORWARD_PROXY_PORT;
239
+ const port = Number.isFinite(fp.port) && fp.port > 0 ? fp.port : DEFAULT_INGRESS_PROXY_PORT;
223
240
  // `host` is a LISTEN address — the client-facing URL must stay reachable
224
241
  // from the client on the same machine, so wildcard binds normalize to loopback.
225
242
  const host = !fp.host || fp.host === '0.0.0.0' || fp.host === '::' ? '127.0.0.1' : fp.host;
@@ -227,6 +244,5 @@ export function resolveForwardProxyEndpoint() {
227
244
  url: `http://${host}:${port}`,
228
245
  port,
229
246
  caPath: caCertPath(fp.caDir),
230
- requireCredential: fp.requireCredential === true,
231
247
  };
232
248
  }
@@ -4,6 +4,15 @@ export declare class ClaudeClientAdapter implements ClientAdapter {
4
4
  name: "claude";
5
5
  hookKind: "config";
6
6
  displayName: string;
7
+ /** `claude --version` prints `2.1.325 (Claude Code)` — the banner's first
8
+ * version token is the CLI's own. */
9
+ versionCmd: string[];
10
+ /** Claude Code's published releases; the native installer and the npm
11
+ * package ship the same version numbers. */
12
+ updateSource: {
13
+ readonly kind: "npm";
14
+ readonly package: "@anthropic-ai/claude-code";
15
+ };
7
16
  getConfigPath(): string;
8
17
  getStatus(): Promise<Omit<ClientHookStatus, 'hookKind'>>;
9
18
  setup(options?: {
@@ -6,6 +6,12 @@ export class ClaudeClientAdapter {
6
6
  name = 'claude';
7
7
  hookKind = 'config';
8
8
  displayName = 'Claude Code';
9
+ /** `claude --version` prints `2.1.325 (Claude Code)` — the banner's first
10
+ * version token is the CLI's own. */
11
+ versionCmd = ['claude', '--version'];
12
+ /** Claude Code's published releases; the native installer and the npm
13
+ * package ship the same version numbers. */
14
+ updateSource = { kind: 'npm', package: '@anthropic-ai/claude-code' };
9
15
  getConfigPath() {
10
16
  const home = os.homedir();
11
17
  const candidateSettings = path.join(home, '.claude', 'settings.json');