pushary 1.9.104 → 1.9.106

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 (133) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/data/SKILL.md +3 -3
  3. package/data/cursor-plugin/skills/pushary/SKILL.md +2 -2
  4. package/data/vscode-plugin/skills/pushary/SKILL.md +2 -2
  5. package/dist/{api-QOG7JVXE.js → api-RL5CPDTH.js} +11 -11
  6. package/dist/bin/pushary-audit.js +4 -4
  7. package/dist/bin/pushary-bell-hook.js +28 -27
  8. package/dist/bin/pushary-bell.js +11 -11
  9. package/dist/bin/pushary-claude.js +28 -28
  10. package/dist/bin/pushary-clean.js +37 -37
  11. package/dist/bin/pushary-codex-bridge.js +22 -22
  12. package/dist/bin/pushary-codex-hook.js +33 -32
  13. package/dist/bin/pushary-codex-session.js +8 -8
  14. package/dist/bin/pushary-codex.js +15 -15
  15. package/dist/bin/pushary-connect.js +28 -28
  16. package/dist/bin/pushary-cowork.js +5 -5
  17. package/dist/bin/pushary-daemon.js +489 -62
  18. package/dist/bin/pushary-disconnect.js +27 -27
  19. package/dist/bin/pushary-display-hook.js +18 -18
  20. package/dist/bin/pushary-doctor.js +50 -50
  21. package/dist/bin/pushary-elicitation-hook.js +28 -27
  22. package/dist/bin/pushary-gemini-bridge.js +16 -16
  23. package/dist/bin/pushary-gemini-hook.js +30 -29
  24. package/dist/bin/pushary-hook.js +33 -31
  25. package/dist/bin/pushary-login.js +21 -21
  26. package/dist/bin/pushary-logout.js +26 -26
  27. package/dist/bin/pushary-mcp.js +12 -12
  28. package/dist/bin/pushary-mode.js +16 -16
  29. package/dist/bin/pushary-notification-hook.js +27 -26
  30. package/dist/bin/pushary-opencode-hook.js +29 -28
  31. package/dist/bin/pushary-permission-denied-hook.js +33 -31
  32. package/dist/bin/pushary-permission-hook.js +33 -31
  33. package/dist/bin/pushary-post-hook.js +27 -26
  34. package/dist/bin/pushary-prompt-hook.js +27 -26
  35. package/dist/bin/pushary-session-end-hook.js +29 -28
  36. package/dist/bin/pushary-session-start-hook.js +37 -36
  37. package/dist/bin/pushary-setup.js +49 -49
  38. package/dist/bin/pushary-stats.js +5 -5
  39. package/dist/bin/pushary-status.js +33 -33
  40. package/dist/bin/pushary-stop-hook.js +27 -26
  41. package/dist/bin/pushary-stopfailure-hook.js +27 -26
  42. package/dist/bin/pushary-suggestions.js +16 -16
  43. package/dist/bin/pushary-transcript-register.js +19 -19
  44. package/dist/bin/pushary-transcripts.js +27 -27
  45. package/dist/bin/pushary-upgrade.js +41 -41
  46. package/dist/bin/pushary-wait.js +16 -16
  47. package/dist/bin/pushary.js +8 -8
  48. package/dist/{chunk-4JBCPRWZ.js → chunk-2HC5ISDW.js} +2 -2
  49. package/dist/{chunk-HB7FHRTT.js → chunk-43PNDDB3.js} +6 -6
  50. package/dist/{chunk-SJCHJQKT.js → chunk-4EMPELDR.js} +4 -4
  51. package/dist/{chunk-XDTE55H7.js → chunk-4OUPD4KA.js} +4 -4
  52. package/dist/{chunk-HJ4EBHK4.js → chunk-4XE3DVF7.js} +2 -2
  53. package/dist/{chunk-SJJCCFD5.js → chunk-5IAW6G3K.js} +3 -3
  54. package/dist/{chunk-JVZVO3K5.js → chunk-6DKMZBRK.js} +1 -1
  55. package/dist/{chunk-OFRQNTJD.js → chunk-76JOLPST.js} +1 -1
  56. package/dist/{chunk-FYQHXN4X.js → chunk-772NHSQB.js} +2 -2
  57. package/dist/{chunk-BDSI2NEN.js → chunk-A37RKFI3.js} +4 -4
  58. package/dist/{chunk-UL52HYKN.js → chunk-ASCQXNCL.js} +1 -1
  59. package/dist/{chunk-XXPA3X6L.js → chunk-ATVZAEM5.js} +5 -5
  60. package/dist/{chunk-JMTOQXHV.js → chunk-B5Q44HKN.js} +1 -1
  61. package/dist/{chunk-NKA2PEQQ.js → chunk-B7O4CXFX.js} +4 -4
  62. package/dist/{chunk-SVZPRTCK.js → chunk-CJTJ55DR.js} +1 -1
  63. package/dist/{chunk-AG7PFGGE.js → chunk-CKWV3T7O.js} +6 -6
  64. package/dist/{chunk-GV2MF4NY.js → chunk-DA57ZI62.js} +2 -2
  65. package/dist/{chunk-ZBT3U2VB.js → chunk-DH22FQAS.js} +1 -1
  66. package/dist/{chunk-VZY4GD4T.js → chunk-DIVVLBZZ.js} +6 -6
  67. package/dist/{chunk-FXTUSTQG.js → chunk-DS672F57.js} +11 -11
  68. package/dist/{chunk-NGY2WS3X.js → chunk-EMSRB2KH.js} +3 -3
  69. package/dist/{chunk-HHEFOGT2.js → chunk-FE5JENEJ.js} +3 -3
  70. package/dist/{chunk-4QI6SBNR.js → chunk-FJYUB3ZK.js} +4 -4
  71. package/dist/{chunk-6B4R7HUV.js → chunk-FUTFQSRA.js} +1 -1
  72. package/dist/{chunk-TMJK3CLD.js → chunk-G5HGV6D4.js} +3 -3
  73. package/dist/{chunk-HXZYBYBD.js → chunk-GBHP3LML.js} +7 -5
  74. package/dist/{chunk-4OLWSYX5.js → chunk-GESW4OSZ.js} +4 -4
  75. package/dist/{chunk-3A7REECH.js → chunk-GKCDMAUM.js} +1 -1
  76. package/dist/{chunk-U5DBYW63.js → chunk-GUIS6ASL.js} +1 -1
  77. package/dist/{chunk-KDIZS7FN.js → chunk-HH5NNPB5.js} +1 -1
  78. package/dist/{chunk-XTMAVKO3.js → chunk-HLYZEZOI.js} +3 -3
  79. package/dist/{chunk-OPV6724W.js → chunk-HONSMBF2.js} +7 -7
  80. package/dist/{chunk-M7BDKARZ.js → chunk-HXBQTPKC.js} +1 -1
  81. package/dist/{chunk-PYUN7HNY.js → chunk-I3IUS4SR.js} +2 -2
  82. package/dist/{chunk-CC4LGKEZ.js → chunk-IAASPG5B.js} +5 -5
  83. package/dist/{chunk-2MRLDEQY.js → chunk-IGO5NDQY.js} +3 -3
  84. package/dist/{chunk-RDUY7MKN.js → chunk-IHQRLJEP.js} +12 -12
  85. package/dist/{chunk-RUN772MN.js → chunk-J2HIFUAT.js} +7 -7
  86. package/dist/{chunk-UYJLXAP4.js → chunk-J5PUKKCT.js} +8 -7
  87. package/dist/{chunk-AYWX6M7J.js → chunk-JCSJEMTA.js} +208 -60
  88. package/dist/{chunk-FVERRWDP.js → chunk-JDGLNYDZ.js} +2 -2
  89. package/dist/{chunk-5BX57BGT.js → chunk-JLJJRBTD.js} +6 -5
  90. package/dist/{chunk-UUYLBSAU.js → chunk-KHZCJP7P.js} +11 -11
  91. package/dist/{chunk-WBLK4WLO.js → chunk-LK3WA6MK.js} +3 -3
  92. package/dist/{chunk-ID4BZRBW.js → chunk-LL7SW4RL.js} +3 -3
  93. package/dist/{chunk-GV5TEADP.js → chunk-LMDXQIYT.js} +1 -1
  94. package/dist/{chunk-RYUIXLZ5.js → chunk-MFJHLVIZ.js} +11 -95
  95. package/dist/{chunk-XXNXMX2G.js → chunk-MLLL2ET6.js} +17 -61
  96. package/dist/{chunk-TYM6IH5F.js → chunk-NM44KCO6.js} +4 -4
  97. package/dist/{chunk-5YVBVJOH.js → chunk-O5TB2LMQ.js} +8 -0
  98. package/dist/{chunk-ZUXDGVW4.js → chunk-OBZQPBUI.js} +5 -5
  99. package/dist/chunk-OINGJICB.js +108 -0
  100. package/dist/{chunk-JGRBWTDW.js → chunk-P3H6I656.js} +11 -11
  101. package/dist/{chunk-IVAXF3JG.js → chunk-P3VVRBBI.js} +1 -1
  102. package/dist/{chunk-PK6LBL3Z.js → chunk-PFZCLG55.js} +4 -4
  103. package/dist/{chunk-I3T5YV5I.js → chunk-RKQVMFHN.js} +11 -93
  104. package/dist/{chunk-VUFHYMSP.js → chunk-ROVLRXBI.js} +1 -1
  105. package/dist/{chunk-7RHEZVAE.js → chunk-S2TTGX6F.js} +5 -5
  106. package/dist/{chunk-N4RIGNDX.js → chunk-S75UO75C.js} +2 -2
  107. package/dist/{chunk-QENTGE75.js → chunk-T5I4PKOQ.js} +37 -1
  108. package/dist/{chunk-SPM4VNED.js → chunk-TXMYET7E.js} +3 -3
  109. package/dist/{chunk-CFTPHNBY.js → chunk-UUJQK7DJ.js} +1 -1
  110. package/dist/{chunk-ORIVT4BL.js → chunk-UXIUCMFO.js} +6 -6
  111. package/dist/{chunk-4HBWXZPI.js → chunk-VCWLGM77.js} +3 -3
  112. package/dist/{chunk-3KEY3453.js → chunk-VK4PPVWB.js} +24 -10
  113. package/dist/{chunk-AE2BQ3XM.js → chunk-VKTW5WVB.js} +2 -2
  114. package/dist/chunk-WUIWHGKF.js +56 -0
  115. package/dist/{chunk-FQNMUJTK.js → chunk-X3QG5RT5.js} +1 -1
  116. package/dist/{chunk-TYH7SNKD.js → chunk-XN527J4W.js} +1 -1
  117. package/dist/{chunk-YDT6TVGN.js → chunk-YDQ6OJMF.js} +1 -1
  118. package/dist/{chunk-FH6PHTUD.js → chunk-Z5FV7LTD.js} +2 -2
  119. package/dist/{chunk-LIDIA5JW.js → chunk-ZB2WNJXZ.js} +4 -4
  120. package/dist/{chunk-VAZCGOLS.js → chunk-ZCBTCW3T.js} +3 -3
  121. package/dist/{codex-app-cards-switch-6IDDWXYS.js → codex-app-cards-switch-FD2ZWLYL.js} +12 -12
  122. package/dist/{codex-desktop-launch-VP4TXVCM.js → codex-desktop-launch-BN5OABPN.js} +1 -1
  123. package/dist/{codex-session-launch-OACJB5NN.js → codex-session-launch-O3PHQWTS.js} +19 -19
  124. package/dist/{config-S7HAIK6E.js → config-KWP7UXYG.js} +3 -3
  125. package/dist/{global-upgrade-OOFEGR4H.js → global-upgrade-NBSY5436.js} +11 -11
  126. package/dist/{identity-QSM6MVAH.js → identity-RP5I7KTV.js} +5 -5
  127. package/dist/{live-capabilities-NSVW362T.js → live-capabilities-XC6C47ZH.js} +6 -6
  128. package/dist/{paths-KFRRYJWL.js → paths-OE5APZ4Q.js} +8 -4
  129. package/dist/{reapply-7H3VCPW4.js → reapply-DRZ32BIB.js} +29 -29
  130. package/dist/src/index.js +32 -30
  131. package/dist/{upgrade-lock-BJKRXNMC.js → upgrade-lock-LWTVHYAJ.js} +5 -5
  132. package/dist/{usage-KGWL6WKQ.js → usage-5YESCANM.js} +3 -3
  133. package/package.json +1 -1
@@ -1,30 +1,42 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  inspectConfiguredManagedProviders
4
- } from "../chunk-JGRBWTDW.js";
4
+ } from "../chunk-P3H6I656.js";
5
+ import {
6
+ MANAGED_CLAUDE_SETTINGS_BY_PLATFORM
7
+ } from "../chunk-WUIWHGKF.js";
8
+ import {
9
+ declinedAgentsFile,
10
+ readDeclinedAgents
11
+ } from "../chunk-GBHP3LML.js";
5
12
  import {
6
13
  HEARTBEAT_INTERVAL_MS,
7
14
  sendHeartbeat
8
- } from "../chunk-UYJLXAP4.js";
9
- import "../chunk-AE2BQ3XM.js";
15
+ } from "../chunk-J5PUKKCT.js";
16
+ import "../chunk-VKTW5WVB.js";
10
17
  import {
11
18
  readSignedOutDiagnosis
12
- } from "../chunk-FYQHXN4X.js";
19
+ } from "../chunk-772NHSQB.js";
13
20
  import {
14
21
  HERMES_INSTALL_MARKER_FILE,
15
22
  defaultHermesHome,
16
23
  parseHermesInstallMarker
17
- } from "../chunk-TYM6IH5F.js";
24
+ } from "../chunk-NM44KCO6.js";
18
25
  import {
19
26
  writeHuman
20
27
  } from "../chunk-QCGNGEGE.js";
21
- import "../chunk-ORIVT4BL.js";
22
- import "../chunk-4QI6SBNR.js";
23
- import "../chunk-GV2MF4NY.js";
24
- import "../chunk-RDUY7MKN.js";
28
+ import "../chunk-UXIUCMFO.js";
29
+ import "../chunk-FJYUB3ZK.js";
30
+ import "../chunk-DA57ZI62.js";
31
+ import {
32
+ OPENCODE_HOOK_BINARY,
33
+ openCodeConfigDir,
34
+ openCodePluginArgv,
35
+ openCodePluginFile
36
+ } from "../chunk-IHQRLJEP.js";
25
37
  import {
26
38
  exitOnHelpFlag
27
- } from "../chunk-JMTOQXHV.js";
39
+ } from "../chunk-B5Q44HKN.js";
28
40
  import {
29
41
  codexBinaryIsBroken,
30
42
  detectProviderLiveCapabilities,
@@ -33,8 +45,8 @@ import {
33
45
  launchableProviders,
34
46
  resolveControlPolicy,
35
47
  trackProviderInventory
36
- } from "../chunk-4OLWSYX5.js";
37
- import "../chunk-2MRLDEQY.js";
48
+ } from "../chunk-GESW4OSZ.js";
49
+ import "../chunk-IGO5NDQY.js";
38
50
  import {
39
51
  SESSION_REAP_SILENCE_MS,
40
52
  describeIdleWindow,
@@ -42,21 +54,29 @@ import {
42
54
  listProcessProofs,
43
55
  ownsLiveProcess,
44
56
  silentSpawnedProofs
45
- } from "../chunk-HHEFOGT2.js";
46
- import "../chunk-VUFHYMSP.js";
57
+ } from "../chunk-FE5JENEJ.js";
58
+ import "../chunk-ROVLRXBI.js";
47
59
  import {
48
60
  readLocalAutoUpdateReport
49
- } from "../chunk-SJJCCFD5.js";
61
+ } from "../chunk-5IAW6G3K.js";
62
+ import {
63
+ liveCursorGateCoverage
64
+ } from "../chunk-OINGJICB.js";
50
65
  import {
51
66
  startRegisteredTranscripts
52
- } from "../chunk-FXTUSTQG.js";
53
- import "../chunk-M7BDKARZ.js";
67
+ } from "../chunk-DS672F57.js";
68
+ import "../chunk-HXBQTPKC.js";
54
69
  import "../chunk-G66WIAST.js";
55
- import "../chunk-5BX57BGT.js";
70
+ import {
71
+ compatibleConfigFile,
72
+ compatibleHookEvents,
73
+ grokHome,
74
+ parseConfigDocument
75
+ } from "../chunk-JLJJRBTD.js";
56
76
  import {
57
77
  pendingCommandReceipts,
58
78
  removePendingCommand
59
- } from "../chunk-UUYLBSAU.js";
79
+ } from "../chunk-KHZCJP7P.js";
60
80
  import {
61
81
  DAEMON_LEASE_RENEW_INTERVAL_MS,
62
82
  acquireDaemonLease,
@@ -73,52 +93,82 @@ import {
73
93
  requestDaemonHandoff,
74
94
  stopDaemonRunning,
75
95
  writeDaemonNeedsLogin
76
- } from "../chunk-OPV6724W.js";
96
+ } from "../chunk-HONSMBF2.js";
77
97
  import {
78
- hookOwnerOf
79
- } from "../chunk-RYUIXLZ5.js";
80
- import "../chunk-OFRQNTJD.js";
81
- import "../chunk-ZBT3U2VB.js";
82
- import "../chunk-U5DBYW63.js";
98
+ DEFAULT_HOOKS_KEY_PATH,
99
+ GEMINI_HOOK_BINARY,
100
+ GEMINI_HOOK_EVENTS,
101
+ hookOwnerOf,
102
+ hooksAt
103
+ } from "../chunk-MFJHLVIZ.js";
104
+ import "../chunk-76JOLPST.js";
105
+ import "../chunk-DH22FQAS.js";
106
+ import "../chunk-GUIS6ASL.js";
83
107
  import "../chunk-YPY4YCIZ.js";
84
- import "../chunk-HJ4EBHK4.js";
108
+ import "../chunk-4XE3DVF7.js";
85
109
  import "../chunk-XMSDA5WA.js";
86
- import "../chunk-SVZPRTCK.js";
87
- import "../chunk-GV5TEADP.js";
88
- import "../chunk-CC4LGKEZ.js";
110
+ import "../chunk-CJTJ55DR.js";
111
+ import "../chunk-LMDXQIYT.js";
112
+ import "../chunk-IAASPG5B.js";
89
113
  import "../chunk-POFBE6ZY.js";
90
- import "../chunk-PK6LBL3Z.js";
91
- import "../chunk-NGY2WS3X.js";
92
- import "../chunk-ID4BZRBW.js";
114
+ import "../chunk-PFZCLG55.js";
115
+ import "../chunk-EMSRB2KH.js";
116
+ import "../chunk-LL7SW4RL.js";
93
117
  import {
94
118
  spawnClaude
95
119
  } from "../chunk-XHKBHWLX.js";
96
120
  import {
97
121
  getMachineId
98
- } from "../chunk-PYUN7HNY.js";
122
+ } from "../chunk-I3IUS4SR.js";
99
123
  import {
100
124
  readControlMode
101
- } from "../chunk-NKA2PEQQ.js";
102
- import "../chunk-FH6PHTUD.js";
125
+ } from "../chunk-B7O4CXFX.js";
126
+ import "../chunk-Z5FV7LTD.js";
103
127
  import {
128
+ CODEX_EARLIER_APPROVAL_MATCHERS,
129
+ CODEX_HOOK_BINARY,
130
+ CODEX_HOOK_EVENTS,
131
+ NO_SPOTLIGHT,
132
+ bridgeCache,
133
+ bridgeStub,
104
134
  claudeConfigDir,
105
- codexHome
106
- } from "../chunk-AYWX6M7J.js";
135
+ claudeSettings,
136
+ claudeSettingsLocal,
137
+ codexConfigToml,
138
+ codexHome,
139
+ codexHookPositions,
140
+ codexHooksFeatureDisabled,
141
+ codexHooksJson,
142
+ codexTrustGaps,
143
+ cursorUserHooks,
144
+ geminiSettings,
145
+ hookBinaryNameOf,
146
+ hookExecutableName,
147
+ installedBridgeBundleRoots,
148
+ isBridgeLocator,
149
+ liveBridgeProbe,
150
+ macAppBridgeIsInstalled,
151
+ parseHookArgv,
152
+ parseHookCommand,
153
+ supportedClaudeEvents
154
+ } from "../chunk-JCSJEMTA.js";
107
155
  import {
108
156
  resolveBinary
109
- } from "../chunk-VAZCGOLS.js";
157
+ } from "../chunk-ZCBTCW3T.js";
110
158
  import {
111
159
  getApiKey,
112
160
  getBaseUrl
113
- } from "../chunk-3A7REECH.js";
161
+ } from "../chunk-GKCDMAUM.js";
114
162
  import "../chunk-YU2EUD7O.js";
115
163
  import {
164
+ readRegularJsonFile,
165
+ readRegularTextFile,
116
166
  writeJsonAtomicDurable
117
- } from "../chunk-QENTGE75.js";
167
+ } from "../chunk-T5I4PKOQ.js";
118
168
  import {
119
169
  EXIT
120
170
  } from "../chunk-BG4HHB7E.js";
121
- import "../chunk-YDT6TVGN.js";
171
+ import "../chunk-YDQ6OJMF.js";
122
172
  import "../chunk-ZVU6WMMU.js";
123
173
  import {
124
174
  CLAUDE_INBOX,
@@ -128,8 +178,14 @@ import {
128
178
  CLAUDE_WAKE,
129
179
  CLAUDE_WAKE_API,
130
180
  COMMAND_RECOVERY,
181
+ CURSOR_GATE_EVENTS,
182
+ CURSOR_GATE_SCRIPT,
183
+ HOOK_COMPATIBLE_PROFILES,
184
+ HOOK_WIRING_PROFILE_LENGTH,
185
+ HOOK_WIRING_REPORT_VERSION,
131
186
  NATIVE_INPUT,
132
187
  NativeInputAgent,
188
+ OPENCODE_APPROVAL_EVENT,
133
189
  claudeInboxAction,
134
190
  claudeWakeDecision,
135
191
  claudeWakeWaitingOn,
@@ -139,6 +195,8 @@ import {
139
195
  isCodexInputReceipt,
140
196
  isCodexQueuedReceipt,
141
197
  isCommandAcknowledgementReceipt,
198
+ isRecord,
199
+ matcherMatchesEveryCall,
142
200
  nativeIdentifier,
143
201
  nativeInputAction,
144
202
  nativeRecord,
@@ -148,7 +206,7 @@ import {
148
206
  parseHermesAdmission,
149
207
  parseHermesReplayCursor,
150
208
  qualifyHermesReceiptMode
151
- } from "../chunk-5YVBVJOH.js";
209
+ } from "../chunk-O5TB2LMQ.js";
152
210
  import "../chunk-MLKGABMK.js";
153
211
 
154
212
  // src/native-host-receiver.ts
@@ -236,8 +294,8 @@ var Rpc = class _Rpc {
236
294
  followRedirects: false
237
295
  });
238
296
  const rpc = new _Rpc(socket, timeout);
239
- await new Promise((resolve3, reject) => {
240
- socket.once("open", resolve3);
297
+ await new Promise((resolve4, reject) => {
298
+ socket.once("open", resolve4);
241
299
  socket.once("error", reject);
242
300
  });
243
301
  if (protocols.length && socket.protocol !== protocols[0]) {
@@ -248,12 +306,12 @@ var Rpc = class _Rpc {
248
306
  }
249
307
  request(method, params) {
250
308
  const id = ++this.sequence;
251
- return new Promise((resolve3, reject) => {
309
+ return new Promise((resolve4, reject) => {
252
310
  const timer = setTimeout(() => {
253
311
  this.pending.delete(id);
254
312
  reject(new Error("native RPC timeout"));
255
313
  }, this.timeout);
256
- this.pending.set(id, { resolve: resolve3, reject, timer });
314
+ this.pending.set(id, { resolve: resolve4, reject, timer });
257
315
  this.socket.send(
258
316
  JSON.stringify({ jsonrpc: "2.0", id, method, params }),
259
317
  (error) => {
@@ -274,7 +332,7 @@ var Rpc = class _Rpc {
274
332
  this.socket.terminate();
275
333
  }
276
334
  };
277
- var controlRequest = (path, request, timeout) => new Promise((resolve3, reject) => {
335
+ var controlRequest = (path, request, timeout) => new Promise((resolve4, reject) => {
278
336
  const s = createConnection(path);
279
337
  let buffer = "";
280
338
  const timer = setTimeout(() => {
@@ -295,7 +353,7 @@ var controlRequest = (path, request, timeout) => new Promise((resolve3, reject)
295
353
  }
296
354
  if (!buffer.includes("\n")) return;
297
355
  try {
298
- resolve3(JSON.parse(buffer.slice(0, buffer.indexOf("\n"))));
356
+ resolve4(JSON.parse(buffer.slice(0, buffer.indexOf("\n"))));
299
357
  } catch {
300
358
  reject(new Error("invalid native control response"));
301
359
  }
@@ -1422,9 +1480,376 @@ var startClaudeInboxReceiver = (apiKey, machineId, options = {}) => {
1422
1480
 
1423
1481
  // src/spawn-daemon.ts
1424
1482
  import { execFileSync as execFileSync2, spawn } from "child_process";
1425
- import { existsSync, statSync as statSync2 } from "fs";
1483
+ import { existsSync, statSync as statSync3 } from "fs";
1484
+ import { homedir as homedir4 } from "os";
1485
+ import { basename as basename3, dirname as dirname4, join as join5 } from "path";
1486
+
1487
+ // src/hook-wiring.ts
1488
+ import { createHash as createHash4 } from "crypto";
1489
+ import { realpathSync as realpathSync2, statSync as statSync2 } from "fs";
1426
1490
  import { homedir as homedir3 } from "os";
1427
- import { basename as basename3, dirname as dirname3, join as join5 } from "path";
1491
+ import { dirname as dirname3, isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
1492
+ var HOOK_WIRING_MAX_FILE_BYTES = 16 * 1024 * 1024;
1493
+ var COMMAND_HOOK_TYPE = "command";
1494
+ var CODEX_TRUST_GAPS_THAT_SWITCH_OFF = /* @__PURE__ */ new Set(["disabled", "asynchronous"]);
1495
+ var CODEX_TRUST_GAP_UNTRUSTED = "untrusted";
1496
+ var MATCHER_ALTERNATIVE_SEPARATOR = "|";
1497
+ var SIMPLE_CLAUDE_CODE_MATCHER = /^[a-zA-Z0-9_|]+$/;
1498
+ var TABLE_PATTERN_WILDCARD = ".*";
1499
+ var TABLE_PATTERN_SAMPLE = "probe";
1500
+ var UNRESTRICTED_MATCHER_PROBES = ["Bash", "Write", "Edit", "Read", "apply_patch", "run_shell_command", "mcp__probe__tool", "probe"];
1501
+ var EXECUTE_BITS = 73;
1502
+ var WINDOWS_PLATFORM = "win32";
1503
+ var NO_EVENTS = /* @__PURE__ */ new Set();
1504
+ var NO_HANDLERS = /* @__PURE__ */ new Map();
1505
+ var NO_EARLIER_MATCHERS = {};
1506
+ var approvalEventsOf = (definitions, binaryOf, earlierMatchers = NO_EARLIER_MATCHERS) => definitions.filter((definition) => definition.delivery === "approval").map((definition) => ({
1507
+ event: definition.event,
1508
+ binary: binaryOf(definition),
1509
+ matcher: definition.matcher ?? null,
1510
+ earlierMatchers: earlierMatchers[definition.event] ?? [],
1511
+ cliOnly: definition.cliOnly === true
1512
+ }));
1513
+ var eventsWithBinary = (events, binary) => events.map((event) => ({ event, binary, matcher: null, earlierMatchers: [], cliOnly: false }));
1514
+ var CODEX_APPROVAL_EVENTS = approvalEventsOf(CODEX_HOOK_EVENTS, () => CODEX_HOOK_BINARY, CODEX_EARLIER_APPROVAL_MATCHERS);
1515
+ var hookWiringAgentOf = (target) => {
1516
+ switch (target.kind) {
1517
+ case "claude":
1518
+ return "claude";
1519
+ case "codex":
1520
+ return "codex";
1521
+ case "gemini":
1522
+ return "gemini";
1523
+ case "cursor":
1524
+ return "cursor";
1525
+ case "opencode":
1526
+ return "opencode";
1527
+ case "compatible":
1528
+ return target.profile.source;
1529
+ }
1530
+ };
1531
+ var hookWiringApprovalEvents = (target) => {
1532
+ switch (target.kind) {
1533
+ case "claude":
1534
+ return approvalEventsOf(supportedClaudeEvents(null), (hook) => hook.binary);
1535
+ case "codex":
1536
+ return CODEX_APPROVAL_EVENTS;
1537
+ case "gemini":
1538
+ return approvalEventsOf(GEMINI_HOOK_EVENTS, () => GEMINI_HOOK_BINARY);
1539
+ case "cursor":
1540
+ return eventsWithBinary(CURSOR_GATE_EVENTS, hookBinaryNameOf(CURSOR_GATE_SCRIPT));
1541
+ case "opencode":
1542
+ return eventsWithBinary([OPENCODE_APPROVAL_EVENT], OPENCODE_HOOK_BINARY);
1543
+ case "compatible":
1544
+ return approvalEventsOf(compatibleHookEvents(target.profile), (hook) => hook.binary);
1545
+ }
1546
+ };
1547
+ var configFileOf = (target) => {
1548
+ switch (target.kind) {
1549
+ case "claude":
1550
+ case "gemini":
1551
+ return target.settingsFile;
1552
+ case "opencode":
1553
+ return target.pluginFile;
1554
+ case "codex":
1555
+ case "cursor":
1556
+ case "compatible":
1557
+ return target.hooksFile;
1558
+ }
1559
+ };
1560
+ var hooksKeyPathOf = (target) => target.kind === "compatible" ? target.profile.hooksKeyPath : DEFAULT_HOOKS_KEY_PATH;
1561
+ var handlerTypeOf = (target) => target.kind === "cursor" ? "optional" : "required";
1562
+ var hookWiringProfileOf = (machineId, configFile) => createHash4("sha256").update(`${machineId}\0${resolve3(configFile)}`, "utf8").digest("hex").slice(0, HOOK_WIRING_PROFILE_LENGTH);
1563
+ var requiredApprovalEvents = (events, owner) => events.filter((event) => !(event.cliOnly && owner === "app")).map((event) => event.event);
1564
+ var isSwitchedOff = (reading, required) => reading.switchedOff || reading.trustGaps.some((gap) => CODEX_TRUST_GAPS_THAT_SWITCH_OFF.has(gap.kind) && required.has(gap.event));
1565
+ var isUntrusted = (reading, required) => reading.trustGaps.some((gap) => gap.kind === CODEX_TRUST_GAP_UNTRUSTED && required.has(gap.event));
1566
+ var weakeningOf = (switchedOff, wiring) => {
1567
+ if (switchedOff) return "switched_off";
1568
+ if (wiring.missing.length > 0) return "events_missing";
1569
+ return wiring.narrowed.length > 0 ? "matcher_narrowed" : null;
1570
+ };
1571
+ var guardedStateOf = (reading, required) => isUntrusted(reading, required) ? "untrusted" : "wired";
1572
+ var requiredEventWiringOf = (required, wiredEvents, narrowedEvents) => ({
1573
+ missing: required.filter((event) => !wiredEvents.has(event) && !narrowedEvents.has(event)),
1574
+ narrowed: required.filter((event) => !wiredEvents.has(event) && narrowedEvents.has(event))
1575
+ });
1576
+ var hookWiringOf = (reading) => {
1577
+ if (!reading.configDirExists) return null;
1578
+ const base = { agent: reading.agent, profile: reading.profile };
1579
+ if (reading.hooks.kind === "unreadable") {
1580
+ return { ...base, state: reading.declined ? "disconnected" : "unreadable", owner: null };
1581
+ }
1582
+ const owner = reading.hooks.kind === "read" ? reading.hooks.owner : null;
1583
+ if (reading.declined) return { ...base, state: "disconnected", owner };
1584
+ const required = requiredApprovalEvents(reading.approvalEvents, owner);
1585
+ const wiring = reading.hooks.kind === "read" ? requiredEventWiringOf(required, reading.hooks.wiredEvents, reading.hooks.narrowedEvents) : requiredEventWiringOf(required, NO_EVENTS, NO_EVENTS);
1586
+ if (wiring.missing.length === required.length) return { ...base, state: "missing", owner };
1587
+ const requiredSet = new Set(required);
1588
+ const weakenedBy = weakeningOf(isSwitchedOff(reading, requiredSet), wiring);
1589
+ if (weakenedBy) {
1590
+ return { ...base, state: "weakened", owner, weakenedBy, ...wiring.missing.length > 0 ? { missing: wiring.missing } : {} };
1591
+ }
1592
+ return { ...base, state: guardedStateOf(reading, requiredSet), owner };
1593
+ };
1594
+ var isCommandHandler = (handler, handlerType) => handler.type === COMMAND_HOOK_TYPE || handlerType === "optional" && handler.type === void 0;
1595
+ var handlerOf = (handler, matcher, handlerType) => {
1596
+ if (!isCommandHandler(handler, handlerType) || typeof handler.command !== "string") return [];
1597
+ const command = parseHookCommand(handler.command);
1598
+ return command ? [{ raw: handler.command, command, matcher }] : [];
1599
+ };
1600
+ var handlersInEntry = (entry, handlerType) => {
1601
+ if (!isRecord(entry)) return [];
1602
+ if (!Array.isArray(entry.hooks)) return handlerOf(entry, entry.matcher, handlerType);
1603
+ return entry.hooks.filter(isRecord).flatMap((handler) => handlerOf(handler, entry.matcher, handlerType));
1604
+ };
1605
+ var handlersOnEvent = (entries, handlerType) => Array.isArray(entries) ? entries.flatMap((entry) => handlersInEntry(entry, handlerType)) : [];
1606
+ var handlersByEventIn = (hooks, handlerType) => new Map(isRecord(hooks) ? Object.entries(hooks).map(([event, entries]) => [event, handlersOnEvent(entries, handlerType)]) : []);
1607
+ var matcherAlternatives = (matcher) => matcher.split(MATCHER_ALTERNATIVE_SEPARATOR);
1608
+ var compiledMatcher = (matcher) => {
1609
+ try {
1610
+ return new RegExp(matcher);
1611
+ } catch {
1612
+ return null;
1613
+ }
1614
+ };
1615
+ var regexToolMatch = (matcher) => {
1616
+ const pattern = compiledMatcher(matcher);
1617
+ return (tool) => pattern !== null && pattern.test(tool);
1618
+ };
1619
+ var toolMatchOf = (semantics, matcher) => {
1620
+ if (semantics === "regex" || !SIMPLE_CLAUDE_CODE_MATCHER.test(matcher)) return regexToolMatch(matcher);
1621
+ const names = new Set(matcherAlternatives(matcher));
1622
+ return (tool) => names.has(tool);
1623
+ };
1624
+ var tableToolSamples = (tableMatcher) => matcherAlternatives(tableMatcher).map((alternative) => alternative.replaceAll(TABLE_PATTERN_WILDCARD, TABLE_PATTERN_SAMPLE));
1625
+ var coverageOfSamples = (samples, matches) => {
1626
+ const matched = samples.filter(matches).length;
1627
+ if (matched === samples.length) return "covers";
1628
+ return matched > 0 ? "narrows" : "misses";
1629
+ };
1630
+ var unrestrictedEventCoverage = (matcher, matches, event) => {
1631
+ if (UNRESTRICTED_MATCHER_PROBES.every(matches)) return "covers";
1632
+ return event.earlierMatchers.includes(matcher) ? "narrows" : "misses";
1633
+ };
1634
+ var tableMatcherCoverage = (semantics) => (matcher, event) => {
1635
+ if (matcherMatchesEveryCall(matcher)) return "covers";
1636
+ if (typeof matcher !== "string") return "misses";
1637
+ const matches = toolMatchOf(semantics, matcher);
1638
+ if (event.matcher === null) return unrestrictedEventCoverage(matcher, matches, event);
1639
+ return coverageOfSamples(tableToolSamples(event.matcher), matches);
1640
+ };
1641
+ var matcherSemanticsOf = (target) => target.kind === "codex" || target.kind === "gemini" ? "regex" : "claude_code";
1642
+ var coverageDecidedElsewhere = () => "covers";
1643
+ var runsBinary = (command, binary, context) => {
1644
+ if (!command.runsExecutable) return false;
1645
+ if (isBridgeLocator(command.executable)) return context.isLiveBridge(command.executable);
1646
+ return hookExecutableName(command.executable) === binary && context.isRunnableBinary(command);
1647
+ };
1648
+ var coveredHandlerOf = (handler, event, coverageOf) => {
1649
+ const coverage = coverageOf(handler.matcher, event);
1650
+ return coverage === "misses" ? [] : [{ handler, coverage }];
1651
+ };
1652
+ var approvalHandlersOn = (handlersByEvent, event, context, coverageOf) => ({
1653
+ event,
1654
+ handlers: (handlersByEvent.get(event.event) ?? []).filter((handler) => runsBinary(handler.command, event.binary, context)).flatMap((handler) => coveredHandlerOf(handler, event, coverageOf))
1655
+ });
1656
+ var coversTableMatcher = (approval) => approval.handlers.some((covered) => covered.coverage === "covers");
1657
+ var isBridgeHandler = (handler) => isBridgeLocator(handler.command.executable);
1658
+ var hasLiveBridgeAnywhere = (handlersByEvent, isLiveBridge) => [...handlersByEvent.values()].flat().some((handler) => handler.command.runsExecutable && isBridgeHandler(handler) && isLiveBridge(handler.command.executable));
1659
+ var approvalOwnerOf = (running, liveBridgeAnywhere) => {
1660
+ const covering = running.flatMap((approval) => approval.handlers.filter((covered) => covered.coverage === "covers").map((covered) => covered.handler));
1661
+ if (covering.length > 0) return covering.some(isBridgeHandler) ? "app" : "cli";
1662
+ if (running.some((approval) => approval.handlers.some((covered) => !isBridgeHandler(covered.handler)))) return "cli";
1663
+ return liveBridgeAnywhere ? "app" : null;
1664
+ };
1665
+ var eventNamesOf = (approvals) => new Set(approvals.map((approval) => approval.event.event));
1666
+ var approvalWiringOf = (handlersByEvent, events, context, coverageOf) => {
1667
+ const running = events.map((event) => approvalHandlersOn(handlersByEvent, event, context, coverageOf)).filter((approval) => approval.handlers.length > 0);
1668
+ return {
1669
+ owner: approvalOwnerOf(running, hasLiveBridgeAnywhere(handlersByEvent, context.isLiveBridge)),
1670
+ wiredEvents: eventNamesOf(running.filter(coversTableMatcher)),
1671
+ narrowedEvents: eventNamesOf(running.filter((approval) => !coversTableMatcher(approval)))
1672
+ };
1673
+ };
1674
+ var readJsonDocument = (path) => {
1675
+ const result = readRegularJsonFile(path, HOOK_WIRING_MAX_FILE_BYTES);
1676
+ if (result.kind === "missing") return { kind: "missing" };
1677
+ if (result.kind === "ok" && isRecord(result.value)) return { kind: "read", document: result.value };
1678
+ return { kind: "unreadable" };
1679
+ };
1680
+ var jsonDocumentOrEmpty = (path) => {
1681
+ if (path === null) return {};
1682
+ const reading = readJsonDocument(path);
1683
+ return reading.kind === "read" ? reading.document : {};
1684
+ };
1685
+ var textOrNull = (path) => {
1686
+ const result = readRegularTextFile(path, HOOK_WIRING_MAX_FILE_BYTES);
1687
+ return result.kind === "ok" ? result.value : null;
1688
+ };
1689
+ var tomlDocumentOrEmpty = (path) => {
1690
+ const document = parseConfigDocument(textOrNull(path), "toml");
1691
+ return document.kind === "parsed" ? document.value : {};
1692
+ };
1693
+ var handlersIn = (document, target) => handlersByEventIn(hooksAt(document, hooksKeyPathOf(target)), handlerTypeOf(target));
1694
+ var tableFileReading = (reading, target, context) => reading.kind === "read" ? { kind: "read", ...approvalWiringOf(handlersIn(reading.document, target), hookWiringApprovalEvents(target), context, tableMatcherCoverage(matcherSemanticsOf(target))) } : reading;
1695
+ var cursorFileReading = (target, context) => {
1696
+ const reading = readJsonDocument(target.hooksFile);
1697
+ if (reading.kind !== "read") return reading;
1698
+ const wiring = approvalWiringOf(handlersIn(reading.document, target), hookWiringApprovalEvents(target), context, coverageDecidedElsewhere);
1699
+ const coverage = liveCursorGateCoverage(reading.document, { hooksFile: target.hooksFile, probe: context.probe });
1700
+ const runsPushary = (event) => wiring.wiredEvents.has(event);
1701
+ return {
1702
+ kind: "read",
1703
+ owner: wiring.owner,
1704
+ wiredEvents: new Set(coverage.full.filter(runsPushary)),
1705
+ narrowedEvents: new Set(coverage.partial.filter(runsPushary))
1706
+ };
1707
+ };
1708
+ var openCodeHandlers = (argv) => {
1709
+ const command = parseHookArgv(argv);
1710
+ return command ? /* @__PURE__ */ new Map([[OPENCODE_APPROVAL_EVENT, [{ raw: argv.join(" "), command, matcher: void 0 }]]]) : NO_HANDLERS;
1711
+ };
1712
+ var openCodeFileReading = (target, context) => {
1713
+ const result = readRegularTextFile(target.pluginFile, HOOK_WIRING_MAX_FILE_BYTES);
1714
+ if (result.kind === "missing") return { kind: "missing" };
1715
+ if (result.kind !== "ok") return { kind: "unreadable" };
1716
+ const handlersByEvent = openCodeHandlers(openCodePluginArgv(result.value) ?? []);
1717
+ return { kind: "read", ...approvalWiringOf(handlersByEvent, hookWiringApprovalEvents(target), context, tableMatcherCoverage(matcherSemanticsOf(target))) };
1718
+ };
1719
+ var isDirectory = (path) => {
1720
+ try {
1721
+ return statSync2(path).isDirectory();
1722
+ } catch {
1723
+ return false;
1724
+ }
1725
+ };
1726
+ var claudeHooksSwitchedOff = (user, local, managed) => [user, local, managed].some((settings) => settings.disableAllHooks === true) || managed.allowManagedHooksOnly === true;
1727
+ var codexTrustCommandIn = (document) => {
1728
+ const handlersByEvent = handlersByEventIn(hooksAt(document, DEFAULT_HOOKS_KEY_PATH), "required");
1729
+ const handlers = CODEX_APPROVAL_EVENTS.flatMap((event) => handlersByEvent.get(event.event) ?? []);
1730
+ return handlers.find((handler) => hookExecutableName(handler.command.executable) === CODEX_HOOK_BINARY)?.raw ?? "";
1731
+ };
1732
+ var codexHookTrustGapsIn = (config, document, hooksFile) => codexTrustGaps(config, document, hooksFile, codexTrustCommandIn(document), codexHookPositions(document));
1733
+ var UNSWITCHED = { switchedOff: false, trustGaps: [] };
1734
+ var readClaudeTarget = (target, context) => {
1735
+ const settings = readJsonDocument(target.settingsFile);
1736
+ return {
1737
+ hooks: tableFileReading(settings, target, context),
1738
+ switchedOff: claudeHooksSwitchedOff(
1739
+ settings.kind === "read" ? settings.document : {},
1740
+ jsonDocumentOrEmpty(target.localSettingsFile),
1741
+ jsonDocumentOrEmpty(target.managedSettingsFile)
1742
+ ),
1743
+ trustGaps: []
1744
+ };
1745
+ };
1746
+ var readCodexTarget = (target, context) => {
1747
+ const hooksDocument = readJsonDocument(target.hooksFile);
1748
+ const hooks = tableFileReading(hooksDocument, target, context);
1749
+ if (hooksDocument.kind !== "read") return { hooks, ...UNSWITCHED };
1750
+ const config = tomlDocumentOrEmpty(target.configFile);
1751
+ return {
1752
+ hooks,
1753
+ switchedOff: codexHooksFeatureDisabled(config),
1754
+ trustGaps: codexHookTrustGapsIn(config, hooksDocument.document, target.hooksFile)
1755
+ };
1756
+ };
1757
+ var readAgentSpecific = (target, context) => {
1758
+ switch (target.kind) {
1759
+ case "claude":
1760
+ return readClaudeTarget(target, context);
1761
+ case "codex":
1762
+ return readCodexTarget(target, context);
1763
+ case "opencode":
1764
+ return { hooks: openCodeFileReading(target, context), ...UNSWITCHED };
1765
+ case "cursor":
1766
+ return { hooks: cursorFileReading(target, context), ...UNSWITCHED };
1767
+ case "gemini":
1768
+ case "compatible":
1769
+ return { hooks: tableFileReading(readJsonDocument(configFileOf(target)), target, context), ...UNSWITCHED };
1770
+ }
1771
+ };
1772
+ var readHookWiringTarget = (target, machineId, declined, context) => {
1773
+ const agent = hookWiringAgentOf(target);
1774
+ return {
1775
+ agent,
1776
+ profile: hookWiringProfileOf(machineId, configFileOf(target)),
1777
+ configDirExists: isDirectory(target.configDir),
1778
+ declined: declined.has(agent),
1779
+ approvalEvents: hookWiringApprovalEvents(target),
1780
+ ...readAgentSpecific(target, context)
1781
+ };
1782
+ };
1783
+ var realpathOrNull = (path) => {
1784
+ try {
1785
+ return realpathSync2(path);
1786
+ } catch {
1787
+ return null;
1788
+ }
1789
+ };
1790
+ var canonicalLiveBridge = (location, probe) => {
1791
+ const stub = realpathOrNull(location.stub);
1792
+ if (stub === null || !macAppBridgeIsInstalled(location, probe)) return () => false;
1793
+ return (executable) => isAbsolute2(executable) && isBridgeLocator(executable) && realpathOrNull(executable) === stub;
1794
+ };
1795
+ var regularFileMode = (path) => {
1796
+ try {
1797
+ const stats = statSync2(path);
1798
+ return stats.isFile() ? stats.mode : null;
1799
+ } catch {
1800
+ return null;
1801
+ }
1802
+ };
1803
+ var runnableBinaryCheck = (platform) => (command) => {
1804
+ if (!isAbsolute2(command.executable)) return false;
1805
+ const mode = regularFileMode(command.executable);
1806
+ if (mode === null) return false;
1807
+ return command.runsThroughNode || platform === WINDOWS_PLATFORM || (mode & EXECUTE_BITS) !== 0;
1808
+ };
1809
+ var hookWiringReadContext = (bridge, platform) => {
1810
+ const probe = { ...liveBridgeProbe(), readFile: textOrNull, mdfind: NO_SPOTLIGHT };
1811
+ return { probe, isLiveBridge: canonicalLiveBridge(bridge, probe), isRunnableBinary: runnableBinaryCheck(platform) };
1812
+ };
1813
+ var compatibleConfigDirOf = (profile, hooksFile) => profile.configFile.root === "grok_home" ? grokHome() : dirname3(hooksFile);
1814
+ var compatibleTarget = (profile) => {
1815
+ const hooksFile = compatibleConfigFile(profile);
1816
+ return { kind: "compatible", profile, configDir: compatibleConfigDirOf(profile, hooksFile), hooksFile };
1817
+ };
1818
+ var hookWiringLocations = (platform = process.platform) => ({
1819
+ declinedAgentsFile: declinedAgentsFile(),
1820
+ bridge: { stub: bridgeStub(), cache: bridgeCache(), bundleRoots: installedBridgeBundleRoots(homedir3()) },
1821
+ targets: [
1822
+ {
1823
+ kind: "claude",
1824
+ configDir: claudeConfigDir(),
1825
+ settingsFile: claudeSettings(),
1826
+ localSettingsFile: claudeSettingsLocal(),
1827
+ managedSettingsFile: MANAGED_CLAUDE_SETTINGS_BY_PLATFORM[platform] ?? null
1828
+ },
1829
+ { kind: "codex", configDir: codexHome(), hooksFile: codexHooksJson(), configFile: codexConfigToml() },
1830
+ { kind: "gemini", configDir: dirname3(geminiSettings()), settingsFile: geminiSettings() },
1831
+ { kind: "cursor", configDir: dirname3(cursorUserHooks()), hooksFile: cursorUserHooks() },
1832
+ { kind: "opencode", configDir: openCodeConfigDir(), pluginFile: openCodePluginFile() },
1833
+ ...HOOK_COMPATIBLE_PROFILES.map(compatibleTarget)
1834
+ ]
1835
+ });
1836
+ var readHookWiring = (machineId, locations = hookWiringLocations()) => {
1837
+ const declined = new Set(readDeclinedAgents(locations.declinedAgentsFile));
1838
+ const context = hookWiringReadContext(locations.bridge, process.platform);
1839
+ const agents = locations.targets.flatMap((target) => {
1840
+ const entry = hookWiringOf(readHookWiringTarget(target, machineId, declined, context));
1841
+ return entry ? [entry] : [];
1842
+ });
1843
+ return { version: HOOK_WIRING_REPORT_VERSION, agents };
1844
+ };
1845
+ var readHookWiringSafely = (read, reportFailure) => {
1846
+ try {
1847
+ return read();
1848
+ } catch (error) {
1849
+ reportFailure(error);
1850
+ return null;
1851
+ }
1852
+ };
1428
1853
 
1429
1854
  // src/stop-requests.ts
1430
1855
  var STOP_CAPABILITY = "stop";
@@ -1607,13 +2032,13 @@ var resolveSpawnDirectory = (requested, options = {}) => {
1607
2032
  const fallbackDir = options.fallbackDir ?? process.cwd();
1608
2033
  const value = requested?.trim();
1609
2034
  if (!value) return { ok: true, cwd: fallbackDir };
1610
- const homeDir = options.homeDir ?? homedir3();
2035
+ const homeDir = options.homeDir ?? homedir4();
1611
2036
  const cwd = value === "~" ? homeDir : value.startsWith("~/") || value.startsWith("~\\") ? join5(homeDir, value.slice(2)) : value;
1612
2037
  if (!(options.exists ?? existsSync)(cwd)) {
1613
2038
  return { ok: false, message: `Directory does not exist: ${value}` };
1614
2039
  }
1615
2040
  try {
1616
- if (!(options.isDirectory ?? ((path) => statSync2(path).isDirectory()))(cwd)) {
2041
+ if (!(options.isDirectory ?? ((path) => statSync3(path).isDirectory()))(cwd)) {
1617
2042
  return { ok: false, message: `Not a directory: ${value}` };
1618
2043
  }
1619
2044
  } catch {
@@ -1705,9 +2130,9 @@ var runSpawnDaemon = async () => {
1705
2130
  describedProviders = description;
1706
2131
  });
1707
2132
  describedProviders = describeLaunchableProviders(inventory.current.capabilities);
1708
- const siblingEntry = process.argv[1] ? join5(dirname3(process.argv[1]), "pushary.js") : "";
1709
- const codexBridgeEntry = process.argv[1] ? join5(dirname3(process.argv[1]), "pushary-codex-bridge.js") : "pushary-codex-bridge";
1710
- const geminiBridgeEntry = process.argv[1] ? join5(dirname3(process.argv[1]), "pushary-gemini-bridge.js") : "pushary-gemini-bridge";
2133
+ const siblingEntry = process.argv[1] ? join5(dirname4(process.argv[1]), "pushary.js") : "";
2134
+ const codexBridgeEntry = process.argv[1] ? join5(dirname4(process.argv[1]), "pushary-codex-bridge.js") : "pushary-codex-bridge";
2135
+ const geminiBridgeEntry = process.argv[1] ? join5(dirname4(process.argv[1]), "pushary-gemini-bridge.js") : "pushary-gemini-bridge";
1711
2136
  const spawnDirect = siblingEntry.length > 0 && existsSync(siblingEntry);
1712
2137
  const existing = readDaemonStatus();
1713
2138
  let handoff;
@@ -1807,7 +2232,7 @@ var runSpawnDaemon = async () => {
1807
2232
  if (!plan) {
1808
2233
  return Promise.reject(new Error(FLAG_SHAPED_PROMPT_MESSAGE));
1809
2234
  }
1810
- return new Promise((resolve3, reject) => {
2235
+ return new Promise((resolve4, reject) => {
1811
2236
  try {
1812
2237
  const child = plan.direct ? spawn(plan.command, plan.args, { cwd, detached: true, stdio: "ignore", env }) : spawnClaude(plan.command, plan.args, { cwd, detached: true, stdio: "ignore", env });
1813
2238
  let started = false;
@@ -1837,7 +2262,7 @@ var runSpawnDaemon = async () => {
1837
2262
  }
1838
2263
  child.unref();
1839
2264
  log(`spawn ${req.id}: launched a phone-requested ${plan.agent} session in ${basename3(cwd)} (pid ${child.pid ?? "unknown"})`);
1840
- resolve3(typeof child.pid === "number" ? child.pid : null);
2265
+ resolve4(typeof child.pid === "number" ? child.pid : null);
1841
2266
  });
1842
2267
  } catch (err) {
1843
2268
  reject(err);
@@ -1857,7 +2282,7 @@ var runSpawnDaemon = async () => {
1857
2282
  return launched || ownsLiveProcess(request);
1858
2283
  },
1859
2284
  selfPid: process.pid,
1860
- sleep: (ms) => new Promise((resolve3) => setTimeout(resolve3, ms)),
2285
+ sleep: (ms) => new Promise((resolve4) => setTimeout(resolve4, ms)),
1861
2286
  isAlive: (pid) => {
1862
2287
  try {
1863
2288
  process.kill(pid, 0);
@@ -1915,7 +2340,7 @@ var runSpawnDaemon = async () => {
1915
2340
  completedStops.delete(acknowledgement.stopId);
1916
2341
  break;
1917
2342
  }
1918
- if (attempt < 2) await new Promise((resolve3) => setTimeout(resolve3, 200 * (attempt + 1)));
2343
+ if (attempt < 2) await new Promise((resolve4) => setTimeout(resolve4, 200 * (attempt + 1)));
1919
2344
  }
1920
2345
  }
1921
2346
  async function apply() {
@@ -2086,13 +2511,15 @@ var runSpawnDaemon = async () => {
2086
2511
  return;
2087
2512
  }
2088
2513
  const result = await sendHeartbeat(apiKey, {
2514
+ machineId,
2089
2515
  repoKey: basename3(process.cwd()),
2090
2516
  capabilities: [
2091
2517
  ...launchAdvertisement(inventory.current.capabilities),
2092
2518
  STOP_CAPABILITY,
2093
2519
  STOP_ACK_CAPABILITY
2094
2520
  ],
2095
- autoUpdate: readLocalAutoUpdateReport()
2521
+ autoUpdate: readLocalAutoUpdateReport(),
2522
+ hookWiring: readHookWiringSafely(() => readHookWiring(machineId), (err) => log(`hook wiring could not be read: ${errMsg(err)}`))
2096
2523
  });
2097
2524
  if (result.kind === "ok") {
2098
2525
  daemonLease.recordSuccessfulHeartbeat();
@@ -2118,13 +2545,13 @@ var runSpawnDaemon = async () => {
2118
2545
  log(hasSpawnProvider(inventory.current.capabilities) ? `daemon online (pid ${process.pid}): this machine (${machineId}) can now be sent a new session from your phone. Ctrl-C to stop.` : `daemon online (pid ${process.pid}): no supported Claude, Codex, or Gemini CLI was found, so phone-start is unavailable. Ctrl-C to stop.`);
2119
2546
  timer = setTimeout(tick, 0);
2120
2547
  const signals = daemonSignals();
2121
- await new Promise((resolve3) => {
2548
+ await new Promise((resolve4) => {
2122
2549
  const onSignal = () => finish();
2123
2550
  for (const signal of signals) process.on(signal, onSignal);
2124
2551
  finish = () => {
2125
2552
  teardown();
2126
2553
  for (const signal of signals) process.off(signal, onSignal);
2127
- resolve3();
2554
+ resolve4();
2128
2555
  };
2129
2556
  });
2130
2557
  return 0;