@pushary/agent-hooks 1.9.57 → 1.9.58

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 (92) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{api-RQAY3A5V.js → api-WVXBM4MR.js} +7 -7
  3. package/dist/bin/pushary-bell-hook.js +15 -15
  4. package/dist/bin/pushary-bell.js +3 -3
  5. package/dist/bin/pushary-claude.js +15 -15
  6. package/dist/bin/pushary-clean.js +39 -36
  7. package/dist/bin/pushary-codex-bridge.js +10 -10
  8. package/dist/bin/pushary-codex-hook.js +19 -19
  9. package/dist/bin/pushary-codex-session.js +8 -6
  10. package/dist/bin/pushary-codex.js +8 -8
  11. package/dist/bin/pushary-connect.js +17 -16
  12. package/dist/bin/pushary-daemon.js +23 -23
  13. package/dist/bin/pushary-disconnect.js +17 -17
  14. package/dist/bin/pushary-doctor.js +28 -26
  15. package/dist/bin/pushary-elicitation-hook.js +16 -16
  16. package/dist/bin/pushary-gemini-bridge.js +5 -5
  17. package/dist/bin/pushary-gemini-hook.js +17 -17
  18. package/dist/bin/pushary-hook.js +18 -18
  19. package/dist/bin/pushary-login.js +6 -6
  20. package/dist/bin/pushary-logout.js +16 -16
  21. package/dist/bin/pushary-mcp.js +8 -8
  22. package/dist/bin/pushary-mode.js +6 -6
  23. package/dist/bin/pushary-notification-hook.js +15 -15
  24. package/dist/bin/pushary-opencode-hook.js +16 -16
  25. package/dist/bin/pushary-permission-denied-hook.js +18 -18
  26. package/dist/bin/pushary-permission-hook.js +18 -18
  27. package/dist/bin/pushary-post-hook.js +15 -15
  28. package/dist/bin/pushary-prompt-hook.js +15 -15
  29. package/dist/bin/pushary-session-end-hook.js +15 -15
  30. package/dist/bin/pushary-session-start-hook.js +21 -21
  31. package/dist/bin/pushary-setup.js +52 -255
  32. package/dist/bin/pushary-status.js +21 -19
  33. package/dist/bin/pushary-stop-hook.js +15 -15
  34. package/dist/bin/pushary-stopfailure-hook.js +15 -15
  35. package/dist/bin/pushary-suggestions.js +6 -6
  36. package/dist/bin/pushary-transcript-register.js +8 -8
  37. package/dist/bin/pushary-upgrade.js +97 -48
  38. package/dist/bin/pushary-wait.js +6 -6
  39. package/dist/bin/pushary.js +4 -4
  40. package/dist/{chunk-DDQRYX2L.js → chunk-3KOPY2UQ.js} +1 -1
  41. package/dist/{chunk-ZU6L34DQ.js → chunk-3WNOO7BM.js} +3 -3
  42. package/dist/{chunk-RFAF3TOX.js → chunk-4JJ3T7IE.js} +93 -14
  43. package/dist/{chunk-JCMSISCC.js → chunk-4LUPZ347.js} +1 -1
  44. package/dist/{chunk-HCIB4YNB.js → chunk-5DZHKNBU.js} +1 -1
  45. package/dist/{chunk-QQYUWTYS.js → chunk-ATUZX4K7.js} +1 -1
  46. package/dist/{chunk-CB565EVO.js → chunk-CK5BCFQF.js} +1 -1
  47. package/dist/{chunk-AN6TVB2H.js → chunk-CSQJCXPX.js} +3 -3
  48. package/dist/chunk-CZULJ647.js +378 -0
  49. package/dist/{chunk-6QM54CSJ.js → chunk-DQ565WFA.js} +3 -3
  50. package/dist/chunk-FAGDOPQI.js +266 -0
  51. package/dist/{chunk-QLDTBZBP.js → chunk-HRHAZ3GE.js} +5 -5
  52. package/dist/{chunk-NQDEMRAS.js → chunk-HUWLEVL2.js} +2 -2
  53. package/dist/{chunk-SQ5G6A6K.js → chunk-IJ6XKKQW.js} +1 -1
  54. package/dist/{chunk-BAJ3A3BU.js → chunk-JZKEC4XJ.js} +4 -1
  55. package/dist/{chunk-ZZB4J6CX.js → chunk-K5CAURU5.js} +3 -3
  56. package/dist/{chunk-7OQ4AJC7.js → chunk-KIH5BDH5.js} +2 -7
  57. package/dist/{chunk-CUEUANIU.js → chunk-KSVCCSAO.js} +3 -3
  58. package/dist/{chunk-D2EETYAL.js → chunk-KW6EYFZV.js} +11 -366
  59. package/dist/{chunk-LW7IWGSV.js → chunk-MCHOBQHE.js} +4 -4
  60. package/dist/{chunk-TWLWDIFB.js → chunk-MYBCXDIL.js} +3 -1
  61. package/dist/{chunk-4QD7VE4E.js → chunk-OHD35NPC.js} +1 -1
  62. package/dist/{chunk-3IBUZQKM.js → chunk-PZOFPAPG.js} +1 -1
  63. package/dist/{chunk-YKYVDHIY.js → chunk-QDFLBTUP.js} +1 -1
  64. package/dist/{chunk-Z7Q36I4K.js → chunk-QP3XPS5U.js} +8 -4
  65. package/dist/{chunk-4YTFYILS.js → chunk-RF74KBF5.js} +4 -4
  66. package/dist/{chunk-K5SDLOFS.js → chunk-RGQEULXD.js} +6 -6
  67. package/dist/{chunk-FBKVCODG.js → chunk-S54YLXWW.js} +1 -1
  68. package/dist/{chunk-PZDMZ7LM.js → chunk-T2AC5VFQ.js} +3 -3
  69. package/dist/{chunk-OLNBYAPI.js → chunk-T2BEIPK2.js} +2 -2
  70. package/dist/{chunk-W6363YYZ.js → chunk-TN74MUMB.js} +3 -3
  71. package/dist/{chunk-2NIRYGTK.js → chunk-UMVVQXAC.js} +2 -2
  72. package/dist/{chunk-K45CFSYV.js → chunk-VLJ5C6IT.js} +1 -1
  73. package/dist/{chunk-LVZYIUSR.js → chunk-VPZ5K72D.js} +1 -1
  74. package/dist/{chunk-AEXACKDR.js → chunk-WVP6UQG3.js} +3 -3
  75. package/dist/{chunk-T45PAPOG.js → chunk-X6F4BQEE.js} +3 -3
  76. package/dist/{chunk-2PJENKRJ.js → chunk-XEJV3QSS.js} +76 -29
  77. package/dist/{chunk-IBSRULIY.js → chunk-XFUKCBPU.js} +8 -8
  78. package/dist/{chunk-UPFFO4F6.js → chunk-XWY4UW62.js} +3 -3
  79. package/dist/{chunk-DS6OR5OS.js → chunk-ZEHUWE3X.js} +3 -3
  80. package/dist/{chunk-OZSP4RIQ.js → chunk-ZJNU32VE.js} +21 -6
  81. package/dist/{chunk-A54W5A74.js → chunk-ZL3UR6M5.js} +2 -2
  82. package/dist/{codex-app-cards-switch-SVGTZ2UN.js → codex-app-cards-switch-TVKXJWXE.js} +16 -14
  83. package/dist/{codex-desktop-launch-SH7OUEEC.js → codex-desktop-launch-ROTJEEGF.js} +3 -1
  84. package/dist/{codex-session-launch-IQ57OL3N.js → codex-session-launch-VL6ZQA3N.js} +10 -10
  85. package/dist/{global-upgrade-SRCWQE7N.js → global-upgrade-IPWV5PTM.js} +13 -5
  86. package/dist/{identity-6KRUO2YO.js → identity-ARPAUNGN.js} +3 -3
  87. package/dist/{live-capabilities-RKUHAWT6.js → live-capabilities-EWTRY2HA.js} +2 -2
  88. package/dist/{paths-MUPQZNLG.js → paths-IZTNMJAQ.js} +4 -2
  89. package/dist/{reapply-YZXZCWCI.js → reapply-ILKOYYKA.js} +17 -17
  90. package/dist/src/index.js +13 -13
  91. package/dist/{upgrade-lock-JXP27UKI.js → upgrade-lock-ML73QXIG.js} +3 -5
  92. package/package.json +1 -1
@@ -14,7 +14,7 @@ import {
14
14
  checkApiKey,
15
15
  describeKeyCheck,
16
16
  keyCheckFromResponse
17
- } from "./chunk-FBKVCODG.js";
17
+ } from "./chunk-S54YLXWW.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-4YTFYILS.js";
3
+ } from "./chunk-RF74KBF5.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -360,9 +360,9 @@ var installGlobally = (options) => {
360
360
  }
361
361
  const started = (async () => {
362
362
  if (!npmIsOnPath()) throw new NpmMissingError();
363
- const { withUpgradeLock } = await import("./global-upgrade-SRCWQE7N.js");
364
- const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-JXP27UKI.js");
365
- const { autoUpdateLock } = await import("./paths-MUPQZNLG.js");
363
+ const { withUpgradeLock } = await import("./global-upgrade-IPWV5PTM.js");
364
+ const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-ML73QXIG.js");
365
+ const { autoUpdateLock } = await import("./paths-IZTNMJAQ.js");
366
366
  let result = "skipped";
367
367
  const install = async () => {
368
368
  const platform = process.platform;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  APPROVAL_SETTINGS_PATH
3
- } from "./chunk-K45CFSYV.js";
3
+ } from "./chunk-VLJ5C6IT.js";
4
4
  import {
5
5
  readMacAppAgentKey
6
- } from "./chunk-OLNBYAPI.js";
6
+ } from "./chunk-T2BEIPK2.js";
7
7
  import {
8
8
  findExportedKeyLines,
9
9
  isAdoptedMacAppKey,
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-IRZ5FVWG.js";
17
17
  import {
18
18
  absoluteUrl
19
- } from "./chunk-FBKVCODG.js";
19
+ } from "./chunk-S54YLXWW.js";
20
20
  import {
21
21
  isValidApiKey
22
22
  } from "./chunk-GZL3KEPC.js";
@@ -1,4 +1,5 @@
1
1
  import {
2
+ LAUNCHCTL,
2
3
  codexAppOnThisMac,
3
4
  codexEngineBehindLauncher,
4
5
  codexPassThroughScript,
@@ -7,13 +8,13 @@ import {
7
8
  everyProgramFileIsThere,
8
9
  installedCodexApp,
9
10
  shellQuoted
10
- } from "./chunk-OZSP4RIQ.js";
11
+ } from "./chunk-ZJNU32VE.js";
11
12
  import {
12
13
  writeHuman
13
14
  } from "./chunk-QCGNGEGE.js";
14
15
  import {
15
16
  xml
16
- } from "./chunk-Z7Q36I4K.js";
17
+ } from "./chunk-QP3XPS5U.js";
17
18
  import {
18
19
  CODEX_APP_LAUNCH_AT_LOGIN_VERB,
19
20
  CODEX_APP_LAUNCH_VARIABLE
@@ -211,7 +212,6 @@ var waitForMacAppExit = (attempts = 20, everyMs = 250) => {
211
212
  // src/codex-app-cards-switch.ts
212
213
  var CODEX_APP_CARDS_LOGIN_ITEM = "com.pushary.codex-app-cards";
213
214
  var CODEX_APP_CARDS_DIRECTORY = "codex-app";
214
- var LAUNCHCTL = "/bin/launchctl";
215
215
  var LAUNCHER_NAME = "codex";
216
216
  var RECEIPT_NAME = "turned-on.json";
217
217
  var TURNED_OFF_NAME = "turned-off";
@@ -276,14 +276,14 @@ var codexAppCardsReceiptFrom = (contents) => {
276
276
  const { entry, app, engine } = parsed;
277
277
  return Array.isArray(entry) && entry.length > 0 && entry.every(isAString) && isAString(app) && isAString(engine) && isAbsolute2(engine) ? { entry, app, engine } : null;
278
278
  };
279
+ var filesThisVersionWrites = (paths, receipt) => ({
280
+ launcherScript: desktopProxyScript(receipt.entry, receipt.app, receipt.engine, { turnsItselfOffWithoutTheEngine: true }),
281
+ loginItem: codexAppCardsLoginItem(paths.launcherPath, receipt.engine, receipt.entry)
282
+ });
279
283
  var codexAppCardsInstallation = (input) => {
280
284
  const paths = codexAppCardsPaths(input.homeDir, input.uid);
281
- return {
282
- paths,
283
- launcherScript: desktopProxyScript(input.entry, input.app, input.engine, { turnsItselfOffWithoutTheEngine: true }),
284
- loginItem: codexAppCardsLoginItem(paths.launcherPath, input.engine, input.entry),
285
- receipt: { entry: input.entry, app: input.app, engine: input.engine }
286
- };
285
+ const receipt = { entry: input.entry, app: input.app, engine: input.engine };
286
+ return { paths, ...filesThisVersionWrites(paths, receipt), receipt };
287
287
  };
288
288
  var isAbsolutePath = (value) => value.startsWith("/");
289
289
  var whatTheLauncherCannotRun = (receipt, machine) => {
@@ -292,8 +292,10 @@ var whatTheLauncherCannotRun = (receipt, machine) => {
292
292
  const missing = receipt.entry.filter(isAbsolutePath).find((path) => !machine.exists(path));
293
293
  return missing === void 0 ? null : { kind: "on_but_pushary_is_missing", missing };
294
294
  };
295
+ var LAUNCH_SETTING_NOT_READ = "The setting that starts the Codex app could not be read, so nothing was changed";
296
+ var launchVariableOrNoneWhenNotRead = (machine) => machine.launchVariable() ?? "";
295
297
  var codexAppCardsStatus = (paths, machine) => {
296
- const value = machine.launchVariable();
298
+ const value = launchVariableOrNoneWhenNotRead(machine);
297
299
  if (value.length > 0 && value !== paths.launcherPath) return { kind: "another_program_owns_the_launch", value };
298
300
  const launcherIsThere = machine.exists(paths.launcherPath);
299
301
  const setForThisLogin = value === paths.launcherPath && launcherIsThere;
@@ -306,7 +308,7 @@ var codexAppCardsStatus = (paths, machine) => {
306
308
  };
307
309
  var turnCodexAppCardsOn = (installation, machine) => {
308
310
  const { paths } = installation;
309
- const value = machine.launchVariable();
311
+ const value = launchVariableOrNoneWhenNotRead(machine);
310
312
  if (value.length > 0 && value !== paths.launcherPath) return { kind: "another_program_owns_the_launch", value };
311
313
  machine.makeDirectory(paths.launcherDirectory, PRIVATE_DIRECTORY_MODE);
312
314
  machine.writeFile(paths.launcherPath, installation.launcherScript, PRIVATE_PROGRAM_MODE);
@@ -321,7 +323,7 @@ var turnCodexAppCardsOn = (installation, machine) => {
321
323
  var setCodexAppLaunchAtLogin = (paths, machine) => {
322
324
  const isTurnedOn = machine.exists(paths.launcherPath) && machine.exists(paths.loginItemPath);
323
325
  const cannotRun = whatTheLauncherCannotRun(codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath)), machine);
324
- if (!isTurnedOn || cannotRun !== null || machine.launchVariable().length > 0) return "left_as_it_is";
326
+ if (!isTurnedOn || cannotRun !== null || launchVariableOrNoneWhenNotRead(machine).length > 0) return "left_as_it_is";
325
327
  machine.setLaunchVariable(paths.launcherPath);
326
328
  return "set";
327
329
  };
@@ -336,6 +338,7 @@ var leaveOnlyThePathToTheEngine = (paths, machine) => {
336
338
  };
337
339
  var turnCodexAppCardsOff = (paths, machine) => {
338
340
  const value = machine.launchVariable();
341
+ if (value === null) throw new Error(LAUNCH_SETTING_NOT_READ);
339
342
  const ours = value === paths.launcherPath;
340
343
  const loginItemIsThere = machine.exists(paths.loginItemPath);
341
344
  leaveOnlyThePathToTheEngine(paths, machine);
@@ -352,18 +355,28 @@ var rememberCodexAppCardsWereTurnedOff = (paths, machine) => {
352
355
  machine.writeFile(paths.turnedOffPath, "", PRIVATE_FILE_MODE);
353
356
  };
354
357
  var turnedOnByTheMacApp = (receipt) => receipt !== null && isTheMacAppsHelper(receipt.entry);
355
- var codexAppCardsReport = (paths, machine) => ({
356
- status: codexAppCardsStatus(paths, machine),
357
- codexApp: machine.codexApp(),
358
- turnedOnByTheMacApp: turnedOnByTheMacApp(codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath))),
359
- turnedOffOnPurpose: machine.exists(paths.turnedOffPath)
360
- });
358
+ var isWhatThisVersionWrites = (receipt, paths, machine) => {
359
+ if (receipt === null) return false;
360
+ const written = filesThisVersionWrites(paths, receipt);
361
+ return machine.readFile(paths.launcherPath) === written.launcherScript && machine.readFile(paths.loginItemPath) === written.loginItem;
362
+ };
363
+ var launchesOrStartsAtLogin = (paths, machine) => machine.launchVariable() === paths.launcherPath || machine.exists(paths.loginItemPath);
364
+ var offButStillLaunchedOrStartedAtLogin = (status, paths, machine) => status.kind === "off" && launchesOrStartsAtLogin(paths, machine);
365
+ var codexAppCardsReport = (paths, machine) => {
366
+ const status = codexAppCardsStatus(paths, machine);
367
+ const receipt = codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath));
368
+ return {
369
+ status,
370
+ codexApp: machine.codexApp(),
371
+ turnedOnByTheMacApp: turnedOnByTheMacApp(receipt),
372
+ turnedOffOnPurpose: machine.exists(paths.turnedOffPath),
373
+ launcher: paths.launcherPath,
374
+ launcherIsCurrent: isWhatThisVersionWrites(receipt, paths, machine),
375
+ leavesALaunchBehind: offButStillLaunchedOrStartedAtLogin(status, paths, machine)
376
+ };
377
+ };
361
378
  var isKeptOnForTheMacApp = (request, paths, machine) => request.keepWhatTheMacAppTurnedOn && turnedOnByTheMacApp(codexAppCardsReceiptFrom(machine.readFile(paths.receiptPath))) && codexAppCardsStatus(paths, machine).kind !== "off";
362
379
  var isKeptOffForTheMacApp = (request, paths, machine) => request.keepWhatTheMacAppTurnedOn && machine.exists(paths.turnedOffPath);
363
- var codexAppCardsFolderStays = (request, machine) => {
364
- const paths = codexAppCardsPaths(request.homeDir, request.uid);
365
- return isKeptOnForTheMacApp(request, paths, machine) || isKeptOffForTheMacApp(request, paths, machine);
366
- };
367
380
  var nothingIsTurnedOn = (paths, machine) => !machine.exists(paths.launcherPath) && !machine.exists(paths.loginItemPath) && machine.launchVariable() !== paths.launcherPath;
368
381
  var removeCodexAppCards = (request, machine) => {
369
382
  const paths = codexAppCardsPaths(request.homeDir, request.uid);
@@ -373,13 +386,40 @@ var removeCodexAppCards = (request, machine) => {
373
386
  return "absent";
374
387
  }
375
388
  if (isKeptOnForTheMacApp(request, paths, machine)) return "kept_for_the_mac_app";
389
+ if (machine.launchVariable() === null) throw new Error(LAUNCH_SETTING_NOT_READ);
376
390
  if (request.dryRun) return "removed";
377
391
  turnCodexAppCardsOff(paths, machine);
378
392
  machine.remove(paths.launcherDirectory);
379
393
  if (keepsTheOff) rememberCodexAppCardsWereTurnedOff(paths, machine);
380
394
  return "removed";
381
395
  };
382
- var launchctl = (args) => execFileSync2(LAUNCHCTL, [...args], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
396
+ var firstLineOf = (error) => (error instanceof Error ? error.message : String(error)).split("\n", 1)[0] ?? "";
397
+ var whatTheCleanUpLeft = (paths, machine) => machine.launchVariable() === null || launchesOrStartsAtLogin(paths, machine) ? "could_not_turn_off" : "off_but_not_tidied";
398
+ var cleanUpCodexAppCards = (request, machine) => {
399
+ const paths = codexAppCardsPaths(request.homeDir, request.uid);
400
+ try {
401
+ const outcome = removeCodexAppCards(request, machine);
402
+ return { outcome, keepsTheFolder: outcome === "kept_for_the_mac_app" || isKeptOffForTheMacApp(request, paths, machine) };
403
+ } catch (error) {
404
+ return { outcome: whatTheCleanUpLeft(paths, machine), keepsTheFolder: true, reason: firstLineOf(error) };
405
+ }
406
+ };
407
+ var codexAppCardsFolderInTheLastSweep = (cleanedUpOnThisMac) => {
408
+ if (cleanedUpOnThisMac === null) return "swept_with_the_rest";
409
+ return cleanedUpOnThisMac.keepsTheFolder ? "kept" : "left_to_the_switch";
410
+ };
411
+ var hasWhatTheCommandSaid = (error) => typeof error === "object" && error !== null && "stderr" in error;
412
+ var whyLaunchctlFailed = (error, verb) => {
413
+ const said = hasWhatTheCommandSaid(error) && typeof error.stderr === "string" ? error.stderr.split("\n").map((line) => line.trim()).find((line) => line.length > 0) : void 0;
414
+ return said ?? `launchctl ${verb} failed`;
415
+ };
416
+ var launchctl = (args) => {
417
+ try {
418
+ return execFileSync2(LAUNCHCTL, [...args], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
419
+ } catch (error) {
420
+ throw new Error(whyLaunchctlFailed(error, args[0] ?? ""));
421
+ }
422
+ };
383
423
  var launchctlIgnoringFailure = (args) => {
384
424
  try {
385
425
  return launchctl(args);
@@ -387,6 +427,13 @@ var launchctlIgnoringFailure = (args) => {
387
427
  return "";
388
428
  }
389
429
  };
430
+ var launchVariableOnThisMac = () => {
431
+ try {
432
+ return launchctl(["getenv", CODEX_APP_LAUNCH_VARIABLE]).trim();
433
+ } catch {
434
+ return null;
435
+ }
436
+ };
390
437
  var fileContents = (path) => {
391
438
  try {
392
439
  return readFileSync(path, "utf8");
@@ -396,7 +443,7 @@ var fileContents = (path) => {
396
443
  };
397
444
  var thisMacsCodexAppCardsMachine = () => ({
398
445
  codexApp: codexAppOnThisMac,
399
- launchVariable: () => launchctlIgnoringFailure(["getenv", CODEX_APP_LAUNCH_VARIABLE]).trim(),
446
+ launchVariable: launchVariableOnThisMac,
400
447
  setLaunchVariable: (value) => {
401
448
  launchctl(["setenv", CODEX_APP_LAUNCH_VARIABLE, value]);
402
449
  },
@@ -418,8 +465,7 @@ var thisMacsCodexAppCardsMachine = () => ({
418
465
  rmSync(path, { recursive: true, force: true });
419
466
  }
420
467
  });
421
- var removeCodexAppCardsFromThisMac = (request) => removeCodexAppCards(request, thisMacsCodexAppCardsMachine());
422
- var codexAppCardsFolderStaysOnThisMac = (request) => codexAppCardsFolderStays(request, thisMacsCodexAppCardsMachine());
468
+ var cleanUpCodexAppCardsOnThisMac = (request) => cleanUpCodexAppCards(request, thisMacsCodexAppCardsMachine());
423
469
  var setCodexAppLaunchAtLoginOnThisMac = () => {
424
470
  const uid = process.getuid?.();
425
471
  if (uid === void 0) return;
@@ -516,10 +562,11 @@ export {
516
562
  turnCodexAppCardsOff,
517
563
  rememberCodexAppCardsWereTurnedOff,
518
564
  codexAppCardsReport,
519
- codexAppCardsFolderStays,
520
565
  removeCodexAppCards,
521
- removeCodexAppCardsFromThisMac,
522
- codexAppCardsFolderStaysOnThisMac,
566
+ cleanUpCodexAppCards,
567
+ codexAppCardsFolderInTheLastSweep,
568
+ whyLaunchctlFailed,
569
+ cleanUpCodexAppCardsOnThisMac,
523
570
  setCodexAppLaunchAtLoginOnThisMac,
524
571
  runsFromATemporaryFolder,
525
572
  codexAppCardsStatusLine,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-2NIRYGTK.js";
3
+ } from "./chunk-UMVVQXAC.js";
4
4
  import {
5
5
  CODEX_INSTRUCTIONS_LABEL,
6
6
  GEMINI_INSTRUCTIONS_LABEL,
@@ -11,7 +11,7 @@ import {
11
11
  macAppFxBridge,
12
12
  refreshInstructionBlock,
13
13
  renderAgentInstructions
14
- } from "./chunk-NQDEMRAS.js";
14
+ } from "./chunk-HUWLEVL2.js";
15
15
  import {
16
16
  OPENCODE_HOOK_BINARY,
17
17
  agentHookOwner,
@@ -21,7 +21,7 @@ import {
21
21
  openCodeInstructionsFile,
22
22
  openCodePluginDir,
23
23
  openCodeWired
24
- } from "./chunk-PZDMZ7LM.js";
24
+ } from "./chunk-T2AC5VFQ.js";
25
25
  import {
26
26
  detectClaudeVersion
27
27
  } from "./chunk-LVWXRXT7.js";
@@ -33,7 +33,7 @@ import {
33
33
  compatibleConfigFile,
34
34
  compatibleInstructionsFile,
35
35
  hasCompatibleHooks
36
- } from "./chunk-UPFFO4F6.js";
36
+ } from "./chunk-XWY4UW62.js";
37
37
  import {
38
38
  claudeUnprovenHolds,
39
39
  claudeWired,
@@ -41,7 +41,7 @@ import {
41
41
  codexWired,
42
42
  geminiWired,
43
43
  planHooks
44
- } from "./chunk-CUEUANIU.js";
44
+ } from "./chunk-KSVCCSAO.js";
45
45
  import {
46
46
  CLAUDE_HOOK_BINARY,
47
47
  CLAUDE_HOOK_EVENTS,
@@ -52,7 +52,7 @@ import {
52
52
  needsReregistration,
53
53
  registrationSignatures,
54
54
  supportedClaudeEvents
55
- } from "./chunk-QQYUWTYS.js";
55
+ } from "./chunk-ATUZX4K7.js";
56
56
  import {
57
57
  formatVersion
58
58
  } from "./chunk-6ICPEJY5.js";
@@ -80,11 +80,11 @@ import {
80
80
  registeredCommands,
81
81
  registrationHolderOf,
82
82
  vscodePluginMcp
83
- } from "./chunk-TWLWDIFB.js";
83
+ } from "./chunk-MYBCXDIL.js";
84
84
  import {
85
85
  resolveGlobalBinDir,
86
86
  resolveGlobalBinary
87
- } from "./chunk-AEXACKDR.js";
87
+ } from "./chunk-WVP6UQG3.js";
88
88
  import {
89
89
  readJsonSafe,
90
90
  writeFileAtomic,
@@ -3,18 +3,18 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-QQYUWTYS.js";
6
+ } from "./chunk-ATUZX4K7.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  compatibleToolLookup
10
- } from "./chunk-4YTFYILS.js";
10
+ } from "./chunk-RF74KBF5.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-TWLWDIFB.js";
17
+ } from "./chunk-MYBCXDIL.js";
18
18
  import {
19
19
  HOOK_COMPATIBLE_PROFILES,
20
20
  HOOK_LOCATOR_BINARY,
@@ -10,7 +10,7 @@ import {
10
10
  describeIdleWindow,
11
11
  idleDeadlinePassed,
12
12
  startProcessOwnership
13
- } from "./chunk-CB565EVO.js";
13
+ } from "./chunk-CK5BCFQF.js";
14
14
  import {
15
15
  spawnClaude
16
16
  } from "./chunk-XHKBHWLX.js";
@@ -23,11 +23,11 @@ import {
23
23
  isWaitForAnswerResponse,
24
24
  withdrawQuestion,
25
25
  writeDegraded
26
- } from "./chunk-6QM54CSJ.js";
26
+ } from "./chunk-DQ565WFA.js";
27
27
  import {
28
28
  callMcpTool,
29
29
  isRetryable
30
- } from "./chunk-A54W5A74.js";
30
+ } from "./chunk-ZL3UR6M5.js";
31
31
  import {
32
32
  AGENT_QUESTION_DESCRIPTION_MAX,
33
33
  AGENT_QUESTION_HEADER_MAX,
@@ -165,7 +165,23 @@ var CodexAppCardLedger = class {
165
165
  }
166
166
  };
167
167
 
168
+ // src/load-once.ts
169
+ var loadedOnce = (load) => {
170
+ let loading;
171
+ const forgetAFailedLoad = (error) => {
172
+ loading = void 0;
173
+ throw error;
174
+ };
175
+ return () => {
176
+ loading ??= load().catch(forgetAFailedLoad);
177
+ return loading;
178
+ };
179
+ };
180
+
168
181
  // src/codex-desktop-proxy.ts
182
+ var loadThePhone = () => import("./api-WVXBM4MR.js");
183
+ var theFirstCardLoadsAgain = () => {
184
+ };
169
185
  var APP_SERVER_COMMAND = "app-server";
170
186
  var CONFIG_FLAGS = ["-c", "--config"];
171
187
  var CONFIG_FLAG_PREFIXES = ["-c=", "--config="];
@@ -332,10 +348,12 @@ var CodexAppCards = class {
332
348
  constructor(options) {
333
349
  this.options = options;
334
350
  this.timing = options.timing ?? USUAL_TIMING;
351
+ this.thePhone = loadedOnce(options.loadPhone ?? loadThePhone);
352
+ void this.thePhone().catch(theFirstCardLoadsAgain);
335
353
  }
336
354
  ledger = new CodexAppCardLedger();
337
355
  questions = /* @__PURE__ */ new Map();
338
- phone;
356
+ thePhone;
339
357
  stoodDown = false;
340
358
  saidAQuestionWasUnknown = false;
341
359
  timing;
@@ -376,10 +394,6 @@ var CodexAppCards = class {
376
394
  for (const question of outstanding) question.waiting.abort();
377
395
  await Promise.allSettled(outstanding.map((question) => this.cancel(question)));
378
396
  }
379
- thePhone() {
380
- this.phone ??= import("./api-RQAY3A5V.js");
381
- return this.phone;
382
- }
383
397
  questionShown(message) {
384
398
  const card = codexAppCardOf(message);
385
399
  if (card) {
@@ -695,7 +709,7 @@ var codexDesktopCommand = async (args, entry, readAccount) => {
695
709
  return runCodexDesktopProxy(engine2, args.slice(3), readAccount, { watchesForCards: layoutIsKnown });
696
710
  }
697
711
  if (args[0] === APP_CARDS_FLAG) {
698
- const { codexAppCardsCommandOnThisMac } = await import("./codex-app-cards-switch-SVGTZ2UN.js");
712
+ const { codexAppCardsCommandOnThisMac } = await import("./codex-app-cards-switch-TVKXJWXE.js");
699
713
  return codexAppCardsCommandOnThisMac(args.slice(1), entry, readAccount);
700
714
  }
701
715
  if (args.length > 2) throw new Error("Usage: pushary codex --desktop [path/to/Codex.app]");
@@ -719,6 +733,7 @@ var codexDesktopCommand = async (args, entry, readAccount) => {
719
733
 
720
734
  export {
721
735
  shellQuoted,
736
+ LAUNCHCTL,
722
737
  desktopEngineFromManifest,
723
738
  everyProgramFileIsThere,
724
739
  desktopProxyScript,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  keyCheckFromResponse
3
- } from "./chunk-FBKVCODG.js";
3
+ } from "./chunk-S54YLXWW.js";
4
4
  import {
5
5
  installNetworkDefaults
6
- } from "./chunk-HCIB4YNB.js";
6
+ } from "./chunk-5DZHKNBU.js";
7
7
  import {
8
8
  getBaseUrl
9
9
  } from "./chunk-LVDC3RUE.js";
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  CODEX_APP_CARDS_DIRECTORY,
3
3
  CODEX_APP_CARDS_LOGIN_ITEM,
4
+ cleanUpCodexAppCards,
5
+ cleanUpCodexAppCardsOnThisMac,
4
6
  codexAppCardsCommand,
5
7
  codexAppCardsCommandOnThisMac,
6
- codexAppCardsFolderStays,
7
- codexAppCardsFolderStaysOnThisMac,
8
+ codexAppCardsFolderInTheLastSweep,
8
9
  codexAppCardsInstallation,
9
10
  codexAppCardsLoginItem,
10
11
  codexAppCardsLoginScript,
@@ -15,24 +16,24 @@ import {
15
16
  codexAppCardsStatusLine,
16
17
  rememberCodexAppCardsWereTurnedOff,
17
18
  removeCodexAppCards,
18
- removeCodexAppCardsFromThisMac,
19
19
  runsFromATemporaryFolder,
20
20
  setCodexAppLaunchAtLogin,
21
21
  setCodexAppLaunchAtLoginOnThisMac,
22
22
  turnCodexAppCardsOff,
23
- turnCodexAppCardsOn
24
- } from "./chunk-2PJENKRJ.js";
25
- import "./chunk-OZSP4RIQ.js";
23
+ turnCodexAppCardsOn,
24
+ whyLaunchctlFailed
25
+ } from "./chunk-XEJV3QSS.js";
26
+ import "./chunk-ZJNU32VE.js";
26
27
  import "./chunk-XCEN33UP.js";
27
28
  import "./chunk-QCGNGEGE.js";
28
- import "./chunk-Z7Q36I4K.js";
29
+ import "./chunk-QP3XPS5U.js";
29
30
  import "./chunk-XHKBHWLX.js";
30
31
  import "./chunk-IRZ5FVWG.js";
31
32
  import "./chunk-E46NE7FB.js";
32
- import "./chunk-SQ5G6A6K.js";
33
+ import "./chunk-IJ6XKKQW.js";
33
34
  import "./chunk-7RZO6VWD.js";
34
- import "./chunk-TWLWDIFB.js";
35
- import "./chunk-AEXACKDR.js";
35
+ import "./chunk-MYBCXDIL.js";
36
+ import "./chunk-WVP6UQG3.js";
36
37
  import "./chunk-QENTGE75.js";
37
38
  import "./chunk-LVDC3RUE.js";
38
39
  import "./chunk-5SFM6XB4.js";
@@ -41,10 +42,11 @@ import "./chunk-GZL3KEPC.js";
41
42
  export {
42
43
  CODEX_APP_CARDS_DIRECTORY,
43
44
  CODEX_APP_CARDS_LOGIN_ITEM,
45
+ cleanUpCodexAppCards,
46
+ cleanUpCodexAppCardsOnThisMac,
44
47
  codexAppCardsCommand,
45
48
  codexAppCardsCommandOnThisMac,
46
- codexAppCardsFolderStays,
47
- codexAppCardsFolderStaysOnThisMac,
49
+ codexAppCardsFolderInTheLastSweep,
48
50
  codexAppCardsInstallation,
49
51
  codexAppCardsLoginItem,
50
52
  codexAppCardsLoginScript,
@@ -55,10 +57,10 @@ export {
55
57
  codexAppCardsStatusLine,
56
58
  rememberCodexAppCardsWereTurnedOff,
57
59
  removeCodexAppCards,
58
- removeCodexAppCardsFromThisMac,
59
60
  runsFromATemporaryFolder,
60
61
  setCodexAppLaunchAtLogin,
61
62
  setCodexAppLaunchAtLoginOnThisMac,
62
63
  turnCodexAppCardsOff,
63
- turnCodexAppCardsOn
64
+ turnCodexAppCardsOn,
65
+ whyLaunchctlFailed
64
66
  };
@@ -1,4 +1,5 @@
1
1
  import {
2
+ LAUNCHCTL,
2
3
  codexAppOnThisMac,
3
4
  codexDesktopCommand,
4
5
  codexEngineBehindLauncher,
@@ -10,13 +11,14 @@ import {
10
11
  installedCodexApp,
11
12
  shellQuoted,
12
13
  writeDesktopProxy
13
- } from "./chunk-OZSP4RIQ.js";
14
+ } from "./chunk-ZJNU32VE.js";
14
15
  import "./chunk-XCEN33UP.js";
15
16
  import {
16
17
  CODEX_APP_LAUNCH_VARIABLE
17
18
  } from "./chunk-E46NE7FB.js";
18
19
  export {
19
20
  CODEX_APP_LAUNCH_VARIABLE,
21
+ LAUNCHCTL,
20
22
  codexAppOnThisMac,
21
23
  codexDesktopCommand,
22
24
  codexEngineBehindLauncher,
@@ -11,11 +11,11 @@ import {
11
11
  isCodexQuestionLeftWithTheLocalClient,
12
12
  planCodexElicitation,
13
13
  reportOwnedQuestion
14
- } from "./chunk-DS6OR5OS.js";
14
+ } from "./chunk-ZEHUWE3X.js";
15
15
  import "./chunk-IUOUNRLH.js";
16
- import "./chunk-DDQRYX2L.js";
16
+ import "./chunk-3KOPY2UQ.js";
17
17
  import "./chunk-LVWXRXT7.js";
18
- import "./chunk-CB565EVO.js";
18
+ import "./chunk-CK5BCFQF.js";
19
19
  import "./chunk-VUFHYMSP.js";
20
20
  import "./chunk-JSQOHMNJ.js";
21
21
  import "./chunk-N3NSWWNU.js";
@@ -24,16 +24,16 @@ import "./chunk-6ICPEJY5.js";
24
24
  import "./chunk-XXNT4FGA.js";
25
25
  import {
26
26
  writeDegraded
27
- } from "./chunk-6QM54CSJ.js";
28
- import "./chunk-A54W5A74.js";
27
+ } from "./chunk-DQ565WFA.js";
28
+ import "./chunk-ZL3UR6M5.js";
29
29
  import "./chunk-POFBE6ZY.js";
30
- import "./chunk-FBKVCODG.js";
31
- import "./chunk-HCIB4YNB.js";
32
- import "./chunk-SQ5G6A6K.js";
30
+ import "./chunk-S54YLXWW.js";
31
+ import "./chunk-5DZHKNBU.js";
32
+ import "./chunk-IJ6XKKQW.js";
33
33
  import "./chunk-7QLSKOSU.js";
34
34
  import "./chunk-KZERVKTD.js";
35
- import "./chunk-TWLWDIFB.js";
36
- import "./chunk-AEXACKDR.js";
35
+ import "./chunk-MYBCXDIL.js";
36
+ import "./chunk-WVP6UQG3.js";
37
37
  import "./chunk-QENTGE75.js";
38
38
  import "./chunk-LVDC3RUE.js";
39
39
  import "./chunk-5SFM6XB4.js";
@@ -1,17 +1,23 @@
1
1
  import {
2
2
  finishGlobalUpgrade,
3
3
  finishUpgradeWithLock,
4
+ forgetUnfinishedUpgrade,
4
5
  globalUpgradeSubject,
5
6
  readGlobalUpgradeSubject,
7
+ recordUnfinishedUpgrade,
6
8
  upgradeInstalledPackage,
7
9
  withUpgradeLock
8
- } from "./chunk-RFAF3TOX.js";
9
- import "./chunk-7OQ4AJC7.js";
10
- import "./chunk-BAJ3A3BU.js";
10
+ } from "./chunk-4JJ3T7IE.js";
11
+ import "./chunk-KIH5BDH5.js";
12
+ import "./chunk-3KOPY2UQ.js";
13
+ import "./chunk-LVWXRXT7.js";
14
+ import "./chunk-VUFHYMSP.js";
15
+ import "./chunk-JZKEC4XJ.js";
16
+ import "./chunk-6ICPEJY5.js";
11
17
  import "./chunk-POFBE6ZY.js";
12
18
  import "./chunk-KZERVKTD.js";
13
- import "./chunk-TWLWDIFB.js";
14
- import "./chunk-AEXACKDR.js";
19
+ import "./chunk-MYBCXDIL.js";
20
+ import "./chunk-WVP6UQG3.js";
15
21
  import "./chunk-QENTGE75.js";
16
22
  import "./chunk-5SFM6XB4.js";
17
23
  import "./chunk-QTOLNRET.js";
@@ -19,8 +25,10 @@ import "./chunk-GZL3KEPC.js";
19
25
  export {
20
26
  finishGlobalUpgrade,
21
27
  finishUpgradeWithLock,
28
+ forgetUnfinishedUpgrade,
22
29
  globalUpgradeSubject,
23
30
  readGlobalUpgradeSubject,
31
+ recordUnfinishedUpgrade,
24
32
  upgradeInstalledPackage,
25
33
  withUpgradeLock
26
34
  };
@@ -2,9 +2,9 @@ import {
2
2
  getMachineId,
3
3
  getOrCreateMachineId,
4
4
  readExistingMachineId
5
- } from "./chunk-SQ5G6A6K.js";
6
- import "./chunk-TWLWDIFB.js";
7
- import "./chunk-AEXACKDR.js";
5
+ } from "./chunk-IJ6XKKQW.js";
6
+ import "./chunk-MYBCXDIL.js";
7
+ import "./chunk-WVP6UQG3.js";
8
8
  import "./chunk-QENTGE75.js";
9
9
  import "./chunk-QTOLNRET.js";
10
10
  import "./chunk-GZL3KEPC.js";
@@ -22,11 +22,11 @@ import {
22
22
  resolveControlPolicy,
23
23
  resolveProviderBinary,
24
24
  trackProviderInventory
25
- } from "./chunk-DDQRYX2L.js";
25
+ } from "./chunk-3KOPY2UQ.js";
26
26
  import "./chunk-LVWXRXT7.js";
27
27
  import "./chunk-VUFHYMSP.js";
28
28
  import "./chunk-6ICPEJY5.js";
29
- import "./chunk-AEXACKDR.js";
29
+ import "./chunk-WVP6UQG3.js";
30
30
  import "./chunk-QENTGE75.js";
31
31
  import "./chunk-QTOLNRET.js";
32
32
  import "./chunk-GZL3KEPC.js";