@pushary/agent-hooks 1.7.1 → 1.7.3

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 (106) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/data/cursor-plugin/CHANGELOG.md +1 -0
  3. package/data/cursor-plugin/scripts/pushary-gate.mjs +3 -3
  4. package/data/cursor-plugin/scripts/pushary-gate.test.mjs +23 -1
  5. package/data/vscode-plugin/CHANGELOG.md +1 -0
  6. package/data/vscode-plugin/scripts/pushary-gate.mjs +3 -3
  7. package/dist/bin/pushary-bell-hook.js +23 -23
  8. package/dist/bin/pushary-bell.js +10 -10
  9. package/dist/bin/pushary-claude.js +48 -37
  10. package/dist/bin/pushary-clean.js +107 -60
  11. package/dist/bin/pushary-codex-bridge.js +18 -17
  12. package/dist/bin/pushary-codex-hook.js +53 -39
  13. package/dist/bin/pushary-codex.js +14 -12
  14. package/dist/bin/pushary-connect.js +16 -16
  15. package/dist/bin/pushary-cowork.js +5 -5
  16. package/dist/bin/pushary-daemon.js +27 -27
  17. package/dist/bin/pushary-disconnect.js +19 -17
  18. package/dist/bin/pushary-doctor.js +63 -35
  19. package/dist/bin/pushary-elicitation-hook.js +35 -26
  20. package/dist/bin/pushary-gemini-bridge.js +12 -12
  21. package/dist/bin/pushary-gemini-hook.js +47 -32
  22. package/dist/bin/pushary-hook.js +34 -32
  23. package/dist/bin/pushary-login.js +16 -16
  24. package/dist/bin/pushary-logout.js +8 -8
  25. package/dist/bin/pushary-mcp.js +9 -8
  26. package/dist/bin/pushary-mode.js +10 -10
  27. package/dist/bin/pushary-notification-hook.js +29 -27
  28. package/dist/bin/pushary-opencode-hook.js +46 -32
  29. package/dist/bin/pushary-permission-denied-hook.js +34 -32
  30. package/dist/bin/pushary-permission-hook.js +33 -31
  31. package/dist/bin/pushary-post-hook.js +29 -27
  32. package/dist/bin/pushary-prompt-hook.js +29 -27
  33. package/dist/bin/pushary-session-end-hook.js +29 -27
  34. package/dist/bin/pushary-session-start-hook.js +33 -31
  35. package/dist/bin/pushary-setup.js +69 -56
  36. package/dist/bin/pushary-stats.js +5 -5
  37. package/dist/bin/pushary-status.js +19 -19
  38. package/dist/bin/pushary-stop-hook.js +29 -27
  39. package/dist/bin/pushary-stopfailure-hook.js +29 -27
  40. package/dist/bin/pushary-suggestions.js +5 -5
  41. package/dist/bin/pushary-transcript-register.js +19 -19
  42. package/dist/bin/pushary-transcripts.js +7 -7
  43. package/dist/bin/pushary-upgrade.js +20 -20
  44. package/dist/bin/pushary-wait.js +10 -10
  45. package/dist/bin/pushary.js +6 -6
  46. package/dist/{chunk-MWVCDP64.js → chunk-3EUBQARL.js} +1 -1
  47. package/dist/{chunk-3QORH5EJ.js → chunk-5GB22QYL.js} +6 -4
  48. package/dist/chunk-5OP5MQI7.js +45 -0
  49. package/dist/{chunk-6PV2JQ64.js → chunk-5S2VBSJI.js} +2 -2
  50. package/dist/{chunk-UPKP67TA.js → chunk-62CVUUNU.js} +2 -2
  51. package/dist/{chunk-42XR73I2.js → chunk-62VT3BPH.js} +35 -35
  52. package/dist/chunk-6JQFIHZC.js +99 -0
  53. package/dist/{chunk-2FU43B5Q.js → chunk-7OA34PNW.js} +2 -2
  54. package/dist/{chunk-7GI6QC3M.js → chunk-7RUJKCR4.js} +2 -2
  55. package/dist/{chunk-H6JV44TE.js → chunk-AWVNAYGD.js} +1 -1
  56. package/dist/{chunk-XMN37YJH.js → chunk-BGBLLHZ4.js} +1 -1
  57. package/dist/{chunk-VCMFKZON.js → chunk-BIH2Y2HP.js} +2 -2
  58. package/dist/{chunk-YZKS3ME3.js → chunk-D6OODZCM.js} +2 -2
  59. package/dist/{chunk-JTQDP4ZL.js → chunk-DUQO4C4I.js} +3 -3
  60. package/dist/{chunk-3QE3BHBW.js → chunk-EADXTSHE.js} +2 -2
  61. package/dist/{chunk-43SSQCWO.js → chunk-EEEJ2JIL.js} +3 -3
  62. package/dist/{chunk-4C4NRDIC.js → chunk-EUGNVLMG.js} +1 -1
  63. package/dist/{chunk-WSC53O7I.js → chunk-G3OMOTJ4.js} +3 -3
  64. package/dist/{chunk-XFNVG3OV.js → chunk-G4GLCLKK.js} +44 -9
  65. package/dist/{chunk-62TEPRWQ.js → chunk-G62JL2NT.js} +1 -1
  66. package/dist/{chunk-QPR33SHS.js → chunk-G6RRVJOG.js} +6 -6
  67. package/dist/{chunk-Y6GKOZBT.js → chunk-IPSRMLCJ.js} +1 -1
  68. package/dist/{chunk-MCNS4725.js → chunk-IRZG3HEU.js} +1 -1
  69. package/dist/{chunk-55RO62FV.js → chunk-IWJKSIB4.js} +1 -1
  70. package/dist/{chunk-NID4UZDN.js → chunk-KEL5MXRL.js} +1 -1
  71. package/dist/{chunk-BYVB3RX3.js → chunk-KJXUIPS4.js} +2 -2
  72. package/dist/{chunk-SNWNA3MQ.js → chunk-LHC45YUC.js} +1 -1
  73. package/dist/{chunk-XPTCPU6V.js → chunk-LPNJLKBQ.js} +1 -1
  74. package/dist/{chunk-WZWXBTRF.js → chunk-MIXWMA73.js} +3 -3
  75. package/dist/{chunk-454KMJHF.js → chunk-MZBRL5H5.js} +34 -1
  76. package/dist/{chunk-KSNAAMU5.js → chunk-N5MZH5A6.js} +4 -4
  77. package/dist/chunk-N6IOSZOE.js +185 -0
  78. package/dist/{chunk-XPMOCJHN.js → chunk-NOI3XTCY.js} +1 -1
  79. package/dist/{chunk-NAAZCNKI.js → chunk-O3JDWNLU.js} +351 -37
  80. package/dist/{chunk-7GYGVQBU.js → chunk-OTNOANMX.js} +8 -8
  81. package/dist/{chunk-P5CBNSYL.js → chunk-OVC5QXN5.js} +1 -1
  82. package/dist/{chunk-O5JD7UI5.js → chunk-P2VIBGXA.js} +3 -3
  83. package/dist/{chunk-3T35OE7C.js → chunk-PRNFSORD.js} +4 -4
  84. package/dist/{chunk-OAL44FM2.js → chunk-R6OYCUNK.js} +1 -1
  85. package/dist/{chunk-6SJQ442W.js → chunk-RLW3JWDY.js} +2 -2
  86. package/dist/{chunk-SVEMF2VO.js → chunk-TCVMK6GI.js} +4 -4
  87. package/dist/{chunk-O5PRIYFZ.js → chunk-U4TMAANR.js} +3 -0
  88. package/dist/{chunk-WM3U2RUK.js → chunk-U6RVDUJ5.js} +75 -232
  89. package/dist/{chunk-KBLIVEFJ.js → chunk-UOQRM7JQ.js} +5 -5
  90. package/dist/{chunk-NQFGVAT6.js → chunk-VE7TXLR4.js} +19 -2
  91. package/dist/{chunk-IGBDOZUO.js → chunk-VKVSRCBO.js} +1 -1
  92. package/dist/{chunk-ZEMSCGDD.js → chunk-VYPJHGG6.js} +8 -3
  93. package/dist/{chunk-YQN7S57T.js → chunk-WGMW7OXW.js} +6 -6
  94. package/dist/{chunk-OTZHT34O.js → chunk-WPX67AKT.js} +1 -1
  95. package/dist/{chunk-XDASEYRS.js → chunk-WTJM7PSL.js} +3 -3
  96. package/dist/{chunk-Q7QRR6YL.js → chunk-Y4ZH64UK.js} +2 -2
  97. package/dist/{chunk-ZIIYTQHC.js → chunk-YC27PROF.js} +12 -4
  98. package/dist/{chunk-AHWJHLG5.js → chunk-YPUBA2FL.js} +7 -5
  99. package/dist/{chunk-EIZW73P5.js → chunk-YYCTF4Q5.js} +1 -1
  100. package/dist/{chunk-AAGLDXH4.js → chunk-ZKJ34T2F.js} +5 -5
  101. package/dist/{reapply-66GQIBXN.js → reapply-PH5T4BGR.js} +9 -9
  102. package/dist/src/index.d.ts +1 -0
  103. package/dist/src/index.js +22 -20
  104. package/package.json +2 -1
  105. package/dist/chunk-JMBG47WV.js +0 -336
  106. package/dist/chunk-YHG74UFF.js +0 -12
@@ -6,17 +6,17 @@ import {
6
6
  } from "../chunk-SGZJ5LYH.js";
7
7
  import {
8
8
  transcriptsEnabled
9
- } from "../chunk-XPTCPU6V.js";
9
+ } from "../chunk-LPNJLKBQ.js";
10
10
  import {
11
11
  exitOnHelpFlag
12
- } from "../chunk-6PV2JQ64.js";
13
- import "../chunk-YZKS3ME3.js";
12
+ } from "../chunk-5S2VBSJI.js";
13
+ import "../chunk-D6OODZCM.js";
14
14
  import "../chunk-KZERVKTD.js";
15
- import "../chunk-UPKP67TA.js";
15
+ import "../chunk-62CVUUNU.js";
16
16
  import "../chunk-T7E75EKA.js";
17
- import "../chunk-OAL44FM2.js";
18
- import "../chunk-EIZW73P5.js";
19
- import "../chunk-XFNVG3OV.js";
17
+ import "../chunk-R6OYCUNK.js";
18
+ import "../chunk-YYCTF4Q5.js";
19
+ import "../chunk-G4GLCLKK.js";
20
20
 
21
21
  // bin/pushary-transcripts.ts
22
22
  exitOnHelpFlag("transcripts");
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  describeCodexTrustConfirmation
4
- } from "../chunk-H6JV44TE.js";
4
+ } from "../chunk-AWVNAYGD.js";
5
5
  import {
6
6
  ensureCodexTrustAfterReapply,
7
7
  reapplyAllAgents
8
- } from "../chunk-QPR33SHS.js";
9
- import "../chunk-Y6GKOZBT.js";
10
- import "../chunk-6SJQ442W.js";
8
+ } from "../chunk-G6RRVJOG.js";
9
+ import "../chunk-IPSRMLCJ.js";
10
+ import "../chunk-RLW3JWDY.js";
11
11
  import {
12
12
  waitForMachineReadiness
13
- } from "../chunk-YQN7S57T.js";
14
- import "../chunk-WSC53O7I.js";
13
+ } from "../chunk-WGMW7OXW.js";
14
+ import "../chunk-G3OMOTJ4.js";
15
15
  import {
16
16
  detectProviderLiveCapabilities,
17
17
  hasSpawnProvider,
18
18
  resolveControlPolicy
19
- } from "../chunk-Q7QRR6YL.js";
19
+ } from "../chunk-Y4ZH64UK.js";
20
20
  import {
21
21
  AUTO_UPDATE_DISABLE_ENV,
22
22
  describeAutoUpdateCheck,
@@ -27,8 +27,8 @@ import {
27
27
  readAutoUpdateState,
28
28
  updateAutoUpdateState,
29
29
  upgradeEntryFor
30
- } from "../chunk-BYVB3RX3.js";
31
- import "../chunk-XDASEYRS.js";
30
+ } from "../chunk-KJXUIPS4.js";
31
+ import "../chunk-WTJM7PSL.js";
32
32
  import {
33
33
  daemonHasRemoteProof,
34
34
  daemonServiceManagerAvailable,
@@ -39,24 +39,24 @@ import {
39
39
  replaceDaemonService,
40
40
  stopDaemonService,
41
41
  waitForDaemonRemoteProof
42
- } from "../chunk-AAGLDXH4.js";
43
- import "../chunk-WZWXBTRF.js";
42
+ } from "../chunk-ZKJ34T2F.js";
43
+ import "../chunk-MIXWMA73.js";
44
44
  import {
45
45
  needsShell
46
46
  } from "../chunk-XHKBHWLX.js";
47
- import "../chunk-4C4NRDIC.js";
47
+ import "../chunk-EUGNVLMG.js";
48
48
  import "../chunk-POFBE6ZY.js";
49
49
  import {
50
50
  exitOnHelpFlag
51
- } from "../chunk-6PV2JQ64.js";
51
+ } from "../chunk-5S2VBSJI.js";
52
52
  import {
53
53
  readControlMode
54
- } from "../chunk-YZKS3ME3.js";
55
- import "../chunk-P5CBNSYL.js";
54
+ } from "../chunk-D6OODZCM.js";
55
+ import "../chunk-OVC5QXN5.js";
56
56
  import {
57
57
  EXIT
58
58
  } from "../chunk-KZERVKTD.js";
59
- import "../chunk-UPKP67TA.js";
59
+ import "../chunk-62CVUUNU.js";
60
60
  import {
61
61
  LATEST_TAG,
62
62
  autoUpdateLock,
@@ -72,21 +72,21 @@ import {
72
72
  npmErrorMessage,
73
73
  resolveGlobalBinary,
74
74
  vscodePluginDir
75
- } from "../chunk-454KMJHF.js";
75
+ } from "../chunk-MZBRL5H5.js";
76
76
  import "../chunk-T7E75EKA.js";
77
77
  import {
78
78
  getApiKey
79
- } from "../chunk-OAL44FM2.js";
79
+ } from "../chunk-R6OYCUNK.js";
80
80
  import {
81
81
  NPX_LATEST_COMMAND
82
- } from "../chunk-EIZW73P5.js";
82
+ } from "../chunk-YYCTF4Q5.js";
83
83
  import {
84
84
  isNewerVersion,
85
85
  isReleaseVersion,
86
86
  isSameMajorVersion,
87
87
  ownPackageRoot,
88
88
  packageVersionAt
89
- } from "../chunk-XFNVG3OV.js";
89
+ } from "../chunk-G4GLCLKK.js";
90
90
 
91
91
  // bin/pushary-upgrade.ts
92
92
  import { existsSync } from "fs";
@@ -4,33 +4,33 @@ import {
4
4
  } from "../chunk-CVWG2N3Y.js";
5
5
  import {
6
6
  exitOnFailedResponse
7
- } from "../chunk-3T35OE7C.js";
8
- import "../chunk-43SSQCWO.js";
7
+ } from "../chunk-PRNFSORD.js";
9
8
  import {
10
9
  createIo
11
- } from "../chunk-O5PRIYFZ.js";
10
+ } from "../chunk-U4TMAANR.js";
12
11
  import {
13
12
  exitOnHelpFlag
14
- } from "../chunk-6PV2JQ64.js";
13
+ } from "../chunk-5S2VBSJI.js";
15
14
  import {
16
15
  rejectUnknownFlags
17
16
  } from "../chunk-GMXKITVA.js";
18
- import "../chunk-JTQDP4ZL.js";
19
- import "../chunk-P5CBNSYL.js";
17
+ import "../chunk-EEEJ2JIL.js";
18
+ import "../chunk-DUQO4C4I.js";
19
+ import "../chunk-OVC5QXN5.js";
20
20
  import {
21
21
  UsageError
22
22
  } from "../chunk-7QLSKOSU.js";
23
23
  import {
24
24
  EXIT
25
25
  } from "../chunk-KZERVKTD.js";
26
- import "../chunk-454KMJHF.js";
26
+ import "../chunk-MZBRL5H5.js";
27
27
  import "../chunk-T7E75EKA.js";
28
28
  import {
29
29
  getApiKey,
30
30
  getBaseUrl
31
- } from "../chunk-OAL44FM2.js";
32
- import "../chunk-EIZW73P5.js";
33
- import "../chunk-XFNVG3OV.js";
31
+ } from "../chunk-R6OYCUNK.js";
32
+ import "../chunk-YYCTF4Q5.js";
33
+ import "../chunk-G4GLCLKK.js";
34
34
 
35
35
  // bin/pushary-wait.ts
36
36
  exitOnHelpFlag("wait");
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  installNetworkDefaults
4
- } from "../chunk-JTQDP4ZL.js";
5
- import "../chunk-P5CBNSYL.js";
4
+ } from "../chunk-DUQO4C4I.js";
5
+ import "../chunk-OVC5QXN5.js";
6
6
  import "../chunk-7QLSKOSU.js";
7
7
  import {
8
8
  EXIT
9
9
  } from "../chunk-KZERVKTD.js";
10
- import "../chunk-454KMJHF.js";
10
+ import "../chunk-MZBRL5H5.js";
11
11
  import "../chunk-T7E75EKA.js";
12
- import "../chunk-OAL44FM2.js";
12
+ import "../chunk-R6OYCUNK.js";
13
13
  import {
14
14
  COMMANDS,
15
15
  isCommandName,
16
16
  renderHelp
17
- } from "../chunk-EIZW73P5.js";
17
+ } from "../chunk-YYCTF4Q5.js";
18
18
  import {
19
19
  getPackageVersion
20
- } from "../chunk-XFNVG3OV.js";
20
+ } from "../chunk-G4GLCLKK.js";
21
21
 
22
22
  // src/cli/runtime.ts
23
23
  var supportsRuntime = (version) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOOK_LOCATOR_BINARY
3
- } from "./chunk-XFNVG3OV.js";
3
+ } from "./chunk-G4GLCLKK.js";
4
4
 
5
5
  // src/diagnostics/bridge.ts
6
6
  import { execFileSync } from "child_process";
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  AUTO_DECISION_WINDOW_MS,
3
- DEFAULT_SESSION,
4
3
  canonicalGateInputs,
5
4
  claimThrottle,
6
5
  deriveToolTarget,
7
6
  permissionDeniedAction,
8
7
  releaseThrottle,
9
8
  reportEvent
10
- } from "./chunk-WM3U2RUK.js";
9
+ } from "./chunk-U6RVDUJ5.js";
10
+ import {
11
+ DEFAULT_SESSION
12
+ } from "./chunk-N6IOSZOE.js";
11
13
  import {
12
14
  canonicalJson
13
- } from "./chunk-454KMJHF.js";
15
+ } from "./chunk-MZBRL5H5.js";
14
16
  import {
15
17
  writeFileAtomic
16
18
  } from "./chunk-T7E75EKA.js";
@@ -20,7 +22,7 @@ import {
20
22
  machineDecisionFor,
21
23
  shouldDeferToNativeMode,
22
24
  wireVerdictFor
23
- } from "./chunk-XFNVG3OV.js";
25
+ } from "./chunk-G4GLCLKK.js";
24
26
 
25
27
  // src/machine-decision-audit.ts
26
28
  import { basename } from "path";
@@ -0,0 +1,45 @@
1
+ import {
2
+ DEFAULT_SESSION
3
+ } from "./chunk-N6IOSZOE.js";
4
+
5
+ // src/answer.ts
6
+ var denyReasonFrom = (value, note) => {
7
+ const trimmed = note?.trim();
8
+ if (trimmed) return `Denied from your phone: ${trimmed}`;
9
+ return value && value !== "no" && value !== "yes" ? `Denied from your phone: ${value}` : "Denied via push notification";
10
+ };
11
+ var isDeferAnswer = (value) => value === "defer";
12
+
13
+ // src/session-notice.ts
14
+ import { existsSync, writeFileSync } from "fs";
15
+ import { tmpdir } from "os";
16
+ import { join } from "path";
17
+ var SUBSCRIPTION_REQUIRED_NOTICE_KIND = "subscription-required";
18
+ var oncePerSession = (kind, sessionId) => {
19
+ try {
20
+ const key = (sessionId || DEFAULT_SESSION).replace(/[^a-zA-Z0-9_-]/g, "");
21
+ const marker = join(tmpdir(), `pushary-${kind}-${key}`);
22
+ if (existsSync(marker)) return false;
23
+ writeFileSync(marker, "1", "utf-8");
24
+ return true;
25
+ } catch {
26
+ return false;
27
+ }
28
+ };
29
+ var subscriptionRequiredNotice = (upgradeUrl) => `[pushary] Your Pushary workspace has no active subscription, so approvals stay with your agent. Subscribe: ${upgradeUrl}`;
30
+ var announceSubscriptionRequired = (upgradeUrl, sessionId) => {
31
+ try {
32
+ if (!oncePerSession(SUBSCRIPTION_REQUIRED_NOTICE_KIND, sessionId)) return;
33
+ process.stderr.write(`${subscriptionRequiredNotice(upgradeUrl)}
34
+ `);
35
+ } catch {
36
+ return;
37
+ }
38
+ };
39
+
40
+ export {
41
+ denyReasonFrom,
42
+ isDeferAnswer,
43
+ oncePerSession,
44
+ announceSubscriptionRequired
45
+ };
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-KZERVKTD.js";
4
4
  import {
5
5
  renderCommandHelp
6
- } from "./chunk-EIZW73P5.js";
6
+ } from "./chunk-YYCTF4Q5.js";
7
7
  import {
8
8
  getPackageVersion
9
- } from "./chunk-XFNVG3OV.js";
9
+ } from "./chunk-G4GLCLKK.js";
10
10
 
11
11
  // src/cli/usage.ts
12
12
  var exitOnHelpFlag = (command) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-OAL44FM2.js";
3
+ } from "./chunk-R6OYCUNK.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-XFNVG3OV.js";
6
+ } from "./chunk-G4GLCLKK.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  activeHookSource,
3
3
  activeIdentity
4
- } from "./chunk-KBLIVEFJ.js";
4
+ } from "./chunk-UOQRM7JQ.js";
5
5
  import {
6
6
  blockedActionFingerprint,
7
7
  defersToNativeMode,
@@ -9,17 +9,18 @@ import {
9
9
  hasBlockedActionHint,
10
10
  recordBlockedActionHint,
11
11
  reportMachineDenial
12
- } from "./chunk-3QORH5EJ.js";
12
+ } from "./chunk-5GB22QYL.js";
13
13
  import {
14
14
  isGatingMoment,
15
15
  recordKeylessMoment
16
- } from "./chunk-MCNS4725.js";
16
+ } from "./chunk-IRZG3HEU.js";
17
17
  import {
18
+ announceSubscriptionRequired,
18
19
  denyReasonFrom,
19
- isDeferAnswer
20
- } from "./chunk-YHG74UFF.js";
20
+ isDeferAnswer,
21
+ oncePerSession
22
+ } from "./chunk-5OP5MQI7.js";
21
23
  import {
22
- DEFAULT_SESSION,
23
24
  UNNAMED_ACTION,
24
25
  claimThrottle,
25
26
  deriveAction,
@@ -36,9 +37,13 @@ import {
36
37
  reportEvent,
37
38
  scopePathFor,
38
39
  settleQuestionsForToolUse
39
- } from "./chunk-WM3U2RUK.js";
40
+ } from "./chunk-U6RVDUJ5.js";
41
+ import {
42
+ DEFAULT_SESSION
43
+ } from "./chunk-N6IOSZOE.js";
40
44
  import {
41
45
  DECISION_STOP_REASON,
46
+ UNVERIFIABLE_APPROVAL_REASON,
42
47
  askUser,
43
48
  cancelQuestion,
44
49
  claimBlockedAction,
@@ -48,14 +53,17 @@ import {
48
53
  requestGate,
49
54
  sendNotification,
50
55
  waitForQuestion
51
- } from "./chunk-ZIIYTQHC.js";
56
+ } from "./chunk-YC27PROF.js";
57
+ import {
58
+ SubscriptionRequiredError
59
+ } from "./chunk-VE7TXLR4.js";
52
60
  import {
53
61
  getMachineId
54
- } from "./chunk-P5CBNSYL.js";
62
+ } from "./chunk-OVC5QXN5.js";
55
63
  import {
56
64
  getApiKey,
57
65
  getBaseUrl
58
- } from "./chunk-OAL44FM2.js";
66
+ } from "./chunk-R6OYCUNK.js";
59
67
  import {
60
68
  AGENT_QUESTION_STRATEGY,
61
69
  GATE_BLOCK_REASON_MAX_LENGTH,
@@ -83,7 +91,7 @@ import {
83
91
  parseAgentQuestions,
84
92
  resolveGate,
85
93
  stoppedOutput
86
- } from "./chunk-XFNVG3OV.js";
94
+ } from "./chunk-G4GLCLKK.js";
87
95
 
88
96
  // src/claude-permission-rules.ts
89
97
  import { readFileSync, statSync } from "fs";
@@ -152,9 +160,7 @@ var reportDecisionEpisode = async (apiKey, input) => {
152
160
  };
153
161
 
154
162
  // src/hook.ts
155
- import { basename, join as join2 } from "path";
156
- import { tmpdir } from "os";
157
- import { existsSync, writeFileSync } from "fs";
163
+ import { basename } from "path";
158
164
  var START_MS = Date.now();
159
165
  var ACTIVE_AGENT = activeIdentity(process.argv);
160
166
  var ACTIVE_SOURCE = activeHookSource(process.argv);
@@ -164,6 +170,11 @@ var deny = (reason) => claudePreToolUseOutput("deny", reason);
164
170
  var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
165
171
  var ask = (reason) => claudePreToolUseOutput("ask", reason);
166
172
  var halted = (reason) => stoppedOutput(deny(reason), reason);
173
+ var outcomeOfFailedAsk = (error, sessionId, failure) => {
174
+ if (!(error instanceof SubscriptionRequiredError)) return failure;
175
+ announceSubscriptionRequired(error.upgradeUrl, sessionId);
176
+ return void 0;
177
+ };
167
178
  var storedWaitDeadline = (result, requestedDeadline) => {
168
179
  const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
169
180
  return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
@@ -187,8 +198,8 @@ var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, ti
187
198
  waitEndsAt: timeoutAction !== "approve" && timeoutAction !== "deny" || clampCut ? new Date(requestedDeadline).toISOString() : void 0,
188
199
  ...decision
189
200
  });
190
- } catch {
191
- return halted("Pushary could not create a verifiable approval. Retry the action.");
201
+ } catch (error) {
202
+ return outcomeOfFailedAsk(error, sessionId, halted(UNVERIFIABLE_APPROVAL_REASON));
192
203
  }
193
204
  if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
194
205
  const deadline = storedWaitDeadline(result, requestedDeadline);
@@ -232,8 +243,8 @@ var handlePushFirst = async (apiKey, description, projectName, pushFirstSeconds,
232
243
  waitEndsAt: new Date(requestedDeadline).toISOString(),
233
244
  ...decision
234
245
  });
235
- } catch {
236
- return halted("Pushary could not create a verifiable approval. Retry the action.");
246
+ } catch (error) {
247
+ return outcomeOfFailedAsk(error, sessionId, halted(UNVERIFIABLE_APPROVAL_REASON));
237
248
  }
238
249
  if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
239
250
  if (!isLocalQuestionHandoff(result) && !result.answered) announceWait(pushFirstSeconds, result.answerUrl, sessionId);
@@ -344,17 +355,6 @@ var announceWait = (waitSeconds, answerUrl, sessionId) => {
344
355
  }
345
356
  };
346
357
  var KEYLESS_NOTICE = "[pushary] Not connected (no API key), so your agent runs untouched. Approval moments are counted locally; see them with: npx @pushary/agent-hooks@latest stats. Connect: https://pushary.com/sign-up?utm_source=cli&utm_medium=keyless-hook";
347
- var oncePerSession = (kind, sessionId) => {
348
- try {
349
- const key = (sessionId || DEFAULT_SESSION).replace(/[^a-zA-Z0-9_-]/g, "");
350
- const marker = join2(tmpdir(), `pushary-${kind}-${key}`);
351
- if (existsSync(marker)) return false;
352
- writeFileSync(marker, "1", "utf-8");
353
- return true;
354
- } catch {
355
- return false;
356
- }
357
- };
358
358
  var keylessNoticeOnce = (sessionId) => {
359
359
  try {
360
360
  if (!oncePerSession("keyless", sessionId)) return;
@@ -391,8 +391,8 @@ var askAsOneCard = async (apiKey, input, parsed, projectName, deadline) => {
391
391
  toolUseId: input.tool_use_id,
392
392
  waitEndsAt: new Date(deadline).toISOString()
393
393
  });
394
- } catch {
395
- return null;
394
+ } catch (error) {
395
+ return outcomeOfFailedAsk(error, input.session_id, null);
396
396
  }
397
397
  if (isDecisionStopped(result)) return null;
398
398
  const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
@@ -424,8 +424,8 @@ var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline)
424
424
  toolUseId: input.tool_use_id ? `${input.tool_use_id}#q${index}` : void 0,
425
425
  waitEndsAt: new Date(deadline).toISOString()
426
426
  });
427
- } catch {
428
- return null;
427
+ } catch (error) {
428
+ return outcomeOfFailedAsk(error, input.session_id, null);
429
429
  }
430
430
  if (isDecisionStopped(result)) return null;
431
431
  const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
@@ -478,8 +478,8 @@ var handleExitPlanMode = async (apiKey, input) => {
478
478
  blocker: "Waiting for you to approve the plan",
479
479
  waitEndsAt: new Date(deadline).toISOString()
480
480
  });
481
- } catch {
482
- return halted(DECISION_STOP_REASON);
481
+ } catch (error) {
482
+ return outcomeOfFailedAsk(error, input.session_id, halted(DECISION_STOP_REASON));
483
483
  }
484
484
  if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
485
485
  const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
@@ -0,0 +1,99 @@
1
+ import {
2
+ pusharyHookExecutable
3
+ } from "./chunk-WTJM7PSL.js";
4
+ import {
5
+ isProtectedByScope,
6
+ registerHookEntry
7
+ } from "./chunk-MZBRL5H5.js";
8
+
9
+ // src/skills-cli.ts
10
+ import { execSync } from "child_process";
11
+ var PUSHARY_SKILL_SOURCE = "Pushary/pushary-skill";
12
+ var PUSHARY_SKILL_NAME = "pushary";
13
+ var installSkillViaSkillsCli = (agent) => {
14
+ try {
15
+ execSync(`npx -y skills@latest add ${PUSHARY_SKILL_SOURCE}@${PUSHARY_SKILL_NAME} -y -g --agent ${agent}`, {
16
+ stdio: "pipe",
17
+ timeout: 9e4
18
+ });
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ };
24
+ var installAgentSkill = async (request, effects) => {
25
+ if (request.skillsCliInUse) {
26
+ const startedAt = effects.now();
27
+ if (effects.runSkillsCli(request.agent)) {
28
+ const modifiedAt = effects.skillModifiedAt(request.agentSkillDir);
29
+ if (modifiedAt !== null && modifiedAt >= startedAt) return "skills-cli";
30
+ }
31
+ }
32
+ await effects.writePackagedSkill(request.agentSkillDir);
33
+ return "packaged-copy";
34
+ };
35
+
36
+ // src/cursor-config.ts
37
+ var hookCommandOf = (entry) => {
38
+ const command = entry && typeof entry === "object" && !Array.isArray(entry) ? entry.command : void 0;
39
+ return typeof command === "string" ? command : "";
40
+ };
41
+ var isPusharyCursorEntry = (entry) => pusharyHookExecutable(hookCommandOf(entry)) !== null;
42
+ var registerCursorGate = (existing, entry) => registerHookEntry(existing, isPusharyCursorEntry, entry);
43
+ var withoutPusharyCursorHooks = (hooks, scope) => {
44
+ let removed = 0;
45
+ const kept = {};
46
+ for (const [event, entries] of Object.entries(hooks)) {
47
+ if (!Array.isArray(entries)) {
48
+ kept[event] = entries;
49
+ continue;
50
+ }
51
+ const others = entries.filter((entry) => !isPusharyCursorEntry(entry) || isProtectedByScope(hookCommandOf(entry), scope));
52
+ removed += entries.length - others.length;
53
+ if (others.length > 0 || entries.length === 0) kept[event] = others;
54
+ }
55
+ return { hooks: kept, removed };
56
+ };
57
+
58
+ // src/cli/dry-run.ts
59
+ import { execFileSync } from "child_process";
60
+ import { rmSync, writeFileSync } from "fs";
61
+ var createGuards = (isDryRun, note) => ({
62
+ write: (path, contents) => {
63
+ if (isDryRun()) return note("rewrite", path);
64
+ writeFileSync(path, contents, "utf-8");
65
+ },
66
+ remove: (path, options = {}) => {
67
+ if (isDryRun()) return note("remove ", path);
68
+ rmSync(path, { recursive: true, force: options.force ?? false });
69
+ },
70
+ execFile: (file, args, options, describe) => {
71
+ if (isDryRun()) return note("run ", describe);
72
+ execFileSync(file, args, options);
73
+ }
74
+ });
75
+ var describeService = (effects) => {
76
+ if (effects.controlMode === "off") return "skip the phone-start background service (--control off)";
77
+ const where = effects.serviceDefinitionPath ?? "the phone-start service definition";
78
+ const condition = effects.controlMode === "on" ? "" : ", when a supported agent and a service manager are present";
79
+ return `write ${where} and register it with the OS${condition}`;
80
+ };
81
+ var describeSetupSideEffects = (effects) => [
82
+ `run npm install -g @pushary/agent-hooks@${effects.version} (the hooks run from the global copy; up to two minutes)`,
83
+ `write ${effects.configFile} (the API key, mode 600)`,
84
+ effects.rcPath ? `edit ${effects.rcPath} (export PUSHARY_API_KEY)` : "print the export line for your shell, since no rc file was found",
85
+ describeService(effects),
86
+ "ask Add Pushary instructions to this project's CLAUDE.md/AGENTS.md? (default no)",
87
+ "ask Alias claude to pushary claude? (default no)"
88
+ ];
89
+
90
+ export {
91
+ PUSHARY_SKILL_SOURCE,
92
+ PUSHARY_SKILL_NAME,
93
+ installSkillViaSkillsCli,
94
+ installAgentSkill,
95
+ registerCursorGate,
96
+ withoutPusharyCursorHooks,
97
+ createGuards,
98
+ describeSetupSideEffects
99
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-NQFGVAT6.js";
3
+ } from "./chunk-VE7TXLR4.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-EIZW73P5.js";
6
+ } from "./chunk-YYCTF4Q5.js";
7
7
 
8
8
  // src/mcp-stdio-bridge.ts
9
9
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-7GYGVQBU.js";
3
+ } from "./chunk-OTNOANMX.js";
4
4
  import {
5
5
  writeDegraded
6
- } from "./chunk-KSNAAMU5.js";
6
+ } from "./chunk-N5MZH5A6.js";
7
7
 
8
8
  // src/tool-hook-input.ts
9
9
  var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-EIZW73P5.js";
3
+ } from "./chunk-YYCTF4Q5.js";
4
4
 
5
5
  // src/setup/codex-trust.ts
6
6
  var CODEX_TRUST_TELEMETRY = {
@@ -9,7 +9,7 @@ import {
9
9
  SETUP_CONNECT_MODES,
10
10
  isSetupConnectMode,
11
11
  isValidApiKey
12
- } from "./chunk-XFNVG3OV.js";
12
+ } from "./chunk-G4GLCLKK.js";
13
13
 
14
14
  // src/setup/options.ts
15
15
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -3,11 +3,11 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-O5JD7UI5.js";
6
+ } from "./chunk-P2VIBGXA.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
10
- } from "./chunk-OTZHT34O.js";
10
+ } from "./chunk-WPX67AKT.js";
11
11
 
12
12
  // src/live-session.ts
13
13
  var MAX_TRANSCRIPT_QUEUE = 100;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-UPKP67TA.js";
3
+ } from "./chunk-62CVUUNU.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-T7E75EKA.js";
10
10
  import {
11
11
  configFilePath
12
- } from "./chunk-OAL44FM2.js";
12
+ } from "./chunk-R6OYCUNK.js";
13
13
 
14
14
  // src/shell-alias.ts
15
15
  import { homedir } from "os";