codex-multi-auth 2.15.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/README.md +22 -1
  3. package/config/README.md +2 -2
  4. package/config/codex-legacy.json +109 -184
  5. package/config/codex-modern.json +44 -114
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +10 -4
  8. package/dist/lib/account-policy.d.ts +4 -0
  9. package/dist/lib/account-policy.d.ts.map +1 -1
  10. package/dist/lib/account-policy.js +8 -0
  11. package/dist/lib/accounts/rate-limits.d.ts.map +1 -1
  12. package/dist/lib/accounts/rate-limits.js +2 -0
  13. package/dist/lib/accounts.d.ts +21 -3
  14. package/dist/lib/accounts.d.ts.map +1 -1
  15. package/dist/lib/accounts.js +229 -17
  16. package/dist/lib/api-route-store.d.ts +24 -0
  17. package/dist/lib/api-route-store.d.ts.map +1 -0
  18. package/dist/lib/api-route-store.js +145 -0
  19. package/dist/lib/auth/account-access.d.ts +115 -0
  20. package/dist/lib/auth/account-access.d.ts.map +1 -0
  21. package/dist/lib/auth/account-access.js +214 -0
  22. package/dist/lib/auth/token-utils.d.ts +54 -1
  23. package/dist/lib/auth/token-utils.d.ts.map +1 -1
  24. package/dist/lib/auth/token-utils.js +92 -7
  25. package/dist/lib/cli.d.ts +1 -1
  26. package/dist/lib/cli.d.ts.map +1 -1
  27. package/dist/lib/cli.js +4 -0
  28. package/dist/lib/codex-cli/state.d.ts +7 -0
  29. package/dist/lib/codex-cli/state.d.ts.map +1 -1
  30. package/dist/lib/codex-cli/state.js +18 -0
  31. package/dist/lib/codex-cli/writer.d.ts.map +1 -1
  32. package/dist/lib/codex-cli/writer.js +60 -8
  33. package/dist/lib/codex-manager/account-manager-commands.d.ts.map +1 -1
  34. package/dist/lib/codex-manager/account-manager-commands.js +1 -0
  35. package/dist/lib/codex-manager/account-pool-write.d.ts +3 -1
  36. package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
  37. package/dist/lib/codex-manager/account-pool-write.js +4 -0
  38. package/dist/lib/codex-manager/api-login-menu.d.ts +14 -0
  39. package/dist/lib/codex-manager/api-login-menu.d.ts.map +1 -0
  40. package/dist/lib/codex-manager/api-login-menu.js +224 -0
  41. package/dist/lib/codex-manager/commands/account.d.ts.map +1 -1
  42. package/dist/lib/codex-manager/commands/account.js +27 -0
  43. package/dist/lib/codex-manager/commands/best.d.ts.map +1 -1
  44. package/dist/lib/codex-manager/commands/best.js +6 -2
  45. package/dist/lib/codex-manager/commands/check.d.ts +7 -1
  46. package/dist/lib/codex-manager/commands/check.d.ts.map +1 -1
  47. package/dist/lib/codex-manager/commands/check.js +24 -3
  48. package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -1
  49. package/dist/lib/codex-manager/commands/forecast.js +5 -1
  50. package/dist/lib/codex-manager/commands/report.d.ts.map +1 -1
  51. package/dist/lib/codex-manager/commands/report.js +5 -1
  52. package/dist/lib/codex-manager/commands/resets.d.ts +2 -0
  53. package/dist/lib/codex-manager/commands/resets.d.ts.map +1 -0
  54. package/dist/lib/codex-manager/commands/resets.js +67 -0
  55. package/dist/lib/codex-manager/commands/rotation.d.ts +2 -2
  56. package/dist/lib/codex-manager/commands/rotation.d.ts.map +1 -1
  57. package/dist/lib/codex-manager/commands/rotation.js +63 -12
  58. package/dist/lib/codex-manager/commands/status.d.ts +12 -1
  59. package/dist/lib/codex-manager/commands/status.d.ts.map +1 -1
  60. package/dist/lib/codex-manager/commands/status.js +166 -22
  61. package/dist/lib/codex-manager/commands/uninstall.js +1 -1
  62. package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -1
  63. package/dist/lib/codex-manager/formatters/quota-formatters.js +3 -2
  64. package/dist/lib/codex-manager/health-check.d.ts +3 -0
  65. package/dist/lib/codex-manager/health-check.d.ts.map +1 -1
  66. package/dist/lib/codex-manager/health-check.js +56 -6
  67. package/dist/lib/codex-manager/help.d.ts.map +1 -1
  68. package/dist/lib/codex-manager/help.js +4 -2
  69. package/dist/lib/codex-manager/login-flow.d.ts.map +1 -1
  70. package/dist/lib/codex-manager/login-flow.js +69 -7
  71. package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -1
  72. package/dist/lib/codex-manager/login-menu-data.js +14 -5
  73. package/dist/lib/codex-manager/login-oauth.d.ts +3 -0
  74. package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -1
  75. package/dist/lib/codex-manager/login-oauth.js +6 -1
  76. package/dist/lib/codex-manager/login-workspace-choice.d.ts +11 -0
  77. package/dist/lib/codex-manager/login-workspace-choice.d.ts.map +1 -0
  78. package/dist/lib/codex-manager/login-workspace-choice.js +37 -0
  79. package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -1
  80. package/dist/lib/codex-manager/persist-selected-account.js +2 -1
  81. package/dist/lib/codex-manager/repair-commands.d.ts +13 -0
  82. package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -1
  83. package/dist/lib/codex-manager/repair-commands.js +143 -8
  84. package/dist/lib/codex-manager.d.ts.map +1 -1
  85. package/dist/lib/codex-manager.js +25 -6
  86. package/dist/lib/concurrency.d.ts +3 -0
  87. package/dist/lib/concurrency.d.ts.map +1 -0
  88. package/dist/lib/concurrency.js +31 -0
  89. package/dist/lib/context-budget/model-context-windows.d.ts +1 -1
  90. package/dist/lib/context-budget/model-context-windows.d.ts.map +1 -1
  91. package/dist/lib/context-budget/model-context-windows.js +9 -10
  92. package/dist/lib/model-route-policy.d.ts +52 -0
  93. package/dist/lib/model-route-policy.d.ts.map +1 -0
  94. package/dist/lib/model-route-policy.js +159 -0
  95. package/dist/lib/policy/runtime-policy.d.ts +1 -0
  96. package/dist/lib/policy/runtime-policy.d.ts.map +1 -1
  97. package/dist/lib/policy/runtime-policy.js +3 -0
  98. package/dist/lib/preemptive-quota-scheduler.d.ts +2 -0
  99. package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -1
  100. package/dist/lib/preemptive-quota-scheduler.js +4 -0
  101. package/dist/lib/prompts/codex.d.ts.map +1 -1
  102. package/dist/lib/prompts/codex.js +3 -1
  103. package/dist/lib/quota-probe.d.ts +5 -0
  104. package/dist/lib/quota-probe.d.ts.map +1 -1
  105. package/dist/lib/quota-probe.js +26 -2
  106. package/dist/lib/request/client-cancellation.d.ts +5 -0
  107. package/dist/lib/request/client-cancellation.d.ts.map +1 -0
  108. package/dist/lib/request/client-cancellation.js +7 -0
  109. package/dist/lib/request/error-classification.d.ts.map +1 -1
  110. package/dist/lib/request/error-classification.js +39 -25
  111. package/dist/lib/request/fetch-helpers.js +1 -1
  112. package/dist/lib/request/helpers/model-map.d.ts +12 -2
  113. package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
  114. package/dist/lib/request/helpers/model-map.js +174 -147
  115. package/dist/lib/request/response-outcome.d.ts +25 -0
  116. package/dist/lib/request/response-outcome.d.ts.map +1 -0
  117. package/dist/lib/request/response-outcome.js +49 -0
  118. package/dist/lib/request/stream-failover-runtime.d.ts +2 -1
  119. package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -1
  120. package/dist/lib/request/stream-failover-runtime.js +29 -10
  121. package/dist/lib/runtime/account-check.d.ts.map +1 -1
  122. package/dist/lib/runtime/account-check.js +2 -8
  123. package/dist/lib/runtime/account-model-catalog.d.ts +64 -0
  124. package/dist/lib/runtime/account-model-catalog.d.ts.map +1 -0
  125. package/dist/lib/runtime/account-model-catalog.js +154 -0
  126. package/dist/lib/runtime/account-pool.d.ts +3 -1
  127. package/dist/lib/runtime/account-pool.d.ts.map +1 -1
  128. package/dist/lib/runtime/account-pool.js +4 -0
  129. package/dist/lib/runtime/account-reset-credits.d.ts +42 -0
  130. package/dist/lib/runtime/account-reset-credits.d.ts.map +1 -0
  131. package/dist/lib/runtime/account-reset-credits.js +82 -0
  132. package/dist/lib/runtime/api-model-capabilities.d.ts +30 -0
  133. package/dist/lib/runtime/api-model-capabilities.d.ts.map +1 -0
  134. package/dist/lib/runtime/api-model-capabilities.js +434 -0
  135. package/dist/lib/runtime/api-model-runtime.d.ts +42 -0
  136. package/dist/lib/runtime/api-model-runtime.d.ts.map +1 -0
  137. package/dist/lib/runtime/api-model-runtime.js +358 -0
  138. package/dist/lib/runtime/app-bind.d.ts +19 -1
  139. package/dist/lib/runtime/app-bind.d.ts.map +1 -1
  140. package/dist/lib/runtime/app-bind.js +79 -9
  141. package/dist/lib/runtime/automatic-account-checks.d.ts +31 -0
  142. package/dist/lib/runtime/automatic-account-checks.d.ts.map +1 -0
  143. package/dist/lib/runtime/automatic-account-checks.js +113 -0
  144. package/dist/lib/runtime/automatic-subscription-checks.d.ts +7 -0
  145. package/dist/lib/runtime/automatic-subscription-checks.d.ts.map +1 -0
  146. package/dist/lib/runtime/automatic-subscription-checks.js +57 -0
  147. package/dist/lib/runtime/catalog-capabilities.d.ts +8 -0
  148. package/dist/lib/runtime/catalog-capabilities.d.ts.map +1 -0
  149. package/dist/lib/runtime/catalog-capabilities.js +61 -0
  150. package/dist/lib/runtime/inference-activity.d.ts +15 -0
  151. package/dist/lib/runtime/inference-activity.d.ts.map +1 -0
  152. package/dist/lib/runtime/inference-activity.js +95 -0
  153. package/dist/lib/runtime/model-discovery-status.d.ts +100 -0
  154. package/dist/lib/runtime/model-discovery-status.d.ts.map +1 -0
  155. package/dist/lib/runtime/model-discovery-status.js +387 -0
  156. package/dist/lib/runtime/native-account-storage.d.ts +11 -0
  157. package/dist/lib/runtime/native-account-storage.d.ts.map +1 -0
  158. package/dist/lib/runtime/native-account-storage.js +50 -0
  159. package/dist/lib/runtime/native-account-sync.d.ts +19 -0
  160. package/dist/lib/runtime/native-account-sync.d.ts.map +1 -0
  161. package/dist/lib/runtime/native-account-sync.js +62 -0
  162. package/dist/lib/runtime/native-binding-lock.d.ts +3 -0
  163. package/dist/lib/runtime/native-binding-lock.d.ts.map +1 -0
  164. package/dist/lib/runtime/native-binding-lock.js +5 -0
  165. package/dist/lib/runtime/native-client-auth.d.ts +3 -0
  166. package/dist/lib/runtime/native-client-auth.d.ts.map +1 -0
  167. package/dist/lib/runtime/native-client-auth.js +42 -0
  168. package/dist/lib/runtime/native-provider-config.d.ts +4 -0
  169. package/dist/lib/runtime/native-provider-config.d.ts.map +1 -0
  170. package/dist/lib/runtime/native-provider-config.js +52 -0
  171. package/dist/lib/runtime/native-rate-limits.d.ts +18 -0
  172. package/dist/lib/runtime/native-rate-limits.d.ts.map +1 -0
  173. package/dist/lib/runtime/native-rate-limits.js +135 -0
  174. package/dist/lib/runtime/reset-credit-routing.d.ts +41 -0
  175. package/dist/lib/runtime/reset-credit-routing.d.ts.map +1 -0
  176. package/dist/lib/runtime/reset-credit-routing.js +66 -0
  177. package/dist/lib/runtime/reset-credits.d.ts +101 -0
  178. package/dist/lib/runtime/reset-credits.d.ts.map +1 -0
  179. package/dist/lib/runtime/reset-credits.js +162 -0
  180. package/dist/lib/runtime/response-output-history.d.ts +17 -0
  181. package/dist/lib/runtime/response-output-history.d.ts.map +1 -0
  182. package/dist/lib/runtime/response-output-history.js +85 -0
  183. package/dist/lib/runtime/responses-websocket.d.ts +31 -0
  184. package/dist/lib/runtime/responses-websocket.d.ts.map +1 -0
  185. package/dist/lib/runtime/responses-websocket.js +636 -0
  186. package/dist/lib/runtime/resume-picker.d.ts +41 -0
  187. package/dist/lib/runtime/resume-picker.d.ts.map +1 -0
  188. package/dist/lib/runtime/resume-picker.js +169 -0
  189. package/dist/lib/runtime/rotation-account-selection.d.ts +6 -0
  190. package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -1
  191. package/dist/lib/runtime/rotation-account-selection.js +63 -0
  192. package/dist/lib/runtime/rotation-proxy-state.d.ts +33 -0
  193. package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -1
  194. package/dist/lib/runtime/rotation-server-types.d.ts +18 -0
  195. package/dist/lib/runtime/rotation-server-types.d.ts.map +1 -1
  196. package/dist/lib/runtime/runtime-capability-failures.d.ts +14 -0
  197. package/dist/lib/runtime/runtime-capability-failures.d.ts.map +1 -0
  198. package/dist/lib/runtime/runtime-capability-failures.js +76 -0
  199. package/dist/lib/runtime/runtime-observability.d.ts +7 -0
  200. package/dist/lib/runtime/runtime-observability.d.ts.map +1 -1
  201. package/dist/lib/runtime/runtime-observability.js +42 -2
  202. package/dist/lib/runtime/subscription-first-use.d.ts +10 -0
  203. package/dist/lib/runtime/subscription-first-use.d.ts.map +1 -0
  204. package/dist/lib/runtime/subscription-first-use.js +64 -0
  205. package/dist/lib/runtime/subscription-quota-event.d.ts +6 -0
  206. package/dist/lib/runtime/subscription-quota-event.d.ts.map +1 -0
  207. package/dist/lib/runtime/subscription-quota-event.js +31 -0
  208. package/dist/lib/runtime/subscription-quota-order.d.ts +17 -0
  209. package/dist/lib/runtime/subscription-quota-order.d.ts.map +1 -0
  210. package/dist/lib/runtime/subscription-quota-order.js +31 -0
  211. package/dist/lib/runtime/workspace-model-scopes.d.ts +15 -0
  212. package/dist/lib/runtime/workspace-model-scopes.d.ts.map +1 -0
  213. package/dist/lib/runtime/workspace-model-scopes.js +34 -0
  214. package/dist/lib/runtime-constants.d.ts +3 -0
  215. package/dist/lib/runtime-constants.d.ts.map +1 -1
  216. package/dist/lib/runtime-constants.js +5 -0
  217. package/dist/lib/runtime-paths.d.ts.map +1 -1
  218. package/dist/lib/runtime-paths.js +4 -1
  219. package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
  220. package/dist/lib/runtime-rotation-proxy.js +855 -46
  221. package/dist/lib/schemas.d.ts +20 -0
  222. package/dist/lib/schemas.d.ts.map +1 -1
  223. package/dist/lib/schemas.js +3 -0
  224. package/dist/lib/storage/credential-sidecars.d.ts +13 -0
  225. package/dist/lib/storage/credential-sidecars.d.ts.map +1 -0
  226. package/dist/lib/storage/credential-sidecars.js +52 -0
  227. package/dist/lib/storage/file-lock.d.ts +9 -0
  228. package/dist/lib/storage/file-lock.d.ts.map +1 -0
  229. package/dist/lib/storage/file-lock.js +186 -0
  230. package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
  231. package/dist/lib/storage/flagged-storage.js +12 -0
  232. package/dist/lib/storage/path-state.d.ts +2 -0
  233. package/dist/lib/storage/path-state.d.ts.map +1 -1
  234. package/dist/lib/storage/path-state.js +9 -0
  235. package/dist/lib/storage/paths.js +4 -4
  236. package/dist/lib/storage/pending-auth.d.ts +17 -0
  237. package/dist/lib/storage/pending-auth.d.ts.map +1 -0
  238. package/dist/lib/storage/pending-auth.js +153 -0
  239. package/dist/lib/storage/public-types.d.ts +13 -0
  240. package/dist/lib/storage/public-types.d.ts.map +1 -1
  241. package/dist/lib/storage/snapshot-merge.d.ts +16 -0
  242. package/dist/lib/storage/snapshot-merge.d.ts.map +1 -0
  243. package/dist/lib/storage/snapshot-merge.js +206 -0
  244. package/dist/lib/storage/transactions.d.ts.map +1 -1
  245. package/dist/lib/storage/transactions.js +5 -4
  246. package/dist/lib/storage.d.ts +6 -0
  247. package/dist/lib/storage.d.ts.map +1 -1
  248. package/dist/lib/storage.js +77 -7
  249. package/dist/lib/ui/auth-menu-builder.d.ts +2 -0
  250. package/dist/lib/ui/auth-menu-builder.d.ts.map +1 -1
  251. package/dist/lib/ui/auth-menu-builder.js +1 -0
  252. package/dist/lib/ui/auth-menu.d.ts.map +1 -1
  253. package/dist/lib/ui/auth-menu.js +1 -0
  254. package/dist/lib/ui/check-progress.d.ts +8 -0
  255. package/dist/lib/ui/check-progress.d.ts.map +1 -0
  256. package/dist/lib/ui/check-progress.js +30 -0
  257. package/dist/lib/ui/format.d.ts +3 -1
  258. package/dist/lib/ui/format.d.ts.map +1 -1
  259. package/dist/lib/ui/format.js +8 -0
  260. package/dist/lib/ui/ui-copy.d.ts +2 -2
  261. package/dist/lib/ui/ui-copy.js +2 -2
  262. package/dist/lib/usage/pricing.d.ts +19 -2
  263. package/dist/lib/usage/pricing.d.ts.map +1 -1
  264. package/dist/lib/usage/pricing.js +101 -40
  265. package/dist/lib/usage/usage-extraction.d.ts +3 -1
  266. package/dist/lib/usage/usage-extraction.d.ts.map +1 -1
  267. package/dist/lib/usage/usage-extraction.js +46 -9
  268. package/package.json +7 -4
  269. package/scripts/codex-app-router.js +7 -0
  270. package/scripts/codex-bin-resolver.js +40 -8
  271. package/scripts/codex-routing.js +1 -0
  272. package/scripts/codex.js +209 -126
package/scripts/codex.js CHANGED
@@ -26,7 +26,9 @@ 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
+ isWindowsShimPath,
29
30
  resolveRealCodexBin as resolveRealCodexBinFromEnvironment,
31
+ resolveWindowsShimPackageEntry,
30
32
  splitPathEntries,
31
33
  } from "./codex-bin-resolver.js";
32
34
  import { normalizeAuthAlias, shouldHandleMultiAuthAuth } from "./codex-routing.js";
@@ -686,15 +688,15 @@ function resolveModelFamilyForStatus(model) {
686
688
  return "gpt-5.2";
687
689
  }
688
690
  if (normalized.includes("daybreak")) return "gpt-5.2";
689
- // GPT-5.6 general tiers share the gpt-5.2 prompt family (see
690
- // lib/request/helpers/model-map.ts MODEL_PROFILES). Check before the generic
691
- // gpt-5 catch-all, which would otherwise mis-bucket them as codex.
692
- if (normalized.startsWith("gpt-5.6")) return "gpt-5.2";
693
- if (normalized.startsWith("gpt-5.2")) return "gpt-5.2";
694
- if (normalized.startsWith("gpt-5.1")) return "gpt-5.1";
695
- if (normalized.includes("codex-max")) return "codex-max";
696
- if (normalized.includes("codex")) return "codex";
697
- if (normalized.startsWith("gpt-5")) return "gpt-5-codex";
691
+ // The proxy keys a /codex/responses request by `getModelFamily(model)`
692
+ // (lib/runtime-rotation-proxy.ts), i.e. the replacement's prompt family.
693
+ // Every codex model is retired and runs on `gpt-5.6-sol`/`terra`, and every
694
+ // live or retired general GPT-5 id runs on a model in the gpt-5.2 family, so
695
+ // status reads that family. The old `codex`/`codex-max`/`gpt-5.1`/
696
+ // `gpt-5-codex` answers named keys the proxy does not write for these ids.
697
+ if (normalized.includes("codex") || normalized.startsWith("gpt-5")) {
698
+ return "gpt-5.2";
699
+ }
698
700
  return null;
699
701
  }
700
702
 
@@ -1350,6 +1352,17 @@ function resolveRealCodexBin() {
1350
1352
  );
1351
1353
  return null;
1352
1354
  }
1355
+ if (
1356
+ process.platform === "win32" &&
1357
+ isWindowsShimPath(override) &&
1358
+ !resolveWindowsShimPackageEntry(override)
1359
+ ) {
1360
+ console.error(
1361
+ `CODEX_MULTI_AUTH_REAL_CODEX_BIN points at a script shim that cannot be launched directly on Windows: ${override}\n` +
1362
+ "Point it at codex.exe or @openai/codex/bin/codex.js instead.",
1363
+ );
1364
+ return null;
1365
+ }
1353
1366
  return resolveRealCodexBinFromEnvironment({
1354
1367
  moduleUrl: import.meta.url,
1355
1368
  env: process.env,
@@ -1368,8 +1381,36 @@ const MODEL_ACCESS_DENIED_PATTERN =
1368
1381
  /the model [`'"]([^`'"]+)[`'"] does not exist or you do not have access to it/i;
1369
1382
  const DIRECT_UNSUPPORTED_MODEL_PATTERN =
1370
1383
  /['"]([^'"]+)['"]\s+model is not supported when using codex with a chatgpt account/i;
1371
- const CURRENT_CODEX_MODEL = "gpt-5.3-codex";
1372
- const LEGACY_CODEX_MODEL = "gpt-5-codex";
1384
+ // Every codex model is retired; codex ids run on the replacement OpenAI names
1385
+ // for them. Mirrors lib/request/helpers/model-map.ts CURRENT_CODEX_MODEL and
1386
+ // RETIRED_MODEL_REPLACEMENTS, pinned in parity by test/retired-models.test.ts.
1387
+ const CURRENT_CODEX_MODEL = "gpt-5.6-sol";
1388
+ const CODEX_MINI_REPLACEMENT_MODEL = "gpt-5.6-terra";
1389
+ const RETIRED_MODEL_REPLACEMENTS = {
1390
+ "gpt-5.4": "gpt-6-sol",
1391
+ "gpt-5.4-mini": "gpt-6-luna",
1392
+ "gpt-5.4-nano": "gpt-6-luna",
1393
+ "gpt-5.4-pro": "gpt-5.5-pro",
1394
+ "gpt-5.2": "gpt-5.6-sol",
1395
+ "gpt-5.2-pro": "gpt-5.5-pro",
1396
+ "gpt-5.1": "gpt-5.6-sol",
1397
+ "gpt-5-mini": "gpt-5.6-terra",
1398
+ "gpt-5-nano": "gpt-5.6-luna",
1399
+ "gpt-5-chat-latest": "gpt-5.6-sol",
1400
+ "gpt-5.1-chat-latest": "gpt-5.6-sol",
1401
+ "gpt-5.2-chat-latest": "gpt-5.6-sol",
1402
+ "gpt-5.3-chat-latest": "gpt-5.6-sol",
1403
+ "gpt-5.3-codex": CURRENT_CODEX_MODEL,
1404
+ "gpt-5.3-codex-spark": CURRENT_CODEX_MODEL,
1405
+ "gpt-5.2-codex": CURRENT_CODEX_MODEL,
1406
+ "gpt-5.1-codex": CURRENT_CODEX_MODEL,
1407
+ "gpt-5.1-codex-max": CURRENT_CODEX_MODEL,
1408
+ "gpt-5-codex": CURRENT_CODEX_MODEL,
1409
+ "codex-max": CURRENT_CODEX_MODEL,
1410
+ "gpt-5.1-codex-mini": CODEX_MINI_REPLACEMENT_MODEL,
1411
+ "gpt-5-codex-mini": CODEX_MINI_REPLACEMENT_MODEL,
1412
+ "codex-mini-latest": CODEX_MINI_REPLACEMENT_MODEL,
1413
+ };
1373
1414
  // Mirrors the GPT-6 rows of lib/request/error-classification.ts
1374
1415
  // `DEFAULT_UNSUPPORTED_CODEX_FALLBACK_CHAIN`. This table is walked differently
1375
1416
  // from lib's: `resolveUnsupportedModelRetryTarget` keys on the model named in
@@ -1381,25 +1422,25 @@ const LEGACY_CODEX_MODEL = "gpt-5-codex";
1381
1422
  const WRAPPER_UNSUPPORTED_MODEL_FALLBACK_CHAIN = {
1382
1423
  "gpt-6-astra": ["gpt-5.6-sol", "gpt-5.5"],
1383
1424
  "gpt-6-astra-aeon": ["gpt-6-astra", "gpt-5.6-sol"],
1425
+ "gpt-6-sol": ["gpt-5.6-sol"],
1426
+ "gpt-6-luna": ["gpt-5.6-luna"],
1384
1427
  "gpt-5.6-sol": ["gpt-5.5"],
1428
+ "gpt-5.6-luna": ["gpt-5.5"],
1429
+ "gpt-5.6-terra": ["gpt-5.5"],
1385
1430
  "gpt-5": ["gpt-5.5"],
1386
1431
  "gpt-5-pro": ["gpt-5.5-pro"],
1387
- "gpt-5-chat-latest": ["gpt-5.5"],
1388
- "gpt-5.5": ["gpt-5.4"],
1389
- "gpt-5.5-pro": ["gpt-5.4"],
1390
- "gpt-5.5-2026-04-23": ["gpt-5.4"],
1391
- "gpt-5.5-pro-2026-04-23": ["gpt-5.4"],
1392
- "gpt-5.5-20260423": ["gpt-5.4"],
1393
- "gpt-5.5-pro-20260423": ["gpt-5.4"],
1394
- "gpt-5.3-codex-spark": [CURRENT_CODEX_MODEL],
1395
- "codex-max": [CURRENT_CODEX_MODEL],
1396
- "gpt-5.1-codex-max": [CURRENT_CODEX_MODEL],
1397
- "codex-mini-latest": [CURRENT_CODEX_MODEL],
1398
- "gpt-5-codex-mini": [CURRENT_CODEX_MODEL],
1399
- "gpt-5.1-codex-mini": [CURRENT_CODEX_MODEL],
1400
- [LEGACY_CODEX_MODEL]: [CURRENT_CODEX_MODEL],
1401
- "gpt-5.2-codex": [CURRENT_CODEX_MODEL],
1402
- "gpt-5.1-codex": [CURRENT_CODEX_MODEL],
1432
+ "gpt-5.5-2026-04-23": ["gpt-5.5"],
1433
+ "gpt-5.5-20260423": ["gpt-5.5"],
1434
+ "gpt-5.5-pro-2026-04-23": ["gpt-5.5-pro"],
1435
+ "gpt-5.5-pro-20260423": ["gpt-5.5-pro"],
1436
+ // `gpt-5.5`/`gpt-5.5-pro` are the floor; `gpt-5.4` is retired. A retired id
1437
+ // steps once to its replacement.
1438
+ ...Object.fromEntries(
1439
+ Object.entries(RETIRED_MODEL_REPLACEMENTS).map(([retired, replacement]) => [
1440
+ retired,
1441
+ [replacement],
1442
+ ]),
1443
+ ),
1403
1444
  };
1404
1445
 
1405
1446
  function canonicalizeRequestedModelName(model) {
@@ -2022,9 +2063,10 @@ function hasCliAuthCredentialsStoreOverride(args) {
2022
2063
  // and its GPT-5 normalization helpers.
2023
2064
  // This wrapper runs before the TypeScript build, so it cannot import that source.
2024
2065
  const SUPPORTED_REASONING_EFFORTS_BY_MODEL = {
2025
- [CURRENT_CODEX_MODEL]: ["low", "medium", "high", "xhigh"],
2026
2066
  "gpt-6-astra": ["low", "medium", "high", "xhigh", "max", "ultra"],
2027
2067
  "gpt-6-astra-aeon": ["low", "medium", "high", "xhigh", "max", "ultra"],
2068
+ "gpt-6-sol": ["low", "medium", "high", "xhigh", "max", "ultra"],
2069
+ "gpt-6-luna": ["low", "medium", "high", "xhigh", "max"],
2028
2070
  "gpt-daybreak-blue-latest": ["low", "medium", "high", "xhigh", "max", "ultra"],
2029
2071
  "gpt-daybreak-red-latest": ["low", "medium", "high", "xhigh", "max", "ultra"],
2030
2072
  "gpt-5.6-sol": ["low", "medium", "high", "xhigh", "max", "ultra"],
@@ -2032,15 +2074,6 @@ const SUPPORTED_REASONING_EFFORTS_BY_MODEL = {
2032
2074
  "gpt-5.6-luna": ["low", "medium", "high", "xhigh", "max"],
2033
2075
  "gpt-5.5": ["none", "low", "medium", "high", "xhigh"],
2034
2076
  "gpt-5.5-pro": ["medium", "high", "xhigh"],
2035
- "gpt-5.4": ["none", "low", "medium", "high", "xhigh"],
2036
- "gpt-5.4-pro": ["medium", "high", "xhigh"],
2037
- "gpt-5.4-mini": ["medium"],
2038
- "gpt-5.4-nano": ["medium"],
2039
- "gpt-5.2-pro": ["medium", "high", "xhigh"],
2040
- "gpt-5.2": ["none", "low", "medium", "high", "xhigh"],
2041
- "gpt-5.1": ["none", "low", "medium", "high"],
2042
- "gpt-5-mini": ["medium"],
2043
- "gpt-5-nano": ["medium"],
2044
2077
  };
2045
2078
 
2046
2079
  const REASONING_FALLBACKS = {
@@ -2086,45 +2119,53 @@ const GPT_5_6_LUNA_MODEL = "gpt-5.6-luna";
2086
2119
  const GPT_5_6_FLAGSHIP_ALIAS = "gpt-5.6";
2087
2120
  const GPT_5_6_SOL_TERRA_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
2088
2121
  const GPT_5_6_LUNA_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
2089
- // GPT-6 Astra (2026-09-03). No Sol/Terra/Luna split this generation: the
2090
- // flagship plus `aeon`, a long-horizon variant. Same frontier effort ladder as
2091
- // 5.6 (no `none`/`minimal`, `ultra` at the top). Bare `gpt-6` -> flagship.
2122
+ // GPT-6 Astra (2026-09-03): the flagship plus `aeon`, a long-horizon variant.
2123
+ // Same frontier effort ladder as 5.6 (no `none`/`minimal`, `ultra` at the
2124
+ // top). Bare `gpt-6` -> flagship.
2092
2125
  const GPT_6_ASTRA_MODEL = "gpt-6-astra";
2093
2126
  const GPT_6_ASTRA_AEON_MODEL = "gpt-6-astra-aeon";
2094
2127
  const GPT_6_FLAGSHIP_ALIAS = "gpt-6";
2095
2128
  const GPT_6_ASTRA_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
2129
+ // GPT-6 Sol and Luna (upstream catalog, 2026-09-22). Sol reaches `ultra`, Luna
2130
+ // stops at `max`. No GPT-6 Terra. Mirrors lib/request/helpers/model-map.ts.
2131
+ const GPT_6_SOL_MODEL = "gpt-6-sol";
2132
+ const GPT_6_LUNA_MODEL = "gpt-6-luna";
2133
+ const GPT_6_SOL_EFFORTS = GPT_6_ASTRA_EFFORTS;
2134
+ const GPT_6_LUNA_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
2096
2135
  // Daybreak cyber models from the upstream Codex catalog. `red` is the
2097
2136
  // cyber-permissive variant, `blue` the defensive one.
2098
2137
  const DAYBREAK_BLUE_MODEL = "gpt-daybreak-blue-latest";
2099
2138
  const DAYBREAK_RED_MODEL = "gpt-daybreak-red-latest";
2100
2139
  const DAYBREAK_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
2140
+ // Retired minors map to the replacement OpenAI names for them. Mirrors lib.
2101
2141
  const GENERAL_GPT5_VERSION_CATALOG = {
2102
2142
  1: {
2103
- base: "gpt-5.1",
2143
+ base: GPT_5_6_SOL_MODEL,
2144
+ pro: GPT_5_5_PRO_CANONICAL_MODEL,
2104
2145
  },
2105
2146
  2: {
2106
- base: "gpt-5.2",
2107
- pro: "gpt-5.2-pro",
2147
+ base: GPT_5_6_SOL_MODEL,
2148
+ pro: GPT_5_5_PRO_CANONICAL_MODEL,
2108
2149
  },
2109
2150
  4: {
2110
- base: DEFAULT_GENERAL_GPT5_MODEL,
2111
- pro: "gpt-5.4-pro",
2112
- mini: "gpt-5.4-mini",
2113
- nano: "gpt-5.4-nano",
2151
+ base: GPT_6_SOL_MODEL,
2152
+ pro: GPT_5_5_PRO_CANONICAL_MODEL,
2153
+ mini: GPT_6_LUNA_MODEL,
2154
+ nano: GPT_6_LUNA_MODEL,
2114
2155
  },
2115
2156
  5: {
2116
2157
  base: GPT_5_5_CANONICAL_MODEL,
2117
2158
  pro: GPT_5_5_PRO_CANONICAL_MODEL,
2118
- mini: "gpt-5-mini",
2119
- nano: "gpt-5-nano",
2159
+ mini: GPT_5_6_TERRA_MODEL,
2160
+ nano: GPT_5_6_LUNA_MODEL,
2120
2161
  },
2121
2162
  };
2122
2163
  const GENERAL_GPT5_STABLE_VARIANTS = GENERAL_GPT5_VERSION_CATALOG[5];
2123
2164
  const GENERAL_GPT5_GENERIC_VARIANTS = {
2124
2165
  base: DEFAULT_GENERAL_GPT5_MODEL,
2125
2166
  pro: GPT_5_5_PRO_CANONICAL_MODEL,
2126
- mini: "gpt-5-mini",
2127
- nano: "gpt-5-nano",
2167
+ mini: GPT_5_6_TERRA_MODEL,
2168
+ nano: GPT_5_6_LUNA_MODEL,
2128
2169
  };
2129
2170
 
2130
2171
  function addRequestedModelAlias(alias, normalizedModel) {
@@ -2268,19 +2309,8 @@ function seedRequestedModelAliases() {
2268
2309
  GPT_5_5_PRO_RELEASE_COMPAT_MODEL,
2269
2310
  GPT_5_5_PRO_CANONICAL_MODEL,
2270
2311
  );
2271
- addRequestedModelReasoningAliases("gpt-5.4", "gpt-5.4");
2272
- addRequestedModelReasoningAliases("gpt-5.4-pro", "gpt-5.4-pro");
2273
- addRequestedModelReasoningAliases("gpt-5.4-mini", "gpt-5.4-mini");
2274
- addRequestedModelReasoningAliases("gpt-5.4-nano", "gpt-5.4-nano");
2275
- addRequestedModelReasoningAliases("gpt-5.2-pro", "gpt-5.2-pro");
2276
2312
  addRequestedModelReasoningAliases("gpt-5-pro", GPT_5_5_PRO_CANONICAL_MODEL);
2277
- addRequestedModelReasoningAliases("gpt-5.2", "gpt-5.2");
2278
- addRequestedModelReasoningAliases("gpt-5.1", "gpt-5.1");
2279
2313
  addRequestedModelReasoningAliases("gpt-5", DEFAULT_GENERAL_GPT5_MODEL);
2280
- addRequestedModelReasoningAliases("gpt-5-mini", "gpt-5-mini");
2281
- addRequestedModelReasoningAliases("gpt-5-nano", "gpt-5-nano");
2282
- addRequestedModelReasoningAliases("gpt-5.1-chat-latest", "gpt-5.1");
2283
- addRequestedModelReasoningAliases("gpt-5-chat-latest", DEFAULT_GENERAL_GPT5_MODEL);
2284
2314
  addRequestedModelEffortAliases(
2285
2315
  GPT_5_6_SOL_MODEL,
2286
2316
  GPT_5_6_SOL_MODEL,
@@ -2322,6 +2352,13 @@ function seedRequestedModelAliases() {
2322
2352
  GPT_6_ASTRA_AEON_MODEL,
2323
2353
  GPT_6_ASTRA_EFFORTS,
2324
2354
  );
2355
+ // No bare `sol`/`luna` aliases: those already mean the 5.6 tiers.
2356
+ addRequestedModelEffortAliases(GPT_6_SOL_MODEL, GPT_6_SOL_MODEL, GPT_6_SOL_EFFORTS);
2357
+ addRequestedModelEffortAliases(
2358
+ GPT_6_LUNA_MODEL,
2359
+ GPT_6_LUNA_MODEL,
2360
+ GPT_6_LUNA_EFFORTS,
2361
+ );
2325
2362
  addRequestedModelEffortAliases(
2326
2363
  DAYBREAK_BLUE_MODEL,
2327
2364
  DAYBREAK_BLUE_MODEL,
@@ -2342,17 +2379,10 @@ function seedRequestedModelAliases() {
2342
2379
  DAYBREAK_RED_MODEL,
2343
2380
  DAYBREAK_EFFORTS,
2344
2381
  );
2345
- addRequestedModelReasoningAliases(CURRENT_CODEX_MODEL, CURRENT_CODEX_MODEL);
2346
- addRequestedModelReasoningAliases("gpt-5.3-codex-spark", CURRENT_CODEX_MODEL);
2347
- addRequestedModelReasoningAliases(LEGACY_CODEX_MODEL, CURRENT_CODEX_MODEL);
2348
- addRequestedModelReasoningAliases("gpt-5.2-codex", CURRENT_CODEX_MODEL);
2349
- addRequestedModelReasoningAliases("gpt-5.1-codex", CURRENT_CODEX_MODEL);
2382
+ for (const [retired, replacement] of Object.entries(RETIRED_MODEL_REPLACEMENTS)) {
2383
+ addRequestedModelReasoningAliases(retired, replacement);
2384
+ }
2350
2385
  addRequestedModelAlias("gpt_5_codex", CURRENT_CODEX_MODEL);
2351
- addRequestedModelReasoningAliases("codex-max", CURRENT_CODEX_MODEL);
2352
- addRequestedModelReasoningAliases("gpt-5.1-codex-max", CURRENT_CODEX_MODEL);
2353
- addRequestedModelAlias("codex-mini-latest", CURRENT_CODEX_MODEL);
2354
- addRequestedModelReasoningAliases("gpt-5-codex-mini", CURRENT_CODEX_MODEL);
2355
- addRequestedModelReasoningAliases("gpt-5.1-codex-mini", CURRENT_CODEX_MODEL);
2356
2386
  }
2357
2387
 
2358
2388
  seedRequestedModelAliases();
@@ -2405,39 +2435,13 @@ function resolveStableGeneralGpt5Variant(variant) {
2405
2435
  // between the two, which is exactly what test/codex-model-resolution.test.ts
2406
2436
  // exists to prevent.
2407
2437
  function resolveCodexRequestedModel(normalized) {
2408
- if (
2409
- normalized.includes("gpt-5.1-codex-max") ||
2410
- normalized.includes("gpt 5.1 codex max") ||
2411
- normalized.includes("codex-max")
2412
- ) {
2413
- return CURRENT_CODEX_MODEL;
2438
+ // Every codex model is retired: a mini codex id goes to Terra, any other id
2439
+ // carrying `codex` to Sol. Mirrors lib resolveCodexCatalogModel.
2440
+ if (!normalized.includes("codex")) return "";
2441
+ if (/codex[- ]mini(?!mal)/.test(normalized)) {
2442
+ return CODEX_MINI_REPLACEMENT_MODEL;
2414
2443
  }
2415
- if (
2416
- normalized.includes("gpt-5.1-codex-mini") ||
2417
- normalized.includes("gpt 5.1 codex mini") ||
2418
- normalized.includes("gpt-5-codex-mini") ||
2419
- normalized.includes("gpt 5 codex mini") ||
2420
- normalized.includes("codex-mini-latest")
2421
- ) {
2422
- return CURRENT_CODEX_MODEL;
2423
- }
2424
- if (
2425
- normalized.includes("gpt-5.3-codex-spark") ||
2426
- normalized.includes("gpt 5.3 codex spark") ||
2427
- normalized.includes("gpt-5.3-codex") ||
2428
- normalized.includes("gpt 5.3 codex") ||
2429
- normalized.includes("gpt-5.2-codex") ||
2430
- normalized.includes("gpt 5.2 codex") ||
2431
- normalized.includes("gpt-5.1-codex") ||
2432
- normalized.includes("gpt 5.1 codex") ||
2433
- normalized.includes("gpt-5-codex") ||
2434
- normalized.includes("gpt 5 codex") ||
2435
- normalized.includes("codex")
2436
- ) {
2437
- return CURRENT_CODEX_MODEL;
2438
- }
2439
-
2440
- return "";
2444
+ return CURRENT_CODEX_MODEL;
2441
2445
  }
2442
2446
 
2443
2447
  // Resolve GPT-5.6 identifiers, including ones that are not exact aliases (e.g. a
@@ -2473,6 +2477,11 @@ function resolveGpt6RequestedModel(stripped) {
2473
2477
  return "";
2474
2478
  }
2475
2479
  if (tokens.includes("aeon")) return GPT_6_ASTRA_AEON_MODEL;
2480
+ if (isAstra) return GPT_6_ASTRA_MODEL;
2481
+ // `terra` goes to Sol: there is no GPT-6 Terra, and upstream migrates
2482
+ // `gpt-5.6-terra` users to Sol.
2483
+ if (tokens.includes("luna")) return GPT_6_LUNA_MODEL;
2484
+ if (tokens.includes("sol") || tokens.includes("terra")) return GPT_6_SOL_MODEL;
2476
2485
  return GPT_6_ASTRA_MODEL;
2477
2486
  }
2478
2487
 
@@ -2546,6 +2555,14 @@ function normalizeRequestedModel(model) {
2546
2555
  if (exactMatch) {
2547
2556
  return exactMatch;
2548
2557
  }
2558
+ // Mirrors lib: retry the alias lookup without a `-max`/`-ultra` suffix.
2559
+ const withoutTopEffort = normalized.replace(/-(max|ultra)$/, "");
2560
+ if (withoutTopEffort !== normalized) {
2561
+ const effortlessMatch = REQUESTED_MODEL_ALIASES.get(withoutTopEffort);
2562
+ if (effortlessMatch) {
2563
+ return effortlessMatch;
2564
+ }
2565
+ }
2549
2566
 
2550
2567
  const daybreakModel = resolveDaybreakRequestedModel(stripped);
2551
2568
  if (daybreakModel) {
@@ -3595,7 +3612,16 @@ function parseRuntimeRotationProxyEnv(value) {
3595
3612
  return undefined;
3596
3613
  }
3597
3614
 
3615
+ function hasNativeAppBinding(env = process.env) {
3616
+ try {
3617
+ const config = readFileSync(join(resolveCodexHomeDir(env), "config.toml"), "utf8");
3618
+ return config.includes("# codex-multi-auth native provider begin") &&
3619
+ extractConfigAssignmentValue(config, "model_provider") === "openai";
3620
+ } catch { return false; }
3621
+ }
3622
+
3598
3623
  async function isRuntimeRotationProxyEnabled(rawArgs, baseEnv = process.env) {
3624
+ if (hasNativeAppBinding(baseEnv)) return false;
3599
3625
  if ((baseEnv.CODEX_MULTI_AUTH_BYPASS ?? "").trim() === "1") {
3600
3626
  return false;
3601
3627
  }
@@ -4017,29 +4043,20 @@ function installRuntimeRotationAppServerCliShim(forwardedEnv, configArgs = []) {
4017
4043
  // Best-effort stale shim cleanup only; the copy below will report a
4018
4044
  // persistent failure without leaving a partially-created helper.
4019
4045
  }
4020
- if (
4021
- process.platform === "win32" ||
4022
- (process.env.CODEX_MULTI_AUTH_TEST_FORCE_APP_SERVER_SHIM_COPY ?? "") === "1"
4023
- ) {
4024
- // A Windows hard link to the running node.exe remains locked by the
4025
- // helper process itself, which prevents the shim directory from being
4026
- // removed during graceful helper shutdown. Use an independent image so
4027
- // the helper can clean up its app-server shim before exiting.
4046
+ if (process.platform === "win32") {
4047
+ // A running hard-linked node.exe prevents helper cleanup on Windows.
4028
4048
  withSynchronousFileOperationRetry(() => {
4029
4049
  maybeThrowSimulatedAppServerShimFileError("copy");
4030
4050
  copyFileSync(process.execPath, executablePath);
4031
4051
  });
4032
4052
  } else {
4033
- try {
4034
- linkSync(process.execPath, executablePath);
4035
- } catch {
4036
- withSynchronousFileOperationRetry(() => {
4037
- maybeThrowSimulatedAppServerShimFileError("copy");
4038
- copyFileSync(process.execPath, executablePath);
4039
- });
4040
- }
4041
- }
4042
- if (process.platform !== "win32") {
4053
+ // Relocating Node breaks installations with executable-relative shared
4054
+ // libraries (including Homebrew). Invoke the original image in place.
4055
+ const quotedNode = "'" + process.execPath.replace(/'/g, "'\\''") + "'";
4056
+ withSynchronousFileOperationRetry(() => {
4057
+ maybeThrowSimulatedAppServerShimFileError("copy");
4058
+ writeFileSync(executablePath, `#!/bin/sh\nexec ${quotedNode} "$@"\n`, { mode: 0o755 });
4059
+ });
4043
4060
  chmodSync(executablePath, 0o755);
4044
4061
  }
4045
4062
  writeFileSync(
@@ -5960,8 +5977,13 @@ function createCompatibilityCodexHome(
5960
5977
  };
5961
5978
  }
5962
5979
 
5963
- function buildForwardArgs(rawArgs) {
5964
- const { args: compatibilityArgs, requestedModel } = rewriteReasoningConfigArgs(rawArgs);
5980
+ function buildForwardArgs(rawArgs, { preserveNativeSettings = false } = {}) {
5981
+ // Native app binding keeps the caller's model and reasoning settings verbatim;
5982
+ // it still needs the file auth store, because the router authenticates the
5983
+ // desktop token it reads from auth.json.
5984
+ const { args: compatibilityArgs, requestedModel } = preserveNativeSettings
5985
+ ? { args: [...rawArgs], requestedModel: extractRequestedModel(rawArgs) }
5986
+ : rewriteReasoningConfigArgs(rawArgs);
5965
5987
  const forceFileAuthStore = (process.env.CODEX_MULTI_AUTH_FORCE_FILE_AUTH_STORE ?? "1").trim() !== "0";
5966
5988
  if (!forceFileAuthStore) {
5967
5989
  return { args: compatibilityArgs, requestedModel };
@@ -6469,6 +6491,33 @@ function ensureWindowsShellShimGuards() {
6469
6491
  }
6470
6492
  }
6471
6493
 
6494
+ export function getResumePickerRequest(args, cwd = process.cwd()) {
6495
+ const baseCwd = cwd;
6496
+ const command = findForwardedCommand(args);
6497
+ if (command?.command !== "resume" || findForwardedSubcommand(args, command.index)) return null;
6498
+ const configArgs = [];
6499
+ let showAll = false;
6500
+ let includeNonInteractive = false;
6501
+ for (let i = 0; i < args.length; i += 1) {
6502
+ const arg = args[i];
6503
+ if (arg === "--") break;
6504
+ if (consumesNextArg(arg) && args[i + 1] === undefined) return null;
6505
+ if (["--last", "--help", "-h", "--remote"].includes(arg) || arg.startsWith("--remote=")) return null;
6506
+ if (arg === "--all") showAll = true;
6507
+ if (arg === "--include-non-interactive") includeNonInteractive = true;
6508
+ if (arg === "-C" || arg === "--cd") cwd = resolvePath(baseCwd, args[i + 1]);
6509
+ else if (arg.startsWith("--cd=")) cwd = resolvePath(baseCwd, arg.slice(5));
6510
+ else if (arg.startsWith("-C") && arg.length > 2) cwd = resolvePath(baseCwd, arg.slice(2));
6511
+ if (["-c", "--config", "-p", "--profile", "--enable", "--disable"].includes(arg)) {
6512
+ configArgs.push(arg, args[i + 1]);
6513
+ } else if (/^--(config|profile|enable|disable)=/.test(arg) || /^-[cp].+/.test(arg)) {
6514
+ configArgs.push(arg);
6515
+ }
6516
+ i = skipOptionValueSpan(args, i);
6517
+ }
6518
+ return { commandIndex: command.index, cwd, configArgs, showAll, includeNonInteractive };
6519
+ }
6520
+
6472
6521
  async function main() {
6473
6522
  hydrateCliVersionEnv();
6474
6523
 
@@ -6509,7 +6558,9 @@ async function main() {
6509
6558
  [
6510
6559
  "Could not locate the official Codex CLI.",
6511
6560
  "Install it with npm, Homebrew, or an official native release so `codex` is on PATH.",
6512
- "Or set CODEX_MULTI_AUTH_REAL_CODEX_BIN to the full path of either codex or @openai/codex/bin/codex.js.",
6561
+ process.platform === "win32"
6562
+ ? "Or set CODEX_MULTI_AUTH_REAL_CODEX_BIN to the full path of codex.exe or @openai/codex/bin/codex.js."
6563
+ : "Or set CODEX_MULTI_AUTH_REAL_CODEX_BIN to the full path of either codex or @openai/codex/bin/codex.js.",
6513
6564
  ].join("\n"),
6514
6565
  );
6515
6566
  return 1;
@@ -6518,12 +6569,42 @@ async function main() {
6518
6569
  // Resolve `--account` / CODEX_MULTI_AUTH_FORCE_ACCOUNT before forwarding: strip
6519
6570
  // the launcher-only flag from the Codex args and publish the resolved pin, or
6520
6571
  // fail hard so a forced account can never silently fall back to another one.
6572
+ if (hasNativeAppBinding(process.env)) {
6573
+ const forced = resolveForcedAccountSelector(rawArgs, process.env);
6574
+ if (forced.error || forced.selector !== null) {
6575
+ console.error(forced.error ?? "Native app binding uses the persistent inference selection. Use codex-multi-auth switch instead of --account.");
6576
+ return 1;
6577
+ }
6578
+ delete process.env.CODEX_MULTI_AUTH_FORCE_ACCOUNT_INDEX;
6579
+ // Best effort: a locked or read-only config.toml (Windows EPERM/EBUSY)
6580
+ // must not block the launch; the per-invocation override below still applies.
6581
+ await ensurePersistedCodexFileAuthStore();
6582
+ const { args: nativeArgs } = buildForwardArgs(forced.strippedArgs, { preserveNativeSettings: true });
6583
+ const result = await forwardToRealCodexOnce(realCodexBin, nativeArgs, process.env);
6584
+ return result.exitCode;
6585
+ }
6521
6586
  const forcedAccount = await applyForcedAccountSelection(rawArgs, process.env);
6522
6587
  if (forcedAccount.error) {
6523
6588
  console.error(forcedAccount.error);
6524
6589
  return 1;
6525
6590
  }
6526
- const forwardArgs = forcedAccount.forwardArgs;
6591
+ const forwardArgs = [...forcedAccount.forwardArgs];
6592
+
6593
+
6594
+ if (process.stdin.isTTY && process.stdout.isTTY && !bypass) {
6595
+ const pickerRequest = getResumePickerRequest(forwardArgs);
6596
+ if (pickerRequest && await isRuntimeRotationProxyEnabled(forwardArgs)) {
6597
+ try {
6598
+ const { pickResumeThread } = await import("../dist/lib/runtime/resume-picker.js");
6599
+ const id = await pickResumeThread({ ...pickerRequest, codexBin: realCodexBin });
6600
+ if (!id) return 0;
6601
+ forwardArgs.splice(pickerRequest.commandIndex + 1, 0, id);
6602
+ } catch (error) {
6603
+ // Discovery is optional: fall back to native `codex resume` with the original args.
6604
+ console.error(`Could not list saved Codex sessions: ${error instanceof Error ? error.message : String(error)}`);
6605
+ }
6606
+ }
6607
+ }
6527
6608
 
6528
6609
  await ensurePersistedCodexFileAuthStore();
6529
6610
  await autoSyncManagerActiveSelectionIfEnabled();
@@ -6542,11 +6623,13 @@ async function main() {
6542
6623
  // lib/request/helpers/model-map.ts (see test/codex-model-resolution.test.ts,
6543
6624
  // which asserts wrapper<->lib parity).
6544
6625
  export {
6626
+ isRuntimeRotationProxyEnabled,
6545
6627
  normalizeRequestedModel,
6546
6628
  coerceReasoningEffortForModel,
6547
6629
  resolveModelFamilyForStatus,
6548
6630
  canonicalizeRequestedModelName,
6549
6631
  WRAPPER_UNSUPPORTED_MODEL_FALLBACK_CHAIN,
6632
+ RETIRED_MODEL_REPLACEMENTS,
6550
6633
  };
6551
6634
 
6552
6635
  // Run the wrapper only when actually launched (as the `codex-multi-auth-codex`