@pushary/agent-hooks 0.95.7 → 0.97.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 (82) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/bin/pushary-bell-hook.js +19 -21
  3. package/dist/bin/pushary-bell.js +6 -8
  4. package/dist/bin/pushary-claude.js +21 -23
  5. package/dist/bin/pushary-clean.js +67 -32
  6. package/dist/bin/pushary-codex-bridge.js +13 -14
  7. package/dist/bin/pushary-codex-hook.js +452 -104
  8. package/dist/bin/pushary-codex.js +8 -8
  9. package/dist/bin/pushary-connect.js +6 -6
  10. package/dist/bin/pushary-cowork.js +3 -3
  11. package/dist/bin/pushary-daemon.js +25 -27
  12. package/dist/bin/pushary-disconnect.js +6 -8
  13. package/dist/bin/pushary-doctor.js +28 -23
  14. package/dist/bin/pushary-elicitation-hook.js +19 -21
  15. package/dist/bin/pushary-gemini-bridge.js +11 -12
  16. package/dist/bin/pushary-gemini-hook.js +22 -24
  17. package/dist/bin/pushary-hook.js +24 -26
  18. package/dist/bin/pushary-login.js +7 -8
  19. package/dist/bin/pushary-logout.js +4 -4
  20. package/dist/bin/pushary-mode.js +3 -3
  21. package/dist/bin/pushary-notification-hook.js +21 -23
  22. package/dist/bin/pushary-opencode-hook.js +22 -24
  23. package/dist/bin/pushary-permission-denied-hook.js +28 -27
  24. package/dist/bin/pushary-permission-hook.js +24 -26
  25. package/dist/bin/pushary-post-hook.js +21 -23
  26. package/dist/bin/pushary-prompt-hook.js +21 -23
  27. package/dist/bin/pushary-session-end-hook.js +21 -23
  28. package/dist/bin/pushary-session-start-hook.js +24 -26
  29. package/dist/bin/pushary-setup.js +34 -38
  30. package/dist/bin/pushary-stats.js +2 -2
  31. package/dist/bin/pushary-status.js +10 -11
  32. package/dist/bin/pushary-stop-hook.js +21 -23
  33. package/dist/bin/pushary-stopfailure-hook.js +21 -23
  34. package/dist/bin/pushary-transcript-register.js +17 -19
  35. package/dist/bin/pushary-transcripts.js +5 -5
  36. package/dist/bin/pushary-upgrade.js +17 -20
  37. package/dist/bin/pushary-wait.js +3 -3
  38. package/dist/{chunk-WAUAYRUQ.js → chunk-3SNTEHOH.js} +4 -4
  39. package/dist/{chunk-WPS5IM7B.js → chunk-4AXWBCCO.js} +4 -4
  40. package/dist/{chunk-IZVK6FKD.js → chunk-5ODZEFP3.js} +1 -1
  41. package/dist/{chunk-BGX4QUQF.js → chunk-67RNDRKL.js} +261 -31
  42. package/dist/{chunk-HAXZ6CBF.js → chunk-6VXZKOBB.js} +8 -8
  43. package/dist/{chunk-CNUDZS4V.js → chunk-6WJKYD3Q.js} +8 -8
  44. package/dist/{chunk-EMGGUO2Q.js → chunk-A4AIISZZ.js} +1 -1
  45. package/dist/{chunk-N6FAXQDD.js → chunk-AXSDMDJI.js} +1 -1
  46. package/dist/{chunk-XO3JR3OP.js → chunk-B3557BDL.js} +2 -2
  47. package/dist/{chunk-QJPYJVL3.js → chunk-BYH75I7Y.js} +1 -1
  48. package/dist/{chunk-VERXHIQF.js → chunk-C2FYSFTQ.js} +1 -1
  49. package/dist/{chunk-SKPXQRKN.js → chunk-CDSA3NTB.js} +1 -1
  50. package/dist/{chunk-XJQOVWBQ.js → chunk-DGUMR5LZ.js} +6 -6
  51. package/dist/{chunk-54W7ELDQ.js → chunk-DNLFSRCF.js} +2 -2
  52. package/dist/{chunk-6W2WGNO5.js → chunk-DOKFLZWL.js} +10 -14
  53. package/dist/{chunk-U5RIXR7I.js → chunk-EHQC3GWL.js} +1 -1
  54. package/dist/{chunk-GQRU4KJF.js → chunk-FU5SQKAY.js} +15 -4
  55. package/dist/{chunk-TY6IJY6I.js → chunk-GGYH6LIE.js} +1 -1
  56. package/dist/{chunk-XZWUOCJZ.js → chunk-H4VNAOCG.js} +1 -1
  57. package/dist/{chunk-MC5WUOJJ.js → chunk-HUZW6SEO.js} +75 -1
  58. package/dist/{chunk-7RNY3UHJ.js → chunk-IBRX7LRE.js} +8 -10
  59. package/dist/{chunk-UKMLSQXA.js → chunk-ICUBJNFL.js} +2 -2
  60. package/dist/{chunk-4OSQZ5TB.js → chunk-IZKCA35M.js} +2 -2
  61. package/dist/{chunk-NKUE5SJB.js → chunk-K7MLXXPY.js} +2 -2
  62. package/dist/{chunk-PQGLDN4V.js → chunk-KDPYXMUI.js} +2 -2
  63. package/dist/{chunk-XS33QBJA.js → chunk-LGXUGYUH.js} +50 -1
  64. package/dist/{chunk-VMZ4SWQD.js → chunk-LYWTLNMG.js} +6 -8
  65. package/dist/chunk-OYTOLQ3N.js +15 -0
  66. package/dist/{chunk-XUTSZYYJ.js → chunk-QFAZ6QCT.js} +1 -4
  67. package/dist/{chunk-FRXZMCVA.js → chunk-ROTIPRM4.js} +1 -1
  68. package/dist/{chunk-BQL7UDIB.js → chunk-SW37HB27.js} +1 -1
  69. package/dist/{chunk-Z4JVEL7R.js → chunk-VCKQ45QA.js} +191 -2
  70. package/dist/{chunk-SDNTRS76.js → chunk-VDTC5DEM.js} +1 -1
  71. package/dist/{chunk-VMQU7YEJ.js → chunk-VF7YOT2W.js} +1 -1
  72. package/dist/{chunk-5GKNAQTG.js → chunk-VOC55PQV.js} +1 -1
  73. package/dist/{chunk-L7NOG547.js → chunk-VTUN7WSG.js} +1 -1
  74. package/dist/{chunk-GOPIMNVC.js → chunk-WIKEADOS.js} +1 -1
  75. package/dist/chunk-XDMHLQMH.js +202 -0
  76. package/dist/{chunk-USWT4PTR.js → chunk-YRXVC4HL.js} +1 -1
  77. package/dist/{chunk-VIUOGMT5.js → chunk-YX3U2CLP.js} +111 -55
  78. package/dist/src/index.js +11 -11
  79. package/package.json +1 -1
  80. package/dist/chunk-3AJIK5AO.js +0 -57
  81. package/dist/chunk-L4ZCFMWW.js +0 -177
  82. package/dist/chunk-VDI645ZX.js +0 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.97.0
4
+
5
+ Requires the Codex auto-reviewer handling in `POST /api/agent/gate`, Codex bodies on `POST /api/agent/blocked-action/claim`, the `blocked-action/v2` Claude identity and `sessionCwd` on the gate request before rollout. Run `pushary upgrade` so Claude Code's `PermissionDenied` and Codex's `Stop` are registered with the hold budget, Codex gives `Stop` the full hook budget, and Codex trusts it again.
6
+
7
+ - When Codex runs with `--approve-for-me`, stop asking you before its auto-reviewer. `PreToolUse` and `PermissionRequest` have no opinion under the reviewer, after the kill switch and a standing deny, so nothing the reviewer allows reaches your phone.
8
+ - When the auto-reviewer denies a shell command, hold the turn end and ask once whether to allow that exact command. A yes continues the turn, Codex runs the same command again, and the retry skips the reviewer once. A no, or no answer, lets the denial stand. Denials of `apply_patch` and MCP calls are not asked about yet. The request names the session's directory as well as the command's, so the card can say where the command runs.
9
+ - Hold a blocked call only when the hook can prove its host waits that long: the `--hold-budget=<seconds>` argument its registration now carries, or the budget the Mac app hands down in `PUSHARY_HOLD_BUDGET_SECONDS`. The hold never waits past that budget less its reserves. Without proof, which is an install registered before this release, the Claude plugin's older entry, an update that skipped `--finish-upgrade` or a Mac app built before it, a Claude block sends the "Auto mode blocked <tool>" notification instead, and a Codex turn end reads no denial, so it is still asked about once the hook is upgraded.
10
+ - Build the `blocked-action/v2` identity for a Claude call, which includes its working directory, so the retry's hint and claim match the server's grant. A Claude call with no working directory is not asked about. Keep the retry hint for the grant's two minutes rather than ten.
11
+ - `pushary doctor` warns when a `PermissionDenied` or Codex `Stop` registration carries no hold budget.
12
+
13
+ ## 0.96.0
14
+
15
+ Requires the auto-mode block handling in `POST /api/agent/gate` and the `POST /api/agent/blocked-action/claim` route before rollout. Run `pushary upgrade` so Claude Code gives the `PermissionDenied` hook the full approval window.
16
+
17
+ - When Claude Code's auto mode blocks a call, hold the agent and ask once whether to allow that exact call. A yes retries it and the retry runs. A no, or no answer, lets the block stand.
18
+ - Stop sending a separate "Auto-mode blocked" notification and remove `PUSHARY_AUTOMODE_RETRY`. The server now decides whether a block is asked about, so the kill switch, a standing deny and your approval mode all apply.
19
+
20
+ ## 0.95.8
21
+
22
+ - Stop `clean` leaving a key it installed in Claude Code, Codex and Gemini when the Mac app is installed. An entry is kept only when its key is the one the Mac app holds; when the app has never signed in, the key setup recorded is removed.
23
+ - Keep `~/.pushary/bridge-auth` when the Mac app is installed. `clean` used to delete the app's bridge key.
24
+
3
25
  ## 0.95.7
4
26
 
5
27
  - Let Gemini's own prompt decide in When I'm out when Pushary cannot create the approval question, instead of refusing the call. Every time still refuses, and says Pushary could not create a verifiable approval.
@@ -1,36 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handleBell
4
- } from "../chunk-TY6IJY6I.js";
4
+ } from "../chunk-GGYH6LIE.js";
5
5
  import {
6
6
  readHookInput
7
- } from "../chunk-IZVK6FKD.js";
8
- import "../chunk-HAXZ6CBF.js";
9
- import "../chunk-EMGGUO2Q.js";
10
- import "../chunk-WPS5IM7B.js";
11
- import "../chunk-XZWUOCJZ.js";
12
- import "../chunk-QJPYJVL3.js";
13
- import "../chunk-GQRU4KJF.js";
14
- import "../chunk-VMZ4SWQD.js";
15
- import "../chunk-7RNY3UHJ.js";
16
- import "../chunk-GOPIMNVC.js";
17
- import "../chunk-3AJIK5AO.js";
18
- import "../chunk-SKPXQRKN.js";
7
+ } from "../chunk-5ODZEFP3.js";
8
+ import "../chunk-6VXZKOBB.js";
9
+ import "../chunk-A4AIISZZ.js";
10
+ import "../chunk-4AXWBCCO.js";
11
+ import "../chunk-H4VNAOCG.js";
12
+ import "../chunk-BYH75I7Y.js";
13
+ import "../chunk-FU5SQKAY.js";
14
+ import "../chunk-LYWTLNMG.js";
15
+ import "../chunk-IBRX7LRE.js";
16
+ import "../chunk-WIKEADOS.js";
17
+ import "../chunk-CDSA3NTB.js";
19
18
  import "../chunk-EQRS3SGM.js";
20
- import "../chunk-VERXHIQF.js";
19
+ import "../chunk-C2FYSFTQ.js";
21
20
  import "../chunk-XHKBHWLX.js";
22
- import "../chunk-L4ZCFMWW.js";
23
- import "../chunk-XUTSZYYJ.js";
24
- import "../chunk-4OSQZ5TB.js";
25
- import "../chunk-BGX4QUQF.js";
21
+ import "../chunk-QFAZ6QCT.js";
22
+ import "../chunk-IZKCA35M.js";
23
+ import "../chunk-67RNDRKL.js";
26
24
  import "../chunk-GMXKITVA.js";
27
25
  import "../chunk-DINDL2CF.js";
28
- import "../chunk-VMQU7YEJ.js";
26
+ import "../chunk-VF7YOT2W.js";
29
27
  import "../chunk-7QLSKOSU.js";
30
28
  import "../chunk-KZERVKTD.js";
31
- import "../chunk-L7NOG547.js";
29
+ import "../chunk-VTUN7WSG.js";
32
30
  import "../chunk-2UMNXADU.js";
33
- import "../chunk-MC5WUOJJ.js";
31
+ import "../chunk-HUZW6SEO.js";
34
32
 
35
33
  // bin/pushary-bell-hook.ts
36
34
  var main = async () => {
@@ -5,17 +5,15 @@ import {
5
5
  liveAgentCount,
6
6
  ring,
7
7
  upgradeThreshold
8
- } from "../chunk-TY6IJY6I.js";
8
+ } from "../chunk-GGYH6LIE.js";
9
9
  import {
10
10
  addBellHooks,
11
11
  bellInstalled,
12
12
  removeBellHooks
13
- } from "../chunk-GOPIMNVC.js";
14
- import "../chunk-3AJIK5AO.js";
15
- import "../chunk-L4ZCFMWW.js";
13
+ } from "../chunk-WIKEADOS.js";
16
14
  import {
17
15
  claudeSettings
18
- } from "../chunk-BGX4QUQF.js";
16
+ } from "../chunk-67RNDRKL.js";
19
17
  import {
20
18
  createIo
21
19
  } from "../chunk-5RUIFDTP.js";
@@ -27,7 +25,7 @@ import {
27
25
  parseFlags
28
26
  } from "../chunk-GMXKITVA.js";
29
27
  import "../chunk-DINDL2CF.js";
30
- import "../chunk-VMQU7YEJ.js";
28
+ import "../chunk-VF7YOT2W.js";
31
29
  import "../chunk-7QLSKOSU.js";
32
30
  import {
33
31
  EXIT
@@ -35,9 +33,9 @@ import {
35
33
  import {
36
34
  readJsonSafe,
37
35
  writeJsonAtomic
38
- } from "../chunk-L7NOG547.js";
36
+ } from "../chunk-VTUN7WSG.js";
39
37
  import "../chunk-2UMNXADU.js";
40
- import "../chunk-MC5WUOJJ.js";
38
+ import "../chunk-HUZW6SEO.js";
41
39
 
42
40
  // bin/pushary-bell.ts
43
41
  exitOnHelpFlag("bell");
@@ -8,7 +8,7 @@ import {
8
8
  describeIdleWindow,
9
9
  startProcessOwnership,
10
10
  withSpawnProcessOwnership
11
- } from "../chunk-PQGLDN4V.js";
11
+ } from "../chunk-KDPYXMUI.js";
12
12
  import {
13
13
  isDeferAnswer
14
14
  } from "../chunk-YHG74UFF.js";
@@ -17,30 +17,28 @@ import {
17
17
  loadSessionKey,
18
18
  registerTranscript,
19
19
  registeredTranscriptEnabled
20
- } from "../chunk-HAXZ6CBF.js";
21
- import "../chunk-EMGGUO2Q.js";
22
- import "../chunk-WPS5IM7B.js";
23
- import "../chunk-XZWUOCJZ.js";
24
- import "../chunk-QJPYJVL3.js";
25
- import "../chunk-GQRU4KJF.js";
20
+ } from "../chunk-6VXZKOBB.js";
21
+ import "../chunk-A4AIISZZ.js";
22
+ import "../chunk-4AXWBCCO.js";
23
+ import "../chunk-H4VNAOCG.js";
24
+ import "../chunk-BYH75I7Y.js";
25
+ import "../chunk-FU5SQKAY.js";
26
26
  import {
27
27
  ensureDaemonRunning
28
- } from "../chunk-VMZ4SWQD.js";
29
- import "../chunk-7RNY3UHJ.js";
30
- import "../chunk-GOPIMNVC.js";
31
- import "../chunk-3AJIK5AO.js";
28
+ } from "../chunk-LYWTLNMG.js";
29
+ import "../chunk-IBRX7LRE.js";
30
+ import "../chunk-WIKEADOS.js";
32
31
  import {
33
32
  encryptRecord
34
- } from "../chunk-SKPXQRKN.js";
33
+ } from "../chunk-CDSA3NTB.js";
35
34
  import "../chunk-EQRS3SGM.js";
36
35
  import {
37
36
  transcriptsEnabled
38
- } from "../chunk-VERXHIQF.js";
37
+ } from "../chunk-C2FYSFTQ.js";
39
38
  import {
40
39
  needsShell,
41
40
  spawnClaude
42
41
  } from "../chunk-XHKBHWLX.js";
43
- import "../chunk-L4ZCFMWW.js";
44
42
  import {
45
43
  DEFAULT_SESSION,
46
44
  fetchModeState,
@@ -54,14 +52,14 @@ import {
54
52
  repoKeyFor,
55
53
  reportEvent,
56
54
  savePendingCommand
57
- } from "../chunk-XJQOVWBQ.js";
55
+ } from "../chunk-DGUMR5LZ.js";
58
56
  import {
59
57
  UNNAMED_ACTION,
60
58
  deriveToolTarget,
61
59
  describeToolCall,
62
60
  scopePathFor
63
- } from "../chunk-Z4JVEL7R.js";
64
- import "../chunk-XUTSZYYJ.js";
61
+ } from "../chunk-VCKQ45QA.js";
62
+ import "../chunk-QFAZ6QCT.js";
65
63
  import {
66
64
  DECISION_STOP_REASON,
67
65
  askUser,
@@ -71,19 +69,19 @@ import {
71
69
  nextLongPollMs,
72
70
  waitForAnswer,
73
71
  withdrawQuestion
74
- } from "../chunk-XS33QBJA.js";
72
+ } from "../chunk-LGXUGYUH.js";
75
73
  import {
76
74
  getMachineId
77
- } from "../chunk-4OSQZ5TB.js";
78
- import "../chunk-BGX4QUQF.js";
75
+ } from "../chunk-IZKCA35M.js";
76
+ import "../chunk-67RNDRKL.js";
79
77
  import "../chunk-GMXKITVA.js";
80
78
  import "../chunk-DINDL2CF.js";
81
- import "../chunk-VMQU7YEJ.js";
79
+ import "../chunk-VF7YOT2W.js";
82
80
  import "../chunk-EYRGBYZG.js";
83
81
  import "../chunk-SAF6HGAA.js";
84
82
  import "../chunk-7QLSKOSU.js";
85
83
  import "../chunk-KZERVKTD.js";
86
- import "../chunk-L7NOG547.js";
84
+ import "../chunk-VTUN7WSG.js";
87
85
  import {
88
86
  getApiKey,
89
87
  getBaseUrl
@@ -92,7 +90,7 @@ import {
92
90
  KILL_REASON,
93
91
  redactSecrets,
94
92
  resolveGate
95
- } from "../chunk-MC5WUOJJ.js";
93
+ } from "../chunk-HUZW6SEO.js";
96
94
 
97
95
  // src/wrapper/localPassthrough.ts
98
96
  var SIGNAL_NUMBERS = {
@@ -5,14 +5,14 @@ import {
5
5
  createGuards,
6
6
  resolveHermesPython,
7
7
  runHermesPythonScript
8
- } from "../chunk-N6FAXQDD.js";
8
+ } from "../chunk-AXSDMDJI.js";
9
9
  import "../chunk-KBITFQST.js";
10
10
  import {
11
11
  removeInstructionBlock,
12
12
  shortenHome,
13
13
  unregisterPluginLocation,
14
14
  vscodeSettingsTargets
15
- } from "../chunk-NKUE5SJB.js";
15
+ } from "../chunk-K7MLXXPY.js";
16
16
  import {
17
17
  OPENCODE_PLUGIN_SIBLING,
18
18
  OPENCODE_PLUGIN_SIBLING_CONTENTS,
@@ -22,40 +22,37 @@ import {
22
22
  openCodePluginDir,
23
23
  openCodePluginFile,
24
24
  removeOpenCodeMcpServer
25
- } from "../chunk-U5RIXR7I.js";
25
+ } from "../chunk-EHQC3GWL.js";
26
26
  import {
27
27
  isClaudeMcpSnapshot,
28
28
  removeClaudeMcpServers,
29
29
  removePusharySettings,
30
30
  restoreClaudeMcpServer
31
- } from "../chunk-CNUDZS4V.js";
31
+ } from "../chunk-6WJKYD3Q.js";
32
32
  import {
33
33
  hookOwnerOf,
34
34
  isHookTakeoverReceipt,
35
35
  restoreHookTakeover,
36
36
  restoreMcpServer
37
- } from "../chunk-WPS5IM7B.js";
38
- import "../chunk-XZWUOCJZ.js";
39
- import "../chunk-QJPYJVL3.js";
37
+ } from "../chunk-4AXWBCCO.js";
38
+ import "../chunk-H4VNAOCG.js";
39
+ import "../chunk-BYH75I7Y.js";
40
40
  import {
41
41
  pusharyHookExecutable
42
- } from "../chunk-GQRU4KJF.js";
42
+ } from "../chunk-FU5SQKAY.js";
43
43
  import {
44
44
  disableDaemonService
45
- } from "../chunk-VMZ4SWQD.js";
45
+ } from "../chunk-LYWTLNMG.js";
46
46
  import {
47
47
  removeGeminiSettings
48
- } from "../chunk-7RNY3UHJ.js";
49
- import "../chunk-GOPIMNVC.js";
50
- import "../chunk-3AJIK5AO.js";
48
+ } from "../chunk-IBRX7LRE.js";
49
+ import "../chunk-WIKEADOS.js";
51
50
  import "../chunk-XHKBHWLX.js";
51
+ import "../chunk-VCKQ45QA.js";
52
+ import "../chunk-QFAZ6QCT.js";
53
+ import "../chunk-IZKCA35M.js";
52
54
  import {
53
- execNpm
54
- } from "../chunk-L4ZCFMWW.js";
55
- import "../chunk-Z4JVEL7R.js";
56
- import "../chunk-XUTSZYYJ.js";
57
- import "../chunk-4OSQZ5TB.js";
58
- import {
55
+ bridgeAgentKey,
59
56
  claudeJson,
60
57
  claudeMcpReceipt,
61
58
  claudeSettings,
@@ -69,18 +66,20 @@ import {
69
66
  cursorPluginDir,
70
67
  cursorUserHooks,
71
68
  cursorUserMcp,
69
+ execNpm,
72
70
  geminiMd,
73
71
  geminiSettings,
74
72
  hermesConfigReceipt,
75
73
  hookTakeoverReceipt,
76
74
  isProtectedByScope,
77
75
  pusharyDir,
76
+ readCodexMcpAuth,
78
77
  removeCodexHookTrust,
79
78
  removeCodexHooks,
80
79
  restoreCodexHookTrust,
81
80
  vscodePluginDir,
82
81
  vscodePluginMcp
83
- } from "../chunk-BGX4QUQF.js";
82
+ } from "../chunk-67RNDRKL.js";
84
83
  import {
85
84
  exitOnHelpFlag
86
85
  } from "../chunk-GOQHN2UH.js";
@@ -91,17 +90,18 @@ import {
91
90
  import "../chunk-DINDL2CF.js";
92
91
  import {
93
92
  removeClaudeAlias
94
- } from "../chunk-VMQU7YEJ.js";
93
+ } from "../chunk-VF7YOT2W.js";
95
94
  import "../chunk-7QLSKOSU.js";
96
95
  import {
97
96
  EXIT
98
97
  } from "../chunk-KZERVKTD.js";
99
- import "../chunk-L7NOG547.js";
98
+ import "../chunk-VTUN7WSG.js";
100
99
  import "../chunk-2UMNXADU.js";
101
100
  import {
102
101
  CURSOR_GATE_EVENTS,
103
- HOOK_LOCATOR_BINARY
104
- } from "../chunk-MC5WUOJJ.js";
102
+ HOOK_LOCATOR_BINARY,
103
+ isValidApiKey
104
+ } from "../chunk-HUZW6SEO.js";
105
105
 
106
106
  // bin/pushary-clean.ts
107
107
  import { existsSync, readFileSync, copyFileSync, readdirSync } from "fs";
@@ -121,10 +121,24 @@ var APP_OWNED_ENTRIES = [
121
121
  // Shared: AgentInstaller.vscodePlugin writes .pushary/plugins/vscode, and so
122
122
  // does the CLI. Not attributable, so it is kept whenever the app is installed
123
123
  // rather than removed and left registered against a path that is gone.
124
- "plugins"
124
+ "plugins",
125
+ "bridge-auth"
125
126
  ];
126
127
  var isAppOwned = (name) => APP_OWNED_ENTRIES.includes(name);
127
128
 
129
+ // src/shared-mcp-key.ts
130
+ var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
131
+ var pusharyKey = (value) => typeof value === "string" && isValidApiKey(value.trim()) ? value.trim() : null;
132
+ var bearerKey = (authorization) => typeof authorization === "string" && authorization.startsWith("Bearer ") ? pusharyKey(authorization.slice("Bearer ".length)) : null;
133
+ var mcpServerBearer = (mcpServers) => bearerKey(asRecord(asRecord(asRecord(mcpServers)?.pushary)?.headers)?.Authorization);
134
+ var appAgentKey = (bridgeAgentKey2) => pusharyKey(asRecord(bridgeAgentKey2)?.key);
135
+ var setupReceiptKey = (claudeMcpReceipt2) => bearerKey(asRecord(asRecord(asRecord(claudeMcpReceipt2)?.installedPushary)?.headers)?.Authorization);
136
+ var macAppKeepsMcpEntry = (entryKey, keys) => {
137
+ if (!entryKey) return true;
138
+ if (keys.appKey) return entryKey === keys.appKey;
139
+ return entryKey !== keys.setupKey;
140
+ };
141
+
128
142
  // bin/pushary-clean.ts
129
143
  exitOnHelpFlag("clean");
130
144
  var dim = (s) => `\x1B[2m${s}\x1B[0m`;
@@ -154,6 +168,10 @@ var removalScope = (keepMcpServer) => ({
154
168
  keepAppWiring: true,
155
169
  keepMcpServer
156
170
  });
171
+ var codexMcpKey = (config) => {
172
+ const auth = readCodexMcpAuth(config);
173
+ return auth?.method === "embedded" ? pusharyKey(auth.key) : null;
174
+ };
157
175
  var readJson = (path) => {
158
176
  try {
159
177
  return JSON.parse(readFileSync(path, "utf-8"));
@@ -355,7 +373,15 @@ var main = async () => {
355
373
  console.log(` ${dim("The Mac app is installed, so its wiring and the state it owns are left alone.")}`);
356
374
  console.log();
357
375
  }
376
+ const restoredByTakeover = new Set(
377
+ ["claude_code", "codex", "gemini_cli"].filter((agent) => existsSync(hookTakeoverReceipt(agent)))
378
+ );
358
379
  if (keepShared) restoreTakeoverReceipts();
380
+ const sharedMcpKeys = {
381
+ appKey: appAgentKey(readJson(bridgeAgentKey())),
382
+ setupKey: setupReceiptKey(readJson(CLAUDE_MCP_RECEIPT))
383
+ };
384
+ const macAppKeeps = (agent, entryKey) => keepShared && (restoredByTakeover.has(agent) || macAppKeepsMcpEntry(entryKey, sharedMcpKeys));
359
385
  if (keepCliRuntime) {
360
386
  console.log(` ${yellow(bold("Clean stopped before changing provider configuration."))}`);
361
387
  console.log(` ${dim("Fix the hooks file or receipt above, then re-run")} npx @pushary/agent-hooks@latest clean`);
@@ -370,22 +396,24 @@ var main = async () => {
370
396
  process.exit(EXIT.FAILED);
371
397
  }
372
398
  console.log(` ${check} Background service ${dim(did("uninstalled"))}`);
373
- cleanSettingsFile(CLAUDE_SETTINGS, "Claude Code settings", scope);
374
- cleanSettingsFile(CLAUDE_SETTINGS_LOCAL, "Claude Code settings.local", scope);
375
- const claudeJson2 = keepShared ? null : readJson(CLAUDE_JSON);
376
- if (keepShared) {
399
+ const claudeJson2 = readJson(CLAUDE_JSON);
400
+ const keepClaudeMcp = macAppKeeps("claude_code", mcpServerBearer(claudeJson2?.mcpServers));
401
+ const claudeHasPusharyEntry = () => Boolean(claudeJson2?.mcpServers?.pushary);
402
+ const claudeHadPusharyEntry = claudeHasPusharyEntry();
403
+ if (keepClaudeMcp) {
377
404
  console.log(` ${skip} Claude Code MCP servers ${dim("(kept: the Mac app uses it)")}`);
378
405
  } else if (claudeJson2) {
379
406
  const rawReceipt = readJson(CLAUDE_MCP_RECEIPT);
380
407
  const receipt = isClaudeMcpSnapshot(rawReceipt) ? rawReceipt : null;
381
408
  if (existsSync(CLAUDE_MCP_RECEIPT) && !receipt) {
382
- incompleteClean = true;
409
+ if (!keepShared) incompleteClean = true;
383
410
  console.log(` ${skip} Claude Code MCP servers ${dim("(setup receipt is unreadable; left unchanged)")}`);
384
411
  } else if (receipt && restoreClaudeMcpServer(claudeJson2, receipt) || !receipt && removeClaudeMcpServers(claudeJson2)) {
385
412
  writeJson(CLAUDE_JSON, claudeJson2);
386
413
  console.log(` ${check} Claude Code MCP servers ${dim(receipt ? "(previous entry restored)" : "(removed from ~/.claude.json)")}`);
414
+ if (keepShared && receipt) guardedRemove(CLAUDE_MCP_RECEIPT, { force: true });
387
415
  } else {
388
- if (receipt) incompleteClean = true;
416
+ if (receipt && !keepShared) incompleteClean = true;
389
417
  console.log(` ${skip} Claude Code MCP servers ${dim(receipt ? "(changed after setup; left unchanged)" : "(no pushary entries)")}`);
390
418
  }
391
419
  } else if (existsSync(CLAUDE_MCP_RECEIPT)) {
@@ -394,6 +422,9 @@ var main = async () => {
394
422
  } else {
395
423
  console.log(` ${skip} Claude Code MCP servers ${dim("(not found)")}`);
396
424
  }
425
+ const claudeScope = removalScope(keepShared && !(claudeHadPusharyEntry && !claudeHasPusharyEntry()));
426
+ cleanSettingsFile(CLAUDE_SETTINGS, "Claude Code settings", claudeScope);
427
+ cleanSettingsFile(CLAUDE_SETTINGS_LOCAL, "Claude Code settings.local", claudeScope);
397
428
  const cursorData = keepShared ? null : readJson(CURSOR_MCP);
398
429
  if (keepShared) {
399
430
  console.log(` ${skip} Cursor MCP config ${dim("(kept: the Mac app uses it)")}`);
@@ -469,7 +500,8 @@ var main = async () => {
469
500
  const trustRemoved = hookOwnerOf(codexHooksData) === "app" ? false : removeCodexHookTrust(parsed, codexHooksJson2, codexPositions);
470
501
  const hadPushary = config.includes("pushary");
471
502
  if (hadPushary || trustRemoved) {
472
- if (!keepShared) {
503
+ const macAppKeepsCodexMcp = macAppKeeps("codex", codexMcpKey(parsed));
504
+ if (!macAppKeepsCodexMcp) {
473
505
  const mcpServers = parsed.mcp_servers ?? {};
474
506
  delete mcpServers.pushary;
475
507
  if (Object.keys(mcpServers).length === 0) delete parsed.mcp_servers;
@@ -482,6 +514,9 @@ var main = async () => {
482
514
  guardedWrite(codexConfig, stringifyTOML(parsed));
483
515
  const what = trustRemoved ? "cleaned, hook trust removed" : "cleaned";
484
516
  console.log(` ${check} Codex config ${dim(did(what))}`);
517
+ if (macAppKeepsCodexMcp && parsed.mcp_servers?.pushary) {
518
+ console.log(` ${skip} Codex MCP server ${dim("(kept: the Mac app uses it)")}`);
519
+ }
485
520
  } else {
486
521
  console.log(` ${skip} Codex config ${dim("(no pushary entries)")}`);
487
522
  }
@@ -518,7 +553,7 @@ var main = async () => {
518
553
  const geminiSettingsPath = geminiSettings();
519
554
  const geminiSettings2 = readJson(geminiSettingsPath);
520
555
  if (geminiSettings2) {
521
- if (removeGeminiSettings(geminiSettings2, scope)) {
556
+ if (removeGeminiSettings(geminiSettings2, removalScope(macAppKeeps("gemini_cli", mcpServerBearer(geminiSettings2.mcpServers))))) {
522
557
  writeJson(geminiSettingsPath, geminiSettings2);
523
558
  console.log(` ${check} Gemini CLI settings ${dim(did("cleaned"))}`);
524
559
  } else {
@@ -1,46 +1,45 @@
1
1
  #!/usr/bin/env node
2
- import "../chunk-54W7ELDQ.js";
2
+ import "../chunk-DNLFSRCF.js";
3
3
  import {
4
4
  LiveTranscriptRelay,
5
5
  liveSessionSleep,
6
6
  postLiveSession,
7
7
  postLiveSessionUntilAccepted,
8
8
  startLiveSessionHeartbeat
9
- } from "../chunk-FRXZMCVA.js";
9
+ } from "../chunk-ROTIPRM4.js";
10
10
  import {
11
11
  SESSION_IDLE_TIMEOUT_MS,
12
12
  describeIdleWindow,
13
13
  idleDeadlinePassed,
14
14
  startProcessOwnership,
15
15
  withSpawnProcessOwnership
16
- } from "../chunk-PQGLDN4V.js";
17
- import "../chunk-SKPXQRKN.js";
16
+ } from "../chunk-KDPYXMUI.js";
17
+ import "../chunk-CDSA3NTB.js";
18
18
  import "../chunk-EQRS3SGM.js";
19
19
  import {
20
20
  transcriptsEnabled
21
- } from "../chunk-VERXHIQF.js";
21
+ } from "../chunk-C2FYSFTQ.js";
22
22
  import {
23
23
  spawnClaude
24
24
  } from "../chunk-XHKBHWLX.js";
25
- import {
26
- resolveBinary
27
- } from "../chunk-L4ZCFMWW.js";
28
25
  import {
29
26
  isDecisionStopped,
30
27
  withdrawQuestion
31
- } from "../chunk-XS33QBJA.js";
28
+ } from "../chunk-LGXUGYUH.js";
32
29
  import {
33
30
  getMachineId
34
- } from "../chunk-4OSQZ5TB.js";
35
- import "../chunk-BGX4QUQF.js";
36
- import "../chunk-VMQU7YEJ.js";
31
+ } from "../chunk-IZKCA35M.js";
32
+ import {
33
+ resolveBinary
34
+ } from "../chunk-67RNDRKL.js";
35
+ import "../chunk-VF7YOT2W.js";
37
36
  import {
38
37
  callMcpTool
39
38
  } from "../chunk-EYRGBYZG.js";
40
39
  import "../chunk-SAF6HGAA.js";
41
40
  import "../chunk-7QLSKOSU.js";
42
41
  import "../chunk-KZERVKTD.js";
43
- import "../chunk-L7NOG547.js";
42
+ import "../chunk-VTUN7WSG.js";
44
43
  import {
45
44
  getApiKey,
46
45
  getBaseUrl
@@ -48,7 +47,7 @@ import {
48
47
  import {
49
48
  parseAgentQuestion,
50
49
  parseAgentQuestionAnswers
51
- } from "../chunk-MC5WUOJJ.js";
50
+ } from "../chunk-HUZW6SEO.js";
52
51
 
53
52
  // bin/pushary-codex-bridge.ts
54
53
  import { existsSync } from "fs";