codexuse-cli 5.0.0 → 5.0.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
@@ -12697,15 +12697,8 @@ async function waitForAppServerPid(mainPid, profileHome) {
12697
12697
  }
12698
12698
  return null;
12699
12699
  }
12700
- async function focusMainPid(pid) {
12701
- const result = await runCommand2("/usr/bin/osascript", [
12702
- "-e",
12703
- `tell application "System Events" to repeat with proc in (processes whose unix id is ${pid})`,
12704
- "-e",
12705
- "set frontmost of proc to true",
12706
- "-e",
12707
- "end repeat"
12708
- ], 5e3);
12700
+ async function focusOfficialCodexApp(candidate) {
12701
+ const result = await runCommand2("/usr/bin/open", [candidate.appPath], 5e3);
12709
12702
  return result.code === 0;
12710
12703
  }
12711
12704
  function managedInstanceToPayload(instance, running, appServerPid = instance.appServerPid, startedAt = null) {
@@ -13387,7 +13380,7 @@ function focusOfficialCodexProfileInstance(profileName, desiredSettings) {
13387
13380
  reason: null
13388
13381
  };
13389
13382
  }
13390
- const focused = await focusMainPid(existing.pid);
13383
+ const focusRequested = await focusOfficialCodexApp(candidate);
13391
13384
  const verifiedAt = Date.now();
13392
13385
  const bridge = await refreshBridgeStateIfNeeded(
13393
13386
  {
@@ -13407,12 +13400,12 @@ function focusOfficialCodexProfileInstance(profileName, desiredSettings) {
13407
13400
  desiredQolSettings,
13408
13401
  desiredPowerSettings,
13409
13402
  lastVerifiedAt: verifiedAt,
13410
- lastStatus: focused ? "focused" : "focus-unknown",
13411
- lastError: focused ? null : "focus-unknown"
13403
+ lastStatus: focusRequested ? "focus-requested" : "focus-unknown",
13404
+ lastError: focusRequested ? null : "focus-unknown"
13412
13405
  };
13413
13406
  await patchManagedInstance(verified);
13414
13407
  return {
13415
- status: focused ? "focused" : "focus-unknown",
13408
+ status: focusRequested ? "focus-requested" : "focus-unknown",
13416
13409
  profileName,
13417
13410
  instance: managedInstanceToPayload(
13418
13411
  verified,
@@ -13420,7 +13413,7 @@ function focusOfficialCodexProfileInstance(profileName, desiredSettings) {
13420
13413
  runtime.appServerPid,
13421
13414
  runtime.startedAt
13422
13415
  ),
13423
- reason: focused ? null : "focus-unknown"
13416
+ reason: focusRequested ? null : "focus-unknown"
13424
13417
  };
13425
13418
  });
13426
13419
  }
@@ -13446,7 +13439,7 @@ function focusOfficialCodexObservedProfileInstance(profileName, pid, appServerPi
13446
13439
  };
13447
13440
  }
13448
13441
  const runtimeAppServerPid = findAppServerPid(rows, pid) ?? appServerPid;
13449
- const focused = await focusMainPid(pid);
13442
+ const focusRequested = await focusOfficialCodexApp(candidate);
13450
13443
  const cdpPort = parseRemoteDebuggingPort(mainRow.args);
13451
13444
  const checkedAt = Date.now();
13452
13445
  const existing = await readManagedInstance(profileName);
@@ -13474,8 +13467,8 @@ function focusOfficialCodexObservedProfileInstance(profileName, pid, appServerPi
13474
13467
  desiredPowerSettings,
13475
13468
  launchedAt: null,
13476
13469
  lastVerifiedAt: checkedAt,
13477
- lastStatus: focused ? "focused" : "focus-unknown",
13478
- lastError: focused ? null : "focus-unknown"
13470
+ lastStatus: focusRequested ? "focus-requested" : "focus-unknown",
13471
+ lastError: focusRequested ? null : "focus-unknown"
13479
13472
  },
13480
13473
  true,
13481
13474
  true,
@@ -13494,12 +13487,12 @@ function focusOfficialCodexObservedProfileInstance(profileName, pid, appServerPi
13494
13487
  desiredPowerSettings,
13495
13488
  launchedAt: null,
13496
13489
  lastVerifiedAt: checkedAt,
13497
- lastStatus: focused ? "focused" : "focus-unknown",
13498
- lastError: focused ? null : "focus-unknown"
13490
+ lastStatus: focusRequested ? "focus-requested" : "focus-unknown",
13491
+ lastError: focusRequested ? null : "focus-unknown"
13499
13492
  };
13500
13493
  await patchManagedInstance(instance);
13501
13494
  return {
13502
- status: focused ? "focused" : "focus-unknown",
13495
+ status: focusRequested ? "focus-requested" : "focus-unknown",
13503
13496
  profileName,
13504
13497
  instance: managedInstanceToPayload(
13505
13498
  instance,
@@ -13507,7 +13500,7 @@ function focusOfficialCodexObservedProfileInstance(profileName, pid, appServerPi
13507
13500
  runtimeAppServerPid,
13508
13501
  mainRow.startedAt
13509
13502
  ),
13510
- reason: focused ? null : "focus-unknown"
13503
+ reason: focusRequested ? null : "focus-unknown"
13511
13504
  };
13512
13505
  });
13513
13506
  }
@@ -13958,6 +13951,9 @@ function formatOfficialCodexProfileAction(result) {
13958
13951
  if (result.status === "focused") {
13959
13952
  return "Official Codex focused.";
13960
13953
  }
13954
+ if (result.status === "focus-requested") {
13955
+ return "Official Codex activation requested.";
13956
+ }
13961
13957
  if (result.status === "already-running") {
13962
13958
  return "Official Codex already running.";
13963
13959
  }
@@ -13996,7 +13992,7 @@ async function focusUnmanagedOfficialCodexWindow(profileName, target) {
13996
13992
  );
13997
13993
  }
13998
13994
  async function recordCliOfficialCodexActivationResult(profileName, profileKey, action) {
13999
- const verifiedAction = action.status === "started" || action.status === "restarted" || action.status === "focused";
13995
+ const verifiedAction = action.status === "started" || action.status === "restarted" || action.status === "focused" || action.status === "focus-requested";
14000
13996
  const pid = verifiedAction ? action.instance?.pid ?? null : null;
14001
13997
  const status = verifiedAction ? action.status : action.status === "failed" ? "failed" : "skipped";
14002
13998
  const reason = verifiedAction ? null : action.reason ?? action.status;
@@ -15958,7 +15954,7 @@ async function ensureCliStorageReady() {
15958
15954
  }
15959
15955
 
15960
15956
  // src/app/main.ts
15961
- var VERSION = true ? "5.0.0" : "0.0.0";
15957
+ var VERSION = true ? "5.0.1" : "0.0.0";
15962
15958
  async function runCli() {
15963
15959
  const args = process.argv.slice(2);
15964
15960
  if (args.length === 0) {