codexuse-cli 5.2.5 → 5.2.7

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
@@ -5974,14 +5974,13 @@ function logInfo(...args) {
5974
5974
  var RPC_TIMEOUT_MS = 1e4;
5975
5975
  var ACTIVATION_TURN_TIMEOUT_MS = 9e4;
5976
5976
  var ACTIVATION_PROMPT = "Reply with exactly: ok.";
5977
- var FALLBACK_ACTIVATION_MODEL = "gpt-5.5";
5978
5977
  function resolveActivationModel(configuredModel) {
5979
5978
  const model = configuredModel?.trim();
5980
5979
  if (!model) {
5981
- return FALLBACK_ACTIVATION_MODEL;
5980
+ return null;
5982
5981
  }
5983
5982
  if (/-codex$/.test(model) || /-codex-mini$/.test(model)) {
5984
- return FALLBACK_ACTIVATION_MODEL;
5983
+ return null;
5985
5984
  }
5986
5985
  return model;
5987
5986
  }
@@ -6570,14 +6569,15 @@ async function activateResetWindowViaRpc(envOverride, options = {}) {
6570
6569
  } catch {
6571
6570
  }
6572
6571
  const activationModel = resolveActivationModel(configuredModel);
6573
- const tempConfigPath = import_node_path8.default.join(tempHome, "config.toml");
6574
- await import_node_fs3.promises.writeFile(
6575
- tempConfigPath,
6576
- `model = ${JSON.stringify(activationModel)}
6572
+ if (activationModel) {
6573
+ await import_node_fs3.promises.writeFile(
6574
+ import_node_path8.default.join(tempHome, "config.toml"),
6575
+ `model = ${JSON.stringify(activationModel)}
6577
6576
  `,
6578
- "utf8"
6579
- ).catch(() => {
6580
- });
6577
+ "utf8"
6578
+ ).catch(() => {
6579
+ });
6580
+ }
6581
6581
  const childEnv = buildCodexChildEnv({
6582
6582
  ...envOverride ?? {},
6583
6583
  HOME: tempHome,
@@ -10627,7 +10627,6 @@ async function findOfficialCodexThreadRecord(profileHome, threadId) {
10627
10627
  // ../../packages/runtime-codex/src/codex/officialAppRestart.ts
10628
10628
  var COMMAND_TIMEOUT_MS = 3e3;
10629
10629
  var EXIT_WAIT_MS = 1e4;
10630
- var LAUNCH_WAIT_MS = 15e3;
10631
10630
  var POLL_INTERVAL_MS = 250;
10632
10631
  var PROCESS_EXIT_GRACE_MS = 15e3;
10633
10632
  var APP_DISCOVERY_CACHE_TTL_MS = 6e4;
@@ -15271,7 +15270,7 @@ function getDescendantPids(rootPid, rows) {
15271
15270
  return descendants;
15272
15271
  }
15273
15272
  async function waitForNewMainPid(candidate, previousPids) {
15274
- const deadline = Date.now() + LAUNCH_WAIT_MS;
15273
+ const deadline = Date.now() + CODEX_BRIDGE_LAUNCH_WAIT_MS;
15275
15274
  while (Date.now() < deadline) {
15276
15275
  const rows = await readProcessRows();
15277
15276
  const pid = rows.find((row) => isMainProcessRow(row, candidate) && !previousPids.has(row.pid))?.pid ?? null;
@@ -15283,7 +15282,7 @@ async function waitForNewMainPid(candidate, previousPids) {
15283
15282
  return null;
15284
15283
  }
15285
15284
  async function waitForAppServerPid(mainPid, profileHome) {
15286
- const deadline = Date.now() + LAUNCH_WAIT_MS;
15285
+ const deadline = Date.now() + CODEX_BRIDGE_LAUNCH_WAIT_MS;
15287
15286
  while (Date.now() < deadline) {
15288
15287
  const pid = await findAppServerPidForProfile(
15289
15288
  await readProcessRows(),
@@ -15451,7 +15450,7 @@ async function resolveInstanceRuntimeState(args) {
15451
15450
  args.rows
15452
15451
  );
15453
15452
  return {
15454
- running: appServerPid2 !== null,
15453
+ running: false,
15455
15454
  appServerPid: appServerPid2,
15456
15455
  startedAt: null
15457
15456
  };
@@ -15463,7 +15462,7 @@ async function resolveInstanceRuntimeState(args) {
15463
15462
  args.rows
15464
15463
  );
15465
15464
  return {
15466
- running: appServerPid2 !== null,
15465
+ running: false,
15467
15466
  appServerPid: appServerPid2,
15468
15467
  startedAt: null
15469
15468
  };
@@ -15595,35 +15594,6 @@ async function collectCodexAppCandidates(rawPaths) {
15595
15594
  }
15596
15595
  return candidates.sort((a, b) => a.appPath.localeCompare(b.appPath));
15597
15596
  }
15598
- function addCodexAppPathsFromDirectory(rawPaths, rootPath, maxDepth = 2) {
15599
- if (!(0, import_node_fs7.existsSync)(rootPath)) {
15600
- return;
15601
- }
15602
- const pending = [{ directory: rootPath, depth: 0 }];
15603
- while (pending.length > 0) {
15604
- const current = pending.shift();
15605
- let entries;
15606
- try {
15607
- entries = (0, import_node_fs7.readdirSync)(current.directory, { withFileTypes: true });
15608
- } catch {
15609
- continue;
15610
- }
15611
- for (const entry of entries) {
15612
- if (!entry.isDirectory()) {
15613
- continue;
15614
- }
15615
- const childPath = import_node_path13.default.join(current.directory, entry.name);
15616
- if (entry.name === "Codex.app") {
15617
- rawPaths.add(childPath);
15618
- continue;
15619
- }
15620
- if (entry.name.endsWith(".app") || current.depth >= maxDepth) {
15621
- continue;
15622
- }
15623
- pending.push({ directory: childPath, depth: current.depth + 1 });
15624
- }
15625
- }
15626
- }
15627
15597
  async function discoverCodexAppCandidates() {
15628
15598
  const now = Date.now();
15629
15599
  const envPath = process.env.CODEXUSE_OFFICIAL_CODEX_APP_PATH?.trim() || null;
@@ -15636,8 +15606,6 @@ async function discoverCodexAppCandidates() {
15636
15606
  }
15637
15607
  rawPaths.add("/Applications/Codex.app");
15638
15608
  rawPaths.add(import_node_path13.default.join((0, import_node_os4.homedir)(), "Applications", "Codex.app"));
15639
- addCodexAppPathsFromDirectory(rawPaths, "/Applications");
15640
- addCodexAppPathsFromDirectory(rawPaths, import_node_path13.default.join((0, import_node_os4.homedir)(), "Applications"));
15641
15609
  const sorted = await collectCodexAppCandidates(rawPaths);
15642
15610
  appDiscoveryCache = {
15643
15611
  envPath,
@@ -15987,6 +15955,10 @@ async function launchOfficialCodexProfileInstanceOnce(options) {
15987
15955
  reason: null
15988
15956
  };
15989
15957
  }
15958
+ if (runtime.appServerPid !== null) {
15959
+ await stopProcessTree(runtime.appServerPid, rows);
15960
+ launchBaselineMainPids = (await readProcessRows()).filter((row) => isMainProcessRow(row, candidate)).map((row) => row.pid);
15961
+ }
15990
15962
  }
15991
15963
  let cdpPort;
15992
15964
  try {
@@ -17346,9 +17318,11 @@ function formatErrorResponse(raw, status) {
17346
17318
  }
17347
17319
  }
17348
17320
  } catch {
17349
- return trimmed;
17350
17321
  }
17351
- return trimmed;
17322
+ if (trimmed.startsWith("<")) {
17323
+ return `Cloud sync request failed (${status}).`;
17324
+ }
17325
+ return trimmed.length > 500 ? `${trimmed.slice(0, 500)}...` : trimmed;
17352
17326
  }
17353
17327
  return `Cloud sync request failed (${status}).`;
17354
17328
  }
@@ -18228,7 +18202,7 @@ async function ensureCliStorageReady() {
18228
18202
  }
18229
18203
 
18230
18204
  // src/app/main.ts
18231
- var VERSION = true ? "5.2.5" : "0.0.0";
18205
+ var VERSION = true ? "5.2.7" : "0.0.0";
18232
18206
  async function runCli() {
18233
18207
  const args = process.argv.slice(2);
18234
18208
  if (args.length === 0) {