codex-multi-auth 2.17.0 → 2.17.3

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 (450) hide show
  1. package/.codex-plugin/plugin.json +9 -9
  2. package/LICENSE +21 -21
  3. package/README.md +142 -484
  4. package/assets/codex-multi-auth-icon.svg +39 -39
  5. package/assets/readme-hero.svg +31 -31
  6. package/config/README.md +31 -31
  7. package/config/codex-legacy.json +1221 -1221
  8. package/config/codex-modern.json +423 -423
  9. package/config/minimal-codex.json +15 -15
  10. package/dist/index.d.ts +0 -1
  11. package/dist/lib/account-policy.d.ts +18 -2
  12. package/dist/lib/account-policy.js +97 -40
  13. package/dist/lib/accounts/rate-limits.d.ts +0 -1
  14. package/dist/lib/accounts.d.ts +1 -8
  15. package/dist/lib/accounts.d.ts.map +1 -1
  16. package/dist/lib/accounts.js +7 -19
  17. package/dist/lib/api-route-store.d.ts +0 -1
  18. package/dist/lib/audit.d.ts +0 -1
  19. package/dist/lib/audit.js +43 -12
  20. package/dist/lib/auth/account-access.d.ts +0 -1
  21. package/dist/lib/auth/account-access.js +5 -1
  22. package/dist/lib/auth/auth.d.ts +4 -3
  23. package/dist/lib/auth/auth.js +220 -28
  24. package/dist/lib/auth/browser.d.ts +0 -1
  25. package/dist/lib/auth/callback-guidance.d.ts +0 -1
  26. package/dist/lib/auth/device-auth.d.ts +0 -1
  27. package/dist/lib/auth/index.d.ts +0 -1
  28. package/dist/lib/auth/org-override.d.ts +0 -1
  29. package/dist/lib/auth/server.d.ts +1 -2
  30. package/dist/lib/auth/server.js +100 -53
  31. package/dist/lib/auth/token-utils.d.ts +0 -1
  32. package/dist/lib/auth-rate-limit.d.ts +0 -1
  33. package/dist/lib/budget-guard.d.ts +16 -2
  34. package/dist/lib/budget-guard.js +123 -43
  35. package/dist/lib/capability-policy.d.ts +0 -1
  36. package/dist/lib/circuit-breaker.d.ts +20 -1
  37. package/dist/lib/circuit-breaker.js +24 -5
  38. package/dist/lib/cli.d.ts +0 -1
  39. package/dist/lib/codex-cli/index.d.ts +0 -1
  40. package/dist/lib/codex-cli/observability.d.ts +0 -1
  41. package/dist/lib/codex-cli/state.d.ts +0 -1
  42. package/dist/lib/codex-cli/sync.d.ts +0 -1
  43. package/dist/lib/codex-cli/writer.d.ts +0 -1
  44. package/dist/lib/codex-manager/account-credentials.d.ts +0 -1
  45. package/dist/lib/codex-manager/account-manager-commands.d.ts +0 -1
  46. package/dist/lib/codex-manager/account-pool-write.d.ts +0 -1
  47. package/dist/lib/codex-manager/active-account-sync.d.ts +6 -0
  48. package/dist/lib/codex-manager/active-account-sync.js +336 -0
  49. package/dist/lib/codex-manager/api-login-menu.d.ts +0 -1
  50. package/dist/lib/codex-manager/backend-category-entry.d.ts +0 -1
  51. package/dist/lib/codex-manager/backend-category-helpers.d.ts +0 -1
  52. package/dist/lib/codex-manager/backend-category-prompt.d.ts +0 -1
  53. package/dist/lib/codex-manager/backend-settings-controller.d.ts +0 -1
  54. package/dist/lib/codex-manager/backend-settings-entry.d.ts +0 -1
  55. package/dist/lib/codex-manager/backend-settings-helpers.d.ts +0 -1
  56. package/dist/lib/codex-manager/backend-settings-prompt.d.ts +0 -1
  57. package/dist/lib/codex-manager/backend-settings-schema.d.ts +0 -1
  58. package/dist/lib/codex-manager/behavior-settings-panel.d.ts +0 -1
  59. package/dist/lib/codex-manager/commands/account.d.ts +8 -3
  60. package/dist/lib/codex-manager/commands/account.js +46 -34
  61. package/dist/lib/codex-manager/commands/best.d.ts +0 -1
  62. package/dist/lib/codex-manager/commands/bridge.d.ts +0 -1
  63. package/dist/lib/codex-manager/commands/budget.d.ts +8 -3
  64. package/dist/lib/codex-manager/commands/budget.js +6 -4
  65. package/dist/lib/codex-manager/commands/check.d.ts +0 -1
  66. package/dist/lib/codex-manager/commands/config-explain.d.ts +0 -1
  67. package/dist/lib/codex-manager/commands/debug-bundle.d.ts +0 -1
  68. package/dist/lib/codex-manager/commands/forecast.d.ts +1 -2
  69. package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -1
  70. package/dist/lib/codex-manager/commands/forecast.js +2 -2
  71. package/dist/lib/codex-manager/commands/history.d.ts +0 -1
  72. package/dist/lib/codex-manager/commands/init-config.d.ts +0 -1
  73. package/dist/lib/codex-manager/commands/integrations.d.ts +0 -1
  74. package/dist/lib/codex-manager/commands/limits.d.ts +0 -1
  75. package/dist/lib/codex-manager/commands/models.d.ts +0 -1
  76. package/dist/lib/codex-manager/commands/monitor.d.ts +0 -1
  77. package/dist/lib/codex-manager/commands/report.d.ts +0 -1
  78. package/dist/lib/codex-manager/commands/resets.d.ts +0 -1
  79. package/dist/lib/codex-manager/commands/resets.js +9 -1
  80. package/dist/lib/codex-manager/commands/rotation.d.ts +0 -1
  81. package/dist/lib/codex-manager/commands/status.d.ts +0 -1
  82. package/dist/lib/codex-manager/commands/switch.d.ts +0 -1
  83. package/dist/lib/codex-manager/commands/uninstall.d.ts +0 -1
  84. package/dist/lib/codex-manager/commands/unpin.d.ts +0 -1
  85. package/dist/lib/codex-manager/commands/usage.d.ts +0 -1
  86. package/dist/lib/codex-manager/commands/verify.d.ts +0 -1
  87. package/dist/lib/codex-manager/commands/why-selected.d.ts +0 -1
  88. package/dist/lib/codex-manager/commands/workspace.d.ts +0 -1
  89. package/dist/lib/codex-manager/dashboard-display-panel.d.ts +0 -1
  90. package/dist/lib/codex-manager/dashboard-formatters.d.ts +0 -1
  91. package/dist/lib/codex-manager/dashboard-settings-controller.d.ts +0 -1
  92. package/dist/lib/codex-manager/dashboard-settings-data.d.ts +0 -1
  93. package/dist/lib/codex-manager/dashboard-settings-entry.d.ts +0 -1
  94. package/dist/lib/codex-manager/experimental-settings-entry.d.ts +0 -1
  95. package/dist/lib/codex-manager/experimental-settings-prompt.d.ts +0 -1
  96. package/dist/lib/codex-manager/experimental-settings-schema.d.ts +0 -1
  97. package/dist/lib/codex-manager/experimental-sync-target-entry.d.ts +0 -1
  98. package/dist/lib/codex-manager/experimental-sync-target.d.ts +0 -1
  99. package/dist/lib/codex-manager/forecast-report-shared.d.ts +0 -1
  100. package/dist/lib/codex-manager/formatters/account-formatters.d.ts +0 -1
  101. package/dist/lib/codex-manager/formatters/index.d.ts +0 -1
  102. package/dist/lib/codex-manager/formatters/model-formatters.d.ts +0 -1
  103. package/dist/lib/codex-manager/formatters/quota-formatters.d.ts +0 -1
  104. package/dist/lib/codex-manager/formatters/text-style.d.ts +0 -1
  105. package/dist/lib/codex-manager/health-check.d.ts +0 -1
  106. package/dist/lib/codex-manager/health-check.js +1 -1
  107. package/dist/lib/codex-manager/help.d.ts +0 -1
  108. package/dist/lib/codex-manager/login-action-panel.d.ts +0 -1
  109. package/dist/lib/codex-manager/login-flow.d.ts +0 -1
  110. package/dist/lib/codex-manager/login-menu-actions.d.ts +0 -1
  111. package/dist/lib/codex-manager/login-menu-data.d.ts +0 -1
  112. package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -1
  113. package/dist/lib/codex-manager/login-menu-data.js +7 -3
  114. package/dist/lib/codex-manager/login-oauth.d.ts +0 -1
  115. package/dist/lib/codex-manager/login-workspace-choice.d.ts +0 -1
  116. package/dist/lib/codex-manager/manual-callback.d.ts +0 -1
  117. package/dist/lib/codex-manager/persist-selected-account.d.ts +0 -1
  118. package/dist/lib/codex-manager/quota-cache-helpers.d.ts +7 -2
  119. package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -1
  120. package/dist/lib/codex-manager/quota-cache-helpers.js +34 -19
  121. package/dist/lib/codex-manager/rate-limit-markers.d.ts +0 -1
  122. package/dist/lib/codex-manager/repair-commands.d.ts +0 -1
  123. package/dist/lib/codex-manager/repair-commands.js +1 -1
  124. package/dist/lib/codex-manager/settings-hub/backend.d.ts +0 -1
  125. package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +0 -1
  126. package/dist/lib/codex-manager/settings-hub/experimental.d.ts +0 -1
  127. package/dist/lib/codex-manager/settings-hub/index.d.ts +0 -1
  128. package/dist/lib/codex-manager/settings-hub/shared.d.ts +0 -1
  129. package/dist/lib/codex-manager/settings-hub-entry.d.ts +0 -1
  130. package/dist/lib/codex-manager/settings-hub-menu.d.ts +0 -1
  131. package/dist/lib/codex-manager/settings-hub-prompt.d.ts +0 -1
  132. package/dist/lib/codex-manager/settings-hub.d.ts +0 -1
  133. package/dist/lib/codex-manager/settings-panels.d.ts +0 -1
  134. package/dist/lib/codex-manager/settings-persist-utils.d.ts +0 -1
  135. package/dist/lib/codex-manager/settings-preview.d.ts +0 -1
  136. package/dist/lib/codex-manager/settings-write-queue.d.ts +0 -1
  137. package/dist/lib/codex-manager/statusline-settings-panel.d.ts +0 -1
  138. package/dist/lib/codex-manager/theme-settings-panel.d.ts +0 -1
  139. package/dist/lib/codex-manager/unified-settings-controller.d.ts +0 -1
  140. package/dist/lib/codex-manager/unified-settings-entry.d.ts +0 -1
  141. package/dist/lib/codex-manager.d.ts +1 -2
  142. package/dist/lib/codex-manager.js +5 -95
  143. package/dist/lib/concurrency.d.ts +0 -1
  144. package/dist/lib/config-schema.d.ts +0 -1
  145. package/dist/lib/config.d.ts +0 -1
  146. package/dist/lib/config.js +46 -241
  147. package/dist/lib/constants.d.ts +0 -1
  148. package/dist/lib/context-budget/model-context-windows.d.ts +0 -1
  149. package/dist/lib/context-budget-guard.d.ts +0 -1
  150. package/dist/lib/context-budget-response.d.ts +0 -1
  151. package/dist/lib/context-budget-response.js +8 -8
  152. package/dist/lib/context-overflow.d.ts +0 -1
  153. package/dist/lib/context-overflow.js +10 -10
  154. package/dist/lib/dashboard-settings.d.ts +0 -1
  155. package/dist/lib/entitlement-cache.d.ts +0 -1
  156. package/dist/lib/env-parsing.d.ts +13 -1
  157. package/dist/lib/env-parsing.js +21 -0
  158. package/dist/lib/errors.d.ts +0 -1
  159. package/dist/lib/forecast.d.ts +0 -1
  160. package/dist/lib/fs-retry.d.ts +0 -1
  161. package/dist/lib/health.d.ts +0 -1
  162. package/dist/lib/index.d.ts +0 -1
  163. package/dist/lib/integration-generators.d.ts +0 -1
  164. package/dist/lib/live-account-sync.d.ts +0 -1
  165. package/dist/lib/local-bridge.d.ts +0 -1
  166. package/dist/lib/local-bridge.js +4 -1
  167. package/dist/lib/local-client-tokens.d.ts +0 -1
  168. package/dist/lib/local-client-tokens.js +125 -30
  169. package/dist/lib/logger.d.ts +0 -1
  170. package/dist/lib/logger.js +11 -1
  171. package/dist/lib/model-capability-matrix.d.ts +0 -1
  172. package/dist/lib/model-route-policy.d.ts +1 -2
  173. package/dist/lib/named-backup-export.d.ts +0 -1
  174. package/dist/lib/oauth-success.html +125 -125
  175. package/dist/lib/oc-chatgpt-import-adapter.d.ts +0 -1
  176. package/dist/lib/oc-chatgpt-orchestrator.d.ts +0 -1
  177. package/dist/lib/oc-chatgpt-target-detection.d.ts +0 -1
  178. package/dist/lib/parallel-probe.d.ts +0 -1
  179. package/dist/lib/policy/runtime-policy-cache.d.ts +80 -0
  180. package/dist/lib/policy/runtime-policy-cache.js +310 -0
  181. package/dist/lib/policy/runtime-policy.d.ts +1 -2
  182. package/dist/lib/policy/runtime-policy.js +46 -19
  183. package/dist/lib/preemptive-quota-scheduler.d.ts +0 -1
  184. package/dist/lib/proactive-refresh.d.ts +0 -1
  185. package/dist/lib/prompts/codex-host-bridge.d.ts +0 -1
  186. package/dist/lib/prompts/codex-host-bridge.js +138 -138
  187. package/dist/lib/prompts/codex.d.ts +0 -1
  188. package/dist/lib/prompts/codex.js +79 -79
  189. package/dist/lib/prompts/fetch-utils.d.ts +0 -1
  190. package/dist/lib/prompts/host-codex-prompt.d.ts +0 -1
  191. package/dist/lib/quota-cache.d.ts +7 -4
  192. package/dist/lib/quota-cache.d.ts.map +1 -1
  193. package/dist/lib/quota-cache.js +117 -61
  194. package/dist/lib/quota-probe.d.ts +0 -1
  195. package/dist/lib/quota-probe.js +5 -2
  196. package/dist/lib/quota-readiness.d.ts +7 -3
  197. package/dist/lib/quota-readiness.d.ts.map +1 -1
  198. package/dist/lib/quota-readiness.js +25 -4
  199. package/dist/lib/recovery/constants.d.ts +0 -1
  200. package/dist/lib/recovery/storage.d.ts +0 -1
  201. package/dist/lib/recovery/types.d.ts +0 -1
  202. package/dist/lib/recovery.d.ts +0 -1
  203. package/dist/lib/redaction.d.ts +0 -1
  204. package/dist/lib/refresh-guardian.d.ts +0 -1
  205. package/dist/lib/refresh-lease.d.ts +0 -1
  206. package/dist/lib/refresh-queue.d.ts +0 -1
  207. package/dist/lib/request/client-cancellation.d.ts +0 -1
  208. package/dist/lib/request/error-classification.d.ts +0 -1
  209. package/dist/lib/request/failover-config.d.ts +0 -1
  210. package/dist/lib/request/failure-policy.d.ts +0 -1
  211. package/dist/lib/request/fetch-helpers.d.ts +0 -1
  212. package/dist/lib/request/headers.d.ts +0 -1
  213. package/dist/lib/request/helpers/input-utils.d.ts +0 -1
  214. package/dist/lib/request/helpers/input-utils.js +88 -34
  215. package/dist/lib/request/helpers/model-map.d.ts +0 -1
  216. package/dist/lib/request/helpers/tool-utils.d.ts +0 -1
  217. package/dist/lib/request/helpers/tool-utils.js +421 -4
  218. package/dist/lib/request/index.d.ts +0 -1
  219. package/dist/lib/request/rate-limit-backoff.d.ts +0 -1
  220. package/dist/lib/request/rate-limit-decision.d.ts +0 -1
  221. package/dist/lib/request/request-attempt-budget.d.ts +0 -1
  222. package/dist/lib/request/request-init.d.ts +0 -1
  223. package/dist/lib/request/request-resilience.d.ts +0 -1
  224. package/dist/lib/request/request-transformer.d.ts +0 -1
  225. package/dist/lib/request/request-transformer.js +50 -25
  226. package/dist/lib/request/response-compaction.d.ts +0 -1
  227. package/dist/lib/request/response-handler.d.ts +0 -1
  228. package/dist/lib/request/response-metadata.d.ts +0 -1
  229. package/dist/lib/request/response-outcome.d.ts +0 -1
  230. package/dist/lib/request/stream-failover-runtime.d.ts +0 -1
  231. package/dist/lib/request/stream-failover.d.ts +0 -1
  232. package/dist/lib/request/stream-failover.js +28 -4
  233. package/dist/lib/request/token-refresh.d.ts +0 -1
  234. package/dist/lib/request/url-rewriting.d.ts +0 -1
  235. package/dist/lib/request/wait-utils.d.ts +0 -1
  236. package/dist/lib/rotation.d.ts +0 -1
  237. package/dist/lib/routing-mutex.d.ts +0 -1
  238. package/dist/lib/routing-profiles.d.ts +16 -2
  239. package/dist/lib/routing-profiles.js +119 -44
  240. package/dist/lib/runtime/account-check-helpers.d.ts +0 -1
  241. package/dist/lib/runtime/account-check-types.d.ts +0 -1
  242. package/dist/lib/runtime/account-check.d.ts +0 -1
  243. package/dist/lib/runtime/account-manager-cache-entry.d.ts +0 -1
  244. package/dist/lib/runtime/account-manager-cache.d.ts +0 -1
  245. package/dist/lib/runtime/account-model-catalog.d.ts +1 -2
  246. package/dist/lib/runtime/account-pool.d.ts +0 -1
  247. package/dist/lib/runtime/account-reset-credits.d.ts +0 -1
  248. package/dist/lib/runtime/account-reset-credits.js +8 -2
  249. package/dist/lib/runtime/account-scope.d.ts +0 -1
  250. package/dist/lib/runtime/account-select-event.d.ts +0 -1
  251. package/dist/lib/runtime/account-selection.d.ts +0 -1
  252. package/dist/lib/runtime/account-state.d.ts +0 -1
  253. package/dist/lib/runtime/account-status.d.ts +0 -1
  254. package/dist/lib/runtime/account-storage-scope-entry.d.ts +0 -1
  255. package/dist/lib/runtime/api-model-capabilities.d.ts +0 -1
  256. package/dist/lib/runtime/api-model-runtime.d.ts +0 -1
  257. package/dist/lib/runtime/app-bind.d.ts +0 -1
  258. package/dist/lib/runtime/app-bind.d.ts.map +1 -1
  259. package/dist/lib/runtime/app-bind.js +10 -2
  260. package/dist/lib/runtime/app-helper-selection.d.ts +0 -1
  261. package/dist/lib/runtime/auth-facade.d.ts +0 -1
  262. package/dist/lib/runtime/automatic-account-checks.d.ts +5 -2
  263. package/dist/lib/runtime/automatic-account-checks.d.ts.map +1 -1
  264. package/dist/lib/runtime/automatic-account-checks.js +29 -2
  265. package/dist/lib/runtime/automatic-subscription-checks.d.ts +1 -2
  266. package/dist/lib/runtime/automatic-subscription-checks.d.ts.map +1 -1
  267. package/dist/lib/runtime/automatic-subscription-checks.js +13 -16
  268. package/dist/lib/runtime/browser-oauth-flow.d.ts +0 -1
  269. package/dist/lib/runtime/capability-boost.d.ts +0 -1
  270. package/dist/lib/runtime/catalog-capabilities.d.ts +0 -1
  271. package/dist/lib/runtime/config-toml.d.ts +0 -1
  272. package/dist/lib/runtime/context-budget-settings.d.ts +0 -1
  273. package/dist/lib/runtime/event-handler.d.ts +0 -1
  274. package/dist/lib/runtime/first-run.d.ts +0 -1
  275. package/dist/lib/runtime/flagged-verify-types.d.ts +0 -1
  276. package/dist/lib/runtime/hydrate-emails.d.ts +0 -1
  277. package/dist/lib/runtime/inference-activity.d.ts +0 -1
  278. package/dist/lib/runtime/live-sync-entry.d.ts +0 -1
  279. package/dist/lib/runtime/live-sync.d.ts +0 -1
  280. package/dist/lib/runtime/loader-setup.d.ts +0 -1
  281. package/dist/lib/runtime/login-menu-accounts.d.ts +0 -1
  282. package/dist/lib/runtime/manual-oauth-flow.d.ts +0 -1
  283. package/dist/lib/runtime/model-discovery-status.d.ts +2 -3
  284. package/dist/lib/runtime/native-account-storage.d.ts +0 -1
  285. package/dist/lib/runtime/native-account-sync.d.ts +0 -1
  286. package/dist/lib/runtime/native-binding-lock.d.ts +0 -1
  287. package/dist/lib/runtime/native-client-auth.d.ts +0 -1
  288. package/dist/lib/runtime/native-provider-config.d.ts +0 -1
  289. package/dist/lib/runtime/native-rate-limits.d.ts +2 -1
  290. package/dist/lib/runtime/native-rate-limits.js +23 -6
  291. package/dist/lib/runtime/preemptive-quota.d.ts +0 -1
  292. package/dist/lib/runtime/quota-headers.d.ts +0 -1
  293. package/dist/lib/runtime/quota-probe.d.ts +0 -1
  294. package/dist/lib/runtime/quota-settings.d.ts +0 -1
  295. package/dist/lib/runtime/refresh-guardian-entry.d.ts +0 -1
  296. package/dist/lib/runtime/refresh-guardian.d.ts +0 -1
  297. package/dist/lib/runtime/request-init.d.ts +0 -1
  298. package/dist/lib/runtime/reset-credit-routing.d.ts +0 -1
  299. package/dist/lib/runtime/reset-credits.d.ts +0 -1
  300. package/dist/lib/runtime/response-output-history.d.ts +0 -1
  301. package/dist/lib/runtime/responses-websocket.d.ts +0 -1
  302. package/dist/lib/runtime/resume-picker.d.ts +0 -1
  303. package/dist/lib/runtime/rotation-account-selection.d.ts +0 -1
  304. package/dist/lib/runtime/rotation-proxy-state.d.ts +0 -1
  305. package/dist/lib/runtime/rotation-server-types.d.ts +0 -1
  306. package/dist/lib/runtime/rotation-storage-meta.d.ts +0 -1
  307. package/dist/lib/runtime/rotation-token-refresh.d.ts +0 -1
  308. package/dist/lib/runtime/runtime-capability-failures.d.ts +0 -1
  309. package/dist/lib/runtime/runtime-current-account.d.ts +0 -1
  310. package/dist/lib/runtime/runtime-observability.d.ts +0 -1
  311. package/dist/lib/runtime/runtime-services.d.ts +0 -1
  312. package/dist/lib/runtime/session-affinity-entry.d.ts +0 -1
  313. package/dist/lib/runtime/session-recovery.d.ts +0 -1
  314. package/dist/lib/runtime/status-marker.d.ts +0 -1
  315. package/dist/lib/runtime/storage-scope.d.ts +0 -1
  316. package/dist/lib/runtime/subscription-first-use.d.ts +0 -1
  317. package/dist/lib/runtime/subscription-quota-event.d.ts +0 -1
  318. package/dist/lib/runtime/subscription-quota-order.d.ts +0 -1
  319. package/dist/lib/runtime/toast.d.ts +0 -1
  320. package/dist/lib/runtime/ui-runtime-entry.d.ts +0 -1
  321. package/dist/lib/runtime/ui-runtime.d.ts +0 -1
  322. package/dist/lib/runtime/verify-flagged.d.ts +0 -1
  323. package/dist/lib/runtime/workspace-model-scopes.d.ts +0 -1
  324. package/dist/lib/runtime-constants.d.ts +0 -1
  325. package/dist/lib/runtime-paths.d.ts +0 -1
  326. package/dist/lib/runtime-rotation-proxy.d.ts +1 -1
  327. package/dist/lib/runtime-rotation-proxy.js +136 -3
  328. package/dist/lib/schemas.d.ts +35 -13
  329. package/dist/lib/schemas.js +19 -2
  330. package/dist/lib/session-affinity.d.ts +0 -1
  331. package/dist/lib/shutdown.d.ts +0 -1
  332. package/dist/lib/storage/account-clear-entry.d.ts +0 -1
  333. package/dist/lib/storage/account-clear.d.ts +0 -1
  334. package/dist/lib/storage/account-match-utils.d.ts +0 -1
  335. package/dist/lib/storage/account-persistence.d.ts +0 -1
  336. package/dist/lib/storage/account-port.d.ts +0 -1
  337. package/dist/lib/storage/account-save-entry.d.ts +0 -1
  338. package/dist/lib/storage/account-save.d.ts +9 -2
  339. package/dist/lib/storage/account-save.js +4 -1
  340. package/dist/lib/storage/account-snapshot.d.ts +0 -1
  341. package/dist/lib/storage/backup-metadata-builder.d.ts +0 -1
  342. package/dist/lib/storage/backup-metadata.d.ts +0 -1
  343. package/dist/lib/storage/backup-paths.d.ts +0 -1
  344. package/dist/lib/storage/backup-restore.d.ts +0 -1
  345. package/dist/lib/storage/cache-artifacts.d.ts +0 -1
  346. package/dist/lib/storage/credential-sidecars.d.ts +0 -1
  347. package/dist/lib/storage/error-hints.d.ts +0 -1
  348. package/dist/lib/storage/file-lock.d.ts +0 -1
  349. package/dist/lib/storage/file-lock.js +33 -1
  350. package/dist/lib/storage/file-paths.d.ts +0 -1
  351. package/dist/lib/storage/fixture-guards.d.ts +0 -1
  352. package/dist/lib/storage/flagged-entry.d.ts +0 -1
  353. package/dist/lib/storage/flagged-load-entry.d.ts +0 -1
  354. package/dist/lib/storage/flagged-save-entry.d.ts +0 -1
  355. package/dist/lib/storage/flagged-storage-file.d.ts +0 -1
  356. package/dist/lib/storage/flagged-storage-io.d.ts +0 -1
  357. package/dist/lib/storage/flagged-storage.d.ts +0 -1
  358. package/dist/lib/storage/gitignore.d.ts +0 -1
  359. package/dist/lib/storage/hash.d.ts +0 -1
  360. package/dist/lib/storage/health.d.ts +0 -1
  361. package/dist/lib/storage/identity.d.ts +0 -1
  362. package/dist/lib/storage/import-export.d.ts +0 -1
  363. package/dist/lib/storage/json-store-lock.d.ts +105 -0
  364. package/dist/lib/storage/json-store-lock.js +259 -0
  365. package/dist/lib/storage/metadata-section.d.ts +0 -1
  366. package/dist/lib/storage/migrations.d.ts +0 -1
  367. package/dist/lib/storage/migrations.js +31 -18
  368. package/dist/lib/storage/named-backup-entry.d.ts +0 -1
  369. package/dist/lib/storage/named-backups-entry.d.ts +0 -1
  370. package/dist/lib/storage/named-backups.d.ts +0 -1
  371. package/dist/lib/storage/path-state.d.ts +0 -1
  372. package/dist/lib/storage/paths.d.ts +0 -1
  373. package/dist/lib/storage/pending-auth.d.ts +10 -3
  374. package/dist/lib/storage/pending-auth.d.ts.map +1 -1
  375. package/dist/lib/storage/pending-auth.js +33 -9
  376. package/dist/lib/storage/project-migration.d.ts +0 -1
  377. package/dist/lib/storage/public-types.d.ts +0 -1
  378. package/dist/lib/storage/record-identity.d.ts +15 -0
  379. package/dist/lib/storage/record-identity.d.ts.map +1 -0
  380. package/dist/lib/storage/record-identity.js +16 -0
  381. package/dist/lib/storage/record-utils.d.ts +0 -1
  382. package/dist/lib/storage/restore-assessment.d.ts +0 -1
  383. package/dist/lib/storage/restore-backup-entry.d.ts +0 -1
  384. package/dist/lib/storage/restore-metadata.d.ts +0 -1
  385. package/dist/lib/storage/save-retry.d.ts +0 -1
  386. package/dist/lib/storage/snapshot-inspectors.d.ts +0 -1
  387. package/dist/lib/storage/snapshot-merge.d.ts +0 -1
  388. package/dist/lib/storage/storage-parser.d.ts +2 -1
  389. package/dist/lib/storage/storage-parser.js +10 -2
  390. package/dist/lib/storage/transactions.d.ts +0 -1
  391. package/dist/lib/storage.d.ts +15 -2
  392. package/dist/lib/storage.js +612 -25
  393. package/dist/lib/synthetic-response.d.ts +0 -1
  394. package/dist/lib/table-formatter.d.ts +0 -1
  395. package/dist/lib/temp-path.d.ts +0 -1
  396. package/dist/lib/tools/hashline-tools.d.ts +0 -1
  397. package/dist/lib/types.d.ts +0 -1
  398. package/dist/lib/ui/ansi.d.ts +0 -1
  399. package/dist/lib/ui/auth-menu-builder.d.ts +0 -1
  400. package/dist/lib/ui/auth-menu.d.ts +0 -1
  401. package/dist/lib/ui/check-progress.d.ts +0 -1
  402. package/dist/lib/ui/confirm.d.ts +0 -1
  403. package/dist/lib/ui/display-width.d.ts +0 -1
  404. package/dist/lib/ui/format.d.ts +0 -1
  405. package/dist/lib/ui/index.d.ts +0 -1
  406. package/dist/lib/ui/runtime.d.ts +0 -1
  407. package/dist/lib/ui/select.d.ts +0 -1
  408. package/dist/lib/ui/theme.d.ts +0 -1
  409. package/dist/lib/ui/ui-copy.d.ts +0 -1
  410. package/dist/lib/unified-settings.d.ts +13 -11
  411. package/dist/lib/unified-settings.js +22 -14
  412. package/dist/lib/update-notice.d.ts +0 -1
  413. package/dist/lib/usage/index.d.ts +0 -1
  414. package/dist/lib/usage/ledger.d.ts +0 -1
  415. package/dist/lib/usage/pricing.d.ts +0 -1
  416. package/dist/lib/usage/redaction.d.ts +0 -1
  417. package/dist/lib/usage/stream-usage-deferral.d.ts +0 -1
  418. package/dist/lib/usage/types.d.ts +0 -1
  419. package/dist/lib/usage/usage-extraction.d.ts +0 -1
  420. package/dist/lib/utils.d.ts +21 -1
  421. package/dist/lib/utils.js +31 -0
  422. package/dist/lib/wsl.d.ts +0 -1
  423. package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -2
  424. package/node_modules/@codex-ai/plugin/dist/index.js +2 -2
  425. package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -42
  426. package/node_modules/@codex-ai/plugin/dist/tool.js +29 -29
  427. package/node_modules/@codex-ai/plugin/package.json +9 -9
  428. package/node_modules/@codex-ai/sdk/dist/index.d.ts +4 -4
  429. package/node_modules/@codex-ai/sdk/dist/index.js +2 -2
  430. package/node_modules/@codex-ai/sdk/package.json +8 -8
  431. package/package.json +206 -200
  432. package/scripts/codex-app-launcher.js +653 -653
  433. package/scripts/codex-app-router.js +373 -373
  434. package/scripts/codex-bin-resolver.js +332 -313
  435. package/scripts/codex-multi-auth.js +65 -59
  436. package/scripts/codex-routing.js +62 -62
  437. package/scripts/codex.js +6923 -6642
  438. package/scripts/install-codex-auth-utils.js +213 -213
  439. package/scripts/mcodex.js +367 -367
  440. package/scripts/postinstall.js +114 -114
  441. package/scripts/preuninstall.js +265 -265
  442. package/skills/codex-auth-setup/SKILL.md +73 -0
  443. package/vendor/codex-ai-plugin/dist/index.d.ts +2 -2
  444. package/vendor/codex-ai-plugin/dist/index.js +2 -2
  445. package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -42
  446. package/vendor/codex-ai-plugin/dist/tool.js +29 -29
  447. package/vendor/codex-ai-plugin/package.json +9 -9
  448. package/vendor/codex-ai-sdk/dist/index.d.ts +4 -4
  449. package/vendor/codex-ai-sdk/dist/index.js +2 -2
  450. package/vendor/codex-ai-sdk/package.json +8 -8
@@ -1,7 +1,6 @@
1
1
  import { type AccountMetadataV3 } from "../storage.js";
2
2
  import { type CodexQuotaSnapshot } from "../quota-probe.js";
3
- type Observer = (account: AccountMetadataV3, snapshot: CodexQuotaSnapshot, accounts: AccountMetadataV3[]) => Promise<void> | void;
3
+ type Observer = (account: AccountMetadataV3, snapshot: CodexQuotaSnapshot, accounts: AccountMetadataV3[], workspaceId: string) => Promise<void> | void;
4
4
  /** Captures this router's pool; reads only verified primary credentials, never API/ZDR entries. */
5
5
  export declare function createAutomaticSubscriptionCheck(observe?: Observer): (signal: AbortSignal) => Promise<void>;
6
6
  export {};
7
- //# sourceMappingURL=automatic-subscription-checks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"automatic-subscription-checks.d.ts","sourceRoot":"","sources":["../../../lib/runtime/automatic-subscription-checks.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAUrF,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAClI,mGAAmG;AACnG,wBAAgB,gCAAgC,CAAC,OAAO,CAAC,EAAE,QAAQ,IASvD,QAAQ,WAAW,mBA+B9B"}
1
+ {"version":3,"file":"automatic-subscription-checks.d.ts","sourceRoot":"","sources":["../../../lib/runtime/automatic-subscription-checks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAOrF,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACvJ,mGAAmG;AACnG,wBAAgB,gCAAgC,CAAC,OAAO,CAAC,EAAE,QAAQ,IASvD,QAAQ,WAAW,mBAgC9B"}
@@ -1,35 +1,33 @@
1
1
  import { getStoragePathState, runWithStoragePathState } from "../storage/path-state.js";
2
- import { join } from "node:path";
3
2
  import { AccountManager, resolveAccountRecordId } from "../accounts.js";
4
3
  import { getAccountPolicyKey, loadAccountPolicyStore } from "../account-policy.js";
5
4
  import { getStoragePath } from "../storage.js";
6
5
  import { fetchCodexQuotaSnapshot } from "../quota-probe.js";
7
6
  import { loadQuotaCache, saveQuotaCache } from "../quota-cache.js";
8
- import { updateQuotaCacheForAccount } from "../codex-manager/quota-cache-helpers.js";
9
- import { getCodexMultiAuthDir } from "../runtime-paths.js";
10
- import { withFileTransactionLock } from "../storage/file-lock.js";
7
+ import { updateQuotaCacheForWorkspace } from "../codex-manager/quota-cache-helpers.js";
11
8
  import { createNativeAccountStorageReader } from "./native-account-storage.js";
12
9
  import { ensureFreshAccessToken } from "./rotation-token-refresh.js";
13
- import { workspaceModelScopes } from "./workspace-model-scopes.js";
14
- import { runAutomaticAccountChecks } from "./automatic-account-checks.js";
10
+ import { automaticCheckWorkspaceId, runAutomaticAccountChecks } from "./automatic-account-checks.js";
15
11
  import { logWarn } from "../logger.js";
16
12
  /** Captures this router's pool; reads only verified primary credentials, never API/ZDR entries. */
17
13
  export function createAutomaticSubscriptionCheck(observe) {
18
14
  const path = getStoragePath(), storageState = getStoragePathState();
19
15
  const read = createNativeAccountStorageReader(undefined, path);
20
- const quotaPath = join(getCodexMultiAuthDir(), "quota-cache.json");
21
- const onQuota = observe ?? (async (account, snapshot, accounts) => withFileTransactionLock(quotaPath, async () => {
16
+ const onQuota = observe ?? (async (account, snapshot, accounts, workspaceId) => {
22
17
  const cache = await loadQuotaCache();
23
- updateQuotaCacheForAccount(cache, account, snapshot, accounts);
24
- await saveQuotaCache(cache);
25
- }));
18
+ const baseline = structuredClone(cache);
19
+ updateQuotaCacheForWorkspace(cache, account, workspaceId, snapshot, accounts);
20
+ await saveQuotaCache(cache, baseline);
21
+ });
26
22
  return (signal) => runWithStoragePathState(storageState, () => runAutomaticAccountChecks({
27
23
  path: `${path}.automatic-checks.json`, signal, loadPolicies: loadAccountPolicyStore,
28
24
  loadAccounts: async () => { const snapshot = await read(); return snapshot.verified ? snapshot.storage : null; },
29
25
  check: async (storage, index) => {
30
26
  const manager = new AccountManager(undefined, storage);
31
27
  const account = manager.getAccountByIndex(index);
32
- if (!account || !workspaceModelScopes(account).some(s => s.bound && s.routable) || signal.aborted)
28
+ const stored = storage.accounts[index];
29
+ const targetId = stored && automaticCheckWorkspaceId(stored);
30
+ if (!account || !targetId || signal.aborted)
33
31
  return;
34
32
  const fresh = await ensureFreshAccessToken({ accountManager: manager, account, family: "codex", model: null, now: Date.now(), tokenRefreshSkewMs: 60000, tokenInvalidationCooldownMs: 300000 });
35
33
  try {
@@ -41,13 +39,12 @@ export function createAutomaticSubscriptionCheck(observe) {
41
39
  const policy = current ? (await loadAccountPolicyStore()).accounts[getAccountPolicyKey(current)] : undefined;
42
40
  if (!disk.storage || !current || current.refreshToken !== fresh.account.refreshToken || current.accessToken !== fresh.accessToken || !policy?.autoPrime || policy.paused || policy.drained || current.enabled === false || current.authInvalidatedAt || (current.coolingDownUntil ?? 0) > Date.now())
43
41
  return;
44
- const bound = workspaceModelScopes(fresh.account).find(s => s.bound && s.routable);
45
- if (!bound || (current.accountId && current.accountId !== bound.accountId) || current.workspaces?.some(w => w.id === bound.accountId && w.enabled === false) || signal.aborted)
42
+ if (automaticCheckWorkspaceId(current) !== targetId || signal.aborted)
46
43
  return;
47
- const snapshot = await fetchCodexQuotaSnapshot({ accountId: bound.accountId, accessToken: fresh.accessToken, primeUnusedSubscription: true, signal });
44
+ const snapshot = await fetchCodexQuotaSnapshot({ accountId: targetId, accessToken: fresh.accessToken, primeUnusedSubscription: true, signal });
48
45
  if (snapshot.primingFailure)
49
46
  logWarn("Automatic first-use completion was not confirmed; retry deferred until the next check.");
50
- await onQuota(current, snapshot, disk.storage.accounts);
47
+ await onQuota(current, snapshot, disk.storage.accounts, targetId);
51
48
  }
52
49
  finally {
53
50
  await manager.flushPendingSave();
@@ -29,4 +29,3 @@ export declare function runBrowserOAuthFlow(params: {
29
29
  exchangeAuthorizationCode: (code: string, verifier: string, redirectUri: string) => Promise<TokenResult>;
30
30
  redirectUri: string;
31
31
  }): Promise<TokenResult>;
32
- //# sourceMappingURL=browser-oauth-flow.d.ts.map
@@ -22,4 +22,3 @@ export declare function buildCapabilityBoostByAccount(input: {
22
22
  };
23
23
  getBoost: (accountKey: string, capabilityKey: string) => number;
24
24
  }): number[];
25
- //# sourceMappingURL=capability-boost.d.ts.map
@@ -5,4 +5,3 @@ export declare function mergeCatalogModels(models: readonly CatalogModel[]): Cat
5
5
  export declare function mergeCatalogModel(a: CatalogModel, b: CatalogModel): CatalogModel;
6
6
  export declare function clampCatalogContext(a: CatalogModel, b: CatalogModel): CatalogModel;
7
7
  export declare function supportsCatalogSettings(model: CatalogModel, effort?: string, tier?: string): boolean;
8
- //# sourceMappingURL=catalog-capabilities.d.ts.map
@@ -21,4 +21,3 @@ export declare function configHasRuntimeRotationProvider(rawConfig: string): boo
21
21
  * rather than the dangling proxy id.
22
22
  */
23
23
  export declare function restoreConfigTomlFromRuntimeRotationProviderWithoutBackup(currentConfig: string, defaultProvider?: string): string;
24
- //# sourceMappingURL=config-toml.d.ts.map
@@ -10,4 +10,3 @@ export declare function applyContextBudgetGuardSettingsFromConfig(pluginConfig:
10
10
  getContextBudgetGuardHardPercent: (config: ReturnType<typeof import("../config.js").loadPluginConfig>) => number;
11
11
  getContextBudgetGuardModelWindowOverrides: (config: ReturnType<typeof import("../config.js").loadPluginConfig>) => Record<string, number>;
12
12
  }): void;
13
- //# sourceMappingURL=context-budget-settings.d.ts.map
@@ -19,4 +19,3 @@ export declare function handleRuntimeEvent(params: {
19
19
  logDebug: (message: string) => void;
20
20
  pluginName: string;
21
21
  }): Promise<void>;
22
- //# sourceMappingURL=event-handler.d.ts.map
@@ -81,4 +81,3 @@ export declare function loadLauncherInstall(candidateOverride?: readonly string[
81
81
  */
82
82
  export declare function ensureFirstRunSetup(deps?: FirstRunSetupDeps): Promise<FirstRunResult>;
83
83
  export {};
84
- //# sourceMappingURL=first-run.d.ts.map
@@ -6,4 +6,3 @@ export type FlaggedVerificationState = {
6
6
  restored: TokenSuccessWithAccount<TokenSuccess>[];
7
7
  };
8
8
  export declare function createFlaggedVerificationState(): FlaggedVerificationState;
9
- //# sourceMappingURL=flagged-verify-types.d.ts.map
@@ -10,4 +10,3 @@ export declare function hydrateRuntimeEmails(storage: AccountStorageV3 | null, d
10
10
  logWarn: (message: string) => void;
11
11
  pluginName: string;
12
12
  }): Promise<AccountStorageV3 | null>;
13
- //# sourceMappingURL=hydrate-emails.d.ts.map
@@ -12,4 +12,3 @@ export declare function createInferenceActivityWriter(save?: (key: string, at: n
12
12
  flush(): Promise<void>;
13
13
  };
14
14
  export declare function loadInferenceRequestTimes(keys: string[]): Promise<Record<string, number>>;
15
- //# sourceMappingURL=inference-activity.d.ts.map
@@ -40,4 +40,3 @@ export declare function ensureLiveAccountSyncEntry<TSync extends LiveAccountSync
40
40
  liveAccountSyncConfigKey: string | null;
41
41
  }>;
42
42
  export {};
43
- //# sourceMappingURL=live-sync-entry.d.ts.map
@@ -35,4 +35,3 @@ export declare function ensureRuntimeLiveAccountSync<TConfig, TSync extends Live
35
35
  configKey: string | null;
36
36
  cleanupRegistered: boolean;
37
37
  }>;
38
- //# sourceMappingURL=live-sync.d.ts.map
@@ -7,4 +7,3 @@ export declare function applyLoaderRuntimeSetup(params: {
7
7
  applyPreemptiveQuotaSettings: (pluginConfig: ReturnType<typeof import("../config.js").loadPluginConfig>) => void;
8
8
  applyContextBudgetGuardSettings: (pluginConfig: ReturnType<typeof import("../config.js").loadPluginConfig>) => void;
9
9
  }): void;
10
- //# sourceMappingURL=loader-setup.d.ts.map
@@ -31,4 +31,3 @@ export declare function buildLoginMenuAccounts(accounts: Array<{
31
31
  }, now: number) => string | null;
32
32
  }): LoginMenuAccount[];
33
33
  export {};
34
- //# sourceMappingURL=login-menu-accounts.d.ts.map
@@ -37,4 +37,3 @@ export declare function buildManualOAuthFlow(pkce: {
37
37
  verifier: string;
38
38
  }, url: string, expectedState: string, deps: RuntimeManualOAuthFlowDeps): ManualOAuthFlow<RuntimeResolvedToken>;
39
39
  export {};
40
- //# sourceMappingURL=manual-oauth-flow.d.ts.map
@@ -23,8 +23,8 @@ declare const schema: z.ZodObject<{
23
23
  model: z.ZodString;
24
24
  checkedAt: z.ZodOptional<z.ZodNumber>;
25
25
  probes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
26
- unsupported: "unsupported";
27
26
  verified: "verified";
27
+ unsupported: "unsupported";
28
28
  unverified: "unverified";
29
29
  downgraded: "downgraded";
30
30
  }>>>;
@@ -51,8 +51,8 @@ declare const schema: z.ZodObject<{
51
51
  model: z.ZodString;
52
52
  checkedAt: z.ZodOptional<z.ZodNumber>;
53
53
  probes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
54
- unsupported: "unsupported";
55
54
  verified: "verified";
55
+ unsupported: "unsupported";
56
56
  unverified: "unverified";
57
57
  downgraded: "downgraded";
58
58
  }>>>;
@@ -97,4 +97,3 @@ export declare function refreshAndPrintModelInventory(log: (message: string) =>
97
97
  /** Compare stable credential/workspace scopes, keeping the last successful baseline through outages. */
98
98
  export declare function withInventoryChanges(current: ModelInventory, previous: ModelInventory | null): ModelInventory;
99
99
  export {};
100
- //# sourceMappingURL=model-discovery-status.d.ts.map
@@ -8,4 +8,3 @@ export interface NativeAccountSnapshot {
8
8
  }
9
9
  /** Cache parsed primary storage only; backup recovery must never resurrect revoked credentials. */
10
10
  export declare function createNativeAccountStorageReader(read?: () => Promise<AccountStorageV3 | null>, path?: string): () => Promise<NativeAccountSnapshot>;
11
- //# sourceMappingURL=native-account-storage.d.ts.map
@@ -16,4 +16,3 @@ export declare function isSameNativeAccount(account: Identity, disk: Identity |
16
16
  /** Adopt credentials from a re-login without resetting independent quota state. */
17
17
  export declare function syncNativeAccountCredentials(manager: AccountManager, storage: AccountStorageV3): boolean;
18
18
  export {};
19
- //# sourceMappingURL=native-account-sync.d.ts.map
@@ -1,3 +1,2 @@
1
1
  /** Shared across CLI processes: protect the native provider check and desktop auth write. */
2
2
  export declare function withNativeBindingLock<T>(configPath: string, action: () => Promise<T>): Promise<T>;
3
- //# sourceMappingURL=native-binding-lock.d.ts.map
@@ -1,3 +1,2 @@
1
1
  /** Trust the exact local desktop credential, never claims from the incoming bearer. */
2
2
  export declare function isNativeClientToken(bearer: string, now: number, read?: () => Promise<string>): Promise<boolean>;
3
- //# sourceMappingURL=native-client-auth.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export { hasNativeProviderConfig } from "../runtime-constants.js";
2
2
  export declare function rewriteNativeProviderConfig(content: string, baseUrl: string): string;
3
3
  export declare function restoreNativeProviderConfig(content: string, original: string): string;
4
- //# sourceMappingURL=native-provider-config.d.ts.map
@@ -7,6 +7,8 @@ export interface NativeUsageAuth {
7
7
  codexCliMirror?: CodexCliMirror;
8
8
  }
9
9
  type Method = 'account/rateLimits/read' | 'account/rateLimitResetCredit/consume';
10
+ /** @internal Native usage needs the desktop backend when it is installed. */
11
+ export declare function resolveNativeUsageCommand(platform?: NodeJS.Platform): string[];
10
12
  /** One bounded native RPC session in an isolated home. No refresh token, API key,
11
13
  * global configuration, or desktop auth changes are available to this process. */
12
14
  export declare function nativeRateLimitsRpc(auth: NativeUsageAuth, method: Method, params: Record<string, unknown>, options?: {
@@ -15,4 +17,3 @@ export declare function nativeRateLimitsRpc(auth: NativeUsageAuth, method: Metho
15
17
  timeoutMs?: number;
16
18
  }): Promise<unknown>;
17
19
  export {};
18
- //# sourceMappingURL=native-rate-limits.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { existsSync, promises as fs } from 'node:fs';
2
+ import { accessSync, constants, existsSync, promises as fs, statSync } from 'node:fs';
3
3
  import { createRequire } from 'node:module';
4
4
  import { isAbsolute, join } from 'node:path';
5
5
  import { codexCliAccountIdFor } from '../auth/token-utils.js';
@@ -18,7 +18,8 @@ async function sweepStaleHomes(root) {
18
18
  catch { /* Another process owns or already removed it. */ }
19
19
  }));
20
20
  }
21
- function nativeCommand() {
21
+ /** @internal Native usage needs the desktop backend when it is installed. */
22
+ export function resolveNativeUsageCommand(platform = process.platform) {
22
23
  const override = process.env.CODEX_MULTI_AUTH_USAGE_CODEX_BIN?.trim();
23
24
  if (override) {
24
25
  if (!isAbsolute(override) || !existsSync(override))
@@ -26,9 +27,25 @@ function nativeCommand() {
26
27
  return [override];
27
28
  }
28
29
  // Prefer the desktop backend whose protocol supplies the native usage UI.
29
- const bundled = '/Applications/ChatGPT.app/Contents/Resources/codex';
30
- if (process.platform === 'darwin' && existsSync(bundled))
31
- return [bundled];
30
+ const bundled = [
31
+ '/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex',
32
+ '/Applications/ChatGPT.app/Contents/Resources/codex',
33
+ ];
34
+ if (platform === 'darwin') {
35
+ const executable = bundled.find(path => {
36
+ try {
37
+ if (!statSync(path).isFile())
38
+ return false;
39
+ accessSync(path, constants.X_OK);
40
+ return true;
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ });
46
+ if (executable)
47
+ return [executable];
48
+ }
32
49
  try {
33
50
  return [process.execPath, createRequire(import.meta.url).resolve('@openai/codex/bin/codex.js')];
34
51
  }
@@ -41,7 +58,7 @@ function nativeCommand() {
41
58
  export async function nativeRateLimitsRpc(auth, method, params, options = {}) {
42
59
  if (!auth.accessToken || !auth.accountId || auth.expiresAt <= Date.now() + 30000)
43
60
  throw Error('Native usage requires a fresh account access token');
44
- const command = options.command ?? nativeCommand();
61
+ const command = options.command ?? resolveNativeUsageCommand();
45
62
  const executable = command[0];
46
63
  if (!executable)
47
64
  throw Error('Native usage backend unavailable');
@@ -10,4 +10,3 @@ export declare function applyRuntimePreemptiveQuotaSettings<TConfig>(pluginConfi
10
10
  getPreemptiveQuotaRemainingPercent7d: (config: TConfig) => number;
11
11
  getPreemptiveQuotaMaxDeferralMs: (config: TConfig) => number;
12
12
  }): void;
13
- //# sourceMappingURL=preemptive-quota.d.ts.map
@@ -4,4 +4,3 @@ export type ParsedCodexQuotaSnapshot = Omit<CodexQuotaSnapshot, "model">;
4
4
  export declare function parseResetAtMs(headers: Headers, prefix: string): number | undefined;
5
5
  export declare function parseCodexQuotaSnapshot(headers: Headers, status: number): ParsedCodexQuotaSnapshot | null;
6
6
  export declare function formatCodexQuotaLine(snapshot: Pick<CodexQuotaSnapshot, "status" | "planType" | "activeLimit" | "primary" | "secondary">): string;
7
- //# sourceMappingURL=quota-headers.d.ts.map
@@ -15,4 +15,3 @@ export declare function fetchRuntimeCodexQuotaSnapshot(params: {
15
15
  message?: string;
16
16
  };
17
17
  }): Promise<CodexQuotaSnapshot>;
18
- //# sourceMappingURL=quota-probe.d.ts.map
@@ -11,4 +11,3 @@ export declare function applyPreemptiveQuotaSettingsFromConfig(pluginConfig: Ret
11
11
  getPreemptiveQuotaMaxDeferralMs: (config: ReturnType<typeof import("../config.js").loadPluginConfig>) => number;
12
12
  }): void;
13
13
  export declare function resolveUiRuntimeFromConfig(loadPluginConfig: () => ReturnType<typeof import("../config.js").loadPluginConfig>, applyUiRuntimeFromConfig: (pluginConfig: ReturnType<typeof import("../config.js").loadPluginConfig>) => ReturnType<typeof import("../ui/runtime.js").getUiRuntimeOptions>): ReturnType<typeof import("../ui/runtime.js").getUiRuntimeOptions>;
14
- //# sourceMappingURL=quota-settings.d.ts.map
@@ -29,4 +29,3 @@ export declare function ensureRefreshGuardianEntry<TGuardian>(params: {
29
29
  refreshGuardian: TGuardian | null;
30
30
  refreshGuardianConfigKey: string | null;
31
31
  };
32
- //# sourceMappingURL=refresh-guardian-entry.d.ts.map
@@ -21,4 +21,3 @@ export declare function ensureRuntimeRefreshGuardian<TConfig, TGuardian extends
21
21
  configKey: string | null;
22
22
  cleanupRegistered: boolean;
23
23
  };
24
- //# sourceMappingURL=refresh-guardian.d.ts.map
@@ -2,4 +2,3 @@ export declare function normalizeRuntimeRequestInit(requestInput: Request | stri
2
2
  export declare function parseRuntimeRequestBody(body: unknown, deps: {
3
3
  logWarn: (message: string) => void;
4
4
  }): Promise<Record<string, unknown>>;
5
- //# sourceMappingURL=request-init.d.ts.map
@@ -38,4 +38,3 @@ export declare function applyConfirmedReset(options: {
38
38
  now: number;
39
39
  }): boolean;
40
40
  export {};
41
- //# sourceMappingURL=reset-credit-routing.d.ts.map
@@ -98,4 +98,3 @@ export declare class ResetCreditService {
98
98
  private automaticLocked;
99
99
  }
100
100
  export {};
101
- //# sourceMappingURL=reset-credits.d.ts.map
@@ -14,4 +14,3 @@ export declare class ResponseOutputHistory {
14
14
  /** A replay must carry each tool call before its corresponding result. */
15
15
  export declare function hasOrphanToolResult(input: unknown): boolean;
16
16
  export {};
17
- //# sourceMappingURL=response-output-history.d.ts.map
@@ -28,4 +28,3 @@ export declare class ResponsesWebSocketGateway {
28
28
  private serve;
29
29
  close(): void;
30
30
  }
31
- //# sourceMappingURL=responses-websocket.d.ts.map
@@ -38,4 +38,3 @@ export declare function pickResumeThread(options: ResumePickerOptions, deps?: {
38
38
  select: (items: MenuItem<Choice>[], options: import("../ui/select.js").SelectOptions<Choice>) => Promise<Choice | null>;
39
39
  }): Promise<string | null>;
40
40
  export {};
41
- //# sourceMappingURL=resume-picker.d.ts.map
@@ -64,4 +64,3 @@ export declare function chooseAccount(params: {
64
64
  */
65
65
  allowPinnedCooldown?: boolean;
66
66
  }): ManagedAccount | null;
67
- //# sourceMappingURL=rotation-account-selection.d.ts.map
@@ -101,4 +101,3 @@ export interface RotationProxyState extends RotationProxyStateInit {
101
101
  export declare function createRotationProxyState(init: RotationProxyStateInit): RotationProxyState;
102
102
  /** @internal */
103
103
  export declare function recoverStaleRuntimeState(state: RotationProxyState): Promise<AccountManager | null>;
104
- //# sourceMappingURL=rotation-proxy-state.d.ts.map
@@ -106,4 +106,3 @@ export interface RuntimeRotationAccountIdentity {
106
106
  accountId: string | null;
107
107
  updatedAt: number;
108
108
  }
109
- //# sourceMappingURL=rotation-server-types.d.ts.map
@@ -37,4 +37,3 @@ export declare function resetPinCacheForTesting(): void;
37
37
  * spinning up the full proxy. See issue #474.
38
38
  */
39
39
  export declare function maybeInvalidateAffinityFromDisk(sessionAffinityStore: SessionAffinityStore | null, lastObservedGeneration: number, storagePath?: string): number;
40
- //# sourceMappingURL=rotation-storage-meta.d.ts.map
@@ -22,4 +22,3 @@ export declare function ensureFreshAccessToken(params: {
22
22
  retryable: boolean;
23
23
  invalidated?: boolean;
24
24
  }>;
25
- //# sourceMappingURL=rotation-token-refresh.d.ts.map
@@ -11,4 +11,3 @@ export declare class RuntimeCapabilityFailures {
11
11
  record(credential: string, model: string, kind: CapabilityFailure, effort?: string, tier?: string): void;
12
12
  supports(credential: string, model: string, effort?: string, tier?: string): boolean;
13
13
  }
14
- //# sourceMappingURL=runtime-capability-failures.d.ts.map
@@ -50,4 +50,3 @@ export declare function resolveRuntimeCurrentAccount(storage: AccountStorageV3,
50
50
  export declare function resolveAccountCurrentMarkers(index: number, storedCurrentIndex: number, runtimeCurrent: RuntimeCurrentAccountSelection | null): AccountCurrentMarker[];
51
51
  export declare function isDisplayCurrentAccount(index: number, storedCurrentIndex: number, runtimeCurrent: RuntimeCurrentAccountSelection | null): boolean;
52
52
  export {};
53
- //# sourceMappingURL=runtime-current-account.d.ts.map
@@ -81,4 +81,3 @@ export declare function recordRuntimeReset(reason: string): void;
81
81
  export declare function recordRuntimeAccountRecovery(index: number): void;
82
82
  export declare function loadPersistedRuntimeObservabilitySnapshot(): Promise<RuntimeObservabilitySnapshot | null>;
83
83
  export {};
84
- //# sourceMappingURL=runtime-observability.d.ts.map
@@ -58,4 +58,3 @@ export declare function ensureSessionAffinityState<TStore extends SessionAffinit
58
58
  sessionAffinityConfigKey: string | null;
59
59
  };
60
60
  export {};
61
- //# sourceMappingURL=runtime-services.d.ts.map
@@ -27,4 +27,3 @@ export declare function ensureSessionAffinityEntry<TStore>(params: {
27
27
  sessionAffinityStore: TStore | null;
28
28
  sessionAffinityConfigKey: string | null;
29
29
  };
30
- //# sourceMappingURL=session-affinity-entry.d.ts.map
@@ -5,4 +5,3 @@ export declare function createRuntimeSessionRecoveryHook(deps: {
5
5
  directory: string;
6
6
  autoResume: boolean;
7
7
  }): import("../recovery.js").SessionRecoveryHook | null;
8
- //# sourceMappingURL=session-recovery.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { UiRuntimeOptions } from "../ui/runtime.js";
2
2
  export declare function getRuntimeStatusMarker(ui: UiRuntimeOptions, status: "ok" | "warning" | "error"): string;
3
- //# sourceMappingURL=status-marker.d.ts.map
@@ -10,4 +10,3 @@ export declare function applyAccountStorageScopeFromConfig(pluginConfig: ReturnT
10
10
  setStoragePath: (path: string | null) => void;
11
11
  cwd: () => string;
12
12
  }): void;
13
- //# sourceMappingURL=storage-scope.d.ts.map
@@ -7,4 +7,3 @@ export declare class FirstUseProbeError extends Error {
7
7
  }
8
8
  /** Consume the already-open tiny response, never start a second request. */
9
9
  export declare function finishSubscriptionFirstUse(response: Response, timeoutMs: number): Promise<void>;
10
- //# sourceMappingURL=subscription-first-use.d.ts.map
@@ -3,4 +3,3 @@ import type { QuotaSchedulerSnapshot } from "../preemptive-quota-scheduler.js";
3
3
  export declare function readSubscriptionQuotaEvent(event: unknown, now: number): (QuotaSchedulerSnapshot & {
4
4
  planType?: string;
5
5
  }) | null;
6
- //# sourceMappingURL=subscription-quota-event.d.ts.map
@@ -14,4 +14,3 @@ export declare function subscriptionQuotaPreference(entry: QuotaCacheEntry | nul
14
14
  export declare function usesSubscriptionReserve(preference: SubscriptionQuotaPreference | undefined): boolean;
15
15
  /** Negative means a should be used first. Equal hints leave existing health/affinity scoring intact. */
16
16
  export declare function compareSubscriptionQuota(a: SubscriptionQuotaPreference, b: SubscriptionQuotaPreference): number;
17
- //# sourceMappingURL=subscription-quota-order.d.ts.map
@@ -13,4 +13,3 @@ export declare function showRuntimeToast(client: {
13
13
  title?: string;
14
14
  duration?: number;
15
15
  }): Promise<void>;
16
- //# sourceMappingURL=toast.d.ts.map
@@ -4,4 +4,3 @@ export declare function resolveUiRuntimeEntry(params: {
4
4
  resolveUiRuntimeFromConfig: (loadPluginConfig: () => ReturnType<typeof import("../config.js").loadPluginConfig>, applyUiRuntimeFromConfig: (pluginConfig: ReturnType<typeof import("../config.js").loadPluginConfig>) => UiRuntimeOptions) => UiRuntimeOptions;
5
5
  applyUiRuntimeFromConfig: (pluginConfig: ReturnType<typeof import("../config.js").loadPluginConfig>) => UiRuntimeOptions;
6
6
  }): UiRuntimeOptions;
7
- //# sourceMappingURL=ui-runtime-entry.d.ts.map
@@ -6,4 +6,3 @@ export declare function applyUiRuntimeFromConfig(pluginConfig: ReturnType<typeof
6
6
  glyphMode: ReturnType<typeof getCodexTuiGlyphMode>;
7
7
  }) => UiRuntimeOptions): UiRuntimeOptions;
8
8
  export declare function getStatusMarker(ui: UiRuntimeOptions, status: "ok" | "warning" | "error"): string;
9
- //# sourceMappingURL=ui-runtime.d.ts.map
@@ -45,4 +45,3 @@ export declare function verifyRuntimeFlaggedAccounts(deps: {
45
45
  now?: () => number;
46
46
  }): Promise<void>;
47
47
  export {};
48
- //# sourceMappingURL=verify-flagged.d.ts.map
@@ -12,4 +12,3 @@ export declare function workspaceModelScopes(account: ManagedAccount): {
12
12
  workspaceIndex: number;
13
13
  enabled: boolean;
14
14
  }[];
15
- //# sourceMappingURL=workspace-model-scopes.d.ts.map
@@ -35,4 +35,3 @@ export declare function listRuntimeHelperOwnerPaths(baseDir: string, entries: re
35
35
  /** Marker shared by config binding and desktop-auth sync protection. */
36
36
  export declare const NATIVE_PROVIDER_BEGIN = "# codex-multi-auth native provider begin";
37
37
  export declare function hasNativeProviderConfig(content: string): boolean;
38
- //# sourceMappingURL=runtime-constants.d.ts.map
@@ -55,4 +55,3 @@ export declare function getCodexLogDir(): string;
55
55
  * @returns The filesystem path for the legacy directory (e.g. `/home/alice/.codex`).
56
56
  */
57
57
  export declare function getLegacyCodexDir(): string;
58
- //# sourceMappingURL=runtime-paths.d.ts.map
@@ -7,6 +7,7 @@ export type { PinnedUnavailableErrorBody } from "./request/rate-limit-decision.j
7
7
  export { chooseAccount } from "./runtime/rotation-account-selection.js";
8
8
  export { maybeInvalidateAffinityFromDisk, readPinnedAccountIndexFromDisk, readStorageMetaFromDisk, resetPinCacheForTesting, } from "./runtime/rotation-storage-meta.js";
9
9
  export type { StorageMeta } from "./runtime/rotation-storage-meta.js";
10
+ export { resetRuntimePolicyCacheForTests } from "./policy/runtime-policy-cache.js";
10
11
  /** @internal Stable identity key for in-memory quota snapshots across reloads. */
11
12
  /**
12
13
  * Quota-scheduler key prefix identifying ONE account across every family and
@@ -47,4 +48,3 @@ export declare function resolveModelCapacityRetryMs(env?: NodeJS.ProcessEnv): nu
47
48
  */
48
49
  export declare function normalizeForcedAccountIndex(value: number | string | null | undefined): number | null;
49
50
  export declare function startRuntimeRotationProxy(options: RuntimeRotationProxyOptions): Promise<RuntimeRotationProxyServer>;
50
- //# sourceMappingURL=runtime-rotation-proxy.d.ts.map