@pushary/agent-hooks 1.9.15 → 1.9.16

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 (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/bin/pushary-bell-hook.js +21 -21
  3. package/dist/bin/pushary-bell.js +9 -9
  4. package/dist/bin/pushary-claude.js +20 -20
  5. package/dist/bin/pushary-clean.js +26 -26
  6. package/dist/bin/pushary-codex-bridge.js +15 -15
  7. package/dist/bin/pushary-codex-hook.js +24 -24
  8. package/dist/bin/pushary-codex.js +10 -10
  9. package/dist/bin/pushary-connect.js +22 -22
  10. package/dist/bin/pushary-cowork.js +3 -3
  11. package/dist/bin/pushary-daemon.js +27 -27
  12. package/dist/bin/pushary-disconnect.js +21 -21
  13. package/dist/bin/pushary-doctor.js +30 -30
  14. package/dist/bin/pushary-elicitation-hook.js +21 -21
  15. package/dist/bin/pushary-gemini-bridge.js +11 -11
  16. package/dist/bin/pushary-gemini-hook.js +22 -22
  17. package/dist/bin/pushary-hook.js +24 -24
  18. package/dist/bin/pushary-login.js +12 -12
  19. package/dist/bin/pushary-logout.js +10 -10
  20. package/dist/bin/pushary-mcp.js +8 -8
  21. package/dist/bin/pushary-mode.js +12 -12
  22. package/dist/bin/pushary-notification-hook.js +20 -20
  23. package/dist/bin/pushary-opencode-hook.js +21 -21
  24. package/dist/bin/pushary-permission-denied-hook.js +23 -23
  25. package/dist/bin/pushary-permission-hook.js +23 -23
  26. package/dist/bin/pushary-post-hook.js +20 -20
  27. package/dist/bin/pushary-prompt-hook.js +20 -20
  28. package/dist/bin/pushary-session-end-hook.js +20 -20
  29. package/dist/bin/pushary-session-start-hook.js +24 -24
  30. package/dist/bin/pushary-setup.js +440 -114
  31. package/dist/bin/pushary-stats.js +3 -3
  32. package/dist/bin/pushary-status.js +24 -24
  33. package/dist/bin/pushary-stop-hook.js +20 -20
  34. package/dist/bin/pushary-stopfailure-hook.js +20 -20
  35. package/dist/bin/pushary-suggestions.js +12 -12
  36. package/dist/bin/pushary-transcript-register.js +13 -13
  37. package/dist/bin/pushary-transcripts.js +6 -6
  38. package/dist/bin/pushary-upgrade.js +27 -27
  39. package/dist/bin/pushary-wait.js +12 -12
  40. package/dist/bin/pushary.js +9 -6
  41. package/dist/{chunk-3FQCZSEQ.js → chunk-3DZG5EXY.js} +2 -2
  42. package/dist/{chunk-YOHPJNFW.js → chunk-4MOOSU5Y.js} +35 -24
  43. package/dist/{chunk-C2OUUGCW.js → chunk-4PQGFWPO.js} +1 -1
  44. package/dist/{chunk-HJL5RBOU.js → chunk-5ETPCIG4.js} +22 -3
  45. package/dist/{chunk-7QZZK2YU.js → chunk-65OI53N7.js} +5 -5
  46. package/dist/{chunk-COZE23R3.js → chunk-7BNU5AVD.js} +1 -1
  47. package/dist/{chunk-5BIMNGRQ.js → chunk-7DE5BZMB.js} +6 -6
  48. package/dist/{chunk-YL6HU2KF.js → chunk-7EBZRHIH.js} +4 -4
  49. package/dist/{chunk-PSWFYNOX.js → chunk-BARUIIUR.js} +2 -2
  50. package/dist/{chunk-Q4JD6WNB.js → chunk-COGQIULO.js} +1 -1
  51. package/dist/{chunk-2DCGUCPZ.js → chunk-CXXYHPN7.js} +1 -1
  52. package/dist/{chunk-6LORREOI.js → chunk-DMJPRZVJ.js} +1 -1
  53. package/dist/{chunk-5EWNGYFD.js → chunk-DUDI3Z7F.js} +2 -2
  54. package/dist/{chunk-VP6WDFVO.js → chunk-EDEIIKCV.js} +1 -1
  55. package/dist/{chunk-6WECKO24.js → chunk-EDXJEQCK.js} +3 -3
  56. package/dist/{chunk-U4TMAANR.js → chunk-FO3MDD26.js} +4 -4
  57. package/dist/{chunk-NDKFHLJI.js → chunk-HBDZYQZX.js} +3 -3
  58. package/dist/{chunk-NDZBDXU3.js → chunk-HDQAN2C3.js} +27 -8
  59. package/dist/{chunk-H5YC7H6V.js → chunk-HKSH4KWI.js} +3 -3
  60. package/dist/{chunk-OIESPH3R.js → chunk-ICEMM4H2.js} +9 -9
  61. package/dist/{chunk-IQCNOEQL.js → chunk-IHPSFUL2.js} +6 -6
  62. package/dist/{chunk-LJJWNHUW.js → chunk-ISJ5ROXM.js} +1 -1
  63. package/dist/{chunk-WJO7SENK.js → chunk-J36EWRVL.js} +5 -5
  64. package/dist/{chunk-HSVJ62BE.js → chunk-JF2XRQR2.js} +1 -1
  65. package/dist/{chunk-6MLSXBNR.js → chunk-JNZU2F5B.js} +1 -1
  66. package/dist/{chunk-5LQ7QUVF.js → chunk-JQC7ZFHM.js} +1 -1
  67. package/dist/{chunk-JEJSAI6Z.js → chunk-L52HDK35.js} +3 -3
  68. package/dist/{chunk-ZMUDVPOT.js → chunk-LJJLMU5B.js} +2 -2
  69. package/dist/{chunk-CU7Y7Y4L.js → chunk-LYEXTD64.js} +2 -2
  70. package/dist/{chunk-6GRUERVL.js → chunk-MN2QJA7K.js} +1 -1
  71. package/dist/{chunk-WBQK6KD5.js → chunk-NM6IHHRO.js} +7 -7
  72. package/dist/{chunk-3YCYTGGK.js → chunk-OEMDXBV6.js} +1 -1
  73. package/dist/{chunk-PNUWMEIY.js → chunk-OIAZ2QAC.js} +2 -1
  74. package/dist/{chunk-SDDKVY4I.js → chunk-OLJ6YZME.js} +4 -4
  75. package/dist/{chunk-HTO2XULO.js → chunk-PJNZJPPX.js} +1 -1
  76. package/dist/{chunk-ME55HQOI.js → chunk-PVOOKOKX.js} +3 -3
  77. package/dist/{chunk-3QXCTYMG.js → chunk-PYPZ3MYC.js} +2 -2
  78. package/dist/{chunk-TFV6RATK.js → chunk-PZ33VQ54.js} +4 -4
  79. package/dist/{chunk-57VUNV32.js → chunk-QINDG6HO.js} +1 -1
  80. package/dist/{chunk-7VOEZPJ4.js → chunk-QJYBHKHO.js} +1 -1
  81. package/dist/{chunk-TMQMUGSN.js → chunk-R2FHKTD3.js} +1 -1
  82. package/dist/{chunk-SYLJL63X.js → chunk-S2LU6HIZ.js} +3 -3
  83. package/dist/{chunk-VKTDXQGH.js → chunk-VKYDON4A.js} +1 -1
  84. package/dist/{chunk-JC3AGMOP.js → chunk-W2AUU35K.js} +1 -1
  85. package/dist/{chunk-D72OJS4S.js → chunk-WVSECXIM.js} +2 -2
  86. package/dist/{chunk-NA5D62OI.js → chunk-XIJMMY6M.js} +1 -1
  87. package/dist/{chunk-Y6KG5JZP.js → chunk-YHHUYJQN.js} +1 -1
  88. package/dist/{chunk-FZW7Q7GM.js → chunk-ZOMVMLMU.js} +8 -13
  89. package/dist/{global-upgrade-MOBLBPIJ.js → global-upgrade-4XWM5RXK.js} +5 -5
  90. package/dist/{paths-55SPLYW5.js → paths-2RE6MBKF.js} +1 -1
  91. package/dist/{reapply-SOIJJKGO.js → reapply-Y5PSM7U7.js} +17 -17
  92. package/dist/src/index.js +16 -16
  93. package/dist/{upgrade-lock-FER4DMDA.js → upgrade-lock-HVWZN4BZ.js} +2 -2
  94. package/package.json +1 -1
@@ -11,16 +11,16 @@ import {
11
11
  clipToRow,
12
12
  terminalColumns,
13
13
  useColor
14
- } from "./chunk-U4TMAANR.js";
14
+ } from "./chunk-FO3MDD26.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-SYLJL63X.js";
17
+ } from "./chunk-S2LU6HIZ.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-VKTDXQGH.js";
20
+ } from "./chunk-VKYDON4A.js";
21
21
  import {
22
22
  NPX_LATEST_COMMAND
23
- } from "./chunk-PNUWMEIY.js";
23
+ } from "./chunk-OIAZ2QAC.js";
24
24
  import {
25
25
  NO_PAIRING_COMPUTER,
26
26
  PAIR_TTL_SECONDS,
@@ -282,9 +282,9 @@ var describeAnswerSource = (source) => {
282
282
  switch (source) {
283
283
  case "mobile_app":
284
284
  case "mobile_background":
285
- return "A phone answered this synthetic test.";
285
+ return "Answered on your phone.";
286
286
  case "mac_app":
287
- return "A Mac answered this synthetic test.";
287
+ return "Answered on your Mac.";
288
288
  case "sandbox":
289
289
  return "This was a simulated sandbox answer.";
290
290
  default:
@@ -357,6 +357,7 @@ var yellow = paint("\x1B[33m");
357
357
  var check = green("\u2713");
358
358
  var apiBase = () => process.env.PUSHARY_API_URL?.trim() || process.env.PUSHARY_BASE_URL?.trim() || "https://pushary.com";
359
359
  var EXIT_ABORTED = 130;
360
+ var EXIT_TERMINATED = 143;
360
361
  var CONNECT_POLL_INTERVAL_MS = 2500;
361
362
  var CONNECT_TIMEOUT_MS = 18e4;
362
363
  var EMPTY_CHANNELS = {
@@ -491,10 +492,11 @@ var startSpinner = (getLabel) => {
491
492
  writeStatusLine(`${finalGlyph} ${finalLabel}`);
492
493
  };
493
494
  };
495
+ var qrRows = (qr) => qr.replace(/\n+$/, "").split("\n");
494
496
  var printQr = (url) => new Promise((resolve, reject) => {
495
497
  try {
496
498
  qrcodeTerminal.generate(url, { small: true }, (qr) => {
497
- writeHuman("\n" + qr.split("\n").map((line) => " " + line).join("\n") + "\n");
499
+ writeHuman("\n" + qrRows(qr).map((line) => " " + line).join("\n") + "\n");
498
500
  resolve();
499
501
  });
500
502
  } catch (err) {
@@ -737,7 +739,17 @@ var PAIR_TIMEOUT_MS = PAIR_TTL_SECONDS * 1e3 - PAIR_STOP_BEFORE_EXPIRY_MS;
737
739
  var PAIR_HINT_AFTER_MS = 45e3;
738
740
  var PAIR_BROWSER_FALLBACK_AFTER_MS = 6e4;
739
741
  var BROWSER_CONNECT_COMMAND = `${NPX_LATEST_COMMAND} setup --connect browser`;
740
- var PAIR_BROWSER_FALLBACK_LINE = `Still waiting? Sign in with a browser instead: Ctrl-C, then ${BROWSER_CONNECT_COMMAND}`;
742
+ var PAIR_BROWSER_FALLBACK_LINE = `Still waiting? Ctrl-C, then: ${BROWSER_CONNECT_COMMAND}`;
743
+ var PAIR_INSTALL_HINT = "No app yet? Install it, sign in, then scan the code above. Ctrl-C to stop.";
744
+ var PAIR_GET_APP_LINE = "No app yet? Get it at pushary.com/download. Setup keeps waiting.";
745
+ var describePairingScreen = (screen) => [
746
+ bold("Connect your phone"),
747
+ "Scan this with your phone's camera or the Pushary app.",
748
+ `${dim("Or open on your phone:")} ${cyan(screen.universalLink)}`,
749
+ `Your phone will show ${cyan(screen.fingerprint)}. Check it matches.`,
750
+ `${dim("Already have the app and it opened a browser? Use")} ${cyan(screen.deepLink)}`,
751
+ dim(PAIR_GET_APP_LINE)
752
+ ];
741
753
  var SYSTEM_PAIR_CLOCK = { now: () => Date.now(), sleep };
742
754
  var startPairing = async (cliPublicKey, computer) => {
743
755
  try {
@@ -841,15 +853,10 @@ var connectViaAppPairing = async (options = {}) => {
841
853
  }
842
854
  const { pairId, code } = started;
843
855
  const { qrLink, universalLink, deepLink } = buildPairLinks(pairId, keypair.publicKeyB64, apiBase(), code);
844
- console.log();
845
- console.log(` ${bold("Connect your Pushary app")}`);
846
- console.log(` ${dim("Scan this with your phone camera:")}`);
856
+ for (const line of describePairingScreen({ universalLink, fingerprint: publicKeyFingerprint(keypair.publicKeyB64), deepLink })) {
857
+ console.log(` ${line}`);
858
+ }
847
859
  await printQr(qrLink);
848
- console.log(` ${dim("No camera handy? Open this on the phone instead:")}`);
849
- console.log(` ${cyan(universalLink)}`);
850
- console.log(` ${dim("Confirm the app shows fingerprint")} ${cyan(publicKeyFingerprint(keypair.publicKeyB64))}`);
851
- console.log(` ${dim("Already have the app and it opened a browser? Use")} ${cyan(deepLink)}`);
852
- console.log();
853
860
  const startedAt = clock.now();
854
861
  const deadline = requestedAt + PAIR_TIMEOUT_MS;
855
862
  let hintShown = false;
@@ -861,20 +868,22 @@ var connectViaAppPairing = async (options = {}) => {
861
868
  }
862
869
  if (!hintShown) {
863
870
  hintShown = true;
864
- writeStatusLine(
865
- `${dim("No app yet? Install it, sign in with this account, then scan. Ctrl-C to stop.")}`
866
- );
871
+ writeStatusLine(dim(PAIR_INSTALL_HINT));
867
872
  }
868
873
  return `Waiting for the app ${dim(`(${left}m left)`)}`;
869
874
  });
870
875
  let cancelled = false;
871
- const onInterrupt = () => {
876
+ const cancelOnSignal = (exitCode) => () => {
877
+ if (cancelled) return;
872
878
  cancelled = true;
873
879
  stop(yellow("!"), "Cancelled");
874
- const flushed = options.onCancelled?.();
875
- void Promise.allSettled([Promise.resolve(flushed), cancelPairing(pairId)]).finally(() => process.exit(EXIT_ABORTED));
880
+ const flushed = options.onCancelled?.(exitCode);
881
+ void Promise.allSettled([Promise.resolve(flushed), cancelPairing(pairId)]).finally(() => process.exit(exitCode));
876
882
  };
883
+ const onInterrupt = cancelOnSignal(EXIT_ABORTED);
884
+ const onTerminate = cancelOnSignal(EXIT_TERMINATED);
877
885
  process.once("SIGINT", onInterrupt);
886
+ process.once("SIGTERM", onTerminate);
878
887
  let consecutiveFailures = 0;
879
888
  try {
880
889
  while (clock.now() < deadline) {
@@ -900,7 +909,7 @@ var connectViaAppPairing = async (options = {}) => {
900
909
  try {
901
910
  apiKey = openSealedKey(claim.sealed, keypair);
902
911
  } catch {
903
- stop(yellow("!"), "Pairing failed to decrypt \u2014 re-run setup to try again");
912
+ stop(yellow("!"), "Pairing failed to decrypt. Re-run setup to try again.");
904
913
  await cancelPairing(pairId);
905
914
  return pairFailed("decrypt");
906
915
  }
@@ -909,7 +918,7 @@ var connectViaAppPairing = async (options = {}) => {
909
918
  return { kind: "paired", apiKey, handle: claim.siteSlug };
910
919
  }
911
920
  if (claim?.status === "expired") {
912
- stop(yellow("!"), "Pairing expired \u2014 re-run setup to try again");
921
+ stop(yellow("!"), "Pairing expired. Re-run setup to try again.");
913
922
  return pairFailed("expired");
914
923
  }
915
924
  if (claim?.status === "failed") {
@@ -927,6 +936,7 @@ var connectViaAppPairing = async (options = {}) => {
927
936
  return pairFailed("unreachable");
928
937
  } finally {
929
938
  process.off("SIGINT", onInterrupt);
939
+ process.off("SIGTERM", onTerminate);
930
940
  }
931
941
  };
932
942
 
@@ -934,6 +944,7 @@ export {
934
944
  reachVerdict,
935
945
  describeReach,
936
946
  verifyRoundTrip,
947
+ describeRoundTripOutcome,
937
948
  describeRoundTrip,
938
949
  roundTripEvidence,
939
950
  fetchChannels,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-KZERVKTD.js";
4
4
  import {
5
5
  renderCommandHelp
6
- } from "./chunk-PNUWMEIY.js";
6
+ } from "./chunk-OIAZ2QAC.js";
7
7
  import {
8
8
  getPackageVersion
9
9
  } from "./chunk-AYV2NRYJ.js";
@@ -168,6 +168,23 @@ var NpmMissingError = class extends Error {
168
168
  this.name = "NpmMissingError";
169
169
  }
170
170
  };
171
+ var NpmPermissionError = class extends Error {
172
+ constructor(detail) {
173
+ super(detail);
174
+ this.name = "NpmPermissionError";
175
+ }
176
+ };
177
+ var NPM_PERMISSION_CODE = /\bE(?:ACCES|PERM)\b/;
178
+ var ERROR_TEXT_FIELDS = ["code", "stderr", "stdout", "message"];
179
+ var errorTextOf = (err) => {
180
+ if (typeof err !== "object" || err === null) return [String(err)];
181
+ return ERROR_TEXT_FIELDS.flatMap((field) => {
182
+ const value = Reflect.get(err, field);
183
+ return typeof value === "string" || Buffer.isBuffer(value) ? [value.toString()] : [];
184
+ });
185
+ };
186
+ var isNpmPermissionFailure = (err) => errorTextOf(err).some((text) => NPM_PERMISSION_CODE.test(text));
187
+ var npmInstallFailure = (err) => isNpmPermissionFailure(err) ? new NpmPermissionError(npmErrorMessage(err)) : new Error(npmErrorMessage(err));
171
188
  var resolveBinary = (name) => resolveGlobalBinary(name) ?? resolvePathBinary(name);
172
189
  var resolvePackageVersionFromBinary = (binary, packageName) => {
173
190
  try {
@@ -365,9 +382,9 @@ var installGlobally = (options) => {
365
382
  }
366
383
  const started = (async () => {
367
384
  if (!npmIsOnPath()) throw new NpmMissingError();
368
- const { withUpgradeLock } = await import("./global-upgrade-MOBLBPIJ.js");
369
- const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-FER4DMDA.js");
370
- const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-55SPLYW5.js");
385
+ const { withUpgradeLock } = await import("./global-upgrade-4XWM5RXK.js");
386
+ const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-HVWZN4BZ.js");
387
+ const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-2RE6MBKF.js");
371
388
  let result = "skipped";
372
389
  const install = async () => {
373
390
  const platform = process.platform;
@@ -848,6 +865,8 @@ export {
848
865
  npmIsOnPath,
849
866
  globalPackageState,
850
867
  NpmMissingError,
868
+ NpmPermissionError,
869
+ npmInstallFailure,
851
870
  resolveBinary,
852
871
  resolvePackageVersionFromBinary,
853
872
  resolveGlobalPackageVersion,
@@ -3,24 +3,24 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-JC3AGMOP.js";
6
+ } from "./chunk-W2AUU35K.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-TFV6RATK.js";
13
+ } from "./chunk-PZ33VQ54.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
- } from "./chunk-5EWNGYFD.js";
17
+ } from "./chunk-DUDI3Z7F.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-NA5D62OI.js";
20
+ } from "./chunk-XIJMMY6M.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-HTO2XULO.js";
23
+ } from "./chunk-PJNZJPPX.js";
24
24
  import {
25
25
  getPackageVersion
26
26
  } from "./chunk-AYV2NRYJ.js";
@@ -6,7 +6,7 @@ import {
6
6
  permissionDeniedAction,
7
7
  releaseThrottle,
8
8
  reportEvent
9
- } from "./chunk-IQCNOEQL.js";
9
+ } from "./chunk-IHPSFUL2.js";
10
10
  import {
11
11
  machineDecisionFor,
12
12
  shouldDeferToNativeMode,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-LJJWNHUW.js";
3
+ } from "./chunk-ISJ5ROXM.js";
4
4
  import {
5
5
  detectClaudeVersion
6
6
  } from "./chunk-RIVNNBEK.js";
@@ -12,12 +12,12 @@ import {
12
12
  openCodeHookArgv,
13
13
  openCodePluginDir,
14
14
  openCodeWired
15
- } from "./chunk-NDKFHLJI.js";
15
+ } from "./chunk-HBDZYQZX.js";
16
16
  import {
17
17
  addClaudeMcpServer,
18
18
  addPusharyHooks,
19
19
  addPusharyToolPermissions
20
- } from "./chunk-ME55HQOI.js";
20
+ } from "./chunk-PVOOKOKX.js";
21
21
  import {
22
22
  claudeUnprovenHolds,
23
23
  claudeWired,
@@ -25,7 +25,7 @@ import {
25
25
  codexWired,
26
26
  geminiWired,
27
27
  planHooks
28
- } from "./chunk-FZW7Q7GM.js";
28
+ } from "./chunk-ZOMVMLMU.js";
29
29
  import {
30
30
  CLAUDE_HOOK_BINARY,
31
31
  CLAUDE_HOOK_EVENTS,
@@ -36,7 +36,7 @@ import {
36
36
  needsReregistration,
37
37
  registrationSignatures,
38
38
  supportedClaudeEvents
39
- } from "./chunk-VP6WDFVO.js";
39
+ } from "./chunk-EDEIIKCV.js";
40
40
  import {
41
41
  formatVersion
42
42
  } from "./chunk-6ICPEJY5.js";
@@ -59,7 +59,7 @@ import {
59
59
  registrationHolderOf,
60
60
  resolveGlobalBinary,
61
61
  vscodePluginMcp
62
- } from "./chunk-HJL5RBOU.js";
62
+ } from "./chunk-5ETPCIG4.js";
63
63
  import {
64
64
  readJsonSafe,
65
65
  writeFileAtomic,
@@ -5,18 +5,18 @@ import {
5
5
  import {
6
6
  SubscriptionRequiredError,
7
7
  callMcpTool
8
- } from "./chunk-SYLJL63X.js";
8
+ } from "./chunk-S2LU6HIZ.js";
9
9
  import {
10
10
  installNetworkDefaults,
11
11
  isNetworkFailure
12
- } from "./chunk-3FQCZSEQ.js";
12
+ } from "./chunk-3DZG5EXY.js";
13
13
  import {
14
14
  clientReportClaims
15
- } from "./chunk-HJL5RBOU.js";
15
+ } from "./chunk-5ETPCIG4.js";
16
16
  import {
17
17
  getApiKey,
18
18
  getBaseUrl
19
- } from "./chunk-HTO2XULO.js";
19
+ } from "./chunk-PJNZJPPX.js";
20
20
  import {
21
21
  ASK_AGENT_NAME_MAX,
22
22
  ASK_QUESTION_MAX,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-3FQCZSEQ.js";
3
+ } from "./chunk-3DZG5EXY.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-KZERVKTD.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-HTO2XULO.js";
12
+ } from "./chunk-PJNZJPPX.js";
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConfigFileKey
3
- } from "./chunk-5EWNGYFD.js";
3
+ } from "./chunk-DUDI3Z7F.js";
4
4
 
5
5
  // src/bell/fleet.ts
6
6
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-HJL5RBOU.js";
3
+ } from "./chunk-5ETPCIG4.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-HTO2XULO.js";
12
+ } from "./chunk-PJNZJPPX.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-VKTDXQGH.js";
3
+ } from "./chunk-VKYDON4A.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-T7E75EKA.js";
10
10
  import {
11
11
  configFilePath
12
- } from "./chunk-HTO2XULO.js";
12
+ } from "./chunk-PJNZJPPX.js";
13
13
 
14
14
  // src/shell-alias.ts
15
15
  import { homedir } from "os";
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  isProtectedByScope,
11
11
  registerHookEntry
12
- } from "./chunk-HJL5RBOU.js";
12
+ } from "./chunk-5ETPCIG4.js";
13
13
  import {
14
14
  CLAUDE_PRETOOLUSE_MATCHER,
15
15
  HOOK_BUDGETS,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  macAppBridgeAvailable
3
- } from "./chunk-NDKFHLJI.js";
3
+ } from "./chunk-HBDZYQZX.js";
4
4
  import {
5
5
  keyPrefix
6
- } from "./chunk-5EWNGYFD.js";
6
+ } from "./chunk-DUDI3Z7F.js";
7
7
  import {
8
8
  bridgeAgentKey
9
- } from "./chunk-HJL5RBOU.js";
9
+ } from "./chunk-5ETPCIG4.js";
10
10
  import {
11
11
  readJsonSafe
12
12
  } from "./chunk-T7E75EKA.js";
@@ -72,11 +72,11 @@ var createIo = (stream = process.stdout, context = {}) => {
72
72
  process.stderr.write(`${yellow("!")} ${s}
73
73
  `);
74
74
  };
75
+ const finishedLine = (label, end) => end ? ` ${end.ok ? check() : yellow("!")} ${end.label}` : ` ${check()} ${label}`;
75
76
  const spinner = async (label, fn, options = {}) => {
76
77
  if (stream.isTTY !== true) {
77
78
  try {
78
- await fn();
79
- line(` ${check()} ${label}`);
79
+ line(finishedLine(label, await fn()));
80
80
  } catch (err) {
81
81
  line(` ${yellow("!")} ${label} ${dim(`(${describeError(err)})`)}`);
82
82
  if (!options.optional) throw err;
@@ -88,9 +88,9 @@ var createIo = (stream = process.stdout, context = {}) => {
88
88
  stream.write(`\r ${dim(SPINNER_FRAMES[frame++ % SPINNER_FRAMES.length])} ${clipToRow(label, terminalColumns(stream) - SPINNER_FRAME_WIDTH)}\x1B[K`);
89
89
  }, SPINNER_INTERVAL_MS);
90
90
  try {
91
- await fn();
91
+ const end = await fn();
92
92
  clearInterval(timer);
93
- stream.write(`\r ${check()} ${label}\x1B[K
93
+ stream.write(`\r${finishedLine(label, end)}\x1B[K
94
94
  `);
95
95
  } catch (err) {
96
96
  clearInterval(timer);
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  compatibleConfigFile
3
- } from "./chunk-ME55HQOI.js";
3
+ } from "./chunk-PVOOKOKX.js";
4
4
  import {
5
5
  hookOwnerOf,
6
6
  hookOwnerOfCommands,
7
7
  liveBridgeProbe,
8
8
  resolveBridgeStub
9
- } from "./chunk-FZW7Q7GM.js";
9
+ } from "./chunk-ZOMVMLMU.js";
10
10
  import {
11
11
  AGENT_CHOICES
12
12
  } from "./chunk-YKYFFCB5.js";
@@ -18,7 +18,7 @@ import {
18
18
  guardedArgv,
19
19
  pusharyDir,
20
20
  vscodePluginDir
21
- } from "./chunk-HJL5RBOU.js";
21
+ } from "./chunk-5ETPCIG4.js";
22
22
  import {
23
23
  readJsonSafe
24
24
  } from "./chunk-T7E75EKA.js";
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  MCP_BRIDGE_BINARY
3
- } from "./chunk-D72OJS4S.js";
3
+ } from "./chunk-WVSECXIM.js";
4
4
  import {
5
5
  KEY_FILE_MODE
6
- } from "./chunk-5EWNGYFD.js";
6
+ } from "./chunk-DUDI3Z7F.js";
7
7
  import {
8
- NpmMissingError
9
- } from "./chunk-HJL5RBOU.js";
8
+ NpmMissingError,
9
+ NpmPermissionError
10
+ } from "./chunk-5ETPCIG4.js";
10
11
  import {
11
12
  readJsonSafe,
12
13
  writeFileAtomic,
@@ -14,7 +15,7 @@ import {
14
15
  } from "./chunk-T7E75EKA.js";
15
16
  import {
16
17
  NPX_LATEST_COMMAND
17
- } from "./chunk-PNUWMEIY.js";
18
+ } from "./chunk-OIAZ2QAC.js";
18
19
 
19
20
  // src/instruction-file.ts
20
21
  import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync } from "fs";
@@ -472,21 +473,37 @@ var AgentConfigError = class extends Error {
472
473
  var configFailureKind = (readFailure) => readFailure === "unparseable" ? "config-unparseable" : "config-unreadable";
473
474
  var AGENT_FAILURE_DETAILS = {
474
475
  "not-wired": "reported success but its config is not there.",
475
- "app-account-mismatch": "Mac app hooks kept, but their Pushary account could not be matched to this setup."
476
+ "app-account-mismatch": "Pushary for Mac set it up with an account that does not match this setup, so it was left as it is."
477
+ };
478
+ var DESCRIBED_FAILURE_REMEDIES = {
479
+ "not-wired": "retry-agent",
480
+ "app-account-mismatch": "match-mac-account"
476
481
  };
477
482
  var describedAgentFailure = (agent, kind) => ({
478
483
  agent,
479
484
  kind,
480
485
  detail: AGENT_FAILURE_DETAILS[kind],
481
- remedy: "retry-agent"
486
+ remedy: DESCRIBED_FAILURE_REMEDIES[kind]
482
487
  });
488
+ var remedyForError = (error) => {
489
+ if (error instanceof NpmMissingError) return "install-node";
490
+ if (error instanceof NpmPermissionError) return "fix-npm-prefix";
491
+ return "retry-agent";
492
+ };
483
493
  var agentFailureFromError = (agent, error, describeError) => ({
484
494
  agent,
485
495
  kind: error instanceof AgentConfigError ? error.kind : "installer-error",
486
496
  detail: describeError(error),
487
- remedy: error instanceof NpmMissingError ? "install-node" : "retry-agent"
497
+ remedy: remedyForError(error)
488
498
  });
489
499
  var retryAgentCommand = (agent) => `${NPX_LATEST_COMMAND} setup --agents ${agent}`;
500
+ var takeOverHooksCommand = (agent) => `${retryAgentCommand(agent)} --take-over-hooks`;
501
+ var matchMacAccountStep = (agent, setupAccount) => `Sign Pushary for Mac into ${setupAccount ?? "this setup's account"}, or run ${takeOverHooksCommand(agent)}`;
502
+ var UNCHECKED_ACCOUNT = "an account that could not be checked";
503
+ var describeMacAccountMismatch = (mismatch) => [
504
+ `${mismatch.agentName}: Pushary for Mac uses ${mismatch.macAccount ?? UNCHECKED_ACCOUNT}. This setup uses ${mismatch.setupAccount ?? UNCHECKED_ACCOUNT}.`,
505
+ matchMacAccountStep(mismatch.agent, mismatch.setupAccount)
506
+ ];
490
507
  var REMAINING_AGENTS_CONTINUE = "Other agents will continue. Re-run setup to retry.";
491
508
  var afterAgentFailureNote = (agentsStillToSetUp) => agentsStillToSetUp > 0 ? REMAINING_AGENTS_CONTINUE : null;
492
509
  var failedAgentsContext = (configuredAgentNames) => configuredAgentNames.length > 0 ? `(configured: ${configuredAgentNames.join(", ")})` : null;
@@ -626,6 +643,8 @@ export {
626
643
  describedAgentFailure,
627
644
  agentFailureFromError,
628
645
  retryAgentCommand,
646
+ matchMacAccountStep,
647
+ describeMacAccountMismatch,
629
648
  afterAgentFailureNote,
630
649
  failedAgentsContext,
631
650
  agentFailureWire,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-ME55HQOI.js";
4
+ } from "./chunk-PVOOKOKX.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-FZW7Q7GM.js";
7
+ } from "./chunk-ZOMVMLMU.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-HJL5RBOU.js";
11
+ } from "./chunk-5ETPCIG4.js";
12
12
 
13
13
  // src/cursor-config.ts
14
14
  var hookCommandOf = (entry) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defersToNativeMode,
3
3
  reportMachineDenial
4
- } from "./chunk-COZE23R3.js";
4
+ } from "./chunk-7BNU5AVD.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
@@ -11,11 +11,11 @@ import {
11
11
  denyReasonFrom,
12
12
  isDeferAnswer,
13
13
  oncePerSession
14
- } from "./chunk-6GRUERVL.js";
14
+ } from "./chunk-MN2QJA7K.js";
15
15
  import {
16
16
  activeHookSource,
17
17
  activeIdentity
18
- } from "./chunk-ME55HQOI.js";
18
+ } from "./chunk-PVOOKOKX.js";
19
19
  import {
20
20
  DEFAULT_SESSION,
21
21
  UNNAMED_ACTION,
@@ -40,7 +40,7 @@ import {
40
40
  reportEvent,
41
41
  scopePathFor,
42
42
  settleQuestionsForToolUse
43
- } from "./chunk-IQCNOEQL.js";
43
+ } from "./chunk-IHPSFUL2.js";
44
44
  import {
45
45
  askUser,
46
46
  cancelQuestion,
@@ -51,20 +51,20 @@ import {
51
51
  requestGate,
52
52
  sendNotification,
53
53
  waitForQuestion
54
- } from "./chunk-YL6HU2KF.js";
54
+ } from "./chunk-7EBZRHIH.js";
55
55
  import {
56
56
  SubscriptionRequiredError
57
- } from "./chunk-SYLJL63X.js";
57
+ } from "./chunk-S2LU6HIZ.js";
58
58
  import {
59
59
  getMachineId
60
- } from "./chunk-NA5D62OI.js";
60
+ } from "./chunk-XIJMMY6M.js";
61
61
  import {
62
62
  getApiKey,
63
63
  getBaseUrl
64
- } from "./chunk-HTO2XULO.js";
64
+ } from "./chunk-PJNZJPPX.js";
65
65
  import {
66
66
  NPX_LATEST_COMMAND
67
- } from "./chunk-PNUWMEIY.js";
67
+ } from "./chunk-OIAZ2QAC.js";
68
68
  import {
69
69
  AGENT_QUESTION_STRATEGY,
70
70
  DECISION_STOP_REASON,
@@ -10,26 +10,26 @@ import {
10
10
  reportClientError,
11
11
  sendNotification,
12
12
  waitForAnswer
13
- } from "./chunk-YL6HU2KF.js";
13
+ } from "./chunk-7EBZRHIH.js";
14
14
  import {
15
15
  withRetry
16
- } from "./chunk-SYLJL63X.js";
16
+ } from "./chunk-S2LU6HIZ.js";
17
17
  import {
18
18
  getMachineId
19
- } from "./chunk-NA5D62OI.js";
19
+ } from "./chunk-XIJMMY6M.js";
20
20
  import {
21
21
  reportedInstallSource
22
- } from "./chunk-VKTDXQGH.js";
22
+ } from "./chunk-VKYDON4A.js";
23
23
  import {
24
24
  canonicalJson
25
- } from "./chunk-HJL5RBOU.js";
25
+ } from "./chunk-5ETPCIG4.js";
26
26
  import {
27
27
  writeFileAtomic
28
28
  } from "./chunk-T7E75EKA.js";
29
29
  import {
30
30
  getApiKey,
31
31
  getBaseUrl
32
- } from "./chunk-HTO2XULO.js";
32
+ } from "./chunk-PJNZJPPX.js";
33
33
  import {
34
34
  ACTION_BODY_MAX,
35
35
  AGENT_LABELS_BY_TYPE,
@@ -8,7 +8,7 @@ import {
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand,
10
10
  resolvePathBinary
11
- } from "./chunk-HJL5RBOU.js";
11
+ } from "./chunk-5ETPCIG4.js";
12
12
  import {
13
13
  getPackageVersion
14
14
  } from "./chunk-AYV2NRYJ.js";