@pushary/agent-hooks 1.6.3 → 1.7.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 (100) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +3 -2
  3. package/dist/bin/pushary-bell-hook.js +24 -22
  4. package/dist/bin/pushary-bell.js +11 -12
  5. package/dist/bin/pushary-claude.js +29 -28
  6. package/dist/bin/pushary-clean.js +99 -40
  7. package/dist/bin/pushary-codex-bridge.js +25 -25
  8. package/dist/bin/pushary-codex-hook.js +39 -34
  9. package/dist/bin/pushary-codex.js +13 -12
  10. package/dist/bin/pushary-connect.js +13 -12
  11. package/dist/bin/pushary-cowork.js +5 -6
  12. package/dist/bin/pushary-daemon.js +31 -32
  13. package/dist/bin/pushary-disconnect.js +22 -21
  14. package/dist/bin/pushary-doctor.js +98 -61
  15. package/dist/bin/pushary-elicitation-hook.js +26 -25
  16. package/dist/bin/pushary-gemini-bridge.js +12 -13
  17. package/dist/bin/pushary-gemini-hook.js +35 -30
  18. package/dist/bin/pushary-hook.js +38 -33
  19. package/dist/bin/pushary-login.js +13 -15
  20. package/dist/bin/pushary-logout.js +12 -13
  21. package/dist/bin/pushary-mcp.d.ts +1 -0
  22. package/dist/bin/pushary-mcp.js +56 -0
  23. package/dist/bin/pushary-mode.js +10 -8
  24. package/dist/bin/pushary-notification-hook.js +28 -27
  25. package/dist/bin/pushary-opencode-hook.js +34 -29
  26. package/dist/bin/pushary-permission-denied-hook.js +32 -31
  27. package/dist/bin/pushary-permission-hook.js +31 -30
  28. package/dist/bin/pushary-post-hook.js +28 -27
  29. package/dist/bin/pushary-prompt-hook.js +28 -27
  30. package/dist/bin/pushary-session-end-hook.js +28 -27
  31. package/dist/bin/pushary-session-start-hook.js +32 -31
  32. package/dist/bin/pushary-setup.js +222 -110
  33. package/dist/bin/pushary-stats.js +5 -6
  34. package/dist/bin/pushary-status.js +15 -16
  35. package/dist/bin/pushary-stop-hook.js +28 -27
  36. package/dist/bin/pushary-stopfailure-hook.js +28 -27
  37. package/dist/bin/pushary-suggestions.js +4 -4
  38. package/dist/bin/pushary-transcript-register.js +19 -20
  39. package/dist/bin/pushary-transcripts.js +7 -8
  40. package/dist/bin/pushary-upgrade.js +28 -28
  41. package/dist/bin/pushary-wait.js +10 -8
  42. package/dist/bin/pushary.js +9 -5
  43. package/dist/{chunk-4KSTLHWY.js → chunk-2C7CCWVX.js} +1 -1
  44. package/dist/{chunk-P4BNYJ5Q.js → chunk-2PS6QWDW.js} +2 -2
  45. package/dist/{chunk-ILGL4L3J.js → chunk-4F46VIEE.js} +8 -8
  46. package/dist/{chunk-UAV5MNKY.js → chunk-52NVBNJT.js} +3 -3
  47. package/dist/{chunk-GQPCPEG2.js → chunk-5HLTWFJ6.js} +1 -1
  48. package/dist/{chunk-EJ7ADMNM.js → chunk-6ADZQFVW.js} +1 -1
  49. package/dist/{chunk-QKOVVL7I.js → chunk-73T6MSU5.js} +7 -7
  50. package/dist/{chunk-YOCXPNQ5.js → chunk-7OS4IHGI.js} +2 -2
  51. package/dist/{chunk-BY2CRWBO.js → chunk-B234346F.js} +1 -1
  52. package/dist/{chunk-EA3IELHP.js → chunk-B3UXMSMW.js} +6 -2
  53. package/dist/{chunk-STOMNX4S.js → chunk-B3YQANFN.js} +1 -1
  54. package/dist/{chunk-JBU7XKY2.js → chunk-B76WVEDX.js} +1 -1
  55. package/dist/{chunk-WA7SQX6S.js → chunk-BBKNJJVX.js} +6 -6
  56. package/dist/{chunk-KNIIFNNQ.js → chunk-BH2SKSSK.js} +1 -1
  57. package/dist/{chunk-CTOK3AYA.js → chunk-BWYJ6AAF.js} +6 -7
  58. package/dist/{chunk-HCVAMXHT.js → chunk-CVALVGA7.js} +1 -1
  59. package/dist/{chunk-DX5FOQSO.js → chunk-D6BULEJW.js} +2 -2
  60. package/dist/{chunk-RJUHSFYE.js → chunk-DANOZVZK.js} +1 -1
  61. package/dist/{chunk-3BJQYXTL.js → chunk-DNJUSFBL.js} +13 -5
  62. package/dist/{chunk-57YDFAPP.js → chunk-DVQDPI3T.js} +8 -8
  63. package/dist/{chunk-BEHGVU4W.js → chunk-DZURML2D.js} +1 -1
  64. package/dist/{chunk-LDS4ERW4.js → chunk-EAQMWJPG.js} +10 -10
  65. package/dist/{chunk-LVHGSD5E.js → chunk-EGKXSQCY.js} +13 -7
  66. package/dist/{chunk-HHYVBHHC.js → chunk-HDRNWNVP.js} +6 -6
  67. package/dist/{chunk-JBXUKGZS.js → chunk-IJ6ECPA6.js} +15 -9
  68. package/dist/{chunk-NMRH3VX4.js → chunk-J2355HR7.js} +1 -1
  69. package/dist/{chunk-HETOKNIL.js → chunk-JNXVOU6Y.js} +10 -6
  70. package/dist/{chunk-COGHCL6K.js → chunk-JXUAXO74.js} +2 -2
  71. package/dist/chunk-KW2RRR7D.js +124 -0
  72. package/dist/{chunk-66H2QQAK.js → chunk-KXMZMZD3.js} +1 -1
  73. package/dist/{chunk-H3FEVIQD.js → chunk-KYQXUGH7.js} +3 -3
  74. package/dist/{chunk-P35IUFFR.js → chunk-L4H2Q2S4.js} +276 -19
  75. package/dist/{chunk-NKR4YDRP.js → chunk-LEZFOTMI.js} +1 -1
  76. package/dist/{chunk-WD6W7QDI.js → chunk-O2LEPIU6.js} +1 -1
  77. package/dist/chunk-POFBE6ZY.js +12 -0
  78. package/dist/{chunk-SND3C2AV.js → chunk-PQ4F64M2.js} +3 -3
  79. package/dist/{chunk-3UOC3GRO.js → chunk-PUDBG3GM.js} +1 -1
  80. package/dist/{chunk-YQMFGWBD.js → chunk-QXAK5RFU.js} +1 -1
  81. package/dist/{chunk-REYWOCQJ.js → chunk-R2XCLT6I.js} +4 -4
  82. package/dist/{chunk-NPGOQQCV.js → chunk-ROQK7IN3.js} +2 -2
  83. package/dist/{chunk-GU3EJCVV.js → chunk-S3UD4V6W.js} +39 -0
  84. package/dist/{chunk-ICGAIM2R.js → chunk-SQRWHALT.js} +2 -2
  85. package/dist/{chunk-JX67DVMY.js → chunk-UC65FJJT.js} +5 -6
  86. package/dist/{chunk-CWIARY6F.js → chunk-UOAQ6QMP.js} +2 -2
  87. package/dist/{chunk-OSJEMXSR.js → chunk-V4AQBAVG.js} +1 -1
  88. package/dist/chunk-V6QRSU2G.js +142 -0
  89. package/dist/{chunk-VDMX5EMU.js → chunk-VKVIAZQO.js} +1 -1
  90. package/dist/{chunk-BG6OCZ4N.js → chunk-WUNZAE7I.js} +5 -5
  91. package/dist/{chunk-TZ4KUNZG.js → chunk-X6KDKOV5.js} +3 -3
  92. package/dist/{chunk-LM2IOEDK.js → chunk-XNCMT7YY.js} +3 -1
  93. package/dist/{chunk-GHOB245Q.js → chunk-YROGUPOZ.js} +132 -30
  94. package/dist/chunk-YYINL576.js +120 -0
  95. package/dist/{chunk-57DDP4TB.js → chunk-ZQ7IDOKY.js} +3 -3
  96. package/dist/{reapply-IB7YE7BU.js → reapply-6PH3FMPX.js} +9 -10
  97. package/dist/src/index.js +20 -19
  98. package/package.json +2 -1
  99. package/dist/chunk-HWJW3CPO.js +0 -65
  100. package/dist/chunk-SAF6HGAA.js +0 -57
@@ -2,29 +2,35 @@
2
2
  import {
3
3
  codexTrustOutcome,
4
4
  describeCodexTrustConfirmation
5
- } from "../chunk-BY2CRWBO.js";
5
+ } from "../chunk-B234346F.js";
6
6
  import {
7
7
  runBrowserLogin
8
- } from "../chunk-YQMFGWBD.js";
8
+ } from "../chunk-QXAK5RFU.js";
9
9
  import {
10
10
  coworkOutput,
11
11
  coworkSelection
12
- } from "../chunk-DX5FOQSO.js";
12
+ } from "../chunk-D6BULEJW.js";
13
13
  import "../chunk-PUZZELE6.js";
14
14
  import {
15
15
  detectClaudeVersion
16
- } from "../chunk-WD6W7QDI.js";
16
+ } from "../chunk-O2LEPIU6.js";
17
17
  import {
18
+ AgentConfigError,
19
+ agentFailureFromError,
20
+ agentFailureWire,
21
+ configFailureKind,
18
22
  describeVersionManagerPin,
23
+ describedAgentFailure,
24
+ retryAgentCommand,
19
25
  versionManagerOf
20
- } from "../chunk-GU3EJCVV.js";
26
+ } from "../chunk-S3UD4V6W.js";
21
27
  import {
22
28
  ensureCodexTrustsPusharyHooks
23
- } from "../chunk-YOCXPNQ5.js";
29
+ } from "../chunk-7OS4IHGI.js";
24
30
  import {
25
31
  readManagedControlEvidence,
26
32
  waitForMachineReadiness
27
- } from "../chunk-ILGL4L3J.js";
33
+ } from "../chunk-4F46VIEE.js";
28
34
  import {
29
35
  HERMES_CONFIG_SCRIPT,
30
36
  HERMES_PIP_PACKAGE,
@@ -34,19 +40,38 @@ import {
34
40
  isHermesConfigReceipt,
35
41
  resolveHermesPython,
36
42
  runHermesPythonScript
37
- } from "../chunk-RJUHSFYE.js";
43
+ } from "../chunk-DANOZVZK.js";
38
44
  import {
45
+ FX_PROFILE_REFUSALS,
46
+ FX_PUSHARY_TOOLS_RULE,
47
+ FX_SETTINGS_REFUSALS,
48
+ FX_TOOL_DISCOVERY_NOTE,
39
49
  describeDetection,
40
50
  detectAllAgents,
51
+ fxIgnoresInstructionsFile,
52
+ fxProfileText,
53
+ fxPusharyEntry,
54
+ fxPusharyEntryOf,
55
+ fxSettingsText,
41
56
  isDetected,
57
+ isFxPusharyEntry,
42
58
  pluginLocationSnippet,
59
+ readFxFile,
60
+ readFxProfile,
61
+ readFxSettings,
43
62
  registerPluginLocation,
44
63
  renderAgentInstructions,
45
64
  renderProjectAgentInstructions,
46
65
  shortenHome,
47
66
  vscodeSettingsTargets,
67
+ withFxPusharyServer,
68
+ withPusharyToolsAllowed,
69
+ workspacesOverridingPusharyRule,
48
70
  writeInstructionBlock
49
- } from "../chunk-P35IUFFR.js";
71
+ } from "../chunk-L4H2Q2S4.js";
72
+ import {
73
+ MCP_BRIDGE_BINARY
74
+ } from "../chunk-YYINL576.js";
50
75
  import {
51
76
  OPENCODE_HOOK_BINARY,
52
77
  addOpenCodeMcpServer,
@@ -57,7 +82,7 @@ import {
57
82
  openCodePluginDir,
58
83
  openCodePluginFile,
59
84
  openCodeWired
60
- } from "../chunk-STOMNX4S.js";
85
+ } from "../chunk-B3YQANFN.js";
61
86
  import {
62
87
  addCompatibleHooks,
63
88
  addCompatibleMcpServer,
@@ -68,7 +93,7 @@ import {
68
93
  compatibleMcpFile,
69
94
  compatiblePermissionRuleFile,
70
95
  hasCompatibleHooks
71
- } from "../chunk-BG6OCZ4N.js";
96
+ } from "../chunk-WUNZAE7I.js";
72
97
  import {
73
98
  addClaudeMcpServer,
74
99
  addPusharyHooks,
@@ -76,16 +101,16 @@ import {
76
101
  captureClaudeMcpServer,
77
102
  isClaudeMcpSnapshot,
78
103
  updateClaudeMcpSnapshot
79
- } from "../chunk-H3FEVIQD.js";
104
+ } from "../chunk-KYQXUGH7.js";
80
105
  import {
81
106
  detectProviderLiveCapabilities,
82
107
  hasSpawnProvider,
83
108
  resolveControlPolicy
84
- } from "../chunk-COGHCL6K.js";
109
+ } from "../chunk-JXUAXO74.js";
85
110
  import {
86
111
  describeAutoUpdateAnnouncement,
87
112
  takeAutoUpdateAnnouncement
88
- } from "../chunk-CTOK3AYA.js";
113
+ } from "../chunk-BWYJ6AAF.js";
89
114
  import {
90
115
  KEEP_HINT,
91
116
  captureHookTakeover,
@@ -95,23 +120,23 @@ import {
95
120
  hookOwnerOf,
96
121
  mcpBearerKey,
97
122
  planHooks
98
- } from "../chunk-REYWOCQJ.js";
123
+ } from "../chunk-R2XCLT6I.js";
99
124
  import {
100
125
  AGENT_CHOICES,
101
126
  effectiveControlMode,
102
127
  effectiveVerify,
103
128
  parseSetupOptions
104
- } from "../chunk-HCVAMXHT.js";
129
+ } from "../chunk-CVALVGA7.js";
105
130
  import {
106
131
  liveBridgeProbe,
107
132
  resolveBridgeStub
108
- } from "../chunk-GQPCPEG2.js";
133
+ } from "../chunk-5HLTWFJ6.js";
109
134
  import {
110
135
  claudeWired,
111
136
  codexWired,
112
137
  geminiWired,
113
138
  pusharyHookExecutable
114
- } from "../chunk-SND3C2AV.js";
139
+ } from "../chunk-PQ4F64M2.js";
115
140
  import {
116
141
  clearDaemonNeedsLogin,
117
142
  daemonHasRemoteProof,
@@ -124,64 +149,26 @@ import {
124
149
  replaceDaemonService,
125
150
  stopDaemonService,
126
151
  waitForDaemonRemoteProof
127
- } from "../chunk-QKOVVL7I.js";
152
+ } from "../chunk-73T6MSU5.js";
128
153
  import {
129
154
  GEMINI_HOOK_BINARY,
130
155
  addGeminiHooks,
131
156
  addGeminiMcpServer,
132
157
  compareVersion,
133
158
  parseVersion
134
- } from "../chunk-57DDP4TB.js";
135
- import "../chunk-VDMX5EMU.js";
159
+ } from "../chunk-ZQ7IDOKY.js";
160
+ import "../chunk-VKVIAZQO.js";
136
161
  import {
137
162
  transcriptPreferenceForSetup
138
- } from "../chunk-JBU7XKY2.js";
163
+ } from "../chunk-B76WVEDX.js";
139
164
  import "../chunk-XHKBHWLX.js";
140
165
  import {
141
166
  reportEvent
142
- } from "../chunk-JBXUKGZS.js";
143
- import "../chunk-BEHGVU4W.js";
144
- import "../chunk-LVHGSD5E.js";
145
- import "../chunk-LM2IOEDK.js";
146
- import {
147
- addCodexHookTrust,
148
- addCodexHooks,
149
- addCodexMcpServer,
150
- autoUpdateState,
151
- captureCodexHookTrust,
152
- claudeJson,
153
- claudeMcpReceipt,
154
- claudeSettings,
155
- claudeSkillDir,
156
- codexAgentsMd2 as codexAgentsMd,
157
- codexConfigToml,
158
- codexHome,
159
- codexHookPositions,
160
- codexSkillDir2 as codexSkillDir,
161
- codexVacatedIndexes,
162
- cursorPluginDir,
163
- cursorUserHooks,
164
- cursorUserMcp,
165
- dropVacatedCodexHookTrust,
166
- fetchLatestPublishedVersion,
167
- geminiMd,
168
- geminiSettings,
169
- guardBinary,
170
- guardCursorGate,
171
- guardedArgv,
172
- hermesConfigReceipt,
173
- hookTakeoverReceipt,
174
- installGlobally,
175
- npmErrorMessage,
176
- pusharyConfigFile,
177
- pusharyDir,
178
- readCodexMcpAuth,
179
- registerHookEntry,
180
- resolveGlobalBinDir,
181
- resolveGlobalBinary,
182
- vscodePluginDir,
183
- vscodePluginMcp
184
- } from "../chunk-3BJQYXTL.js";
167
+ } from "../chunk-IJ6ECPA6.js";
168
+ import "../chunk-DZURML2D.js";
169
+ import "../chunk-EGKXSQCY.js";
170
+ import "../chunk-V6QRSU2G.js";
171
+ import "../chunk-POFBE6ZY.js";
185
172
  import {
186
173
  BROWSER_CONNECT_COMMAND,
187
174
  confirmAppConnection,
@@ -192,13 +179,13 @@ import {
192
179
  printConnectInstructions,
193
180
  roundTripEvidence,
194
181
  verifyRoundTrip
195
- } from "../chunk-HHYVBHHC.js";
182
+ } from "../chunk-HDRNWNVP.js";
196
183
  import "../chunk-3EGEA4KH.js";
197
184
  import {
198
185
  checkApiKey,
199
186
  describeKeyCheck,
200
187
  samePusharyAccount
201
- } from "../chunk-TZ4KUNZG.js";
188
+ } from "../chunk-X6KDKOV5.js";
202
189
  import {
203
190
  setHumanStream
204
191
  } from "../chunk-QCGNGEGE.js";
@@ -216,40 +203,82 @@ import {
216
203
  readKeySource,
217
204
  resolveShellRc,
218
205
  writeKey
219
- } from "../chunk-CWIARY6F.js";
220
- import "../chunk-HETOKNIL.js";
221
- import "../chunk-SAF6HGAA.js";
206
+ } from "../chunk-UOAQ6QMP.js";
207
+ import "../chunk-JNXVOU6Y.js";
208
+ import "../chunk-KW2RRR7D.js";
209
+ import "../chunk-XNCMT7YY.js";
222
210
  import {
223
211
  UsageError
224
212
  } from "../chunk-7QLSKOSU.js";
225
213
  import {
226
214
  EXIT
227
215
  } from "../chunk-KZERVKTD.js";
228
- import "../chunk-NPGOQQCV.js";
216
+ import "../chunk-ROQK7IN3.js";
217
+ import {
218
+ addCodexHookTrust,
219
+ addCodexHooks,
220
+ addCodexMcpServer,
221
+ autoUpdateState,
222
+ captureCodexHookTrust,
223
+ claudeJson,
224
+ claudeMcpReceipt,
225
+ claudeSettings,
226
+ claudeSkillDir,
227
+ codexAgentsMd2 as codexAgentsMd,
228
+ codexConfigToml,
229
+ codexHome,
230
+ codexHookPositions,
231
+ codexSkillDir2 as codexSkillDir,
232
+ codexVacatedIndexes,
233
+ cursorPluginDir,
234
+ cursorUserHooks,
235
+ cursorUserMcp,
236
+ dropVacatedCodexHookTrust,
237
+ fetchLatestPublishedVersion,
238
+ fxAgentsMd,
239
+ fxConfigDir,
240
+ fxMcpProfile,
241
+ fxSettings,
242
+ geminiMd,
243
+ geminiSettings,
244
+ guardBinary,
245
+ guardCursorGate,
246
+ guardedArgv,
247
+ hermesConfigReceipt,
248
+ hookTakeoverReceipt,
249
+ installGlobally,
250
+ npmErrorMessage,
251
+ pusharyConfigFile,
252
+ pusharyDir,
253
+ readCodexMcpAuth,
254
+ registerHookEntry,
255
+ resolveGlobalBinDir,
256
+ resolveGlobalBinary,
257
+ vscodePluginDir,
258
+ vscodePluginMcp
259
+ } from "../chunk-DNJUSFBL.js";
229
260
  import {
230
261
  backupFile,
231
262
  readJsonSafe,
232
263
  writeFileAtomic,
233
264
  writeJsonAtomic
234
265
  } from "../chunk-T7E75EKA.js";
235
- import "../chunk-OSJEMXSR.js";
266
+ import "../chunk-V4AQBAVG.js";
267
+ import {
268
+ NPX_LATEST_COMMAND,
269
+ renderCommandHelp
270
+ } from "../chunk-B3UXMSMW.js";
236
271
  import {
237
272
  HOOK_COMPATIBLE_PROFILES,
238
273
  HOOK_LOCATOR_BINARY,
239
274
  PRETOOLUSE_GATED_TOOLS,
240
275
  SUPPORT_EMAIL,
241
276
  compatibleTargetFiles,
277
+ getPackageVersion,
242
278
  hookCompatibleProfile,
279
+ isNewerVersion,
243
280
  isValidApiKey
244
- } from "../chunk-GHOB245Q.js";
245
- import {
246
- NPX_LATEST_COMMAND,
247
- renderCommandHelp
248
- } from "../chunk-EA3IELHP.js";
249
- import {
250
- getPackageVersion,
251
- isNewerVersion
252
- } from "../chunk-HWJW3CPO.js";
281
+ } from "../chunk-YROGUPOZ.js";
253
282
 
254
283
  // bin/pushary-setup.ts
255
284
  import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, readdirSync, statSync, openSync, readSync, closeSync } from "fs";
@@ -278,35 +307,6 @@ var planPhoneCheck = (context) => {
278
307
  return "connect";
279
308
  };
280
309
 
281
- // src/setup/agent-failure.ts
282
- var AgentConfigError = class extends Error {
283
- kind;
284
- filePath;
285
- constructor(kind, filePath, message) {
286
- super(message);
287
- this.name = "AgentConfigError";
288
- this.kind = kind;
289
- this.filePath = filePath;
290
- }
291
- };
292
- var configFailureKind = (readFailure) => readFailure === "unparseable" ? "config-unparseable" : "config-unreadable";
293
- var AGENT_FAILURE_DETAILS = {
294
- "not-wired": "reported success but its config is not there.",
295
- "app-account-mismatch": "Mac app hooks kept, but their Pushary account could not be matched to this setup."
296
- };
297
- var describedAgentFailure = (agent, kind) => ({
298
- agent,
299
- kind,
300
- detail: AGENT_FAILURE_DETAILS[kind]
301
- });
302
- var agentFailureFromError = (agent, error, describeError) => ({
303
- agent,
304
- kind: error instanceof AgentConfigError ? error.kind : "installer-error",
305
- detail: describeError(error)
306
- });
307
- var retryAgentCommand = (agent) => `${NPX_LATEST_COMMAND} setup --agents ${agent}`;
308
- var agentFailureWire = (failures) => failures.map(({ agent, kind }) => ({ agent, kind }));
309
-
310
310
  // src/setup/closing.ts
311
311
  var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";
312
312
  var COMMAND_SURFACE = [
@@ -1484,6 +1484,112 @@ var saveApiKey = async (apiKey, controlMode, transcriptSync) => {
1484
1484
  }
1485
1485
  return rc;
1486
1486
  };
1487
+ var fxRetryHint = () => `Fix it, then run ${retryAgentCommand("fx")}.`;
1488
+ var readFxProfileForSetup = (filePath) => {
1489
+ const read = readFxFile(filePath, readFxProfile);
1490
+ if (read.kind === "profile") return read.profile;
1491
+ if (read.kind === "missing") return {};
1492
+ if (read.kind === "unreadable") {
1493
+ throw new AgentConfigError(configFailureKind("unreadable"), filePath, `${filePath} could not be read, so it was left untouched. ${fxRetryHint()}`);
1494
+ }
1495
+ throw new AgentConfigError(
1496
+ configFailureKind("unparseable"),
1497
+ filePath,
1498
+ `${filePath} ${FX_PROFILE_REFUSALS[read.reason]}, so it was left untouched. ${fxRetryHint()}`
1499
+ );
1500
+ };
1501
+ var writeFxProfile = (filePath, profile) => {
1502
+ const rendered = fxProfileText(profile);
1503
+ if (rendered.kind === "refused") {
1504
+ throw new Error(`${filePath} would grow past the size fx reads, so it was left untouched. ${fxRetryHint()}`);
1505
+ }
1506
+ writeFileAtomic(filePath, rendered.text, KEY_FILE_MODE);
1507
+ };
1508
+ var FX_ALLOW_RULE_SNIPPET = `"permission": { "${FX_PUSHARY_TOOLS_RULE}": "allow" }`;
1509
+ var fxSettingsReadRefusal = (filePath, read) => {
1510
+ if (read.kind === "unreadable") return `${filePath} could not be read`;
1511
+ if (read.kind === "refused") return `${filePath} ${FX_SETTINGS_REFUSALS[read.reason]}`;
1512
+ return null;
1513
+ };
1514
+ var allowPusharyToolsInFx = (filePath) => {
1515
+ const read = readFxFile(filePath, readFxSettings);
1516
+ const refusal = fxSettingsReadRefusal(filePath, read);
1517
+ if (refusal) return { kind: "refused", detail: refusal };
1518
+ const { settings, change } = withPusharyToolsAllowed(read.kind === "settings" ? read.settings : {});
1519
+ if (change !== "added") return { kind: "written", change, overridingWorkspaces: workspacesOverridingPusharyRule(settings) };
1520
+ const rendered = fxSettingsText(settings);
1521
+ if (rendered.kind === "refused") return { kind: "refused", detail: `${filePath} would grow past the 64 KiB fx reads` };
1522
+ try {
1523
+ writeFileAtomic(filePath, rendered.text, KEY_FILE_MODE);
1524
+ } catch (err) {
1525
+ return { kind: "refused", detail: `${filePath} could not be written (${formatError(err)})` };
1526
+ }
1527
+ return { kind: "written", change, overridingWorkspaces: workspacesOverridingPusharyRule(settings) };
1528
+ };
1529
+ var reportFxToolsRule = (outcome) => {
1530
+ if (outcome.kind === "refused") {
1531
+ console.log(` ${yellow("!")} ${outcome.detail}, so Pushary tools were not auto-allowed. fx will review or prompt for each Pushary call.`);
1532
+ noteManual(`Add ${FX_ALLOW_RULE_SNIPPET} to ${fxSettings()} so fx runs Pushary tools without a prompt.`);
1533
+ return;
1534
+ }
1535
+ if (outcome.change === "user-rule-kept") {
1536
+ console.log(` ${yellow("!")} ${fxSettings()} already has a ${FX_PUSHARY_TOOLS_RULE} rule, so it was left as you set it.`);
1537
+ } else {
1538
+ console.log(` ${dim("\u2022")} Auto-allowed tools: ${FX_PUSHARY_TOOLS_RULE} in ${fxSettings()}, so Pushary calls run without an fx prompt or review`);
1539
+ }
1540
+ if (outcome.overridingWorkspaces.length > 0) {
1541
+ console.log(` ${yellow("!")} ${outcome.overridingWorkspaces.length} fx workspace(s) set their own permission rules, which replace the global ones there. Add ${FX_PUSHARY_TOOLS_RULE} to each to auto-allow Pushary tools.`);
1542
+ }
1543
+ };
1544
+ var teachFxToAskViaPush = () => {
1545
+ if (fxIgnoresInstructionsFile(fxAgentsMd(), fxConfigDir())) return false;
1546
+ writeInstructionBlock(fxAgentsMd(), `${renderAgentInstructions("fx")}
1547
+
1548
+ ${FX_TOOL_DISCOVERY_NOTE}`);
1549
+ return true;
1550
+ };
1551
+ var fxWired = () => {
1552
+ const read = readFxFile(fxMcpProfile(), readFxProfile);
1553
+ return read.kind === "profile" && isFxPusharyEntry(fxPusharyEntryOf(read.profile));
1554
+ };
1555
+ var setupFx = async () => {
1556
+ console.log(`
1557
+ ${bold("Setting up fx")}
1558
+ `);
1559
+ if (process.platform === "win32") {
1560
+ console.log(` ${yellow("!")} fx does not run on Windows. Skipping.`);
1561
+ return "skipped";
1562
+ }
1563
+ if (!existsSync(fxConfigDir())) {
1564
+ console.log(` ${yellow("!")} fx not found (${fxConfigDir()} does not exist). Skipping.`);
1565
+ console.log(` ${dim("Install fx from https://fx.sh, run it once, then re-run setup.")}`);
1566
+ return "skipped";
1567
+ }
1568
+ await installGlobally2();
1569
+ await spinner(`Adding the Pushary MCP server (${fxMcpProfile()})`, async () => {
1570
+ const profile = readFxProfileForSetup(fxMcpProfile());
1571
+ const bridge = resolveGlobalBinary(MCP_BRIDGE_BINARY) ?? MCP_BRIDGE_BINARY;
1572
+ const entry = fxPusharyEntry(guardedArgv({ kind: "binary", path: bridge, runtime: "node" }));
1573
+ writeFxProfile(fxMcpProfile(), withFxPusharyServer(profile, entry));
1574
+ });
1575
+ const toolsRule = allowPusharyToolsInFx(fxSettings());
1576
+ const instructionsWritten = teachFxToAskViaPush();
1577
+ console.log();
1578
+ console.log(` ${dim("What this configured:")}`);
1579
+ console.log(` ${dim("\u2022")} MCP server ${bold("pushary")} in ${fxMcpProfile()}`);
1580
+ console.log(` ${dim("\u2022")} It runs ${MCP_BRIDGE_BINARY}, which signs in with the key saved in ~/.pushary, so no key is written to fx's config`);
1581
+ reportFxToolsRule(toolsRule);
1582
+ if (instructionsWritten) {
1583
+ console.log(` ${dim("\u2022")} Instructions: ${fxAgentsMd()}`);
1584
+ } else {
1585
+ console.log(` ${yellow("!")} ${fxAgentsMd()} links outside ${fxConfigDir()}, and fx ignores such a file, so no instructions were written.`);
1586
+ noteManual(`Replace the ${fxAgentsMd()} symlink with a file so fx loads Pushary's instructions, then run ${retryAgentCommand("fx")}.`);
1587
+ }
1588
+ console.log(` ${dim("\u2022")} fx cannot hand its own approval prompts to Pushary; its agent asks through Pushary when it chooses to`);
1589
+ console.log(` ${dim("Restart fx, or run /mcp reload in a running session.")}`);
1590
+ noteManual("Restart fx, or run /mcp reload in a running session.");
1591
+ return "configured";
1592
+ };
1487
1593
  var setupCustom = async (apiKey, context) => {
1488
1594
  console.log(`
1489
1595
  ${bold("Connect any other agent (MCP or HTTP)")}
@@ -1665,6 +1771,8 @@ var agentIsWired = (agent) => {
1665
1771
  return existsSync(VSCODE_PLUGIN_MCP);
1666
1772
  case "opencode":
1667
1773
  return openCodeWired();
1774
+ case "fx":
1775
+ return fxWired();
1668
1776
  default: {
1669
1777
  const profile = hookCompatibleProfile(agent);
1670
1778
  if (!profile) return true;
@@ -1757,6 +1865,7 @@ var AGENT_SETUP = {
1757
1865
  cursor: setupCursor,
1758
1866
  vscode: setupVsCode,
1759
1867
  opencode: setupOpenCode,
1868
+ fx: setupFx,
1760
1869
  ...COMPATIBLE_SETUP,
1761
1870
  custom: setupCustom
1762
1871
  };
@@ -1861,6 +1970,7 @@ var AGENT_NAMES = {
1861
1970
  cursor: "Cursor",
1862
1971
  vscode: "VS Code",
1863
1972
  opencode: "OpenCode",
1973
+ fx: "fx",
1864
1974
  ...compatibleRecord((profile) => profile.label),
1865
1975
  custom: "Other"
1866
1976
  };
@@ -1872,6 +1982,7 @@ var AGENT_CAPABILITIES = {
1872
1982
  cursor: "plugin + permission gate",
1873
1983
  vscode: "agent plugin + permission gate",
1874
1984
  opencode: "generated plugin + permission gate",
1985
+ fx: "MCP through a local bridge",
1875
1986
  ...compatibleRecord((profile) => profile.mcp ? "MCP + native hooks" : "native hooks"),
1876
1987
  custom: "any MCP or HTTP agent (Windsurf, n8n, custom)"
1877
1988
  };
@@ -1950,6 +2061,7 @@ var AGENT_TARGETS = {
1950
2061
  openCodeConfigFile(),
1951
2062
  OPENCODE_INSTRUCTIONS()
1952
2063
  ],
2064
+ fx: [fxMcpProfile(), fxSettings(), fxAgentsMd()],
1953
2065
  ...compatibleRecord((profile) => compatibleTargetFiles(profile).map((file) => join3(homedir(), ...file))),
1954
2066
  custom: ["nothing (prints connection details only)"]
1955
2067
  };
@@ -1,17 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readLedgerSummary
4
- } from "../chunk-4KSTLHWY.js";
4
+ } from "../chunk-2C7CCWVX.js";
5
5
  import {
6
6
  exitOnHelpFlag
7
- } from "../chunk-P4BNYJ5Q.js";
7
+ } from "../chunk-2PS6QWDW.js";
8
8
  import "../chunk-KZERVKTD.js";
9
9
  import {
10
10
  getApiKey
11
- } from "../chunk-OSJEMXSR.js";
12
- import "../chunk-GHOB245Q.js";
13
- import "../chunk-EA3IELHP.js";
14
- import "../chunk-HWJW3CPO.js";
11
+ } from "../chunk-V4AQBAVG.js";
12
+ import "../chunk-B3UXMSMW.js";
13
+ import "../chunk-YROGUPOZ.js";
15
14
 
16
15
  // bin/pushary-stats.ts
17
16
  exitOnHelpFlag("stats");
@@ -2,49 +2,48 @@
2
2
  import {
3
3
  describeLastSeen,
4
4
  listMachines
5
- } from "../chunk-ILGL4L3J.js";
6
- import "../chunk-COGHCL6K.js";
7
- import "../chunk-QKOVVL7I.js";
5
+ } from "../chunk-4F46VIEE.js";
6
+ import "../chunk-JXUAXO74.js";
7
+ import "../chunk-73T6MSU5.js";
8
8
  import "../chunk-XHKBHWLX.js";
9
- import "../chunk-LM2IOEDK.js";
10
- import "../chunk-3BJQYXTL.js";
11
9
  import {
12
10
  describeReach,
13
11
  fetchChannels,
14
12
  reachVerdict
15
- } from "../chunk-HHYVBHHC.js";
13
+ } from "../chunk-HDRNWNVP.js";
16
14
  import "../chunk-3EGEA4KH.js";
17
15
  import {
18
16
  checkApiKey,
19
17
  describeKeyCheck
20
- } from "../chunk-TZ4KUNZG.js";
18
+ } from "../chunk-X6KDKOV5.js";
21
19
  import "../chunk-QCGNGEGE.js";
22
20
  import {
23
21
  createIo
24
22
  } from "../chunk-5RUIFDTP.js";
25
23
  import {
26
24
  exitOnHelpFlag
27
- } from "../chunk-P4BNYJ5Q.js";
25
+ } from "../chunk-2PS6QWDW.js";
28
26
  import {
29
27
  rejectUnknownFlags
30
28
  } from "../chunk-GMXKITVA.js";
31
29
  import {
32
30
  readKeySource
33
- } from "../chunk-CWIARY6F.js";
34
- import "../chunk-HETOKNIL.js";
35
- import "../chunk-SAF6HGAA.js";
31
+ } from "../chunk-UOAQ6QMP.js";
32
+ import "../chunk-JNXVOU6Y.js";
33
+ import "../chunk-KW2RRR7D.js";
34
+ import "../chunk-XNCMT7YY.js";
36
35
  import {
37
36
  UsageError
38
37
  } from "../chunk-7QLSKOSU.js";
39
38
  import {
40
39
  EXIT
41
40
  } from "../chunk-KZERVKTD.js";
42
- import "../chunk-NPGOQQCV.js";
41
+ import "../chunk-ROQK7IN3.js";
42
+ import "../chunk-DNJUSFBL.js";
43
43
  import "../chunk-T7E75EKA.js";
44
- import "../chunk-OSJEMXSR.js";
45
- import "../chunk-GHOB245Q.js";
46
- import "../chunk-EA3IELHP.js";
47
- import "../chunk-HWJW3CPO.js";
44
+ import "../chunk-V4AQBAVG.js";
45
+ import "../chunk-B3UXMSMW.js";
46
+ import "../chunk-YROGUPOZ.js";
48
47
 
49
48
  // src/status.ts
50
49
  var keySourceLine = (source) => {
@@ -2,45 +2,46 @@
2
2
  import {
3
3
  activeHookSource,
4
4
  activeIdentity
5
- } from "../chunk-BG6OCZ4N.js";
6
- import "../chunk-H3FEVIQD.js";
5
+ } from "../chunk-WUNZAE7I.js";
6
+ import "../chunk-KYQXUGH7.js";
7
7
  import {
8
8
  readHookInput
9
- } from "../chunk-JX67DVMY.js";
10
- import "../chunk-LDS4ERW4.js";
9
+ } from "../chunk-UC65FJJT.js";
10
+ import "../chunk-EAQMWJPG.js";
11
11
  import "../chunk-SGZJ5LYH.js";
12
- import "../chunk-REYWOCQJ.js";
13
- import "../chunk-HCVAMXHT.js";
14
- import "../chunk-GQPCPEG2.js";
15
- import "../chunk-SND3C2AV.js";
16
- import "../chunk-QKOVVL7I.js";
17
- import "../chunk-57DDP4TB.js";
18
- import "../chunk-VDMX5EMU.js";
19
- import "../chunk-KNIIFNNQ.js";
20
- import "../chunk-66H2QQAK.js";
21
- import "../chunk-JBU7XKY2.js";
12
+ import "../chunk-R2XCLT6I.js";
13
+ import "../chunk-CVALVGA7.js";
14
+ import "../chunk-5HLTWFJ6.js";
15
+ import "../chunk-PQ4F64M2.js";
16
+ import "../chunk-73T6MSU5.js";
17
+ import "../chunk-ZQ7IDOKY.js";
18
+ import "../chunk-VKVIAZQO.js";
19
+ import "../chunk-BH2SKSSK.js";
20
+ import "../chunk-KXMZMZD3.js";
21
+ import "../chunk-B76WVEDX.js";
22
22
  import "../chunk-XHKBHWLX.js";
23
23
  import {
24
24
  handleStop,
25
25
  handleSubagentStop,
26
26
  isSubagentStop
27
- } from "../chunk-JBXUKGZS.js";
28
- import "../chunk-BEHGVU4W.js";
29
- import "../chunk-LVHGSD5E.js";
30
- import "../chunk-LM2IOEDK.js";
31
- import "../chunk-3BJQYXTL.js";
27
+ } from "../chunk-IJ6ECPA6.js";
28
+ import "../chunk-DZURML2D.js";
29
+ import "../chunk-EGKXSQCY.js";
30
+ import "../chunk-V6QRSU2G.js";
31
+ import "../chunk-POFBE6ZY.js";
32
32
  import "../chunk-GMXKITVA.js";
33
- import "../chunk-CWIARY6F.js";
34
- import "../chunk-HETOKNIL.js";
35
- import "../chunk-SAF6HGAA.js";
33
+ import "../chunk-UOAQ6QMP.js";
34
+ import "../chunk-JNXVOU6Y.js";
35
+ import "../chunk-KW2RRR7D.js";
36
+ import "../chunk-XNCMT7YY.js";
36
37
  import "../chunk-7QLSKOSU.js";
37
38
  import "../chunk-KZERVKTD.js";
38
- import "../chunk-NPGOQQCV.js";
39
+ import "../chunk-ROQK7IN3.js";
40
+ import "../chunk-DNJUSFBL.js";
39
41
  import "../chunk-T7E75EKA.js";
40
- import "../chunk-OSJEMXSR.js";
41
- import "../chunk-GHOB245Q.js";
42
- import "../chunk-EA3IELHP.js";
43
- import "../chunk-HWJW3CPO.js";
42
+ import "../chunk-V4AQBAVG.js";
43
+ import "../chunk-B3UXMSMW.js";
44
+ import "../chunk-YROGUPOZ.js";
44
45
 
45
46
  // bin/pushary-stop-hook.ts
46
47
  var AGENT = activeIdentity(process.argv);