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
package/scripts/codex.js CHANGED
@@ -20,12 +20,13 @@ import {
20
20
  } from "node:fs";
21
21
  import { rm as rmAsync } from "node:fs/promises";
22
22
  import { createRequire } from "node:module";
23
- import { homedir, tmpdir } from "node:os";
24
- import { basename, delimiter, dirname, join, resolve as resolvePath, sep } from "node:path";
23
+ import { constants as osConstants, homedir, tmpdir } from "node:os";
24
+ import { basename, delimiter, dirname, isAbsolute, join, resolve as resolvePath, sep } from "node:path";
25
25
  import process from "node:process";
26
26
  import { StringDecoder } from "node:string_decoder";
27
27
  import { fileURLToPath, pathToFileURL } from "node:url";
28
28
  import {
29
+ isFullyQualifiedBinOverride,
29
30
  isWindowsShimPath,
30
31
  resolveRealCodexBin as resolveRealCodexBinFromEnvironment,
31
32
  resolveWindowsShimPackageEntry,
@@ -65,6 +66,11 @@ const SHADOW_HOME_STATE_FILE_SET = new Set(SHADOW_HOME_STATE_FILES);
65
66
  const SHADOW_HOME_CONFIG_FILE = "config.toml";
66
67
  const SHADOW_HOME_SYNC_LOCK_DIR = ".codex-multi-auth-shadow-sync.lock";
67
68
  const SHADOW_HOME_SYNC_STATE_FILE = ".codex-multi-auth-shadow-sync-state.json";
69
+ // Housekeeping marker written into every shadow home ({pid, createdAt, and the
70
+ // forwarded child's pid once spawned}) so the next launch can tell a dead
71
+ // owner's leftover from a home still in use. It is never mirrored in from the
72
+ // real home nor synced back into it.
73
+ const SHADOW_HOME_OWNER_FILE = ".codex-multi-auth-owner.json";
68
74
  const APP_SERVER_ACCOUNT_DISPLAY_NAME = "codex-multi-auth";
69
75
  const RUNTIME_CONSTANTS = await loadRuntimeConstants();
70
76
  const RUNTIME_ROTATION_PROXY_PROVIDER_ID =
@@ -1329,7 +1335,10 @@ async function autoSyncManagerActiveSelectionIfEnabled() {
1329
1335
  if (!enabled) return;
1330
1336
 
1331
1337
  try {
1332
- const mod = await import("../dist/lib/codex-manager.js");
1338
+ // Slim entry point: importing dist/lib/codex-manager.js here would pull
1339
+ // the whole command/dispatch/settings graph (~126 modules incl. zod)
1340
+ // onto every forwarded invocation's cold-start path.
1341
+ const mod = await import("../dist/lib/codex-manager/active-account-sync.js");
1333
1342
  if (typeof mod.autoSyncActiveAccountToCodex !== "function") {
1334
1343
  return;
1335
1344
  }
@@ -1346,6 +1355,15 @@ async function autoSyncManagerActiveSelectionIfEnabled() {
1346
1355
  function resolveRealCodexBin() {
1347
1356
  const override = (process.env.CODEX_MULTI_AUTH_REAL_CODEX_BIN ?? "").trim();
1348
1357
  if (override.length > 0) {
1358
+ // Fully-qualified = absolute AND drive-qualified on Windows: a
1359
+ // root-relative override like "\bin\codex.exe" resolves against the cwd's
1360
+ // drive and could exec a planted file (CWE-426).
1361
+ if (!isFullyQualifiedBinOverride(override, process.platform)) {
1362
+ console.error(
1363
+ `CODEX_MULTI_AUTH_REAL_CODEX_BIN must be a fully-qualified absolute path (a drive-qualified or UNC path on Windows), got: ${override}`,
1364
+ );
1365
+ return null;
1366
+ }
1349
1367
  if (!existsSync(override)) {
1350
1368
  console.error(
1351
1369
  `CODEX_MULTI_AUTH_REAL_CODEX_BIN is set but missing: ${override}`,
@@ -1817,11 +1835,23 @@ function forwardToRealCodexOnce(
1817
1835
  ? createAppServerAccountReadProtocolProxy()
1818
1836
  : null;
1819
1837
  let cleanupProtocolProxy = () => {};
1838
+ let detachSignalRelay = () => {};
1839
+ let signalForceTimer = null;
1840
+ // Set the moment finalization begins so a repeated signal during cleanup
1841
+ // can exit with the result already decided instead of the default
1842
+ // disposition, which would look like a signal death and truncate
1843
+ // shadow-home sync-back mid-write.
1844
+ let finalizedExitCode = null;
1820
1845
  const finalize = async (exitCode) => {
1821
1846
  if (settled) {
1822
1847
  return;
1823
1848
  }
1824
1849
  settled = true;
1850
+ finalizedExitCode = exitCode;
1851
+ if (signalForceTimer !== null) {
1852
+ clearTimeout(signalForceTimer);
1853
+ signalForceTimer = null;
1854
+ }
1825
1855
  cleanupProtocolProxy();
1826
1856
  protocolProxy?.flushOutput();
1827
1857
  try {
@@ -1829,6 +1859,11 @@ function forwardToRealCodexOnce(
1829
1859
  } catch {
1830
1860
  // Best-effort cleanup only.
1831
1861
  }
1862
+ // The relay stays installed until cleanup has run: a repeated signal
1863
+ // landing mid-finalize exits with the decided code (see
1864
+ // onRelayedSignal) rather than a default kill that truncates
1865
+ // shadow-home sync-back.
1866
+ detachSignalRelay();
1832
1867
  if (captureOutput && stdout.length > 0) {
1833
1868
  const filteredStdout = filterKnownForwardedCodexStderr(stdout);
1834
1869
  if (filteredStdout.length > 0) {
@@ -1878,6 +1913,68 @@ function forwardToRealCodexOnce(
1878
1913
  return;
1879
1914
  }
1880
1915
 
1916
+ // The forwarded child can outlive this wrapper — SIGKILL can neither be
1917
+ // caught nor relayed — so the shadow-home owner marker names the child
1918
+ // too; otherwise the next launch's sweep would see only the dead wrapper
1919
+ // PID and reap a home a live child is still writing to.
1920
+ recordShadowHomeChildPid(env.CODEX_HOME, child?.pid);
1921
+
1922
+ // Relay terminal signals to the forwarded child. Without this the child
1923
+ // outlives the wrapper whenever a signal targets the wrapper PID
1924
+ // directly (kill, launcher, monitor) rather than the process group, and
1925
+ // the shadow-home cleanup inside finalize never runs.
1926
+ const signalRelayHandlers = new Map();
1927
+ // The first relayed signal decides the exit result: once the force-kill
1928
+ // fallback SIGKILLs the child, its `close` event reports SIGKILL, which
1929
+ // would mask the SIGTERM the caller actually sent (137 instead of 143).
1930
+ let relayedSignal = null;
1931
+ const onRelayedSignal = (signal) => {
1932
+ if (settled) {
1933
+ // Finalization is already running. A repeated signal here is the
1934
+ // caller escalating (Ctrl-C again, a monitor's follow-up TERM):
1935
+ // exit with the result finalization produced rather than hang on
1936
+ // a slow cleanup — but never with signal-death semantics, which
1937
+ // is what the pre-handler default would have reported.
1938
+ process.exit(finalizedExitCode ?? 1);
1939
+ }
1940
+ relayedSignal ??= signal;
1941
+ try {
1942
+ child?.kill(signal);
1943
+ } catch {
1944
+ // Best-effort forward only.
1945
+ }
1946
+ if (signalForceTimer !== null) {
1947
+ return;
1948
+ }
1949
+ // If the child ignores the signal, force-kill it — but leave
1950
+ // finalization to the child's "close" event, so shadow-home sync and
1951
+ // removal run only after the child is reaped and its stdio drained.
1952
+ signalForceTimer = setTimeout(() => {
1953
+ signalForceTimer = null;
1954
+ try {
1955
+ child?.kill("SIGKILL");
1956
+ } catch {
1957
+ // Best-effort only.
1958
+ }
1959
+ }, 1_000);
1960
+ signalForceTimer.unref?.();
1961
+ };
1962
+ // `on`, not `once`: the handlers stay installed until finalization, so a
1963
+ // repeated signal while a child still ignores the first keeps relaying
1964
+ // instead of falling back to the default disposition — which would kill
1965
+ // the wrapper before it can reap the child or clean the shadow home.
1966
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
1967
+ const handler = () => onRelayedSignal(signal);
1968
+ signalRelayHandlers.set(signal, handler);
1969
+ process.on(signal, handler);
1970
+ }
1971
+ detachSignalRelay = () => {
1972
+ for (const [signal, handler] of signalRelayHandlers) {
1973
+ process.removeListener(signal, handler);
1974
+ }
1975
+ signalRelayHandlers.clear();
1976
+ };
1977
+
1881
1978
  if (proxyAppServerAccountRead && protocolProxy) {
1882
1979
  let stdinClosed = false;
1883
1980
  let stdoutClosed = false;
@@ -1948,9 +2045,16 @@ function forwardToRealCodexOnce(
1948
2045
  });
1949
2046
 
1950
2047
  child.once("close", (code, signal) => {
1951
- if (signal) {
1952
- const signalNumber = signal === "SIGINT" ? 130 : 1;
1953
- finalize(signalNumber);
2048
+ const reportedSignal = relayedSignal ?? signal;
2049
+ if (reportedSignal) {
2050
+ const signalNumber = osConstants.signals?.[reportedSignal];
2051
+ finalize(
2052
+ typeof signalNumber === "number"
2053
+ ? 128 + signalNumber
2054
+ : reportedSignal === "SIGINT"
2055
+ ? 130
2056
+ : 1,
2057
+ );
1954
2058
  return;
1955
2059
  }
1956
2060
  finalize(typeof code === "number" ? code : 1);
@@ -1959,6 +2063,7 @@ function forwardToRealCodexOnce(
1959
2063
  }
1960
2064
 
1961
2065
  async function forwardToRealCodex(codexBin, rawArgs, baseEnv = process.env) {
2066
+ sweepStaleShadowHomes(baseEnv);
1962
2067
  let currentArgs = [...rawArgs];
1963
2068
  let lastExitCode = 1;
1964
2069
  const attemptedModels = new Set();
@@ -3271,6 +3376,7 @@ function collectShadowHomeSyncFileNames(shadowCodexHome, syncFileNames) {
3271
3376
  if (
3272
3377
  name === SHADOW_HOME_CONFIG_FILE ||
3273
3378
  name === SHADOW_HOME_SYNC_STATE_FILE ||
3379
+ name === SHADOW_HOME_OWNER_FILE ||
3274
3380
  syncFileNames.has(name)
3275
3381
  ) {
3276
3382
  continue;
@@ -3442,6 +3548,7 @@ function createShadowHomeMirror(
3442
3548
  name === SHADOW_HOME_CONFIG_FILE ||
3443
3549
  name === SHADOW_HOME_SYNC_STATE_FILE ||
3444
3550
  name === SHADOW_HOME_SYNC_LOCK_DIR ||
3551
+ name === SHADOW_HOME_OWNER_FILE ||
3445
3552
  skipMirrorPredicate(name)
3446
3553
  ) {
3447
3554
  continue;
@@ -3671,6 +3778,175 @@ function resolveRuntimeRotationProxyOriginalCodexHome(baseEnv) {
3671
3778
  return override || resolveCodexHomeDir(baseEnv);
3672
3779
  }
3673
3780
 
3781
+ // Markerless dirs are pre-sweeper leftovers (or crashed-before-mark runs);
3782
+ // 24h is generous next to any real session so a live shadow is never reaped.
3783
+ const STALE_SHADOW_HOME_AGE_MS = 24 * 60 * 60 * 1000;
3784
+ // A recorded PID is an identity, not just a liveness token: the owning process
3785
+ // necessarily started before its marker was written, so a process now holding
3786
+ // the PID that started meaningfully later is a different process — the PID was
3787
+ // recycled. Same rule sweepStaleRuntimeRotationAppHelperMetadata uses.
3788
+ const SHADOW_HOME_OWNER_SKEW_MS = 60_000;
3789
+ let staleShadowHomeSweepDone = false;
3790
+
3791
+ function writeShadowHomeOwnerMarker(shadowDir) {
3792
+ try {
3793
+ writeFileSync(
3794
+ join(shadowDir, SHADOW_HOME_OWNER_FILE),
3795
+ JSON.stringify({ pid: process.pid, createdAt: Date.now() }),
3796
+ { mode: 0o600 },
3797
+ );
3798
+ } catch {
3799
+ // Best-effort only; a missing marker just defers reaping to the age rule.
3800
+ }
3801
+ }
3802
+
3803
+ // Once the forwarded child exists it is recorded alongside the wrapper PID: a
3804
+ // wrapper that dies ungracefully (SIGKILL cannot be relayed) leaves a marker
3805
+ // whose wrapper PID is dead while the child may still be running against the
3806
+ // shadow home. Only markers this process wrote are updated — a foreign or
3807
+ // leaked marker is left for the sweep's own rules.
3808
+ function recordShadowHomeChildPid(shadowDir, childPid) {
3809
+ if (typeof shadowDir !== "string" || shadowDir.trim().length === 0) {
3810
+ return;
3811
+ }
3812
+ if (typeof childPid !== "number" || !Number.isFinite(childPid)) {
3813
+ return;
3814
+ }
3815
+ try {
3816
+ const ownerPath = join(shadowDir, SHADOW_HOME_OWNER_FILE);
3817
+ if (!existsSync(ownerPath)) {
3818
+ return;
3819
+ }
3820
+ const owner = JSON.parse(readFileSync(ownerPath, "utf8"));
3821
+ if (owner?.pid !== process.pid) {
3822
+ return;
3823
+ }
3824
+ writeFileSync(
3825
+ ownerPath,
3826
+ JSON.stringify({
3827
+ ...owner,
3828
+ childPid,
3829
+ childRecordedAt: Date.now(),
3830
+ }),
3831
+ { mode: 0o600 },
3832
+ );
3833
+ } catch {
3834
+ // Best-effort only; a missing child record just shortens retention.
3835
+ }
3836
+ }
3837
+
3838
+ function isShadowHomeStale(shadowDir, probeStartTime) {
3839
+ const ownerPath = join(shadowDir, SHADOW_HOME_OWNER_FILE);
3840
+ if (existsSync(ownerPath)) {
3841
+ try {
3842
+ const owner = JSON.parse(readFileSync(ownerPath, "utf8"));
3843
+ if (typeof owner?.pid === "number" && Number.isFinite(owner.pid)) {
3844
+ const recordedProcessAlive = (pid, recordedAt) => {
3845
+ if (typeof pid !== "number" || !Number.isFinite(pid)) {
3846
+ return false;
3847
+ }
3848
+ if (!isProcessAlive(pid)) {
3849
+ return false;
3850
+ }
3851
+ if (
3852
+ typeof recordedAt !== "number" ||
3853
+ !Number.isFinite(recordedAt)
3854
+ ) {
3855
+ // No marker timestamp to check identity against — bare liveness.
3856
+ return true;
3857
+ }
3858
+ const actualStartTimeMs = probeStartTime(pid);
3859
+ if (actualStartTimeMs === null || actualStartTimeMs === undefined) {
3860
+ // Identity unknowable (Windows, no ps, probe budget spent) —
3861
+ // retaining a maybe-live home beats reaping a live one.
3862
+ return true;
3863
+ }
3864
+ return actualStartTimeMs <= recordedAt + SHADOW_HOME_OWNER_SKEW_MS;
3865
+ };
3866
+ if (recordedProcessAlive(owner.pid, owner.createdAt)) {
3867
+ return false;
3868
+ }
3869
+ // The wrapper that owned this home is gone, but a killed wrapper
3870
+ // can leave its forwarded child running against the shadow home;
3871
+ // the home is only orphaned once the child is gone too.
3872
+ if (
3873
+ recordedProcessAlive(
3874
+ owner.childPid,
3875
+ owner.childRecordedAt ?? owner.createdAt,
3876
+ )
3877
+ ) {
3878
+ return false;
3879
+ }
3880
+ return true;
3881
+ }
3882
+ } catch {
3883
+ // Corrupt marker — fall through to the age rule.
3884
+ }
3885
+ }
3886
+ try {
3887
+ return Date.now() - statSync(shadowDir).mtimeMs > STALE_SHADOW_HOME_AGE_MS;
3888
+ } catch {
3889
+ return false;
3890
+ }
3891
+ }
3892
+
3893
+ function sweepStaleShadowHomes(baseEnv) {
3894
+ if (staleShadowHomeSweepDone) {
3895
+ return;
3896
+ }
3897
+ staleShadowHomeSweepDone = true;
3898
+ const candidates = [
3899
+ {
3900
+ root: join(
3901
+ resolveCodexHomeDir(baseEnv),
3902
+ "multi-auth",
3903
+ "runtime-shadow-homes",
3904
+ ),
3905
+ prefix: "codex-multi-auth-runtime-home-",
3906
+ },
3907
+ { root: tmpdir(), prefix: "codex-multi-auth-home-" },
3908
+ ];
3909
+ // Identity probes are memoized per PID and bounded: at most a handful of
3910
+ // `ps` spawns run per launch, and only for markers whose PID is still live —
3911
+ // dead-PID markers, the common case after a crash, never probe at all.
3912
+ const probedStartTimes = new Map();
3913
+ let probeBudget = 20;
3914
+ const probeStartTime = (pid) => {
3915
+ if (probedStartTimes.has(pid)) {
3916
+ return probedStartTimes.get(pid);
3917
+ }
3918
+ if (probeBudget <= 0) {
3919
+ return undefined;
3920
+ }
3921
+ probeBudget -= 1;
3922
+ const startTime = readProcessStartTimeMs(pid);
3923
+ probedStartTimes.set(pid, startTime);
3924
+ return startTime;
3925
+ };
3926
+ for (const { root, prefix } of candidates) {
3927
+ let entries;
3928
+ try {
3929
+ entries = readdirSync(root, { withFileTypes: true });
3930
+ } catch {
3931
+ continue;
3932
+ }
3933
+ for (const entry of entries) {
3934
+ if (!entry.isDirectory() || !entry.name.startsWith(prefix)) {
3935
+ continue;
3936
+ }
3937
+ const shadowDir = join(root, entry.name);
3938
+ if (!isShadowHomeStale(shadowDir, probeStartTime)) {
3939
+ continue;
3940
+ }
3941
+ try {
3942
+ removeDirectoryWithRetry(shadowDir);
3943
+ } catch {
3944
+ // Best-effort sweep; a busy shadow is retried on the next launch.
3945
+ }
3946
+ }
3947
+ }
3948
+ }
3949
+
3674
3950
  function createRuntimeRotationShadowHome(originalCodexHome) {
3675
3951
  const shadowRoot = join(
3676
3952
  originalCodexHome,
@@ -3678,7 +3954,11 @@ function createRuntimeRotationShadowHome(originalCodexHome) {
3678
3954
  "runtime-shadow-homes",
3679
3955
  );
3680
3956
  mkdirSync(shadowRoot, { recursive: true });
3681
- return mkdtempSync(join(shadowRoot, "codex-multi-auth-runtime-home-"));
3957
+ const shadowDir = mkdtempSync(
3958
+ join(shadowRoot, "codex-multi-auth-runtime-home-"),
3959
+ );
3960
+ writeShadowHomeOwnerMarker(shadowDir);
3961
+ return shadowDir;
3682
3962
  }
3683
3963
 
3684
3964
  function parseHookStateTableKey(line) {
@@ -5927,6 +6207,7 @@ function createCompatibilityCodexHome(
5927
6207
  }
5928
6208
 
5929
6209
  const shadowCodexHome = mkdtempSync(join(tmpdir(), "codex-multi-auth-home-"));
6210
+ writeShadowHomeOwnerMarker(shadowCodexHome);
5930
6211
  let syncShadowHomeStateBack = () => {};
5931
6212
  const cleanup = () => {
5932
6213
  try {
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: codex-auth-setup
3
+ description: Install or refresh codex-multi-auth for the official Codex CLI, run first login, and verify account health and routing.
4
+ ---
5
+
6
+ # codex-auth-setup
7
+
8
+ Use this skill when the user wants to install, reinstall, upgrade, or troubleshoot `codex-multi-auth` for the official `@openai/codex` CLI.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm i -g @openai/codex
14
+ npm i -g codex-multi-auth
15
+ ```
16
+
17
+ If the old scoped prerelease package is still installed:
18
+
19
+ ```bash
20
+ npm uninstall -g @ndycode/codex-multi-auth
21
+ npm i -g codex-multi-auth
22
+ ```
23
+
24
+ ## First login
25
+
26
+ ```bash
27
+ codex-multi-auth login
28
+ ```
29
+
30
+ Default flow:
31
+
32
+ 1. Open the account menu.
33
+ 2. Choose the browser-first OAuth path.
34
+ 3. Complete the official OAuth flow.
35
+ 4. Return to the terminal and confirm the account was saved.
36
+
37
+ ## Verify health and routing
38
+
39
+ ```bash
40
+ codex-multi-auth status
41
+ codex-multi-auth list
42
+ codex-multi-auth check
43
+ codex-multi-auth forecast --live
44
+ ```
45
+
46
+ Use these next when managing multiple accounts:
47
+
48
+ ```bash
49
+ codex-multi-auth switch 2
50
+ codex-multi-auth verify-flagged
51
+ codex-multi-auth doctor --fix
52
+ ```
53
+
54
+ ## Alternate login paths
55
+
56
+ Use these when browser launch is blocked or the shell is headless:
57
+
58
+ ```bash
59
+ codex-multi-auth login --manual
60
+ CODEX_AUTH_NO_BROWSER=1 codex-multi-auth login
61
+ ```
62
+
63
+ ## Troubleshooting
64
+
65
+ - Run `where codex-multi-auth` if `codex-multi-auth` is not recognized.
66
+ - Free port `1455` and retry if the OAuth callback server cannot bind.
67
+ - Re-run `codex-multi-auth login` if the active account is stale or the wrong account was selected.
68
+ - Use `codex-multi-auth doctor --fix` followed by `codex-multi-auth check` for a fast recovery loop.
69
+ - See `docs/getting-started.md`, `docs/configuration.md`, `docs/troubleshooting.md`, and `docs/reference/commands.md` for the full command and config docs.
70
+
71
+ ## Usage boundaries
72
+
73
+ This project is for personal development use. For production or commercial workloads, use the OpenAI Platform API.