@pushary/agent-hooks 0.89.10 → 0.89.12

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 (78) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +3 -2
  3. package/dist/bin/pushary-bell-hook.js +5 -5
  4. package/dist/bin/pushary-bell.js +11 -11
  5. package/dist/bin/pushary-claude.js +125 -36
  6. package/dist/bin/pushary-clean.js +39 -28
  7. package/dist/bin/pushary-codex-bridge.js +17 -10
  8. package/dist/bin/pushary-codex-hook.js +12 -11
  9. package/dist/bin/pushary-codex.js +8 -8
  10. package/dist/bin/pushary-connect.js +12 -12
  11. package/dist/bin/pushary-daemon-supervisor.d.ts +1 -0
  12. package/dist/bin/pushary-daemon-supervisor.js +27 -0
  13. package/dist/bin/pushary-daemon.js +22 -22
  14. package/dist/bin/pushary-disconnect.js +9 -9
  15. package/dist/bin/pushary-doctor.js +59 -49
  16. package/dist/bin/pushary-elicitation-hook.js +5 -5
  17. package/dist/bin/pushary-gemini-bridge.js +17 -9
  18. package/dist/bin/pushary-gemini-hook.js +11 -10
  19. package/dist/bin/pushary-hook.js +14 -14
  20. package/dist/bin/pushary-login.js +11 -11
  21. package/dist/bin/pushary-logout.js +11 -11
  22. package/dist/bin/pushary-mode.js +5 -5
  23. package/dist/bin/pushary-notification-hook.js +8 -8
  24. package/dist/bin/pushary-opencode-hook.js +11 -10
  25. package/dist/bin/pushary-permission-denied-hook.js +12 -12
  26. package/dist/bin/pushary-permission-hook.js +12 -12
  27. package/dist/bin/pushary-post-hook.js +8 -8
  28. package/dist/bin/pushary-prompt-hook.js +8 -8
  29. package/dist/bin/pushary-session-end-hook.js +8 -8
  30. package/dist/bin/pushary-session-start-hook.js +8 -8
  31. package/dist/bin/pushary-setup.js +88 -60
  32. package/dist/bin/pushary-stats.js +4 -4
  33. package/dist/bin/pushary-status.js +14 -14
  34. package/dist/bin/pushary-stop-hook.js +8 -8
  35. package/dist/bin/pushary-stopfailure-hook.js +8 -8
  36. package/dist/bin/pushary-suggestions.js +2 -2
  37. package/dist/bin/pushary-upgrade.js +21 -21
  38. package/dist/bin/pushary-wait.js +5 -5
  39. package/dist/bin/pushary.js +1 -1
  40. package/dist/{chunk-253WC6O5.js → chunk-327YMKP5.js} +1 -1
  41. package/dist/{chunk-6XUABEX2.js → chunk-3OXHYPZG.js} +1 -1
  42. package/dist/{chunk-MZGWKIUZ.js → chunk-3XSP5SML.js} +7 -3
  43. package/dist/{chunk-XX2V4QS5.js → chunk-4LL6LG5X.js} +2 -2
  44. package/dist/{chunk-DKWM5T3P.js → chunk-5NDB3YOE.js} +2 -2
  45. package/dist/{chunk-TEZ2FZD6.js → chunk-6GU55AQQ.js} +2 -2
  46. package/dist/{chunk-Q223OM5J.js → chunk-6V7ZDH3A.js} +4 -4
  47. package/dist/{chunk-OLAGKKSR.js → chunk-6VXNA5JB.js} +16 -6
  48. package/dist/{chunk-34GN3IPX.js → chunk-7DK3ZH3N.js} +1 -1
  49. package/dist/{chunk-PZRWFWSR.js → chunk-7HYJPOGG.js} +7 -7
  50. package/dist/{chunk-TY5HVMXT.js → chunk-DHR4F2CR.js} +1 -1
  51. package/dist/{chunk-3HFK3UXM.js → chunk-FCUUVHTS.js} +1 -1
  52. package/dist/{chunk-NCVIWGVA.js → chunk-GKPURU7P.js} +1 -1
  53. package/dist/{chunk-UXHMWF4H.js → chunk-JHJHCMAF.js} +1 -1
  54. package/dist/chunk-JJV5Q4KG.js +20 -0
  55. package/dist/{chunk-TG3T3M4K.js → chunk-JVZX5YRJ.js} +6 -2
  56. package/dist/{chunk-6EKQZA6R.js → chunk-KVHP5ZME.js} +1 -1
  57. package/dist/{chunk-X4ZUUFKV.js → chunk-L4ZCFMWW.js} +63 -1
  58. package/dist/{chunk-2LPEZYMC.js → chunk-MFNQ5IMW.js} +1 -1
  59. package/dist/{chunk-KVE5RCQL.js → chunk-NBRM3FMD.js} +1 -1
  60. package/dist/{chunk-FZ73G2RO.js → chunk-NESKLV6R.js} +25 -6
  61. package/dist/{chunk-GTZLL7F4.js → chunk-OADGBOP7.js} +5 -5
  62. package/dist/{chunk-GSSFSVAQ.js → chunk-OCMOTJTW.js} +42 -24
  63. package/dist/{chunk-LURY4WNF.js → chunk-OTPJ4FUR.js} +1 -1
  64. package/dist/{chunk-QA72MKIT.js → chunk-OVEGEQSB.js} +5 -5
  65. package/dist/{chunk-3SQYKLBW.js → chunk-PS7DQ2SU.js} +46 -18
  66. package/dist/{chunk-UDBJHQMG.js → chunk-QFJZHVVL.js} +1 -1
  67. package/dist/chunk-QZCFVWA7.js +58 -0
  68. package/dist/{chunk-3XTFX4CL.js → chunk-RLQWNEPM.js} +3 -2
  69. package/dist/{chunk-3CUDMTL4.js → chunk-RNKPLUWC.js} +10 -3
  70. package/dist/{chunk-SYUIXXQW.js → chunk-VF3RTVWY.js} +1 -1
  71. package/dist/{chunk-TRVIRETT.js → chunk-VPLQFXCH.js} +1 -1
  72. package/dist/{chunk-IUN6VOKV.js → chunk-WDVQ6O4C.js} +2 -42
  73. package/dist/{chunk-IUWRVTQK.js → chunk-XREW7RQ3.js} +1 -1
  74. package/dist/{chunk-BLODMQKJ.js → chunk-Y4WVZIEI.js} +1 -1
  75. package/dist/src/index.d.ts +8 -1
  76. package/dist/src/index.js +16 -12
  77. package/package.json +2 -1
  78. /package/dist/{chunk-X6RXX2NF.js → chunk-3MCEES6Z.js} +0 -0
@@ -1,33 +1,40 @@
1
1
  #!/usr/bin/env node
2
- import "../chunk-6XUABEX2.js";
2
+ import "../chunk-3OXHYPZG.js";
3
3
  import {
4
4
  LiveTranscriptRelay,
5
5
  liveSessionSleep,
6
6
  postLiveSession,
7
7
  postLiveSessionUntilAccepted,
8
8
  startLiveSessionHeartbeat
9
- } from "../chunk-OLAGKKSR.js";
10
- import "../chunk-IUN6VOKV.js";
9
+ } from "../chunk-6VXNA5JB.js";
10
+ import "../chunk-WDVQ6O4C.js";
11
+ import "../chunk-QZCFVWA7.js";
12
+ import {
13
+ transcriptsEnabled
14
+ } from "../chunk-JJV5Q4KG.js";
11
15
  import {
12
16
  startProcessOwnership,
13
17
  withSpawnProcessOwnership
14
- } from "../chunk-TEZ2FZD6.js";
18
+ } from "../chunk-6GU55AQQ.js";
15
19
  import {
16
20
  spawnClaude
17
21
  } from "../chunk-XHKBHWLX.js";
18
22
  import {
19
23
  resolveBinary
20
- } from "../chunk-X4ZUUFKV.js";
24
+ } from "../chunk-L4ZCFMWW.js";
21
25
  import {
22
26
  getMachineId
23
- } from "../chunk-DKWM5T3P.js";
24
- import "../chunk-QA72MKIT.js";
25
- import "../chunk-XX2V4QS5.js";
27
+ } from "../chunk-5NDB3YOE.js";
28
+ import "../chunk-OVEGEQSB.js";
29
+ import "../chunk-RNKPLUWC.js";
30
+ import "../chunk-BC3VCZ3E.js";
31
+ import "../chunk-XREW7RQ3.js";
32
+ import "../chunk-4LL6LG5X.js";
26
33
  import {
27
34
  getApiKey,
28
35
  getBaseUrl
29
36
  } from "../chunk-2UMNXADU.js";
30
- import "../chunk-X6RXX2NF.js";
37
+ import "../chunk-3MCEES6Z.js";
31
38
 
32
39
  // bin/pushary-codex-bridge.ts
33
40
  import { existsSync } from "fs";
@@ -371,7 +378,7 @@ var outcome = await withSpawnProcessOwnership(spawnId, () => runCodexBridge({
371
378
  args: ["app-server", "--stdio"]
372
379
  },
373
380
  signal: abort.signal,
374
- transcripts: process.env.PUSHARY_TRANSCRIPTS === "1"
381
+ transcripts: transcriptsEnabled()
375
382
  }));
376
383
  for (const signal of signals) process.off(signal, stop);
377
384
  process.exit(outcome === "stopped" ? 0 : 1);
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  defersToNativeMode
4
- } from "../chunk-NCVIWGVA.js";
4
+ } from "../chunk-GKPURU7P.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "../chunk-3HFK3UXM.js";
8
+ } from "../chunk-FCUUVHTS.js";
9
9
  import {
10
10
  readHookInput
11
11
  } from "../chunk-6CUUA7HO.js";
@@ -34,7 +34,7 @@ import {
34
34
  toCodexWire,
35
35
  toPolicyLookup,
36
36
  toPolicyLookups
37
- } from "../chunk-GTZLL7F4.js";
37
+ } from "../chunk-OADGBOP7.js";
38
38
  import {
39
39
  DEFAULT_SESSION,
40
40
  askUser,
@@ -42,26 +42,27 @@ import {
42
42
  pollForAnswer,
43
43
  savePendingQuestion,
44
44
  sendNotification
45
- } from "../chunk-UXHMWF4H.js";
45
+ } from "../chunk-JHJHCMAF.js";
46
46
  import {
47
+ UNNAMED_ACTION,
47
48
  deriveActionBody,
48
49
  deriveBlocker,
49
50
  deriveToolTarget,
50
51
  describeToolCall,
51
52
  scopePathFor
52
- } from "../chunk-TG3T3M4K.js";
53
+ } from "../chunk-JVZX5YRJ.js";
53
54
  import {
54
55
  getMachineId
55
- } from "../chunk-DKWM5T3P.js";
56
+ } from "../chunk-5NDB3YOE.js";
56
57
  import {
57
58
  canonicalJson
58
- } from "../chunk-QA72MKIT.js";
59
+ } from "../chunk-OVEGEQSB.js";
59
60
  import "../chunk-BSZYIAZL.js";
60
61
  import "../chunk-SAF6HGAA.js";
61
- import "../chunk-IUWRVTQK.js";
62
62
  import "../chunk-7QLSKOSU.js";
63
63
  import "../chunk-KZERVKTD.js";
64
- import "../chunk-XX2V4QS5.js";
64
+ import "../chunk-XREW7RQ3.js";
65
+ import "../chunk-4LL6LG5X.js";
65
66
  import {
66
67
  getApiKey
67
68
  } from "../chunk-2UMNXADU.js";
@@ -72,7 +73,7 @@ import {
72
73
  hookWaitClamped,
73
74
  hookWaitDeadline,
74
75
  resolveGate
75
- } from "../chunk-X6RXX2NF.js";
76
+ } from "../chunk-3MCEES6Z.js";
76
77
 
77
78
  // bin/pushary-codex-hook.ts
78
79
  import { basename } from "path";
@@ -179,7 +180,7 @@ var pushQuestion = async (apiKey, input, lookup, waitSeconds, mode) => {
179
180
  const projectName = basename(input.cwd ?? process.cwd());
180
181
  const description = describeFor(input, lookup);
181
182
  const result = await askUser(apiKey, {
182
- question: `Allow ${description}?`,
183
+ question: `Allow ${description || UNNAMED_ACTION}?`,
183
184
  type: "confirm",
184
185
  context: `Agent wants to run this in ${projectName}`,
185
186
  agentName: agentNameFor(input),
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reportEvent
4
- } from "../chunk-GTZLL7F4.js";
4
+ } from "../chunk-OADGBOP7.js";
5
5
  import {
6
6
  askUser,
7
7
  waitForAnswer
8
- } from "../chunk-UXHMWF4H.js";
9
- import "../chunk-TG3T3M4K.js";
8
+ } from "../chunk-JHJHCMAF.js";
9
+ import "../chunk-JVZX5YRJ.js";
10
10
  import {
11
11
  getMachineId
12
- } from "../chunk-DKWM5T3P.js";
13
- import "../chunk-QA72MKIT.js";
12
+ } from "../chunk-5NDB3YOE.js";
13
+ import "../chunk-OVEGEQSB.js";
14
14
  import "../chunk-BSZYIAZL.js";
15
15
  import "../chunk-SAF6HGAA.js";
16
- import "../chunk-IUWRVTQK.js";
17
16
  import "../chunk-7QLSKOSU.js";
18
17
  import "../chunk-KZERVKTD.js";
19
- import "../chunk-XX2V4QS5.js";
18
+ import "../chunk-XREW7RQ3.js";
19
+ import "../chunk-4LL6LG5X.js";
20
20
  import {
21
21
  getApiKey
22
22
  } from "../chunk-2UMNXADU.js";
23
- import "../chunk-X6RXX2NF.js";
23
+ import "../chunk-3MCEES6Z.js";
24
24
 
25
25
  // bin/pushary-codex.ts
26
26
  import { basename } from "path";
@@ -1,43 +1,43 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  printKeyCheck
4
- } from "../chunk-253WC6O5.js";
4
+ } from "../chunk-327YMKP5.js";
5
5
  import {
6
6
  confirmAppConnection,
7
7
  connectDevice,
8
8
  printConnectInstructions
9
- } from "../chunk-2LPEZYMC.js";
9
+ } from "../chunk-MFNQ5IMW.js";
10
10
  import "../chunk-3EGEA4KH.js";
11
11
  import {
12
12
  checkApiKey
13
- } from "../chunk-BLODMQKJ.js";
13
+ } from "../chunk-Y4WVZIEI.js";
14
14
  import {
15
15
  createIo
16
16
  } from "../chunk-5RUIFDTP.js";
17
- import {
18
- readKeySource
19
- } from "../chunk-3CUDMTL4.js";
20
17
  import {
21
18
  parseFlags
22
19
  } from "../chunk-GMXKITVA.js";
23
20
  import {
24
21
  exitOnHelpFlag
25
- } from "../chunk-LURY4WNF.js";
26
- import "../chunk-3XTFX4CL.js";
27
- import "../chunk-BC3VCZ3E.js";
22
+ } from "../chunk-OTPJ4FUR.js";
23
+ import "../chunk-RLQWNEPM.js";
28
24
  import "../chunk-DINDL2CF.js";
25
+ import {
26
+ readKeySource
27
+ } from "../chunk-RNKPLUWC.js";
28
+ import "../chunk-BC3VCZ3E.js";
29
29
  import "../chunk-BSZYIAZL.js";
30
30
  import "../chunk-SAF6HGAA.js";
31
- import "../chunk-IUWRVTQK.js";
32
31
  import {
33
32
  UsageError
34
33
  } from "../chunk-7QLSKOSU.js";
35
34
  import {
36
35
  EXIT
37
36
  } from "../chunk-KZERVKTD.js";
38
- import "../chunk-XX2V4QS5.js";
37
+ import "../chunk-XREW7RQ3.js";
38
+ import "../chunk-4LL6LG5X.js";
39
39
  import "../chunk-2UMNXADU.js";
40
- import "../chunk-X6RXX2NF.js";
40
+ import "../chunk-3MCEES6Z.js";
41
41
 
42
42
  // bin/pushary-connect.ts
43
43
  exitOnHelpFlag("connect");
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ // bin/pushary-daemon-supervisor.ts
4
+ import { spawn } from "child_process";
5
+ var FIRST_DELAY_MS = 1e4;
6
+ var MAX_DELAY_MS = 5 * 6e4;
7
+ var HEALTHY_RUN_MS = 6e4;
8
+ var daemonEntry = process.argv[2];
9
+ if (!daemonEntry) {
10
+ process.stderr.write("Missing daemon entry.\n");
11
+ process.exitCode = 64;
12
+ } else {
13
+ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
14
+ const run = () => new Promise((resolve) => {
15
+ const child = spawn(process.execPath, [daemonEntry], { stdio: "inherit", windowsHide: true });
16
+ child.once("error", () => resolve(1));
17
+ child.once("exit", (code) => resolve(code ?? 1));
18
+ });
19
+ let delay = FIRST_DELAY_MS;
20
+ for (; ; ) {
21
+ const startedAt = Date.now();
22
+ if (await run() === 0) break;
23
+ if (Date.now() - startedAt >= HEALTHY_RUN_MS) delay = FIRST_DELAY_MS;
24
+ await wait(delay);
25
+ delay = Math.min(delay * 2, MAX_DELAY_MS);
26
+ }
27
+ }
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  inspectConfiguredManagedProviders
4
- } from "../chunk-PZRWFWSR.js";
5
- import "../chunk-KVE5RCQL.js";
6
- import "../chunk-FZ73G2RO.js";
4
+ } from "../chunk-7HYJPOGG.js";
5
+ import "../chunk-NBRM3FMD.js";
7
6
  import {
8
7
  HEARTBEAT_INTERVAL_MS,
9
8
  sendHeartbeat
10
- } from "../chunk-TY5HVMXT.js";
11
- import "../chunk-Q223OM5J.js";
12
- import "../chunk-6EKQZA6R.js";
13
- import "../chunk-SYUIXXQW.js";
9
+ } from "../chunk-DHR4F2CR.js";
10
+ import "../chunk-NESKLV6R.js";
11
+ import "../chunk-6V7ZDH3A.js";
12
+ import "../chunk-KVHP5ZME.js";
13
+ import "../chunk-VF3RTVWY.js";
14
14
  import {
15
15
  DAEMON_LEASE_RENEW_INTERVAL_MS,
16
16
  acquireDaemonLease,
@@ -23,45 +23,45 @@ import {
23
23
  replaceDaemonService,
24
24
  requestDaemonHandoff,
25
25
  stopDaemonRunning
26
- } from "../chunk-3SQYKLBW.js";
26
+ } from "../chunk-PS7DQ2SU.js";
27
27
  import {
28
28
  detectProviderLiveCapabilities,
29
29
  hasSpawnProvider,
30
30
  resolveControlPolicy
31
- } from "../chunk-6XUABEX2.js";
31
+ } from "../chunk-3OXHYPZG.js";
32
32
  import {
33
33
  findLiveProcessBySpawnId,
34
34
  ownsLiveProcess
35
- } from "../chunk-TEZ2FZD6.js";
35
+ } from "../chunk-6GU55AQQ.js";
36
36
  import {
37
37
  spawnClaude
38
38
  } from "../chunk-XHKBHWLX.js";
39
39
  import {
40
40
  resolveBinary
41
- } from "../chunk-X4ZUUFKV.js";
41
+ } from "../chunk-L4ZCFMWW.js";
42
42
  import {
43
43
  getMachineId
44
- } from "../chunk-DKWM5T3P.js";
45
- import "../chunk-QA72MKIT.js";
46
- import {
47
- readControlMode
48
- } from "../chunk-3CUDMTL4.js";
44
+ } from "../chunk-5NDB3YOE.js";
45
+ import "../chunk-OVEGEQSB.js";
49
46
  import {
50
47
  exitOnHelpFlag
51
- } from "../chunk-LURY4WNF.js";
52
- import "../chunk-3XTFX4CL.js";
53
- import "../chunk-BC3VCZ3E.js";
48
+ } from "../chunk-OTPJ4FUR.js";
49
+ import "../chunk-RLQWNEPM.js";
54
50
  import "../chunk-DINDL2CF.js";
55
- import "../chunk-IUWRVTQK.js";
51
+ import {
52
+ readControlMode
53
+ } from "../chunk-RNKPLUWC.js";
54
+ import "../chunk-BC3VCZ3E.js";
56
55
  import {
57
56
  EXIT
58
57
  } from "../chunk-KZERVKTD.js";
59
- import "../chunk-XX2V4QS5.js";
58
+ import "../chunk-XREW7RQ3.js";
59
+ import "../chunk-4LL6LG5X.js";
60
60
  import {
61
61
  getApiKey,
62
62
  getBaseUrl
63
63
  } from "../chunk-2UMNXADU.js";
64
- import "../chunk-X6RXX2NF.js";
64
+ import "../chunk-3MCEES6Z.js";
65
65
 
66
66
  // src/spawn-daemon.ts
67
67
  import { execFileSync, spawn } from "child_process";
@@ -8,17 +8,17 @@ import {
8
8
  openCodePluginDir,
9
9
  openCodePluginFile,
10
10
  removeOpenCodeMcpServer
11
- } from "../chunk-34GN3IPX.js";
11
+ } from "../chunk-7DK3ZH3N.js";
12
12
  import {
13
13
  isClaudeMcpSnapshot,
14
14
  removeClaudeMcpServers,
15
15
  removeGeminiSettings,
16
16
  removePusharySettings,
17
17
  restoreClaudeMcpServer
18
- } from "../chunk-Q223OM5J.js";
19
- import "../chunk-6EKQZA6R.js";
20
- import "../chunk-SYUIXXQW.js";
21
- import "../chunk-X4ZUUFKV.js";
18
+ } from "../chunk-6V7ZDH3A.js";
19
+ import "../chunk-KVHP5ZME.js";
20
+ import "../chunk-VF3RTVWY.js";
21
+ import "../chunk-L4ZCFMWW.js";
22
22
  import {
23
23
  claudeJson,
24
24
  claudeMcpReceipt,
@@ -32,14 +32,14 @@ import {
32
32
  geminiSettings,
33
33
  removeCodexHooks,
34
34
  removeCodexSettings
35
- } from "../chunk-QA72MKIT.js";
35
+ } from "../chunk-OVEGEQSB.js";
36
36
  import {
37
37
  exitOnHelpFlag
38
- } from "../chunk-LURY4WNF.js";
39
- import "../chunk-3XTFX4CL.js";
38
+ } from "../chunk-OTPJ4FUR.js";
39
+ import "../chunk-RLQWNEPM.js";
40
40
  import "../chunk-DINDL2CF.js";
41
41
  import "../chunk-KZERVKTD.js";
42
- import "../chunk-X6RXX2NF.js";
42
+ import "../chunk-3MCEES6Z.js";
43
43
 
44
44
  // bin/pushary-disconnect.ts
45
45
  import { readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
@@ -2,16 +2,11 @@
2
2
  import {
3
3
  describeWaitLadder
4
4
  } from "../chunk-IIENZE2J.js";
5
- import {
6
- claudeWired,
7
- codexWired,
8
- geminiWired,
9
- pusharyHookExecutable
10
- } from "../chunk-FZ73G2RO.js";
11
5
  import {
12
6
  readMachineReadiness
13
- } from "../chunk-TY5HVMXT.js";
7
+ } from "../chunk-DHR4F2CR.js";
14
8
  import {
9
+ CURSOR_GATE_SCRIPT,
15
10
  agentProbes,
16
11
  detectAgent,
17
12
  detectAllAgents,
@@ -19,42 +14,50 @@ import {
19
14
  isDetected,
20
15
  isPluginRegistered,
21
16
  vscodeSettingsTargets
22
- } from "../chunk-MZGWKIUZ.js";
17
+ } from "../chunk-3XSP5SML.js";
18
+ import {
19
+ claudeWired,
20
+ codexWired,
21
+ cursorMcpAuthorization,
22
+ cursorWired,
23
+ geminiWired,
24
+ pusharyHookExecutable
25
+ } from "../chunk-NESKLV6R.js";
23
26
  import {
24
27
  OPENCODE_PLUGIN_PLACEHOLDER,
25
28
  openCodePluginDir,
26
29
  openCodePluginFile,
27
30
  openCodeWired
28
- } from "../chunk-34GN3IPX.js";
31
+ } from "../chunk-7DK3ZH3N.js";
29
32
  import {
30
33
  GEMINI_HOOK_BINARY,
31
34
  hasGeminiHooks,
32
35
  missingGeminiHookEvents
33
- } from "../chunk-Q223OM5J.js";
34
- import "../chunk-6EKQZA6R.js";
35
- import "../chunk-SYUIXXQW.js";
36
+ } from "../chunk-6V7ZDH3A.js";
37
+ import "../chunk-KVHP5ZME.js";
38
+ import "../chunk-VF3RTVWY.js";
36
39
  import {
37
40
  daemonHasRemoteProof,
38
41
  daemonServiceManagerAvailable,
39
42
  hasDaemonServiceDefinition,
40
43
  readDaemonStatus
41
- } from "../chunk-3SQYKLBW.js";
44
+ } from "../chunk-PS7DQ2SU.js";
42
45
  import {
43
46
  detectProviderLiveCapabilities,
44
47
  hasSpawnProvider,
45
48
  resolveControlPolicy
46
- } from "../chunk-6XUABEX2.js";
49
+ } from "../chunk-3OXHYPZG.js";
47
50
  import "../chunk-XHKBHWLX.js";
48
51
  import {
49
52
  execNpm
50
- } from "../chunk-X4ZUUFKV.js";
53
+ } from "../chunk-L4ZCFMWW.js";
51
54
  import {
52
55
  readLedgerSummary
53
- } from "../chunk-3HFK3UXM.js";
54
- import "../chunk-TG3T3M4K.js";
56
+ } from "../chunk-FCUUVHTS.js";
57
+ import "../chunk-JVZX5YRJ.js";
55
58
  import {
56
59
  getMachineId
57
- } from "../chunk-DKWM5T3P.js";
60
+ } from "../chunk-5NDB3YOE.js";
58
61
  import {
59
62
  claudeJson,
60
63
  claudeSettings,
@@ -66,6 +69,7 @@ import {
66
69
  codexSkillDir,
67
70
  cursorPluginDir,
68
71
  cursorUserHooks,
72
+ cursorUserMcp,
69
73
  geminiMd,
70
74
  geminiSettings,
71
75
  hasCodexHooks,
@@ -74,58 +78,58 @@ import {
74
78
  readCodexMcpAuth,
75
79
  untrustedCodexHookEvents,
76
80
  vscodePluginDir
77
- } from "../chunk-QA72MKIT.js";
81
+ } from "../chunk-OVEGEQSB.js";
78
82
  import {
79
83
  describeReach,
80
84
  describeRoundTrip,
81
85
  fetchChannels,
82
86
  reachVerdict,
83
87
  verifyRoundTrip
84
- } from "../chunk-2LPEZYMC.js";
88
+ } from "../chunk-MFNQ5IMW.js";
85
89
  import "../chunk-3EGEA4KH.js";
86
90
  import {
87
91
  checkApiKey,
88
92
  describeKeyCheck
89
- } from "../chunk-BLODMQKJ.js";
93
+ } from "../chunk-Y4WVZIEI.js";
90
94
  import {
91
95
  createIo
92
96
  } from "../chunk-5RUIFDTP.js";
93
- import {
94
- keyPrefix,
95
- readControlMode,
96
- readKeySource
97
- } from "../chunk-3CUDMTL4.js";
98
97
  import {
99
98
  parseFlags
100
99
  } from "../chunk-GMXKITVA.js";
101
100
  import {
102
101
  exitOnHelpFlag
103
- } from "../chunk-LURY4WNF.js";
104
- import "../chunk-3XTFX4CL.js";
105
- import "../chunk-BC3VCZ3E.js";
102
+ } from "../chunk-OTPJ4FUR.js";
103
+ import "../chunk-RLQWNEPM.js";
106
104
  import {
107
105
  getPackageVersion
108
106
  } from "../chunk-DINDL2CF.js";
107
+ import {
108
+ keyPrefix,
109
+ readControlMode,
110
+ readKeySource
111
+ } from "../chunk-RNKPLUWC.js";
112
+ import "../chunk-BC3VCZ3E.js";
109
113
  import {
110
114
  callMcpTool,
111
115
  sendMcpRequest
112
116
  } from "../chunk-BSZYIAZL.js";
113
117
  import "../chunk-SAF6HGAA.js";
114
- import "../chunk-IUWRVTQK.js";
115
118
  import {
116
119
  UsageError
117
120
  } from "../chunk-7QLSKOSU.js";
118
121
  import {
119
122
  EXIT
120
123
  } from "../chunk-KZERVKTD.js";
121
- import "../chunk-XX2V4QS5.js";
124
+ import "../chunk-XREW7RQ3.js";
125
+ import "../chunk-4LL6LG5X.js";
122
126
  import {
123
127
  getBaseUrl
124
128
  } from "../chunk-2UMNXADU.js";
125
129
  import {
126
130
  CURSOR_GATE_EVENTS,
127
131
  HOOK_LOCATOR_BINARY
128
- } from "../chunk-X6RXX2NF.js";
132
+ } from "../chunk-3MCEES6Z.js";
129
133
 
130
134
  // bin/pushary-doctor.ts
131
135
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -258,8 +262,8 @@ var extractHookCommand = (entries, needle) => {
258
262
  if (!Array.isArray(entries)) return null;
259
263
  for (const entry of entries) {
260
264
  const hookList = entry.hooks;
261
- if (!Array.isArray(hookList)) continue;
262
- for (const candidate of hookList) {
265
+ const candidates = Array.isArray(hookList) ? hookList : [entry];
266
+ for (const candidate of candidates) {
263
267
  const command = candidate.command;
264
268
  if (typeof command === "string" && command.includes(needle)) return command;
265
269
  }
@@ -609,13 +613,18 @@ var main = async () => {
609
613
  }
610
614
  }
611
615
  const cursorPluginDir2 = cursorPluginDir();
612
- if (existsSync(cursorPluginDir2)) {
616
+ const cursorUserHooksJson = readJson(cursorUserHooks());
617
+ const cursorUserMcpJson = readJson(cursorUserMcp());
618
+ if (cursorWired({
619
+ userHooks: cursorUserHooksJson,
620
+ mcp: cursorUserMcpJson,
621
+ pluginDirExists: existsSync(cursorPluginDir2)
622
+ })) {
613
623
  checking("Cursor");
614
- const cursorUserHooks2 = cursorUserHooks();
615
- const userHooks = readJson(cursorUserHooks2);
624
+ const userHooks = cursorUserHooksJson;
616
625
  const gateEntries = CURSOR_GATE_EVENTS.map((event) => ({
617
626
  event,
618
- entry: userHooks?.hooks?.[event]?.find((h) => String(h.command ?? "").includes("pushary-gate"))
627
+ entry: userHooks?.hooks?.[event]?.find((h) => pusharyHookExecutable(String(h.command ?? "")) !== null)
619
628
  }));
620
629
  const missing = gateEntries.filter(({ entry }) => !entry).map(({ event }) => event);
621
630
  if (missing.length === gateEntries.length) {
@@ -623,7 +632,7 @@ var main = async () => {
623
632
  } else if (missing.length > 0) {
624
633
  check(false, "Cursor: permission gate registered", `${missing.join(", ")} not registered \u2014 re-run setup`);
625
634
  } else {
626
- const paths_ = gateEntries.map(({ entry }) => String(entry.command).match(/"([^"]+)"/)?.[1] ?? "");
635
+ const paths_ = gateEntries.map(({ entry }) => pusharyHookExecutable(String(entry.command)) ?? "");
627
636
  const broken = paths_.filter((path) => !path || !existsSync(path));
628
637
  check(
629
638
  broken.length === 0,
@@ -631,17 +640,18 @@ var main = async () => {
631
640
  broken.length === 0 ? `~/.cursor/hooks.json \u2192 ${paths_[0]} (${gateEntries.length} events)` : `gate script not found: ${broken[0]} \u2014 re-run setup`
632
641
  );
633
642
  }
634
- const cursorMcp = readJson(join(cursorPluginDir2, "mcp.json"));
635
- const cursorServers = cursorMcp?.mcpServers ?? {};
636
- const cursorAuth = cursorServers.pushary?.headers?.Authorization;
643
+ const { authorization: cursorAuth, source: cursorMcpSource } = cursorMcpAuthorization(
644
+ readJson(join(cursorPluginDir2, "mcp.json")),
645
+ cursorUserMcpJson
646
+ );
637
647
  if (!cursorAuth) {
638
- check(false, "Cursor: API key linked", "no Authorization in plugin mcp.json \u2014 re-run setup");
648
+ check(false, "Cursor: API key linked", `no Authorization in ${cursorMcpSource} \u2014 re-run setup`);
639
649
  } else if (cursorAuth.includes("PUSHARY_API_KEY")) {
640
- check(false, "Cursor: API key linked", "plugin relies on $PUSHARY_API_KEY; re-run setup to embed the key so the gate works when Cursor is launched from the GUI");
650
+ check(false, "Cursor: API key linked", `${cursorMcpSource} relies on $PUSHARY_API_KEY; re-run setup to embed the key so the gate works when Cursor is launched from the GUI`);
641
651
  } else if (apiKey && cursorAuth !== `Bearer ${apiKey}`) {
642
652
  check(false, "Cursor: API key matches active key", "the embedded key is not the key hooks use (rotated?) \u2014 re-run setup");
643
653
  } else {
644
- check(true, "Cursor: API key linked", "embedded in plugin mcp.json");
654
+ check(true, "Cursor: API key linked", `embedded in ${cursorMcpSource}`);
645
655
  }
646
656
  } else {
647
657
  skipped("Cursor", installed("cursor") ? "installed, but Pushary is not set up for it" : "not installed");
@@ -658,16 +668,16 @@ var main = async () => {
658
668
  registeredIn.length > 0 ? registeredIn.join(", ") : "not listed in chat.pluginLocations \u2014 re-run setup (an unregistered plugin directory is never loaded)"
659
669
  );
660
670
  const vscodeHooks = readJson(join(vscodePluginDir2, "hooks", "hooks.json"));
661
- const gateEntry = vscodeHooks?.hooks?.PreToolUse?.find((h) => String(h.command ?? "").includes("pushary-gate"));
662
- if (!gateEntry) {
671
+ const gateCommand = extractAgentHookCommand(vscodeHooks?.hooks?.PreToolUse, CURSOR_GATE_SCRIPT);
672
+ if (!gateCommand) {
663
673
  check(false, "VS Code: permission gate present", "no Pushary gate in the plugin hooks.json \u2014 re-run setup");
664
674
  } else {
665
- const scriptPath = String(gateEntry.command).match(/"([^"]+)"/)?.[1] ?? "";
675
+ const scriptPath = pusharyHookExecutable(gateCommand) ?? "";
666
676
  const resolves = scriptPath ? existsSync(scriptPath) : false;
667
677
  check(
668
678
  resolves,
669
679
  "VS Code: permission gate present",
670
- resolves ? scriptPath : `gate script not found: ${scriptPath || gateEntry.command} \u2014 re-run setup`
680
+ resolves ? scriptPath : `gate script not found: ${scriptPath || gateCommand} \u2014 re-run setup`
671
681
  );
672
682
  }
673
683
  const vscodeMcp = readJson(join(vscodePluginDir2, ".mcp.json"));
@@ -11,16 +11,16 @@ import {
11
11
  cancelQuestion,
12
12
  pollForAnswer,
13
13
  savePendingQuestion
14
- } from "../chunk-UXHMWF4H.js";
14
+ } from "../chunk-JHJHCMAF.js";
15
15
  import {
16
16
  getMachineId
17
- } from "../chunk-DKWM5T3P.js";
18
- import "../chunk-QA72MKIT.js";
17
+ } from "../chunk-5NDB3YOE.js";
18
+ import "../chunk-OVEGEQSB.js";
19
19
  import "../chunk-BSZYIAZL.js";
20
20
  import "../chunk-SAF6HGAA.js";
21
21
  import "../chunk-7QLSKOSU.js";
22
22
  import "../chunk-KZERVKTD.js";
23
- import "../chunk-XX2V4QS5.js";
23
+ import "../chunk-4LL6LG5X.js";
24
24
  import {
25
25
  getApiKey
26
26
  } from "../chunk-2UMNXADU.js";
@@ -34,7 +34,7 @@ import {
34
34
  planElicitationAsk,
35
35
  readElicitationFields,
36
36
  renderElicitationOutput
37
- } from "../chunk-X6RXX2NF.js";
37
+ } from "../chunk-3MCEES6Z.js";
38
38
 
39
39
  // bin/pushary-elicitation-hook.ts
40
40
  import { basename } from "path";