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.
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +22 -1
- package/config/README.md +2 -2
- package/config/codex-legacy.json +109 -184
- package/config/codex-modern.json +44 -114
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/lib/account-policy.d.ts +4 -0
- package/dist/lib/account-policy.d.ts.map +1 -1
- package/dist/lib/account-policy.js +8 -0
- package/dist/lib/accounts/rate-limits.d.ts.map +1 -1
- package/dist/lib/accounts/rate-limits.js +2 -0
- package/dist/lib/accounts.d.ts +21 -3
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +229 -17
- package/dist/lib/api-route-store.d.ts +24 -0
- package/dist/lib/api-route-store.d.ts.map +1 -0
- package/dist/lib/api-route-store.js +145 -0
- package/dist/lib/auth/account-access.d.ts +115 -0
- package/dist/lib/auth/account-access.d.ts.map +1 -0
- package/dist/lib/auth/account-access.js +214 -0
- package/dist/lib/auth/token-utils.d.ts +54 -1
- package/dist/lib/auth/token-utils.d.ts.map +1 -1
- package/dist/lib/auth/token-utils.js +92 -7
- package/dist/lib/cli.d.ts +1 -1
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +4 -0
- package/dist/lib/codex-cli/state.d.ts +7 -0
- package/dist/lib/codex-cli/state.d.ts.map +1 -1
- package/dist/lib/codex-cli/state.js +18 -0
- package/dist/lib/codex-cli/writer.d.ts.map +1 -1
- package/dist/lib/codex-cli/writer.js +60 -8
- package/dist/lib/codex-manager/account-manager-commands.d.ts.map +1 -1
- package/dist/lib/codex-manager/account-manager-commands.js +1 -0
- package/dist/lib/codex-manager/account-pool-write.d.ts +3 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
- package/dist/lib/codex-manager/account-pool-write.js +4 -0
- package/dist/lib/codex-manager/api-login-menu.d.ts +14 -0
- package/dist/lib/codex-manager/api-login-menu.d.ts.map +1 -0
- package/dist/lib/codex-manager/api-login-menu.js +224 -0
- package/dist/lib/codex-manager/commands/account.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/account.js +27 -0
- package/dist/lib/codex-manager/commands/best.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/best.js +6 -2
- package/dist/lib/codex-manager/commands/check.d.ts +7 -1
- package/dist/lib/codex-manager/commands/check.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/check.js +24 -3
- package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/forecast.js +5 -1
- package/dist/lib/codex-manager/commands/report.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/report.js +5 -1
- package/dist/lib/codex-manager/commands/resets.d.ts +2 -0
- package/dist/lib/codex-manager/commands/resets.d.ts.map +1 -0
- package/dist/lib/codex-manager/commands/resets.js +67 -0
- package/dist/lib/codex-manager/commands/rotation.d.ts +2 -2
- package/dist/lib/codex-manager/commands/rotation.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/rotation.js +63 -12
- package/dist/lib/codex-manager/commands/status.d.ts +12 -1
- package/dist/lib/codex-manager/commands/status.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/status.js +166 -22
- package/dist/lib/codex-manager/commands/uninstall.js +1 -1
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -1
- package/dist/lib/codex-manager/formatters/quota-formatters.js +3 -2
- package/dist/lib/codex-manager/health-check.d.ts +3 -0
- package/dist/lib/codex-manager/health-check.d.ts.map +1 -1
- package/dist/lib/codex-manager/health-check.js +56 -6
- package/dist/lib/codex-manager/help.d.ts.map +1 -1
- package/dist/lib/codex-manager/help.js +4 -2
- package/dist/lib/codex-manager/login-flow.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-flow.js +69 -7
- package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-menu-data.js +14 -5
- package/dist/lib/codex-manager/login-oauth.d.ts +3 -0
- package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-oauth.js +6 -1
- package/dist/lib/codex-manager/login-workspace-choice.d.ts +11 -0
- package/dist/lib/codex-manager/login-workspace-choice.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-workspace-choice.js +37 -0
- package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -1
- package/dist/lib/codex-manager/persist-selected-account.js +2 -1
- package/dist/lib/codex-manager/repair-commands.d.ts +13 -0
- package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -1
- package/dist/lib/codex-manager/repair-commands.js +143 -8
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +25 -6
- package/dist/lib/concurrency.d.ts +3 -0
- package/dist/lib/concurrency.d.ts.map +1 -0
- package/dist/lib/concurrency.js +31 -0
- package/dist/lib/context-budget/model-context-windows.d.ts +1 -1
- package/dist/lib/context-budget/model-context-windows.d.ts.map +1 -1
- package/dist/lib/context-budget/model-context-windows.js +9 -10
- package/dist/lib/model-route-policy.d.ts +52 -0
- package/dist/lib/model-route-policy.d.ts.map +1 -0
- package/dist/lib/model-route-policy.js +159 -0
- package/dist/lib/policy/runtime-policy.d.ts +1 -0
- package/dist/lib/policy/runtime-policy.d.ts.map +1 -1
- package/dist/lib/policy/runtime-policy.js +3 -0
- package/dist/lib/preemptive-quota-scheduler.d.ts +2 -0
- package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -1
- package/dist/lib/preemptive-quota-scheduler.js +4 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +3 -1
- package/dist/lib/quota-probe.d.ts +5 -0
- package/dist/lib/quota-probe.d.ts.map +1 -1
- package/dist/lib/quota-probe.js +26 -2
- package/dist/lib/request/client-cancellation.d.ts +5 -0
- package/dist/lib/request/client-cancellation.d.ts.map +1 -0
- package/dist/lib/request/client-cancellation.js +7 -0
- package/dist/lib/request/error-classification.d.ts.map +1 -1
- package/dist/lib/request/error-classification.js +39 -25
- package/dist/lib/request/fetch-helpers.js +1 -1
- package/dist/lib/request/helpers/model-map.d.ts +12 -2
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +174 -147
- package/dist/lib/request/response-outcome.d.ts +25 -0
- package/dist/lib/request/response-outcome.d.ts.map +1 -0
- package/dist/lib/request/response-outcome.js +49 -0
- package/dist/lib/request/stream-failover-runtime.d.ts +2 -1
- package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -1
- package/dist/lib/request/stream-failover-runtime.js +29 -10
- package/dist/lib/runtime/account-check.d.ts.map +1 -1
- package/dist/lib/runtime/account-check.js +2 -8
- package/dist/lib/runtime/account-model-catalog.d.ts +64 -0
- package/dist/lib/runtime/account-model-catalog.d.ts.map +1 -0
- package/dist/lib/runtime/account-model-catalog.js +154 -0
- package/dist/lib/runtime/account-pool.d.ts +3 -1
- package/dist/lib/runtime/account-pool.d.ts.map +1 -1
- package/dist/lib/runtime/account-pool.js +4 -0
- package/dist/lib/runtime/account-reset-credits.d.ts +42 -0
- package/dist/lib/runtime/account-reset-credits.d.ts.map +1 -0
- package/dist/lib/runtime/account-reset-credits.js +82 -0
- package/dist/lib/runtime/api-model-capabilities.d.ts +30 -0
- package/dist/lib/runtime/api-model-capabilities.d.ts.map +1 -0
- package/dist/lib/runtime/api-model-capabilities.js +434 -0
- package/dist/lib/runtime/api-model-runtime.d.ts +42 -0
- package/dist/lib/runtime/api-model-runtime.d.ts.map +1 -0
- package/dist/lib/runtime/api-model-runtime.js +358 -0
- package/dist/lib/runtime/app-bind.d.ts +19 -1
- package/dist/lib/runtime/app-bind.d.ts.map +1 -1
- package/dist/lib/runtime/app-bind.js +79 -9
- package/dist/lib/runtime/automatic-account-checks.d.ts +31 -0
- package/dist/lib/runtime/automatic-account-checks.d.ts.map +1 -0
- package/dist/lib/runtime/automatic-account-checks.js +113 -0
- package/dist/lib/runtime/automatic-subscription-checks.d.ts +7 -0
- package/dist/lib/runtime/automatic-subscription-checks.d.ts.map +1 -0
- package/dist/lib/runtime/automatic-subscription-checks.js +57 -0
- package/dist/lib/runtime/catalog-capabilities.d.ts +8 -0
- package/dist/lib/runtime/catalog-capabilities.d.ts.map +1 -0
- package/dist/lib/runtime/catalog-capabilities.js +61 -0
- package/dist/lib/runtime/inference-activity.d.ts +15 -0
- package/dist/lib/runtime/inference-activity.d.ts.map +1 -0
- package/dist/lib/runtime/inference-activity.js +95 -0
- package/dist/lib/runtime/model-discovery-status.d.ts +100 -0
- package/dist/lib/runtime/model-discovery-status.d.ts.map +1 -0
- package/dist/lib/runtime/model-discovery-status.js +387 -0
- package/dist/lib/runtime/native-account-storage.d.ts +11 -0
- package/dist/lib/runtime/native-account-storage.d.ts.map +1 -0
- package/dist/lib/runtime/native-account-storage.js +50 -0
- package/dist/lib/runtime/native-account-sync.d.ts +19 -0
- package/dist/lib/runtime/native-account-sync.d.ts.map +1 -0
- package/dist/lib/runtime/native-account-sync.js +62 -0
- package/dist/lib/runtime/native-binding-lock.d.ts +3 -0
- package/dist/lib/runtime/native-binding-lock.d.ts.map +1 -0
- package/dist/lib/runtime/native-binding-lock.js +5 -0
- package/dist/lib/runtime/native-client-auth.d.ts +3 -0
- package/dist/lib/runtime/native-client-auth.d.ts.map +1 -0
- package/dist/lib/runtime/native-client-auth.js +42 -0
- package/dist/lib/runtime/native-provider-config.d.ts +4 -0
- package/dist/lib/runtime/native-provider-config.d.ts.map +1 -0
- package/dist/lib/runtime/native-provider-config.js +52 -0
- package/dist/lib/runtime/native-rate-limits.d.ts +18 -0
- package/dist/lib/runtime/native-rate-limits.d.ts.map +1 -0
- package/dist/lib/runtime/native-rate-limits.js +135 -0
- package/dist/lib/runtime/reset-credit-routing.d.ts +41 -0
- package/dist/lib/runtime/reset-credit-routing.d.ts.map +1 -0
- package/dist/lib/runtime/reset-credit-routing.js +66 -0
- package/dist/lib/runtime/reset-credits.d.ts +101 -0
- package/dist/lib/runtime/reset-credits.d.ts.map +1 -0
- package/dist/lib/runtime/reset-credits.js +162 -0
- package/dist/lib/runtime/response-output-history.d.ts +17 -0
- package/dist/lib/runtime/response-output-history.d.ts.map +1 -0
- package/dist/lib/runtime/response-output-history.js +85 -0
- package/dist/lib/runtime/responses-websocket.d.ts +31 -0
- package/dist/lib/runtime/responses-websocket.d.ts.map +1 -0
- package/dist/lib/runtime/responses-websocket.js +636 -0
- package/dist/lib/runtime/resume-picker.d.ts +41 -0
- package/dist/lib/runtime/resume-picker.d.ts.map +1 -0
- package/dist/lib/runtime/resume-picker.js +169 -0
- package/dist/lib/runtime/rotation-account-selection.d.ts +6 -0
- package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -1
- package/dist/lib/runtime/rotation-account-selection.js +63 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts +33 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -1
- package/dist/lib/runtime/rotation-server-types.d.ts +18 -0
- package/dist/lib/runtime/rotation-server-types.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-capability-failures.d.ts +14 -0
- package/dist/lib/runtime/runtime-capability-failures.d.ts.map +1 -0
- package/dist/lib/runtime/runtime-capability-failures.js +76 -0
- package/dist/lib/runtime/runtime-observability.d.ts +7 -0
- package/dist/lib/runtime/runtime-observability.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-observability.js +42 -2
- package/dist/lib/runtime/subscription-first-use.d.ts +10 -0
- package/dist/lib/runtime/subscription-first-use.d.ts.map +1 -0
- package/dist/lib/runtime/subscription-first-use.js +64 -0
- package/dist/lib/runtime/subscription-quota-event.d.ts +6 -0
- package/dist/lib/runtime/subscription-quota-event.d.ts.map +1 -0
- package/dist/lib/runtime/subscription-quota-event.js +31 -0
- package/dist/lib/runtime/subscription-quota-order.d.ts +17 -0
- package/dist/lib/runtime/subscription-quota-order.d.ts.map +1 -0
- package/dist/lib/runtime/subscription-quota-order.js +31 -0
- package/dist/lib/runtime/workspace-model-scopes.d.ts +15 -0
- package/dist/lib/runtime/workspace-model-scopes.d.ts.map +1 -0
- package/dist/lib/runtime/workspace-model-scopes.js +34 -0
- package/dist/lib/runtime-constants.d.ts +3 -0
- package/dist/lib/runtime-constants.d.ts.map +1 -1
- package/dist/lib/runtime-constants.js +5 -0
- package/dist/lib/runtime-paths.d.ts.map +1 -1
- package/dist/lib/runtime-paths.js +4 -1
- package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
- package/dist/lib/runtime-rotation-proxy.js +855 -46
- package/dist/lib/schemas.d.ts +20 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +3 -0
- package/dist/lib/storage/credential-sidecars.d.ts +13 -0
- package/dist/lib/storage/credential-sidecars.d.ts.map +1 -0
- package/dist/lib/storage/credential-sidecars.js +52 -0
- package/dist/lib/storage/file-lock.d.ts +9 -0
- package/dist/lib/storage/file-lock.d.ts.map +1 -0
- package/dist/lib/storage/file-lock.js +186 -0
- package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage.js +12 -0
- package/dist/lib/storage/path-state.d.ts +2 -0
- package/dist/lib/storage/path-state.d.ts.map +1 -1
- package/dist/lib/storage/path-state.js +9 -0
- package/dist/lib/storage/paths.js +4 -4
- package/dist/lib/storage/pending-auth.d.ts +17 -0
- package/dist/lib/storage/pending-auth.d.ts.map +1 -0
- package/dist/lib/storage/pending-auth.js +153 -0
- package/dist/lib/storage/public-types.d.ts +13 -0
- package/dist/lib/storage/public-types.d.ts.map +1 -1
- package/dist/lib/storage/snapshot-merge.d.ts +16 -0
- package/dist/lib/storage/snapshot-merge.d.ts.map +1 -0
- package/dist/lib/storage/snapshot-merge.js +206 -0
- package/dist/lib/storage/transactions.d.ts.map +1 -1
- package/dist/lib/storage/transactions.js +5 -4
- package/dist/lib/storage.d.ts +6 -0
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +77 -7
- package/dist/lib/ui/auth-menu-builder.d.ts +2 -0
- package/dist/lib/ui/auth-menu-builder.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu-builder.js +1 -0
- package/dist/lib/ui/auth-menu.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu.js +1 -0
- package/dist/lib/ui/check-progress.d.ts +8 -0
- package/dist/lib/ui/check-progress.d.ts.map +1 -0
- package/dist/lib/ui/check-progress.js +30 -0
- package/dist/lib/ui/format.d.ts +3 -1
- package/dist/lib/ui/format.d.ts.map +1 -1
- package/dist/lib/ui/format.js +8 -0
- package/dist/lib/ui/ui-copy.d.ts +2 -2
- package/dist/lib/ui/ui-copy.js +2 -2
- package/dist/lib/usage/pricing.d.ts +19 -2
- package/dist/lib/usage/pricing.d.ts.map +1 -1
- package/dist/lib/usage/pricing.js +101 -40
- package/dist/lib/usage/usage-extraction.d.ts +3 -1
- package/dist/lib/usage/usage-extraction.d.ts.map +1 -1
- package/dist/lib/usage/usage-extraction.js +46 -9
- package/package.json +7 -4
- package/scripts/codex-app-router.js +7 -0
- package/scripts/codex-bin-resolver.js +40 -8
- package/scripts/codex-routing.js +1 -0
- 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
|
-
//
|
|
690
|
-
// lib/
|
|
691
|
-
//
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
if (normalized.includes("codex
|
|
696
|
-
|
|
697
|
-
|
|
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
|
-
|
|
1372
|
-
|
|
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-
|
|
1388
|
-
"gpt-5.5": ["gpt-5.
|
|
1389
|
-
"gpt-5.5-pro": ["gpt-5.
|
|
1390
|
-
"gpt-5.5-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
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)
|
|
2090
|
-
//
|
|
2091
|
-
//
|
|
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:
|
|
2143
|
+
base: GPT_5_6_SOL_MODEL,
|
|
2144
|
+
pro: GPT_5_5_PRO_CANONICAL_MODEL,
|
|
2104
2145
|
},
|
|
2105
2146
|
2: {
|
|
2106
|
-
base:
|
|
2107
|
-
pro:
|
|
2147
|
+
base: GPT_5_6_SOL_MODEL,
|
|
2148
|
+
pro: GPT_5_5_PRO_CANONICAL_MODEL,
|
|
2108
2149
|
},
|
|
2109
2150
|
4: {
|
|
2110
|
-
base:
|
|
2111
|
-
pro:
|
|
2112
|
-
mini:
|
|
2113
|
-
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:
|
|
2119
|
-
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:
|
|
2127
|
-
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
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
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
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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`
|