@pushary/agent-hooks 1.9.8 → 1.9.10

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 (104) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/bin/pushary-bell-hook.js +22 -23
  3. package/dist/bin/pushary-bell.js +13 -13
  4. package/dist/bin/pushary-claude.js +26 -27
  5. package/dist/bin/pushary-clean.js +124 -51
  6. package/dist/bin/pushary-codex-bridge.js +20 -20
  7. package/dist/bin/pushary-codex-hook.js +34 -35
  8. package/dist/bin/pushary-codex.js +13 -13
  9. package/dist/bin/pushary-connect.js +41 -18
  10. package/dist/bin/pushary-cowork.js +5 -5
  11. package/dist/bin/pushary-daemon.js +35 -37
  12. package/dist/bin/pushary-disconnect.js +29 -32
  13. package/dist/bin/pushary-doctor.js +101 -78
  14. package/dist/bin/pushary-elicitation-hook.js +25 -26
  15. package/dist/bin/pushary-gemini-bridge.js +13 -13
  16. package/dist/bin/pushary-gemini-hook.js +29 -30
  17. package/dist/bin/pushary-hook.js +36 -37
  18. package/dist/bin/pushary-login.js +12 -12
  19. package/dist/bin/pushary-logout.js +18 -78
  20. package/dist/bin/pushary-mcp.js +9 -9
  21. package/dist/bin/pushary-mode.js +12 -12
  22. package/dist/bin/pushary-notification-hook.js +29 -30
  23. package/dist/bin/pushary-opencode-hook.js +28 -29
  24. package/dist/bin/pushary-permission-denied-hook.js +30 -31
  25. package/dist/bin/pushary-permission-hook.js +33 -34
  26. package/dist/bin/pushary-post-hook.js +30 -31
  27. package/dist/bin/pushary-prompt-hook.js +29 -30
  28. package/dist/bin/pushary-session-end-hook.js +29 -30
  29. package/dist/bin/pushary-session-start-hook.js +33 -35
  30. package/dist/bin/pushary-setup.js +147 -116
  31. package/dist/bin/pushary-stats.js +5 -5
  32. package/dist/bin/pushary-status.js +48 -18
  33. package/dist/bin/pushary-stop-hook.js +29 -30
  34. package/dist/bin/pushary-stopfailure-hook.js +29 -30
  35. package/dist/bin/pushary-suggestions.js +12 -12
  36. package/dist/bin/pushary-transcript-register.js +18 -19
  37. package/dist/bin/pushary-transcripts.js +7 -7
  38. package/dist/bin/pushary-upgrade.js +38 -44
  39. package/dist/bin/pushary-wait.js +12 -12
  40. package/dist/bin/pushary.js +6 -6
  41. package/dist/{chunk-CKV3UPMU.js → chunk-2HFSKYLN.js} +2 -2
  42. package/dist/{chunk-ZN3C6GBG.js → chunk-2HXG2QDI.js} +4 -4
  43. package/dist/{chunk-5QUPKDI5.js → chunk-2M52CFVO.js} +1 -1
  44. package/dist/{chunk-KF3UZLYI.js → chunk-2S34OPHS.js} +1 -1
  45. package/dist/{chunk-2A53H4S6.js → chunk-5MQYA3YL.js} +22 -21
  46. package/dist/{chunk-I5IJRMNV.js → chunk-5RGA636G.js} +21 -9
  47. package/dist/{chunk-IAD2RT4L.js → chunk-6KNC6KLL.js} +4 -4
  48. package/dist/{chunk-KHNFLYJO.js → chunk-7HGR5GNY.js} +4 -4
  49. package/dist/{chunk-BEJRK4DF.js → chunk-AKPHYSEL.js} +5 -4
  50. package/dist/{chunk-ZBK6E2OR.js → chunk-APP43AW7.js} +1 -1
  51. package/dist/chunk-BOSXFI7L.js +52 -0
  52. package/dist/{chunk-WS4H76EP.js → chunk-BTFUSQFB.js} +2 -2
  53. package/dist/{chunk-B64KHETR.js → chunk-BVPPYR7B.js} +3 -3
  54. package/dist/{chunk-TCWKTUAE.js → chunk-BVSIM4EF.js} +2 -2
  55. package/dist/{chunk-BXET3ALR.js → chunk-C6QTMWJZ.js} +2 -2
  56. package/dist/{chunk-IHO3YQAN.js → chunk-CJYM4ZHV.js} +2 -2
  57. package/dist/{chunk-6TE27XZR.js → chunk-DAOQT4WK.js} +2 -2
  58. package/dist/{chunk-V5HPPF3E.js → chunk-DL6QHS7V.js} +1 -1
  59. package/dist/{chunk-DPGSLWOS.js → chunk-DWO4RLYK.js} +10 -10
  60. package/dist/{chunk-GU3EJCVV.js → chunk-EA5NWDK7.js} +4 -0
  61. package/dist/{chunk-I6MJXLMY.js → chunk-EVC765EO.js} +2 -2
  62. package/dist/{chunk-WG3K4TCH.js → chunk-GQYX24UC.js} +1 -1
  63. package/dist/{chunk-N4QSPI3B.js → chunk-GTZ4HIHU.js} +15 -13
  64. package/dist/{chunk-DUZVXBBU.js → chunk-H4F5O3RE.js} +1 -1
  65. package/dist/{chunk-MKTJEXZ3.js → chunk-I3W7GJ5R.js} +3 -3
  66. package/dist/{chunk-ZSTSEBG7.js → chunk-IIVZZMSO.js} +1 -1
  67. package/dist/{chunk-KRCR2CRQ.js → chunk-LDQGURCF.js} +11 -11
  68. package/dist/{chunk-2WXF3QJR.js → chunk-LXA236ZQ.js} +2 -2
  69. package/dist/{chunk-CD47ZFFZ.js → chunk-MD4SVNT6.js} +1 -1
  70. package/dist/{chunk-CLOSJ4ES.js → chunk-MISUKJGW.js} +1 -1
  71. package/dist/{chunk-DKMD6AWR.js → chunk-NQ67AF3V.js} +4 -4
  72. package/dist/{chunk-HRULIYDU.js → chunk-OL2Z7WI4.js} +2 -2
  73. package/dist/{chunk-MXHTGVFZ.js → chunk-PNC5ZQFS.js} +16 -20
  74. package/dist/{chunk-3I6IVOZV.js → chunk-PR2VDVCP.js} +3 -3
  75. package/dist/{chunk-FQ2GORVG.js → chunk-Q3UMWSE4.js} +2 -2
  76. package/dist/{chunk-MFF3ONG5.js → chunk-QAGWWDXQ.js} +78 -8
  77. package/dist/{chunk-M6BZZFVQ.js → chunk-QGRENWJL.js} +1 -1
  78. package/dist/{chunk-LKLVTG3V.js → chunk-RPQLZLKC.js} +5 -5
  79. package/dist/{chunk-KFF7G225.js → chunk-S2DAKKQQ.js} +3 -3
  80. package/dist/chunk-SB2GN6OP.js +71 -0
  81. package/dist/{chunk-2QGYMY7A.js → chunk-SIHYBIEN.js} +142 -4
  82. package/dist/{chunk-ZW3XZLJC.js → chunk-SJDMULE7.js} +5 -5
  83. package/dist/{chunk-IHFDPV7C.js → chunk-SMVMLWCD.js} +1 -1
  84. package/dist/{chunk-QOLITCIP.js → chunk-T6ZN4TEF.js} +1 -1
  85. package/dist/{chunk-7DVNSQWF.js → chunk-TCXL5FQQ.js} +2 -2
  86. package/dist/{chunk-7PT35RY2.js → chunk-U5FP5JIS.js} +2 -2
  87. package/dist/{chunk-ZBHUHJG6.js → chunk-UJZ7AGSC.js} +6 -4
  88. package/dist/{chunk-TCQ43LSG.js → chunk-UM5WXBKN.js} +3 -3
  89. package/dist/{chunk-2QTO5YIT.js → chunk-XKMGHVXW.js} +6 -6
  90. package/dist/{chunk-LWOO567I.js → chunk-XXLCYKVS.js} +3 -3
  91. package/dist/{chunk-MGRFDGWU.js → chunk-Y7JM47CI.js} +2 -2
  92. package/dist/{chunk-NWDG3MSW.js → chunk-YUQHUGTH.js} +1 -1
  93. package/dist/{chunk-WWOHTTVP.js → chunk-Z2Q2VH43.js} +2 -2
  94. package/dist/{chunk-DL7XWKYV.js → chunk-ZGADIZDS.js} +2 -2
  95. package/dist/{chunk-2VZAALEJ.js → chunk-ZSGJYSF2.js} +8 -8
  96. package/dist/{global-upgrade-I56HNM23.js → global-upgrade-PUM44JUH.js} +6 -6
  97. package/dist/{paths-AGY43CXS.js → paths-U2MJGNBT.js} +2 -2
  98. package/dist/{reapply-IA5XUKWW.js → reapply-PRKV4EO7.js} +22 -24
  99. package/dist/src/index.js +19 -19
  100. package/dist/{upgrade-lock-B34TAUKV.js → upgrade-lock-QZSVLEM7.js} +3 -3
  101. package/package.json +1 -1
  102. package/dist/chunk-3Z3A37WD.js +0 -77
  103. package/dist/chunk-OP7IHC2I.js +0 -24
  104. package/dist/chunk-YIG2R3BJ.js +0 -145
@@ -1,40 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runBrowserLogin
4
- } from "../chunk-NWDG3MSW.js";
4
+ } from "../chunk-YUQHUGTH.js";
5
5
  import {
6
6
  coworkOutput,
7
7
  coworkSelection
8
- } from "../chunk-B64KHETR.js";
8
+ } from "../chunk-BVPPYR7B.js";
9
9
  import "../chunk-PUZZELE6.js";
10
10
  import {
11
11
  clearDeclinedAgent,
12
12
  declinedAgentForSetupChoice
13
- } from "../chunk-BXET3ALR.js";
14
- import {
15
- agentHookFile,
16
- agentHookOwner,
17
- macAppBridgeAvailable
18
- } from "../chunk-3Z3A37WD.js";
13
+ } from "../chunk-C6QTMWJZ.js";
19
14
  import {
15
+ CURSOR_GATE_SCRIPT,
20
16
  describeVersionManagerPin,
21
17
  versionManagerOf
22
- } from "../chunk-GU3EJCVV.js";
18
+ } from "../chunk-EA5NWDK7.js";
23
19
  import {
24
20
  codexTrustOutcome,
25
21
  describeCodexTrustConfirmation,
26
22
  needsCodexTrustStep
27
- } from "../chunk-6TE27XZR.js";
23
+ } from "../chunk-DAOQT4WK.js";
28
24
  import {
29
25
  writeStdoutFully
30
26
  } from "../chunk-EO23EUOK.js";
31
27
  import {
32
28
  ensureCodexTrustsPusharyHooks
33
- } from "../chunk-MGRFDGWU.js";
29
+ } from "../chunk-Y7JM47CI.js";
34
30
  import {
35
31
  readManagedControlEvidence,
36
32
  waitForMachineReadiness
37
- } from "../chunk-2QTO5YIT.js";
33
+ } from "../chunk-XKMGHVXW.js";
38
34
  import {
39
35
  describeSetupSideEffects,
40
36
  installAgentSkill,
@@ -44,7 +40,7 @@ import {
44
40
  CURSOR_PLUGIN_BACKUP_INFIX,
45
41
  CURSOR_PLUGIN_STAGING_PREFIX,
46
42
  registerCursorGate
47
- } from "../chunk-TCWKTUAE.js";
43
+ } from "../chunk-BVSIM4EF.js";
48
44
  import {
49
45
  HERMES_PIP_PACKAGE,
50
46
  describeDetection,
@@ -57,7 +53,7 @@ import {
57
53
  runHermesConfigScript,
58
54
  shortenHome,
59
55
  vscodeSettingsTargets
60
- } from "../chunk-KFF7G225.js";
56
+ } from "../chunk-S2DAKKQQ.js";
61
57
  import {
62
58
  AgentConfigError,
63
59
  FX_PUSHARY_TOOLS_RULE,
@@ -81,39 +77,10 @@ import {
81
77
  withFxPusharyServer,
82
78
  writeFxProfile,
83
79
  writeInstructionBlock
84
- } from "../chunk-ZN3C6GBG.js";
80
+ } from "../chunk-2HXG2QDI.js";
85
81
  import {
86
82
  MCP_BRIDGE_BINARY
87
- } from "../chunk-HRULIYDU.js";
88
- import {
89
- OPENCODE_HOOK_BINARY,
90
- addOpenCodeMcpServer,
91
- installOpenCodePlugin,
92
- openCodeConfigDir,
93
- openCodeConfigFile,
94
- openCodeHookArgv,
95
- openCodeInstructionsFile,
96
- openCodePluginDir,
97
- openCodePluginFile,
98
- openCodeWired
99
- } from "../chunk-MFF3ONG5.js";
100
- import {
101
- addClaudeMcpServer,
102
- addCompatibleHooks,
103
- addCompatibleMcpServer,
104
- addCompatibleToolPermissions,
105
- addPusharyHooks,
106
- addPusharyToolPermissions,
107
- captureClaudeMcpServer,
108
- compatibleConfigFile,
109
- compatibleHookEvents,
110
- compatibleInstructionsFile,
111
- compatibleMcpFile,
112
- compatiblePermissionRuleFile,
113
- hasCompatibleHooks,
114
- isClaudeMcpSnapshot,
115
- updateClaudeMcpSnapshot
116
- } from "../chunk-KHNFLYJO.js";
83
+ } from "../chunk-OL2Z7WI4.js";
117
84
  import {
118
85
  checkCodexInstall,
119
86
  detectProviderLiveCapabilities,
@@ -121,29 +88,14 @@ import {
121
88
  hasSpawnProvider,
122
89
  nodeCodexInstallProbe,
123
90
  resolveControlPolicy
124
- } from "../chunk-I6MJXLMY.js";
91
+ } from "../chunk-EVC765EO.js";
125
92
  import {
126
93
  detectClaudeVersion
127
94
  } from "../chunk-RIVNNBEK.js";
128
95
  import {
129
96
  describeAutoUpdateAnnouncement,
130
97
  takeAutoUpdateAnnouncement
131
- } from "../chunk-7PT35RY2.js";
132
- import {
133
- KEEP_HINT,
134
- captureHookTakeover,
135
- captureMcpServer,
136
- describeAppOwnership,
137
- describeHookOwnership,
138
- mcpBearerKey,
139
- planHooks
140
- } from "../chunk-YIG2R3BJ.js";
141
- import {
142
- AGENT_CHOICES,
143
- effectiveControlMode,
144
- effectiveVerify,
145
- parseSetupOptions
146
- } from "../chunk-DL7XWKYV.js";
98
+ } from "../chunk-U5FP5JIS.js";
147
99
  import {
148
100
  DAEMON_COLD_START_TIMEOUT_MS,
149
101
  clearDaemonNeedsLogin,
@@ -157,35 +109,11 @@ import {
157
109
  replaceDaemonService,
158
110
  stopDaemonService,
159
111
  waitForDaemonRemoteProof
160
- } from "../chunk-LKLVTG3V.js";
161
- import {
162
- claudeWired,
163
- codexWired,
164
- geminiWired,
165
- pusharyHookExecutable
166
- } from "../chunk-2QGYMY7A.js";
167
- import {
168
- GEMINI_HOOK_BINARY,
169
- addGeminiHooks,
170
- addGeminiMcpServer
171
- } from "../chunk-3I6IVOZV.js";
172
- import "../chunk-WG3K4TCH.js";
112
+ } from "../chunk-RPQLZLKC.js";
173
113
  import {
174
114
  transcriptPreferenceForSetup
175
- } from "../chunk-M6BZZFVQ.js";
115
+ } from "../chunk-QGRENWJL.js";
176
116
  import "../chunk-XHKBHWLX.js";
177
- import {
178
- compareVersion,
179
- parseVersion
180
- } from "../chunk-6ICPEJY5.js";
181
- import {
182
- reportEvent
183
- } from "../chunk-KRCR2CRQ.js";
184
- import "../chunk-N6IOSZOE.js";
185
- import "../chunk-CD47ZFFZ.js";
186
- import "../chunk-2VZAALEJ.js";
187
- import "../chunk-DKMD6AWR.js";
188
- import "../chunk-POFBE6ZY.js";
189
117
  import {
190
118
  BROWSER_CONNECT_COMMAND,
191
119
  confirmAppConnection,
@@ -196,17 +124,82 @@ import {
196
124
  printConnectInstructions,
197
125
  roundTripEvidence,
198
126
  verifyRoundTrip
199
- } from "../chunk-IAD2RT4L.js";
127
+ } from "../chunk-6KNC6KLL.js";
200
128
  import "../chunk-3EGEA4KH.js";
201
129
  import {
202
130
  setHumanStream
203
131
  } from "../chunk-QCGNGEGE.js";
132
+ import {
133
+ readMacAppAgentKey
134
+ } from "../chunk-BOSXFI7L.js";
135
+ import {
136
+ OPENCODE_HOOK_BINARY,
137
+ addOpenCodeMcpServer,
138
+ agentHookFile,
139
+ agentHookOwner,
140
+ agentHooksKeyPath,
141
+ installOpenCodePlugin,
142
+ macAppBridgeAvailable,
143
+ openCodeConfigDir,
144
+ openCodeConfigFile,
145
+ openCodeHookArgv,
146
+ openCodeInstructionsFile,
147
+ openCodePluginDir,
148
+ openCodePluginFile,
149
+ openCodeWired
150
+ } from "../chunk-QAGWWDXQ.js";
151
+ import {
152
+ addClaudeMcpServer,
153
+ addCompatibleHooks,
154
+ addCompatibleMcpServer,
155
+ addCompatibleToolPermissions,
156
+ addPusharyHooks,
157
+ addPusharyToolPermissions,
158
+ captureClaudeMcpServer,
159
+ compatibleConfigFile,
160
+ compatibleHookEvents,
161
+ compatibleInstructionsFile,
162
+ compatibleMcpFile,
163
+ compatiblePermissionRuleFile,
164
+ hasCompatibleHooks,
165
+ isClaudeMcpSnapshot,
166
+ updateClaudeMcpSnapshot
167
+ } from "../chunk-7HGR5GNY.js";
204
168
  import {
205
169
  ansiPainter,
206
170
  createIo,
207
171
  useColor
208
172
  } from "../chunk-U4TMAANR.js";
173
+ import {
174
+ KEEP_HINT,
175
+ captureHookTakeover,
176
+ captureMcpServer,
177
+ claudeWired,
178
+ codexWired,
179
+ describeAppOwnership,
180
+ describeHookOwnership,
181
+ geminiWired,
182
+ mcpBearerKey,
183
+ planHooks,
184
+ pusharyHookExecutable
185
+ } from "../chunk-SIHYBIEN.js";
186
+ import {
187
+ GEMINI_HOOK_BINARY,
188
+ addGeminiHooks,
189
+ addGeminiMcpServer
190
+ } from "../chunk-PR2VDVCP.js";
191
+ import {
192
+ AGENT_CHOICES,
193
+ effectiveControlMode,
194
+ effectiveVerify,
195
+ parseSetupOptions
196
+ } from "../chunk-ZGADIZDS.js";
197
+ import "../chunk-GQYX24UC.js";
209
198
  import "../chunk-GMXKITVA.js";
199
+ import {
200
+ compareVersion,
201
+ parseVersion
202
+ } from "../chunk-6ICPEJY5.js";
210
203
  import {
211
204
  KEY_FILE_MODE,
212
205
  exportLine,
@@ -219,22 +212,30 @@ import {
219
212
  recordMacAppKeyPrefix,
220
213
  resolveShellRc,
221
214
  writeKey
222
- } from "../chunk-N4QSPI3B.js";
223
- import "../chunk-MKTJEXZ3.js";
215
+ } from "../chunk-GTZ4HIHU.js";
216
+ import {
217
+ reportEvent
218
+ } from "../chunk-LDQGURCF.js";
219
+ import "../chunk-N6IOSZOE.js";
220
+ import "../chunk-MD4SVNT6.js";
221
+ import "../chunk-ZSGJYSF2.js";
222
+ import "../chunk-I3W7GJ5R.js";
224
223
  import {
225
224
  checkApiKey,
226
225
  describeKeyCheck,
227
226
  samePusharyAccount
228
- } from "../chunk-LWOO567I.js";
229
- import "../chunk-TCQ43LSG.js";
230
- import "../chunk-DUZVXBBU.js";
227
+ } from "../chunk-XXLCYKVS.js";
228
+ import "../chunk-NQ67AF3V.js";
229
+ import "../chunk-POFBE6ZY.js";
230
+ import "../chunk-UM5WXBKN.js";
231
+ import "../chunk-H4F5O3RE.js";
231
232
  import {
232
233
  UsageError
233
234
  } from "../chunk-7QLSKOSU.js";
234
235
  import {
235
236
  EXIT
236
237
  } from "../chunk-KZERVKTD.js";
237
- import "../chunk-FQ2GORVG.js";
238
+ import "../chunk-Q3UMWSE4.js";
238
239
  import {
239
240
  NpmMissingError,
240
241
  addCodexHookTrust,
@@ -266,6 +267,7 @@ import {
266
267
  geminiSettings,
267
268
  guardBinary,
268
269
  guardCursorGate,
270
+ guardNodeScript,
269
271
  guardedArgv,
270
272
  hermesConfigReceipt,
271
273
  hookTakeoverReceipt,
@@ -278,18 +280,18 @@ import {
278
280
  resolveGlobalBinary,
279
281
  vscodePluginDir,
280
282
  vscodePluginMcp
281
- } from "../chunk-ZBHUHJG6.js";
283
+ } from "../chunk-UJZ7AGSC.js";
282
284
  import {
283
285
  backupFile,
284
286
  readJsonSafe,
285
287
  writeFileAtomic,
286
288
  writeJsonAtomic
287
289
  } from "../chunk-T7E75EKA.js";
288
- import "../chunk-5QUPKDI5.js";
290
+ import "../chunk-2M52CFVO.js";
289
291
  import {
290
292
  NPX_LATEST_COMMAND,
291
293
  renderCommandHelp
292
- } from "../chunk-7DVNSQWF.js";
294
+ } from "../chunk-TCXL5FQQ.js";
293
295
  import {
294
296
  HOOK_COMPATIBLE_PROFILES,
295
297
  PRETOOLUSE_GATED_TOOLS,
@@ -303,7 +305,7 @@ import {
303
305
  isValidApiKey,
304
306
  launchedPackage,
305
307
  ownPackageName
306
- } from "../chunk-I5IJRMNV.js";
308
+ } from "../chunk-5RGA636G.js";
307
309
 
308
310
  // bin/pushary-setup.ts
309
311
  import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, statSync, openSync, readSync, closeSync } from "fs";
@@ -644,6 +646,24 @@ var pickAppKey = (candidates) => candidates.fromAgents.find(
644
646
  (candidate) => typeof candidate === "string" && candidate !== candidates.storedKey && candidate !== candidates.envKey && isValidApiKey(candidate)
645
647
  ) ?? null;
646
648
 
649
+ // src/vscode-gate-hooks.ts
650
+ var isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
651
+ var runsTheGate = (entry) => typeof entry.command === "string" && (pusharyHookExecutable(entry.command)?.endsWith(CURSOR_GATE_SCRIPT) ?? false);
652
+ var guardedEntry = (entry, command) => isRecord(entry) && runsTheGate(entry) ? { ...entry, command } : entry;
653
+ var guardVsCodeGateHooks = (document, gateScript) => {
654
+ if (!isRecord(document) || !isRecord(document.hooks)) {
655
+ return { kind: "invalid", reason: "bundled VS Code hooks.json has no hooks map" };
656
+ }
657
+ const hooks = document.hooks;
658
+ const preToolUse = hooks.PreToolUse;
659
+ if (!Array.isArray(preToolUse) || preToolUse.length === 0) {
660
+ return { kind: "invalid", reason: "bundled VS Code hooks.json is missing a PreToolUse entry" };
661
+ }
662
+ const command = guardNodeScript(gateScript);
663
+ const guarded = Object.fromEntries(Object.entries(hooks).map(([event, entries]) => [event, Array.isArray(entries) ? entries.map((entry) => guardedEntry(entry, command)) : entries]));
664
+ return { kind: "guarded", document: { ...document, hooks: guarded } };
665
+ };
666
+
647
667
  // src/setup/pairing-computer.ts
648
668
  var LOCAL_NETWORK_SUFFIX = /\.local$/i;
649
669
  var computerNameOfHost = (host) => host.replace(LOCAL_NETWORK_SUFFIX, "").trim() || null;
@@ -1308,16 +1328,11 @@ var resolveBundledVsCodePlugin = () => {
1308
1328
  ];
1309
1329
  return candidates.find((p) => existsSync(join3(p, ".claude-plugin", "plugin.json"))) ?? null;
1310
1330
  };
1311
- var pinVsCodeGatePath = (pluginDir) => {
1331
+ var pinGuardedVsCodeGate = (pluginDir) => {
1312
1332
  const hooksPath = join3(pluginDir, "hooks", "hooks.json");
1313
- const data = readJson(hooksPath);
1314
- const entries = data.hooks?.PreToolUse;
1315
- if (!Array.isArray(entries) || entries.length === 0) {
1316
- throw new Error("bundled VS Code hooks.json is missing a PreToolUse entry");
1317
- }
1318
- const gate = join3(pluginDir, "scripts", "pushary-gate.mjs");
1319
- data.hooks.PreToolUse = entries.map((entry) => ({ ...entry, command: `node "${gate}"` }));
1320
- writeJson(hooksPath, data);
1333
+ const guarded = guardVsCodeGateHooks(readJson(hooksPath), join3(pluginDir, "scripts", CURSOR_GATE_SCRIPT));
1334
+ if (guarded.kind === "invalid") throw new Error(guarded.reason);
1335
+ writeJson(hooksPath, guarded.document);
1321
1336
  };
1322
1337
  var registerVsCodePlugin = (pluginDir) => {
1323
1338
  const written = [];
@@ -1379,7 +1394,7 @@ var setupVsCode = async (apiKey) => {
1379
1394
  mcp.mcpServers = servers;
1380
1395
  writeJsonAtomic(mcpPath, mcp, KEY_FILE_MODE);
1381
1396
  }
1382
- pinVsCodeGatePath(VSCODE_PLUGIN_DIR);
1397
+ pinGuardedVsCodeGate(VSCODE_PLUGIN_DIR);
1383
1398
  });
1384
1399
  let registration = { written: [], manual: [] };
1385
1400
  await spinner("Registering the plugin with VS Code", async () => {
@@ -1417,7 +1432,7 @@ var saveApiKey = async (apiKey, controlMode, transcriptSync) => {
1417
1432
  let result;
1418
1433
  await spinner("Saving your API key", async () => {
1419
1434
  result = writeKey(apiKey, {
1420
- ...controlMode === null ? {} : { controlMode },
1435
+ controlMode,
1421
1436
  transcriptsEnabled: transcriptSync
1422
1437
  });
1423
1438
  });
@@ -1633,14 +1648,30 @@ var clearSetupChoiceDecline = (agent) => {
1633
1648
  const declined = declinedAgentForSetupChoice(agent);
1634
1649
  if (declined) clearDeclinedAgent(declined);
1635
1650
  };
1651
+ var compatibleAppMcpEntries = () => Object.fromEntries(HOOK_COMPATIBLE_PROFILES.flatMap((profile) => {
1652
+ const file = compatibleMcpFile(profile);
1653
+ return file === null ? [] : [[profile.agentType, { file: () => file, container: "mcpServers" }]];
1654
+ }));
1655
+ var APP_MCP_ENTRIES = {
1656
+ claude_code: { file: () => CLAUDE_JSON, container: "mcpServers" },
1657
+ gemini_cli: { file: () => GEMINI_SETTINGS, container: "mcpServers" },
1658
+ cursor: { file: cursorUserMcp, container: "mcpServers" },
1659
+ vscode: { file: () => VSCODE_PLUGIN_MCP, container: "mcpServers" },
1660
+ opencode: { file: openCodeConfigFile, container: "mcp" },
1661
+ ...compatibleAppMcpEntries()
1662
+ };
1663
+ var MAC_APP_DEVICE_KEY_AGENTS = new Set(
1664
+ HOOK_COMPATIBLE_PROFILES.filter((profile) => profile.mcp === null).map((profile) => profile.agentType)
1665
+ );
1636
1666
  var appMcpKeyFor = (agent) => {
1637
1667
  if (agent === "codex") {
1638
1668
  const auth = readCodexMcpAuth(readAgentToml(codexConfigToml()));
1639
1669
  return auth?.method === "embedded" ? auth.key : null;
1640
1670
  }
1641
- const file = agent === "claude_code" ? CLAUDE_JSON : agent === "gemini_cli" ? GEMINI_SETTINGS : agent === "cursor" ? cursorUserMcp() : agent === "vscode" ? VSCODE_PLUGIN_MCP : null;
1642
- return file ? mcpBearerKey(readAgentJson(file), "mcpServers", "headers") : null;
1671
+ const entry = APP_MCP_ENTRIES[agent];
1672
+ return entry ? mcpBearerKey(readAgentJson(entry.file()), entry.container, "headers") : null;
1643
1673
  };
1674
+ var appWiringAccountKeyFor = (agent) => MAC_APP_DEVICE_KEY_AGENTS.has(agent) ? readMacAppAgentKey() : appMcpKeyFor(agent);
1644
1675
  var appMcpKeyIfReadable = (agent) => {
1645
1676
  try {
1646
1677
  return appMcpKeyFor(agent);
@@ -1652,7 +1683,7 @@ var captureTakeoverReceipt = (agent) => {
1652
1683
  const hookFile = agentHookFile(agent);
1653
1684
  if (!hookFile) return;
1654
1685
  const document = readAgentJson(hookFile);
1655
- const captured = captureHookTakeover(agent, document);
1686
+ const captured = captureHookTakeover(agent, document, agentHooksKeyPath(agent));
1656
1687
  if (!captured) throw new Error(`Cannot safely take over ${AGENT_NAMES[agent]}'s hooks: no Mac app wiring was found.`);
1657
1688
  const codexConfig = agent === "codex" ? readAgentToml(codexConfigToml()) : null;
1658
1689
  const mcp = agent === "claude_code" ? [readAgentJson(CLAUDE_JSON), "mcpServers"] : agent === "codex" ? [codexConfig, "mcp_servers"] : agent === "gemini_cli" ? [document, "mcpServers"] : agent === "vscode" ? [readAgentJson(VSCODE_PLUGIN_MCP), "mcpServers"] : null;
@@ -2006,7 +2037,7 @@ var reportDryRun = (apiKey, agents, keyCheck, controlMode) => {
2006
2037
  apiKey ? ` ${dim("Key:")} ${dim(`${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`)} ${dim(`(${keyCheck?.kind ?? "not verified"})`)}` : ` ${dim("Key:")} ${dim("none on this machine \u2014 a real run would acquire one")}`
2007
2038
  );
2008
2039
  console.log(` ${dim("Key store:")} ${PUSHARY_CONFIG_FILE}`);
2009
- console.log(` ${dim("Control:")} ${controlMode ?? "unchanged (legacy install)"}`);
2040
+ console.log(` ${dim("Control:")} ${controlMode}`);
2010
2041
  const rc = resolveShellRc();
2011
2042
  console.log(` ${dim("Shell rc:")} ${rc ? rc.path : dim("none for this shell; the key would stay in Pushary's config only")}`);
2012
2043
  console.log();
@@ -2060,7 +2091,7 @@ var main = async () => {
2060
2091
  `);
2061
2092
  process.exit(EXIT.OK);
2062
2093
  }
2063
- const controlMode = effectiveControlMode(options, readControlMode(), existsSync(PUSHARY_CONFIG_FILE));
2094
+ const controlMode = effectiveControlMode(options, readControlMode());
2064
2095
  recordSetupOptions(options);
2065
2096
  if (options.json) {
2066
2097
  jsonMode = true;
@@ -2241,7 +2272,7 @@ var main = async () => {
2241
2272
  return pending;
2242
2273
  };
2243
2274
  const appAccountMatches = async (agent) => {
2244
- const appKey2 = appMcpKeyFor(agent);
2275
+ const appKey2 = appWiringAccountKeyFor(agent);
2245
2276
  if (!appKey2) return false;
2246
2277
  if (appKey2 === trimmedKey) return true;
2247
2278
  const [cliAccount, appAccount] = await Promise.all([
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readLedgerSummary
4
- } from "../chunk-ZSTSEBG7.js";
4
+ } from "../chunk-IIVZZMSO.js";
5
5
  import {
6
6
  exitOnHelpFlag
7
- } from "../chunk-CKV3UPMU.js";
7
+ } from "../chunk-2HFSKYLN.js";
8
8
  import "../chunk-KZERVKTD.js";
9
9
  import {
10
10
  getApiKey
11
- } from "../chunk-5QUPKDI5.js";
12
- import "../chunk-7DVNSQWF.js";
13
- import "../chunk-I5IJRMNV.js";
11
+ } from "../chunk-2M52CFVO.js";
12
+ import "../chunk-TCXL5FQQ.js";
13
+ import "../chunk-5RGA636G.js";
14
14
 
15
15
  // bin/pushary-stats.ts
16
16
  exitOnHelpFlag("stats");
@@ -2,56 +2,72 @@
2
2
  import {
3
3
  describeLastSeen,
4
4
  listMachines
5
- } from "../chunk-2QTO5YIT.js";
6
- import "../chunk-I6MJXLMY.js";
5
+ } from "../chunk-XKMGHVXW.js";
6
+ import "../chunk-EVC765EO.js";
7
7
  import "../chunk-RIVNNBEK.js";
8
- import "../chunk-LKLVTG3V.js";
8
+ import "../chunk-RPQLZLKC.js";
9
9
  import "../chunk-XHKBHWLX.js";
10
- import "../chunk-6ICPEJY5.js";
11
10
  import {
12
11
  describeReach,
13
12
  fetchChannels,
14
13
  reachVerdict
15
- } from "../chunk-IAD2RT4L.js";
14
+ } from "../chunk-6KNC6KLL.js";
16
15
  import "../chunk-3EGEA4KH.js";
17
16
  import "../chunk-QCGNGEGE.js";
17
+ import {
18
+ CONNECTED_THROUGH_MAC_APP,
19
+ readMacAppConnectionWhenKeyless
20
+ } from "../chunk-BOSXFI7L.js";
18
21
  import {
19
22
  SIGNED_OUT_ON_MAC_MESSAGE,
20
23
  activeKeyVerdictOf,
21
24
  describeSignedOutKey,
22
25
  readSignedOutDiagnosis
23
- } from "../chunk-2WXF3QJR.js";
26
+ } from "../chunk-LXA236ZQ.js";
27
+ import "../chunk-QAGWWDXQ.js";
28
+ import "../chunk-7HGR5GNY.js";
24
29
  import {
25
30
  createIo
26
31
  } from "../chunk-U4TMAANR.js";
27
32
  import {
28
33
  exitOnHelpFlag
29
- } from "../chunk-CKV3UPMU.js";
34
+ } from "../chunk-2HFSKYLN.js";
35
+ import "../chunk-SIHYBIEN.js";
36
+ import "../chunk-PR2VDVCP.js";
37
+ import "../chunk-ZGADIZDS.js";
38
+ import "../chunk-GQYX24UC.js";
30
39
  import {
31
40
  rejectUnknownFlags
32
41
  } from "../chunk-GMXKITVA.js";
42
+ import "../chunk-6ICPEJY5.js";
33
43
  import {
34
44
  readKeySource
35
- } from "../chunk-N4QSPI3B.js";
36
- import "../chunk-MKTJEXZ3.js";
45
+ } from "../chunk-GTZ4HIHU.js";
46
+ import "../chunk-LDQGURCF.js";
47
+ import "../chunk-N6IOSZOE.js";
48
+ import "../chunk-MD4SVNT6.js";
49
+ import "../chunk-ZSGJYSF2.js";
50
+ import "../chunk-I3W7GJ5R.js";
37
51
  import {
38
52
  checkApiKey,
39
53
  describeKeyCheck
40
- } from "../chunk-LWOO567I.js";
41
- import "../chunk-TCQ43LSG.js";
42
- import "../chunk-DUZVXBBU.js";
54
+ } from "../chunk-XXLCYKVS.js";
55
+ import "../chunk-NQ67AF3V.js";
56
+ import "../chunk-POFBE6ZY.js";
57
+ import "../chunk-UM5WXBKN.js";
58
+ import "../chunk-H4F5O3RE.js";
43
59
  import {
44
60
  UsageError
45
61
  } from "../chunk-7QLSKOSU.js";
46
62
  import {
47
63
  EXIT
48
64
  } from "../chunk-KZERVKTD.js";
49
- import "../chunk-FQ2GORVG.js";
50
- import "../chunk-ZBHUHJG6.js";
65
+ import "../chunk-Q3UMWSE4.js";
66
+ import "../chunk-UJZ7AGSC.js";
51
67
  import "../chunk-T7E75EKA.js";
52
- import "../chunk-5QUPKDI5.js";
53
- import "../chunk-7DVNSQWF.js";
54
- import "../chunk-I5IJRMNV.js";
68
+ import "../chunk-2M52CFVO.js";
69
+ import "../chunk-TCXL5FQQ.js";
70
+ import "../chunk-5RGA636G.js";
55
71
 
56
72
  // src/status.ts
57
73
  var signedOutReport = (facts, lines) => {
@@ -60,6 +76,12 @@ var signedOutReport = (facts, lines) => {
60
76
  lines.push({ label: "Server", value: "key signed out on this Mac", ok: false });
61
77
  return { lines, headline: SIGNED_OUT_ON_MAC_MESSAGE, next: [...describeSignedOutKey(signedOut)], exitCode: EXIT.UNAUTHENTICATED };
62
78
  };
79
+ var connectedThroughMacAppReport = (macApp) => ({
80
+ lines: [{ label: "Key", value: `${macApp.keyPrefix} held by the Pushary Mac app`, ok: true }],
81
+ headline: `${CONNECTED_THROUGH_MAC_APP}.`,
82
+ next: ["Approvals, phone pairing and account settings for this computer are in the Pushary Mac app."],
83
+ exitCode: EXIT.OK
84
+ });
63
85
  var keySourceLine = (source) => {
64
86
  if (source.kind === "none") {
65
87
  return { label: "Key", value: "none found", ok: false };
@@ -100,6 +122,7 @@ var buildStatusReport = (facts) => {
100
122
  if (facts.source.kind === "none") {
101
123
  const signedOut = signedOutReport(facts, lines);
102
124
  if (signedOut) return signedOut;
125
+ if (facts.macApp?.kind === "connected") return connectedThroughMacAppReport(facts.macApp);
103
126
  return {
104
127
  lines,
105
128
  headline: "Not set up on this machine.",
@@ -191,6 +214,7 @@ var statusJson = (facts, report) => ({
191
214
  keySource: facts.source.kind,
192
215
  keyOrigin: facts.source.origin,
193
216
  keyPrefix: facts.source.key ? facts.source.key.split(".")[0] : null,
217
+ connectedThroughMacApp: facts.macApp?.kind === "connected",
194
218
  drift: facts.source.drift ? {
195
219
  env: facts.source.drift.envPrefix,
196
220
  config: facts.source.drift.configPrefix,
@@ -224,7 +248,13 @@ var main = async () => {
224
248
  if (keyCheck.kind === "ok") channels = await fetchChannels(source.key);
225
249
  }
226
250
  const machines = devices && keyCheck?.kind === "ok" ? await listMachines(source.key) : null;
227
- const facts = { source, keyCheck, channels, signedOut: readSignedOutDiagnosis(source.key, activeKeyVerdictOf(keyCheck)) };
251
+ const facts = {
252
+ source,
253
+ keyCheck,
254
+ channels,
255
+ signedOut: readSignedOutDiagnosis(source.key, activeKeyVerdictOf(keyCheck)),
256
+ macApp: readMacAppConnectionWhenKeyless(source.key)
257
+ };
228
258
  const report = buildStatusReport(facts);
229
259
  if (json) {
230
260
  const payload = statusJson(facts, report);