pushary 1.9.103 → 1.9.105

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 (137) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -0
  3. package/dist/{api-3O3GJV3V.js → api-RL5CPDTH.js} +13 -12
  4. package/dist/bin/pushary-audit.d.ts +1 -0
  5. package/dist/bin/pushary-audit.js +263 -0
  6. package/dist/bin/pushary-bell-hook.js +32 -30
  7. package/dist/bin/pushary-bell.js +14 -13
  8. package/dist/bin/pushary-claude.js +42 -41
  9. package/dist/bin/pushary-clean.js +42 -41
  10. package/dist/bin/pushary-codex-bridge.js +25 -24
  11. package/dist/bin/pushary-codex-hook.js +40 -38
  12. package/dist/bin/pushary-codex-session.js +8 -8
  13. package/dist/bin/pushary-codex.js +17 -16
  14. package/dist/bin/pushary-connect.js +33 -32
  15. package/dist/bin/pushary-cowork.js +8 -8
  16. package/dist/bin/pushary-daemon.js +501 -72
  17. package/dist/bin/pushary-disconnect.js +32 -31
  18. package/dist/bin/pushary-display-hook.js +21 -20
  19. package/dist/bin/pushary-doctor.js +63 -61
  20. package/dist/bin/pushary-elicitation-hook.js +32 -30
  21. package/dist/bin/pushary-gemini-bridge.js +16 -15
  22. package/dist/bin/pushary-gemini-hook.js +35 -33
  23. package/dist/bin/pushary-hook.js +38 -35
  24. package/dist/bin/pushary-login.js +27 -26
  25. package/dist/bin/pushary-logout.js +33 -32
  26. package/dist/bin/pushary-mcp.js +14 -13
  27. package/dist/bin/pushary-mode.js +19 -18
  28. package/dist/bin/pushary-notification-hook.js +32 -30
  29. package/dist/bin/pushary-opencode-hook.js +34 -32
  30. package/dist/bin/pushary-permission-denied-hook.js +37 -34
  31. package/dist/bin/pushary-permission-hook.js +38 -35
  32. package/dist/bin/pushary-post-hook.js +32 -30
  33. package/dist/bin/pushary-prompt-hook.js +32 -30
  34. package/dist/bin/pushary-session-end-hook.js +34 -32
  35. package/dist/bin/pushary-session-start-hook.js +42 -40
  36. package/dist/bin/pushary-setup.js +71 -69
  37. package/dist/bin/pushary-stats.js +6 -6
  38. package/dist/bin/pushary-status.js +39 -38
  39. package/dist/bin/pushary-stop-hook.js +32 -30
  40. package/dist/bin/pushary-stopfailure-hook.js +32 -30
  41. package/dist/bin/pushary-suggestions.js +19 -18
  42. package/dist/bin/pushary-transcript-register.js +22 -21
  43. package/dist/bin/pushary-transcripts.js +30 -29
  44. package/dist/bin/pushary-upgrade.js +48 -46
  45. package/dist/bin/pushary-wait.js +19 -18
  46. package/dist/bin/pushary.js +11 -9
  47. package/dist/{chunk-WYJ6QM7K.js → chunk-2HC5ISDW.js} +2 -2
  48. package/dist/{chunk-FF7L4B3W.js → chunk-43PNDDB3.js} +9 -9
  49. package/dist/{chunk-2PR5EP7N.js → chunk-4EMPELDR.js} +4 -4
  50. package/dist/{chunk-3OIUMHHO.js → chunk-4XE3DVF7.js} +2 -2
  51. package/dist/{chunk-EOD3DBIN.js → chunk-5IAW6G3K.js} +3 -3
  52. package/dist/{chunk-QD57EL3I.js → chunk-6DKMZBRK.js} +3 -3
  53. package/dist/{chunk-MP3SEXXJ.js → chunk-76JOLPST.js} +1 -1
  54. package/dist/{chunk-ZXK46QT4.js → chunk-772NHSQB.js} +2 -2
  55. package/dist/{chunk-JUA7MX2V.js → chunk-A37RKFI3.js} +4 -4
  56. package/dist/{chunk-TLERJKSE.js → chunk-ASCQXNCL.js} +1 -1
  57. package/dist/{chunk-WZNLWDSL.js → chunk-ATVZAEM5.js} +7 -7
  58. package/dist/{chunk-WPK2UWDU.js → chunk-B5Q44HKN.js} +2 -2
  59. package/dist/{chunk-HYAQIKYB.js → chunk-B7O4CXFX.js} +6 -6
  60. package/dist/{chunk-KZERVKTD.js → chunk-BG4HHB7E.js} +2 -1
  61. package/dist/{chunk-3Q2X3T3U.js → chunk-CJTJ55DR.js} +1 -1
  62. package/dist/{chunk-SRE6XJ3K.js → chunk-CKWV3T7O.js} +7 -7
  63. package/dist/{chunk-AZSOH2SF.js → chunk-DA57ZI62.js} +2 -2
  64. package/dist/{chunk-WVAJSBI2.js → chunk-DH22FQAS.js} +3 -3
  65. package/dist/{chunk-JPKJBKZE.js → chunk-DIVVLBZZ.js} +9 -9
  66. package/dist/{chunk-KTM2X3XQ.js → chunk-DS672F57.js} +16 -16
  67. package/dist/{chunk-7BIVBOD5.js → chunk-EMSRB2KH.js} +5 -5
  68. package/dist/{chunk-T7G6IIV4.js → chunk-FE5JENEJ.js} +3 -3
  69. package/dist/{chunk-JECH4NJL.js → chunk-FJYUB3ZK.js} +6 -4
  70. package/dist/{chunk-4TVLPGJV.js → chunk-FUTFQSRA.js} +1 -1
  71. package/dist/{chunk-UQWEH7CK.js → chunk-G5HGV6D4.js} +5 -5
  72. package/dist/{chunk-MK2XE66G.js → chunk-GBHP3LML.js} +7 -5
  73. package/dist/{chunk-J6SSLXSU.js → chunk-GESW4OSZ.js} +4 -4
  74. package/dist/{chunk-KOUB4ZLX.js → chunk-GKCDMAUM.js} +1 -1
  75. package/dist/{chunk-VJOMBYY5.js → chunk-GUIS6ASL.js} +1 -1
  76. package/dist/{chunk-KACD6W6J.js → chunk-HH5NNPB5.js} +1 -1
  77. package/dist/{chunk-3ITURBPE.js → chunk-HLYZEZOI.js} +5 -5
  78. package/dist/{chunk-NZQEABRO.js → chunk-HONSMBF2.js} +13 -11
  79. package/dist/{chunk-G7RMOSRX.js → chunk-HXBQTPKC.js} +1 -1
  80. package/dist/{chunk-6N5DQG5F.js → chunk-I3IUS4SR.js} +2 -2
  81. package/dist/{chunk-ZCYLCD6L.js → chunk-IAASPG5B.js} +5 -5
  82. package/dist/{chunk-YETNUPV5.js → chunk-IGO5NDQY.js} +3 -3
  83. package/dist/{chunk-PM34Z5WX.js → chunk-IHQRLJEP.js} +12 -12
  84. package/dist/{chunk-X3HBR57D.js → chunk-J2HIFUAT.js} +7 -7
  85. package/dist/{chunk-7OZOFTTB.js → chunk-J5PUKKCT.js} +10 -9
  86. package/dist/{chunk-O7ITTNDD.js → chunk-JCSJEMTA.js} +210 -60
  87. package/dist/{chunk-AWF5WICI.js → chunk-JDGLNYDZ.js} +2 -2
  88. package/dist/{chunk-UOE26LPT.js → chunk-JLJJRBTD.js} +8 -7
  89. package/dist/{chunk-Z2TX7DVU.js → chunk-KHZCJP7P.js} +15 -13
  90. package/dist/{chunk-5PW25NHB.js → chunk-LK3WA6MK.js} +5 -5
  91. package/dist/{chunk-KLJ2CTT7.js → chunk-LL7SW4RL.js} +4 -4
  92. package/dist/{chunk-4QO267OY.js → chunk-LMDXQIYT.js} +1 -1
  93. package/dist/{chunk-VD6CAELE.js → chunk-MFJHLVIZ.js} +11 -95
  94. package/dist/{chunk-E7WJQBK3.js → chunk-MLLL2ET6.js} +17 -61
  95. package/dist/{chunk-COBOR3ST.js → chunk-NM44KCO6.js} +6 -4
  96. package/dist/{chunk-4FAJQPFY.js → chunk-O5TB2LMQ.js} +338 -0
  97. package/dist/{chunk-AVXG5QB2.js → chunk-OBZQPBUI.js} +5 -5
  98. package/dist/chunk-OINGJICB.js +108 -0
  99. package/dist/{chunk-RMFL62HR.js → chunk-P3H6I656.js} +14 -12
  100. package/dist/{chunk-Y7KRX7U4.js → chunk-P3VVRBBI.js} +1 -1
  101. package/dist/{chunk-V5DV7XZN.js → chunk-PFZCLG55.js} +4 -4
  102. package/dist/{chunk-2S5J5YI2.js → chunk-QCFWJZGT.js} +5 -5
  103. package/dist/{chunk-SA4PCB6N.js → chunk-RKQVMFHN.js} +11 -93
  104. package/dist/{chunk-LURFSDCL.js → chunk-ROVLRXBI.js} +1 -1
  105. package/dist/{chunk-JKOAAIJD.js → chunk-S2TTGX6F.js} +5 -5
  106. package/dist/{chunk-Y3SZVZF6.js → chunk-S75UO75C.js} +2 -2
  107. package/dist/chunk-T5I4PKOQ.js +122 -0
  108. package/dist/{chunk-3K7PB5LI.js → chunk-TXMYET7E.js} +3 -3
  109. package/dist/{chunk-CQ7QE4W2.js → chunk-UUJQK7DJ.js} +1 -1
  110. package/dist/{chunk-SXAZPWL7.js → chunk-UXIUCMFO.js} +8 -6
  111. package/dist/{chunk-JVE4P54I.js → chunk-VCWLGM77.js} +5 -3
  112. package/dist/{chunk-RVSRPDRF.js → chunk-VKTW5WVB.js} +2 -2
  113. package/dist/{chunk-T6TQETDN.js → chunk-WTREXZGS.js} +4 -4
  114. package/dist/chunk-WUIWHGKF.js +56 -0
  115. package/dist/{chunk-IOQ3ZCAE.js → chunk-X3QG5RT5.js} +1 -1
  116. package/dist/{chunk-O5ZKMUTP.js → chunk-X4TZN52V.js} +6 -6
  117. package/dist/{chunk-AHIAB7JQ.js → chunk-XN527J4W.js} +1 -1
  118. package/dist/{chunk-PWGD5EP6.js → chunk-YDQ6OJMF.js} +7 -1
  119. package/dist/{chunk-NMUI3ZWG.js → chunk-YPY4YCIZ.js} +1 -1
  120. package/dist/{chunk-PPY5N2E6.js → chunk-YU2EUD7O.js} +1 -1
  121. package/dist/{chunk-AFGMZZEB.js → chunk-Z5FV7LTD.js} +2 -2
  122. package/dist/{chunk-BQHZRH6S.js → chunk-ZCBTCW3T.js} +26 -110
  123. package/dist/{codex-app-cards-switch-D475JLP5.js → codex-app-cards-switch-FD2ZWLYL.js} +13 -12
  124. package/dist/{codex-desktop-launch-WOPEZMO6.js → codex-desktop-launch-BN5OABPN.js} +1 -1
  125. package/dist/{codex-session-launch-AWWECV2L.js → codex-session-launch-O3PHQWTS.js} +22 -21
  126. package/dist/{config-A5EC37VZ.js → config-KWP7UXYG.js} +3 -3
  127. package/dist/{global-upgrade-V6FA6MUF.js → global-upgrade-NBSY5436.js} +12 -11
  128. package/dist/{identity-BEPQQHNR.js → identity-RP5I7KTV.js} +5 -4
  129. package/dist/{live-capabilities-EAM2QN73.js → live-capabilities-XC6C47ZH.js} +6 -5
  130. package/dist/{paths-2IEEYSHM.js → paths-OE5APZ4Q.js} +8 -3
  131. package/dist/reapply-DRZ32BIB.js +65 -0
  132. package/dist/src/index.js +39 -36
  133. package/dist/{upgrade-lock-DLGVC34L.js → upgrade-lock-LWTVHYAJ.js} +5 -4
  134. package/dist/usage-5YESCANM.js +11 -0
  135. package/package.json +2 -1
  136. package/dist/reapply-LDCMRN6Q.js +0 -64
  137. package/dist/usage-U6H5UFS2.js +0 -11
@@ -1,30 +1,42 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  inspectConfiguredManagedProviders
4
- } from "../chunk-RMFL62HR.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-7OZOFTTB.js";
9
- import "../chunk-RVSRPDRF.js";
15
+ } from "../chunk-J5PUKKCT.js";
16
+ import "../chunk-VKTW5WVB.js";
10
17
  import {
11
18
  readSignedOutDiagnosis
12
- } from "../chunk-ZXK46QT4.js";
19
+ } from "../chunk-772NHSQB.js";
13
20
  import {
14
21
  HERMES_INSTALL_MARKER_FILE,
15
22
  defaultHermesHome,
16
23
  parseHermesInstallMarker
17
- } from "../chunk-COBOR3ST.js";
24
+ } from "../chunk-NM44KCO6.js";
18
25
  import {
19
26
  writeHuman
20
27
  } from "../chunk-QCGNGEGE.js";
21
- import "../chunk-SXAZPWL7.js";
22
- import "../chunk-JECH4NJL.js";
23
- import "../chunk-AZSOH2SF.js";
24
- import "../chunk-PM34Z5WX.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-WPK2UWDU.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-J6SSLXSU.js";
37
- import "../chunk-YETNUPV5.js";
48
+ } from "../chunk-GESW4OSZ.js";
49
+ import "../chunk-IGO5NDQY.js";
38
50
  import {
39
51
  SESSION_REAP_SILENCE_MS,
40
52
  describeIdleWindow,
@@ -42,17 +54,29 @@ import {
42
54
  listProcessProofs,
43
55
  ownsLiveProcess,
44
56
  silentSpawnedProofs
45
- } from "../chunk-T7G6IIV4.js";
46
- import "../chunk-LURFSDCL.js";
57
+ } from "../chunk-FE5JENEJ.js";
58
+ import "../chunk-ROVLRXBI.js";
47
59
  import {
48
60
  readLocalAutoUpdateReport
49
- } from "../chunk-EOD3DBIN.js";
61
+ } from "../chunk-5IAW6G3K.js";
62
+ import {
63
+ liveCursorGateCoverage
64
+ } from "../chunk-OINGJICB.js";
50
65
  import {
51
66
  startRegisteredTranscripts
52
- } from "../chunk-KTM2X3XQ.js";
53
- import "../chunk-G7RMOSRX.js";
67
+ } from "../chunk-DS672F57.js";
68
+ import "../chunk-HXBQTPKC.js";
54
69
  import "../chunk-G66WIAST.js";
55
- import "../chunk-UOE26LPT.js";
70
+ import {
71
+ compatibleConfigFile,
72
+ compatibleHookEvents,
73
+ grokHome,
74
+ parseConfigDocument
75
+ } from "../chunk-JLJJRBTD.js";
76
+ import {
77
+ pendingCommandReceipts,
78
+ removePendingCommand
79
+ } from "../chunk-KHZCJP7P.js";
56
80
  import {
57
81
  DAEMON_LEASE_RENEW_INTERVAL_MS,
58
82
  acquireDaemonLease,
@@ -69,54 +93,82 @@ import {
69
93
  requestDaemonHandoff,
70
94
  stopDaemonRunning,
71
95
  writeDaemonNeedsLogin
72
- } from "../chunk-NZQEABRO.js";
96
+ } from "../chunk-HONSMBF2.js";
73
97
  import {
74
- hookOwnerOf
75
- } from "../chunk-VD6CAELE.js";
76
- import "../chunk-WVAJSBI2.js";
77
- import "../chunk-VJOMBYY5.js";
78
- import "../chunk-NMUI3ZWG.js";
79
- import "../chunk-3OIUMHHO.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";
107
+ import "../chunk-YPY4YCIZ.js";
108
+ import "../chunk-4XE3DVF7.js";
80
109
  import "../chunk-XMSDA5WA.js";
81
- import "../chunk-3Q2X3T3U.js";
110
+ import "../chunk-CJTJ55DR.js";
111
+ import "../chunk-LMDXQIYT.js";
112
+ import "../chunk-IAASPG5B.js";
113
+ import "../chunk-POFBE6ZY.js";
114
+ import "../chunk-PFZCLG55.js";
115
+ import "../chunk-EMSRB2KH.js";
116
+ import "../chunk-LL7SW4RL.js";
82
117
  import {
83
118
  spawnClaude
84
119
  } from "../chunk-XHKBHWLX.js";
85
- import {
86
- readControlMode
87
- } from "../chunk-HYAQIKYB.js";
88
- import {
89
- pendingCommandReceipts,
90
- removePendingCommand
91
- } from "../chunk-Z2TX7DVU.js";
92
- import "../chunk-MP3SEXXJ.js";
93
- import "../chunk-4QO267OY.js";
94
- import "../chunk-ZCYLCD6L.js";
95
- import "../chunk-POFBE6ZY.js";
96
- import "../chunk-V5DV7XZN.js";
97
- import "../chunk-7BIVBOD5.js";
98
- import "../chunk-KLJ2CTT7.js";
99
120
  import {
100
121
  getMachineId
101
- } from "../chunk-6N5DQG5F.js";
102
- import "../chunk-AFGMZZEB.js";
122
+ } from "../chunk-I3IUS4SR.js";
123
+ import {
124
+ readControlMode
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-O7ITTNDD.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
- resolveBinary,
109
- writeJsonAtomicDurable
110
- } from "../chunk-BQHZRH6S.js";
156
+ resolveBinary
157
+ } from "../chunk-ZCBTCW3T.js";
111
158
  import {
112
159
  getApiKey,
113
160
  getBaseUrl
114
- } from "../chunk-KOUB4ZLX.js";
115
- import "../chunk-PPY5N2E6.js";
161
+ } from "../chunk-GKCDMAUM.js";
162
+ import "../chunk-YU2EUD7O.js";
163
+ import {
164
+ readRegularJsonFile,
165
+ readRegularTextFile,
166
+ writeJsonAtomicDurable
167
+ } from "../chunk-T5I4PKOQ.js";
116
168
  import {
117
169
  EXIT
118
- } from "../chunk-KZERVKTD.js";
119
- import "../chunk-PWGD5EP6.js";
170
+ } from "../chunk-BG4HHB7E.js";
171
+ import "../chunk-YDQ6OJMF.js";
120
172
  import "../chunk-ZVU6WMMU.js";
121
173
  import {
122
174
  CLAUDE_INBOX,
@@ -126,8 +178,14 @@ import {
126
178
  CLAUDE_WAKE,
127
179
  CLAUDE_WAKE_API,
128
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,
129
186
  NATIVE_INPUT,
130
187
  NativeInputAgent,
188
+ OPENCODE_APPROVAL_EVENT,
131
189
  claudeInboxAction,
132
190
  claudeWakeDecision,
133
191
  claudeWakeWaitingOn,
@@ -137,6 +195,8 @@ import {
137
195
  isCodexInputReceipt,
138
196
  isCodexQueuedReceipt,
139
197
  isCommandAcknowledgementReceipt,
198
+ isRecord,
199
+ matcherMatchesEveryCall,
140
200
  nativeIdentifier,
141
201
  nativeInputAction,
142
202
  nativeRecord,
@@ -146,7 +206,7 @@ import {
146
206
  parseHermesAdmission,
147
207
  parseHermesReplayCursor,
148
208
  qualifyHermesReceiptMode
149
- } from "../chunk-4FAJQPFY.js";
209
+ } from "../chunk-O5TB2LMQ.js";
150
210
  import "../chunk-MLKGABMK.js";
151
211
 
152
212
  // src/native-host-receiver.ts
@@ -234,8 +294,8 @@ var Rpc = class _Rpc {
234
294
  followRedirects: false
235
295
  });
236
296
  const rpc = new _Rpc(socket, timeout);
237
- await new Promise((resolve3, reject) => {
238
- socket.once("open", resolve3);
297
+ await new Promise((resolve4, reject) => {
298
+ socket.once("open", resolve4);
239
299
  socket.once("error", reject);
240
300
  });
241
301
  if (protocols.length && socket.protocol !== protocols[0]) {
@@ -246,12 +306,12 @@ var Rpc = class _Rpc {
246
306
  }
247
307
  request(method, params) {
248
308
  const id = ++this.sequence;
249
- return new Promise((resolve3, reject) => {
309
+ return new Promise((resolve4, reject) => {
250
310
  const timer = setTimeout(() => {
251
311
  this.pending.delete(id);
252
312
  reject(new Error("native RPC timeout"));
253
313
  }, this.timeout);
254
- this.pending.set(id, { resolve: resolve3, reject, timer });
314
+ this.pending.set(id, { resolve: resolve4, reject, timer });
255
315
  this.socket.send(
256
316
  JSON.stringify({ jsonrpc: "2.0", id, method, params }),
257
317
  (error) => {
@@ -272,7 +332,7 @@ var Rpc = class _Rpc {
272
332
  this.socket.terminate();
273
333
  }
274
334
  };
275
- var controlRequest = (path, request, timeout) => new Promise((resolve3, reject) => {
335
+ var controlRequest = (path, request, timeout) => new Promise((resolve4, reject) => {
276
336
  const s = createConnection(path);
277
337
  let buffer = "";
278
338
  const timer = setTimeout(() => {
@@ -293,7 +353,7 @@ var controlRequest = (path, request, timeout) => new Promise((resolve3, reject)
293
353
  }
294
354
  if (!buffer.includes("\n")) return;
295
355
  try {
296
- resolve3(JSON.parse(buffer.slice(0, buffer.indexOf("\n"))));
356
+ resolve4(JSON.parse(buffer.slice(0, buffer.indexOf("\n"))));
297
357
  } catch {
298
358
  reject(new Error("invalid native control response"));
299
359
  }
@@ -1420,9 +1480,376 @@ var startClaudeInboxReceiver = (apiKey, machineId, options = {}) => {
1420
1480
 
1421
1481
  // src/spawn-daemon.ts
1422
1482
  import { execFileSync as execFileSync2, spawn } from "child_process";
1423
- 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";
1424
1490
  import { homedir as homedir3 } from "os";
1425
- 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
+ };
1426
1853
 
1427
1854
  // src/stop-requests.ts
1428
1855
  var STOP_CAPABILITY = "stop";
@@ -1605,13 +2032,13 @@ var resolveSpawnDirectory = (requested, options = {}) => {
1605
2032
  const fallbackDir = options.fallbackDir ?? process.cwd();
1606
2033
  const value = requested?.trim();
1607
2034
  if (!value) return { ok: true, cwd: fallbackDir };
1608
- const homeDir = options.homeDir ?? homedir3();
2035
+ const homeDir = options.homeDir ?? homedir4();
1609
2036
  const cwd = value === "~" ? homeDir : value.startsWith("~/") || value.startsWith("~\\") ? join5(homeDir, value.slice(2)) : value;
1610
2037
  if (!(options.exists ?? existsSync)(cwd)) {
1611
2038
  return { ok: false, message: `Directory does not exist: ${value}` };
1612
2039
  }
1613
2040
  try {
1614
- if (!(options.isDirectory ?? ((path) => statSync2(path).isDirectory()))(cwd)) {
2041
+ if (!(options.isDirectory ?? ((path) => statSync3(path).isDirectory()))(cwd)) {
1615
2042
  return { ok: false, message: `Not a directory: ${value}` };
1616
2043
  }
1617
2044
  } catch {
@@ -1703,9 +2130,9 @@ var runSpawnDaemon = async () => {
1703
2130
  describedProviders = description;
1704
2131
  });
1705
2132
  describedProviders = describeLaunchableProviders(inventory.current.capabilities);
1706
- const siblingEntry = process.argv[1] ? join5(dirname3(process.argv[1]), "pushary.js") : "";
1707
- const codexBridgeEntry = process.argv[1] ? join5(dirname3(process.argv[1]), "pushary-codex-bridge.js") : "pushary-codex-bridge";
1708
- 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";
1709
2136
  const spawnDirect = siblingEntry.length > 0 && existsSync(siblingEntry);
1710
2137
  const existing = readDaemonStatus();
1711
2138
  let handoff;
@@ -1805,7 +2232,7 @@ var runSpawnDaemon = async () => {
1805
2232
  if (!plan) {
1806
2233
  return Promise.reject(new Error(FLAG_SHAPED_PROMPT_MESSAGE));
1807
2234
  }
1808
- return new Promise((resolve3, reject) => {
2235
+ return new Promise((resolve4, reject) => {
1809
2236
  try {
1810
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 });
1811
2238
  let started = false;
@@ -1835,7 +2262,7 @@ var runSpawnDaemon = async () => {
1835
2262
  }
1836
2263
  child.unref();
1837
2264
  log(`spawn ${req.id}: launched a phone-requested ${plan.agent} session in ${basename3(cwd)} (pid ${child.pid ?? "unknown"})`);
1838
- resolve3(typeof child.pid === "number" ? child.pid : null);
2265
+ resolve4(typeof child.pid === "number" ? child.pid : null);
1839
2266
  });
1840
2267
  } catch (err) {
1841
2268
  reject(err);
@@ -1855,7 +2282,7 @@ var runSpawnDaemon = async () => {
1855
2282
  return launched || ownsLiveProcess(request);
1856
2283
  },
1857
2284
  selfPid: process.pid,
1858
- sleep: (ms) => new Promise((resolve3) => setTimeout(resolve3, ms)),
2285
+ sleep: (ms) => new Promise((resolve4) => setTimeout(resolve4, ms)),
1859
2286
  isAlive: (pid) => {
1860
2287
  try {
1861
2288
  process.kill(pid, 0);
@@ -1913,7 +2340,7 @@ var runSpawnDaemon = async () => {
1913
2340
  completedStops.delete(acknowledgement.stopId);
1914
2341
  break;
1915
2342
  }
1916
- 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)));
1917
2344
  }
1918
2345
  }
1919
2346
  async function apply() {
@@ -2084,13 +2511,15 @@ var runSpawnDaemon = async () => {
2084
2511
  return;
2085
2512
  }
2086
2513
  const result = await sendHeartbeat(apiKey, {
2514
+ machineId,
2087
2515
  repoKey: basename3(process.cwd()),
2088
2516
  capabilities: [
2089
2517
  ...launchAdvertisement(inventory.current.capabilities),
2090
2518
  STOP_CAPABILITY,
2091
2519
  STOP_ACK_CAPABILITY
2092
2520
  ],
2093
- autoUpdate: readLocalAutoUpdateReport()
2521
+ autoUpdate: readLocalAutoUpdateReport(),
2522
+ hookWiring: readHookWiringSafely(() => readHookWiring(machineId), (err) => log(`hook wiring could not be read: ${errMsg(err)}`))
2094
2523
  });
2095
2524
  if (result.kind === "ok") {
2096
2525
  daemonLease.recordSuccessfulHeartbeat();
@@ -2116,13 +2545,13 @@ var runSpawnDaemon = async () => {
2116
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.`);
2117
2546
  timer = setTimeout(tick, 0);
2118
2547
  const signals = daemonSignals();
2119
- await new Promise((resolve3) => {
2548
+ await new Promise((resolve4) => {
2120
2549
  const onSignal = () => finish();
2121
2550
  for (const signal of signals) process.on(signal, onSignal);
2122
2551
  finish = () => {
2123
2552
  teardown();
2124
2553
  for (const signal of signals) process.off(signal, onSignal);
2125
- resolve3();
2554
+ resolve4();
2126
2555
  };
2127
2556
  });
2128
2557
  return 0;