@pushary/agent-hooks 1.8.1 → 1.8.3

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 (72) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/bin/pushary-bell-hook.js +12 -11
  3. package/dist/bin/pushary-bell.js +2 -2
  4. package/dist/bin/pushary-claude.js +16 -15
  5. package/dist/bin/pushary-clean.js +19 -18
  6. package/dist/bin/pushary-codex-bridge.js +14 -12
  7. package/dist/bin/pushary-codex-hook.js +19 -18
  8. package/dist/bin/pushary-codex.js +8 -8
  9. package/dist/bin/pushary-connect.js +7 -7
  10. package/dist/bin/pushary-daemon.js +92 -25
  11. package/dist/bin/pushary-disconnect.js +12 -11
  12. package/dist/bin/pushary-doctor.js +24 -21
  13. package/dist/bin/pushary-elicitation-hook.js +15 -14
  14. package/dist/bin/pushary-gemini-bridge.js +9 -6
  15. package/dist/bin/pushary-gemini-hook.js +17 -16
  16. package/dist/bin/pushary-hook.js +20 -19
  17. package/dist/bin/pushary-login.js +5 -5
  18. package/dist/bin/pushary-logout.js +1 -1
  19. package/dist/bin/pushary-mcp.js +6 -6
  20. package/dist/bin/pushary-mode.js +5 -5
  21. package/dist/bin/pushary-notification-hook.js +18 -17
  22. package/dist/bin/pushary-opencode-hook.js +16 -15
  23. package/dist/bin/pushary-permission-denied-hook.js +20 -19
  24. package/dist/bin/pushary-permission-hook.js +20 -19
  25. package/dist/bin/pushary-post-hook.js +18 -17
  26. package/dist/bin/pushary-prompt-hook.js +18 -17
  27. package/dist/bin/pushary-session-end-hook.js +18 -17
  28. package/dist/bin/pushary-session-start-hook.js +22 -21
  29. package/dist/bin/pushary-setup.js +37 -93
  30. package/dist/bin/pushary-status.js +11 -9
  31. package/dist/bin/pushary-stop-hook.js +18 -17
  32. package/dist/bin/pushary-stopfailure-hook.js +18 -17
  33. package/dist/bin/pushary-transcript-register.js +9 -8
  34. package/dist/bin/pushary-upgrade.js +219 -141
  35. package/dist/bin/pushary-wait.js +5 -5
  36. package/dist/bin/pushary.js +3 -3
  37. package/dist/{chunk-W2LJ4O3A.js → chunk-27A7L4DA.js} +1 -1
  38. package/dist/{chunk-I4HKMUZQ.js → chunk-34EQOFMH.js} +2 -2
  39. package/dist/{chunk-2SLCHCVN.js → chunk-4CW5EAOI.js} +1 -1
  40. package/dist/{chunk-F6NTWZZC.js → chunk-4DYHBXX4.js} +5 -5
  41. package/dist/{chunk-INSMZNS7.js → chunk-4SJIPHR3.js} +1 -1
  42. package/dist/chunk-6ICPEJY5.js +20 -0
  43. package/dist/{chunk-ZJYJAD52.js → chunk-6SS74UHS.js} +1 -1
  44. package/dist/{chunk-DVW2MYCM.js → chunk-6UDK5TY6.js} +1 -1
  45. package/dist/{chunk-MMVCI6DT.js → chunk-AKCE6ZRF.js} +3 -3
  46. package/dist/{chunk-HBWC3JVZ.js → chunk-APURTMSW.js} +2 -2
  47. package/dist/{chunk-QB6QYZ6B.js → chunk-CTNLP4A5.js} +4 -4
  48. package/dist/{chunk-GH6KGWMC.js → chunk-CXYKQAL2.js} +11 -9
  49. package/dist/{chunk-4A3UQERT.js → chunk-DMU5E6HJ.js} +1 -1
  50. package/dist/{chunk-FLQPM2GQ.js → chunk-E5JGQGLD.js} +2 -2
  51. package/dist/{chunk-JRQRNNGA.js → chunk-EJXEHNB5.js} +2 -2
  52. package/dist/{chunk-5DGNEUXK.js → chunk-FBTUF2PH.js} +1 -1
  53. package/dist/{chunk-EIGJYCOE.js → chunk-IEXWWAJY.js} +2 -2
  54. package/dist/{chunk-HQRCVEI2.js → chunk-MSMKCO4Y.js} +6 -6
  55. package/dist/{chunk-TKQ6LZQZ.js → chunk-OLYTGVCC.js} +5 -4
  56. package/dist/{chunk-ASWRMBOM.js → chunk-RIVNNBEK.js} +2 -1
  57. package/dist/{chunk-6TK4IY3A.js → chunk-SD6OLZJX.js} +3 -3
  58. package/dist/chunk-SOUJG6UY.js +198 -0
  59. package/dist/{chunk-KB2FTO4O.js → chunk-UXKXGRKG.js} +2 -2
  60. package/dist/{chunk-T55H6YEP.js → chunk-VF3X4MDB.js} +1 -1
  61. package/dist/{chunk-64H5IZZD.js → chunk-VI55VXDH.js} +1 -1
  62. package/dist/{chunk-NHCUXTEM.js → chunk-VUP5BMOD.js} +1 -1
  63. package/dist/{chunk-HOEB6AKG.js → chunk-XH7UNEHO.js} +1 -1
  64. package/dist/{chunk-LK2S5XIV.js → chunk-XNJ4MQF3.js} +2 -2
  65. package/dist/{chunk-HTEGMMT3.js → chunk-YLJ26RR2.js} +5 -18
  66. package/dist/{chunk-OCVVSRDA.js → chunk-YOYSXLUB.js} +2 -2
  67. package/dist/{chunk-GBNQXYN4.js → chunk-ZOKXZ3AS.js} +2 -2
  68. package/dist/{chunk-UPLV5AJF.js → chunk-ZR7LIQKO.js} +57 -5
  69. package/dist/{reapply-ICGTBHVE.js → reapply-DYOQAVUP.js} +8 -7
  70. package/dist/src/index.js +14 -13
  71. package/package.json +1 -1
  72. package/dist/chunk-VZMIHERK.js +0 -59
@@ -1,3 +1,7 @@
1
+ import {
2
+ atLeast,
3
+ formatVersion
4
+ } from "./chunk-6ICPEJY5.js";
1
5
  import {
2
6
  NOTIFICATION_MATCHED_TYPES,
3
7
  POSTTOOLUSE_MIRRORED_TOOLS
@@ -5,7 +9,7 @@ import {
5
9
  import {
6
10
  isProtectedByScope,
7
11
  registerHookEntry
8
- } from "./chunk-UPLV5AJF.js";
12
+ } from "./chunk-ZR7LIQKO.js";
9
13
  import {
10
14
  CLAUDE_PRETOOLUSE_MATCHER,
11
15
  HOOK_BUDGETS,
@@ -111,20 +115,6 @@ var missingGeminiHookEvents = (settings) => {
111
115
  }).map((definition) => definition.event);
112
116
  };
113
117
 
114
- // src/agent-version.ts
115
- var parseVersion = (raw) => {
116
- const match = raw.match(/(\d+)\.(\d+)\.(\d+)/);
117
- return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
118
- };
119
- var compareVersion = (a, b) => {
120
- for (let index = 0; index < 3; index++) {
121
- if (a[index] !== b[index]) return a[index] < b[index] ? -1 : 1;
122
- }
123
- return 0;
124
- };
125
- var atLeast = (version, floor) => compareVersion(version, floor) >= 0;
126
- var formatVersion = (version) => version.join(".");
127
-
128
118
  // src/claude-events.ts
129
119
  var MIRRORED_TOOLS = POSTTOOLUSE_MIRRORED_TOOLS.join("|");
130
120
  var ESTABLISHED = [1, 0, 0];
@@ -174,9 +164,6 @@ export {
174
164
  removeGeminiSettings,
175
165
  hasGeminiHooks,
176
166
  missingGeminiHookEvents,
177
- parseVersion,
178
- compareVersion,
179
- formatVersion,
180
167
  CLAUDE_HOOK_BINARY,
181
168
  CLAUDE_HOOK_EVENTS,
182
169
  supportedClaudeEvents,
@@ -2,12 +2,12 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-HTEGMMT3.js";
5
+ } from "./chunk-YLJ26RR2.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
9
9
  holdBudgetOf
10
- } from "./chunk-UPLV5AJF.js";
10
+ } from "./chunk-ZR7LIQKO.js";
11
11
  import {
12
12
  CURSOR_GATE_EVENTS,
13
13
  HOOK_LOCATOR_BINARY,
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-MYHG7PX2.js";
7
7
  import {
8
8
  pusharyHookExecutable
9
- } from "./chunk-OCVVSRDA.js";
9
+ } from "./chunk-YOYSXLUB.js";
10
10
  import {
11
11
  BELL_HOOK_BINARY
12
- } from "./chunk-HOEB6AKG.js";
12
+ } from "./chunk-XH7UNEHO.js";
13
13
 
14
14
  // src/setup/hook-ownership.ts
15
15
  var commandsIn = (value) => {
@@ -16,7 +16,8 @@ import {
16
16
  } from "./chunk-5YY3IJT4.js";
17
17
 
18
18
  // src/npm.ts
19
- import { execFileSync, execSync } from "child_process";
19
+ import { promisify } from "util";
20
+ import { exec, execFile, execFileSync, execSync } from "child_process";
20
21
  import { existsSync, readFileSync, readlinkSync, realpathSync } from "fs";
21
22
  import { dirname, isAbsolute, join, relative, resolve } from "path";
22
23
  var latestReleaseUrl = (packageName) => `https://registry.npmjs.org/${packageName}/latest`;
@@ -57,7 +58,10 @@ var readGlobalPrefix = () => {
57
58
  var resolveGlobalBinary = (name) => {
58
59
  const prefix = readGlobalPrefix();
59
60
  if (prefix === void 0) return void 0;
60
- const candidates = process.platform === "win32" ? [join(prefix, `${name}.cmd`), join(prefix, name)] : [join(prefix, "bin", name)];
61
+ return resolveGlobalBinaryAt(name, prefix);
62
+ };
63
+ var resolveGlobalBinaryAt = (name, prefix, platform = process.platform) => {
64
+ const candidates = platform === "win32" ? [join(prefix, `${name}.cmd`), join(prefix, name)] : [join(prefix, "bin", name)];
61
65
  return candidates.find(existsSync);
62
66
  };
63
67
  var resolvePathBinary = (name, platform = process.platform) => {
@@ -71,6 +75,35 @@ var resolvePathBinary = (name, platform = process.platform) => {
71
75
  return void 0;
72
76
  }
73
77
  };
78
+ var runFileAsync = promisify(execFile);
79
+ var runShellAsync = promisify(exec);
80
+ var DISCOVERY_TIMEOUT_MS = 5e3;
81
+ var refuseDiscoveryAfterStop = (signal) => signal?.throwIfAborted();
82
+ var runNpmDiscovery = (command, signal) => {
83
+ refuseDiscoveryAfterStop(signal);
84
+ const options = { env: cleanNpmEnv(), timeout: DISCOVERY_TIMEOUT_MS, signal };
85
+ return process.platform === "win32" ? runShellAsync(`npm ${command}`, options) : runFileAsync("npm", command.split(" "), options);
86
+ };
87
+ var readGlobalPrefixAsync = async (signal) => {
88
+ try {
89
+ const { stdout } = await runNpmDiscovery("prefix -g --no-workspaces", signal);
90
+ return stdout.trim() || void 0;
91
+ } catch {
92
+ return void 0;
93
+ }
94
+ };
95
+ var resolvePathBinaryAsync = async (name, signal, platform = process.platform) => {
96
+ try {
97
+ refuseDiscoveryAfterStop(signal);
98
+ const { stdout } = await runFileAsync(platform === "win32" ? "where" : "which", [name], {
99
+ timeout: DISCOVERY_TIMEOUT_MS,
100
+ signal
101
+ });
102
+ return stdout.split(/\r?\n/, 1)[0]?.trim() || void 0;
103
+ } catch {
104
+ return void 0;
105
+ }
106
+ };
74
107
  var NPM_MISSING_MESSAGE = "npm is not on PATH, and the hooks run from a global npm install.";
75
108
  var NPM_LOOKUP = process.platform === "win32" ? "where npm" : "command -v npm";
76
109
  var npmIsOnPath = () => {
@@ -121,11 +154,26 @@ var resolvePackageVersionFromBinary = (binary, packageName) => {
121
154
  }
122
155
  return void 0;
123
156
  };
157
+ var globalPackageVersionIn = (output, name) => {
158
+ const result = JSON.parse(output);
159
+ if (typeof result !== "object" || result === null || !("dependencies" in result)) return void 0;
160
+ const dependencies = result.dependencies;
161
+ if (typeof dependencies !== "object" || dependencies === null || !(name in dependencies)) return void 0;
162
+ const entry = Reflect.get(dependencies, name);
163
+ if (typeof entry !== "object" || entry === null || !("version" in entry)) return void 0;
164
+ return typeof entry.version === "string" ? entry.version : void 0;
165
+ };
124
166
  var resolveGlobalPackageVersion = (name) => {
125
167
  try {
126
- const result = JSON.parse(execNpm("list -g --depth=0 --json --no-workspaces", { timeout: 5e3 }).toString());
127
- const value = result.dependencies?.[name]?.version;
128
- return typeof value === "string" ? value : void 0;
168
+ return globalPackageVersionIn(execNpm("list -g --depth=0 --json --no-workspaces", { timeout: DISCOVERY_TIMEOUT_MS }).toString(), name);
169
+ } catch {
170
+ return void 0;
171
+ }
172
+ };
173
+ var resolveGlobalPackageVersionAsync = async (name, signal) => {
174
+ try {
175
+ const { stdout } = await runNpmDiscovery("list -g --depth=0 --json --no-workspaces", signal);
176
+ return globalPackageVersionIn(stdout, name);
129
177
  } catch {
130
178
  return void 0;
131
179
  }
@@ -754,13 +802,17 @@ export {
754
802
  execNpm,
755
803
  readGlobalPrefix,
756
804
  resolveGlobalBinary,
805
+ resolveGlobalBinaryAt,
757
806
  resolvePathBinary,
807
+ readGlobalPrefixAsync,
808
+ resolvePathBinaryAsync,
758
809
  npmIsOnPath,
759
810
  globalPackageState,
760
811
  NpmMissingError,
761
812
  resolveBinary,
762
813
  resolvePackageVersionFromBinary,
763
814
  resolveGlobalPackageVersion,
815
+ resolveGlobalPackageVersionAsync,
764
816
  readGlobalFolder,
765
817
  readGlobalCliInstallAt,
766
818
  readGlobalCliInstall,
@@ -9,15 +9,16 @@ import {
9
9
  reapplyGeminiSettings,
10
10
  reapplyVsCodePlugin,
11
11
  repairCodexHolds
12
- } from "./chunk-GH6KGWMC.js";
13
- import "./chunk-ASWRMBOM.js";
14
- import "./chunk-W2LJ4O3A.js";
15
- import "./chunk-JRQRNNGA.js";
16
- import "./chunk-OCVVSRDA.js";
17
- import "./chunk-HTEGMMT3.js";
12
+ } from "./chunk-CXYKQAL2.js";
13
+ import "./chunk-27A7L4DA.js";
14
+ import "./chunk-EJXEHNB5.js";
15
+ import "./chunk-RIVNNBEK.js";
16
+ import "./chunk-YOYSXLUB.js";
17
+ import "./chunk-YLJ26RR2.js";
18
18
  import "./chunk-XHKBHWLX.js";
19
+ import "./chunk-6ICPEJY5.js";
19
20
  import "./chunk-VFFHQC7W.js";
20
- import "./chunk-UPLV5AJF.js";
21
+ import "./chunk-ZR7LIQKO.js";
21
22
  import "./chunk-T7E75EKA.js";
22
23
  import "./chunk-5YY3IJT4.js";
23
24
  export {
package/dist/src/index.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-HQRCVEI2.js";
4
- import "../chunk-QB6QYZ6B.js";
5
- import "../chunk-JRQRNNGA.js";
6
- import "../chunk-5DGNEUXK.js";
3
+ } from "../chunk-MSMKCO4Y.js";
4
+ import "../chunk-CTNLP4A5.js";
5
+ import "../chunk-EJXEHNB5.js";
6
+ import "../chunk-FBTUF2PH.js";
7
7
  import "../chunk-7ITOAMCD.js";
8
8
  import "../chunk-5OP5MQI7.js";
9
- import "../chunk-HTEGMMT3.js";
9
+ import "../chunk-YLJ26RR2.js";
10
10
  import {
11
11
  fetchAccountPublicKey
12
12
  } from "../chunk-UMMCHS6P.js";
13
+ import "../chunk-6ICPEJY5.js";
13
14
  import {
14
15
  fetchModeOverride,
15
16
  fetchModeState,
@@ -18,24 +19,24 @@ import {
18
19
  handlePostToolUse,
19
20
  handleStop,
20
21
  reportEvent
21
- } from "../chunk-F6NTWZZC.js";
22
+ } from "../chunk-4DYHBXX4.js";
22
23
  import "../chunk-N6IOSZOE.js";
23
24
  import "../chunk-VFFHQC7W.js";
24
25
  import {
25
26
  askUser,
26
27
  cancelQuestion,
27
28
  waitForAnswer
28
- } from "../chunk-MMVCI6DT.js";
29
- import "../chunk-KB2FTO4O.js";
29
+ } from "../chunk-AKCE6ZRF.js";
30
+ import "../chunk-UXKXGRKG.js";
30
31
  import "../chunk-POFBE6ZY.js";
31
- import "../chunk-I4HKMUZQ.js";
32
- import "../chunk-DVW2MYCM.js";
33
- import "../chunk-2SLCHCVN.js";
34
- import "../chunk-4A3UQERT.js";
32
+ import "../chunk-34EQOFMH.js";
33
+ import "../chunk-6UDK5TY6.js";
34
+ import "../chunk-4CW5EAOI.js";
35
+ import "../chunk-DMU5E6HJ.js";
35
36
  import "../chunk-7QLSKOSU.js";
36
37
  import "../chunk-KZERVKTD.js";
37
38
  import "../chunk-5Y2DY6X4.js";
38
- import "../chunk-UPLV5AJF.js";
39
+ import "../chunk-ZR7LIQKO.js";
39
40
  import "../chunk-T7E75EKA.js";
40
41
  import {
41
42
  getApiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,59 +0,0 @@
1
- import {
2
- resolveBinary,
3
- resolveGlobalPackageVersion,
4
- resolvePackageVersionFromBinary
5
- } from "./chunk-UPLV5AJF.js";
6
- import {
7
- MANAGED_PROVIDERS
8
- } from "./chunk-5YY3IJT4.js";
9
-
10
- // src/live-capabilities.ts
11
- var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
12
- var CLAUDE_RESUME_CAPABILITY = "claude-resume";
13
- var CODEX_BRIDGE_CAPABILITY = "codex-bridge";
14
- var CODEX_RESUME_CAPABILITY = "codex-resume";
15
- var GEMINI_BRIDGE_CAPABILITY = "gemini-bridge";
16
- var GEMINI_RESUME_CAPABILITY = "gemini-resume";
17
- var GEMINI_BRIDGE_MIN_VERSION = [0, 40, 0];
18
- var version = (raw) => {
19
- const match = raw?.match(/^(\d+)\.(\d+)\.(\d+)/);
20
- return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
21
- };
22
- var geminiLiveCapabilities = (rawVersion) => {
23
- const installed = version(rawVersion);
24
- if (!installed) return [];
25
- for (let index = 0; index < GEMINI_BRIDGE_MIN_VERSION.length; index++) {
26
- if (installed[index] > GEMINI_BRIDGE_MIN_VERSION[index]) break;
27
- if (installed[index] < GEMINI_BRIDGE_MIN_VERSION[index]) return [];
28
- }
29
- return [GEMINI_BRIDGE_CAPABILITY, GEMINI_RESUME_CAPABILITY];
30
- };
31
- var providerLiveCapabilities = (probe) => [
32
- ...probe.claude ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
33
- ...probe.codex ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
34
- ...geminiLiveCapabilities(probe.geminiVersion)
35
- ];
36
- var hasSpawnProvider = (capabilities) => capabilities.some(
37
- (capability) => capability === CLAUDE_BRIDGE_CAPABILITY || capability === CODEX_BRIDGE_CAPABILITY || capability === GEMINI_BRIDGE_CAPABILITY
38
- );
39
- var resolveControlPolicy = (input) => {
40
- if (input.mode === "off") return "disabled";
41
- if (input.mode === null && !input.servicePresent) return "preserve-absent";
42
- if (input.providerAvailable && input.managerAvailable) return "enabled";
43
- return input.servicePresent ? "legacy" : "unsupported";
44
- };
45
- var detectProviderLiveCapabilities = (providers = MANAGED_PROVIDERS) => {
46
- const enabled = new Set(providers);
47
- const geminiBin = enabled.has("gemini") ? resolveBinary("gemini") : void 0;
48
- return providerLiveCapabilities({
49
- claude: enabled.has("claude") && resolveBinary("claude") !== void 0,
50
- codex: enabled.has("codex") && resolveBinary("codex") !== void 0,
51
- geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0
52
- });
53
- };
54
-
55
- export {
56
- hasSpawnProvider,
57
- resolveControlPolicy,
58
- detectProviderLiveCapabilities
59
- };