@pushary/agent-hooks 1.9.157 → 1.9.161

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 (147) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -0
  3. package/dist/{api-3C62HQDC.js → api-WHTSBK74.js} +15 -13
  4. package/dist/bin/pushary-audit.js +7 -7
  5. package/dist/bin/pushary-bell-hook.js +31 -31
  6. package/dist/bin/pushary-bell.js +16 -16
  7. package/dist/bin/pushary-calls.d.ts +1 -0
  8. package/dist/bin/pushary-calls.js +287 -0
  9. package/dist/bin/pushary-claude.js +37 -37
  10. package/dist/bin/pushary-clean.js +47 -45
  11. package/dist/bin/pushary-codex-bridge.js +27 -27
  12. package/dist/bin/pushary-codex-hook.js +61 -51
  13. package/dist/bin/pushary-codex-session.js +8 -8
  14. package/dist/bin/pushary-codex.js +19 -19
  15. package/dist/bin/pushary-connect.js +41 -40
  16. package/dist/bin/pushary-cowork.js +6 -6
  17. package/dist/bin/pushary-daemon.js +52 -51
  18. package/dist/bin/pushary-disconnect.js +39 -37
  19. package/dist/bin/pushary-display-hook.js +20 -1
  20. package/dist/bin/pushary-doctor.js +61 -59
  21. package/dist/bin/pushary-elicitation-hook.js +32 -32
  22. package/dist/bin/pushary-gemini-bridge.js +19 -19
  23. package/dist/bin/pushary-gemini-hook.js +36 -36
  24. package/dist/bin/pushary-hook.js +39 -38
  25. package/dist/bin/pushary-login.js +28 -28
  26. package/dist/bin/pushary-logout.js +34 -33
  27. package/dist/bin/pushary-mcp.js +15 -15
  28. package/dist/bin/pushary-mode.js +21 -21
  29. package/dist/bin/pushary-notification-hook.js +30 -30
  30. package/dist/bin/pushary-opencode-hook.js +399 -45
  31. package/dist/bin/pushary-permission-denied-hook.js +39 -38
  32. package/dist/bin/pushary-permission-hook.js +39 -38
  33. package/dist/bin/pushary-post-hook.js +31 -31
  34. package/dist/bin/pushary-prompt-hook.js +30 -30
  35. package/dist/bin/pushary-session-end-hook.js +30 -30
  36. package/dist/bin/pushary-session-start-hook.js +41 -40
  37. package/dist/bin/pushary-setup.js +73 -72
  38. package/dist/bin/pushary-stats.js +6 -6
  39. package/dist/bin/pushary-status.js +40 -39
  40. package/dist/bin/pushary-stop-hook.js +30 -30
  41. package/dist/bin/pushary-stopfailure-hook.js +30 -30
  42. package/dist/bin/pushary-suggestions.js +21 -21
  43. package/dist/bin/pushary-transcript-register.js +21 -21
  44. package/dist/bin/pushary-transcripts.js +32 -32
  45. package/dist/bin/pushary-upgrade.js +50 -49
  46. package/dist/bin/pushary-wait.js +23 -23
  47. package/dist/bin/pushary.js +10 -9
  48. package/dist/{chunk-2SHPCEH6.js → chunk-26GVUJMR.js} +5 -2
  49. package/dist/{chunk-UAYNQ2IG.js → chunk-2ABUBECK.js} +6 -6
  50. package/dist/{chunk-6NRFAP45.js → chunk-2PY5DJTC.js} +1 -1
  51. package/dist/{chunk-RF7HGOBC.js → chunk-3F6HE5AK.js} +3 -3
  52. package/dist/{chunk-5MWNWCCI.js → chunk-4ZNZS6FM.js} +8 -5
  53. package/dist/{chunk-KB7YWU7A.js → chunk-55AHQF63.js} +110 -0
  54. package/dist/{chunk-3XTH6EKH.js → chunk-5S66DHJS.js} +3 -3
  55. package/dist/{chunk-CHI57HS3.js → chunk-5UBV26GO.js} +3 -3
  56. package/dist/{chunk-V4OIPLSC.js → chunk-6NWESDKK.js} +4 -4
  57. package/dist/{chunk-RF35YTIF.js → chunk-6OSE2IRG.js} +2 -2
  58. package/dist/{chunk-G6SQOGSD.js → chunk-7AQTKVA6.js} +12 -7
  59. package/dist/{chunk-ANL74IBU.js → chunk-7IHVTLHK.js} +1 -1
  60. package/dist/{chunk-3EF7G5EV.js → chunk-7VXHWU7A.js} +4 -4
  61. package/dist/{chunk-MH4O453X.js → chunk-7WLKE7QN.js} +4 -3
  62. package/dist/{chunk-3UYTCDDY.js → chunk-ANYLSZN3.js} +24 -9
  63. package/dist/{chunk-GA5T3WEB.js → chunk-AT5ZLKMQ.js} +5 -5
  64. package/dist/{chunk-HXX4EFK3.js → chunk-ATI5XO3E.js} +4 -4
  65. package/dist/{chunk-TIOQ55VZ.js → chunk-AVGYUZVK.js} +6 -6
  66. package/dist/{chunk-6UGVZTRA.js → chunk-AVRRD6AY.js} +1 -1
  67. package/dist/{chunk-WCVANKUD.js → chunk-BGU56XCS.js} +1 -1
  68. package/dist/{chunk-DDSMTD4W.js → chunk-BTYHDCAP.js} +3 -3
  69. package/dist/{chunk-IQWMRFKD.js → chunk-DHUWAUVL.js} +1 -1
  70. package/dist/{chunk-W2GOSAFI.js → chunk-DHX5JZSH.js} +4 -4
  71. package/dist/{chunk-KOBIBSE6.js → chunk-DLZ6RK2P.js} +3 -3
  72. package/dist/{chunk-TWOSBIAW.js → chunk-DWMQZM52.js} +1 -1
  73. package/dist/{chunk-WDU4LEEW.js → chunk-E7K6YCWY.js} +6 -6
  74. package/dist/{chunk-7JAEIKBV.js → chunk-EGEZKJHX.js} +5 -5
  75. package/dist/{chunk-VRLYEBDN.js → chunk-F5NJUDGA.js} +78 -50
  76. package/dist/{chunk-ELF4NIIM.js → chunk-FZCEPG6J.js} +2 -2
  77. package/dist/{chunk-KURQ4KMV.js → chunk-G44FOBHN.js} +4 -4
  78. package/dist/{chunk-S6DJAYQW.js → chunk-GJA3KQ3T.js} +5 -5
  79. package/dist/{chunk-WIOLCW7W.js → chunk-GNHXDRO6.js} +1 -1
  80. package/dist/{chunk-C3HYWUZE.js → chunk-HHNC6FWO.js} +1 -1
  81. package/dist/{chunk-E2KAAKWU.js → chunk-HKCJZGAJ.js} +6 -6
  82. package/dist/{chunk-7HDQUTRK.js → chunk-HKI4RMZF.js} +8 -7
  83. package/dist/{chunk-C4K4KYOY.js → chunk-I5HXAELM.js} +5 -5
  84. package/dist/{chunk-MGT2V2AB.js → chunk-IGSSDODQ.js} +2 -2
  85. package/dist/{chunk-ICHKAH5Q.js → chunk-IHYKSPWH.js} +85 -8
  86. package/dist/chunk-J36DDPJV.js +18 -0
  87. package/dist/{chunk-QONYKXWP.js → chunk-KDHLOPSO.js} +1 -1
  88. package/dist/{chunk-O3NAHPCR.js → chunk-KKDKPWGM.js} +1 -1
  89. package/dist/{chunk-REUFDG7O.js → chunk-L2ADRR62.js} +5 -5
  90. package/dist/{chunk-F6ZBXV4G.js → chunk-LRTRIDOC.js} +1 -1
  91. package/dist/{chunk-4I4HAPT5.js → chunk-LVGRSC44.js} +5 -5
  92. package/dist/{chunk-UH5NAPWL.js → chunk-MGOBIHXH.js} +10 -10
  93. package/dist/{chunk-CV6G4IDZ.js → chunk-MPYQW4IV.js} +2 -2
  94. package/dist/{chunk-QBDCKECQ.js → chunk-N4OKAE65.js} +120 -32
  95. package/dist/{chunk-EQF6SSQL.js → chunk-ONMAG5BF.js} +2 -2
  96. package/dist/{chunk-CAZ5FMWP.js → chunk-OOODAKCC.js} +6 -6
  97. package/dist/chunk-OQAIMSHQ.js +885 -0
  98. package/dist/{chunk-MOX7IOGL.js → chunk-OSCZ4MNE.js} +7 -7
  99. package/dist/{chunk-6W6MZ53D.js → chunk-OXZ75E2Y.js} +4 -4
  100. package/dist/{chunk-O2DJWDVK.js → chunk-OZK75SFS.js} +11 -9
  101. package/dist/{chunk-WSPDIT2B.js → chunk-PXLWR4TG.js} +2 -2
  102. package/dist/{chunk-UJJ2OXFA.js → chunk-QLEFFGCN.js} +1 -1
  103. package/dist/{chunk-T3LSBTWU.js → chunk-R7NAG65X.js} +4 -4
  104. package/dist/{chunk-WDCS3RGI.js → chunk-R7RN3Z2T.js} +2 -2
  105. package/dist/{chunk-P5JV6YZW.js → chunk-RZBCXPOV.js} +14 -3
  106. package/dist/{chunk-JBF6A2X5.js → chunk-S6ARXVVZ.js} +1 -1
  107. package/dist/{chunk-R4DMHIOK.js → chunk-TYB2QGJD.js} +6 -6
  108. package/dist/{chunk-C74JHUD3.js → chunk-U36COV3Z.js} +11 -11
  109. package/dist/{chunk-PKU3WFT5.js → chunk-U3FVVMB3.js} +1 -1
  110. package/dist/{chunk-3FQJYA76.js → chunk-UH7GJHOO.js} +3 -3
  111. package/dist/chunk-UJT32RSQ.js +242 -0
  112. package/dist/{chunk-WIIMW5YO.js → chunk-UQTQ6HPO.js} +2 -0
  113. package/dist/{chunk-WWDWEVGT.js → chunk-UZTGEACF.js} +5 -5
  114. package/dist/{chunk-4RSJZOKB.js → chunk-VIS3EVRH.js} +1 -1
  115. package/dist/{chunk-5HMVXNFU.js → chunk-VYNC7EYV.js} +2 -2
  116. package/dist/{chunk-MEUAK5BK.js → chunk-W6FCSBTM.js} +2 -2
  117. package/dist/{chunk-PMEDJ4WM.js → chunk-WAFJGQSE.js} +39 -8
  118. package/dist/{chunk-25PVMWSM.js → chunk-WCXVPYSD.js} +1 -1
  119. package/dist/{chunk-5TCLBCUO.js → chunk-WNIDBPT2.js} +8 -8
  120. package/dist/{chunk-2NSPZZBJ.js → chunk-WTWBHE2Y.js} +42 -34
  121. package/dist/{chunk-UOVTXOSS.js → chunk-XWCLKWKP.js} +1 -1
  122. package/dist/{chunk-2LTRA6NA.js → chunk-Y23YO46U.js} +3 -3
  123. package/dist/{chunk-2N23JFER.js → chunk-Y553AEQU.js} +3 -3
  124. package/dist/{chunk-H6CL3T2S.js → chunk-Y6ILCLKE.js} +1 -1
  125. package/dist/{chunk-AKUYCHJU.js → chunk-YD45WNVQ.js} +1 -1
  126. package/dist/{chunk-44FDCO7M.js → chunk-YEB7YWW7.js} +13 -13
  127. package/dist/{chunk-BMR66K6T.js → chunk-YGHHDDIM.js} +4 -4
  128. package/dist/{chunk-KRI7BOND.js → chunk-Z5DOTAFI.js} +3 -3
  129. package/dist/{chunk-XHPTW6WL.js → chunk-ZIKSHD5M.js} +5 -3
  130. package/dist/{codex-app-cards-switch-MQIEZLSU.js → codex-app-cards-switch-DPCGWQSX.js} +14 -14
  131. package/dist/{codex-card-routing-UTWTJ6YQ.js → codex-card-routing-NFIEH66Q.js} +2 -2
  132. package/dist/{codex-desktop-launch-A6GX6F54.js → codex-desktop-launch-MARNBY23.js} +1 -1
  133. package/dist/{codex-session-launch-AVEFGOT7.js → codex-session-launch-LSNU7CUV.js} +23 -23
  134. package/dist/{config-YGUXX5GB.js → config-5D34OAYM.js} +4 -4
  135. package/dist/{global-upgrade-HLXPTFDU.js → global-upgrade-5XBO6FYU.js} +11 -11
  136. package/dist/{identity-CAC763RQ.js → identity-6QEFK7PW.js} +5 -5
  137. package/dist/{live-capabilities-WRI22INV.js → live-capabilities-6KOGY6KM.js} +5 -5
  138. package/dist/{paths-DNXBDJJH.js → paths-7M6V62NO.js} +4 -4
  139. package/dist/reapply-ZECM5JRX.js +69 -0
  140. package/dist/src/index.d.ts +6 -1
  141. package/dist/src/index.js +39 -38
  142. package/dist/{upgrade-lock-CRW26OIW.js → upgrade-lock-DI4JY2CU.js} +5 -5
  143. package/dist/usage-X4BIHYR5.js +11 -0
  144. package/package.json +2 -1
  145. package/dist/chunk-BO4HRAY7.js +0 -593
  146. package/dist/reapply-5ZNMLEKV.js +0 -68
  147. package/dist/usage-AWWCZ7H7.js +0 -11
@@ -1,20 +1,20 @@
1
+ import {
2
+ fetchAsCredential
3
+ } from "./chunk-DWMQZM52.js";
1
4
  import {
2
5
  keyCheckFromResponse
3
- } from "./chunk-C4K4KYOY.js";
6
+ } from "./chunk-I5HXAELM.js";
4
7
  import {
5
8
  installNetworkDefaults
6
- } from "./chunk-E2KAAKWU.js";
7
- import {
8
- fetchAsCredential
9
- } from "./chunk-TWOSBIAW.js";
9
+ } from "./chunk-HKCJZGAJ.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-ANL74IBU.js";
12
+ } from "./chunk-7IHVTLHK.js";
13
13
  import {
14
14
  isRecord,
15
15
  isToolErrorResult,
16
16
  toolFailureCodeOfResult
17
- } from "./chunk-KB7YWU7A.js";
17
+ } from "./chunk-55AHQF63.js";
18
18
 
19
19
  // src/retry.ts
20
20
  var isRetryable = (err) => {
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  macAppBridgeAvailable
3
- } from "./chunk-BO4HRAY7.js";
3
+ } from "./chunk-UJT32RSQ.js";
4
4
  import {
5
5
  keyPrefix
6
- } from "./chunk-2LTRA6NA.js";
6
+ } from "./chunk-Y23YO46U.js";
7
7
  import {
8
8
  bridgeAgentKey
9
- } from "./chunk-MH4O453X.js";
9
+ } from "./chunk-7WLKE7QN.js";
10
10
  import {
11
11
  readJsonSafe
12
12
  } from "./chunk-TODDEIYG.js";
13
13
  import {
14
14
  isRecord,
15
15
  isValidApiKey
16
- } from "./chunk-KB7YWU7A.js";
16
+ } from "./chunk-55AHQF63.js";
17
17
 
18
18
  // src/shared-mcp-key.ts
19
19
  var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -1,31 +1,33 @@
1
1
  import {
2
2
  MANAGED_CLAUDE_SETTINGS_BY_PLATFORM
3
- } from "./chunk-WSPDIT2B.js";
3
+ } from "./chunk-PXLWR4TG.js";
4
4
  import {
5
5
  declinedAgentsFile,
6
6
  readDeclinedAgents
7
- } from "./chunk-WDCS3RGI.js";
7
+ } from "./chunk-R7RN3Z2T.js";
8
8
  import {
9
9
  OPENCODE_HOOK_BINARY,
10
10
  openCodeConfigDir,
11
- openCodePluginArgv,
12
11
  openCodePluginFile
13
- } from "./chunk-BO4HRAY7.js";
12
+ } from "./chunk-UJT32RSQ.js";
13
+ import {
14
+ openCodePluginArgv
15
+ } from "./chunk-OQAIMSHQ.js";
14
16
  import {
15
17
  liveCursorGateCoverage
16
- } from "./chunk-3EF7G5EV.js";
18
+ } from "./chunk-7VXHWU7A.js";
17
19
  import {
18
20
  compatibleConfigFile,
19
21
  compatibleHookEvents,
20
22
  grokHome,
21
23
  parseConfigDocument
22
- } from "./chunk-4I4HAPT5.js";
24
+ } from "./chunk-LVGRSC44.js";
23
25
  import {
24
26
  DEFAULT_HOOKS_KEY_PATH,
25
27
  GEMINI_HOOK_BINARY,
26
28
  GEMINI_HOOK_EVENTS,
27
29
  hooksAt
28
- } from "./chunk-BMR66K6T.js";
30
+ } from "./chunk-YGHHDDIM.js";
29
31
  import {
30
32
  CODEX_EARLIER_APPROVAL_MATCHERS,
31
33
  CODEX_HOOK_BINARY,
@@ -53,7 +55,7 @@ import {
53
55
  parseHookArgv,
54
56
  parseHookCommand,
55
57
  supportedClaudeEvents
56
- } from "./chunk-MH4O453X.js";
58
+ } from "./chunk-7WLKE7QN.js";
57
59
  import {
58
60
  readRegularJsonFile,
59
61
  readRegularTextFile
@@ -67,7 +69,7 @@ import {
67
69
  OPENCODE_APPROVAL_EVENT,
68
70
  isRecord,
69
71
  matcherMatchesEveryCall
70
- } from "./chunk-KB7YWU7A.js";
72
+ } from "./chunk-55AHQF63.js";
71
73
 
72
74
  // src/hook-wiring.ts
73
75
  import { createHash } from "crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  claudeConfigDir
3
- } from "./chunk-MH4O453X.js";
3
+ } from "./chunk-7WLKE7QN.js";
4
4
  import {
5
5
  claudePermissionRulesFromSettings
6
- } from "./chunk-KB7YWU7A.js";
6
+ } from "./chunk-55AHQF63.js";
7
7
 
8
8
  // src/claude-permission-rules.ts
9
9
  import { readFileSync, statSync } from "fs";
@@ -2,7 +2,7 @@ import {
2
2
  localRepoKey,
3
3
  normalizeRepoRemote,
4
4
  parseGitBranch
5
- } from "./chunk-KB7YWU7A.js";
5
+ } from "./chunk-55AHQF63.js";
6
6
 
7
7
  // src/repo.ts
8
8
  import { existsSync, readFileSync, statSync } from "fs";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  spawnClaude
3
- } from "./chunk-H6CL3T2S.js";
3
+ } from "./chunk-Y6ILCLKE.js";
4
4
  import {
5
5
  CODEX_HOOK_EVENTS,
6
6
  CODEX_REQUIRED_APPROVAL_EVENTS,
7
7
  codexHome,
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand
10
- } from "./chunk-MH4O453X.js";
10
+ } from "./chunk-7WLKE7QN.js";
11
11
  import {
12
12
  resolvePathBinary
13
- } from "./chunk-PMEDJ4WM.js";
13
+ } from "./chunk-WAFJGQSE.js";
14
14
  import {
15
15
  getPackageVersion
16
- } from "./chunk-WIIMW5YO.js";
16
+ } from "./chunk-UQTQ6HPO.js";
17
17
 
18
18
  // src/codex-app-server.ts
19
19
  import { existsSync, realpathSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-MH4O453X.js";
3
+ } from "./chunk-7WLKE7QN.js";
4
4
  import {
5
5
  readRegularJsonFile,
6
6
  writeFileAtomic
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-KB7YWU7A.js";
16
+ } from "./chunk-55AHQF63.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -1,11 +1,12 @@
1
1
  import {
2
+ LATEST_DIST_TAG,
2
3
  isReleaseVersion
3
- } from "./chunk-WIIMW5YO.js";
4
+ } from "./chunk-UQTQ6HPO.js";
4
5
  import {
5
6
  DISCONNECT_AGENT_IDS,
6
7
  SETUP_AGENT_CHOICES,
7
8
  isApprovalMode
8
- } from "./chunk-KB7YWU7A.js";
9
+ } from "./chunk-55AHQF63.js";
9
10
 
10
11
  // src/cli/mode-request.ts
11
12
  var parseDuration = (value) => {
@@ -38,8 +39,9 @@ var describeMode = (mode) => {
38
39
  // src/cli/commands.ts
39
40
  var npxLatestCommandFor = (platform) => `${platform === "win32" ? "npx.cmd" : "npx"} pushary@latest`;
40
41
  var NPX_LATEST_COMMAND = npxLatestCommandFor(process.platform);
42
+ var isRecoveryVersion = (version) => version === LATEST_DIST_TAG || isReleaseVersion(version) && version !== "0.0.0";
41
43
  var npmExecSetupCommandFor = (platform, agents, version) => {
42
- if (!isReleaseVersion(version) || version === "0.0.0") throw new Error("Recovery requires a known release version");
44
+ if (!isRecoveryVersion(version)) throw new Error("Recovery requires a known release version or the latest tag");
43
45
  return `${platform === "win32" ? "npm.cmd" : "npm"} exec --yes --package=pushary@${version} -c "pushary setup --agents ${agents.join(",")}"`;
44
46
  };
45
47
  var COMMAND_LIST = [
@@ -118,6 +120,7 @@ var COMMAND_LIST = [
118
120
  { name: "clean", module: "pushary-clean", summary: "Remove Pushary from this machine (--everything: the Mac app's setup too, --dry-run: preview)" },
119
121
  { name: "mode", module: "pushary-mode", summary: "Choose where approval requests appear" },
120
122
  { name: "wait", module: "pushary-wait", summary: 'Show or set the "wait for your phone" ladder (pushary wait 45)' },
123
+ { name: "calls", module: "pushary-calls", summary: "Get a phone call when an approval waits: add your number, confirm it, turn calls on or off" },
121
124
  { name: "stats", module: "pushary-stats", summary: "Show the approval moments your agents hit while not connected" },
122
125
  {
123
126
  name: "audit",
@@ -180,6 +183,14 @@ var COMMAND_OPTIONS = {
180
183
  ["--everything", "Also revoke the key this CLI created (any other key is only removed) and remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
181
184
  ["--yes", "Remove everything without asking"]
182
185
  ],
186
+ calls: [
187
+ ["on", "Add your number, confirm it with a test call, and turn calls on"],
188
+ ["off", "Turn calls off"],
189
+ ["status", "Show your number, whether calls are on, and minutes left (default)"],
190
+ ["--number <+1 415 555 0134>", "Your mobile number with its country code, instead of being asked"],
191
+ ["--name <first name>", "The name the call greets you with, instead of being asked"],
192
+ ["--yes", "Agree to be called without being asked"]
193
+ ],
183
194
  transcripts: [
184
195
  ["on", "Sync encrypted transcripts from this machine so your phone shows the conversation"],
185
196
  ["off", "Stop syncing transcripts from this machine"],
@@ -10,7 +10,7 @@ import {
10
10
  uploadTranscriptRecords,
11
11
  verifyAnchoredRecipients,
12
12
  wrapSessionKey
13
- } from "./chunk-CHI57HS3.js";
13
+ } from "./chunk-5UBV26GO.js";
14
14
 
15
15
  // src/live-session.ts
16
16
  var LIVE_TRANSCRIPT_LIMITS = { queuedRecords: 100, recordCharacters: 32 * 1024 };
@@ -3,27 +3,27 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-3FQJYA76.js";
6
+ } from "./chunk-UH7GJHOO.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-5TCLBCUO.js";
13
+ } from "./chunk-WNIDBPT2.js";
14
14
  import {
15
15
  getMachineId
16
- } from "./chunk-4RSJZOKB.js";
16
+ } from "./chunk-VIS3EVRH.js";
17
17
  import {
18
18
  readControlMode,
19
19
  readKeySource
20
- } from "./chunk-2LTRA6NA.js";
20
+ } from "./chunk-Y23YO46U.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-ANL74IBU.js";
23
+ } from "./chunk-7IHVTLHK.js";
24
24
  import {
25
25
  getPackageVersion
26
- } from "./chunk-WIIMW5YO.js";
26
+ } from "./chunk-UQTQ6HPO.js";
27
27
 
28
28
  // src/machines.ts
29
29
  import { hostname } from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-T3LSBTWU.js";
3
+ } from "./chunk-R7NAG65X.js";
4
4
  import {
5
5
  hermesReceiptPaths,
6
6
  hermesSetupPredatesThePluginFolder,
@@ -9,7 +9,7 @@ import {
9
9
  refreshHermesPluginFiles,
10
10
  refreshOpenClawPlugin,
11
11
  shippedHermesPlugin
12
- } from "./chunk-UAYNQ2IG.js";
12
+ } from "./chunk-2ABUBECK.js";
13
13
  import {
14
14
  fxIgnoresInstructionsFile,
15
15
  fxInstructionsBody,
@@ -18,7 +18,7 @@ import {
18
18
  macAppFxBridge,
19
19
  refreshClineKey,
20
20
  switchFxHttpEntryToBridge
21
- } from "./chunk-S6DJAYQW.js";
21
+ } from "./chunk-GJA3KQ3T.js";
22
22
  import {
23
23
  OPENCODE_HOOK_BINARY,
24
24
  agentHookOwner,
@@ -31,16 +31,16 @@ import {
31
31
  openCodePluginDir,
32
32
  openCodeWired,
33
33
  withOpenCodeAskRules
34
- } from "./chunk-BO4HRAY7.js";
34
+ } from "./chunk-UJT32RSQ.js";
35
35
  import {
36
36
  detectClaudeVersion
37
- } from "./chunk-MEUAK5BK.js";
37
+ } from "./chunk-W6FCSBTM.js";
38
38
  import {
39
39
  addCompatibleHooks,
40
40
  compatibleConfigFile,
41
41
  compatibleInstructionsFile,
42
42
  hasCompatibleHooks
43
- } from "./chunk-4I4HAPT5.js";
43
+ } from "./chunk-LVGRSC44.js";
44
44
  import {
45
45
  GEMINI_HOOK_BINARY,
46
46
  addGeminiHooks,
@@ -52,10 +52,10 @@ import {
52
52
  geminiWired,
53
53
  hasGeminiHooks,
54
54
  planHooks
55
- } from "./chunk-BMR66K6T.js";
55
+ } from "./chunk-YGHHDDIM.js";
56
56
  import {
57
57
  KEY_FILE_MODE
58
- } from "./chunk-2LTRA6NA.js";
58
+ } from "./chunk-Y23YO46U.js";
59
59
  import {
60
60
  CLAUDE_CODE_PUSHARY_PERMISSION_RULES,
61
61
  CLAUDE_HOOK_BINARY,
@@ -102,13 +102,13 @@ import {
102
102
  renderAgentInstructions,
103
103
  supportedClaudeEvents,
104
104
  vscodePluginMcp
105
- } from "./chunk-MH4O453X.js";
105
+ } from "./chunk-7WLKE7QN.js";
106
106
  import {
107
107
  formatVersion,
108
108
  hookCommandsUseBareNames,
109
109
  resolveGlobalBinDir,
110
110
  resolveGlobalBinary
111
- } from "./chunk-PMEDJ4WM.js";
111
+ } from "./chunk-WAFJGQSE.js";
112
112
  import {
113
113
  readJsonSafe,
114
114
  writeFileAtomic,
@@ -118,7 +118,7 @@ import {
118
118
  HOOK_COMPATIBLE_PROFILES,
119
119
  isCompatibleAgentType,
120
120
  isRecord
121
- } from "./chunk-KB7YWU7A.js";
121
+ } from "./chunk-55AHQF63.js";
122
122
 
123
123
  // src/reapply.ts
124
124
  import { dirname, join } from "path";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  RETRY_ACK,
6
6
  refusedReceiptMessage
7
- } from "./chunk-QONYKXWP.js";
7
+ } from "./chunk-KDHLOPSO.js";
8
8
 
9
9
  // src/command-receipts.ts
10
10
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  realpath
3
- } from "./chunk-MEUAK5BK.js";
3
+ } from "./chunk-W6FCSBTM.js";
4
4
  import {
5
5
  findNativeClaudeInstall
6
6
  } from "./chunk-CYTPQDQY.js";
@@ -12,7 +12,7 @@ import {
12
12
  resolvePackageVersionFromBinary,
13
13
  resolvePathBinary,
14
14
  resolvePathBinaryAsync
15
- } from "./chunk-PMEDJ4WM.js";
15
+ } from "./chunk-WAFJGQSE.js";
16
16
  import {
17
17
  CLAUDE_BRIDGE_CAPABILITY,
18
18
  CLAUDE_RESUME_CAPABILITY,
@@ -23,7 +23,7 @@ import {
23
23
  MANAGED_PROVIDERS,
24
24
  SPAWN_CAPABILITY,
25
25
  sessionProvidersAdvertisedBy
26
- } from "./chunk-KB7YWU7A.js";
26
+ } from "./chunk-55AHQF63.js";
27
27
 
28
28
  // src/live-capabilities.ts
29
29
  import { accessSync, constants, statSync as statSync2 } from "fs";
@@ -0,0 +1,242 @@
1
+ import {
2
+ OPENCODE_FAILED_EVENT,
3
+ OPENCODE_IDLE_EVENT,
4
+ OPENCODE_PLUGIN_DIR,
5
+ OPENCODE_PLUGIN_FILE,
6
+ OPENCODE_PLUGIN_SIBLING,
7
+ OPENCODE_PLUGIN_SIBLING_CONTENTS,
8
+ OPENCODE_SUBAGENT_IDLE_EVENT,
9
+ isOpenCodePluginOurs,
10
+ openCodePluginArgv,
11
+ openCodePluginModule,
12
+ renderOpenCodePlugin
13
+ } from "./chunk-OQAIMSHQ.js";
14
+ import {
15
+ compatibleConfigFile
16
+ } from "./chunk-LVGRSC44.js";
17
+ import {
18
+ hookOwnerOf,
19
+ hookOwnerOfCommands
20
+ } from "./chunk-YGHHDDIM.js";
21
+ import {
22
+ AGENT_CHOICES
23
+ } from "./chunk-AVRRD6AY.js";
24
+ import {
25
+ OPENCODE_INSTRUCTIONS_LABEL,
26
+ bridgeStub,
27
+ claudeSettings,
28
+ codexHooksJson,
29
+ cursorUserHooks,
30
+ geminiSettings,
31
+ guardedArgv,
32
+ liveBridgeProbe,
33
+ renderAgentInstructions,
34
+ resolveBridgeStub,
35
+ vscodePluginDir,
36
+ windowsNodeLauncherFor
37
+ } from "./chunk-7WLKE7QN.js";
38
+ import {
39
+ readJsonSafe
40
+ } from "./chunk-TODDEIYG.js";
41
+ import {
42
+ HOOK_BUDGETS,
43
+ HOOK_COMPATIBLE_PROFILES,
44
+ OPENCODE_APPROVAL_EVENT,
45
+ hookCompatibleProfile,
46
+ isRecord
47
+ } from "./chunk-55AHQF63.js";
48
+
49
+ // src/opencode-config.ts
50
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
51
+ import { homedir } from "os";
52
+ import { join } from "path";
53
+ var OPENCODE_HOOK_BINARY = "pushary-opencode-hook";
54
+ var OPENCODE_HOOK_ARGS = ["--source", "opencode"];
55
+ var openCodeHookArgv = (resolvedBinary, platform = process.platform) => guardedArgv({ kind: "binary", path: resolvedBinary ?? OPENCODE_HOOK_BINARY, runtime: "node" }, OPENCODE_HOOK_ARGS, platform, windowsNodeLauncherFor(platform));
56
+ var openCodeConfigDirFrom = (home, env = process.env) => env.OPENCODE_CONFIG_DIR?.trim() || join(env.XDG_CONFIG_HOME?.trim() || join(home, ".config"), "opencode");
57
+ var openCodeConfigDir = () => openCodeConfigDirFrom(homedir());
58
+ var OPENCODE_PLUGIN_PATH = `${OPENCODE_PLUGIN_DIR}/${OPENCODE_PLUGIN_FILE}`;
59
+ var openCodePluginDir = () => join(openCodeConfigDir(), OPENCODE_PLUGIN_DIR);
60
+ var openCodePluginFile = () => join(openCodePluginDir(), OPENCODE_PLUGIN_FILE);
61
+ var OPENCODE_HOOK_EVENTS = [
62
+ { event: OPENCODE_APPROVAL_EVENT, delivery: "approval", timeout: HOOK_BUDGETS.opencode.budgetSeconds },
63
+ { event: "tool.execute.after", delivery: "telemetry", timeout: 10 },
64
+ { event: "chat.message", delivery: "telemetry", timeout: 10 },
65
+ { event: OPENCODE_IDLE_EVENT, delivery: "telemetry", timeout: 10 },
66
+ { event: OPENCODE_FAILED_EVENT, delivery: "telemetry", timeout: 10 },
67
+ { event: OPENCODE_SUBAGENT_IDLE_EVENT, delivery: "telemetry", timeout: 10 }
68
+ ];
69
+ var hasForeignPlugins = (entries) => entries.some((entry) => entry !== OPENCODE_PLUGIN_FILE && /\.(ts|js)$/.test(entry));
70
+ var installOpenCodePlugin = (argv, dir = openCodePluginDir()) => {
71
+ mkdirSync(dir, { recursive: true });
72
+ const plugin = join(dir, OPENCODE_PLUGIN_FILE);
73
+ writeFileSync(plugin, renderOpenCodePlugin(openCodePluginModule(), argv), "utf-8");
74
+ const sibling = join(dir, OPENCODE_PLUGIN_SIBLING);
75
+ if (existsSync(sibling)) return { plugin, wroteSibling: false };
76
+ writeFileSync(sibling, OPENCODE_PLUGIN_SIBLING_CONTENTS, "utf-8");
77
+ return { plugin, wroteSibling: true };
78
+ };
79
+ var openCodeWired = (dir = openCodePluginDir()) => {
80
+ try {
81
+ return isOpenCodePluginOurs(readFileSync(join(dir, OPENCODE_PLUGIN_FILE), "utf-8"));
82
+ } catch {
83
+ return false;
84
+ }
85
+ };
86
+ var OPENCODE_MCP_URL = "https://pushary.com/api/mcp/mcp";
87
+ var OPENCODE_CONFIG_FILE = "opencode.json";
88
+ var openCodeConfigFile = () => join(openCodeConfigDir(), OPENCODE_CONFIG_FILE);
89
+ var OPENCODE_INSTRUCTIONS_FILE = "AGENTS.md";
90
+ var openCodeInstructionsFile = () => join(openCodeConfigDir(), OPENCODE_INSTRUCTIONS_FILE);
91
+ var OPENCODE_QUESTION_TOOL = "question";
92
+ var OPENCODE_QUESTION_NOTE = `In OpenCode, this replaces the guidance above to prefer \`ask_user\`: ask with OpenCode's own \`${OPENCODE_QUESTION_TOOL}\` tool, one question per call. Pushary shows that question on the phone and the Mac notch as well, and the first answer, in the terminal or on the phone, is the one you receive. Do not ask the same question through \`ask_user\` too. Use the Pushary \`ask_user\` tool only when OpenCode has no \`${OPENCODE_QUESTION_TOOL}\` tool. When Pushary's tools are listed under Code Mode, as in OpenCode 2, call them inside \`execute\`, for example \`await tools.pushary.ask_user({ ... })\` and \`await tools.pushary.wait_for_answer({ ... })\`. Otherwise, as in OpenCode 1, they are direct tools such as \`pushary_ask_user\`.`;
93
+ var openCodeInstructionsBody = () => `${renderAgentInstructions(OPENCODE_INSTRUCTIONS_LABEL)}
94
+
95
+ ${OPENCODE_QUESTION_NOTE}`;
96
+ var OPENCODE_MAC_APP_QUESTION_NOTE = `In OpenCode, this replaces the guidance above to ask in the terminal while the user is there: ask every question through the Pushary \`ask_user\` tool, even while the user is at this terminal, and not through OpenCode's own \`${OPENCODE_QUESTION_TOOL}\` tool. When Pushary's tools are listed under Code Mode, call them inside \`execute\`, for example \`await tools.pushary.ask_user({ ... })\` and \`await tools.pushary.wait_for_answer({ ... })\`. Otherwise OpenCode lists them as direct tools such as \`pushary_ask_user\`. That includes a question the user asks you to put to them, such as "ask me a multiple choice question": use \`ask_user\` with type "select". Ask one question at a time and wait for its answer before asking the next. OpenCode's question prompt cannot reach the phone or the Mac notch, so a question asked there waits unseen once the user steps away. Ask in your reply or with the \`${OPENCODE_QUESTION_TOOL}\` tool instead only when a Pushary handoffAction tells you to ask here, or when Pushary's tools are listed under neither name or \`ask_user\` fails without a handoffAction.`;
97
+ var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
98
+ var addOpenCodeMcpServer = (config, apiKey) => {
99
+ const servers = asRecord(config.mcp) ?? {};
100
+ servers.pushary = {
101
+ type: "remote",
102
+ url: OPENCODE_MCP_URL,
103
+ enabled: true,
104
+ headers: { Authorization: `Bearer ${apiKey}` }
105
+ };
106
+ config.mcp = servers;
107
+ };
108
+ var OPENCODE_ASKED_PERMISSIONS = ["bash", "edit", "webfetch"];
109
+ var PERMISSION_KEY = "permission";
110
+ var PERMISSIONS_KEY = "permissions";
111
+ var TOOLS_KEY = "tools";
112
+ var ASK_ACTION = "ask";
113
+ var ALLOW_ACTION = "allow";
114
+ var DENY_ACTION = "deny";
115
+ var ALL_PATTERNS = "*";
116
+ var RULE_EFFECTS = [ASK_ACTION, ALLOW_ACTION, DENY_ACTION];
117
+ var OPENCODE_ACTION_NAMES = {
118
+ bash: ["bash", "shell"],
119
+ edit: ["edit", "write", "patch"],
120
+ webfetch: ["webfetch"]
121
+ };
122
+ var escapedForPattern = (text) => text.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("?", ".");
123
+ var keyMatches = (key, name) => new RegExp(`^${key.split(ALL_PATTERNS).map(escapedForPattern).join(".*")}$`).test(name);
124
+ var ruleNamesPermission = (permission) => ([key]) => OPENCODE_ACTION_NAMES[permission].some((name) => keyMatches(key, name));
125
+ var toolRules = (config) => Object.entries(asRecord(config[TOOLS_KEY]) ?? {}).filter(([, enabled]) => typeof enabled === "boolean").map(([key, enabled]) => [key, enabled ? ALLOW_ACTION : DENY_ACTION]);
126
+ var permissionRules = (config) => {
127
+ const permission = config[PERMISSION_KEY];
128
+ if (permission === void 0) return [];
129
+ const rules = asRecord(permission);
130
+ return rules ? Object.entries(rules) : [[ALL_PATTERNS, permission]];
131
+ };
132
+ var rulesInOrder = (config) => [...toolRules(config), ...permissionRules(config)];
133
+ var isNativeRule = (value) => {
134
+ const rule = asRecord(value);
135
+ return rule !== void 0 && typeof rule.action === "string" && typeof rule.resource === "string" && RULE_EFFECTS.includes(rule.effect);
136
+ };
137
+ var nativePermissionRules = (config) => {
138
+ const entries = config[PERMISSIONS_KEY];
139
+ if (!Array.isArray(entries)) return [];
140
+ return entries.filter(isNativeRule).map(({ action, resource, effect }) => [action, { [resource]: effect }]);
141
+ };
142
+ var effectiveRulesInOrder = (config) => [...rulesInOrder(config), ...nativePermissionRules(config)];
143
+ var actionOfRule = (value) => {
144
+ const patterns = asRecord(value);
145
+ return patterns ? patterns[ALL_PATTERNS] : value;
146
+ };
147
+ var holdsTheCall = (action) => action === ASK_ACTION || action === DENY_ACTION;
148
+ var withOpenCodeAskRules = (config) => {
149
+ const permission = config[PERMISSION_KEY];
150
+ const rules = asRecord(permission);
151
+ if (permission !== void 0 && !rules) return { config, change: { kind: "person-setting-kept" } };
152
+ const personRules = rulesInOrder(config);
153
+ const added = OPENCODE_ASKED_PERMISSIONS.filter((name) => !personRules.some(ruleNamesPermission(name)));
154
+ if (added.length === 0) return { config, change: { kind: "present" } };
155
+ const asks = Object.fromEntries(added.map((name) => [name, ASK_ACTION]));
156
+ return { config: { ...config, [PERMISSION_KEY]: { ...asks, ...rules } }, change: { kind: "added", added } };
157
+ };
158
+ var openCodePermissionsLeftOpen = (config) => {
159
+ const rules = effectiveRulesInOrder(asRecord(config) ?? {});
160
+ return OPENCODE_ASKED_PERMISSIONS.filter((name) => !holdsTheCall(
161
+ rules.filter(ruleNamesPermission(name)).map(([, value]) => actionOfRule(value)).filter((action) => action !== void 0).at(-1)
162
+ ));
163
+ };
164
+ var openCodeAskCheck = (config) => {
165
+ if (config.kind === "unreadable" || config.kind === "unparseable") return { kind: "unreadable" };
166
+ const value = config.kind === "ok" ? asRecord(config.value) ?? {} : {};
167
+ const open = openCodePermissionsLeftOpen(value);
168
+ if (open.length === 0) return { kind: "asks" };
169
+ const personRules = effectiveRulesInOrder(value);
170
+ const namedByPerson = (name) => personRules.some(ruleNamesPermission(name));
171
+ return { kind: "open", unset: open.filter((name) => !namedByPerson(name)), allowedByPerson: open.filter(namedByPerson) };
172
+ };
173
+ var removeOpenCodeMcpServer = (config) => {
174
+ const servers = asRecord(config.mcp);
175
+ if (!servers || !("pushary" in servers)) return false;
176
+ delete servers.pushary;
177
+ if (Object.keys(servers).length === 0) delete config.mcp;
178
+ return true;
179
+ };
180
+
181
+ // src/setup/agent-hook-owner.ts
182
+ import { readFileSync as readFileSync2 } from "fs";
183
+ import { join as join2 } from "path";
184
+ var COMPATIBLE_HOOK_FILES = Object.fromEntries(
185
+ HOOK_COMPATIBLE_PROFILES.map((profile) => [profile.agentType, () => compatibleConfigFile(profile)])
186
+ );
187
+ var HOOK_FILES = {
188
+ claude_code: claudeSettings,
189
+ codex: codexHooksJson,
190
+ gemini_cli: geminiSettings,
191
+ cursor: cursorUserHooks,
192
+ vscode: () => join2(vscodePluginDir(), "hooks", "hooks.json"),
193
+ ...COMPATIBLE_HOOK_FILES
194
+ };
195
+ var agentHookFile = (agent) => HOOK_FILES[agent]?.() ?? null;
196
+ var agentHooksKeyPath = (agent) => hookCompatibleProfile(agent)?.hooksKeyPath;
197
+ var readTextOrNull = (path) => {
198
+ try {
199
+ return readFileSync2(path, "utf-8");
200
+ } catch {
201
+ return null;
202
+ }
203
+ };
204
+ var openCodePluginOwner = (appAvailable) => {
205
+ const contents = readTextOrNull(openCodePluginFile());
206
+ return hookOwnerOfCommands(contents === null ? [] : openCodePluginArgv(contents) ?? [], appAvailable);
207
+ };
208
+ var agentHookOwner = (agent, appAvailable) => {
209
+ if (agent === "opencode") return openCodePluginOwner(appAvailable);
210
+ const file = agentHookFile(agent);
211
+ if (!file) return "none";
212
+ const document = readJsonSafe(file);
213
+ return hookOwnerOf(document.kind === "ok" && isRecord(document.value) ? document.value : null, appAvailable, agentHooksKeyPath(agent));
214
+ };
215
+ var cliOwnsAnyAgentHooks = (appAvailable) => AGENT_CHOICES.some((agent) => agentHookOwner(agent, appAvailable) === "cli");
216
+ var macAppBridgeAvailable = () => resolveBridgeStub(bridgeStub(), liveBridgeProbe()).kind === "bundle";
217
+
218
+ export {
219
+ OPENCODE_HOOK_BINARY,
220
+ openCodeHookArgv,
221
+ openCodeConfigDirFrom,
222
+ openCodeConfigDir,
223
+ openCodePluginDir,
224
+ openCodePluginFile,
225
+ hasForeignPlugins,
226
+ installOpenCodePlugin,
227
+ openCodeWired,
228
+ openCodeConfigFile,
229
+ openCodeInstructionsFile,
230
+ openCodeInstructionsBody,
231
+ addOpenCodeMcpServer,
232
+ OPENCODE_ASKED_PERMISSIONS,
233
+ withOpenCodeAskRules,
234
+ openCodePermissionsLeftOpen,
235
+ openCodeAskCheck,
236
+ removeOpenCodeMcpServer,
237
+ agentHookFile,
238
+ agentHooksKeyPath,
239
+ agentHookOwner,
240
+ cliOwnsAnyAgentHooks,
241
+ macAppBridgeAvailable
242
+ };
@@ -174,6 +174,7 @@ var isNewerVersion = (candidate, current) => {
174
174
  };
175
175
  var RELEASE_VERSION = /^\d+\.\d+\.\d+$/;
176
176
  var isReleaseVersion = (value) => RELEASE_VERSION.test(value);
177
+ var LATEST_DIST_TAG = "latest";
177
178
  var majorOf = (version) => parseInt(version.split(".")[0] ?? "", 10) || 0;
178
179
  var isSameMajorVersion = (candidate, current) => majorOf(candidate) === majorOf(current);
179
180
 
@@ -203,5 +204,6 @@ export {
203
204
  packageVersionAt,
204
205
  isNewerVersion,
205
206
  isReleaseVersion,
207
+ LATEST_DIST_TAG,
206
208
  isSameMajorVersion
207
209
  };