codexuse-cli 5.3.0 → 5.4.1

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/dist/index.js CHANGED
@@ -2031,9 +2031,10 @@ var import_node_path10 = __toESM(require("path"));
2031
2031
 
2032
2032
  // ../../packages/contracts/src/settings/types.ts
2033
2033
  var DEFAULT_ACCOUNT_POOL_EXPOSED_MODELS = [
2034
- "gpt-5.5",
2035
- "gpt-5.3-codex-spark",
2036
- "gpt-5.4-mini"
2034
+ "gpt-5.6-sol",
2035
+ "gpt-5.6-terra",
2036
+ "gpt-5.6-luna",
2037
+ "gpt-5.5"
2037
2038
  ];
2038
2039
  var LEGACY_ACCOUNT_POOL_EXPOSED_MODELS_DEFAULT = [
2039
2040
  "gpt-5.5",
@@ -2046,7 +2047,8 @@ var DEFAULT_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS = [
2046
2047
  "low",
2047
2048
  "medium",
2048
2049
  "high",
2049
- "xhigh"
2050
+ "xhigh",
2051
+ "max"
2050
2052
  ];
2051
2053
  var LEGACY_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS_DEFAULT = [
2052
2054
  "none",
@@ -2056,13 +2058,22 @@ var LEGACY_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS_DEFAULT = [
2056
2058
  "high",
2057
2059
  "xhigh"
2058
2060
  ];
2061
+ var SUPERSEDED_ACCOUNT_POOL_EXPOSED_MODEL_DEFAULTS = [
2062
+ LEGACY_ACCOUNT_POOL_EXPOSED_MODELS_DEFAULT,
2063
+ ["gpt-5.5", "gpt-5.3-codex-spark", "gpt-5.4-mini"]
2064
+ ];
2065
+ var SUPERSEDED_ACCOUNT_POOL_EXPOSED_REASONING_DEFAULTS = [
2066
+ LEGACY_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS_DEFAULT,
2067
+ ["none", "low", "medium", "high", "xhigh"]
2068
+ ];
2069
+ function sequenceEquals(a, b) {
2070
+ return a.length === b.length && a.every((value3, index2) => value3 === b[index2]);
2071
+ }
2059
2072
  function migrateLegacyAccountPoolExposedModelDefaults(models) {
2060
- return models.length === LEGACY_ACCOUNT_POOL_EXPOSED_MODELS_DEFAULT.length && models.every((model, index2) => model === LEGACY_ACCOUNT_POOL_EXPOSED_MODELS_DEFAULT[index2]) ? [...DEFAULT_ACCOUNT_POOL_EXPOSED_MODELS] : [...models];
2073
+ return SUPERSEDED_ACCOUNT_POOL_EXPOSED_MODEL_DEFAULTS.some((legacy) => sequenceEquals(models, legacy)) ? [...DEFAULT_ACCOUNT_POOL_EXPOSED_MODELS] : [...models];
2061
2074
  }
2062
2075
  function migrateLegacyAccountPoolExposedReasoningDefaults(efforts) {
2063
- return efforts.length === LEGACY_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS_DEFAULT.length && efforts.every(
2064
- (effort, index2) => effort === LEGACY_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS_DEFAULT[index2]
2065
- ) ? [...DEFAULT_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS] : [...efforts];
2076
+ return SUPERSEDED_ACCOUNT_POOL_EXPOSED_REASONING_DEFAULTS.some((legacy) => sequenceEquals(efforts, legacy)) ? [...DEFAULT_ACCOUNT_POOL_EXPOSED_REASONING_EFFORTS] : [...efforts];
2066
2077
  }
2067
2078
 
2068
2079
  // ../../packages/runtime-app-state/src/app/state.ts
@@ -2150,6 +2161,9 @@ function sanitizeAutoRollPriorityOrder(value3) {
2150
2161
  }
2151
2162
  return normalized;
2152
2163
  }
2164
+ function sanitizeAutoRollExcludedAccountKeys(value3) {
2165
+ return sanitizeAutoRollPriorityOrder(value3);
2166
+ }
2153
2167
  function sanitizeLowRemainingNotificationThreshold(value3) {
2154
2168
  const numeric = resolveFiniteNumber(value3, DEFAULT_LOW_REMAINING_NOTIFICATION_THRESHOLD);
2155
2169
  return clampNumber(
@@ -2182,6 +2196,9 @@ function normalizeAutoRollSettings(raw) {
2182
2196
  launchOfficialCodexWhenClosedOnAutoRoll: raw?.launchOfficialCodexWhenClosedOnAutoRoll === true ? true : DEFAULT_LAUNCH_OFFICIAL_CODEX_WHEN_CLOSED_ON_AUTO_ROLL,
2183
2197
  handoffRunningThreadsOnAccountSwitch: raw?.handoffRunningThreadsOnAccountSwitch === true ? true : DEFAULT_HANDOFF_RUNNING_THREADS_ON_ACCOUNT_SWITCH,
2184
2198
  priorityOrder: sanitizeAutoRollPriorityOrder(raw?.priorityOrder),
2199
+ excludedAccountKeys: sanitizeAutoRollExcludedAccountKeys(
2200
+ raw?.excludedAccountKeys
2201
+ ),
2185
2202
  lowRemainingNotificationEnabled: raw?.lowRemainingNotificationEnabled === true ? true : DEFAULT_LOW_REMAINING_NOTIFICATION_ENABLED,
2186
2203
  lowRemainingNotificationThreshold: sanitizeLowRemainingNotificationThreshold(
2187
2204
  typeof raw?.lowRemainingNotificationThreshold === "number" ? raw.lowRemainingNotificationThreshold : Number.NaN
@@ -2576,6 +2593,7 @@ function createDefaultAppState() {
2576
2593
  launchOfficialCodexWhenClosedOnAutoRoll: false,
2577
2594
  handoffRunningThreadsOnAccountSwitch: false,
2578
2595
  priorityOrder: [],
2596
+ excludedAccountKeys: [],
2579
2597
  lowRemainingNotificationEnabled: false,
2580
2598
  lowRemainingNotificationThreshold: 1,
2581
2599
  autoActivateResetWindowEnabled: false
@@ -3714,6 +3732,7 @@ async function writeCodexSettingsJsonRaw(payload) {
3714
3732
  launchOfficialCodexWhenClosedOnAutoRoll: autoRoll.launchOfficialCodexWhenClosedOnAutoRoll,
3715
3733
  handoffRunningThreadsOnAccountSwitch: autoRoll.handoffRunningThreadsOnAccountSwitch,
3716
3734
  priorityOrder: autoRoll.priorityOrder,
3735
+ excludedAccountKeys: autoRoll.excludedAccountKeys,
3717
3736
  lowRemainingNotificationEnabled: autoRoll.lowRemainingNotificationEnabled,
3718
3737
  lowRemainingNotificationThreshold: autoRoll.lowRemainingNotificationThreshold,
3719
3738
  autoActivateResetWindowEnabled: autoRoll.autoActivateResetWindowEnabled ?? false
@@ -27588,7 +27607,7 @@ var ProviderItemId = makeEntityId("ProviderItemId");
27588
27607
  var ApprovalRequestId = makeEntityId("ApprovalRequestId");
27589
27608
 
27590
27609
  // ../../packages/contracts/src/model.ts
27591
- var CODEX_REASONING_EFFORT_OPTIONS = ["xhigh", "high", "medium", "low"];
27610
+ var CODEX_REASONING_EFFORT_OPTIONS = ["max", "xhigh", "high", "medium", "low"];
27592
27611
  var CodexModelOptions = Schema_exports.Struct({
27593
27612
  reasoningEffort: Schema_exports.optional(Schema_exports.Literals(CODEX_REASONING_EFFORT_OPTIONS)),
27594
27613
  fastMode: Schema_exports.optional(Schema_exports.Boolean)
@@ -27598,6 +27617,9 @@ var ProviderModelOptions = Schema_exports.Struct({
27598
27617
  });
27599
27618
  var MODEL_OPTIONS_BY_PROVIDER = {
27600
27619
  codex: [
27620
+ { slug: "gpt-5.6-sol", name: "GPT-5.6 Sol" },
27621
+ { slug: "gpt-5.6-terra", name: "GPT-5.6 Terra" },
27622
+ { slug: "gpt-5.6-luna", name: "GPT-5.6 Luna" },
27601
27623
  { slug: "gpt-5.5", name: "GPT-5.5" },
27602
27624
  { slug: "gpt-5.4", name: "GPT-5.4" },
27603
27625
  { slug: "gpt-5.4-mini", name: "GPT-5.4 Mini" },
@@ -31325,6 +31347,10 @@ var DESKTOP_RPC_STATE_DIR = "desktop-rpc";
31325
31347
  var ACCOUNT_POOL_STORE_VERSION = 3;
31326
31348
  var MAX_RESPONSE_IDS_PER_SESSION = 64;
31327
31349
  var MODEL_SLUG_ALIASES = {
31350
+ "gpt-5.6": "gpt-5.6-sol",
31351
+ "5.6": "gpt-5.6-sol",
31352
+ "5.6-terra": "gpt-5.6-terra",
31353
+ "5.6-luna": "gpt-5.6-luna",
31328
31354
  "5.5": "gpt-5.5",
31329
31355
  "5.4": "gpt-5.4",
31330
31356
  "5.3": "gpt-5.3-codex",
@@ -33009,6 +33035,10 @@ var CODEXUSE_BRIDGE_BINDING_NAME = "__codexuseBridgeBinding";
33009
33035
  var CODEXUSE_BRIDGE_INSTALL_TTL_MS = 5e3;
33010
33036
  var CODEXUSE_BRIDGE_VERSION = "0.2.0";
33011
33037
  var CODEXUSE_STALE_LAUNCH_GRACE_MS = 45e3;
33038
+ var OFFICIAL_CODEX_APP_NAMES = [
33039
+ "ChatGPT.app",
33040
+ "Codex.app"
33041
+ ];
33012
33042
  function sleep3(ms) {
33013
33043
  return new Promise((resolve2) => setTimeout(resolve2, ms));
33014
33044
  }
@@ -37537,12 +37567,19 @@ function isMainProcessRow(row, candidate) {
37537
37567
  return row.args.includes(getMainExecutablePath(candidate));
37538
37568
  }
37539
37569
  function findAppServerPid(rows, mainPid) {
37570
+ const descendants = new Set(getDescendantPids(mainPid, rows));
37540
37571
  return rows.find(
37541
- (row) => row.ppid === mainPid && isAppServerProcessRow(row)
37572
+ (row) => descendants.has(row.pid) && isAppServerProcessRow(row)
37542
37573
  )?.pid ?? null;
37543
37574
  }
37544
37575
  function isAppServerProcessRow(row) {
37545
- return row.args.includes("/Contents/Resources/codex app-server");
37576
+ const executableMarker = "/Contents/Resources/codex";
37577
+ const executableIndex = row.args.indexOf(executableMarker);
37578
+ if (executableIndex < 0) {
37579
+ return false;
37580
+ }
37581
+ const appServerArgs = row.args.slice(executableIndex + executableMarker.length);
37582
+ return /(?:^|\s)app-server(?:\s|$)/.test(appServerArgs);
37546
37583
  }
37547
37584
  async function processMatchesProfileHome(pid, profileHome) {
37548
37585
  const result2 = await runCommand3(
@@ -37556,8 +37593,9 @@ async function processMatchesProfileHome(pid, profileHome) {
37556
37593
  return result2.stdout.includes(`CODEX_HOME=${profileHome}`) || result2.stdout.includes(profileHome);
37557
37594
  }
37558
37595
  async function findAppServerPidForProfile(rows, mainPid, profileHome) {
37596
+ const descendants = new Set(getDescendantPids(mainPid, rows));
37559
37597
  const candidates = rows.filter(
37560
- (row) => row.ppid === mainPid && isAppServerProcessRow(row)
37598
+ (row) => descendants.has(row.pid) && isAppServerProcessRow(row)
37561
37599
  );
37562
37600
  for (const row of candidates) {
37563
37601
  if (row.args.includes(profileHome) || await processMatchesProfileHome(row.pid, profileHome)) {
@@ -37700,8 +37738,9 @@ async function stopProcessTree(rootPid, rows) {
37700
37738
  }
37701
37739
  async function stopUnverifiedLaunch(rootPid) {
37702
37740
  try {
37703
- await stopProcessTree(rootPid, await readProcessRows());
37741
+ return await stopProcessTree(rootPid, await readProcessRows());
37704
37742
  } catch {
37743
+ return [rootPid];
37705
37744
  }
37706
37745
  }
37707
37746
  async function isCodexUseLaunchedProcess(pid) {
@@ -37947,10 +37986,20 @@ async function readBundleString(appPath, key) {
37947
37986
  const bundleId = result2.stdout.trim();
37948
37987
  return bundleId.length > 0 ? bundleId : null;
37949
37988
  }
37989
+ function addStandardOfficialCodexAppPaths(rawPaths) {
37990
+ for (const appName of OFFICIAL_CODEX_APP_NAMES) {
37991
+ rawPaths.add(import_node_path13.default.join("/Applications", appName));
37992
+ rawPaths.add(import_node_path13.default.join((0, import_node_os4.homedir)(), "Applications", appName));
37993
+ }
37994
+ }
37995
+ function officialCodexAppPriority(appPath) {
37996
+ const priority = OFFICIAL_CODEX_APP_NAMES.indexOf(import_node_path13.default.basename(appPath));
37997
+ return priority >= 0 ? priority : OFFICIAL_CODEX_APP_NAMES.length;
37998
+ }
37950
37999
  async function collectCodexAppCandidates(rawPaths) {
37951
38000
  const candidates = [];
37952
38001
  for (const appPath of rawPaths) {
37953
- if (!(0, import_node_fs7.existsSync)(appPath) || import_node_path13.default.basename(appPath) !== "Codex.app") {
38002
+ if (!(0, import_node_fs7.existsSync)(appPath) || !OFFICIAL_CODEX_APP_NAMES.includes(import_node_path13.default.basename(appPath)) || !(0, import_node_fs7.existsSync)(import_node_path13.default.join(appPath, "Contents", "Resources", "codex"))) {
37954
38003
  continue;
37955
38004
  }
37956
38005
  const bundleId = await readBundleString(appPath, "CFBundleIdentifier");
@@ -37961,10 +38010,12 @@ async function collectCodexAppCandidates(rawPaths) {
37961
38010
  appPath,
37962
38011
  bundleId,
37963
38012
  version: await readBundleString(appPath, "CFBundleShortVersionString"),
37964
- executableName: await readBundleString(appPath, "CFBundleExecutable") ?? "Codex"
38013
+ executableName: await readBundleString(appPath, "CFBundleExecutable") ?? import_node_path13.default.basename(appPath, ".app")
37965
38014
  });
37966
38015
  }
37967
- return candidates.sort((a, b) => a.appPath.localeCompare(b.appPath));
38016
+ return candidates.sort(
38017
+ (a, b) => officialCodexAppPriority(a.appPath) - officialCodexAppPriority(b.appPath) || a.appPath.localeCompare(b.appPath)
38018
+ );
37968
38019
  }
37969
38020
  async function discoverCodexAppCandidates() {
37970
38021
  const now2 = Date.now();
@@ -37976,8 +38027,7 @@ async function discoverCodexAppCandidates() {
37976
38027
  if (envPath) {
37977
38028
  rawPaths.add(envPath);
37978
38029
  }
37979
- rawPaths.add("/Applications/Codex.app");
37980
- rawPaths.add(import_node_path13.default.join((0, import_node_os4.homedir)(), "Applications", "Codex.app"));
38030
+ addStandardOfficialCodexAppPaths(rawPaths);
37981
38031
  const sorted = await collectCodexAppCandidates(rawPaths);
37982
38032
  appDiscoveryCache = {
37983
38033
  envPath,
@@ -38927,7 +38977,7 @@ function compareAutoRollCandidates(a, b, priorityRanks) {
38927
38977
  }
38928
38978
  return a.profile.name.localeCompare(b.profile.name);
38929
38979
  }
38930
- function computeAutoRollCandidate(profiles, usageMap, currentProfileName, currentSummary, switchRemainingThreshold, priorityOrder = [], blockedProfileNames = /* @__PURE__ */ new Set()) {
38980
+ function computeAutoRollCandidate(profiles, usageMap, currentProfileName, currentSummary, switchRemainingThreshold, priorityOrder = [], excludedAccountKeys = /* @__PURE__ */ new Set(), blockedProfileNames = /* @__PURE__ */ new Set()) {
38931
38981
  const priorityRanks = /* @__PURE__ */ new Map();
38932
38982
  for (const [index2, key] of priorityOrder.entries()) {
38933
38983
  const normalized = key.trim();
@@ -38936,7 +38986,7 @@ function computeAutoRollCandidate(profiles, usageMap, currentProfileName, curren
38936
38986
  }
38937
38987
  }
38938
38988
  const candidates = profiles.filter(
38939
- (profile) => profile.name !== currentProfileName && !blockedProfileNames.has(profile.name) && profile.isValid && !profile.tokenStatus?.requiresUserAction
38989
+ (profile) => profile.name !== currentProfileName && !excludedAccountKeys.has(resolveProfileIdentityKeyFromProfile(profile)) && !blockedProfileNames.has(profile.name) && profile.isValid && !profile.tokenStatus?.requiresUserAction
38940
38990
  ).map((profile) => ({
38941
38991
  profile,
38942
38992
  usageSummary: usageMap.get(profile.name)?.usageSummary ?? summarizeRateLimitSnapshot(null)
@@ -39335,6 +39385,26 @@ async function runAutoRollPass(manager, options) {
39335
39385
  if (!current.name) {
39336
39386
  return { switched: false, message: "No active profile.", source: null, target: null };
39337
39387
  }
39388
+ const currentProfile = profiles.find((profile) => profile.name === current.name);
39389
+ if (!currentProfile) {
39390
+ return {
39391
+ switched: false,
39392
+ message: `Current profile '${current.name}' is missing from saved profiles.`,
39393
+ source: current.name,
39394
+ target: null
39395
+ };
39396
+ }
39397
+ const excludedAccountKeys = new Set(options.excludedAccountKeys ?? []);
39398
+ if (excludedAccountKeys.has(
39399
+ resolveProfileIdentityKeyFromProfile(currentProfile)
39400
+ )) {
39401
+ return {
39402
+ switched: false,
39403
+ message: `'${current.name}' is excluded from auto-roll.`,
39404
+ source: current.name,
39405
+ target: null
39406
+ };
39407
+ }
39338
39408
  const codexPath = resolveCodexBinary();
39339
39409
  if (!codexPath) {
39340
39410
  throw new Error("Codex CLI binary not found on PATH. Auto-roll requires codex for live rate limits.");
@@ -39345,15 +39415,6 @@ async function runAutoRollPass(manager, options) {
39345
39415
  usageMap,
39346
39416
  options.rearmRemainingThreshold
39347
39417
  );
39348
- const currentProfile = profiles.find((profile) => profile.name === current.name);
39349
- if (!currentProfile) {
39350
- return {
39351
- switched: false,
39352
- message: `Current profile '${current.name}' is missing from saved profiles.`,
39353
- source: current.name,
39354
- target: null
39355
- };
39356
- }
39357
39418
  const currentUsage = usageMap.get(current.name)?.usageSummary ?? summarizeRateLimitSnapshot(null);
39358
39419
  if (!currentUsage.hasUsage) {
39359
39420
  return {
@@ -39399,6 +39460,7 @@ async function runAutoRollPass(manager, options) {
39399
39460
  currentUsage,
39400
39461
  options.switchRemainingThreshold,
39401
39462
  options.priorityOrder ?? [],
39463
+ excludedAccountKeys,
39402
39464
  options.blockedProfiles
39403
39465
  );
39404
39466
  if (!candidate) {
@@ -39597,6 +39659,7 @@ async function handleProfileCommand(args2, version2) {
39597
39659
  rearmRemainingThreshold,
39598
39660
  dryRun,
39599
39661
  priorityOrder: settings?.priorityOrder ?? [],
39662
+ excludedAccountKeys: settings?.excludedAccountKeys ?? [],
39600
39663
  activateOfficialCodex,
39601
39664
  launchOfficialCodexWhenClosed: settings?.launchOfficialCodexWhenClosedOnAutoRoll === true,
39602
39665
  blockedProfiles,
@@ -39617,6 +39680,7 @@ async function handleProfileCommand(args2, version2) {
39617
39680
  rearmRemainingThreshold,
39618
39681
  dryRun,
39619
39682
  priorityOrder: settings?.priorityOrder ?? [],
39683
+ excludedAccountKeys: settings?.excludedAccountKeys ?? [],
39620
39684
  activateOfficialCodex,
39621
39685
  launchOfficialCodexWhenClosed: settings?.launchOfficialCodexWhenClosedOnAutoRoll === true
39622
39686
  });
@@ -40587,7 +40651,7 @@ async function ensureCliStorageReady() {
40587
40651
  }
40588
40652
 
40589
40653
  // src/app/main.ts
40590
- var VERSION = true ? "5.3.0" : "0.0.0";
40654
+ var VERSION = true ? "5.4.1" : "0.0.0";
40591
40655
  async function runCli() {
40592
40656
  const args2 = process.argv.slice(2);
40593
40657
  if (args2.length === 0) {