@pushary/agent-hooks 1.7.2 → 1.8.0

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 (105) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +13 -1
  3. package/data/cursor-plugin/CHANGELOG.md +1 -0
  4. package/data/cursor-plugin/scripts/pushary-gate.mjs +2 -21
  5. package/data/cursor-plugin/scripts/pushary-gate.test.mjs +23 -1
  6. package/data/cursor-plugin/scripts/redaction.mjs +51 -0
  7. package/data/vscode-plugin/CHANGELOG.md +1 -0
  8. package/data/vscode-plugin/scripts/pushary-gate.mjs +1 -21
  9. package/data/vscode-plugin/scripts/redaction.mjs +51 -0
  10. package/dist/bin/pushary-bell-hook.js +23 -23
  11. package/dist/bin/pushary-bell.js +9 -9
  12. package/dist/bin/pushary-claude.js +28 -28
  13. package/dist/bin/pushary-clean.js +91 -107
  14. package/dist/bin/pushary-codex-bridge.js +18 -18
  15. package/dist/bin/pushary-codex-hook.js +42 -43
  16. package/dist/bin/pushary-codex.js +13 -13
  17. package/dist/bin/pushary-connect.js +13 -13
  18. package/dist/bin/pushary-cowork.js +5 -5
  19. package/dist/bin/pushary-daemon.js +27 -27
  20. package/dist/bin/pushary-disconnect.js +18 -18
  21. package/dist/bin/pushary-doctor.js +85 -79
  22. package/dist/bin/pushary-elicitation-hook.js +25 -25
  23. package/dist/bin/pushary-gemini-bridge.js +12 -12
  24. package/dist/bin/pushary-gemini-hook.js +29 -30
  25. package/dist/bin/pushary-hook.js +32 -32
  26. package/dist/bin/pushary-login.js +12 -12
  27. package/dist/bin/pushary-logout.js +7 -7
  28. package/dist/bin/pushary-mcp.js +85 -28
  29. package/dist/bin/pushary-mode.js +9 -9
  30. package/dist/bin/pushary-notification-hook.js +28 -28
  31. package/dist/bin/pushary-opencode-hook.js +28 -29
  32. package/dist/bin/pushary-permission-denied-hook.js +32 -32
  33. package/dist/bin/pushary-permission-hook.js +31 -31
  34. package/dist/bin/pushary-post-hook.js +28 -28
  35. package/dist/bin/pushary-prompt-hook.js +28 -28
  36. package/dist/bin/pushary-session-end-hook.js +28 -28
  37. package/dist/bin/pushary-session-start-hook.js +32 -32
  38. package/dist/bin/pushary-setup.js +60 -127
  39. package/dist/bin/pushary-stats.js +5 -5
  40. package/dist/bin/pushary-status.js +15 -15
  41. package/dist/bin/pushary-stop-hook.js +28 -28
  42. package/dist/bin/pushary-stopfailure-hook.js +28 -28
  43. package/dist/bin/pushary-suggestions.js +4 -4
  44. package/dist/bin/pushary-transcript-register.js +19 -19
  45. package/dist/bin/pushary-transcripts.js +7 -7
  46. package/dist/bin/pushary-upgrade.js +231 -105
  47. package/dist/bin/pushary-wait.js +9 -9
  48. package/dist/bin/pushary.js +6 -6
  49. package/dist/{chunk-VQDJ6KB3.js → chunk-2ABTSGFT.js} +3 -3
  50. package/dist/{chunk-UFNBKYWT.js → chunk-2OY3ZZ5N.js} +3 -3
  51. package/dist/{chunk-A6WQF7FQ.js → chunk-3EVPNIBE.js} +3 -3
  52. package/dist/{chunk-L6IF4JOF.js → chunk-6J2JC2RT.js} +3 -3
  53. package/dist/{chunk-3NSRL5E7.js → chunk-7Z7Q4GGS.js} +2 -2
  54. package/dist/{chunk-NYBZJ44G.js → chunk-A2A2YTMG.js} +108 -25
  55. package/dist/{chunk-SKEW3TQX.js → chunk-AHV4LNB5.js} +1 -1
  56. package/dist/{chunk-KAJT6HPI.js → chunk-AXPCESYO.js} +3 -3
  57. package/dist/{chunk-JMSB6CJT.js → chunk-C2WCPBF7.js} +1 -1
  58. package/dist/chunk-CJVVKOSR.js +73 -0
  59. package/dist/{chunk-2B4XCMH6.js → chunk-CULUZTWQ.js} +283 -41
  60. package/dist/{chunk-6QZK4O36.js → chunk-CVQYGMSR.js} +4 -4
  61. package/dist/{chunk-SEIZQZEE.js → chunk-D2FX3EPW.js} +1 -1
  62. package/dist/{chunk-LI3C2IQY.js → chunk-DB3ONZB4.js} +2 -2
  63. package/dist/{chunk-YU54LNC6.js → chunk-DE4Y6TCC.js} +6 -6
  64. package/dist/{chunk-65RN6ZCO.js → chunk-E4FJTUH4.js} +1 -1
  65. package/dist/{chunk-RLRDPZG4.js → chunk-EPCXUP3P.js} +3 -1
  66. package/dist/{chunk-OXEF6JHD.js → chunk-EX3GAPA4.js} +1 -1
  67. package/dist/{chunk-E3PLF7YB.js → chunk-EYK3GSRH.js} +4 -4
  68. package/dist/{chunk-SJN64NJX.js → chunk-GPEGOGRJ.js} +1 -1
  69. package/dist/chunk-GU3EJCVV.js +43 -0
  70. package/dist/{chunk-YNJ2H2FD.js → chunk-HQ6G3B5R.js} +2 -2
  71. package/dist/{chunk-6NHXKTQU.js → chunk-HZVVNGEW.js} +2 -2
  72. package/dist/{chunk-ZUKZJQGR.js → chunk-IPVKH2ST.js} +1 -1
  73. package/dist/{chunk-T3PRPFDY.js → chunk-J5TIV3J6.js} +5 -5
  74. package/dist/{chunk-F6BMJOSW.js → chunk-JU6W3XAU.js} +1 -1
  75. package/dist/{chunk-AWZNDM3B.js → chunk-JYG4B33G.js} +1 -1
  76. package/dist/{chunk-ZMWX5SDA.js → chunk-JZTHGAPA.js} +8 -8
  77. package/dist/{chunk-3RO2UWJQ.js → chunk-KGDWDSNL.js} +2 -2
  78. package/dist/{chunk-MY3UZO5U.js → chunk-KVQBWI5T.js} +3 -3
  79. package/dist/{chunk-HOIGXMI7.js → chunk-LXQ5FBBD.js} +1 -1
  80. package/dist/{chunk-D4OGEWLH.js → chunk-M5ICYGHT.js} +3 -3
  81. package/dist/{chunk-YLCSKVQQ.js → chunk-M5JDZ45W.js} +4 -4
  82. package/dist/{chunk-SKMWPXGV.js → chunk-MDEPU45E.js} +183 -28
  83. package/dist/{chunk-R7ZETVNR.js → chunk-MPWXGONV.js} +3 -3
  84. package/dist/{chunk-2XOHXZRC.js → chunk-NGDD6TXY.js} +20 -5
  85. package/dist/{chunk-WWTLAZQA.js → chunk-NQTHFF4W.js} +178 -39
  86. package/dist/{chunk-KLXYMPTM.js → chunk-OKXS7WDZ.js} +1 -1
  87. package/dist/{chunk-Q7CDBJXU.js → chunk-OLQRRFBX.js} +1 -1
  88. package/dist/{chunk-VSGKQ3HI.js → chunk-P7WQEVWA.js} +2 -2
  89. package/dist/{chunk-UUTWHVSV.js → chunk-Q7E4I6UA.js} +28 -16
  90. package/dist/{chunk-WXIVUIXA.js → chunk-R7437YI3.js} +2 -2
  91. package/dist/{chunk-5GIBNUBD.js → chunk-RHR6NARM.js} +2 -2
  92. package/dist/{chunk-QSZ37ROP.js → chunk-SAXBC4AZ.js} +1 -1
  93. package/dist/{chunk-U3MS6D5X.js → chunk-SIFVFP6T.js} +1 -1
  94. package/dist/{chunk-TVJYGZXB.js → chunk-SLFABHW3.js} +40 -10
  95. package/dist/{chunk-M2JGLFFS.js → chunk-TY4JT7W3.js} +1 -1
  96. package/dist/{chunk-YU4222G2.js → chunk-UI36QSBI.js} +28 -16
  97. package/dist/{chunk-OJRB5QKN.js → chunk-VQKRG3AC.js} +6 -6
  98. package/dist/{chunk-4S7CCOXB.js → chunk-WE2J62NC.js} +31 -17
  99. package/dist/{chunk-PWNQGITG.js → chunk-ZSZSSJCV.js} +1 -1
  100. package/dist/{chunk-I7B2DNVU.js → chunk-ZVSKMPBZ.js} +1 -1
  101. package/dist/{reapply-D6RSDYCK.js → reapply-CW3MA66V.js} +9 -9
  102. package/dist/src/index.js +20 -20
  103. package/package.json +1 -1
  104. package/dist/chunk-INR3RVQ3.js +0 -92
  105. package/dist/chunk-IZVAVXHQ.js +0 -255
@@ -3,23 +3,25 @@ import {
3
3
  } from "./chunk-POFBE6ZY.js";
4
4
  import {
5
5
  autoUpdateState
6
- } from "./chunk-NYBZJ44G.js";
6
+ } from "./chunk-A2A2YTMG.js";
7
7
  import {
8
8
  readJsonSafe,
9
9
  writeJsonAtomic
10
10
  } from "./chunk-T7E75EKA.js";
11
11
  import {
12
+ CLI_PACKAGE_NAMES,
13
+ POSIX_GLOBAL_ROOT_SEGMENTS,
14
+ cliPackagePathSegments,
15
+ globalUpgradeEntry,
12
16
  ownPackageRoot
13
- } from "./chunk-WWTLAZQA.js";
17
+ } from "./chunk-NQTHFF4W.js";
14
18
 
15
19
  // src/auto-update.ts
16
20
  import { spawn } from "child_process";
17
- import { dirname, join } from "path";
21
+ import { dirname } from "path";
18
22
  var AUTO_UPDATE_DISABLE_ENV = "PUSHARY_DISABLE_AUTOUPDATE";
19
23
  var AUTO_UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1e3;
20
24
  var AUTO_UPDATE_FLAG = "--auto";
21
- var GLOBAL_PACKAGE_SUBPATH = "/lib/node_modules/@pushary/agent-hooks";
22
- var UPGRADE_ENTRY_SUBPATH = ["dist", "bin", "pushary-upgrade.js"];
23
25
  var NON_GLOBAL_INSTALL_SEGMENTS = ["/_npx/", "/.volta/"];
24
26
  var AUTO_UPDATE_RESULTS = ["updated", "current", "needs_manual", "failed", "finish_pending"];
25
27
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -55,14 +57,24 @@ var autoUpdateOffReason = (input) => {
55
57
  if (input.platform === "linux") return "linux";
56
58
  return null;
57
59
  };
58
- var globalInstallPrefix = (packageRoot) => {
59
- const root = packageRoot.replace(/\/+$/, "");
60
- if (!root.endsWith(GLOBAL_PACKAGE_SUBPATH)) return null;
61
- if (NON_GLOBAL_INSTALL_SEGMENTS.some((segment) => root.includes(segment))) return null;
62
- const prefix = root.slice(0, -GLOBAL_PACKAGE_SUBPATH.length);
60
+ var globalPackageSubpath = (name) => `/${[...POSIX_GLOBAL_ROOT_SEGMENTS, ...cliPackagePathSegments(name)].join("/")}`;
61
+ var prefixOfGlobalPackage = (root, name) => {
62
+ const subpath = globalPackageSubpath(name);
63
+ if (!root.endsWith(subpath)) return null;
64
+ const prefix = root.slice(0, -subpath.length);
63
65
  return prefix.startsWith("/") ? prefix : null;
64
66
  };
65
- var upgradeEntryFor = (prefix) => join(prefix, GLOBAL_PACKAGE_SUBPATH, ...UPGRADE_ENTRY_SUBPATH);
67
+ var isNonGlobalInstall = (root) => NON_GLOBAL_INSTALL_SEGMENTS.some((segment) => root.includes(segment));
68
+ var globalInstallLocation = (packageRoot) => {
69
+ const root = packageRoot.replace(/\/+$/, "");
70
+ if (isNonGlobalInstall(root)) return null;
71
+ for (const packageName of CLI_PACKAGE_NAMES) {
72
+ const prefix = prefixOfGlobalPackage(root, packageName);
73
+ if (prefix !== null) return { prefix, packageName };
74
+ }
75
+ return null;
76
+ };
77
+ var upgradeEntryFor = (location, platform = process.platform) => globalUpgradeEntry(location.prefix, location.packageName, platform);
66
78
  var checkedWithinInterval = (lastCheckAt, now) => {
67
79
  const last = lastCheckAt === void 0 ? Number.NaN : Date.parse(lastCheckAt);
68
80
  if (Number.isNaN(last)) return false;
@@ -73,10 +85,10 @@ var autoUpdateDecision = (input) => {
73
85
  if (input.isSubagentStart) return { kind: "skip", reason: "subagent_start" };
74
86
  const offReason = autoUpdateOffReason(input);
75
87
  if (offReason !== null) return { kind: "skip", reason: offReason };
76
- const prefix = input.packageRoot === void 0 ? null : globalInstallPrefix(input.packageRoot);
77
- if (prefix === null) return { kind: "skip", reason: "not_global_install" };
88
+ const location = input.packageRoot === void 0 ? null : globalInstallLocation(input.packageRoot);
89
+ if (location === null) return { kind: "skip", reason: "not_global_install" };
78
90
  if (checkedWithinInterval(input.state.lastCheckAt, input.now)) return { kind: "skip", reason: "checked_recently" };
79
- return { kind: "check", prefix };
91
+ return { kind: "check", ...location };
80
92
  };
81
93
  var parseAutoUpdateFlag = (args) => {
82
94
  const token = args.find((arg) => arg === AUTO_UPDATE_FLAG || arg.startsWith(`${AUTO_UPDATE_FLAG}=`));
@@ -141,7 +153,7 @@ var triggerAutoUpdate = (trigger) => {
141
153
  if (decision.kind === "skip") return decision;
142
154
  updateAutoUpdateState(statePath, { lastCheckAt: new Date(now).toISOString() });
143
155
  const spawnUpgrade = trigger.spawn ?? spawnDetached;
144
- spawnUpgrade(trigger.execPath ?? process.execPath, [upgradeEntryFor(decision.prefix), AUTO_UPDATE_FLAG], dirname(statePath));
156
+ spawnUpgrade(trigger.execPath ?? process.execPath, [upgradeEntryFor(decision), AUTO_UPDATE_FLAG], dirname(statePath));
145
157
  return decision;
146
158
  } catch {
147
159
  return null;
@@ -152,7 +164,7 @@ export {
152
164
  AUTO_UPDATE_DISABLE_ENV,
153
165
  isAutoUpdateDisabledByEnv,
154
166
  autoUpdateOffReason,
155
- globalInstallPrefix,
167
+ globalInstallLocation,
156
168
  upgradeEntryFor,
157
169
  parseAutoUpdateFlag,
158
170
  describeAutoUpdateCheck,
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  detectClaudeVersion
3
- } from "./chunk-U3MS6D5X.js";
3
+ } from "./chunk-SIFVFP6T.js";
4
4
  import {
5
5
  ensureCodexTrustsPusharyHooks
6
- } from "./chunk-5GIBNUBD.js";
6
+ } from "./chunk-RHR6NARM.js";
7
7
  import {
8
8
  addClaudeMcpServer,
9
9
  addPusharyHooks,
10
10
  addPusharyToolPermissions
11
- } from "./chunk-KAJT6HPI.js";
11
+ } from "./chunk-AXPCESYO.js";
12
12
  import {
13
13
  claudeUnprovenHolds,
14
14
  claudeWired,
15
15
  codexUnprovenHolds,
16
16
  codexWired,
17
17
  geminiWired
18
- } from "./chunk-L6IF4JOF.js";
18
+ } from "./chunk-6J2JC2RT.js";
19
19
  import {
20
20
  CLAUDE_HOOK_BINARY,
21
21
  CLAUDE_HOOK_EVENTS,
@@ -27,7 +27,7 @@ import {
27
27
  needsReregistration,
28
28
  registrationSignatures,
29
29
  supportedClaudeEvents
30
- } from "./chunk-A6WQF7FQ.js";
30
+ } from "./chunk-3EVPNIBE.js";
31
31
  import {
32
32
  CODEX_HOOK_BINARY,
33
33
  addCodexHookTrust,
@@ -47,7 +47,7 @@ import {
47
47
  registrationHolderOf,
48
48
  resolveGlobalBinary,
49
49
  vscodePluginMcp
50
- } from "./chunk-NYBZJ44G.js";
50
+ } from "./chunk-A2A2YTMG.js";
51
51
  import {
52
52
  readJsonSafe,
53
53
  writeFileAtomic,
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  readControlMode
7
- } from "./chunk-VSGKQ3HI.js";
7
+ } from "./chunk-P7WQEVWA.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-HOIGXMI7.js";
10
+ } from "./chunk-LXQ5FBBD.js";
11
11
  import {
12
12
  pusharyDir,
13
13
  resolveGlobalBinary
14
- } from "./chunk-NYBZJ44G.js";
14
+ } from "./chunk-A2A2YTMG.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -20,10 +20,14 @@ import {
20
20
  } from "./chunk-T7E75EKA.js";
21
21
  import {
22
22
  getApiKey
23
- } from "./chunk-SJN64NJX.js";
23
+ } from "./chunk-GPEGOGRJ.js";
24
24
  import {
25
- getPackageVersion
26
- } from "./chunk-WWTLAZQA.js";
25
+ CLI_PACKAGE_NAMES,
26
+ cmdShimTarget,
27
+ getPackageVersion,
28
+ globalPackageFolder,
29
+ globalRootFor
30
+ } from "./chunk-NQTHFF4W.js";
27
31
 
28
32
  // src/daemon-lifecycle.ts
29
33
  import { dirname, join, win32 as win32Path } from "path";
@@ -279,6 +283,26 @@ WantedBy=default.target
279
283
  }
280
284
  return null;
281
285
  };
286
+ var WINDOWS_DAEMON_ENTRY_SEGMENTS = ["dist", "bin", "pushary-daemon.js"];
287
+ var WINDOWS_CMD_SHIM = /\.cmd$/i;
288
+ var readTextFile = (path) => readFileSync(path, "utf8");
289
+ var windowsShimTarget = (shim, readFile) => {
290
+ if (!WINDOWS_CMD_SHIM.test(shim)) return void 0;
291
+ try {
292
+ return cmdShimTarget(win32Path.dirname(shim), readFile(shim));
293
+ } catch {
294
+ return void 0;
295
+ }
296
+ };
297
+ var windowsPackageDaemonEntries = (globalPrefix) => {
298
+ const root = globalRootFor(globalPrefix, "win32");
299
+ return CLI_PACKAGE_NAMES.map((name) => win32Path.join(globalPackageFolder(root, name, "win32"), ...WINDOWS_DAEMON_ENTRY_SEGMENTS));
300
+ };
301
+ var windowsDaemonEntryCandidates = (shim, readFile) => {
302
+ const shimEntry = windowsShimTarget(shim, readFile);
303
+ const packageEntries = windowsPackageDaemonEntries(win32Path.dirname(shim));
304
+ return shimEntry === void 0 ? packageEntries : [shimEntry, ...packageEntries];
305
+ };
282
306
  var resolveDaemonServiceDefinition = (options = {}) => {
283
307
  const platform = options.platform ?? process.platform;
284
308
  const exists = options.entryExists ?? existsSync;
@@ -286,17 +310,7 @@ var resolveDaemonServiceDefinition = (options = {}) => {
286
310
  let daemonEntry = options.daemonEntry;
287
311
  if (!daemonEntry && globalBinary) {
288
312
  if (platform === "win32") {
289
- const globalRoot = win32Path.dirname(globalBinary);
290
- const candidate = win32Path.join(
291
- globalRoot,
292
- "node_modules",
293
- "@pushary",
294
- "agent-hooks",
295
- "dist",
296
- "bin",
297
- "pushary-daemon.js"
298
- );
299
- if (exists(candidate)) daemonEntry = candidate;
313
+ daemonEntry = windowsDaemonEntryCandidates(globalBinary, options.readFile ?? readTextFile).find((candidate) => exists(candidate));
300
314
  } else {
301
315
  try {
302
316
  const candidate = (options.realpath ?? realpathSync)(globalBinary);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-NYBZJ44G.js";
3
+ } from "./chunk-A2A2YTMG.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-T7E75EKA.js";
@@ -9,7 +9,7 @@ import {
9
9
  SETUP_CONNECT_MODES,
10
10
  isSetupConnectMode,
11
11
  isValidApiKey
12
- } from "./chunk-WWTLAZQA.js";
12
+ } from "./chunk-NQTHFF4W.js";
13
13
 
14
14
  // src/setup/options.ts
15
15
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -9,17 +9,17 @@ import {
9
9
  reapplyGeminiSettings,
10
10
  reapplyVsCodePlugin,
11
11
  repairCodexHolds
12
- } from "./chunk-OJRB5QKN.js";
13
- import "./chunk-U3MS6D5X.js";
14
- import "./chunk-5GIBNUBD.js";
15
- import "./chunk-KAJT6HPI.js";
16
- import "./chunk-L6IF4JOF.js";
17
- import "./chunk-A6WQF7FQ.js";
12
+ } from "./chunk-VQKRG3AC.js";
13
+ import "./chunk-SIFVFP6T.js";
14
+ import "./chunk-RHR6NARM.js";
15
+ import "./chunk-AXPCESYO.js";
16
+ import "./chunk-6J2JC2RT.js";
17
+ import "./chunk-3EVPNIBE.js";
18
18
  import "./chunk-XHKBHWLX.js";
19
- import "./chunk-RLRDPZG4.js";
20
- import "./chunk-NYBZJ44G.js";
19
+ import "./chunk-EPCXUP3P.js";
20
+ import "./chunk-A2A2YTMG.js";
21
21
  import "./chunk-T7E75EKA.js";
22
- import "./chunk-WWTLAZQA.js";
22
+ import "./chunk-NQTHFF4W.js";
23
23
  export {
24
24
  ensureCodexTrustAfterReapply,
25
25
  inspectConfiguredManagedProviders,
package/dist/src/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-UUTWHVSV.js";
4
- import "../chunk-T3PRPFDY.js";
5
- import "../chunk-KAJT6HPI.js";
6
- import "../chunk-IZVAVXHQ.js";
7
- import "../chunk-F6BMJOSW.js";
3
+ } from "../chunk-Q7E4I6UA.js";
4
+ import "../chunk-J5TIV3J6.js";
5
+ import "../chunk-AXPCESYO.js";
6
+ import "../chunk-CJVVKOSR.js";
7
+ import "../chunk-JU6W3XAU.js";
8
8
  import "../chunk-5OP5MQI7.js";
9
- import "../chunk-A6WQF7FQ.js";
9
+ import "../chunk-3EVPNIBE.js";
10
10
  import {
11
11
  fetchAccountPublicKey
12
- } from "../chunk-QSZ37ROP.js";
12
+ } from "../chunk-SAXBC4AZ.js";
13
13
  import {
14
14
  fetchModeOverride,
15
15
  fetchModeState,
@@ -18,33 +18,33 @@ import {
18
18
  handlePostToolUse,
19
19
  handleStop,
20
20
  reportEvent
21
- } from "../chunk-2B4XCMH6.js";
21
+ } from "../chunk-CULUZTWQ.js";
22
22
  import "../chunk-N6IOSZOE.js";
23
- import "../chunk-RLRDPZG4.js";
23
+ import "../chunk-EPCXUP3P.js";
24
24
  import {
25
25
  askUser,
26
26
  cancelQuestion,
27
27
  waitForAnswer
28
- } from "../chunk-2XOHXZRC.js";
29
- import "../chunk-6QZK4O36.js";
28
+ } from "../chunk-NGDD6TXY.js";
29
+ import "../chunk-CVQYGMSR.js";
30
30
  import "../chunk-POFBE6ZY.js";
31
- import "../chunk-D4OGEWLH.js";
32
- import "../chunk-VQDJ6KB3.js";
33
- import "../chunk-UFNBKYWT.js";
34
- import "../chunk-HOIGXMI7.js";
31
+ import "../chunk-M5ICYGHT.js";
32
+ import "../chunk-2ABTSGFT.js";
33
+ import "../chunk-2OY3ZZ5N.js";
34
+ import "../chunk-LXQ5FBBD.js";
35
35
  import "../chunk-7QLSKOSU.js";
36
36
  import "../chunk-KZERVKTD.js";
37
- import "../chunk-LI3C2IQY.js";
38
- import "../chunk-NYBZJ44G.js";
37
+ import "../chunk-DB3ONZB4.js";
38
+ import "../chunk-A2A2YTMG.js";
39
39
  import "../chunk-T7E75EKA.js";
40
40
  import {
41
41
  getApiKey,
42
42
  getBaseUrl
43
- } from "../chunk-SJN64NJX.js";
44
- import "../chunk-65RN6ZCO.js";
43
+ } from "../chunk-GPEGOGRJ.js";
44
+ import "../chunk-E4FJTUH4.js";
45
45
  import {
46
46
  resolvePolicy
47
- } from "../chunk-WWTLAZQA.js";
47
+ } from "../chunk-NQTHFF4W.js";
48
48
  export {
49
49
  askUser,
50
50
  cancelQuestion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,92 +0,0 @@
1
- import {
2
- NpmMissingError
3
- } from "./chunk-NYBZJ44G.js";
4
- import {
5
- NPX_LATEST_COMMAND
6
- } from "./chunk-65RN6ZCO.js";
7
-
8
- // src/setup/agent-failure.ts
9
- var AgentConfigError = class extends Error {
10
- kind;
11
- filePath;
12
- constructor(kind, filePath, message) {
13
- super(message);
14
- this.name = "AgentConfigError";
15
- this.kind = kind;
16
- this.filePath = filePath;
17
- }
18
- };
19
- var configFailureKind = (readFailure) => readFailure === "unparseable" ? "config-unparseable" : "config-unreadable";
20
- var AGENT_FAILURE_DETAILS = {
21
- "not-wired": "reported success but its config is not there.",
22
- "app-account-mismatch": "Mac app hooks kept, but their Pushary account could not be matched to this setup."
23
- };
24
- var describedAgentFailure = (agent, kind) => ({
25
- agent,
26
- kind,
27
- detail: AGENT_FAILURE_DETAILS[kind],
28
- remedy: "retry-agent"
29
- });
30
- var agentFailureFromError = (agent, error, describeError) => ({
31
- agent,
32
- kind: error instanceof AgentConfigError ? error.kind : "installer-error",
33
- detail: describeError(error),
34
- remedy: error instanceof NpmMissingError ? "install-node" : "retry-agent"
35
- });
36
- var retryAgentCommand = (agent) => `${NPX_LATEST_COMMAND} setup --agents ${agent}`;
37
- var REMAINING_AGENTS_CONTINUE = "Other agents will continue. Re-run setup to retry.";
38
- var afterAgentFailureNote = (agentsStillToSetUp) => agentsStillToSetUp > 0 ? REMAINING_AGENTS_CONTINUE : null;
39
- var failedAgentsContext = (configuredAgentNames) => configuredAgentNames.length > 0 ? `(configured: ${configuredAgentNames.join(", ")})` : null;
40
- var agentFailureWire = (failures) => failures.map(({ agent, kind }) => ({ agent, kind }));
41
-
42
- // src/diagnostics/service-runtime.ts
43
- var unescapeXml = (value) => value.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
44
- var unquoteSystemd = (value) => value.replaceAll('\\"', '"').replaceAll("\\\\", "\\").replaceAll("%%", "%");
45
- var readServiceExecPath = (contents, platform) => {
46
- if (platform === "darwin") {
47
- const program = contents.match(/<key>ProgramArguments<\/key>\s*<array>\s*<string>([^<]*)<\/string>/)?.[1];
48
- return program ? unescapeXml(program) : null;
49
- }
50
- if (platform === "linux") {
51
- const exec = contents.match(/^ExecStart="((?:[^"\\]|\\.)*)"/m)?.[1];
52
- return exec ? unquoteSystemd(exec) : null;
53
- }
54
- if (platform === "win32") {
55
- const command = contents.match(/<Command>([^<]*)<\/Command>/)?.[1];
56
- return command ? unescapeXml(command) : null;
57
- }
58
- return null;
59
- };
60
- var MANAGER_SEGMENTS = [
61
- [".nvm", "nvm"],
62
- ["nvm", "nvm"],
63
- ["fnm", "fnm"],
64
- [".fnm", "fnm"],
65
- [".volta", "volta"],
66
- ["volta", "volta"],
67
- [".asdf", "asdf"],
68
- ["asdf", "asdf"]
69
- ];
70
- var versionManagerOf = (execPath) => {
71
- const segments = execPath.split(/[/\\]/);
72
- for (const segment of segments) {
73
- const hit = MANAGER_SEGMENTS.find(([name]) => name === segment);
74
- if (hit) return hit[1];
75
- }
76
- return null;
77
- };
78
- var describeVersionManagerPin = (execPath, manager) => `The background service is pinned to ${execPath}, which ${manager} manages. Switching Node versions strands it; run pushary daemon install afterwards.`;
79
-
80
- export {
81
- AgentConfigError,
82
- configFailureKind,
83
- describedAgentFailure,
84
- agentFailureFromError,
85
- retryAgentCommand,
86
- afterAgentFailureNote,
87
- failedAgentsContext,
88
- agentFailureWire,
89
- readServiceExecPath,
90
- versionManagerOf,
91
- describeVersionManagerPin
92
- };