@bitkyc08/opencodex 2.91.0 → 2.93.0-preview.20261027

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 (360) hide show
  1. package/bin/ocx.mjs +47 -8
  2. package/gui/dist/assets/App-CJZoq-uF.js +58 -0
  3. package/gui/dist/assets/{Tray-BuLy7hL1.js → Tray-BWQPcgZn.js} +1 -1
  4. package/gui/dist/assets/index-DRe8Hhfz.css +1 -0
  5. package/gui/dist/assets/index-Xfct8owH.js +94 -0
  6. package/gui/dist/assets/quota-summary-DxToX1rV.js +1 -0
  7. package/gui/dist/index.html +2 -2
  8. package/gui/dist/provider-icons/workbuddy-color.svg +29 -0
  9. package/package.json +8 -7
  10. package/src/adapters/anthropic.ts +28 -5
  11. package/src/adapters/coding-agent/batch-dispatcher.ts +122 -0
  12. package/src/adapters/coding-agent/profile.ts +54 -16
  13. package/src/adapters/coding-agent/turn.ts +30 -2
  14. package/src/adapters/command-code.ts +114 -7
  15. package/src/adapters/cursor/native-exec-fs.ts +11 -9
  16. package/src/adapters/devin/live-models.ts +4 -0
  17. package/src/adapters/google-vertex-endpoint.ts +9 -1
  18. package/src/adapters/google-vertex-key-project.ts +223 -0
  19. package/src/adapters/google-wire-compiler.ts +1 -2
  20. package/src/adapters/google.ts +13 -3
  21. package/src/adapters/kiro/reasoning.ts +2 -0
  22. package/src/adapters/kiro-refusal.ts +6 -1
  23. package/src/adapters/kiro-wire.ts +1 -1
  24. package/src/adapters/openai-chat/messages.ts +8 -2
  25. package/src/adapters/openai-chat/passthrough.ts +35 -14
  26. package/src/adapters/openai-chat/reasoning-replay.ts +27 -16
  27. package/src/adapters/openai-chat/reasoning-wire.ts +117 -8
  28. package/src/adapters/openai-chat/required-tool-result.ts +64 -0
  29. package/src/adapters/openai-chat/tool-name-registry.ts +3 -1
  30. package/src/adapters/openai-chat.ts +9 -10
  31. package/src/adapters/openai-responses/passthrough.ts +7 -4
  32. package/src/adapters/openai-responses/reasoning.ts +13 -0
  33. package/src/adapters/openai-responses/request-strips.ts +60 -0
  34. package/src/adapters/qoder/adapter.ts +129 -8
  35. package/src/adapters/qoder/scaffold-guard.ts +5 -0
  36. package/src/adapters/reasoning-controls.ts +16 -0
  37. package/src/adapters/registry.ts +5 -0
  38. package/src/adapters/tool-call-id.ts +1 -3
  39. package/src/adapters/workbuddy-schema.ts +61 -0
  40. package/src/adapters/workbuddy.ts +68 -0
  41. package/src/bridge/errors.ts +27 -0
  42. package/src/bridge/response-json.ts +1 -1
  43. package/src/bridge/sse.ts +1 -1
  44. package/src/bridge.ts +1 -1
  45. package/src/chat/inbound.ts +4 -1
  46. package/src/chat/outbound.ts +20 -6
  47. package/src/chat/reasoning-details.ts +28 -5
  48. package/src/claude/desktop-first-party.ts +54 -4
  49. package/src/claude/desktop-picker.ts +11 -8
  50. package/src/claude/first-party-settings.ts +3 -1
  51. package/src/claude/inbound.ts +2 -1
  52. package/src/claude/intercept/local-ca.ts +2 -1
  53. package/src/claude/intercept/picker-ca-cleanup.ts +4 -2
  54. package/src/claude/intercept/picker-ca-startup.ts +3 -1
  55. package/src/claude/intercept/picker-models.ts +6 -3
  56. package/src/claude/intercept/picker-runtime.ts +3 -2
  57. package/src/claude/intercept/runtime.ts +6 -3
  58. package/src/claude/model-info.ts +31 -8
  59. package/src/cli/account-api.ts +11 -0
  60. package/src/cli/capabilities-agents-routing.ts +3 -3
  61. package/src/cli/capabilities-base.ts +7 -1
  62. package/src/cli/capabilities-observe-system.ts +10 -0
  63. package/src/cli/claude-desktop.ts +9 -8
  64. package/src/cli/claude.ts +3 -2
  65. package/src/cli/codex-cli-update.ts +8 -0
  66. package/src/cli/codex-shim-autorestore.ts +9 -0
  67. package/src/cli/combo-result.ts +13 -0
  68. package/src/cli/combo-stats.ts +3 -0
  69. package/src/cli/combo.ts +83 -41
  70. package/src/cli/cross-home-owner.ts +13 -1
  71. package/src/cli/dispatch.ts +25 -6
  72. package/src/cli/ensure-desired-integrations.ts +8 -6
  73. package/src/cli/export-command.ts +4 -1
  74. package/src/cli/help.ts +2 -1
  75. package/src/cli/index.ts +45 -45
  76. package/src/cli/integration-plan-dto.ts +4 -0
  77. package/src/cli/launcher-context.ts +49 -2
  78. package/src/cli/link.ts +45 -32
  79. package/src/cli/opencode.ts +20 -9
  80. package/src/cli/provider.ts +2 -1
  81. package/src/cli/registry.ts +6 -4
  82. package/src/cli/root.ts +9 -0
  83. package/src/cli/status.ts +59 -1
  84. package/src/cli/stop-restore.ts +113 -0
  85. package/src/cli/sync-expectation.ts +60 -0
  86. package/src/cli/uninstall-integrations.ts +41 -7
  87. package/src/cli/usage-compare.ts +68 -12
  88. package/src/client/connect.ts +40 -3
  89. package/src/client/link-home.ts +10 -1
  90. package/src/client/link-ingress.ts +1 -1
  91. package/src/client/link-readiness.ts +97 -0
  92. package/src/client/link-relay-transport.ts +79 -11
  93. package/src/client/link-relay.ts +74 -15
  94. package/src/client/link-tunnel.ts +45 -18
  95. package/src/client/machine-api.ts +3 -1
  96. package/src/client/machine-listener.ts +20 -2
  97. package/src/client/runtime.ts +20 -2
  98. package/src/client/sync-expectation.ts +118 -0
  99. package/src/clients/config-export/agent-clients.ts +96 -0
  100. package/src/clients/config-export/contracts.ts +25 -7
  101. package/src/clients/config-export/qoder.ts +38 -23
  102. package/src/clients/config-export/reasoning-metadata.ts +55 -8
  103. package/src/clients/config-export.ts +12 -0
  104. package/src/clients/lazycodex.ts +7 -2
  105. package/src/clients/reasoning-controls.ts +49 -0
  106. package/src/codex/account-store.ts +17 -3
  107. package/src/codex/app-server-restart-service.ts +6 -5
  108. package/src/codex/auth-api/account-identity.ts +14 -0
  109. package/src/codex/auth-api/account-list.ts +29 -2
  110. package/src/codex/auth-api/http.ts +13 -0
  111. package/src/codex/auth-api/main-account-probe.ts +2 -2
  112. package/src/codex/auth-api/pool-mode-gate.ts +16 -3
  113. package/src/codex/auth-api/pool-quota-probe.ts +15 -0
  114. package/src/codex/auth-context.ts +15 -12
  115. package/src/codex/catalog/build-entries.ts +22 -0
  116. package/src/codex/catalog/configured-tiers.ts +70 -0
  117. package/src/codex/catalog/effort.ts +52 -11
  118. package/src/codex/catalog/gather-capture.ts +5 -2
  119. package/src/codex/catalog/heal-observation.ts +155 -13
  120. package/src/codex/catalog/metadata.ts +6 -0
  121. package/src/codex/catalog/model-hints.ts +60 -11
  122. package/src/codex/catalog/model-visibility.ts +3 -2
  123. package/src/codex/catalog/native-models.ts +18 -3
  124. package/src/codex/catalog/parsing.ts +10 -8
  125. package/src/codex/catalog/pinned-models.ts +2 -1
  126. package/src/codex/catalog/provider-models.ts +18 -13
  127. package/src/codex/catalog/retained-sync.ts +2 -1
  128. package/src/codex/catalog/routed-gather.ts +19 -20
  129. package/src/codex/catalog/write-audit.ts +3 -2
  130. package/src/codex/catalog-self-heal.ts +43 -23
  131. package/src/codex/chatgpt-refresh-failure.ts +6 -2
  132. package/src/codex/cli-install-provenance.ts +418 -0
  133. package/src/codex/cli-installation-targets.ts +5 -1
  134. package/src/codex/cli-update-plan.ts +43 -16
  135. package/src/codex/collision-identity.ts +30 -5
  136. package/src/codex/convergence.ts +4 -3
  137. package/src/codex/data/roster-pinned-models.json +177 -1
  138. package/src/codex/desired-state.ts +6 -1
  139. package/src/codex/desktop-app/picker-freshness.ts +10 -8
  140. package/src/codex/desktop-compatibility/installed-build.ts +88 -12
  141. package/src/codex/desktop-compatibility/runtime.ts +29 -5
  142. package/src/codex/desktop-compatibility/usage-activation.ts +2 -1
  143. package/src/codex/desktop-compatibility/usage-controller.ts +9 -1
  144. package/src/codex/desktop-compatibility/windows-certificate-trust.ts +46 -12
  145. package/src/codex/inject/config-toml.ts +0 -18
  146. package/src/codex/inject/plan.ts +18 -3
  147. package/src/codex/inject/remove.ts +6 -2
  148. package/src/codex/inject.ts +1 -1
  149. package/src/codex/journal.ts +61 -1
  150. package/src/codex/model-entitlements.ts +1 -1
  151. package/src/codex/native-main-owner.ts +27 -1
  152. package/src/codex/native-profile-store.ts +2 -1
  153. package/src/codex/pool-credit-policy.ts +35 -1
  154. package/src/codex/pool-refresh-backoff.ts +3 -1
  155. package/src/codex/quota-types.ts +3 -0
  156. package/src/codex/quota.ts +24 -4
  157. package/src/codex/role-auto-assign.ts +6 -2
  158. package/src/codex/subagent-defaults.ts +49 -4
  159. package/src/codex/user-identity.ts +35 -6
  160. package/src/codex/windows-current-sid.ts +162 -0
  161. package/src/combos/failover.ts +17 -2
  162. package/src/combos/jev-decision-contract.ts +22 -1
  163. package/src/combos/jev-quota-activation.ts +5 -1
  164. package/src/combos/jev-quota-route.ts +1 -1
  165. package/src/combos/jev-quota.ts +9 -1
  166. package/src/combos/jev-service-exchange.ts +3 -1
  167. package/src/combos/jev-session-pin-config.ts +51 -0
  168. package/src/combos/jev.ts +101 -9
  169. package/src/combos/resolve.ts +45 -1
  170. package/src/combos/types.ts +43 -0
  171. package/src/config/load-degrade.ts +5 -0
  172. package/src/config/paths.ts +19 -3
  173. package/src/config/pending-teardown.ts +22 -1
  174. package/src/config/provider-validation.ts +22 -4
  175. package/src/config/removed-opencode-free.ts +11 -0
  176. package/src/config/schema/leaf-validators.ts +6 -0
  177. package/src/generated/compatibility-version.json +467 -311
  178. package/src/generated/model-metadata.ts +5 -5
  179. package/src/images/loop.ts +16 -2
  180. package/src/integrations/catalog-refresh.ts +1 -1
  181. package/src/integrations/hermes-profiles.ts +251 -0
  182. package/src/integrations/merge.ts +8 -0
  183. package/src/integrations/mutation-plan.ts +19 -4
  184. package/src/integrations/registry.ts +5 -0
  185. package/src/integrations/state.ts +36 -1
  186. package/src/integrations/writer.ts +18 -4
  187. package/src/lib/bun-path-runtime.mjs +2 -1
  188. package/src/lib/decision-quota-sink.ts +10 -0
  189. package/src/lib/errors.ts +62 -0
  190. package/src/lib/eventstream-decoder.ts +81 -37
  191. package/src/lib/opaque-proxy-tunnel.ts +32 -8
  192. package/src/lib/pinned-http.ts +35 -2
  193. package/src/lib/process-control.ts +13 -1
  194. package/src/lib/socks5-fetch.ts +59 -64
  195. package/src/lib/socks5-upload-waiter.ts +50 -0
  196. package/src/lib/sse-decoder.ts +7 -2
  197. package/src/lib/state-store-sweeper.ts +40 -14
  198. package/src/lib/translator-budget.ts +4 -4
  199. package/src/lib/upstream-retry.ts +4 -1
  200. package/src/lib/windows-native-principal-worker.ts +14 -0
  201. package/src/lib/windows-native-principal.ts +188 -0
  202. package/src/lib/windows-secret-acl.ts +39 -3
  203. package/src/lib/windows-user-principal.ts +62 -18
  204. package/src/link/diagnostics.ts +193 -0
  205. package/src/link/relay-auth.ts +6 -0
  206. package/src/link/ssh-config.ts +35 -3
  207. package/src/link/status-projection.ts +39 -0
  208. package/src/link/supervisor.ts +45 -12
  209. package/src/link/tunnel-history.ts +109 -0
  210. package/src/link/tunnel-state.ts +80 -17
  211. package/src/messaging/remote-files.ts +24 -1
  212. package/src/oauth/generic-account-failover.ts +91 -7
  213. package/src/oauth/index.ts +15 -0
  214. package/src/oauth/model-discovery-auth.ts +5 -0
  215. package/src/oauth/store.ts +4 -1
  216. package/src/oauth/token-guardian.ts +7 -0
  217. package/src/oauth/types.ts +9 -0
  218. package/src/oauth/workbuddy.ts +139 -0
  219. package/src/providers/account-quota-disk.ts +12 -4
  220. package/src/providers/antigravity-quota-identity.ts +37 -0
  221. package/src/providers/base-url-choices.ts +8 -5
  222. package/src/providers/codebuddy-models.ts +6 -0
  223. package/src/providers/codex-capacity.ts +3 -1
  224. package/src/providers/derive.ts +51 -3
  225. package/src/providers/kiro-models.ts +3 -0
  226. package/src/providers/mimo-thinking.ts +12 -0
  227. package/src/providers/model-discovery.ts +2 -0
  228. package/src/providers/model-rename-fields.ts +2 -0
  229. package/src/providers/model-rename-migration.ts +10 -0
  230. package/src/providers/openai-sidecar-credit.ts +2 -2
  231. package/src/providers/quota/account-cache.ts +3 -2
  232. package/src/providers/quota/antigravity.ts +25 -14
  233. package/src/providers/quota/report-cache.ts +13 -4
  234. package/src/providers/quota/vendor-probes-key.ts +60 -0
  235. package/src/providers/quota/workbuddy.ts +83 -0
  236. package/src/providers/quota-decision-antigravity.ts +64 -0
  237. package/src/providers/quota-decision-publication.ts +11 -0
  238. package/src/providers/quota-decision-snapshot.ts +21 -4
  239. package/src/providers/quota-types.ts +2 -0
  240. package/src/providers/quota.ts +3 -1
  241. package/src/providers/reasoning-capabilities.ts +76 -0
  242. package/src/providers/registry/entries-core.ts +23 -12
  243. package/src/providers/registry/entries-extended.ts +83 -27
  244. package/src/providers/registry/model-ids.ts +5 -0
  245. package/src/providers/registry/model-seeds.ts +120 -56
  246. package/src/providers/registry/types.ts +29 -2
  247. package/src/providers/resolved-model-policy.ts +30 -10
  248. package/src/providers/routed-config.ts +24 -1
  249. package/src/providers/stale-model-roster-migration.ts +123 -18
  250. package/src/providers/workbuddy-credit-balance.ts +81 -0
  251. package/src/providers/workbuddy-models.ts +37 -0
  252. package/src/providers/workbuddy.ts +60 -0
  253. package/src/remote-control/workspace-pi-runtime.ts +11 -6
  254. package/src/responses/compaction-summary.ts +45 -0
  255. package/src/responses/muse-tool-name-alias.ts +1 -2
  256. package/src/responses/parser.ts +3 -2
  257. package/src/responses/reasoning-replay-cache.ts +18 -14
  258. package/src/responses/schema.ts +1 -0
  259. package/src/responses/thought-signature-replay.ts +10 -2
  260. package/src/router.ts +2 -0
  261. package/src/routing/analytics.ts +2 -3
  262. package/src/routing/capability.ts +8 -2
  263. package/src/routing/fallback-policy.ts +3 -3
  264. package/src/routing/history/ingest.ts +28 -3
  265. package/src/server/auth-cors.ts +4 -2
  266. package/src/server/chat-completions.ts +21 -1
  267. package/src/server/chat-native-eligibility.ts +7 -0
  268. package/src/server/chat-native-reasoning.ts +24 -7
  269. package/src/server/chat-native.ts +13 -2
  270. package/src/server/claude-messages.ts +3 -0
  271. package/src/server/direct-local-http.ts +5 -2
  272. package/src/server/effort-policy.ts +5 -1
  273. package/src/server/index/link-relay-sessions.ts +9 -5
  274. package/src/server/index/live-sideband.ts +18 -15
  275. package/src/server/index/optional-listeners.ts +4 -0
  276. package/src/server/index/serve-options.ts +5 -4
  277. package/src/server/local-management-read-client.ts +3 -1
  278. package/src/server/management/agent-settings-routes.ts +27 -15
  279. package/src/server/management/combo-routes.ts +14 -4
  280. package/src/server/management/config-routes.ts +2 -2
  281. package/src/server/management/decision-discovery.ts +12 -2
  282. package/src/server/management/hermes-profile-routes.ts +156 -0
  283. package/src/server/management/integration-routes.ts +85 -24
  284. package/src/server/management/link-routes.ts +5 -2
  285. package/src/server/management/model-routes.ts +2 -2
  286. package/src/server/management/model-row-export-metadata.ts +25 -6
  287. package/src/server/management/model-rows.ts +15 -20
  288. package/src/server/management/native-integration-routes.ts +11 -8
  289. package/src/server/management/provider-routes.ts +1 -1
  290. package/src/server/management/route-registry.ts +4 -0
  291. package/src/server/management-api.ts +5 -0
  292. package/src/server/models-capabilities.ts +21 -3
  293. package/src/server/port-reclaim.ts +51 -9
  294. package/src/server/request-log-conversation.ts +49 -0
  295. package/src/server/request-log.ts +2 -0
  296. package/src/server/responses/adapter-delivery.ts +11 -1
  297. package/src/server/responses/adapter-dispatch.ts +2 -2
  298. package/src/server/responses/anthropic-thinking-recovery.ts +1 -0
  299. package/src/server/responses/codex-ws-exchange.ts +39 -9
  300. package/src/server/responses/codex-ws-session.ts +38 -4
  301. package/src/server/responses/codex-ws-wire.ts +6 -1
  302. package/src/server/responses/combo-required-tool-contract.ts +103 -0
  303. package/src/server/responses/combo-stream-preflight.ts +8 -1
  304. package/src/server/responses/compact.ts +14 -5
  305. package/src/server/responses/context-overflow.ts +8 -1
  306. package/src/server/responses/core-combo-failure.ts +10 -0
  307. package/src/server/responses/core-combo.ts +74 -44
  308. package/src/server/responses/core-lifetime.ts +5 -2
  309. package/src/server/responses/core-normalize.ts +17 -4
  310. package/src/server/responses/core-opaque-recovery.ts +1 -0
  311. package/src/server/responses/core-options.ts +7 -0
  312. package/src/server/responses/core-replay.ts +2 -1
  313. package/src/server/responses/jev-combo-choice.ts +39 -0
  314. package/src/server/responses/jev-session-pin.ts +203 -0
  315. package/src/server/responses/main-hard-lock-routing.ts +60 -44
  316. package/src/server/responses/passthrough-delivery.ts +44 -2
  317. package/src/server/responses/policy-fallback.ts +6 -1
  318. package/src/server/responses/request-compression.ts +12 -7
  319. package/src/server/responses/request-prepare.ts +32 -7
  320. package/src/server/responses/request-sidecar-auth.ts +2 -0
  321. package/src/server/responses/request-transport.ts +25 -6
  322. package/src/server/responses/response-effects.ts +22 -10
  323. package/src/server/responses/run-turn-execution.ts +2 -4
  324. package/src/server/responses/sidecar-execution.ts +13 -7
  325. package/src/server/responses-phase-inference.ts +267 -0
  326. package/src/server/sse-payload-rewrite.ts +14 -1
  327. package/src/server/stop-teardown.ts +36 -1
  328. package/src/server/ws-bridge.ts +1 -1
  329. package/src/service/definition.ts +20 -8
  330. package/src/service/desktop-supervision.d.mts +7 -4
  331. package/src/service/desktop-supervision.mjs +90 -13
  332. package/src/service/ownership-mutation-lease.mjs +21 -7
  333. package/src/types/config.ts +14 -2
  334. package/src/types/provider.ts +29 -7
  335. package/src/types/request.ts +11 -0
  336. package/src/types/wire.ts +1 -0
  337. package/src/types.ts +1 -0
  338. package/src/update/bind-probe.ts +29 -0
  339. package/src/update/codex-cli-update-launch-policy.d.mts +9 -0
  340. package/src/update/codex-cli-update-launch-policy.mjs +30 -0
  341. package/src/update/job.ts +10 -29
  342. package/src/update/npm-install-job.ps1 +173 -0
  343. package/src/update/npm-install.mjs +70 -0
  344. package/src/update/stop-contract.d.mts +1 -0
  345. package/src/update/stop-contract.mjs +14 -0
  346. package/src/update/stop-decision.d.mts +1 -1
  347. package/src/update/stop-decision.mjs +13 -3
  348. package/src/update/teardown-handover.ts +166 -0
  349. package/src/update/transactional-install.d.mts +14 -3
  350. package/src/update/transactional-install.mjs +33 -7
  351. package/src/usage/expected-prices.ts +64 -31
  352. package/src/usage/jev-stats.ts +54 -14
  353. package/src/usage/timeline.ts +19 -9
  354. package/src/vision/eligibility.ts +15 -5
  355. package/src/vision/plan.ts +2 -2
  356. package/src/web-search/loop.ts +16 -2
  357. package/gui/dist/assets/App-nZ34cR5G.js +0 -58
  358. package/gui/dist/assets/index-DGXS51sp.js +0 -94
  359. package/gui/dist/assets/index-DPeB9HpV.css +0 -1
  360. package/gui/dist/assets/quota-summary-DO1Sx5TM.js +0 -1
@@ -29,6 +29,8 @@ const FILENAME = "provider-account-quota-cache.json";
29
29
  */
30
30
  const DISK_MAX_AGE_MS = 6 * 60 * 60_000;
31
31
  const PERSIST_DEBOUNCE_MS = 250;
32
+ /** Match the reset ledger's maximum deferral under sustained quota observations. */
33
+ const MAX_PERSIST_DEFERRAL_MS = 1_000;
32
34
 
33
35
  type DiskFile = {
34
36
  version: 1;
@@ -38,6 +40,7 @@ type DiskFile = {
38
40
  };
39
41
 
40
42
  let persistTimer: ReturnType<typeof setTimeout> | null = null;
43
+ let persistStartedAt: number | null = null;
41
44
 
42
45
  /** Read the snapshot. Returns an empty map for a missing, corrupt or stale file. */
43
46
  export function readPersistedAccountQuotas(now = Date.now()): Map<string, ProviderQuota> {
@@ -86,14 +89,19 @@ export function readPersistedKiroVerdicts(now = Date.now()): Map<string, KiroPer
86
89
  return result;
87
90
  }
88
91
 
89
- /** Write the snapshot, debounced. Best-effort: a failed write is not an error. */
92
+ /** Debounce snapshots without starving writes under load. Failures remain best-effort. */
90
93
  export function schedulePersistAccountQuotas(
91
94
  rows: () => Iterable<[string, ProviderQuota | KiroPersistedQuota]>,
92
95
  verdicts: () => Iterable<[string, KiroPersistedVerdict]> = () => [],
93
96
  ): void {
97
+ const now = performance.now();
98
+ persistStartedAt ??= now;
99
+ const delay = Math.max(0, Math.min(PERSIST_DEBOUNCE_MS,
100
+ MAX_PERSIST_DEFERRAL_MS - (now - persistStartedAt)));
94
101
  if (persistTimer) clearTimeout(persistTimer);
95
102
  persistTimer = setTimeout(() => {
96
103
  persistTimer = null;
104
+ persistStartedAt = null;
97
105
  try {
98
106
  const out: Record<string, ProviderQuota> = {};
99
107
  for (const [key, quota] of rows()) out[key] = quota;
@@ -106,12 +114,12 @@ export function schedulePersistAccountQuotas(
106
114
  } catch {
107
115
  // Best-effort persistence only.
108
116
  }
109
- }, PERSIST_DEBOUNCE_MS);
117
+ }, delay);
110
118
  }
111
119
 
112
120
  /** Test seam: drop any pending write so a suite cannot leak one into the next file. */
113
121
  export function cancelPendingAccountQuotaPersist(): void {
114
- if (!persistTimer) return;
115
- clearTimeout(persistTimer);
122
+ if (persistTimer) clearTimeout(persistTimer);
116
123
  persistTimer = null;
124
+ persistStartedAt = null;
117
125
  }
@@ -0,0 +1,37 @@
1
+ import { createHash } from "node:crypto";
2
+ import { effectiveGoogleMode, getProviderRegistryEntry } from "./registry";
3
+ import type { OAuthCredentials } from "../oauth/types";
4
+ import type { OcxProviderConfig } from "../types";
5
+
6
+ const ARGON_TOKEN = /(?:^|[^a-z0-9])argon(?:[^a-z0-9]|$)/i;
7
+ /** Argon has an independent quota pool, including its native effort-suffixed identities. */
8
+ export function isAntigravityArgonIdentity(identity: string): boolean { return ARGON_TOKEN.test(identity); }
9
+
10
+ /**
11
+ * The OAuth store key whose account both inference and the quota probe resolve. Inference reads
12
+ * `store[route.providerName]` and refreshes through the OAuth definition registered under that same
13
+ * name, and `ocx login` only accepts registered names, so a renamed provider row never authenticates
14
+ * as this account. Evidence is bound to this key alone; a renamed row reads unknown.
15
+ */
16
+ export const ANTIGRAVITY_OAUTH_STORE_KEY = "google-antigravity";
17
+
18
+ /** Accounting and inference must refer to the same OAuth store entry and the supported Antigravity destination. */
19
+ export function antigravityQuotaEligible(name: string, provider: OcxProviderConfig): boolean {
20
+ if (name !== ANTIGRAVITY_OAUTH_STORE_KEY || provider.disabled || provider.authMode !== "oauth"
21
+ || effectiveGoogleMode(name, provider) !== "cloud-code-assist") return false;
22
+ try {
23
+ const url = new URL(provider.baseUrl);
24
+ const expected = new URL(getProviderRegistryEntry(ANTIGRAVITY_OAUTH_STORE_KEY)!.baseUrl);
25
+ return url.href.replace(/\/$/, "") === expected.href.replace(/\/$/, "");
26
+ } catch { return false; }
27
+ }
28
+
29
+ /** Private generation includes the accounting project, not just the rotating bearer. */
30
+ export function antigravityQuotaCredentialGeneration(credential: OAuthCredentials): string {
31
+ return createHash("sha256").update(JSON.stringify([credential.refresh, credential.access, credential.expires, credential.projectId])).digest("hex");
32
+ }
33
+
34
+ /** Immutable instance/destination policy, never returned to decision services. */
35
+ export function antigravityQuotaPolicy(name: string, provider: OcxProviderConfig): string {
36
+ return createHash("sha256").update(JSON.stringify([name, provider])).digest("hex");
37
+ }
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Qwen Cloud OpenAI-compatible endpoint presets.
3
3
  * Token plan is the GUI default; pay-as-you-go and custom are selectable.
4
+ * Token plan host per https://docs.qwencloud.com/token-plan/personal/token-plan-personal-quickstart
5
+ * (checked 2026-10-23); a saved older host stays usable as a custom URL.
4
6
  */
5
7
  export const QWEN_CLOUD_TOKEN_PLAN_BASE_URL =
6
- "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";
8
+ "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1";
7
9
  export const QWEN_CLOUD_PAYG_BASE_URL =
8
10
  "https://dashscope.aliyuncs.com/compatible-mode/v1";
9
11
 
@@ -23,10 +25,11 @@ export const QWEN_CLOUD_BASE_URL_CHOICES: readonly ProviderBaseUrlChoice[] = [
23
25
 
24
26
  /**
25
27
  * Alibaba Token Plan International (ap-southeast-1) endpoint presets.
26
- * Same product as the Beijing Token Plan but for international accounts.
27
- * Note: ALIBABA_INTL_TOKEN_PLAN_BASE_URL intentionally duplicates
28
- * QWEN_CLOUD_TOKEN_PLAN_BASE_URL — same host, different product branding
29
- * and model lineup. Kept as a separate constant for clarity.
28
+ * Separate regional account and billing destination; both regions offer both tiers.
29
+ * Alibaba Cloud's own quick start still documents this host (checked 2026-10-23):
30
+ * https://www.alibabacloud.com/help/en/model-studio/token-plan-personal-quick-start
31
+ * Qwen Cloud documents a different Token Plan host, so the two constants are
32
+ * independent and must not be assumed equal.
30
33
  */
31
34
  export const ALIBABA_INTL_TOKEN_PLAN_BASE_URL =
32
35
  "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";
@@ -30,6 +30,8 @@ export const CODEBUDDY_GLOBAL_MODELS = [
30
30
  "gpt-6-luna",
31
31
  // 260930 preemptive: GPT-6.1 Sol (OpenAI announced 2026-09-29); mirrors the GPT-6 Sol row.
32
32
  "gpt-6.1-sol",
33
+ // 261027 preemptive: GPT-6.1 Terra (mirrors CodeBuddy's GPT-6.1 Sol seed; provider listing unverified).
34
+ "gpt-6.1-terra",
33
35
  "gpt-5.5",
34
36
  "gpt-5.4",
35
37
  "gpt-5.3-codex",
@@ -82,6 +84,7 @@ export const CODEBUDDY_GLOBAL_MODEL_CONTEXT_WINDOWS: Record<string, number> = {
82
84
  "gpt-6-sol": 1_000_000,
83
85
  "gpt-6-luna": 1_000_000,
84
86
  "gpt-6.1-sol": 1_000_000,
87
+ "gpt-6.1-terra": 1_000_000,
85
88
  "gpt-5.5": 1_000_000,
86
89
  "gpt-5.4": 272_000,
87
90
  "gpt-5.3-codex": 272_000,
@@ -105,6 +108,7 @@ export const CODEBUDDY_GLOBAL_MODEL_MAX_OUTPUT_TOKENS: Record<string, number> =
105
108
  "gpt-6-sol": 128_000,
106
109
  "gpt-6-luna": 128_000,
107
110
  "gpt-6.1-sol": 128_000,
111
+ "gpt-6.1-terra": 128_000,
108
112
  "gpt-5.5": 72_000,
109
113
  "gpt-5.4": 128_000,
110
114
  "gpt-5.3-codex": 128_000,
@@ -124,6 +128,7 @@ export const CODEBUDDY_GLOBAL_MODEL_REASONING_EFFORTS: Record<string, string[]>
124
128
  "gpt-6-sol": ["low", "medium", "high", "xhigh"],
125
129
  "gpt-6-luna": ["low", "medium", "high", "xhigh"],
126
130
  "gpt-6.1-sol": ["low", "medium", "high", "xhigh"],
131
+ "gpt-6.1-terra": ["low", "medium", "high", "xhigh"],
127
132
  "glm-5.3": ["low", "high", "max"],
128
133
  "glm-5.2": ["high", "xhigh"],
129
134
  };
@@ -135,6 +140,7 @@ export const CODEBUDDY_GLOBAL_MODEL_DEFAULT_REASONING_EFFORTS: Record<string, st
135
140
  "gpt-6-sol": "high",
136
141
  "gpt-6-luna": "high",
137
142
  "gpt-6.1-sol": "high",
143
+ "gpt-6.1-terra": "high",
138
144
  "glm-5.3": "high",
139
145
  "glm-5.2": "high",
140
146
  };
@@ -5,6 +5,8 @@ export const CODEX_CONFIGURED_CAPACITY_WEIGHTS = {
5
5
  team: 1,
6
6
  business: 1,
7
7
  prolite: 5,
8
+ // Business Premium has 5x Standard included usage; this is display calibration only (#7440).
9
+ self_serve_business_prolite: 5,
8
10
  pro: 20,
9
11
  } as const;
10
12
 
@@ -13,7 +15,7 @@ export const CODEX_CONFIGURED_CAPACITY_WEIGHTS = {
13
15
  *
14
16
  * `CodexAccount.plan` is an unrestricted upstream string and cannot be enumerated: the
15
17
  * bundled model snapshot alone carries 21 distinct plan names (`edu_plus`, `finserv`,
16
- * `k12`, `quorum`, `self_serve_business_usage_based`, …) against the five listed above.
18
+ * `k12`, `quorum`, `self_serve_business_usage_based`, …) against the calibrated entries above.
17
19
  * Treating an unlisted plan as unknown dropped the account from the estimate entirely and
18
20
  * reported "incomplete coverage" — which is how a Business seat upgraded to Premium
19
21
  * disappeared from its own capacity report (#3155), and it was already happening to the
@@ -3,8 +3,11 @@ import { COST_VENDOR_PRIORITY, getModelMetadata, getModelMetadataCaseInsensitive
3
3
  import { cloneFastWire } from "./fastwire";
4
4
  import { isAzureModelMetadataDestination, publishedAzureModelMetadata, type AzureModelMetadata } from "./azure-model-metadata";
5
5
  import { resolveModelPolicy } from "./resolved-model-policy";
6
+ import { mapFill, nestedMapFill, stableUnion } from "./resolved-model-policy-merge";
7
+ import { mergeReasoningModelCapabilities } from "./reasoning-capabilities";
6
8
  import {
7
9
  PROVIDER_REGISTRY,
10
+ normalizedProviderEndpoint,
8
11
  registryEntryForProviderDestination,
9
12
  registryModelServiceTierCapabilityApplies,
10
13
  type ProviderRegistryEntry,
@@ -30,6 +33,7 @@ export interface DerivedKeyLoginProvider {
30
33
  contextWindow?: number;
31
34
  modelContextWindows?: Record<string, number>;
32
35
  modelInputModalities?: Record<string, string[]>;
36
+ modelCapabilities?: OcxProviderConfig["modelCapabilities"];
33
37
  modelMaxInputTokens?: Record<string, number>;
34
38
  defaultMaxOutputTokens?: number;
35
39
  modelMaxOutputTokens?: Record<string, number>;
@@ -56,6 +60,7 @@ export interface DerivedKeyLoginProvider {
56
60
  thinkingBudgetModels?: string[];
57
61
  escapeBuiltinToolNames?: boolean;
58
62
  openaiChatEofTolerance?: boolean;
63
+ foldDeveloperRoleToSystem?: boolean;
59
64
  googleMode?: "ai-studio" | "vertex" | "cloud-code-assist";
60
65
  project?: string;
61
66
  location?: string;
@@ -261,6 +266,7 @@ export function providerConfigSeed(entry: ProviderRegistryEntry): OcxProviderCon
261
266
  ...(staticPolicy.modelContextWindows ? { modelContextWindows: { ...staticPolicy.modelContextWindows } } : {}),
262
267
  ...(staticPolicy.modelDisplayNames ? { modelDisplayNames: { ...staticPolicy.modelDisplayNames } } : {}),
263
268
  ...(staticPolicy.modelInputModalities ? { modelInputModalities: cloneRecordOfArrays(staticPolicy.modelInputModalities) } : {}),
269
+ ...(staticPolicy.modelCapabilities ? { modelCapabilities: structuredClone(staticPolicy.modelCapabilities) } : {}),
264
270
  ...(staticPolicy.modelMaxInputTokens ? { modelMaxInputTokens: { ...staticPolicy.modelMaxInputTokens } } : {}),
265
271
  ...(entry.defaultMaxOutputTokens !== undefined ? { defaultMaxOutputTokens: entry.defaultMaxOutputTokens } : {}),
266
272
  ...(staticPolicy.modelMaxOutputTokens ? { modelMaxOutputTokens: { ...staticPolicy.modelMaxOutputTokens } } : {}),
@@ -280,6 +286,7 @@ export function providerConfigSeed(entry: ProviderRegistryEntry): OcxProviderCon
280
286
  ...(entry.promptCacheKey !== undefined ? { promptCacheKey: entry.promptCacheKey } : {}),
281
287
  ...(entry.chatServiceTier !== undefined ? { chatServiceTier: entry.chatServiceTier } : {}),
282
288
  ...(entry.openaiChatEofTolerance !== undefined ? { openaiChatEofTolerance: entry.openaiChatEofTolerance } : {}),
289
+ ...(entry.foldDeveloperRoleToSystem !== undefined ? { foldDeveloperRoleToSystem: entry.foldDeveloperRoleToSystem } : {}),
283
290
  ...(entry.responsesPath !== undefined ? { responsesPath: entry.responsesPath } : {}),
284
291
  ...(entry.chatCompletionsPath !== undefined ? { chatCompletionsPath: entry.chatCompletionsPath } : {}),
285
292
  ...(entry.statelessResponses !== undefined ? { statelessResponses: entry.statelessResponses } : {}),
@@ -312,6 +319,9 @@ export function deriveKeyLoginMap(): Record<string, DerivedKeyLoginProvider> {
312
319
  const out: Record<string, DerivedKeyLoginProvider> = {};
313
320
  for (const entry of PROVIDER_REGISTRY) {
314
321
  if (entry.authKind !== "key") continue;
322
+ // A deprecated route cannot complete a login, but its entry must stay resolvable for
323
+ // configs saved while it still worked.
324
+ if (entry.deprecated) continue;
315
325
  if (!entry.dashboardUrl) throw new Error(`Registry key provider missing dashboardUrl: ${entry.id}`);
316
326
  const liveModels = registryEntrySupportsLiveModelDiscovery(entry) ? entry.liveModels : false;
317
327
  out[entry.id] = {
@@ -334,6 +344,7 @@ export function deriveKeyLoginMap(): Record<string, DerivedKeyLoginProvider> {
334
344
  ...(entry.modelMaxOutputTokens ? { modelMaxOutputTokens: { ...entry.modelMaxOutputTokens } } : {}),
335
345
  ...(entry.reasoningEfforts ? { reasoningEfforts: [...entry.reasoningEfforts] } : {}),
336
346
  ...(entry.modelReasoningEfforts ? { modelReasoningEfforts: cloneRecordOfArrays(entry.modelReasoningEfforts) } : {}),
347
+ ...(entry.modelCapabilities ? { modelCapabilities: structuredClone(entry.modelCapabilities) } : {}),
337
348
  ...(entry.modelDefaultReasoningEfforts ? { modelDefaultReasoningEfforts: { ...entry.modelDefaultReasoningEfforts } } : {}),
338
349
  ...(entry.reasoningEffortMap ? { reasoningEffortMap: { ...entry.reasoningEffortMap } } : {}),
339
350
  ...(entry.modelReasoningEffortMap ? { modelReasoningEffortMap: cloneNestedRecord(entry.modelReasoningEffortMap) } : {}),
@@ -355,6 +366,7 @@ export function deriveKeyLoginMap(): Record<string, DerivedKeyLoginProvider> {
355
366
  ...(entry.thinkingBudgetModels ? { thinkingBudgetModels: [...entry.thinkingBudgetModels] } : {}),
356
367
  ...(entry.escapeBuiltinToolNames !== undefined ? { escapeBuiltinToolNames: entry.escapeBuiltinToolNames } : {}),
357
368
  ...(entry.openaiChatEofTolerance !== undefined ? { openaiChatEofTolerance: entry.openaiChatEofTolerance } : {}),
369
+ ...(entry.foldDeveloperRoleToSystem !== undefined ? { foldDeveloperRoleToSystem: entry.foldDeveloperRoleToSystem } : {}),
358
370
  ...(entry.googleMode ? { googleMode: entry.googleMode } : {}),
359
371
  ...(entry.project ? { project: entry.project } : {}),
360
372
  ...(entry.location ? { location: entry.location } : {}),
@@ -364,7 +376,7 @@ export function deriveKeyLoginMap(): Record<string, DerivedKeyLoginProvider> {
364
376
  }
365
377
 
366
378
  export function deriveInitProviders(): DerivedInitProvider[] {
367
- return PROVIDER_REGISTRY.map(entry => ({
379
+ return PROVIDER_REGISTRY.filter(entry => !entry.deprecated).map(entry => ({
368
380
  id: entry.id,
369
381
  label: formatInitLabel(entry),
370
382
  adapter: entry.adapter,
@@ -391,6 +403,7 @@ export function deriveOAuthIds(): string[] {
391
403
 
392
404
  export function deriveProviderPresets(): DerivedProviderPreset[] {
393
405
  const presets = PROVIDER_REGISTRY
406
+ .filter(entry => !entry.deprecated)
394
407
  .filter(entry => entry.featured || entry.authKind === "key" || entry.dashboardPreset)
395
408
  .map(entryToPreset);
396
409
  return [...dedupePresets(presets), customPreset()];
@@ -470,19 +483,33 @@ function applyVerbosityDefaults(prov: OcxProviderConfig, entry: ProviderRegistry
470
483
  * was skipped and the reasoning ladder was advertised without summary support — exactly the
471
484
  * inconsistency that makes Codex drop the inbound reasoning object.
472
485
  *
473
- * Deliberately narrow: reasoning-summary, effort, and replay-compatibility metadata only, via
486
+ * Deliberately narrow: reasoning-summary, effort, structured-output, and replay-compatibility metadata only, via
474
487
  * `registryEntryForProviderDestination`, which matches fixed key destinations and refuses
475
488
  * templated or overridable base URLs. A custom row keeps its own identity for everything else.
476
489
  */
477
490
  function enrichReasoningMetadataByDestination(prov: OcxProviderConfig): void {
478
491
  const destination = registryEntryForProviderDestination(prov);
492
+ const capabilities = mergeReasoningModelCapabilities(destination?.modelCapabilities, prov.modelCapabilities);
493
+ if (capabilities) prov.modelCapabilities = capabilities;
479
494
  applyReasoningSummaryDefaults(prov, destination?.modelSupportsReasoningSummaries);
495
+ if (destination?.modelDefaultReasoningEfforts) {
496
+ prov.modelDefaultReasoningEfforts = mapFill(destination.modelDefaultReasoningEfforts, prov.modelDefaultReasoningEfforts)[0];
497
+ }
498
+ if (destination?.modelReasoningEffortMap) {
499
+ prov.modelReasoningEffortMap = nestedMapFill(destination.modelReasoningEffortMap, prov.modelReasoningEffortMap)[0];
500
+ }
501
+ if (destination?.noStructuredOutputModels?.length) {
502
+ prov.noStructuredOutputModels = stableUnion(destination.noStructuredOutputModels, prov.noStructuredOutputModels)[0];
503
+ }
480
504
  if (prov.dropResponsesReasoningItems === undefined && destination?.dropResponsesReasoningItems !== undefined) {
481
505
  prov.dropResponsesReasoningItems = destination.dropResponsesReasoningItems;
482
506
  }
483
507
  if (destination?.modelReasoningEfforts) {
484
508
  prov.modelReasoningEfforts = fillRecordOfArrays(destination.modelReasoningEfforts, prov.modelReasoningEfforts);
485
509
  }
510
+ if (destination?.modelDefaultReasoningEfforts) {
511
+ [prov.modelDefaultReasoningEfforts] = mapFill(destination.modelDefaultReasoningEfforts, prov.modelDefaultReasoningEfforts);
512
+ }
486
513
  if (prov.reasoningEfforts === undefined && destination?.reasoningEfforts !== undefined) {
487
514
  prov.reasoningEfforts = [...destination.reasoningEfforts];
488
515
  }
@@ -496,6 +523,23 @@ export function hasLegacyClinePassReasoningEfforts(name: string, prov: OcxProvid
496
523
  && prov.reasoningEfforts[0] === "low";
497
524
  }
498
525
 
526
+ /**
527
+ * The registry's provider-wide `inputModalities` for a row that still points at that entry's
528
+ * destination. Runtime-only: callers apply it to a private copy (vision eligibility) or to the
529
+ * routed provider. Enrichment does not copy it, because init and management writes persist the
530
+ * enriched object, and a saved copy would follow the row to another URL.
531
+ */
532
+ export function registryInputModalitiesForDestination(name: string, prov: OcxProviderConfig): string[] | undefined {
533
+ let entry = PROVIDER_REGISTRY.find(row => row.id === name);
534
+ if (!entry || !providerMatchesRegistryTransportWithStaticGuards(name, prov)) {
535
+ entry = registryEntryForProviderDestination(prov);
536
+ // Runtime modality authority follows only the canonical fixed-key destination, not aliases.
537
+ if (entry && (entry.adapter !== prov.adapter
538
+ || normalizedProviderEndpoint(entry.baseUrl) !== normalizedProviderEndpoint(prov.baseUrl))) return undefined;
539
+ }
540
+ return entry?.inputModalities ? [...entry.inputModalities] : undefined;
541
+ }
542
+
499
543
  export function enrichProviderFromRegistry(name: string, prov: OcxProviderConfig): void {
500
544
  const entry = PROVIDER_REGISTRY.find(row => row.id === name);
501
545
  if (!entry || !providerMatchesRegistryTransportWithStaticGuards(name, prov)) {
@@ -551,6 +595,7 @@ export function enrichProviderFromRegistry(name: string, prov: OcxProviderConfig
551
595
  // (mapFill in src/providers/resolved-model-policy-merge.ts), so the wire honored the effort while /v1/models and
552
596
  // every client export showed no effort control at all.
553
597
  if (resolvedStatic.modelReasoningEfforts) prov.modelReasoningEfforts = cloneRecordOfArrays(resolvedStatic.modelReasoningEfforts);
598
+ if (resolvedStatic.modelCapabilities) prov.modelCapabilities = structuredClone(resolvedStatic.modelCapabilities);
554
599
  if (!prov.modelDefaultReasoningEfforts && seed.modelDefaultReasoningEfforts) prov.modelDefaultReasoningEfforts = { ...seed.modelDefaultReasoningEfforts };
555
600
  if (!prov.reasoningEffortMap && seed.reasoningEffortMap) prov.reasoningEffortMap = { ...seed.reasoningEffortMap };
556
601
  if (!prov.modelReasoningEffortMap && seed.modelReasoningEffortMap) prov.modelReasoningEffortMap = cloneNestedRecord(seed.modelReasoningEffortMap);
@@ -567,6 +612,9 @@ export function enrichProviderFromRegistry(name: string, prov: OcxProviderConfig
567
612
  if (prov.openaiChatEofTolerance === undefined && seed.openaiChatEofTolerance !== undefined) {
568
613
  prov.openaiChatEofTolerance = seed.openaiChatEofTolerance;
569
614
  }
615
+ if (prov.foldDeveloperRoleToSystem === undefined && seed.foldDeveloperRoleToSystem !== undefined) {
616
+ prov.foldDeveloperRoleToSystem = seed.foldDeveloperRoleToSystem;
617
+ }
570
618
  // Fill-only: a hand-edited path must survive, and a config saved before the registry
571
619
  // learned this route still gets backfilled.
572
620
  if (prov.responsesPath === undefined && seed.responsesPath !== undefined) prov.responsesPath = seed.responsesPath;
@@ -633,7 +681,7 @@ export function enrichProviderFromRegistry(name: string, prov: OcxProviderConfig
633
681
  }
634
682
 
635
683
  export function deriveFeaturedProviderIds(): string[] {
636
- return PROVIDER_REGISTRY.filter(entry => entry.featured).map(entry => entry.id);
684
+ return PROVIDER_REGISTRY.filter(entry => entry.featured && !entry.deprecated).map(entry => entry.id);
637
685
  }
638
686
 
639
687
  export function deriveJawcodeAliases(): Record<string, string> {
@@ -10,6 +10,8 @@ export const KIRO_MODELS = [
10
10
  // 260930 preemptive: GPT-6.1 Sol (OpenAI announced 2026-09-29; kiro.dev did not list it on 2026-09-30).
11
11
  // Mirrors gpt-6-sol; calls fail upstream until Kiro ships the model.
12
12
  "gpt-6.1-sol",
13
+ // 261027 preemptive: GPT-6.1 Terra (mirrors Kiro's GPT-6.1 Sol seed; provider listing unverified).
14
+ "gpt-6.1-terra",
13
15
  // 260929 preemptive: Claude Sonnet 5.5 added ahead of Kiro's catalog (kiro.dev did not list it on
14
16
  // 2026-09-29). Mirrors claude-sonnet-5; calls fail upstream until Kiro ships the model.
15
17
  "claude-sonnet-5.5",
@@ -46,6 +48,7 @@ export const KIRO_MODEL_CONTEXT_WINDOWS: Record<string, number> = {
46
48
  "gpt-6-sol": 272_000,
47
49
  "gpt-6-luna": 272_000,
48
50
  "gpt-6.1-sol": 272_000,
51
+ "gpt-6.1-terra": 272_000,
49
52
  "claude-sonnet-5.5": 1_000_000,
50
53
  "claude-sonnet-5": 1_000_000,
51
54
  "claude-opus-5.5": 1_000_000,
@@ -0,0 +1,12 @@
1
+ import type { ModelCapabilities } from "../types";
2
+
3
+ // Public MiMo V2.6 exposes an on/off switch, not distinct reasoning strengths.
4
+ export const MIMO_THINKING_MODELS = ["mimo-v2.6-pro", "mimo-v2.6-flash", "mimo-v2.6-pro-ultraspeed"] as const;
5
+ export const MIMO_THINKING_CAPABILITIES: Record<string, ModelCapabilities> = Object.fromEntries(
6
+ MIMO_THINKING_MODELS.map(id => [id, {
7
+ supportsReasoning: true,
8
+ supportsThinkingToggle: true,
9
+ supportsReasoningEffort: false,
10
+ defaultThinkingEnabled: true,
11
+ }]),
12
+ );
@@ -1,3 +1,4 @@
1
+ import { extractWorkBuddyModels } from "./workbuddy-models";
1
2
  import type { OcxProviderConfig } from "../types";
2
3
  import {
3
4
  isValidModelDiscoveryModelId,
@@ -513,6 +514,7 @@ export function extractProviderModelItems(
513
514
  discovery: ResolvedProviderModelDiscovery,
514
515
  ): ProviderModelItemsResult {
515
516
  const limit = positiveIntegerAtMost(discovery.maxModels, MODEL_DISCOVERY_MAX_MODELS);
517
+ if (discovery.spec?.format === "workbuddy") return extractWorkBuddyModels(value, limit);
516
518
  let data: unknown[];
517
519
  let siblings: SiblingIndex | null = null;
518
520
  if (Array.isArray(value)) {
@@ -67,6 +67,7 @@ export const PROVIDER_MODEL_RENAME_ROLES = {
67
67
  modelContextWindows: "record",
68
68
  modelContextTiers: "record",
69
69
  modelInputModalities: "record",
70
+ inputModalities: "none",
70
71
  modelCapabilities: "record",
71
72
  modelMaxInputTokens: "record",
72
73
  modelAutoCompactTokenLimits: "record",
@@ -153,6 +154,7 @@ export const PROVIDER_MODEL_RENAME_ROLES = {
153
154
  desktopExecutor: "none",
154
155
  unsafeAllowNativeLocalExec: "none",
155
156
  nativeLocalExec: "none",
157
+ messagePhaseInference: "none",
156
158
  tlsProfile: "none",
157
159
  } as const satisfies Record<keyof OcxProviderConfig, ModelRenameRole>;
158
160
 
@@ -19,6 +19,7 @@
19
19
  // Everything else in the row is left alone.
20
20
 
21
21
  import { PROVIDER_REGISTRY, normalizedProviderEndpoint } from "./registry";
22
+ import { MINIMAX_M31_FLASH, MINIMAX_M31_FLASH_PREVIEW_RETIRED } from "./registry/model-seeds";
22
23
  import { MODEL_KEYED_RECORDS, MODEL_ID_LISTS, MODEL_ID_SCALARS, MODEL_NESTED_RECORDS } from "./model-rename-fields";
23
24
  import { providerConfigSeed } from "./derive";
24
25
  import type { OcxConfig, OcxProviderConfig } from "../types";
@@ -138,6 +139,15 @@ export const MODEL_RENAMES: readonly ModelRename[] = [
138
139
  // may also hold one as a value. 3.8 resolves tiers from its own suffix ladder instead.
139
140
  dropReasoningEffortMap: true,
140
141
  })),
142
+ // MiniMax shipped M3.1-Flash as generally available on 2026-10-19 and retired the preview
143
+ // id, so a saved MiniMax-M3.1-Flash-Preview selection would answer model-not-found. The
144
+ // stale-roster refresh only matches exact old seeds; this repairs the preview id itself.
145
+ ...(["minimax", "minimax-cn"] as const).map(provider => ({
146
+ provider,
147
+ from: MINIMAX_M31_FLASH_PREVIEW_RETIRED,
148
+ to: MINIMAX_M31_FLASH,
149
+ reason: "MiniMax shipped M3.1-Flash as generally available and retired the preview id",
150
+ })),
141
151
  ];
142
152
 
143
153
  function renameInList(value: unknown, from: string, to: string): string[] | null {
@@ -5,7 +5,7 @@ import {
5
5
  type CodexAuthContext,
6
6
  type CodexAuthPolicyConfig,
7
7
  } from "../codex/auth-context";
8
- import { poolContextCreditHoldResetAt } from "../codex/pool-credit-policy";
8
+ import { poolContextCreditHoldResetAt, poolContextCreditRecoveryNeeded } from "../codex/pool-credit-policy";
9
9
 
10
10
  export function createOpenAiSidecarCreditGuard(
11
11
  context: CodexAuthContext,
@@ -16,7 +16,7 @@ export function createOpenAiSidecarCreditGuard(
16
16
  const resetAt = poolContextCreditHoldResetAt(context, policy);
17
17
  if (resetAt === undefined) return;
18
18
  releaseCodexAuthContextProbeLease(context);
19
- throw new CodexPoolAccountCreditsOffError(context.accountId, resetAt);
19
+ throw new CodexPoolAccountCreditsOffError(context.accountId, resetAt, poolContextCreditRecoveryNeeded(context, policy), context.quotaScope);
20
20
  };
21
21
  }
22
22
 
@@ -203,7 +203,7 @@ export function supportsPerAccountQuota(provider: string): boolean {
203
203
 
204
204
  export function explicitAccountReader(provider: string): boolean {
205
205
  return provider === "xai" || provider === "cursor" || provider === "kimi" || provider === "command-code"
206
- || provider === "devin" || provider === "dsh-account";
206
+ || provider === "devin" || provider === "workbuddy-ai" || provider === "dsh-account";
207
207
  }
208
208
 
209
209
  export function providerOAuthAccountQuotaMode(provider: string): AccountQuotaMode {
@@ -558,6 +558,7 @@ export function quotaCredentialIdentity(provider: string, accountId: string, cre
558
558
  // Only credentials that carry their own endpoint (Devin tenants) extend the identity, so
559
559
  // every other provider's existing cache keys stay valid.
560
560
  ...(provider === "devin" && credential.apiBaseUrl ? [credential.apiBaseUrl] : []),
561
+ ...(provider === "workbuddy-ai" ? [credential.workbuddy] : []),
561
562
  ])).digest("hex");
562
563
  }
563
564
 
@@ -567,5 +568,5 @@ export function explicitQuotaDestination(provider: string, config: OcxProviderCo
567
568
  if (provider === "command-code") return isCanonicalCommandCodeBaseUrl(config.baseUrl);
568
569
  // These readers use fixed canonical billing origins, never config.baseUrl. Devin reads
569
570
  // the credential's own allowlisted api-server host instead (fetchDevinQuota revalidates it).
570
- return provider === "xai" || provider === "cursor" || provider === "devin" || provider === "dsh-account";
571
+ return provider === "xai" || provider === "cursor" || provider === "devin" || provider === "workbuddy-ai" || provider === "dsh-account";
571
572
  }
@@ -3,9 +3,13 @@ import { DestinationDnsResolutionError } from "../../lib/destination-policy";
3
3
  import { PinnedHttpError, type PinnedHttpErrorCode } from "../../lib/pinned-http";
4
4
  import { ProviderOutboundPolicyError, providerOutboundPost, providerRedirectError, type ProviderOutboundDependencies } from "../../lib/provider-outbound";
5
5
  import { getValidAccessToken } from "../../oauth";
6
- import { getAccountCredential, getCredential } from "../../oauth/store";
6
+ import { getAccountCredential, getAccountSet, getCredential } from "../../oauth/store";
7
7
  import { asRecord, normalizePercent, normalizeResetAt, readQuotaJson, REQUEST_TIMEOUT_MS, toFiniteNumber } from "../quota-wire";
8
- import { report, type ProviderQuotaReport } from "./report-cache";
8
+ import { antigravityEvidence, report, type ProviderQuotaReport } from "./report-cache";
9
+ import { captureAntigravityQuotaReceipt, decisionQuotaSinkActive } from "../../lib/decision-quota-sink";
10
+ import { antigravityDecisionWindows } from "../quota-decision-publication";
11
+ import { antigravityQuotaCredentialGeneration, isAntigravityArgonIdentity } from "../antigravity-quota-identity";
12
+ import type { OcxProviderConfig } from "../../types";
9
13
  import { quotaCredentialIdentity } from "./account-cache";
10
14
  import type { ProviderQuota, ProviderQuotaWindow, QuotaFailureCode } from "../quota-types";
11
15
  import { httpQuotaFailure } from "./failure-codes";
@@ -46,11 +50,6 @@ function quotaInfoEntries(modelInfo: Record<string, unknown>): Record<string, un
46
50
  return entries;
47
51
  }
48
52
 
49
- /**
50
- * Gemini 4 Argon has its own quota pool. Its names also contain "gemini", so every family
51
- * decision below checks Argon first; otherwise Argon readings fill or replace the Gem family.
52
- */
53
- const ARGON_TOKEN = /(?:^|[^a-z0-9])argon(?:[^a-z0-9]|$)/i;
54
53
  const GEMINI_TOKEN = /(?:^|[^a-z0-9])gemini(?:[^a-z0-9]|$)/i;
55
54
  const CLAUDE_FAMILY_TOKEN = /(?:^|[^a-z0-9])(?:claude|3p|gpt|opus|sonnet)(?:[^a-z0-9]|$)/i;
56
55
  /** Canonical model of the Argon summary pool; tagging keeps the window out of routing. */
@@ -61,7 +60,7 @@ type AntigravitySummaryFamily = "argon" | "gem" | "cla";
61
60
  /** A bucket's own id and name decide its family when they name one; the group decides otherwise. */
62
61
  function antigravitySummaryBucketFamily(bucket: Record<string, unknown>): AntigravitySummaryFamily | undefined {
63
62
  const identity = `${typeof bucket.bucketId === "string" ? bucket.bucketId : ""} ${typeof bucket.displayName === "string" ? bucket.displayName : ""}`;
64
- if (ARGON_TOKEN.test(identity)) return "argon";
63
+ if (isAntigravityArgonIdentity(identity)) return "argon";
65
64
  if (GEMINI_TOKEN.test(identity)) return "gem";
66
65
  if (CLAUDE_FAMILY_TOKEN.test(identity)) return "cla";
67
66
  return undefined;
@@ -70,7 +69,7 @@ function antigravitySummaryBucketFamily(bucket: Record<string, unknown>): Antigr
70
69
  function classifyAntigravityFamily(modelId: string, modelInfo: Record<string, unknown>, quotaInfo: Record<string, unknown>): "Gem" | "Cla" | null {
71
70
  const displayName = typeof modelInfo.displayName === "string" ? modelInfo.displayName : "";
72
71
  // Argon models keep their exact model rows but never seed the shared Gem family bar.
73
- if (ARGON_TOKEN.test(`${modelId} ${displayName}`)) return null;
72
+ if (isAntigravityArgonIdentity(`${modelId} ${displayName}`)) return null;
74
73
  const tier = typeof quotaInfo.tier === "string" ? quotaInfo.tier : "";
75
74
  const haystack = `${modelId} ${displayName} ${tier}`.toLowerCase();
76
75
  if (haystack.includes("gemini")) return "Gem";
@@ -155,7 +154,7 @@ function parseAntigravityQuotaSummary(body: Record<string, unknown> | null): Pro
155
154
  const groupDisplayName = typeof group.displayName === "string" ? group.displayName : "";
156
155
  const groupName = `${groupDisplayName} ${typeof group.description === "string" ? group.description : ""}`.toLowerCase();
157
156
  // A description that merely mentions Argon must not move a whole Gemini group.
158
- const groupFamily: AntigravitySummaryFamily | undefined = ARGON_TOKEN.test(groupDisplayName) ? "argon"
157
+ const groupFamily: AntigravitySummaryFamily | undefined = isAntigravityArgonIdentity(groupDisplayName) ? "argon"
159
158
  : groupName.includes("gemini") ? "gem"
160
159
  : groupName.includes("claude") || groupName.includes("3p") || groupName.includes("gpt") ? "cla"
161
160
  : undefined;
@@ -360,13 +359,25 @@ export async function fetchAntigravityUsageQuota(accessToken: string, projectId:
360
359
  return null;
361
360
  }
362
361
 
363
- export async function fetchAntigravityQuota(provider: string): Promise<ProviderQuotaReport | null> {
364
- const credential = getCredential("google-antigravity");
362
+ /** Every store read uses `provider`, the same key inference resolves, so a row never probes another row's account. */
363
+ export async function fetchAntigravityQuota(provider: string, config: OcxProviderConfig): Promise<ProviderQuotaReport | null> {
364
+ const credential = getCredential(provider);
365
365
  if (!credential?.projectId) return null;
366
366
  let accessToken: string;
367
- try { accessToken = await getValidAccessToken("google-antigravity"); } catch { return null; }
367
+ try { accessToken = await getValidAccessToken(provider); } catch { return null; }
368
+ const set = decisionQuotaSinkActive() ? getAccountSet(provider) : undefined;
369
+ const account = set?.accounts.find(row => row.id === set.activeAccountId);
370
+ const probed = account?.credential.access === accessToken && account.credential.projectId === credential.projectId ? account : undefined;
371
+ const receipt = probed ? captureAntigravityQuotaReceipt(provider, config, probed.id, antigravityQuotaCredentialGeneration(probed.credential)) : undefined;
368
372
  const result = await probeAntigravityUsageQuota(accessToken, credential.projectId);
369
- if (result.kind === "available") return report(provider, result.source, result.quota);
373
+ if (result.kind === "available") {
374
+ const value = report(provider, result.source, result.quota);
375
+ // Only the summary endpoint reports real family buckets. The models fallback labels one model's
376
+ // counter Gem/Cla, so it stays display-only: no windows, and retained summary clocks survive.
377
+ const windows = result.source === "google-antigravity:retrieveUserQuotaSummary" ? antigravityDecisionWindows(result.quota) : [];
378
+ if (value && receipt) antigravityEvidence.set(value, { receipt, windows: Object.freeze(windows.map(row => Object.freeze(row))) });
379
+ return value;
380
+ }
370
381
  if (result.legacy.kind === "throw") throw result.legacy.error;
371
382
  return null;
372
383
  }
@@ -1,5 +1,6 @@
1
- import { decisionQuotaSinkActive, invalidateDecisionKeyQuotas, publishDecisionKeyQuota } from "../../lib/decision-quota-sink";
1
+ import { decisionQuotaSinkActive, invalidateDecisionKeyQuotas, replaceCollectedDecisionQuotas, type AntigravityQuotaObservation, type AntigravityQuotaReceipt, type DecisionKeyObservation } from "../../lib/decision-quota-sink";
2
2
  import { providerDecisionWindows } from "../quota-decision-publication";
3
+ import type { DecisionQuotaWindow } from "../quota-decision-snapshot";
3
4
  import { createHash } from "node:crypto";
4
5
  import { effectiveCodexAuthAccountId, listCodexAuthAccountsSnapshot } from "../../codex/auth-api";
5
6
  import { withoutRetiredCodexQuota, type StoredAccountQuota } from "../../codex/quota";
@@ -21,6 +22,8 @@ export const LAST_GOOD_MAX_AGE_MS = CODEX_CAPACITY_MAX_QUOTA_AGE_MS;
21
22
  const nativeMainReportGenerations = new WeakMap<ProviderQuotaReport, number>();
22
23
  export const accountReportCurrent = new WeakMap<ProviderQuotaReport, () => boolean>();
23
24
  export const routingEvidence = new WeakMap<ProviderQuotaReport, ProviderQuotaRoutingEvidence>();
25
+ /** Only the live Antigravity probe binds this projection; display/last-good rows cannot create it. */
26
+ export const antigravityEvidence = new WeakMap<ProviderQuotaReport, { receipt: AntigravityQuotaReceipt; windows: readonly DecisionQuotaWindow[] }>();
24
27
  export let providerQuotaBeforePublishForTests: (() => void | Promise<void>) | null = null;
25
28
 
26
29
  /** Test-only seam for identity/config invalidation after probes but before publication. */
@@ -100,6 +103,7 @@ export function clearProviderQuotaCache(): void {
100
103
  cache = null;
101
104
  clearCachedProviderQuotas();
102
105
  clearProviderApiKeyQuotaCache();
106
+ invalidateDecisionKeyQuotas();
103
107
  invalidationEpoch += 1;
104
108
  }
105
109
 
@@ -350,13 +354,18 @@ export function isProviderQuotaReportCurrent(value: ProviderQuotaReport): boolea
350
354
  /** Called only by an accepted collector/cache publication, never the JEV read path. */
351
355
  export function publishCollectedDecisionQuota(reports: ProviderQuotaReport[], config: OcxConfig): void {
352
356
  if (!decisionQuotaSinkActive()) return;
353
- invalidateDecisionKeyQuotas();
357
+ const keys: DecisionKeyObservation[] = [];
358
+ const oauth: AntigravityQuotaObservation[] = [];
354
359
  for (const report of reports) {
355
360
  const provider = config.providers[report.provider];
361
+ if (!provider || !isProviderQuotaReportCurrent(report)) continue;
362
+ const observation = antigravityEvidence.get(report);
363
+ if (observation) oauth.push({ name: report.provider, provider, ...observation });
356
364
  const evidence = routingEvidence.get(report);
357
- if (provider && evidence && evidence.binding === providerQuotaRoutingBinding(report.provider, provider))
358
- publishDecisionKeyQuota(report.provider, provider, providerDecisionWindows(evidence.quota));
365
+ if (evidence && evidence.binding === providerQuotaRoutingBinding(report.provider, provider))
366
+ keys.push({ name: report.provider, provider, windows: providerDecisionWindows(evidence.quota) });
359
367
  }
368
+ replaceCollectedDecisionQuotas(keys, oauth);
360
369
  }
361
370
 
362
371
  /**