@pushary/agent-hooks 1.9.7 → 1.9.8

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 (110) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +3 -3
  3. package/data/cursor-plugin/README.md +3 -7
  4. package/data/vscode-plugin/README.md +1 -1
  5. package/dist/bin/pushary-bell-hook.js +22 -23
  6. package/dist/bin/pushary-bell.js +9 -9
  7. package/dist/bin/pushary-claude.js +27 -28
  8. package/dist/bin/pushary-clean.js +101 -79
  9. package/dist/bin/pushary-codex-bridge.js +18 -18
  10. package/dist/bin/pushary-codex-hook.js +32 -33
  11. package/dist/bin/pushary-codex.js +13 -13
  12. package/dist/bin/pushary-connect.js +24 -21
  13. package/dist/bin/pushary-cowork.js +5 -5
  14. package/dist/bin/pushary-daemon.js +51 -39
  15. package/dist/bin/pushary-disconnect.js +189 -54
  16. package/dist/bin/pushary-doctor.js +67 -58
  17. package/dist/bin/pushary-elicitation-hook.js +24 -25
  18. package/dist/bin/pushary-gemini-bridge.js +13 -13
  19. package/dist/bin/pushary-gemini-hook.js +29 -30
  20. package/dist/bin/pushary-hook.js +30 -32
  21. package/dist/bin/pushary-login.js +12 -12
  22. package/dist/bin/pushary-logout.js +105 -42
  23. package/dist/bin/pushary-mcp.js +9 -9
  24. package/dist/bin/pushary-mode.js +28 -31
  25. package/dist/bin/pushary-notification-hook.js +26 -28
  26. package/dist/bin/pushary-opencode-hook.js +28 -29
  27. package/dist/bin/pushary-permission-denied-hook.js +30 -32
  28. package/dist/bin/pushary-permission-hook.js +29 -31
  29. package/dist/bin/pushary-post-hook.js +26 -28
  30. package/dist/bin/pushary-prompt-hook.js +26 -28
  31. package/dist/bin/pushary-session-end-hook.js +26 -28
  32. package/dist/bin/pushary-session-start-hook.js +31 -32
  33. package/dist/bin/pushary-setup.js +91 -101
  34. package/dist/bin/pushary-stats.js +5 -5
  35. package/dist/bin/pushary-status.js +34 -18
  36. package/dist/bin/pushary-stop-hook.js +26 -28
  37. package/dist/bin/pushary-stopfailure-hook.js +26 -28
  38. package/dist/bin/pushary-suggestions.js +19 -21
  39. package/dist/bin/pushary-transcript-register.js +18 -19
  40. package/dist/bin/pushary-transcripts.js +7 -7
  41. package/dist/bin/pushary-upgrade.js +55 -25
  42. package/dist/bin/pushary-wait.js +23 -19
  43. package/dist/bin/pushary.js +15 -14
  44. package/dist/{chunk-R3YW55MY.js → chunk-2A53H4S6.js} +17 -15
  45. package/dist/{chunk-4YO4T5FV.js → chunk-2QGYMY7A.js} +83 -3
  46. package/dist/{chunk-MBK7N46B.js → chunk-2QTO5YIT.js} +6 -6
  47. package/dist/{chunk-D6S5EKXA.js → chunk-2VZAALEJ.js} +5 -9
  48. package/dist/chunk-2WXF3QJR.js +49 -0
  49. package/dist/{chunk-JCWZ23MJ.js → chunk-3I6IVOZV.js} +3 -3
  50. package/dist/chunk-3Z3A37WD.js +77 -0
  51. package/dist/{chunk-Z6HPS67T.js → chunk-5QUPKDI5.js} +1 -1
  52. package/dist/{chunk-JWKBDSPF.js → chunk-6TE27XZR.js} +2 -2
  53. package/dist/{chunk-STQRUH3S.js → chunk-7DVNSQWF.js} +59 -15
  54. package/dist/{chunk-QTO6HEZD.js → chunk-7PT35RY2.js} +2 -2
  55. package/dist/{chunk-7OIWWZAD.js → chunk-B64KHETR.js} +3 -3
  56. package/dist/chunk-BEJRK4DF.js +94 -0
  57. package/dist/chunk-BXET3ALR.js +46 -0
  58. package/dist/{chunk-6DJTDHBI.js → chunk-CD47ZFFZ.js} +1 -1
  59. package/dist/{chunk-UFVGSEWH.js → chunk-CKV3UPMU.js} +2 -2
  60. package/dist/{chunk-4FK6RZVJ.js → chunk-CLOSJ4ES.js} +1 -1
  61. package/dist/{chunk-AVNKVF7N.js → chunk-DKMD6AWR.js} +4 -4
  62. package/dist/{chunk-SBLPHUEB.js → chunk-DL7XWKYV.js} +7 -5
  63. package/dist/{chunk-BTQGAXZ3.js → chunk-DPGSLWOS.js} +8 -8
  64. package/dist/{chunk-KYO45G5L.js → chunk-DUZVXBBU.js} +1 -1
  65. package/dist/{chunk-EB4XGVBG.js → chunk-EUW7JL2K.js} +0 -32
  66. package/dist/{chunk-4D2AYNSE.js → chunk-FQ2GORVG.js} +2 -2
  67. package/dist/{chunk-W2KI5KPD.js → chunk-HRULIYDU.js} +2 -2
  68. package/dist/{chunk-QR6VE5ME.js → chunk-I5IJRMNV.js} +58 -8
  69. package/dist/{chunk-T7Y5EADL.js → chunk-I6MJXLMY.js} +2 -2
  70. package/dist/{chunk-N4EUSDKX.js → chunk-IAD2RT4L.js} +14 -14
  71. package/dist/{chunk-H37L7TT3.js → chunk-IHFDPV7C.js} +2 -2
  72. package/dist/{chunk-3GNUXXDZ.js → chunk-IHO3YQAN.js} +2 -2
  73. package/dist/{chunk-JWQZSYCK.js → chunk-KF3UZLYI.js} +1 -1
  74. package/dist/chunk-KFF7G225.js +599 -0
  75. package/dist/{chunk-MZPXVH4A.js → chunk-KHNFLYJO.js} +204 -28
  76. package/dist/{chunk-QFEM7R6T.js → chunk-KRCR2CRQ.js} +9 -9
  77. package/dist/{chunk-VXRXFU6Q.js → chunk-LKLVTG3V.js} +14 -7
  78. package/dist/{chunk-KFKL3FHS.js → chunk-LWOO567I.js} +4 -3
  79. package/dist/{chunk-HPRZJKRO.js → chunk-M6BZZFVQ.js} +1 -1
  80. package/dist/{chunk-X5NXPCIC.js → chunk-MFF3ONG5.js} +16 -2
  81. package/dist/{chunk-H7MMU64M.js → chunk-MGRFDGWU.js} +2 -2
  82. package/dist/{chunk-L76HTPU6.js → chunk-MKTJEXZ3.js} +3 -3
  83. package/dist/{chunk-NIBFSARF.js → chunk-MXHTGVFZ.js} +33 -9
  84. package/dist/{chunk-ADSQDYYG.js → chunk-N4QSPI3B.js} +54 -5
  85. package/dist/{chunk-AQ55ZSSS.js → chunk-NWDG3MSW.js} +1 -1
  86. package/dist/chunk-OP7IHC2I.js +24 -0
  87. package/dist/{chunk-KT5E2RLS.js → chunk-QOLITCIP.js} +1 -1
  88. package/dist/{chunk-JXISQ7DT.js → chunk-TCQ43LSG.js} +3 -3
  89. package/dist/chunk-TCWKTUAE.js +50 -0
  90. package/dist/{chunk-RQGODFQN.js → chunk-V5HPPF3E.js} +1 -1
  91. package/dist/{chunk-7264S5HZ.js → chunk-WG3K4TCH.js} +1 -1
  92. package/dist/{chunk-GKI6LFAV.js → chunk-WS4H76EP.js} +2 -2
  93. package/dist/{chunk-XWAYAO3V.js → chunk-WWOHTTVP.js} +2 -2
  94. package/dist/{chunk-SD3272LS.js → chunk-YIG2R3BJ.js} +9 -7
  95. package/dist/{chunk-ZUTU43FT.js → chunk-ZBHUHJG6.js} +4 -4
  96. package/dist/{chunk-AUUXS44H.js → chunk-ZBK6E2OR.js} +1 -1
  97. package/dist/{chunk-QQ4HBXZC.js → chunk-ZN3C6GBG.js} +84 -673
  98. package/dist/{chunk-CBQACHKY.js → chunk-ZSTSEBG7.js} +1 -1
  99. package/dist/{chunk-3PVDOCFI.js → chunk-ZW3XZLJC.js} +5 -5
  100. package/dist/{global-upgrade-E2HUEB4B.js → global-upgrade-I56HNM23.js} +6 -6
  101. package/dist/{paths-QVTEGNZV.js → paths-AGY43CXS.js} +2 -2
  102. package/dist/reapply-IA5XUKWW.js +57 -0
  103. package/dist/src/index.d.ts +1 -0
  104. package/dist/src/index.js +19 -20
  105. package/dist/{upgrade-lock-JCIDZMHF.js → upgrade-lock-B34TAUKV.js} +3 -3
  106. package/package.json +1 -1
  107. package/dist/chunk-ANEAA37E.js +0 -197
  108. package/dist/chunk-MNWRUGMH.js +0 -86
  109. package/dist/chunk-RQSOEB4S.js +0 -44
  110. package/dist/reapply-5QVKM6LA.js +0 -38
@@ -3,34 +3,37 @@ import {
3
3
  describeWaitLadder
4
4
  } from "../chunk-CVWG2N3Y.js";
5
5
  import {
6
- exitOnFailedResponse
7
- } from "../chunk-RQSOEB4S.js";
6
+ exitOnFailedSettingsRequest
7
+ } from "../chunk-BEJRK4DF.js";
8
+ import "../chunk-2WXF3QJR.js";
8
9
  import {
9
10
  createIo
10
11
  } from "../chunk-U4TMAANR.js";
11
12
  import {
12
13
  exitOnHelpFlag
13
- } from "../chunk-UFVGSEWH.js";
14
+ } from "../chunk-CKV3UPMU.js";
14
15
  import {
15
16
  rejectUnknownFlags
16
17
  } from "../chunk-GMXKITVA.js";
17
- import "../chunk-KFKL3FHS.js";
18
- import "../chunk-JXISQ7DT.js";
19
- import "../chunk-KYO45G5L.js";
18
+ import "../chunk-N4QSPI3B.js";
19
+ import "../chunk-LWOO567I.js";
20
+ import "../chunk-TCQ43LSG.js";
21
+ import "../chunk-DUZVXBBU.js";
20
22
  import {
21
23
  UsageError
22
24
  } from "../chunk-7QLSKOSU.js";
23
25
  import {
24
26
  EXIT
25
27
  } from "../chunk-KZERVKTD.js";
26
- import "../chunk-ZUTU43FT.js";
28
+ import "../chunk-FQ2GORVG.js";
29
+ import "../chunk-ZBHUHJG6.js";
27
30
  import "../chunk-T7E75EKA.js";
28
31
  import {
29
32
  getApiKey,
30
33
  getBaseUrl
31
- } from "../chunk-Z6HPS67T.js";
32
- import "../chunk-STQRUH3S.js";
33
- import "../chunk-QR6VE5ME.js";
34
+ } from "../chunk-5QUPKDI5.js";
35
+ import "../chunk-7DVNSQWF.js";
36
+ import "../chunk-I5IJRMNV.js";
34
37
 
35
38
  // bin/pushary-wait.ts
36
39
  exitOnHelpFlag("wait");
@@ -56,18 +59,18 @@ var printLadder = (data) => {
56
59
  console.log(` ${dim("Reset it:")} ${cyan("pushary wait clear")}`);
57
60
  console.log(` ${dim("Per-tool rules live in the dashboard under Agent \u2192 Policies.")}`);
58
61
  };
59
- var fetchPolicy = async (baseUrl, headers) => {
60
- const res = await fetch(`${baseUrl}/api/mcp/policy`, { headers });
61
- if (!res.ok) await exitOnFailedResponse(res, baseUrl);
62
+ var fetchPolicy = async (settings, headers) => {
63
+ const res = await fetch(`${settings.baseUrl}/api/mcp/policy`, { headers });
64
+ if (!res.ok) await exitOnFailedSettingsRequest(res, settings);
62
65
  return res.json();
63
66
  };
64
- var setWindow = async (baseUrl, headers, seconds) => {
65
- const res = await fetch(`${baseUrl}/api/mcp/policy`, {
67
+ var setWindow = async (settings, headers, seconds) => {
68
+ const res = await fetch(`${settings.baseUrl}/api/mcp/policy`, {
66
69
  method: "PATCH",
67
70
  headers,
68
71
  body: JSON.stringify({ defaultPushFirstSeconds: seconds })
69
72
  });
70
- if (!res.ok) await exitOnFailedResponse(res, baseUrl);
73
+ if (!res.ok) await exitOnFailedSettingsRequest(res, settings);
71
74
  const data = await res.json();
72
75
  return data.defaultPushFirstSeconds;
73
76
  };
@@ -85,6 +88,7 @@ var setWindow = async (baseUrl, headers, seconds) => {
85
88
  var main = async () => {
86
89
  const apiKey = getApiKey();
87
90
  const baseUrl = getBaseUrl();
91
+ const settings = { request: "wait", apiKey, baseUrl };
88
92
  const headers = {
89
93
  "Authorization": `Bearer ${apiKey}`,
90
94
  "Content-Type": "application/json"
@@ -93,11 +97,11 @@ var main = async () => {
93
97
  const args = rest[0] === "wait" ? rest.slice(1) : rest;
94
98
  const arg = args[0];
95
99
  if (!arg || arg === "status") {
96
- printLadder(await fetchPolicy(baseUrl, headers));
100
+ printLadder(await fetchPolicy(settings, headers));
97
101
  return;
98
102
  }
99
103
  if (arg === "clear" || arg === "reset") {
100
- const value2 = await setWindow(baseUrl, headers, 20);
104
+ const value2 = await setWindow(settings, headers, 20);
101
105
  console.log(` ${green("\u2713")} Default push window reset to ${cyan(`${value2}s`)}`);
102
106
  return;
103
107
  }
@@ -107,7 +111,7 @@ var main = async () => {
107
111
  console.log(` ${dim("Usage: pushary wait <seconds> | status | clear")}`);
108
112
  process.exit(EXIT.USAGE);
109
113
  }
110
- const value = await setWindow(baseUrl, headers, Math.trunc(seconds));
114
+ const value = await setWindow(settings, headers, Math.trunc(seconds));
111
115
  const ladder = describeWaitLadder({ tool: "*", mode: "push_first", pushFirstSeconds: value, timeoutSeconds: 0, timeoutAction: "escalate" });
112
116
  console.log(` ${green("\u2713")} Default push window set to ${cyan(`${value}s`)} ${dim(`(${ladder})`)}`);
113
117
  };
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  installNetworkDefaults
4
- } from "../chunk-JXISQ7DT.js";
5
- import "../chunk-KYO45G5L.js";
4
+ } from "../chunk-TCQ43LSG.js";
5
+ import "../chunk-DUZVXBBU.js";
6
6
  import "../chunk-7QLSKOSU.js";
7
7
  import {
8
8
  EXIT
9
9
  } from "../chunk-KZERVKTD.js";
10
- import "../chunk-ZUTU43FT.js";
10
+ import "../chunk-ZBHUHJG6.js";
11
11
  import "../chunk-T7E75EKA.js";
12
- import "../chunk-Z6HPS67T.js";
12
+ import "../chunk-5QUPKDI5.js";
13
13
  import {
14
14
  COMMANDS,
15
- isCommandName,
16
- renderHelp
17
- } from "../chunk-STQRUH3S.js";
15
+ renderHelp,
16
+ resolveCommandName
17
+ } from "../chunk-7DVNSQWF.js";
18
18
  import {
19
19
  getPackageVersion
20
- } from "../chunk-QR6VE5ME.js";
20
+ } from "../chunk-I5IJRMNV.js";
21
21
 
22
22
  // src/cli/runtime.ts
23
23
  var supportsRuntime = (version) => {
@@ -33,8 +33,8 @@ var LOADERS = {
33
33
  daemon: () => import("./pushary-daemon.js"),
34
34
  status: () => import("./pushary-status.js"),
35
35
  login: () => import("./pushary-login.js"),
36
- logout: () => import("./pushary-logout.js"),
37
- connect: () => import("./pushary-connect.js"),
36
+ "sign-out": () => import("./pushary-logout.js"),
37
+ pair: () => import("./pushary-connect.js"),
38
38
  bell: () => import("./pushary-bell.js"),
39
39
  doctor: () => import("./pushary-doctor.js"),
40
40
  disconnect: () => import("./pushary-disconnect.js"),
@@ -54,21 +54,22 @@ if (!supportsRuntime(process.versions.node)) {
54
54
  installNetworkDefaults();
55
55
  var argv = process.argv.slice(2);
56
56
  var command = argv[0] ?? "";
57
+ var resolved = resolveCommandName(command);
57
58
  var wants = (...names) => argv.some((arg) => names.includes(arg));
58
- if (!command || wants("--help", "-h") && !isCommandName(command)) {
59
+ if (!command || wants("--help", "-h") && resolved === null) {
59
60
  process.stdout.write(renderHelp(getPackageVersion()));
60
61
  process.exit(EXIT.OK);
61
62
  }
62
- if (wants("--version", "-v") && !isCommandName(command)) {
63
+ if (wants("--version", "-v") && resolved === null) {
63
64
  process.stdout.write(`${getPackageVersion()}
64
65
  `);
65
66
  process.exit(EXIT.OK);
66
67
  }
67
- if (!isCommandName(command)) {
68
+ if (resolved === null) {
68
69
  process.stderr.write(`Unknown command: ${command}
69
70
  `);
70
71
  process.stderr.write(`Run \`pushary --help\`. Available: ${COMMANDS.map((c) => c.name).join(", ")}
71
72
  `);
72
73
  process.exit(EXIT.USAGE);
73
74
  }
74
- await LOADERS[command]();
75
+ await LOADERS[resolved]();
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  activeHookSource,
3
3
  activeIdentity
4
- } from "./chunk-MZPXVH4A.js";
4
+ } from "./chunk-KHNFLYJO.js";
5
5
  import {
6
6
  defersToNativeMode,
7
7
  reportMachineDenial
8
- } from "./chunk-3GNUXXDZ.js";
8
+ } from "./chunk-IHO3YQAN.js";
9
9
  import {
10
10
  isGatingMoment,
11
11
  recordKeylessMoment
12
- } from "./chunk-CBQACHKY.js";
12
+ } from "./chunk-ZSTSEBG7.js";
13
13
  import {
14
14
  announceSubscriptionRequired,
15
15
  denyReasonFrom,
@@ -39,13 +39,11 @@ import {
39
39
  reportEvent,
40
40
  scopePathFor,
41
41
  settleQuestionsForToolUse
42
- } from "./chunk-QFEM7R6T.js";
42
+ } from "./chunk-KRCR2CRQ.js";
43
43
  import {
44
44
  DEFAULT_SESSION
45
45
  } from "./chunk-N6IOSZOE.js";
46
46
  import {
47
- DECISION_STOP_REASON,
48
- UNVERIFIABLE_APPROVAL_REASON,
49
47
  askUser,
50
48
  cancelQuestion,
51
49
  claimBlockedAction,
@@ -55,24 +53,27 @@ import {
55
53
  requestGate,
56
54
  sendNotification,
57
55
  waitForQuestion
58
- } from "./chunk-D6S5EKXA.js";
56
+ } from "./chunk-2VZAALEJ.js";
59
57
  import {
60
58
  SubscriptionRequiredError
61
- } from "./chunk-L76HTPU6.js";
59
+ } from "./chunk-MKTJEXZ3.js";
62
60
  import {
63
61
  getMachineId
64
- } from "./chunk-KYO45G5L.js";
62
+ } from "./chunk-DUZVXBBU.js";
65
63
  import {
66
64
  getApiKey,
67
65
  getBaseUrl
68
- } from "./chunk-Z6HPS67T.js";
66
+ } from "./chunk-5QUPKDI5.js";
69
67
  import {
70
68
  NPX_LATEST_COMMAND
71
- } from "./chunk-STQRUH3S.js";
69
+ } from "./chunk-7DVNSQWF.js";
72
70
  import {
73
71
  AGENT_QUESTION_STRATEGY,
72
+ DECISION_STOP_REASON,
74
73
  GATE_BLOCK_REASON_MAX_LENGTH,
75
74
  GATE_WIRE,
75
+ UNVERIFIABLE_APPROVAL_REASON,
76
+ WITHDRAWN_APPROVAL_REASON,
76
77
  agentQuestionStrategy,
77
78
  agentRulesAllowEveryInput,
78
79
  buildDecisionEpisodeFeatures,
@@ -83,6 +84,7 @@ import {
83
84
  claudePermissionRulesFromSettings,
84
85
  claudePreToolUseOutput,
85
86
  claudePromptsBeforeAnEdit,
87
+ claudeStoppedPreToolUseOutput,
86
88
  editAsksAtTheAgentsPrompt,
87
89
  effectiveWaitSeconds,
88
90
  hookHoldWindowMs,
@@ -96,7 +98,7 @@ import {
96
98
  parseAgentQuestions,
97
99
  resolveGate,
98
100
  stoppedOutput
99
- } from "./chunk-QR6VE5ME.js";
101
+ } from "./chunk-I5IJRMNV.js";
100
102
 
101
103
  // src/claude-permission-rules.ts
102
104
  import { readFileSync, statSync } from "fs";
@@ -174,7 +176,7 @@ var allow = (reason) => claudePreToolUseOutput("allow", reason);
174
176
  var deny = (reason) => claudePreToolUseOutput("deny", reason);
175
177
  var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
176
178
  var ask = (reason) => claudePreToolUseOutput("ask", reason);
177
- var halted = (reason) => stoppedOutput(deny(reason), reason);
179
+ var halted = (reason) => claudeStoppedPreToolUseOutput(reason);
178
180
  var outcomeOfFailedAsk = (error, sessionId, failure) => {
179
181
  if (!(error instanceof SubscriptionRequiredError)) return failure;
180
182
  announceSubscriptionRequired(error.upgradeUrl, sessionId);
@@ -218,7 +220,7 @@ var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, ti
218
220
  return answer.value === "yes" ? allow() : deny(denyReasonFrom(answer.value, answer.note));
219
221
  }
220
222
  if (timeoutAction === "wait" || clampCut || deadline < requestedDeadline) {
221
- return ask("The phone question was withdrawn. Approve in the current client.");
223
+ return ask(WITHDRAWN_APPROVAL_REASON);
222
224
  }
223
225
  switch (timeoutAction) {
224
226
  case "approve":
@@ -261,7 +263,7 @@ var handlePushFirst = async (apiKey, description, projectName, pushFirstSeconds,
261
263
  signals.humanDecision = true;
262
264
  return answer.value === "yes" ? allow() : deny(denyReasonFrom(answer.value, answer.note));
263
265
  }
264
- return ask("The phone question was withdrawn. Approve in the current client.");
266
+ return ask(WITHDRAWN_APPROVAL_REASON);
265
267
  };
266
268
  var handleNotifyOnly = async (apiKey, description, projectName, sessionId, machineId) => {
267
269
  try {
@@ -2,17 +2,93 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-JCWZ23MJ.js";
5
+ } from "./chunk-3I6IVOZV.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
9
9
  holdBudgetOf
10
- } from "./chunk-ZUTU43FT.js";
10
+ } from "./chunk-ZBHUHJG6.js";
11
11
  import {
12
12
  CURSOR_GATE_EVENTS,
13
13
  HOOK_LOCATOR_BINARY,
14
14
  hookCommandHoldBudget
15
- } from "./chunk-QR6VE5ME.js";
15
+ } from "./chunk-I5IJRMNV.js";
16
+
17
+ // src/diagnostics/bridge.ts
18
+ import { execFileSync } from "child_process";
19
+ import { existsSync, readFileSync } from "fs";
20
+ import { homedir } from "os";
21
+ import { dirname, join } from "path";
22
+ var BRIDGE_BUNDLE_IDENTIFIER = "com.pushary.app";
23
+ var BRIDGE_HELPER_SUFFIX = "/Contents/Helpers/pushary-bridge";
24
+ var BRIDGE_BUNDLE_ROOTS = ["/Applications/Pushary.app", "$HOME/Applications/Pushary.app"];
25
+ var expandHome = (path, home) => path.replaceAll("$HOME", home);
26
+ var parseBridgeStub = (contents, stubPath) => {
27
+ const helperSuffix = contents.match(/^H=(\S+)$/m)?.[1] ?? BRIDGE_HELPER_SUFFIX;
28
+ const cachePath = contents.match(/^C="([^"\n]+)"$/m)?.[1] ?? join(dirname(stubPath), ".bridge-cache");
29
+ const rootsLine = contents.match(/^for P in ((?:"[^"\n]*"\s*)+); do$/m)?.[1];
30
+ const bundleRoots = rootsLine ? [...rootsLine.matchAll(/"([^"]*)"/g)].map((match) => match[1]) : BRIDGE_BUNDLE_ROOTS;
31
+ const bundleIdentifier = contents.match(/kMDItemCFBundleIdentifier == "([^"]+)"/)?.[1] ?? BRIDGE_BUNDLE_IDENTIFIER;
32
+ return { helperSuffix, cachePath, bundleRoots, bundleIdentifier };
33
+ };
34
+ var resolveBridgeStub = (stubPath, probe) => {
35
+ const contents = probe.readFile(stubPath);
36
+ if (contents === null) return { kind: "no-stub", stub: stubPath };
37
+ const shape = parseBridgeStub(contents, stubPath);
38
+ const helperIn = (bundle) => `${bundle}${shape.helperSuffix}`;
39
+ const looked = [];
40
+ for (const root of shape.bundleRoots.map((root2) => expandHome(root2, probe.home))) {
41
+ looked.push(root);
42
+ if (probe.exists(helperIn(root))) return { kind: "bundle", helper: helperIn(root), via: "root" };
43
+ }
44
+ const cached = shape.cachePath ? probe.readFile(shape.cachePath)?.split("\n")[0]?.trim() : void 0;
45
+ if (cached) {
46
+ looked.push(cached);
47
+ if (probe.exists(helperIn(cached))) return { kind: "bundle", helper: helperIn(cached), via: "cache" };
48
+ }
49
+ for (const found of probe.mdfind(shape.bundleIdentifier)) {
50
+ looked.push(found);
51
+ if (probe.exists(helperIn(found))) return { kind: "bundle", helper: helperIn(found), via: "spotlight" };
52
+ }
53
+ return { kind: "missing", stub: stubPath, looked };
54
+ };
55
+ var BRIDGE_GONE_MESSAGE = "the Mac app is gone but its hooks remain; run pushary setup or reinstall the app";
56
+ var describeBridgeResolution = (resolution) => {
57
+ switch (resolution.kind) {
58
+ case "bundle":
59
+ return `${resolution.helper} (${resolution.via === "root" ? "installed" : resolution.via === "cache" ? "cached path" : "found by Spotlight"})`;
60
+ case "missing":
61
+ return BRIDGE_GONE_MESSAGE;
62
+ case "no-stub":
63
+ return `${resolution.stub} is not there; ${BRIDGE_GONE_MESSAGE}`;
64
+ }
65
+ };
66
+ var isBridgeLocator = (executable) => executable !== null && executable.split(/[/\\]/).pop() === HOOK_LOCATOR_BINARY;
67
+ var spotlight = (bundleIdentifier) => {
68
+ if (process.platform !== "darwin") return [];
69
+ try {
70
+ return execFileSync("/usr/bin/mdfind", [`kMDItemCFBundleIdentifier == "${bundleIdentifier}"`], {
71
+ encoding: "utf-8",
72
+ timeout: 5e3,
73
+ stdio: ["ignore", "pipe", "ignore"]
74
+ }).split("\n").map((line) => line.trim()).filter((line) => line !== "");
75
+ } catch {
76
+ return [];
77
+ }
78
+ };
79
+ var readOrNull = (path) => {
80
+ try {
81
+ return readFileSync(path, "utf-8");
82
+ } catch {
83
+ return null;
84
+ }
85
+ };
86
+ var liveBridgeProbe = () => ({
87
+ exists: existsSync,
88
+ readFile: readOrNull,
89
+ mdfind: spotlight,
90
+ home: homedir()
91
+ });
16
92
 
17
93
  // src/diagnostics/wiring.ts
18
94
  var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -131,6 +207,10 @@ var describeOtherHolder = (holder) => `another hook also registered on ${holder.
131
207
  var describeHoldSentence = (agentLabel) => `${agentLabel} waits for every hook on an event, so the terminal cannot move until that one returns, however fast your phone answered.`;
132
208
 
133
209
  export {
210
+ resolveBridgeStub,
211
+ describeBridgeResolution,
212
+ isBridgeLocator,
213
+ liveBridgeProbe,
134
214
  pusharyHookExecutable,
135
215
  claudeWired,
136
216
  codexWired,
@@ -3,27 +3,27 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-T7Y5EADL.js";
6
+ } from "./chunk-I6MJXLMY.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-VXRXFU6Q.js";
13
+ } from "./chunk-LKLVTG3V.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
- } from "./chunk-ADSQDYYG.js";
17
+ } from "./chunk-N4QSPI3B.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-KYO45G5L.js";
20
+ } from "./chunk-DUZVXBBU.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-Z6HPS67T.js";
23
+ } from "./chunk-5QUPKDI5.js";
24
24
  import {
25
25
  getPackageVersion
26
- } from "./chunk-QR6VE5ME.js";
26
+ } from "./chunk-I5IJRMNV.js";
27
27
 
28
28
  // src/machines.ts
29
29
  import { hostname } from "os";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  clientErrorKindOf,
3
3
  reportClientError
4
- } from "./chunk-AVNKVF7N.js";
4
+ } from "./chunk-DKMD6AWR.js";
5
5
  import {
6
6
  SubscriptionRequiredError,
7
7
  callMcpTool
8
- } from "./chunk-L76HTPU6.js";
8
+ } from "./chunk-MKTJEXZ3.js";
9
9
  import {
10
10
  installNetworkDefaults
11
- } from "./chunk-JXISQ7DT.js";
11
+ } from "./chunk-TCQ43LSG.js";
12
12
  import {
13
13
  getBaseUrl
14
- } from "./chunk-Z6HPS67T.js";
14
+ } from "./chunk-5QUPKDI5.js";
15
15
  import {
16
16
  ASK_AGENT_NAME_MAX,
17
17
  ASK_QUESTION_MAX,
18
18
  DECISION_LINE_MAX,
19
19
  truncateLine
20
- } from "./chunk-QR6VE5ME.js";
20
+ } from "./chunk-I5IJRMNV.js";
21
21
 
22
22
  // src/api.ts
23
23
  import { randomUUID } from "crypto";
@@ -56,11 +56,9 @@ var isBlockedActionClaim = (data) => {
56
56
 
57
57
  // src/api.ts
58
58
  installNetworkDefaults();
59
- var DECISION_STOP_REASON = "Approval was cancelled or became unavailable. Retry only after resolving it.";
60
59
  var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
61
60
  var isLocalQuestionHandoff = (result) => result.suppressed === true || result.noDevices === true || result.status === "terminal" || result.status === "notified";
62
61
  var STOPPED = { answered: false, handoffAction: "stop" };
63
- var UNVERIFIABLE_APPROVAL_REASON = "Pushary could not create a verifiable approval. Retry the action.";
64
62
  var unavailableQuestionUnlessSubscriptionRequired = (error) => {
65
63
  if (error instanceof SubscriptionRequiredError) throw error;
66
64
  return { correlationId: "", status: "unavailable" };
@@ -174,10 +172,8 @@ export {
174
172
  isPolicyConfig,
175
173
  isAskUserResponse,
176
174
  isWaitForAnswerResponse,
177
- DECISION_STOP_REASON,
178
175
  isDecisionStopped,
179
176
  isLocalQuestionHandoff,
180
- UNVERIFIABLE_APPROVAL_REASON,
181
177
  unavailableQuestionUnlessSubscriptionRequired,
182
178
  askUser,
183
179
  waitForAnswer,
@@ -0,0 +1,49 @@
1
+ import {
2
+ findExportedKeyLine,
3
+ keyPrefix,
4
+ readConfigFileKey,
5
+ readMacAppKeyPrefix
6
+ } from "./chunk-N4QSPI3B.js";
7
+ import {
8
+ NPX_LATEST_COMMAND
9
+ } from "./chunk-7DVNSQWF.js";
10
+
11
+ // src/key-signed-out.ts
12
+ var VERDICT_BY_CHECK = {
13
+ ok: "accepted",
14
+ locked: "accepted",
15
+ rejected: "rejected",
16
+ malformed: "unchecked",
17
+ unreachable: "unchecked"
18
+ };
19
+ var activeKeyVerdictOf = (check) => check === null ? "unchecked" : VERDICT_BY_CHECK[check.kind];
20
+ var NOT_SIGNED_OUT = { kind: "none" };
21
+ var isMacAppKey = (key, macAppKeyPrefix) => keyPrefix(key) === macAppKeyPrefix;
22
+ var diagnoseSignedOutKey = (evidence) => {
23
+ const adopted = evidence.macAppKeyPrefix;
24
+ if (evidence.configKey !== null || adopted === null) return NOT_SIGNED_OUT;
25
+ if (evidence.activeKey !== null) {
26
+ if (!isMacAppKey(evidence.activeKey, adopted) || evidence.activeKeyVerdict === "accepted") return NOT_SIGNED_OUT;
27
+ }
28
+ const exported = evidence.exportedKey;
29
+ return { kind: "signed_out_on_mac", deadExport: exported && isMacAppKey(exported.key, adopted) ? exported : null };
30
+ };
31
+ var SIGNED_OUT_ON_MAC_MESSAGE = "This computer used the key the Pushary Mac app signed in with, and it was signed out on this Mac, so it no longer works here.";
32
+ var describeSignedOutKey = (diagnosis) => [
33
+ `Run pushary login, or re-run ${NPX_LATEST_COMMAND} setup, to connect this computer again.`,
34
+ ...diagnosis.deadExport ? [`${diagnosis.deadExport.path} line ${diagnosis.deadExport.line} still exports the old key (${keyPrefix(diagnosis.deadExport.key)}). Delete that line, or let login replace it, then open a new terminal.`] : []
35
+ ];
36
+ var readSignedOutDiagnosis = (activeKey, activeKeyVerdict) => diagnoseSignedOutKey({
37
+ configKey: readConfigFileKey(),
38
+ macAppKeyPrefix: readMacAppKeyPrefix(),
39
+ activeKey,
40
+ activeKeyVerdict,
41
+ exportedKey: findExportedKeyLine()
42
+ });
43
+
44
+ export {
45
+ activeKeyVerdictOf,
46
+ SIGNED_OUT_ON_MAC_MESSAGE,
47
+ describeSignedOutKey,
48
+ readSignedOutDiagnosis
49
+ };
@@ -5,16 +5,16 @@ import {
5
5
  import {
6
6
  NOTIFICATION_MATCHED_TYPES,
7
7
  POSTTOOLUSE_MIRRORED_TOOLS
8
- } from "./chunk-6DJTDHBI.js";
8
+ } from "./chunk-CD47ZFFZ.js";
9
9
  import {
10
10
  isProtectedByScope,
11
11
  registerHookEntry
12
- } from "./chunk-ZUTU43FT.js";
12
+ } from "./chunk-ZBHUHJG6.js";
13
13
  import {
14
14
  CLAUDE_PRETOOLUSE_MATCHER,
15
15
  HOOK_BUDGETS,
16
16
  HOOK_LOCATOR_BINARY
17
- } from "./chunk-QR6VE5ME.js";
17
+ } from "./chunk-I5IJRMNV.js";
18
18
 
19
19
  // src/gemini-config.ts
20
20
  var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
@@ -0,0 +1,77 @@
1
+ import {
2
+ openCodePluginArgv,
3
+ openCodePluginFile
4
+ } from "./chunk-MFF3ONG5.js";
5
+ import {
6
+ compatibleConfigFile
7
+ } from "./chunk-KHNFLYJO.js";
8
+ import {
9
+ hookOwnerOf,
10
+ hookOwnerOfCommands
11
+ } from "./chunk-YIG2R3BJ.js";
12
+ import {
13
+ liveBridgeProbe,
14
+ resolveBridgeStub
15
+ } from "./chunk-2QGYMY7A.js";
16
+ import {
17
+ claudeSettings,
18
+ codexHooksJson,
19
+ cursorUserHooks,
20
+ geminiSettings,
21
+ pusharyDir,
22
+ vscodePluginDir
23
+ } from "./chunk-ZBHUHJG6.js";
24
+ import {
25
+ readJsonSafe
26
+ } from "./chunk-T7E75EKA.js";
27
+ import {
28
+ HOOK_COMPATIBLE_PROFILES,
29
+ HOOK_LOCATOR_BINARY,
30
+ hookCompatibleProfile
31
+ } from "./chunk-I5IJRMNV.js";
32
+
33
+ // src/setup/agent-hook-owner.ts
34
+ import { readFileSync } from "fs";
35
+ import { join } from "path";
36
+ var COMPATIBLE_HOOK_FILES = Object.fromEntries(
37
+ HOOK_COMPATIBLE_PROFILES.map((profile) => [profile.agentType, () => compatibleConfigFile(profile)])
38
+ );
39
+ var HOOK_FILES = {
40
+ claude_code: claudeSettings,
41
+ codex: codexHooksJson,
42
+ gemini_cli: geminiSettings,
43
+ cursor: cursorUserHooks,
44
+ vscode: () => join(vscodePluginDir(), "hooks", "hooks.json"),
45
+ ...COMPATIBLE_HOOK_FILES
46
+ };
47
+ var agentHookFile = (agent) => HOOK_FILES[agent]?.() ?? null;
48
+ var agentHookOwner = (agent, appAvailable) => {
49
+ const file = agentHookFile(agent);
50
+ if (!file) return "none";
51
+ const document = readJsonSafe(file);
52
+ const profile = hookCompatibleProfile(agent);
53
+ return hookOwnerOf(
54
+ document.kind === "ok" ? document.value : null,
55
+ appAvailable,
56
+ profile ? profile.hooksKeyPath : void 0
57
+ );
58
+ };
59
+ var readTextOrNull = (path) => {
60
+ try {
61
+ return readFileSync(path, "utf-8");
62
+ } catch {
63
+ return null;
64
+ }
65
+ };
66
+ var openCodePluginOwner = (appAvailable, pluginFile = openCodePluginFile()) => {
67
+ const contents = readTextOrNull(pluginFile);
68
+ return hookOwnerOfCommands(contents === null ? [] : openCodePluginArgv(contents) ?? [], appAvailable);
69
+ };
70
+ var macAppBridgeAvailable = () => resolveBridgeStub(join(pusharyDir(), "bin", HOOK_LOCATOR_BINARY), liveBridgeProbe()).kind === "bundle";
71
+
72
+ export {
73
+ agentHookFile,
74
+ agentHookOwner,
75
+ openCodePluginOwner,
76
+ macAppBridgeAvailable
77
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-STQRUH3S.js";
3
+ } from "./chunk-7DVNSQWF.js";
4
4
 
5
5
  // src/config.ts
6
6
  import { readFileSync } from "fs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODEX_HOOK_STATUS
3
- } from "./chunk-H7MMU64M.js";
3
+ } from "./chunk-MGRFDGWU.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-STQRUH3S.js";
6
+ } from "./chunk-7DVNSQWF.js";
7
7
 
8
8
  // src/setup/codex-trust.ts
9
9
  var CODEX_TRUST_TELEMETRY = {