codex-multi-auth 2.17.2 → 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 (394) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/README.md +83 -428
  3. package/dist/index.d.ts +0 -1
  4. package/dist/lib/account-policy.d.ts +18 -2
  5. package/dist/lib/account-policy.js +97 -40
  6. package/dist/lib/accounts/rate-limits.d.ts +0 -1
  7. package/dist/lib/accounts.d.ts +0 -1
  8. package/dist/lib/accounts.js +4 -5
  9. package/dist/lib/api-route-store.d.ts +0 -1
  10. package/dist/lib/audit.d.ts +0 -1
  11. package/dist/lib/audit.js +43 -12
  12. package/dist/lib/auth/account-access.d.ts +0 -1
  13. package/dist/lib/auth/account-access.js +5 -1
  14. package/dist/lib/auth/auth.d.ts +4 -3
  15. package/dist/lib/auth/auth.js +220 -28
  16. package/dist/lib/auth/browser.d.ts +0 -1
  17. package/dist/lib/auth/callback-guidance.d.ts +0 -1
  18. package/dist/lib/auth/device-auth.d.ts +0 -1
  19. package/dist/lib/auth/index.d.ts +0 -1
  20. package/dist/lib/auth/org-override.d.ts +0 -1
  21. package/dist/lib/auth/server.d.ts +1 -2
  22. package/dist/lib/auth/server.js +100 -53
  23. package/dist/lib/auth/token-utils.d.ts +0 -1
  24. package/dist/lib/auth-rate-limit.d.ts +0 -1
  25. package/dist/lib/budget-guard.d.ts +16 -2
  26. package/dist/lib/budget-guard.js +123 -43
  27. package/dist/lib/capability-policy.d.ts +0 -1
  28. package/dist/lib/circuit-breaker.d.ts +20 -1
  29. package/dist/lib/circuit-breaker.js +24 -5
  30. package/dist/lib/cli.d.ts +0 -1
  31. package/dist/lib/codex-cli/index.d.ts +0 -1
  32. package/dist/lib/codex-cli/observability.d.ts +0 -1
  33. package/dist/lib/codex-cli/state.d.ts +0 -1
  34. package/dist/lib/codex-cli/sync.d.ts +0 -1
  35. package/dist/lib/codex-cli/writer.d.ts +0 -1
  36. package/dist/lib/codex-manager/account-credentials.d.ts +0 -1
  37. package/dist/lib/codex-manager/account-manager-commands.d.ts +0 -1
  38. package/dist/lib/codex-manager/account-pool-write.d.ts +0 -1
  39. package/dist/lib/codex-manager/active-account-sync.d.ts +6 -0
  40. package/dist/lib/codex-manager/active-account-sync.js +336 -0
  41. package/dist/lib/codex-manager/api-login-menu.d.ts +0 -1
  42. package/dist/lib/codex-manager/backend-category-entry.d.ts +0 -1
  43. package/dist/lib/codex-manager/backend-category-helpers.d.ts +0 -1
  44. package/dist/lib/codex-manager/backend-category-prompt.d.ts +0 -1
  45. package/dist/lib/codex-manager/backend-settings-controller.d.ts +0 -1
  46. package/dist/lib/codex-manager/backend-settings-entry.d.ts +0 -1
  47. package/dist/lib/codex-manager/backend-settings-helpers.d.ts +0 -1
  48. package/dist/lib/codex-manager/backend-settings-prompt.d.ts +0 -1
  49. package/dist/lib/codex-manager/backend-settings-schema.d.ts +0 -1
  50. package/dist/lib/codex-manager/behavior-settings-panel.d.ts +0 -1
  51. package/dist/lib/codex-manager/commands/account.d.ts +8 -3
  52. package/dist/lib/codex-manager/commands/account.js +46 -34
  53. package/dist/lib/codex-manager/commands/best.d.ts +0 -1
  54. package/dist/lib/codex-manager/commands/bridge.d.ts +0 -1
  55. package/dist/lib/codex-manager/commands/budget.d.ts +8 -3
  56. package/dist/lib/codex-manager/commands/budget.js +6 -4
  57. package/dist/lib/codex-manager/commands/check.d.ts +0 -1
  58. package/dist/lib/codex-manager/commands/config-explain.d.ts +0 -1
  59. package/dist/lib/codex-manager/commands/debug-bundle.d.ts +0 -1
  60. package/dist/lib/codex-manager/commands/forecast.d.ts +0 -1
  61. package/dist/lib/codex-manager/commands/history.d.ts +0 -1
  62. package/dist/lib/codex-manager/commands/init-config.d.ts +0 -1
  63. package/dist/lib/codex-manager/commands/integrations.d.ts +0 -1
  64. package/dist/lib/codex-manager/commands/limits.d.ts +0 -1
  65. package/dist/lib/codex-manager/commands/models.d.ts +0 -1
  66. package/dist/lib/codex-manager/commands/monitor.d.ts +0 -1
  67. package/dist/lib/codex-manager/commands/report.d.ts +0 -1
  68. package/dist/lib/codex-manager/commands/resets.d.ts +0 -1
  69. package/dist/lib/codex-manager/commands/resets.js +9 -1
  70. package/dist/lib/codex-manager/commands/rotation.d.ts +0 -1
  71. package/dist/lib/codex-manager/commands/status.d.ts +0 -1
  72. package/dist/lib/codex-manager/commands/switch.d.ts +0 -1
  73. package/dist/lib/codex-manager/commands/uninstall.d.ts +0 -1
  74. package/dist/lib/codex-manager/commands/unpin.d.ts +0 -1
  75. package/dist/lib/codex-manager/commands/usage.d.ts +0 -1
  76. package/dist/lib/codex-manager/commands/verify.d.ts +0 -1
  77. package/dist/lib/codex-manager/commands/why-selected.d.ts +0 -1
  78. package/dist/lib/codex-manager/commands/workspace.d.ts +0 -1
  79. package/dist/lib/codex-manager/dashboard-display-panel.d.ts +0 -1
  80. package/dist/lib/codex-manager/dashboard-formatters.d.ts +0 -1
  81. package/dist/lib/codex-manager/dashboard-settings-controller.d.ts +0 -1
  82. package/dist/lib/codex-manager/dashboard-settings-data.d.ts +0 -1
  83. package/dist/lib/codex-manager/dashboard-settings-entry.d.ts +0 -1
  84. package/dist/lib/codex-manager/experimental-settings-entry.d.ts +0 -1
  85. package/dist/lib/codex-manager/experimental-settings-prompt.d.ts +0 -1
  86. package/dist/lib/codex-manager/experimental-settings-schema.d.ts +0 -1
  87. package/dist/lib/codex-manager/experimental-sync-target-entry.d.ts +0 -1
  88. package/dist/lib/codex-manager/experimental-sync-target.d.ts +0 -1
  89. package/dist/lib/codex-manager/forecast-report-shared.d.ts +0 -1
  90. package/dist/lib/codex-manager/formatters/account-formatters.d.ts +0 -1
  91. package/dist/lib/codex-manager/formatters/index.d.ts +0 -1
  92. package/dist/lib/codex-manager/formatters/model-formatters.d.ts +0 -1
  93. package/dist/lib/codex-manager/formatters/quota-formatters.d.ts +0 -1
  94. package/dist/lib/codex-manager/formatters/text-style.d.ts +0 -1
  95. package/dist/lib/codex-manager/health-check.d.ts +0 -1
  96. package/dist/lib/codex-manager/help.d.ts +0 -1
  97. package/dist/lib/codex-manager/login-action-panel.d.ts +0 -1
  98. package/dist/lib/codex-manager/login-flow.d.ts +0 -1
  99. package/dist/lib/codex-manager/login-menu-actions.d.ts +0 -1
  100. package/dist/lib/codex-manager/login-menu-data.d.ts +0 -1
  101. package/dist/lib/codex-manager/login-oauth.d.ts +0 -1
  102. package/dist/lib/codex-manager/login-workspace-choice.d.ts +0 -1
  103. package/dist/lib/codex-manager/manual-callback.d.ts +0 -1
  104. package/dist/lib/codex-manager/persist-selected-account.d.ts +0 -1
  105. package/dist/lib/codex-manager/quota-cache-helpers.d.ts +0 -1
  106. package/dist/lib/codex-manager/rate-limit-markers.d.ts +0 -1
  107. package/dist/lib/codex-manager/repair-commands.d.ts +0 -1
  108. package/dist/lib/codex-manager/settings-hub/backend.d.ts +0 -1
  109. package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +0 -1
  110. package/dist/lib/codex-manager/settings-hub/experimental.d.ts +0 -1
  111. package/dist/lib/codex-manager/settings-hub/index.d.ts +0 -1
  112. package/dist/lib/codex-manager/settings-hub/shared.d.ts +0 -1
  113. package/dist/lib/codex-manager/settings-hub-entry.d.ts +0 -1
  114. package/dist/lib/codex-manager/settings-hub-menu.d.ts +0 -1
  115. package/dist/lib/codex-manager/settings-hub-prompt.d.ts +0 -1
  116. package/dist/lib/codex-manager/settings-hub.d.ts +0 -1
  117. package/dist/lib/codex-manager/settings-panels.d.ts +0 -1
  118. package/dist/lib/codex-manager/settings-persist-utils.d.ts +0 -1
  119. package/dist/lib/codex-manager/settings-preview.d.ts +0 -1
  120. package/dist/lib/codex-manager/settings-write-queue.d.ts +0 -1
  121. package/dist/lib/codex-manager/statusline-settings-panel.d.ts +0 -1
  122. package/dist/lib/codex-manager/theme-settings-panel.d.ts +0 -1
  123. package/dist/lib/codex-manager/unified-settings-controller.d.ts +0 -1
  124. package/dist/lib/codex-manager/unified-settings-entry.d.ts +0 -1
  125. package/dist/lib/codex-manager.d.ts +1 -2
  126. package/dist/lib/codex-manager.js +5 -95
  127. package/dist/lib/concurrency.d.ts +0 -1
  128. package/dist/lib/config-schema.d.ts +0 -1
  129. package/dist/lib/config.d.ts +0 -1
  130. package/dist/lib/config.js +46 -241
  131. package/dist/lib/constants.d.ts +0 -1
  132. package/dist/lib/context-budget/model-context-windows.d.ts +0 -1
  133. package/dist/lib/context-budget-guard.d.ts +0 -1
  134. package/dist/lib/context-budget-response.d.ts +0 -1
  135. package/dist/lib/context-overflow.d.ts +0 -1
  136. package/dist/lib/dashboard-settings.d.ts +0 -1
  137. package/dist/lib/entitlement-cache.d.ts +0 -1
  138. package/dist/lib/env-parsing.d.ts +13 -1
  139. package/dist/lib/env-parsing.js +21 -0
  140. package/dist/lib/errors.d.ts +0 -1
  141. package/dist/lib/forecast.d.ts +0 -1
  142. package/dist/lib/fs-retry.d.ts +0 -1
  143. package/dist/lib/health.d.ts +0 -1
  144. package/dist/lib/index.d.ts +0 -1
  145. package/dist/lib/integration-generators.d.ts +0 -1
  146. package/dist/lib/live-account-sync.d.ts +0 -1
  147. package/dist/lib/local-bridge.d.ts +0 -1
  148. package/dist/lib/local-bridge.js +4 -1
  149. package/dist/lib/local-client-tokens.d.ts +0 -1
  150. package/dist/lib/local-client-tokens.js +125 -30
  151. package/dist/lib/logger.d.ts +0 -1
  152. package/dist/lib/logger.js +11 -1
  153. package/dist/lib/model-capability-matrix.d.ts +0 -1
  154. package/dist/lib/model-route-policy.d.ts +1 -2
  155. package/dist/lib/named-backup-export.d.ts +0 -1
  156. package/dist/lib/oc-chatgpt-import-adapter.d.ts +0 -1
  157. package/dist/lib/oc-chatgpt-orchestrator.d.ts +0 -1
  158. package/dist/lib/oc-chatgpt-target-detection.d.ts +0 -1
  159. package/dist/lib/parallel-probe.d.ts +0 -1
  160. package/dist/lib/policy/runtime-policy-cache.d.ts +80 -0
  161. package/dist/lib/policy/runtime-policy-cache.js +310 -0
  162. package/dist/lib/policy/runtime-policy.d.ts +1 -2
  163. package/dist/lib/policy/runtime-policy.js +46 -19
  164. package/dist/lib/preemptive-quota-scheduler.d.ts +0 -1
  165. package/dist/lib/proactive-refresh.d.ts +0 -1
  166. package/dist/lib/prompts/codex-host-bridge.d.ts +0 -1
  167. package/dist/lib/prompts/codex.d.ts +0 -1
  168. package/dist/lib/prompts/fetch-utils.d.ts +0 -1
  169. package/dist/lib/prompts/host-codex-prompt.d.ts +0 -1
  170. package/dist/lib/quota-cache.d.ts +0 -1
  171. package/dist/lib/quota-cache.js +60 -36
  172. package/dist/lib/quota-probe.d.ts +0 -1
  173. package/dist/lib/quota-probe.js +5 -2
  174. package/dist/lib/quota-readiness.d.ts +0 -1
  175. package/dist/lib/recovery/constants.d.ts +0 -1
  176. package/dist/lib/recovery/storage.d.ts +0 -1
  177. package/dist/lib/recovery/types.d.ts +0 -1
  178. package/dist/lib/recovery.d.ts +0 -1
  179. package/dist/lib/redaction.d.ts +0 -1
  180. package/dist/lib/refresh-guardian.d.ts +0 -1
  181. package/dist/lib/refresh-lease.d.ts +0 -1
  182. package/dist/lib/refresh-queue.d.ts +0 -1
  183. package/dist/lib/request/client-cancellation.d.ts +0 -1
  184. package/dist/lib/request/error-classification.d.ts +0 -1
  185. package/dist/lib/request/failover-config.d.ts +0 -1
  186. package/dist/lib/request/failure-policy.d.ts +0 -1
  187. package/dist/lib/request/fetch-helpers.d.ts +0 -1
  188. package/dist/lib/request/headers.d.ts +0 -1
  189. package/dist/lib/request/helpers/input-utils.d.ts +0 -1
  190. package/dist/lib/request/helpers/input-utils.js +88 -34
  191. package/dist/lib/request/helpers/model-map.d.ts +0 -1
  192. package/dist/lib/request/helpers/tool-utils.d.ts +0 -1
  193. package/dist/lib/request/helpers/tool-utils.js +421 -4
  194. package/dist/lib/request/index.d.ts +0 -1
  195. package/dist/lib/request/rate-limit-backoff.d.ts +0 -1
  196. package/dist/lib/request/rate-limit-decision.d.ts +0 -1
  197. package/dist/lib/request/request-attempt-budget.d.ts +0 -1
  198. package/dist/lib/request/request-init.d.ts +0 -1
  199. package/dist/lib/request/request-resilience.d.ts +0 -1
  200. package/dist/lib/request/request-transformer.d.ts +0 -1
  201. package/dist/lib/request/request-transformer.js +50 -25
  202. package/dist/lib/request/response-compaction.d.ts +0 -1
  203. package/dist/lib/request/response-handler.d.ts +0 -1
  204. package/dist/lib/request/response-metadata.d.ts +0 -1
  205. package/dist/lib/request/response-outcome.d.ts +0 -1
  206. package/dist/lib/request/stream-failover-runtime.d.ts +0 -1
  207. package/dist/lib/request/stream-failover.d.ts +0 -1
  208. package/dist/lib/request/stream-failover.js +28 -4
  209. package/dist/lib/request/token-refresh.d.ts +0 -1
  210. package/dist/lib/request/url-rewriting.d.ts +0 -1
  211. package/dist/lib/request/wait-utils.d.ts +0 -1
  212. package/dist/lib/rotation.d.ts +0 -1
  213. package/dist/lib/routing-mutex.d.ts +0 -1
  214. package/dist/lib/routing-profiles.d.ts +16 -2
  215. package/dist/lib/routing-profiles.js +119 -44
  216. package/dist/lib/runtime/account-check-helpers.d.ts +0 -1
  217. package/dist/lib/runtime/account-check-types.d.ts +0 -1
  218. package/dist/lib/runtime/account-check.d.ts +0 -1
  219. package/dist/lib/runtime/account-manager-cache-entry.d.ts +0 -1
  220. package/dist/lib/runtime/account-manager-cache.d.ts +0 -1
  221. package/dist/lib/runtime/account-model-catalog.d.ts +1 -2
  222. package/dist/lib/runtime/account-pool.d.ts +0 -1
  223. package/dist/lib/runtime/account-reset-credits.d.ts +0 -1
  224. package/dist/lib/runtime/account-reset-credits.js +8 -2
  225. package/dist/lib/runtime/account-scope.d.ts +0 -1
  226. package/dist/lib/runtime/account-select-event.d.ts +0 -1
  227. package/dist/lib/runtime/account-selection.d.ts +0 -1
  228. package/dist/lib/runtime/account-state.d.ts +0 -1
  229. package/dist/lib/runtime/account-status.d.ts +0 -1
  230. package/dist/lib/runtime/account-storage-scope-entry.d.ts +0 -1
  231. package/dist/lib/runtime/api-model-capabilities.d.ts +0 -1
  232. package/dist/lib/runtime/api-model-runtime.d.ts +0 -1
  233. package/dist/lib/runtime/app-bind.d.ts +0 -1
  234. package/dist/lib/runtime/app-helper-selection.d.ts +0 -1
  235. package/dist/lib/runtime/auth-facade.d.ts +0 -1
  236. package/dist/lib/runtime/automatic-account-checks.d.ts +0 -1
  237. package/dist/lib/runtime/automatic-subscription-checks.d.ts +0 -1
  238. package/dist/lib/runtime/browser-oauth-flow.d.ts +0 -1
  239. package/dist/lib/runtime/capability-boost.d.ts +0 -1
  240. package/dist/lib/runtime/catalog-capabilities.d.ts +0 -1
  241. package/dist/lib/runtime/config-toml.d.ts +0 -1
  242. package/dist/lib/runtime/context-budget-settings.d.ts +0 -1
  243. package/dist/lib/runtime/event-handler.d.ts +0 -1
  244. package/dist/lib/runtime/first-run.d.ts +0 -1
  245. package/dist/lib/runtime/flagged-verify-types.d.ts +0 -1
  246. package/dist/lib/runtime/hydrate-emails.d.ts +0 -1
  247. package/dist/lib/runtime/inference-activity.d.ts +0 -1
  248. package/dist/lib/runtime/live-sync-entry.d.ts +0 -1
  249. package/dist/lib/runtime/live-sync.d.ts +0 -1
  250. package/dist/lib/runtime/loader-setup.d.ts +0 -1
  251. package/dist/lib/runtime/login-menu-accounts.d.ts +0 -1
  252. package/dist/lib/runtime/manual-oauth-flow.d.ts +0 -1
  253. package/dist/lib/runtime/model-discovery-status.d.ts +2 -3
  254. package/dist/lib/runtime/native-account-storage.d.ts +0 -1
  255. package/dist/lib/runtime/native-account-sync.d.ts +0 -1
  256. package/dist/lib/runtime/native-binding-lock.d.ts +0 -1
  257. package/dist/lib/runtime/native-client-auth.d.ts +0 -1
  258. package/dist/lib/runtime/native-provider-config.d.ts +0 -1
  259. package/dist/lib/runtime/native-rate-limits.d.ts +2 -1
  260. package/dist/lib/runtime/native-rate-limits.js +23 -6
  261. package/dist/lib/runtime/preemptive-quota.d.ts +0 -1
  262. package/dist/lib/runtime/quota-headers.d.ts +0 -1
  263. package/dist/lib/runtime/quota-probe.d.ts +0 -1
  264. package/dist/lib/runtime/quota-settings.d.ts +0 -1
  265. package/dist/lib/runtime/refresh-guardian-entry.d.ts +0 -1
  266. package/dist/lib/runtime/refresh-guardian.d.ts +0 -1
  267. package/dist/lib/runtime/request-init.d.ts +0 -1
  268. package/dist/lib/runtime/reset-credit-routing.d.ts +0 -1
  269. package/dist/lib/runtime/reset-credits.d.ts +0 -1
  270. package/dist/lib/runtime/response-output-history.d.ts +0 -1
  271. package/dist/lib/runtime/responses-websocket.d.ts +0 -1
  272. package/dist/lib/runtime/resume-picker.d.ts +0 -1
  273. package/dist/lib/runtime/rotation-account-selection.d.ts +0 -1
  274. package/dist/lib/runtime/rotation-proxy-state.d.ts +0 -1
  275. package/dist/lib/runtime/rotation-server-types.d.ts +0 -1
  276. package/dist/lib/runtime/rotation-storage-meta.d.ts +0 -1
  277. package/dist/lib/runtime/rotation-token-refresh.d.ts +0 -1
  278. package/dist/lib/runtime/runtime-capability-failures.d.ts +0 -1
  279. package/dist/lib/runtime/runtime-current-account.d.ts +0 -1
  280. package/dist/lib/runtime/runtime-observability.d.ts +0 -1
  281. package/dist/lib/runtime/runtime-services.d.ts +0 -1
  282. package/dist/lib/runtime/session-affinity-entry.d.ts +0 -1
  283. package/dist/lib/runtime/session-recovery.d.ts +0 -1
  284. package/dist/lib/runtime/status-marker.d.ts +0 -1
  285. package/dist/lib/runtime/storage-scope.d.ts +0 -1
  286. package/dist/lib/runtime/subscription-first-use.d.ts +0 -1
  287. package/dist/lib/runtime/subscription-quota-event.d.ts +0 -1
  288. package/dist/lib/runtime/subscription-quota-order.d.ts +0 -1
  289. package/dist/lib/runtime/toast.d.ts +0 -1
  290. package/dist/lib/runtime/ui-runtime-entry.d.ts +0 -1
  291. package/dist/lib/runtime/ui-runtime.d.ts +0 -1
  292. package/dist/lib/runtime/verify-flagged.d.ts +0 -1
  293. package/dist/lib/runtime/workspace-model-scopes.d.ts +0 -1
  294. package/dist/lib/runtime-constants.d.ts +0 -1
  295. package/dist/lib/runtime-paths.d.ts +0 -1
  296. package/dist/lib/runtime-rotation-proxy.d.ts +1 -1
  297. package/dist/lib/runtime-rotation-proxy.js +133 -0
  298. package/dist/lib/schemas.d.ts +35 -13
  299. package/dist/lib/schemas.js +19 -2
  300. package/dist/lib/session-affinity.d.ts +0 -1
  301. package/dist/lib/shutdown.d.ts +0 -1
  302. package/dist/lib/storage/account-clear-entry.d.ts +0 -1
  303. package/dist/lib/storage/account-clear.d.ts +0 -1
  304. package/dist/lib/storage/account-match-utils.d.ts +0 -1
  305. package/dist/lib/storage/account-persistence.d.ts +0 -1
  306. package/dist/lib/storage/account-port.d.ts +0 -1
  307. package/dist/lib/storage/account-save-entry.d.ts +0 -1
  308. package/dist/lib/storage/account-save.d.ts +9 -2
  309. package/dist/lib/storage/account-save.js +4 -1
  310. package/dist/lib/storage/account-snapshot.d.ts +0 -1
  311. package/dist/lib/storage/backup-metadata-builder.d.ts +0 -1
  312. package/dist/lib/storage/backup-metadata.d.ts +0 -1
  313. package/dist/lib/storage/backup-paths.d.ts +0 -1
  314. package/dist/lib/storage/backup-restore.d.ts +0 -1
  315. package/dist/lib/storage/cache-artifacts.d.ts +0 -1
  316. package/dist/lib/storage/credential-sidecars.d.ts +0 -1
  317. package/dist/lib/storage/error-hints.d.ts +0 -1
  318. package/dist/lib/storage/file-lock.d.ts +0 -1
  319. package/dist/lib/storage/file-lock.js +33 -1
  320. package/dist/lib/storage/file-paths.d.ts +0 -1
  321. package/dist/lib/storage/fixture-guards.d.ts +0 -1
  322. package/dist/lib/storage/flagged-entry.d.ts +0 -1
  323. package/dist/lib/storage/flagged-load-entry.d.ts +0 -1
  324. package/dist/lib/storage/flagged-save-entry.d.ts +0 -1
  325. package/dist/lib/storage/flagged-storage-file.d.ts +0 -1
  326. package/dist/lib/storage/flagged-storage-io.d.ts +0 -1
  327. package/dist/lib/storage/flagged-storage.d.ts +0 -1
  328. package/dist/lib/storage/gitignore.d.ts +0 -1
  329. package/dist/lib/storage/hash.d.ts +0 -1
  330. package/dist/lib/storage/health.d.ts +0 -1
  331. package/dist/lib/storage/identity.d.ts +0 -1
  332. package/dist/lib/storage/import-export.d.ts +0 -1
  333. package/dist/lib/storage/json-store-lock.d.ts +105 -0
  334. package/dist/lib/storage/json-store-lock.js +259 -0
  335. package/dist/lib/storage/metadata-section.d.ts +0 -1
  336. package/dist/lib/storage/migrations.d.ts +0 -1
  337. package/dist/lib/storage/migrations.js +31 -18
  338. package/dist/lib/storage/named-backup-entry.d.ts +0 -1
  339. package/dist/lib/storage/named-backups-entry.d.ts +0 -1
  340. package/dist/lib/storage/named-backups.d.ts +0 -1
  341. package/dist/lib/storage/path-state.d.ts +0 -1
  342. package/dist/lib/storage/paths.d.ts +0 -1
  343. package/dist/lib/storage/pending-auth.d.ts +9 -3
  344. package/dist/lib/storage/pending-auth.js +30 -8
  345. package/dist/lib/storage/project-migration.d.ts +0 -1
  346. package/dist/lib/storage/public-types.d.ts +0 -1
  347. package/dist/lib/storage/record-identity.d.ts +0 -1
  348. package/dist/lib/storage/record-utils.d.ts +0 -1
  349. package/dist/lib/storage/restore-assessment.d.ts +0 -1
  350. package/dist/lib/storage/restore-backup-entry.d.ts +0 -1
  351. package/dist/lib/storage/restore-metadata.d.ts +0 -1
  352. package/dist/lib/storage/save-retry.d.ts +0 -1
  353. package/dist/lib/storage/snapshot-inspectors.d.ts +0 -1
  354. package/dist/lib/storage/snapshot-merge.d.ts +0 -1
  355. package/dist/lib/storage/storage-parser.d.ts +2 -1
  356. package/dist/lib/storage/storage-parser.js +10 -2
  357. package/dist/lib/storage/transactions.d.ts +0 -1
  358. package/dist/lib/storage.d.ts +15 -2
  359. package/dist/lib/storage.js +612 -25
  360. package/dist/lib/synthetic-response.d.ts +0 -1
  361. package/dist/lib/table-formatter.d.ts +0 -1
  362. package/dist/lib/temp-path.d.ts +0 -1
  363. package/dist/lib/tools/hashline-tools.d.ts +0 -1
  364. package/dist/lib/types.d.ts +0 -1
  365. package/dist/lib/ui/ansi.d.ts +0 -1
  366. package/dist/lib/ui/auth-menu-builder.d.ts +0 -1
  367. package/dist/lib/ui/auth-menu.d.ts +0 -1
  368. package/dist/lib/ui/check-progress.d.ts +0 -1
  369. package/dist/lib/ui/confirm.d.ts +0 -1
  370. package/dist/lib/ui/display-width.d.ts +0 -1
  371. package/dist/lib/ui/format.d.ts +0 -1
  372. package/dist/lib/ui/index.d.ts +0 -1
  373. package/dist/lib/ui/runtime.d.ts +0 -1
  374. package/dist/lib/ui/select.d.ts +0 -1
  375. package/dist/lib/ui/theme.d.ts +0 -1
  376. package/dist/lib/ui/ui-copy.d.ts +0 -1
  377. package/dist/lib/unified-settings.d.ts +13 -11
  378. package/dist/lib/unified-settings.js +22 -14
  379. package/dist/lib/update-notice.d.ts +0 -1
  380. package/dist/lib/usage/index.d.ts +0 -1
  381. package/dist/lib/usage/ledger.d.ts +0 -1
  382. package/dist/lib/usage/pricing.d.ts +0 -1
  383. package/dist/lib/usage/redaction.d.ts +0 -1
  384. package/dist/lib/usage/stream-usage-deferral.d.ts +0 -1
  385. package/dist/lib/usage/types.d.ts +0 -1
  386. package/dist/lib/usage/usage-extraction.d.ts +0 -1
  387. package/dist/lib/utils.d.ts +21 -1
  388. package/dist/lib/utils.js +31 -0
  389. package/dist/lib/wsl.d.ts +0 -1
  390. package/package.json +11 -5
  391. package/scripts/codex-bin-resolver.js +20 -1
  392. package/scripts/codex-multi-auth.js +7 -1
  393. package/scripts/codex.js +288 -7
  394. package/skills/codex-auth-setup/SKILL.md +73 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-multi-auth",
3
- "version": "2.17.2",
3
+ "version": "2.17.3",
4
4
  "description": "Install and operate codex-multi-auth for the official @openai/codex CLI with multi-account OAuth rotation, switching, health checks, and recovery tools.",
5
5
  "interface": {
6
6
  "composerIcon": "./assets/codex-multi-auth-icon.svg"
package/README.md CHANGED
@@ -1,487 +1,142 @@
1
- # codex-multi-auth: multi-account OAuth for the official Codex CLI
1
+ # codex-multi-auth
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
4
4
  [![npm downloads](https://img.shields.io/npm/dw/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
5
5
  [![CI](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml)
6
6
  [![MIT license](https://img.shields.io/npm/l/codex-multi-auth.svg)](LICENSE)
7
7
 
8
- `codex-multi-auth` is a multi-account OAuth manager for the official `@openai/codex` CLI. It gives Codex CLI users explicit ChatGPT account login, account switching, health checks, local diagnostics, project-scoped storage, and default-on runtime Responses rotation without taking over the official `codex` binary. Use `codex-multi-auth ...` for account management, or `codex-multi-auth-codex ...` only when you intentionally want the optional forwarding wrapper.
8
+ `codex-multi-auth` is a multi-account OAuth manager for the official `@openai/codex` CLI. It keeps a named pool of ChatGPT sign-ins on your machine, lets you switch the active account, and — when you run Codex through its optional wrapper — rotates accounts across live requests through a loopback-only proxy. It never installs or shadows a `codex` binary; the official OpenAI install keeps owning that command.
9
9
 
10
- Use it when you need a local Codex CLI multi-account workflow with visible account state, safer recovery commands, and a loopback-only runtime rotation proxy for request-bearing forwarded Codex sessions.
10
+ Use it when one Codex account is not enough: you hit rate limits or quota windows, you split work across organizations and workspaces, you want per-project account pools, or you run unattended agents that need JSON diagnostics and safe repair commands instead of one opaque auth file.
11
11
 
12
- <img width="1270" height="729" alt="codex-multi-auth terminal dashboard for Codex CLI multi-account OAuth account status" src="https://github.com/user-attachments/assets/0cecb77e-a6d3-432a-ba48-3577db0c7093" />
12
+ ## What it does
13
13
 
14
+ - **Account pool** — OAuth login for multiple ChatGPT accounts, stored locally under `~/.codex/multi-auth` (files `0600`, directories `0700`), with per-project pools under `projects/<project-key>/`.
15
+ - **Switching and selection** — pin an account, pick the forecast-best one, or let health- and quota-aware hybrid selection rotate for you.
16
+ - **Runtime rotation** — a default-on, loopback-only proxy that forwards Responses API and model-discovery traffic through the best available account during wrapper-launched Codex sessions.
17
+ - **Diagnostics and repair** — status, live health checks, quota forecasts, JSON reports, and `fix`/`doctor`/`verify` commands that recover stale or damaged local state.
18
+ - **Local governance** — file-backed usage ledger, budget guards, account tags/weights/pause/drain policies, routing profiles, and an optional loopback bridge with bearer tokens for local OpenAI-compatible clients.
19
+ - **Desktop routing (optional)** — a reversible bind of the packaged Codex app plus user-level launcher helpers; official app binaries are never patched.
14
20
 
21
+ ## The four binaries
15
22
 
16
- > [!NOTE]
17
- > Legacy scoped prerelease package `@ndycode/codex-multi-auth` is migration-only.
18
- > Use `codex-multi-auth` for all new installs.
19
-
20
- ## What You Get
21
-
22
- - Codex CLI multi-account OAuth management with a dedicated `codex-multi-auth ...` command family
23
- - Explicit ChatGPT account login, saved-account listing, account switching, health checks, and diagnostics
24
- - Optional `codex-multi-auth-codex ...` forwarding wrapper for official Codex CLI commands when you choose wrapper-launched sessions
25
- - Health-aware account selection, quota forecasting, automatic failover, and flagged-account recovery
26
- - Project-scoped account storage under `~/.codex/multi-auth/projects/<project-key>/...` for repo-specific workflows
27
- - Interactive terminal dashboard for account actions, settings, search, and hotkeys
28
- - Forecast, report, fix, doctor, verify, monitor, and rotation commands for operational confidence
29
- - Local usage ledger, budget guards, account policy controls, routing profiles, and model/account capability views
30
- - Runtime counters, budget/cooldown state, and multi-auth probe visibility in `codex-multi-auth status` / `codex-multi-auth report`
31
- - Default-on loopback Responses proxy for live account rotation inside forwarded Codex CLI/app sessions
32
- - [Image generation/edit transport](docs/reference/image-routes.md) through the same authenticated runtime proxy
33
- - [Built-in image_gen provider compatibility](docs/reference/imagegen-provider-compatibility.md) through the same authenticated runtime proxy
34
- - Optional loopback-only local bridge for `/health`, `/v1/models`, and `/v1/responses`, protected by hashed local client tokens
35
- - Reversible packaged Codex app bind and user-level launcher routing helpers that do not patch official app binaries
36
- - Session affinity, live account sync, proactive refresh, and preemptive quota deferral controls
37
- - Codex-oriented request/prompt compatibility with strict runtime handling and documented error contracts
38
- - Stable docs for install, configuration, troubleshooting, upgrade, public API, storage paths, and release notes
39
-
40
- ---
41
-
42
- ## Optional automatic subscription priming
43
-
44
- Run `codex-multi-auth account auto-prime <index> on` to opt an account into
45
- periodic first-use checks by the running CLI/app router (every 15 minutes).
46
- It completes a tiny response only for an unused personal subscription and
47
- consumes subscription quota. Checks follow the saved workspace selection and
48
- track each saved account separately, including members of a shared organization.
49
- Status reads quota for the selected workspace; routing reads quota for the request’s exact workspace.
50
- Select Personal for a Personal subscription. The default is off; use `off` to disable it.
51
- Manual `check` still needs `--prime`. See the [command reference](docs/reference/commands.md).
52
-
53
- ## Why Developers Use It
54
-
55
- `codex-multi-auth` makes local Codex account state visible and recoverable. Instead of one opaque auth file, you get a named account pool, deterministic account switching, health-aware selection, JSON diagnostics for automation, and safe repair commands for stale or damaged local state. The architecture is designed for personal development workflows: credentials stay local, runtime rotation is loopback-only, and official Codex install paths keep owning the `codex` command.
56
-
57
- ---
58
-
59
- ## Current Architecture At A Glance
60
-
61
- `codex-multi-auth` ships four global binaries:
62
-
63
- | Binary | Purpose |
23
+ | Binary | Role |
64
24
  | --- | --- |
65
- | `codex-multi-auth` | Primary account manager; accepts bare auth subcommands such as `login`, `status`, `switch`, `forecast`, and `rotation status` |
66
- | `codex-multi-auth-codex` | Optional wrapper that handles `auth ...` locally and forwards every other command to the official Codex CLI |
67
- | `mcodex` | Convenience launcher over `codex-multi-auth-codex` with optional `--monitor` and `--tmux` modes |
68
- | `codex-multi-auth-app-launcher` | Optional desktop launcher helper for supported user-level shortcuts and wrapper apps |
69
-
70
- The package does not publish a global `codex` binary. Keep `codex` owned by the official OpenAI install path. Use `codex-multi-auth-codex ...` or `mcodex ...` only when you intentionally want this package's forwarding wrapper.
71
-
72
- With runtime rotation enabled, interactive `mcodex resume` lists saved CLI and desktop sessions across providers in the current directory. Use `mcodex resume --all` to include other directories, or `-C <directory>` to change the project scope. Select a session to resume it through multi-auth; Escape cancels. Discovery uses the official local Codex app-server and does not rewrite session metadata. Desktop and CLI must use the same `CODEX_HOME` for shared history.
73
-
74
- Explicit session IDs, `--last`, remote connections, non-interactive invocations, and the in-session `/resume` command retain native Codex behavior. The cross-provider picker requires an official Codex version supporting the app-server `thread/list` API.
75
-
76
- ---
25
+ | `codex-multi-auth` | The account manager. Runs all 31 management subcommands locally (`login`, `status`, `switch`, `forecast`, `rotation`, `fix`, ...). The `auth` prefix is optional: `codex-multi-auth login` ≡ `codex-multi-auth auth login`. |
26
+ | `codex-multi-auth-codex` | Opt-in wrapper. Handles `auth ...` locally and forwards every other command to the official Codex CLI, enabling the rotation proxy for request-bearing commands. |
27
+ | `mcodex` | Convenience launcher over the wrapper, with optional `--monitor` and `--tmux` modes. No account logic of its own. |
28
+ | `codex-multi-auth-app-launcher` | User-level OS launcher routing helper (Windows shortcut, macOS wrapper app, Linux `.desktop`). |
77
29
 
78
- <details open>
79
- <summary><b>Terms and Usage Notice</b></summary>
30
+ ## Install
80
31
 
81
- > [!CAUTION]
82
- > This project uses OAuth account credentials and is intended for personal development use.
83
- >
84
- > By using this package, you acknowledge:
85
- > - This is an independent open-source project, not an official OpenAI product
86
- > - You are responsible for your own usage and policy compliance
87
- > - For production/commercial workloads, use the OpenAI Platform API
88
-
89
- </details>
90
-
91
- ---
92
-
93
- ## Installation
94
-
95
- <details open>
96
- <summary><b>For Humans</b></summary>
97
-
98
- ### Option A: Standard install
32
+ Requirements: Node.js >= 18.17, and the official Codex CLI on `PATH` (`npm i -g @openai/codex`, Homebrew, or a release binary).
99
33
 
100
34
  ```bash
101
35
  npm i -g codex-multi-auth
102
36
  ```
103
37
 
104
- ### Option B: Migrate from legacy scoped prerelease
105
-
106
- ```bash
107
- npm uninstall -g @ndycode/codex-multi-auth
108
- npm i -g codex-multi-auth
109
- ```
110
-
111
- ### Option C: Verify wiring
112
-
113
- `codex --version` confirms the official Codex CLI is reachable. `codex-multi-auth --version` confirms the installed manager package version. `codex-multi-auth-codex --version` is the optional forwarding wrapper entrypoint.
114
-
115
- ```bash
116
- codex --version
117
- codex-multi-auth --version
118
- codex-multi-auth status
119
- ```
120
-
121
- Any official install path is fine as long as `codex` is on `PATH`: `npm i -g @openai/codex`, `brew install --cask codex`, or an official release binary.
122
-
123
- </details>
124
-
125
- <details>
126
- <summary><b>For LLM Agents</b></summary>
127
-
128
- ### Step-by-step
129
-
130
- 1. Install global package:
131
- - `npm i -g codex-multi-auth`
132
- 2. Run first login flow with `codex-multi-auth login`
133
- 3. Validate state with `codex-multi-auth status` and `codex-multi-auth check`
134
- 4. Confirm routing with `codex-multi-auth forecast --live`
135
-
136
- ### Verification
137
-
138
- ```bash
139
- codex-multi-auth status
140
- codex-multi-auth check
141
- ```
142
-
143
- </details>
144
-
145
- ---
146
-
147
- ## Quick Start
148
-
149
- Install and sign in:
150
-
151
- ```bash
152
- npm i -g @openai/codex
153
- npm i -g codex-multi-auth
154
- codex-multi-auth login
155
- ```
38
+ > [!NOTE]
39
+ > The legacy scoped prerelease `@ndycode/codex-multi-auth` is migration-only. Install `codex-multi-auth` for all new setups; see [docs/upgrade.md](docs/upgrade.md) to migrate.
156
40
 
157
- If you already installed the official native CLI via Homebrew or a release binary, you only need:
41
+ ## Quick start (5 minutes)
158
42
 
159
43
  ```bash
160
- npm i -g codex-multi-auth
44
+ # 1. Sign in a ChatGPT account (browser OAuth, loopback callback on localhost:1455)
161
45
  codex-multi-auth login
162
- ```
163
46
 
164
- Verify the manager and the new account:
165
-
166
- ```bash
47
+ # 2. Repeat login to add more accounts, then inspect the pool
167
48
  codex-multi-auth status
168
- codex-multi-auth check
169
- ```
170
49
 
171
- Use these next:
172
-
173
- ```bash
174
- codex-multi-auth list
175
- codex-multi-auth switch 2
50
+ # 3. Probe account health and preview which account would serve next
51
+ codex-multi-auth check
176
52
  codex-multi-auth forecast --live
177
53
  ```
178
54
 
179
- If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#alternate-login-paths).
180
- For remote or headless shells, prefer `codex-multi-auth login --device-auth`.
181
- To refresh one saved account without changing the active selection or manual
182
- pin, run:
55
+ Headless or remote shell? Use `codex-multi-auth login --device-auth` — no callback port needed. Blocked browser? See [alternate login paths](docs/getting-started.md#log-in).
183
56
 
184
- ```bash
185
- codex-multi-auth login --account <index|email|account_id> --preserve-selection
186
- ```
187
-
188
- Add `--device-auth` on a remote shell. The refreshed OAuth identity must match
189
- the requested saved account or nothing is written. Refreshing the account Codex
190
- is currently using still publishes its new tokens to the native CLI; refreshing
191
- any other account leaves the active selection and the manual pin untouched. A
192
- disabled account stays disabled. `--account` cannot be combined with `--org`,
193
- which would rebind the row to a different workspace.
194
-
195
- ---
196
-
197
- ## Command Toolkit
198
-
199
- ### Start here
200
-
201
- | Command | What it answers |
202
- | --- | --- |
203
- | `codex-multi-auth login` | How do I add or re-open the account menu? |
204
- | `codex-multi-auth status` | What does my account pool, pin, and runtime metrics look like? (`list` is the same output) |
205
- | `codex-multi-auth check` | Do live health probes against my saved accounts succeed? |
206
-
207
- ### Daily use
208
-
209
- | Command | What it answers |
210
- | --- | --- |
211
- | `codex-multi-auth list` | Alias of `status` — full account/runtime dump |
212
- | `codex-multi-auth switch <index>` | How do I pin a different saved account for runtime routing? |
213
- | `codex-multi-auth unpin` | How do I clear a manual pin and resume hybrid rotation? |
214
- | `codex-multi-auth workspace <account> [workspace]` | How do I list or set an account's active workspace? |
215
- | `codex-multi-auth best --live` | How do I switch to the forecast-best account (clears any pin)? |
216
- | `codex-multi-auth-codex --account <index\|email\|id>` | How do I force one account for a single wrapper session without changing my default? |
217
- | `codex-multi-auth forecast --live` | Which account looks best for the next session? |
218
-
219
- ### Repair
220
-
221
- | Command | What it answers |
222
- | --- | --- |
223
- | `codex-multi-auth verify-flagged` | Can any previously flagged account be restored? |
224
- | `codex-multi-auth verify --paths` | Do my storage path chain and sandbox probes still pass self-test? |
225
- | `codex-multi-auth fix --dry-run` | What safe storage or account repairs are available? |
226
- | `codex-multi-auth doctor --fix` | Can the CLI diagnose and apply the safest fixes now? |
227
- | `codex-multi-auth uninstall` | Remove residual artifacts (run BEFORE `npm uninstall`; npm@7+ no longer fires `preuninstall`) |
228
-
229
- ### Advanced
230
-
231
- | Command | What it answers |
232
- | --- | --- |
233
- | `codex-multi-auth report --live --json` | How do I get the full machine-readable health report? |
234
- | `codex-multi-auth limits --json [--refresh]` | How do I read account quota windows without parsing internal cache files or terminal text? |
235
- | `codex-multi-auth fix --live --model gpt-5.5` | How do I run live repair probes with a chosen model? |
236
- | `codex-multi-auth why-selected --json` | Which account does the selector pick now, and why? |
237
- | `codex-multi-auth usage --since 24h --by project` | What local usage has been recorded recently? |
238
- | `codex-multi-auth monitor --json` | What is the combined usage, policy, quota, runtime, and project state? |
239
- | `codex-multi-auth bridge token create --label local-client` | How do I create a local bridge bearer token? |
240
- | `codex-multi-auth integrations --kind python` | How do I generate local bridge client snippets? |
241
- | `codex-multi-auth rotation status` | Is live runtime account rotation enabled for forwarded Codex sessions? |
242
-
243
- ### Reliability behavior
244
-
245
- - whole-pool replay is disabled by default when every account is rate-limited
246
- - active requests use a bounded outbound request budget so one prompt cannot walk the full pool indefinitely
247
- - repeated cross-account 5xx bursts trigger a short cooldown instead of continuing aggressive rotation
248
- - proactive refresh is staggered to reduce background refresh bursts
249
- - `codex-multi-auth status` surfaces recent runtime request metrics in text output, and `codex-multi-auth report --json` exposes the machine-readable cooldown/runtime snapshot
250
-
251
- ---
252
-
253
- ## Dashboard Hotkeys
254
-
255
- ### Main dashboard
256
-
257
- | Key | Action |
258
- | --- | --- |
259
- | `Up` / `Down` | Move selection |
260
- | `Enter` | Select/open |
261
- | `1-9` | Quick switch |
262
- | `/` | Search |
263
- | `?` | Toggle help |
264
- | `Q` | Back/cancel |
265
-
266
- ### Account details
267
-
268
- | Key | Action |
269
- | --- | --- |
270
- | `S` | Set current account |
271
- | `R` | Refresh/re-login account |
272
- | `E` | Enable/disable account |
273
- | `D` | Delete account |
274
-
275
- ---
276
-
277
- ## Storage Paths
278
-
279
- | File | Default path |
280
- | --- | --- |
281
- | Settings | `~/.codex/multi-auth/settings.json` |
282
- | Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
283
- | Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
284
- | Quota cache | `~/.codex/multi-auth/quota-cache.json` |
285
- | Runtime observability | `~/.codex/multi-auth/runtime-observability.json` |
286
- | Usage ledger | `~/.codex/multi-auth/usage/usage-ledger.jsonl` |
287
- | Account policies | `~/.codex/multi-auth/account-policies.json` |
288
- | Routing profiles | `~/.codex/multi-auth/routing-profiles.json` |
289
- | Budget guards | `~/.codex/multi-auth/budget-guards.json` |
290
- | Local client tokens | `~/.codex/multi-auth/local-client-tokens.json` |
291
- | Runtime app helper status | `~/.codex/multi-auth/runtime-rotation-app-helper.<pid>.json` |
292
- | Runtime app helper owner metadata | `~/.codex/multi-auth/runtime-rotation-app-helper-owner.<pid>.json` |
293
- | Persistent app bind state/logs | `~/.codex/multi-auth/app-bind/` |
294
- | Logs | `~/.codex/multi-auth/logs/codex-plugin/` |
295
- | Per-project accounts | `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json` |
296
-
297
- Override root with `CODEX_MULTI_AUTH_DIR=<path>`.
298
-
299
- ---
300
-
301
- ## Configuration
302
-
303
- Primary config root:
304
- - `~/.codex/multi-auth/settings.json`
305
- - or `CODEX_MULTI_AUTH_DIR/settings.json` when custom root is set
306
-
307
- Selected runtime/environment overrides:
308
-
309
- | Variable | Effect |
310
- | --- | --- |
311
- | `CODEX_MULTI_AUTH_DIR` | Override settings/accounts root |
312
- | `CODEX_MULTI_AUTH_CONFIG_PATH` | Prefer this config file when it exists (also the save target when set) |
313
- | `CODEX_MODE=0/1` | Disable/enable Codex mode |
314
- | `CODEX_MULTI_AUTH_FORCE_ACCOUNT=<index\|email\|id>` | Force one account for a single `codex-multi-auth-codex` run (ephemeral; requires rotation proxy) |
315
- | `CODEX_MULTI_AUTH_BYPASS=1` | Skip multi-auth intercept and forward straight to official Codex |
316
- | `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0/1` | Opt out/in of live Responses proxy rotation for forwarded Codex CLI/app sessions |
317
- | `CODEX_MULTI_AUTH_RUNTIME_PROXY_UPSTREAM_BASE_URL=http://127.0.0.1:<port>/<path>` | Route the runtime rotation proxy through an explicit loopback HTTP upstream; requires an explicit port and a numeric loopback host (`127.0.0.0/8` or `[::1]`), and rejects credentials, query strings, fragments, HTTPS, and every other host |
318
- | `CODEX_MULTI_AUTH_MODEL_CAPACITY_RETRY_MS=<ms>` | Wall-clock ceiling on how long one request waits out a "selected model is at capacity" response before giving up (default 600000, max 3600000, `0` disables) |
319
- | `CODEX_MULTI_AUTH_APP_ROTATION_IDLE_MS=<ms>` | Override automatic Codex app helper idle shutdown |
320
- | `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0/1` | Opt out/in of packaged Codex app bind self-heal on first CLI run or rotation enable |
321
- | `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0/1` | Opt out/in of routing supported app shortcuts on first CLI run or rotation enable |
322
- | `CODEX_TUI_V2=0/1` | Disable/enable TUI v2 |
323
- | `CODEX_TUI_COLOR_PROFILE=truecolor\|ansi256\|ansi16` | TUI color profile |
324
- | `CODEX_TUI_GLYPHS=ascii\|unicode\|auto` | TUI glyph style |
325
- | `CODEX_AUTH_BACKGROUND_RESPONSES=0/1` | Opt in/out of stateful Responses `background: true` compatibility |
326
- | `CODEX_AUTH_FETCH_TIMEOUT_MS=<ms>` | Request timeout override |
327
- | `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=<ms>` | Stream stall timeout override |
328
-
329
- Validate config after changes:
57
+ Run Codex through the wrapper so requests rotate across the pool:
330
58
 
331
59
  ```bash
332
- codex-multi-auth status
333
- codex-multi-auth check
334
- codex-multi-auth forecast --live
60
+ codex-multi-auth-codex # interactive TUI, rotation on by default
61
+ codex-multi-auth-codex exec "summarize this repo"
62
+ mcodex # same wrapper, shorter name
335
63
  ```
336
64
 
337
- Responses background mode stays opt-in. Enable `backgroundResponses` in settings or `CODEX_AUTH_BACKGROUND_RESPONSES=1` only for callers that intentionally send `background: true`, because those requests switch from stateless `store=false` routing to stateful `store=true`. See [docs/upgrade.md](docs/upgrade.md) for rollout guidance.
338
-
339
- Runtime rotation is enabled by default for request-bearing wrapper-launched Codex sessions. Package install scripts stay side-effect-free: npm postinstall only prints a short notice (and stays silent in CI or non-interactive installs). The first CLI run after an install self-heals supported packaged Codex app binds and user-level launcher routing when possible (recorded once in a `first-run-setup.json` marker under the multi-auth runtime root), while `codex-multi-auth rotation enable` remains the explicit repair command. `codex-multi-auth rotation disable` turns the setting off and removes the persistent app bind. Set `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0`, or `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0` to opt out of the matching default behavior.
340
-
341
- Advanced local proxy chains can set `CODEX_MULTI_AUTH_RUNTIME_PROXY_UPSTREAM_BASE_URL` for one wrapper process. The wrapper passes that URL to both the shadow-runtime and interactive-helper rotation paths and fails closed if the configured upstream is invalid or unavailable; it never falls back silently to the direct backend while an explicit upstream is required. Because the request that reaches the upstream carries the managed OAuth bearer token, the host must be a numeric loopback literal: a name such as `localhost` is rejected, since a hosts-file entry can point it at a routable address. "Fails closed" also covers the case where runtime rotation itself is off (`CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_BYPASS=1`, or the setting disabled): a request-bearing invocation exits non-zero rather than bypassing the configured upstream. Subcommands that make no backend requests still run normally.
342
-
343
- When the backend answers that the selected model is at capacity, the runtime proxy waits and re-sends the request instead of burning the pool. Capacity is a property of the model, not of an account, so rotating spends the transient budget against accounts that all fail identically and the request ends as a 503 within seconds. The wait backs off (2s, 5s, 15s, 30s, then 60s), honors an upstream `retry-after` when one is sent, and stops at a wall-clock deadline set by `CODEX_MULTI_AUTH_MODEL_CAPACITY_RETRY_MS` (10 minutes by default, 1 hour maximum). Set that variable to `0` to restore the previous rotate-and-fail behavior. The responding account is left completely unpenalized: its pool token is refunded and it is never marked rate limited or cooled down, so selection runs normally on the next pass and may pick any healthy account. The wait is abandoned if the client disconnects, so no further upstream request is sent for a response nobody is reading. See [#689](https://github.com/ndycode/codex-multi-auth/issues/689).
344
-
345
- Trust boundary: the loopback check bounds exposure to the local machine, and nothing more. It does not authenticate the process listening on that port, and plaintext HTTP is what a local inspection proxy needs, so any process that can bind the port you name receives the managed bearer token in cleartext. Set this variable only on a machine where you trust every local process that can bind a loopback port, and only for as long as you need the chain.
65
+ ## Command map
346
66
 
347
- Installed wrappers may perform a best-effort daily npm version check during normal forwarded Codex startup. When a newer package is detected, the wrapper only prints a manual notice on an interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`: `npm install -g codex-multi-auth@latest`. It never runs npm install or update commands for you.
67
+ `codex-multi-auth` ships 31 subcommands. The full surface — every flag, hotkey, and JSON mode — is in [docs/reference/commands.md](docs/reference/commands.md).
348
68
 
349
- ---
69
+ | Group | Commands | Purpose |
70
+ | --- | --- | --- |
71
+ | Accounts | `login`, `list`, `status`, `switch <i>`, `unpin`, `workspace` | sign in, inspect the pool, pin or switch the active account, pick workspaces |
72
+ | Selection | `forecast`, `best`, `why-selected`, `check`, `limits`, `models` | preview, explain, and probe which account serves the next request |
73
+ | Runtime | `rotation status` `enable` `disable` `bind-app` `unbind-app` `reset-runtime` `reset-rate-limits` | inspect and control live rotation and the app bind |
74
+ | Repair | `fix`, `doctor`, `verify`, `verify-flagged`, `uninstall` | diagnose and repair storage, flagged accounts, and install residue |
75
+ | Governance | `usage`, `budget`, `account`, `monitor`, `history`, `resets` | usage ledger, budget limits, tags/weights/pause/drain, snapshots |
76
+ | Local clients | `bridge`, `integrations` | bearer tokens and client snippets for the loopback bridge |
77
+ | Config | `config explain` `template`, `init-config`, `debug bundle`, `features` | effective-config report, config templates, sanitized debug bundle |
350
78
 
351
- ## Experimental Settings Highlights
352
-
353
- The Settings menu now includes an `Experimental` section for staged features:
354
-
355
- - preview-first sync into `oc-chatgpt-multi-auth`
356
- - named local pool backup export with filename prompt
357
- - refresh guard toggle and interval controls moved out of Backend Controls
358
- - context budget guard: pause a session before it hits the model's context window, with independently configurable soft/hard thresholds (default 65% / 69%) — ships disabled; see [Context Budget Guard](docs/features.md#context-budget-guard-experimental)
359
-
360
- These flows are intentionally non-destructive by default: sync previews before apply, destination-only accounts are preserved, and backup filename collisions fail safely.
361
-
362
- ---
363
-
364
- ## Troubleshooting
365
-
366
- <details open>
367
- <summary><b>60-second recovery</b></summary>
79
+ Everyday examples:
368
80
 
369
81
  ```bash
370
- codex-multi-auth doctor --fix
371
- codex-multi-auth check
372
- codex-multi-auth forecast --live
82
+ codex-multi-auth switch 2 # pin account #2
83
+ codex-multi-auth report --live --json # full machine-readable health report
84
+ codex-multi-auth fix --live --model gpt-5.5 # live repair probes with a chosen model
85
+ codex-multi-auth doctor --fix # diagnose and apply the safest fixes
86
+ codex-multi-auth usage --since 24h --by model # local usage ledger summary
87
+ codex-multi-auth rotation status # is live rotation enabled?
373
88
  ```
374
89
 
375
- If still broken:
376
-
377
- ```bash
378
- codex-multi-auth login
379
- ```
90
+ ## Runtime rotation, in one paragraph
380
91
 
381
- </details>
92
+ With rotation on (the default), request-bearing wrapper commands — `exec`, `review`, `resume`, `fork`, `app`, and the bare TUI — route through a local proxy that picks the healthiest account per request, refreshes tokens as needed, and fails over across the pool on rate limits within a bounded retry budget. The proxy listens on loopback only, authenticates its own clients with a per-process token, forwards only Responses API and model-discovery calls, and never writes account emails or tokens to client headers or logs. Plain `codex` is never touched: rotation exists only inside `codex-multi-auth-codex`/`mcodex` sessions, or inside the packaged desktop app after an opt-in, reversible bind. Turn it off with `codex-multi-auth rotation disable` or `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`.
382
93
 
383
- <details>
384
- <summary><b>Common symptoms</b></summary>
94
+ ## Where state lives
385
95
 
386
- - `codex-multi-auth` unrecognized: run `where codex-multi-auth` or `which codex-multi-auth`, then follow `docs/troubleshooting.md` for install checks
387
- - Switch succeeds but wrong account appears active: run `codex-multi-auth switch <index>`, then restart session
388
- - Requests fail fast with a pool cooldown message: wait for the cooldown window or inspect `codex-multi-auth status`
389
- - Requests fail fast after repeated upstream 5xx errors: inspect `codex-multi-auth report --json` for runtime traffic and cooldown details
390
- - Storage cleanup fails with `EBUSY` / `EPERM` (Windows): run `codex-multi-auth doctor --fix` to retry, or manually remove `~/.codex/multi-auth/<project-key>/` and re-login
391
- - OAuth callback on port `1455` fails: free the port and re-run `codex-multi-auth login`
392
- - Login hangs in WSL, or installing in WSL breaks a working Windows install: Windows and WSL contend for callback port `1455`, and the browser opens on the Windows host either way — see [Windows and WSL side by side](docs/troubleshooting.md#windows-and-wsl-side-by-side), or use `codex-multi-auth login --device-auth`, which needs no callback port
393
- - Browser launch is blocked or you are in a headless shell: prefer `codex-multi-auth login --device-auth`; use `codex-multi-auth login --manual` or `CODEX_AUTH_NO_BROWSER=1` only when you need the callback-paste fallback
394
- - `missing field id_token` / `token_expired` / `refresh_token_reused`: re-login affected account
96
+ | What | Path |
97
+ | --- | --- |
98
+ | Accounts, settings, quota cache, usage ledger, policies, observability | `~/.codex/multi-auth/` |
99
+ | Per-project account pools | `~/.codex/multi-auth/projects/<project-key>/` |
100
+ | Official Codex state (kept by the official install) | `~/.codex/` |
101
+ | Override the multi-auth root | `CODEX_MULTI_AUTH_DIR=<path>` |
395
102
 
396
- </details>
103
+ Full path map: [docs/reference/storage-paths.md](docs/reference/storage-paths.md).
397
104
 
398
- <details>
399
- <summary><b>Diagnostics pack</b></summary>
105
+ ## Troubleshooting in 60 seconds
400
106
 
401
107
  ```bash
402
- codex-multi-auth list
403
- codex-multi-auth status
108
+ codex-multi-auth doctor --fix
404
109
  codex-multi-auth check
405
- codex-multi-auth verify-flagged --json
406
110
  codex-multi-auth forecast --live
407
- codex-multi-auth fix --dry-run
408
- codex-multi-auth report --live --json
409
- codex-multi-auth doctor --json
410
111
  ```
411
112
 
412
- </details>
413
-
414
- ---
113
+ Common symptoms — wrong active account, OAuth callback port `1455` already bound, Windows/WSL port contention, `EBUSY`/`EPERM` on Windows — are covered in [docs/troubleshooting.md](docs/troubleshooting.md).
415
114
 
416
115
  ## Documentation
417
116
 
418
- - Docs portal: [docs/README.md](docs/README.md)
419
- - Getting started: [docs/getting-started.md](docs/getting-started.md)
420
- - Features: [docs/features.md](docs/features.md)
421
- - Configuration: [docs/configuration.md](docs/configuration.md)
422
- - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
423
- - Commands reference: [docs/reference/commands.md](docs/reference/commands.md)
424
- - Public API contract: [docs/reference/public-api.md](docs/reference/public-api.md)
425
- - Error contracts: [docs/reference/error-contracts.md](docs/reference/error-contracts.md)
426
- - Settings reference: [docs/reference/settings.md](docs/reference/settings.md)
427
- - Storage paths: [docs/reference/storage-paths.md](docs/reference/storage-paths.md)
428
- - Upgrade guide: [docs/upgrade.md](docs/upgrade.md)
429
- - Privacy: [docs/privacy.md](docs/privacy.md)
430
-
431
- ---
432
-
433
- ## Release Notes
434
-
435
- - Current stable: [docs/releases/v2.17.0.md](docs/releases/v2.17.0.md) — install via `npm i -g codex-multi-auth`
436
- - Previous stable: [docs/releases/v2.8.3.md](docs/releases/v2.8.3.md)
437
- - Previous stable: [docs/releases/v2.8.2.md](docs/releases/v2.8.2.md)
438
- - Previous stable: [docs/releases/v2.7.1.md](docs/releases/v2.7.1.md)
439
- - Previous stable: [docs/releases/v2.7.0.md](docs/releases/v2.7.0.md)
440
- - Previous stable: [docs/releases/v2.6.0.md](docs/releases/v2.6.0.md)
441
- - Previous stable: [docs/releases/v2.5.0.md](docs/releases/v2.5.0.md)
442
- - Previous stable: [docs/releases/v2.4.0.md](docs/releases/v2.4.0.md)
443
- - Previous stable: [docs/releases/v2.3.3.md](docs/releases/v2.3.3.md)
444
- - Previous stable: [docs/releases/v2.3.2.md](docs/releases/v2.3.2.md)
445
- - Previous stable: [docs/releases/v2.3.1.md](docs/releases/v2.3.1.md)
446
- - Previous stable: [docs/releases/v2.3.0.md](docs/releases/v2.3.0.md)
447
- - Previous stable: [docs/releases/v2.2.2.md](docs/releases/v2.2.2.md)
448
- - Previous stable: [docs/releases/v2.2.1.md](docs/releases/v2.2.1.md)
449
- - Previous stable: [docs/releases/v2.2.0.md](docs/releases/v2.2.0.md)
450
- - Previous stable: [docs/releases/v2.1.12.md](docs/releases/v2.1.12.md)
451
- - Earlier stable: [docs/releases/v2.1.11.md](docs/releases/v2.1.11.md)
452
- - Earlier stable: [docs/releases/v2.1.10.md](docs/releases/v2.1.10.md)
453
- - Earlier stable: [docs/releases/v2.1.8.md](docs/releases/v2.1.8.md)
454
- - Earlier stable: [docs/releases/v2.1.7.md](docs/releases/v2.1.7.md)
455
- - Earlier stable: [docs/releases/v2.1.6.md](docs/releases/v2.1.6.md)
456
- - Earlier stable: [docs/releases/v2.1.5.md](docs/releases/v2.1.5.md)
457
- - Earlier stable: [docs/releases/v2.1.4.md](docs/releases/v2.1.4.md)
458
- - Earlier stable: [docs/releases/v2.1.3.md](docs/releases/v2.1.3.md)
459
- - Earlier stable: [docs/releases/v2.1.2.md](docs/releases/v2.1.2.md)
460
- - Earlier stable: [docs/releases/v2.1.1.md](docs/releases/v2.1.1.md)
461
- - Earlier stable: [docs/releases/v2.1.0.md](docs/releases/v2.1.0.md)
462
- - Earlier stable: [docs/releases/v1.3.2.md](docs/releases/v1.3.2.md)
463
- - Stable archive: [docs/releases/v1.3.1.md](docs/releases/v1.3.1.md)
117
+ | Doc | What it covers |
118
+ | --- | --- |
119
+ | [docs/index.md](docs/index.md) | Product overview — what it does at runtime and who needs it |
120
+ | [docs/README.md](docs/README.md) | Full documentation portal and sitemap |
121
+ | [docs/getting-started.md](docs/getting-started.md) | Install, first login, day-1 commands |
122
+ | [docs/features.md](docs/features.md) | Feature tour |
123
+ | [docs/architecture.md](docs/architecture.md) | Components, request flow, trust boundaries |
124
+ | [docs/configuration.md](docs/configuration.md) | Settings and environment overrides |
125
+ | [docs/reference/commands.md](docs/reference/commands.md) | Every command, flag, and hotkey |
126
+ | [docs/reference/public-api.md](docs/reference/public-api.md) | Public API stability tiers and semver contract |
127
+ | [docs/troubleshooting.md](docs/troubleshooting.md) | Recovery playbooks |
128
+ | [docs/faq.md](docs/faq.md) | Common questions |
129
+ | [docs/upgrade.md](docs/upgrade.md) | Version and legacy-package migration |
130
+ | [docs/privacy.md](docs/privacy.md) | Data handling and local storage behavior |
131
+
132
+ ## Release notes
133
+
134
+ - Current stable: [v2.17.3](docs/releases/v2.17.3.md) — `npm i -g codex-multi-auth`
135
+ - Earlier stable lines: [v2.6.0](docs/releases/v2.6.0.md), [v2.5.0](docs/releases/v2.5.0.md)
464
136
  - Full release archive: [docs/README.md#release-history](docs/README.md#release-history)
465
- - Archived prerelease: [docs/releases/v0.1.0-beta.0.md](docs/releases/v0.1.0-beta.0.md)
466
-
467
- ## License
468
-
469
- MIT License. See [LICENSE](LICENSE).
470
-
471
- <details>
472
- <summary><b>Legal</b></summary>
473
-
474
- - Not affiliated with OpenAI.
475
- - "ChatGPT", "Codex", and "OpenAI" are trademarks of OpenAI.
476
- - You assume responsibility for your own usage and compliance.
477
137
 
478
- </details>
138
+ ## Terms and license
479
139
 
480
- ### Optional native desktop binding
140
+ `codex-multi-auth` uses OAuth account credentials and is intended for personal development use. It is an independent open-source project, not an official OpenAI product; you are responsible for your own usage and policy compliance, and for production or commercial workloads you should use the OpenAI Platform API. "ChatGPT", "Codex", and "OpenAI" are trademarks of OpenAI.
481
141
 
482
- Native desktop features such as Remote Control pairing need the real desktop
483
- account identity. Use `codex-multi-auth rotation bind-app --native` to preserve
484
- that login while routing inference through managed accounts. Add
485
- `--catalog-account <index>` to use one account's live model catalog. This mode
486
- requires file-backed desktop credentials; see the [rotation command reference](docs/reference/commands.md#native-provider-binding-opt-in)
487
- for setup, limitations, and rollback.
142
+ MIT license — see [LICENSE](LICENSE).
package/dist/index.d.ts CHANGED
@@ -42,4 +42,3 @@ import type { Plugin } from "@codex-ai/plugin";
42
42
  export declare const OpenAIOAuthPlugin: Plugin;
43
43
  export declare const OpenAIAuthPlugin: any;
44
44
  export default OpenAIOAuthPlugin;
45
- //# sourceMappingURL=index.d.ts.map
@@ -21,8 +21,24 @@ export declare function getAccountPolicyKey(account: Pick<AccountMetadataV3, "ac
21
21
  refreshToken?: string | null;
22
22
  }, _index?: number): string;
23
23
  export declare function loadAccountPolicyStore(): Promise<AccountPolicyStore>;
24
- export declare function saveAccountPolicyStore(store: AccountPolicyStore): Promise<void>;
24
+ export declare function saveAccountPolicyStore(store: AccountPolicyStore, baseline?: AccountPolicyStore): Promise<void>;
25
+ /**
26
+ * Run a policy-store read→mutate→write inside the write queue (in-process
27
+ * serialization) AND the cross-process lock directory, with mtime CAS retry:
28
+ * every attempt re-reads the freshest on-disk store and re-applies `mutate`
29
+ * before writing — so two commands editing DIFFERENT fields of the same
30
+ * policy (e.g. `weight` vs `tags`) both land, which the whole-record
31
+ * `updatedAt` merge in {@link saveAccountPolicyStore} cannot guarantee: a
32
+ * stale snapshot's record would either clobber a newer record wholesale or be
33
+ * discarded entirely. `mutate` must be re-appliable across retries (apply
34
+ * precomputed work onto the store it is handed, don't capture mutated state).
35
+ * Prefer this over load→upsert→save whenever the caller is mutating rather
36
+ * than importing a foreign store.
37
+ */
38
+ export declare function updateAccountPolicyStore<T>(mutate: (store: AccountPolicyStore) => {
39
+ result: T;
40
+ dirty: boolean;
41
+ }): Promise<T>;
25
42
  export declare function upsertAccountPolicy(store: AccountPolicyStore, accountKey: string, mutate: (policy: AccountPolicy) => void, now?: number): AccountPolicy;
26
43
  export declare function normalizeAccountPolicyTag(value: string): string | null;
27
44
  export declare function resetAccountPolicyWriteQueueForTests(): void;
28
- //# sourceMappingURL=account-policy.d.ts.map