@pushary/agent-hooks 0.98.0 → 1.0.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 (81) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/bin/pushary-bell-hook.js +20 -19
  3. package/dist/bin/pushary-bell.js +7 -6
  4. package/dist/bin/pushary-claude.js +24 -25
  5. package/dist/bin/pushary-clean.js +61 -18
  6. package/dist/bin/pushary-codex-bridge.js +11 -10
  7. package/dist/bin/pushary-codex-hook.js +43 -35
  8. package/dist/bin/pushary-codex.js +7 -7
  9. package/dist/bin/pushary-connect.js +7 -6
  10. package/dist/bin/pushary-cowork.js +3 -3
  11. package/dist/bin/pushary-daemon.js +24 -23
  12. package/dist/bin/pushary-disconnect.js +48 -7
  13. package/dist/bin/pushary-doctor.js +61 -21
  14. package/dist/bin/pushary-elicitation-hook.js +19 -18
  15. package/dist/bin/pushary-gemini-bridge.js +10 -9
  16. package/dist/bin/pushary-gemini-hook.js +27 -28
  17. package/dist/bin/pushary-hook.js +63 -34
  18. package/dist/bin/pushary-login.js +8 -7
  19. package/dist/bin/pushary-logout.js +5 -4
  20. package/dist/bin/pushary-mode.js +3 -3
  21. package/dist/bin/pushary-notification-hook.js +28 -22
  22. package/dist/bin/pushary-opencode-hook.js +29 -30
  23. package/dist/bin/pushary-permission-denied-hook.js +26 -24
  24. package/dist/bin/pushary-permission-hook.js +34 -25
  25. package/dist/bin/pushary-post-hook.js +32 -23
  26. package/dist/bin/pushary-prompt-hook.js +28 -22
  27. package/dist/bin/pushary-session-end-hook.js +28 -22
  28. package/dist/bin/pushary-session-start-hook.js +32 -26
  29. package/dist/bin/pushary-setup.js +146 -37
  30. package/dist/bin/pushary-stats.js +2 -2
  31. package/dist/bin/pushary-status.js +11 -10
  32. package/dist/bin/pushary-stop-hook.js +29 -23
  33. package/dist/bin/pushary-stopfailure-hook.js +28 -22
  34. package/dist/bin/pushary-transcript-register.js +18 -17
  35. package/dist/bin/pushary-transcripts.js +6 -5
  36. package/dist/bin/pushary-upgrade.js +15 -14
  37. package/dist/bin/pushary-wait.js +3 -3
  38. package/dist/{chunk-HFQ7WSHZ.js → chunk-2PS3DTHQ.js} +7 -4
  39. package/dist/{chunk-W2MG2P46.js → chunk-2SL5X7UB.js} +9 -6
  40. package/dist/{chunk-53QCTSWY.js → chunk-3C4ERARU.js} +4 -4
  41. package/dist/{chunk-LBNAGGLV.js → chunk-3UUAK2AK.js} +3 -2
  42. package/dist/{chunk-V47GITZV.js → chunk-447SBIC7.js} +15 -2
  43. package/dist/{chunk-VZD2GEKB.js → chunk-4LL6LG5X.js} +1 -43
  44. package/dist/{chunk-WU6LSXJ6.js → chunk-7WMFPYR5.js} +2 -2
  45. package/dist/{chunk-XPPXOKIG.js → chunk-7ZDFVWRR.js} +1 -1
  46. package/dist/chunk-A3D43VXO.js +44 -0
  47. package/dist/{chunk-3RVCQDC4.js → chunk-BOZETFXB.js} +1 -1
  48. package/dist/{chunk-LX4NNYII.js → chunk-BPD4P3NN.js} +2 -2
  49. package/dist/{chunk-IRLTW6KF.js → chunk-CDTGL7TT.js} +1 -1
  50. package/dist/{chunk-CP34FI4B.js → chunk-D2N2EJH2.js} +2 -2
  51. package/dist/{chunk-J44RPHUZ.js → chunk-DMJTWULU.js} +2 -2
  52. package/dist/{chunk-SJLGOVC6.js → chunk-DOYARIYB.js} +4 -2
  53. package/dist/{chunk-XOOWC62T.js → chunk-DUOG74E7.js} +1 -1
  54. package/dist/{chunk-OPR2BPD4.js → chunk-EMCNSBF3.js} +1 -1
  55. package/dist/{chunk-5KLAETSU.js → chunk-GTR72MIU.js} +1 -1
  56. package/dist/{chunk-5B5QV3KC.js → chunk-HGEI7SVM.js} +8 -8
  57. package/dist/chunk-HS2KEAFD.js +224 -0
  58. package/dist/{chunk-6CYB77VD.js → chunk-I3TWY7GH.js} +30 -29
  59. package/dist/{chunk-NQGYPTJQ.js → chunk-IBU7UU3R.js} +1 -1
  60. package/dist/{chunk-M4TVEMLH.js → chunk-IWZG2Y4Z.js} +1 -1
  61. package/dist/{chunk-TZHDKRMG.js → chunk-IYA3NCZG.js} +2 -2
  62. package/dist/{chunk-XL3RKJYQ.js → chunk-LTPQKBJH.js} +65 -30
  63. package/dist/{chunk-YJDRHQLG.js → chunk-MDV7ZRAT.js} +698 -43
  64. package/dist/{chunk-QXIF6R4P.js → chunk-MGI6MLFU.js} +16 -16
  65. package/dist/{chunk-DOD3A6EU.js → chunk-MSOFZYI3.js} +4 -4
  66. package/dist/{chunk-JQU6PMH4.js → chunk-R744XA2M.js} +62 -45
  67. package/dist/{chunk-FAJ4R7IB.js → chunk-RFNMSC6N.js} +1 -1
  68. package/dist/{chunk-NIXVMMJM.js → chunk-S2W4ZSHE.js} +1 -1
  69. package/dist/{chunk-OUAE3GKO.js → chunk-TTBRBWAK.js} +278 -1
  70. package/dist/{chunk-6C6MS57P.js → chunk-TVY7AT6O.js} +1 -1
  71. package/dist/{chunk-2GLOHBYB.js → chunk-UWQVODHT.js} +1 -1
  72. package/dist/{chunk-6LRGZJFB.js → chunk-XK34HTMW.js} +10 -6
  73. package/dist/{chunk-SI7GYBQP.js → chunk-XKDKUFMP.js} +1 -1
  74. package/dist/{chunk-HB2KB7QL.js → chunk-XNXIMIFY.js} +1 -1
  75. package/dist/{chunk-K6CH5NVW.js → chunk-Y55JNI2I.js} +1 -1
  76. package/dist/{chunk-OBYC6SN4.js → chunk-YKLCWWEI.js} +1 -1
  77. package/dist/{chunk-B35OCFXH.js → chunk-ZZIUQVAN.js} +4 -4
  78. package/dist/reapply-I4NB5SSM.js +30 -0
  79. package/dist/src/index.js +13 -10
  80. package/package.json +1 -1
  81. package/dist/chunk-A76GNRIK.js +0 -608
@@ -1,45 +1,51 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ activeHookSource,
4
+ activeIdentity
5
+ } from "../chunk-HS2KEAFD.js";
6
+ import "../chunk-MGI6MLFU.js";
2
7
  import {
3
8
  readHookInput
4
- } from "../chunk-M4TVEMLH.js";
5
- import "../chunk-5B5QV3KC.js";
6
- import "../chunk-OBYC6SN4.js";
7
- import "../chunk-W2MG2P46.js";
8
- import "../chunk-LBNAGGLV.js";
9
- import "../chunk-IRLTW6KF.js";
10
- import "../chunk-6LRGZJFB.js";
11
- import "../chunk-DOD3A6EU.js";
12
- import "../chunk-HFQ7WSHZ.js";
13
- import "../chunk-2GLOHBYB.js";
14
- import "../chunk-XPPXOKIG.js";
9
+ } from "../chunk-IWZG2Y4Z.js";
10
+ import "../chunk-HGEI7SVM.js";
11
+ import "../chunk-YKLCWWEI.js";
12
+ import "../chunk-2SL5X7UB.js";
13
+ import "../chunk-3UUAK2AK.js";
14
+ import "../chunk-CDTGL7TT.js";
15
+ import "../chunk-XK34HTMW.js";
16
+ import "../chunk-MSOFZYI3.js";
17
+ import "../chunk-2PS3DTHQ.js";
18
+ import "../chunk-UWQVODHT.js";
19
+ import "../chunk-7ZDFVWRR.js";
15
20
  import "../chunk-EQRS3SGM.js";
16
- import "../chunk-NQGYPTJQ.js";
21
+ import "../chunk-IBU7UU3R.js";
17
22
  import "../chunk-XHKBHWLX.js";
18
23
  import {
19
24
  handleUserPrompt
20
- } from "../chunk-YJDRHQLG.js";
21
- import "../chunk-A76GNRIK.js";
22
- import "../chunk-OPR2BPD4.js";
25
+ } from "../chunk-MDV7ZRAT.js";
26
+ import "../chunk-EMCNSBF3.js";
23
27
  import "../chunk-LGXUGYUH.js";
24
- import "../chunk-WU6LSXJ6.js";
25
- import "../chunk-XL3RKJYQ.js";
28
+ import "../chunk-7WMFPYR5.js";
29
+ import "../chunk-LTPQKBJH.js";
26
30
  import "../chunk-GMXKITVA.js";
27
31
  import "../chunk-DINDL2CF.js";
28
- import "../chunk-SJLGOVC6.js";
32
+ import "../chunk-DOYARIYB.js";
29
33
  import "../chunk-EYRGBYZG.js";
30
34
  import "../chunk-SAF6HGAA.js";
31
35
  import "../chunk-7QLSKOSU.js";
32
36
  import "../chunk-KZERVKTD.js";
33
- import "../chunk-VZD2GEKB.js";
37
+ import "../chunk-A3D43VXO.js";
38
+ import "../chunk-4LL6LG5X.js";
34
39
  import "../chunk-2UMNXADU.js";
35
- import "../chunk-OUAE3GKO.js";
40
+ import "../chunk-TTBRBWAK.js";
36
41
 
37
42
  // bin/pushary-prompt-hook.ts
43
+ var AGENT = activeIdentity(process.argv);
38
44
  var main = async () => {
39
- const input = await readHookInput("claude", "UserPromptSubmit");
45
+ const input = await readHookInput(activeHookSource(process.argv), "UserPromptSubmit");
40
46
  if (!input) return;
41
47
  try {
42
- const additionalContext = await handleUserPrompt(input);
48
+ const additionalContext = await handleUserPrompt(input, AGENT);
43
49
  if (additionalContext) {
44
50
  process.stdout.write(JSON.stringify({
45
51
  hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext }
@@ -2,47 +2,53 @@
2
2
  import {
3
3
  WRAPPER_ACTIVE_ENV
4
4
  } from "../chunk-PQ4K74WL.js";
5
+ import {
6
+ activeHookSource,
7
+ activeIdentity
8
+ } from "../chunk-HS2KEAFD.js";
9
+ import "../chunk-MGI6MLFU.js";
5
10
  import {
6
11
  readHookInput
7
- } from "../chunk-M4TVEMLH.js";
8
- import "../chunk-5B5QV3KC.js";
9
- import "../chunk-OBYC6SN4.js";
10
- import "../chunk-W2MG2P46.js";
11
- import "../chunk-LBNAGGLV.js";
12
- import "../chunk-IRLTW6KF.js";
13
- import "../chunk-6LRGZJFB.js";
14
- import "../chunk-DOD3A6EU.js";
15
- import "../chunk-HFQ7WSHZ.js";
16
- import "../chunk-2GLOHBYB.js";
17
- import "../chunk-XPPXOKIG.js";
12
+ } from "../chunk-IWZG2Y4Z.js";
13
+ import "../chunk-HGEI7SVM.js";
14
+ import "../chunk-YKLCWWEI.js";
15
+ import "../chunk-2SL5X7UB.js";
16
+ import "../chunk-3UUAK2AK.js";
17
+ import "../chunk-CDTGL7TT.js";
18
+ import "../chunk-XK34HTMW.js";
19
+ import "../chunk-MSOFZYI3.js";
20
+ import "../chunk-2PS3DTHQ.js";
21
+ import "../chunk-UWQVODHT.js";
22
+ import "../chunk-7ZDFVWRR.js";
18
23
  import "../chunk-EQRS3SGM.js";
19
- import "../chunk-NQGYPTJQ.js";
24
+ import "../chunk-IBU7UU3R.js";
20
25
  import "../chunk-XHKBHWLX.js";
21
26
  import {
22
27
  handleSessionEnd
23
- } from "../chunk-YJDRHQLG.js";
24
- import "../chunk-A76GNRIK.js";
25
- import "../chunk-OPR2BPD4.js";
28
+ } from "../chunk-MDV7ZRAT.js";
29
+ import "../chunk-EMCNSBF3.js";
26
30
  import "../chunk-LGXUGYUH.js";
27
- import "../chunk-WU6LSXJ6.js";
28
- import "../chunk-XL3RKJYQ.js";
31
+ import "../chunk-7WMFPYR5.js";
32
+ import "../chunk-LTPQKBJH.js";
29
33
  import "../chunk-GMXKITVA.js";
30
34
  import "../chunk-DINDL2CF.js";
31
- import "../chunk-SJLGOVC6.js";
35
+ import "../chunk-DOYARIYB.js";
32
36
  import "../chunk-EYRGBYZG.js";
33
37
  import "../chunk-SAF6HGAA.js";
34
38
  import "../chunk-7QLSKOSU.js";
35
39
  import "../chunk-KZERVKTD.js";
36
- import "../chunk-VZD2GEKB.js";
40
+ import "../chunk-A3D43VXO.js";
41
+ import "../chunk-4LL6LG5X.js";
37
42
  import "../chunk-2UMNXADU.js";
38
- import "../chunk-OUAE3GKO.js";
43
+ import "../chunk-TTBRBWAK.js";
39
44
 
40
45
  // bin/pushary-session-end-hook.ts
46
+ var AGENT = activeIdentity(process.argv);
41
47
  var main = async () => {
42
- const input = await readHookInput("claude", "SessionEnd");
48
+ const input = await readHookInput(activeHookSource(process.argv), "SessionEnd");
43
49
  if (!input) return;
44
50
  try {
45
- await handleSessionEnd(input, void 0, { reportClosed: process.env[WRAPPER_ACTIVE_ENV] !== "1" });
51
+ await handleSessionEnd(input, AGENT, { reportClosed: process.env[WRAPPER_ACTIVE_ENV] !== "1" });
46
52
  } catch {
47
53
  }
48
54
  };
@@ -1,56 +1,62 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reapplyClaudeForVersion
4
- } from "../chunk-JQU6PMH4.js";
5
- import "../chunk-K6CH5NVW.js";
6
- import "../chunk-QXIF6R4P.js";
4
+ } from "../chunk-R744XA2M.js";
5
+ import "../chunk-Y55JNI2I.js";
6
+ import {
7
+ activeHookSource,
8
+ activeIdentity
9
+ } from "../chunk-HS2KEAFD.js";
10
+ import "../chunk-MGI6MLFU.js";
7
11
  import {
8
12
  readHookInput
9
- } from "../chunk-M4TVEMLH.js";
10
- import "../chunk-5B5QV3KC.js";
11
- import "../chunk-OBYC6SN4.js";
12
- import "../chunk-W2MG2P46.js";
13
- import "../chunk-LBNAGGLV.js";
14
- import "../chunk-IRLTW6KF.js";
15
- import "../chunk-6LRGZJFB.js";
16
- import "../chunk-DOD3A6EU.js";
17
- import "../chunk-HFQ7WSHZ.js";
18
- import "../chunk-2GLOHBYB.js";
19
- import "../chunk-XPPXOKIG.js";
13
+ } from "../chunk-IWZG2Y4Z.js";
14
+ import "../chunk-HGEI7SVM.js";
15
+ import "../chunk-YKLCWWEI.js";
16
+ import "../chunk-2SL5X7UB.js";
17
+ import "../chunk-3UUAK2AK.js";
18
+ import "../chunk-CDTGL7TT.js";
19
+ import "../chunk-XK34HTMW.js";
20
+ import "../chunk-MSOFZYI3.js";
21
+ import "../chunk-2PS3DTHQ.js";
22
+ import "../chunk-UWQVODHT.js";
23
+ import "../chunk-7ZDFVWRR.js";
20
24
  import "../chunk-EQRS3SGM.js";
21
- import "../chunk-NQGYPTJQ.js";
25
+ import "../chunk-IBU7UU3R.js";
22
26
  import "../chunk-XHKBHWLX.js";
23
27
  import {
28
+ CLAUDE_CODE_AGENT,
24
29
  handleSessionStart
25
- } from "../chunk-YJDRHQLG.js";
26
- import "../chunk-A76GNRIK.js";
27
- import "../chunk-OPR2BPD4.js";
30
+ } from "../chunk-MDV7ZRAT.js";
31
+ import "../chunk-EMCNSBF3.js";
28
32
  import "../chunk-LGXUGYUH.js";
29
- import "../chunk-WU6LSXJ6.js";
30
- import "../chunk-XL3RKJYQ.js";
33
+ import "../chunk-7WMFPYR5.js";
34
+ import "../chunk-LTPQKBJH.js";
31
35
  import "../chunk-GMXKITVA.js";
32
36
  import "../chunk-DINDL2CF.js";
33
- import "../chunk-SJLGOVC6.js";
37
+ import "../chunk-DOYARIYB.js";
34
38
  import "../chunk-EYRGBYZG.js";
35
39
  import "../chunk-SAF6HGAA.js";
36
40
  import "../chunk-7QLSKOSU.js";
37
41
  import "../chunk-KZERVKTD.js";
38
- import "../chunk-VZD2GEKB.js";
42
+ import "../chunk-A3D43VXO.js";
43
+ import "../chunk-4LL6LG5X.js";
39
44
  import "../chunk-2UMNXADU.js";
40
- import "../chunk-OUAE3GKO.js";
45
+ import "../chunk-TTBRBWAK.js";
41
46
 
42
47
  // bin/pushary-session-start-hook.ts
48
+ var AGENT = activeIdentity(process.argv);
43
49
  var main = async () => {
44
- const input = await readHookInput("claude", "SessionStart");
50
+ const input = await readHookInput(activeHookSource(process.argv), "SessionStart");
45
51
  if (!input) return;
46
- if (!input.agent_id) {
52
+ if (!input.agent_id && AGENT.type === CLAUDE_CODE_AGENT.type) {
47
53
  try {
48
54
  reapplyClaudeForVersion();
49
55
  } catch {
50
56
  }
51
57
  }
52
58
  try {
53
- await handleSessionStart(input);
59
+ await handleSessionStart(input, AGENT);
54
60
  } catch {
55
61
  }
56
62
  };
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  coworkOutput,
7
7
  coworkSelection
8
- } from "../chunk-CP34FI4B.js";
8
+ } from "../chunk-D2N2EJH2.js";
9
9
  import "../chunk-PUZZELE6.js";
10
10
  import {
11
11
  detectClaudeVersion
12
- } from "../chunk-K6CH5NVW.js";
12
+ } from "../chunk-Y55JNI2I.js";
13
13
  import {
14
14
  describeVersionManagerPin,
15
15
  versionManagerOf
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  readManagedControlEvidence,
19
19
  waitForMachineReadiness
20
- } from "../chunk-B35OCFXH.js";
20
+ } from "../chunk-ZZIUQVAN.js";
21
21
  import {
22
22
  HERMES_CONFIG_SCRIPT,
23
23
  HERMES_PIP_PACKAGE,
@@ -25,7 +25,7 @@ import {
25
25
  isHermesConfigReceipt,
26
26
  resolveHermesPython,
27
27
  runHermesPythonScript
28
- } from "../chunk-FAJ4R7IB.js";
28
+ } from "../chunk-RFNMSC6N.js";
29
29
  import {
30
30
  describeDetection,
31
31
  detectAllAgents,
@@ -37,7 +37,7 @@ import {
37
37
  shortenHome,
38
38
  vscodeSettingsTargets,
39
39
  writeInstructionBlock
40
- } from "../chunk-V47GITZV.js";
40
+ } from "../chunk-447SBIC7.js";
41
41
  import {
42
42
  OPENCODE_HOOK_BINARY,
43
43
  addOpenCodeMcpServer,
@@ -48,7 +48,18 @@ import {
48
48
  openCodePluginDir,
49
49
  openCodePluginFile,
50
50
  openCodeWired
51
- } from "../chunk-HB2KB7QL.js";
51
+ } from "../chunk-XNXIMIFY.js";
52
+ import {
53
+ addCompatibleHooks,
54
+ addCompatibleMcpServer,
55
+ addCompatibleToolPermissions,
56
+ compatibleConfigFile,
57
+ compatibleHookEvents,
58
+ compatibleInstructionsFile,
59
+ compatibleMcpFile,
60
+ compatiblePermissionRuleFile,
61
+ hasCompatibleHooks
62
+ } from "../chunk-HS2KEAFD.js";
52
63
  import {
53
64
  addClaudeMcpServer,
54
65
  addPusharyHooks,
@@ -56,12 +67,12 @@ import {
56
67
  captureClaudeMcpServer,
57
68
  isClaudeMcpSnapshot,
58
69
  updateClaudeMcpSnapshot
59
- } from "../chunk-QXIF6R4P.js";
70
+ } from "../chunk-MGI6MLFU.js";
60
71
  import {
61
72
  detectProviderLiveCapabilities,
62
73
  hasSpawnProvider,
63
74
  resolveControlPolicy
64
- } from "../chunk-TZHDKRMG.js";
75
+ } from "../chunk-IYA3NCZG.js";
65
76
  import {
66
77
  KEEP_HINT,
67
78
  captureHookTakeover,
@@ -71,23 +82,23 @@ import {
71
82
  hookOwnerOf,
72
83
  mcpBearerKey,
73
84
  planHooks
74
- } from "../chunk-W2MG2P46.js";
85
+ } from "../chunk-2SL5X7UB.js";
75
86
  import {
76
87
  AGENT_CHOICES,
77
88
  effectiveControlMode,
78
89
  effectiveVerify,
79
90
  parseSetupOptions
80
- } from "../chunk-LBNAGGLV.js";
91
+ } from "../chunk-3UUAK2AK.js";
81
92
  import {
82
93
  liveBridgeProbe,
83
94
  resolveBridgeStub
84
- } from "../chunk-IRLTW6KF.js";
95
+ } from "../chunk-CDTGL7TT.js";
85
96
  import {
86
97
  claudeWired,
87
98
  codexWired,
88
99
  geminiWired,
89
100
  pusharyHookExecutable
90
- } from "../chunk-6LRGZJFB.js";
101
+ } from "../chunk-XK34HTMW.js";
91
102
  import {
92
103
  clearDaemonNeedsLogin,
93
104
  daemonHasRemoteProof,
@@ -100,26 +111,25 @@ import {
100
111
  replaceDaemonService,
101
112
  stopDaemonService,
102
113
  waitForDaemonRemoteProof
103
- } from "../chunk-DOD3A6EU.js";
114
+ } from "../chunk-MSOFZYI3.js";
104
115
  import {
105
116
  GEMINI_HOOK_BINARY,
106
117
  addGeminiHooks,
107
118
  addGeminiMcpServer,
108
119
  compareVersion,
109
120
  parseVersion
110
- } from "../chunk-HFQ7WSHZ.js";
111
- import "../chunk-2GLOHBYB.js";
121
+ } from "../chunk-2PS3DTHQ.js";
122
+ import "../chunk-UWQVODHT.js";
112
123
  import {
113
124
  transcriptPreferenceForSetup
114
- } from "../chunk-NQGYPTJQ.js";
125
+ } from "../chunk-IBU7UU3R.js";
115
126
  import "../chunk-XHKBHWLX.js";
116
127
  import {
117
128
  reportEvent
118
- } from "../chunk-YJDRHQLG.js";
119
- import "../chunk-A76GNRIK.js";
120
- import "../chunk-OPR2BPD4.js";
129
+ } from "../chunk-MDV7ZRAT.js";
130
+ import "../chunk-EMCNSBF3.js";
121
131
  import "../chunk-LGXUGYUH.js";
122
- import "../chunk-WU6LSXJ6.js";
132
+ import "../chunk-7WMFPYR5.js";
123
133
  import {
124
134
  addCodexHookTrust,
125
135
  addCodexHooks,
@@ -157,7 +167,7 @@ import {
157
167
  resolveGlobalBinary,
158
168
  vscodePluginDir,
159
169
  vscodePluginMcp
160
- } from "../chunk-XL3RKJYQ.js";
170
+ } from "../chunk-LTPQKBJH.js";
161
171
  import {
162
172
  confirmAppConnection,
163
173
  connectDevice,
@@ -167,13 +177,13 @@ import {
167
177
  printConnectInstructions,
168
178
  roundTripEvidence,
169
179
  verifyRoundTrip
170
- } from "../chunk-LX4NNYII.js";
180
+ } from "../chunk-BPD4P3NN.js";
171
181
  import "../chunk-3EGEA4KH.js";
172
182
  import {
173
183
  checkApiKey,
174
184
  describeKeyCheck,
175
185
  samePusharyAccount
176
- } from "../chunk-3RVCQDC4.js";
186
+ } from "../chunk-BOZETFXB.js";
177
187
  import {
178
188
  setHumanStream
179
189
  } from "../chunk-QCGNGEGE.js";
@@ -198,7 +208,7 @@ import {
198
208
  readKeySource,
199
209
  resolveShellRc,
200
210
  writeKey
201
- } from "../chunk-SJLGOVC6.js";
211
+ } from "../chunk-DOYARIYB.js";
202
212
  import "../chunk-EYRGBYZG.js";
203
213
  import "../chunk-SAF6HGAA.js";
204
214
  import {
@@ -207,17 +217,22 @@ import {
207
217
  import {
208
218
  EXIT
209
219
  } from "../chunk-KZERVKTD.js";
220
+ import "../chunk-A3D43VXO.js";
210
221
  import {
211
222
  backupFile,
212
223
  readJsonSafe,
213
224
  writeFileAtomic,
214
225
  writeJsonAtomic
215
- } from "../chunk-VZD2GEKB.js";
226
+ } from "../chunk-4LL6LG5X.js";
216
227
  import "../chunk-2UMNXADU.js";
217
228
  import {
229
+ HOOK_COMPATIBLE_PROFILES,
218
230
  HOOK_LOCATOR_BINARY,
231
+ PRETOOLUSE_GATED_TOOLS,
232
+ compatibleTargetFiles,
233
+ hookCompatibleProfile,
219
234
  isValidApiKey
220
- } from "../chunk-OUAE3GKO.js";
235
+ } from "../chunk-TTBRBWAK.js";
221
236
 
222
237
  // bin/pushary-setup.ts
223
238
  import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, readdirSync, statSync, openSync, readSync, closeSync } from "fs";
@@ -1489,18 +1504,28 @@ var setupOpenCode = async (apiKey) => {
1489
1504
  noteManual("Restart OpenCode to load the plugin.");
1490
1505
  return "configured";
1491
1506
  };
1507
+ var compatibleRecord = (of) => HOOK_COMPATIBLE_PROFILES.reduce(
1508
+ (record, profile) => ({ ...record, [profile.agentType]: of(profile) }),
1509
+ {}
1510
+ );
1492
1511
  var HOOK_FILES = {
1493
1512
  claude_code: () => CLAUDE_SETTINGS,
1494
1513
  codex: () => CODEX_HOOKS_JSON,
1495
1514
  gemini_cli: () => GEMINI_SETTINGS,
1496
1515
  cursor: () => CURSOR_USER_HOOKS,
1497
- vscode: () => join3(VSCODE_PLUGIN_DIR, "hooks", "hooks.json")
1516
+ vscode: () => join3(VSCODE_PLUGIN_DIR, "hooks", "hooks.json"),
1517
+ ...compatibleRecord((profile) => () => compatibleConfigFile(profile))
1498
1518
  };
1499
1519
  var hookOwnerFor = (agent, appAvailable = true) => {
1500
1520
  const file = HOOK_FILES[agent]?.();
1501
1521
  if (!file) return "none";
1502
1522
  const document = readJsonSafe(file);
1503
- return hookOwnerOf(document.kind === "ok" ? document.value : null, appAvailable);
1523
+ const profile = hookCompatibleProfile(agent);
1524
+ return hookOwnerOf(
1525
+ document.kind === "ok" ? document.value : null,
1526
+ appAvailable,
1527
+ profile ? profile.hooksKeyPath : void 0
1528
+ );
1504
1529
  };
1505
1530
  var appMcpKeyFor = (agent) => {
1506
1531
  if (agent === "codex") {
@@ -1570,10 +1595,90 @@ var agentIsWired = (agent) => {
1570
1595
  return existsSync(VSCODE_PLUGIN_MCP);
1571
1596
  case "opencode":
1572
1597
  return openCodeWired();
1573
- default:
1574
- return true;
1598
+ default: {
1599
+ const profile = hookCompatibleProfile(agent);
1600
+ if (!profile) return true;
1601
+ const config = readJson2(compatibleConfigFile(profile));
1602
+ return config !== null && hasCompatibleHooks(config, profile);
1603
+ }
1604
+ }
1605
+ };
1606
+ var compatibleGateSummary = (profile) => {
1607
+ const gated = PRETOOLUSE_GATED_TOOLS.map((canonical) => Object.entries(profile.toolAliases).find(([, target]) => target === canonical)?.[0] ?? canonical);
1608
+ return gated.slice(0, 3).map((name) => bold(name)).join(", ");
1609
+ };
1610
+ var setupCompatibleAgent = (profile) => async (apiKey) => {
1611
+ const configFile = compatibleConfigFile(profile);
1612
+ const mcpFile = compatibleMcpFile(profile);
1613
+ const permissionFile = compatiblePermissionRuleFile(profile);
1614
+ const instructionsFile = compatibleInstructionsFile(profile);
1615
+ console.log(`
1616
+ ${bold(`Setting up ${profile.label}`)}
1617
+ `);
1618
+ if (!isInstalled(profile.binary) && !existsSync(dirname2(configFile))) {
1619
+ console.log(` ${yellow("!")} ${profile.label} not found. Skipping.`);
1620
+ console.log(` ${dim(`Install ${profile.label} and re-run setup to configure.`)}`);
1621
+ return "skipped";
1575
1622
  }
1623
+ await installGlobally2();
1624
+ const documents = /* @__PURE__ */ new Map();
1625
+ const open = (path) => {
1626
+ const existing = documents.get(path);
1627
+ if (existing) return existing;
1628
+ const document = readAgentJson(path);
1629
+ documents.set(path, document);
1630
+ return document;
1631
+ };
1632
+ const declined = [];
1633
+ const record = (path, write) => {
1634
+ if (!write.ok) declined.push(`${shortenHome(path)} \u2192 ${write.conflictAt}`);
1635
+ };
1636
+ const events = compatibleHookEvents(profile).map((hook) => hook.event);
1637
+ await spinner(`Adding hooks (${events.slice(0, 4).join(", ")}${events.length > 4 ? `, +${events.length - 4} more` : ""})`, async () => {
1638
+ record(configFile, addCompatibleHooks(open(configFile), profile, resolveGlobalBinDir("pushary-hook")));
1639
+ });
1640
+ if (mcpFile) {
1641
+ await spinner(`Adding MCP server (${shortenHome(mcpFile)})`, async () => {
1642
+ addCompatibleMcpServer(open(mcpFile), profile, apiKey);
1643
+ });
1644
+ }
1645
+ if (permissionFile) {
1646
+ await spinner("Auto-allowing Pushary MCP tools", async () => {
1647
+ record(permissionFile, addCompatibleToolPermissions(open(permissionFile)));
1648
+ });
1649
+ }
1650
+ if (declined.length > 0) {
1651
+ console.log(`
1652
+ ${yellow("!")} ${profile.label} keeps something unexpected where Pushary writes. Nothing was changed.`);
1653
+ for (const conflict of declined) console.log(` ${dim(`\u2022 ${conflict}`)}`);
1654
+ console.log(` ${dim("Pushary expects a list of hook entries there. Move that key and re-run setup.")}`);
1655
+ return "skipped";
1656
+ }
1657
+ for (const [path, document] of documents) {
1658
+ await spinner(`Writing ${shortenHome(path)}`, async () => {
1659
+ writeJsonAtomic(path, document, KEY_FILE_MODE);
1660
+ });
1661
+ }
1662
+ if (instructionsFile && profile.instructions) {
1663
+ await spinner(`Teaching ${profile.label} to ask via push (${shortenHome(instructionsFile)})`, async () => {
1664
+ writeInstructionBlock(instructionsFile, renderAgentInstructions(profile.instructions.label));
1665
+ });
1666
+ }
1667
+ console.log();
1668
+ console.log(` ${dim("What this configured:")}`);
1669
+ console.log(` ${dim("\u2022")} Hooks: phone approvals, policy enforcement, kill switch, session tracking`);
1670
+ console.log(` ${dim("\u2022")} Gate covers ${compatibleGateSummary(profile)}`);
1671
+ if (mcpFile) console.log(` ${dim("\u2022")} MCP server: ${profile.label} can send notifications and ask questions`);
1672
+ else console.log(` ${dim("\u2022")} ${dim(`No MCP server: ${profile.label} documents no remote-server config shape, so approvals work and agent-initiated questions do not`)}`);
1673
+ if (instructionsFile) console.log(` ${dim("\u2022")} Proactive instructions: ${shortenHome(instructionsFile)}`);
1674
+ console.log(` ${dim(`Restart ${profile.label} to load the new config.`)}`);
1675
+ noteManual(`Restart ${profile.label} to load the new config.`);
1676
+ return "configured";
1576
1677
  };
1678
+ var COMPATIBLE_SETUP = HOOK_COMPATIBLE_PROFILES.reduce((installers, profile) => ({
1679
+ ...installers,
1680
+ [profile.agentType]: setupCompatibleAgent(profile)
1681
+ }), {});
1577
1682
  var AGENT_SETUP = {
1578
1683
  claude_code: setupClaudeCode,
1579
1684
  codex: setupCodex,
@@ -1582,6 +1687,7 @@ var AGENT_SETUP = {
1582
1687
  cursor: setupCursor,
1583
1688
  vscode: setupVsCode,
1584
1689
  opencode: setupOpenCode,
1690
+ ...COMPATIBLE_SETUP,
1585
1691
  custom: setupCustom
1586
1692
  };
1587
1693
  var PROJECT_INSTRUCTION_TARGETS = {
@@ -1685,6 +1791,7 @@ var AGENT_NAMES = {
1685
1791
  cursor: "Cursor",
1686
1792
  vscode: "VS Code",
1687
1793
  opencode: "OpenCode",
1794
+ ...compatibleRecord((profile) => profile.label),
1688
1795
  custom: "Other"
1689
1796
  };
1690
1797
  var AGENT_CAPABILITIES = {
@@ -1695,6 +1802,7 @@ var AGENT_CAPABILITIES = {
1695
1802
  cursor: "plugin + permission gate",
1696
1803
  vscode: "agent plugin + permission gate",
1697
1804
  opencode: "generated plugin + permission gate",
1805
+ ...compatibleRecord((profile) => profile.mcp ? "MCP + native hooks" : "native hooks"),
1698
1806
  custom: "any MCP or HTTP agent (Windsurf, n8n, custom)"
1699
1807
  };
1700
1808
  var NAME_COLUMN = Math.max(...Object.values(AGENT_NAMES).map((name) => name.length)) + 2;
@@ -1765,6 +1873,7 @@ var AGENT_TARGETS = {
1765
1873
  openCodeConfigFile(),
1766
1874
  OPENCODE_INSTRUCTIONS()
1767
1875
  ],
1876
+ ...compatibleRecord((profile) => compatibleTargetFiles(profile).map((file) => join3(homedir(), ...file))),
1768
1877
  custom: ["nothing (prints connection details only)"]
1769
1878
  };
1770
1879
  var reportDryRun = (apiKey, agents, keyCheck, controlMode) => {
@@ -1791,10 +1900,10 @@ var reportDryRun = (apiKey, agents, keyCheck, controlMode) => {
1791
1900
  if (agents.length === 0) {
1792
1901
  console.log(` ${dim("Agents:")} ${dim("none")}`);
1793
1902
  } else {
1794
- console.log(` ${dim("Agents:")} ${agents.map((a) => a.replace("_", " ")).join(", ")}`);
1903
+ console.log(` ${dim("Agents:")} ${agents.map((agent) => AGENT_NAMES[agent]).join(", ")}`);
1795
1904
  for (const agent of agents) {
1796
1905
  console.log();
1797
- console.log(` ${bold(agent.replace("_", " "))}`);
1906
+ console.log(` ${bold(AGENT_NAMES[agent])}`);
1798
1907
  for (const target of AGENT_TARGETS[agent]) console.log(` ${dim("would write")} ${target}`);
1799
1908
  }
1800
1909
  }
@@ -2044,7 +2153,7 @@ var main = async () => {
2044
2153
  if (keepAppWiring) {
2045
2154
  if (!await appAccountMatches(agent)) {
2046
2155
  hookOwners.push({ agent, owner: "app", kept: true });
2047
- failed.push(agent.replace("_", " "));
2156
+ failed.push(AGENT_NAMES[agent]);
2048
2157
  console.log(`
2049
2158
  ${yellow("!")} ${AGENT_NAMES[agent]}: Mac app hooks kept, but their Pushary account could not be matched to this setup.`);
2050
2159
  console.log(` ${dim("Sign the Mac app into the same account and repair this agent, then re-run setup.")}`);
@@ -2065,13 +2174,13 @@ var main = async () => {
2065
2174
  completed.push(agent);
2066
2175
  hookOwners.push({ agent, owner: hookOwnerFor(agent, appBridgeAvailable), kept: false });
2067
2176
  } else {
2068
- failed.push(agent.replace("_", " "));
2069
- console.log(` ${yellow("!")} ${agent.replace("_", " ")} reported success but its config is not there.`);
2177
+ failed.push(AGENT_NAMES[agent]);
2178
+ console.log(` ${yellow("!")} ${AGENT_NAMES[agent]} reported success but its config is not there.`);
2070
2179
  console.log(` ${dim("Re-run setup, then")} ${cyan("npx @pushary/agent-hooks@latest doctor")} ${dim("to see what is missing.")}`);
2071
2180
  }
2072
2181
  } catch (err) {
2073
- failed.push(agent.replace("_", " "));
2074
- console.log(` ${yellow("!")} ${agent.replace("_", " ")} setup failed: ${formatError(err)}`);
2182
+ failed.push(AGENT_NAMES[agent]);
2183
+ console.log(` ${yellow("!")} ${AGENT_NAMES[agent]} setup failed: ${formatError(err)}`);
2075
2184
  console.log(` ${dim("Other agents will continue. Re-run setup to retry.")}`);
2076
2185
  }
2077
2186
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readLedgerSummary
4
- } from "../chunk-XOOWC62T.js";
4
+ } from "../chunk-DUOG74E7.js";
5
5
  import {
6
6
  exitOnHelpFlag
7
7
  } from "../chunk-GOQHN2UH.js";
@@ -11,7 +11,7 @@ import "../chunk-KZERVKTD.js";
11
11
  import {
12
12
  getApiKey
13
13
  } from "../chunk-2UMNXADU.js";
14
- import "../chunk-OUAE3GKO.js";
14
+ import "../chunk-TTBRBWAK.js";
15
15
 
16
16
  // bin/pushary-stats.ts
17
17
  exitOnHelpFlag("stats");