@pushary/agent-hooks 0.79.0 → 0.80.0

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 (58) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +52 -0
  3. package/data/SKILL.md +16 -3
  4. package/data/cursor-plugin/skills/pushary/SKILL.md +15 -2
  5. package/data/vscode-plugin/skills/pushary/SKILL.md +15 -2
  6. package/dist/bin/pushary-bell-hook.d.ts +1 -0
  7. package/dist/bin/pushary-bell-hook.js +22 -0
  8. package/dist/bin/pushary-bell.d.ts +1 -0
  9. package/dist/bin/pushary-bell.js +203 -0
  10. package/dist/bin/pushary-claude.js +8 -7
  11. package/dist/bin/pushary-clean.js +14 -14
  12. package/dist/bin/pushary-codex-hook.js +8 -7
  13. package/dist/bin/pushary-codex.js +3 -2
  14. package/dist/bin/pushary-connect.js +15 -14
  15. package/dist/bin/pushary-daemon.js +5 -5
  16. package/dist/bin/pushary-doctor.js +34 -64
  17. package/dist/bin/pushary-gemini-hook.js +8 -7
  18. package/dist/bin/pushary-hook.js +11 -10
  19. package/dist/bin/pushary-login.js +15 -14
  20. package/dist/bin/pushary-logout.js +12 -11
  21. package/dist/bin/pushary-mode.js +7 -7
  22. package/dist/bin/pushary-notification-hook.js +3 -2
  23. package/dist/bin/pushary-permission-denied-hook.js +7 -6
  24. package/dist/bin/pushary-permission-hook.js +7 -6
  25. package/dist/bin/pushary-post-hook.js +3 -2
  26. package/dist/bin/pushary-prompt-hook.js +3 -2
  27. package/dist/bin/pushary-session-end-hook.js +3 -2
  28. package/dist/bin/pushary-session-start-hook.js +3 -2
  29. package/dist/bin/pushary-setup.js +131 -41
  30. package/dist/bin/pushary-stats.js +6 -6
  31. package/dist/bin/pushary-status.js +17 -16
  32. package/dist/bin/pushary-stop-hook.js +3 -2
  33. package/dist/bin/pushary-stopfailure-hook.js +3 -2
  34. package/dist/bin/pushary-suggestions.js +4 -4
  35. package/dist/bin/pushary-upgrade.js +10 -10
  36. package/dist/bin/pushary-wait.js +9 -9
  37. package/dist/bin/pushary.js +6 -5
  38. package/dist/chunk-22EQOB2T.js +212 -0
  39. package/dist/{chunk-PXE6HXRP.js → chunk-7DYFAM32.js} +1 -1
  40. package/dist/{chunk-QVOJF23R.js → chunk-A5DAEWBZ.js} +2 -2
  41. package/dist/{chunk-MGFZXUUR.js → chunk-BOMF4C2Q.js} +114 -14
  42. package/dist/{chunk-MDPSJR45.js → chunk-DUYM5SHH.js} +10 -1
  43. package/dist/{chunk-NHKWU7MN.js → chunk-E6I3DBJW.js} +8 -1
  44. package/dist/{chunk-NH7RW736.js → chunk-EBP4YG75.js} +1 -1
  45. package/dist/{chunk-NQTRA7H5.js → chunk-GQLB2GBJ.js} +3 -3
  46. package/dist/{chunk-HAP7UTZS.js → chunk-MHA2WB7S.js} +1 -1
  47. package/dist/chunk-PPD3HHNJ.js +44 -0
  48. package/dist/{chunk-TNG3EWFN.js → chunk-Q4QULGAV.js} +1 -1
  49. package/dist/{chunk-FCB6J5YC.js → chunk-R6AYBATA.js} +1 -1
  50. package/dist/{chunk-BBK3TTU2.js → chunk-RRZZ7TFJ.js} +1 -1
  51. package/dist/{chunk-KJFKEKTC.js → chunk-T6BNEQ2A.js} +23 -0
  52. package/dist/{chunk-VDHV6KAS.js → chunk-U2PZKYZM.js} +1 -1
  53. package/dist/{chunk-5Q64QDCR.js → chunk-UBUPETEQ.js} +2 -2
  54. package/dist/{chunk-IXZMT6IS.js → chunk-ULITFWLG.js} +8 -8
  55. package/dist/{chunk-EQJZS2LE.js → chunk-WYVKPLVT.js} +1 -1
  56. package/dist/{chunk-7OYGFJYZ.js → chunk-ZUKH2NPJ.js} +18 -0
  57. package/dist/src/index.js +7 -6
  58. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.80.0
4
+
5
+ ### A bell, free, for when you only need to know it finished
6
+
7
+ `npx @pushary/agent-hooks@latest bell` makes a noise in your terminal and raises
8
+ a desktop notification when Claude Code says an agent finished or is waiting on
9
+ you. No account, no API key, no network call. Nothing leaves your machine, and
10
+ `pushary bell --off` removes it without touching anything else.
11
+
12
+ If you run one agent, that is genuinely all you need and we would rather you did
13
+ not pay for more. Above three agents at once the bell says so, once a day, and
14
+ then stops talking, because a bell cannot tell you which of them is asking and
15
+ cannot reach you once you have walked away.
16
+
17
+ If you got here from `claude config set --global preferrednotifchannel
18
+ terminal_bell` and the `unknown option '--global'` error, the README now answers
19
+ that directly.
20
+
21
+ ### Setup waits for you to tap, instead of trusting that a push went out
22
+
23
+ Setup used to finish on a delivered notification. A notification that arrives
24
+ and cannot be answered looks exactly the same at that point, and that is the
25
+ most common way this quietly breaks: approvals keep arriving and keep going
26
+ unanswered.
27
+
28
+ So setup now sends a real question and waits for you to answer it, and only says
29
+ `Setup complete, and proven.` once you have. If nothing comes back it tells you
30
+ rather than congratulating you. It only does this when someone is actually
31
+ there, which includes a pairing you just scanned, and never in CI. Pass
32
+ `--verify push` for the old behaviour, or `--verify none` to skip the check.
33
+
34
+ `pushary doctor --roundtrip` runs the same check and now says the same things
35
+ about it.
36
+
37
+ ### Your agent works out when to reach you, without being told
38
+
39
+ The bundled skill used to describe itself only in terms of what you might say to
40
+ it: ping me on my phone, run this overnight. That only fires when you are there
41
+ to say something. It now also describes the moments that are true of the work
42
+ itself: about to do something irreversible, about to spend money or deploy,
43
+ blocked on a decision that is not the agent's to make, or a long task finishing
44
+ with nobody watching.
45
+
46
+ Everything it matched before, it still matches. Re-run
47
+ `npx @pushary/agent-hooks setup` to update the copy your agents already have.
48
+
3
49
  ## 0.79.0
4
50
 
5
51
  ### Your agent now says what kind of update it is sending, so you can route it
package/README.md CHANGED
@@ -24,6 +24,57 @@ There are three things.
24
24
 
25
25
  **Gate.** Risky shell commands (`rm -rf`, force pushes, history rewrites, database drops, deploys) are checked before they run. What happens is set by your dashboard policy: auto approve trusted read-only commands, push to your phone for approval, or hold for the phone and never auto-deny. If the check cannot run, the decision falls back to the agent's own permission prompt in the terminal; nothing is silently allowed. Without an API key configured, the hooks stay out of the way entirely and only count what they would have gated.
26
26
 
27
+ ## Just want a bell? That part is free.
28
+
29
+ If your agent runs in front of you and you only need to know when it finishes,
30
+ you do not need any of the above and you should not pay for it:
31
+
32
+ ```bash
33
+ npx @pushary/agent-hooks@latest bell
34
+ ```
35
+
36
+ That is the whole thing. It makes a noise in your terminal and raises a desktop
37
+ notification when Claude Code says an agent finished or is waiting on you.
38
+ It rides Claude Code's own notification events, so it fires when you have
39
+ actually stepped away rather than after every reply. No account,
40
+ no API key, no network call, nothing leaves your machine. Turn it off with
41
+ `pushary bell --off`; it touches nothing else in your settings.
42
+
43
+ ### If you landed here from `error: unknown option '--global'`
44
+
45
+ You probably ran this, from a blog post or an answer somewhere:
46
+
47
+ ```
48
+ claude config set --global preferrednotifchannel terminal_bell
49
+ error: unknown option '--global'
50
+ ```
51
+
52
+ `claude config set` no longer takes `--global`. The setting moved into
53
+ `~/.claude/settings.json`, so the direct equivalent is to put it there yourself:
54
+
55
+ ```json
56
+ { "preferredNotifChannel": "terminal_bell" }
57
+ ```
58
+
59
+ That rings on Claude Code's own notification events. `pushary bell` does the same
60
+ job through a hook instead, which means it also fires on Stop (the agent
61
+ finished, which is the case most people actually want) and can raise a real
62
+ desktop notification rather than only a beep. Either is fine. Neither costs
63
+ anything.
64
+
65
+ ### Where the free part stops
66
+
67
+ A bell has a ceiling, and the ceiling is how many agents you run:
68
+
69
+ - **One agent.** A bell is perfect. Pushary is overkill and we would rather you
70
+ did not buy it.
71
+ - **Two or three.** The bell rings and you cannot tell which agent. You alt-tab
72
+ looking for it.
73
+ - **Four or more.** The bell is noise, and you have left the room anyway.
74
+
75
+ Above three concurrent agents the bell says so, once a day, and then stops
76
+ talking. Set `PUSHARY_BELL_QUIET=1` if you would rather it never mentioned it.
77
+
27
78
  ## Setup
28
79
 
29
80
  You need an API key. Sign up at [pushary.com](https://pushary.com/sign-up?from=npm), then run:
@@ -70,6 +121,7 @@ status One screen: which key is in force, whether the server accepts it, w
70
121
  login Sign in from this terminal, no key to copy (--with-token to pipe one in)
71
122
  logout Remove the key this machine stores, and say what it does not remove
72
123
  connect Connect a phone without re-running setup (--app for the Pushary app)
124
+ bell Free local bell when an agent finishes or needs you. No account, no key, no network
73
125
  doctor Verify your Pushary installation is working
74
126
  clean Remove all Pushary configuration (--yes for non-interactive)
75
127
  mode Switch approval mode (push_only, push_first, terminal_only)
package/data/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pushary
3
- version: 0.7.1
4
- description: Push notifications and human-in-the-loop for AI agents. Use this when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from the user's lock screen. Use these tools proactively - do not wait for the user to ask for notifications. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
3
+ version: 0.8.0
4
+ description: Push notifications and human-in-the-loop for AI agents. Use this whenever a running agent needs a human and nobody is at the terminal: before an irreversible or destructive action, before spending money, deploying, force-pushing or deleting, when blocked on a decision outside your authority, when running unattended and you hit a genuine ambiguity, when another skill's workflow says to confirm with the user, and when a long task finishes or fails with nobody watching. Also use it when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from the user's lock screen. Use these tools proactively - do not wait for the user to ask for notifications. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
5
5
  metadata:
6
6
  hermes:
7
7
  tags: [notifications, push, human-in-the-loop, alerts, permissions, mcp]
@@ -22,6 +22,19 @@ Use these tools proactively. Do not wait for the user to ask for notifications.
22
22
 
23
23
  Works with Claude Code, Codex, Cursor, Windsurf, Hermes, Lovable, or any MCP client. No Claude Max subscription required.
24
24
 
25
+ ## Reach for This Without Being Asked
26
+
27
+ Nobody has to say "ping me". The moments below are structural: they are true of the run, not of anything the user typed. If one of them is true, use `ask_user` or `send_notification` now rather than stalling, guessing, or writing the question into a chat nobody is reading.
28
+
29
+ - **You are about to do something irreversible.** Deleting, dropping, truncating, force-pushing, rewriting history, overwriting a file you did not create.
30
+ - **You are about to spend money or touch production.** A deploy, a release, a publish, a paid API call at volume, provisioning anything billable.
31
+ - **The decision is outside your authority.** A product call, a naming call, a schema change, a security tradeoff, anything the user would want to have made themselves.
32
+ - **You are running unattended and hit a real ambiguity.** Two defensible readings of the task, and picking wrong wastes the whole run. Ask instead of guessing.
33
+ - **Another skill's workflow says to confirm with the user.** That instruction assumes someone is watching the terminal. Often nobody is. Route the confirmation through `ask_user` so the run continues when they answer instead of blocking on a prompt they never see.
34
+ - **A long task finished or failed and nobody is watching.** Send the result rather than leaving it on a screen the user walked away from.
35
+
36
+ If no phone or browser is connected, `ask_user` says so in its response and the run should carry on as it would have without this skill. Never block a task on an answer that cannot arrive.
37
+
25
38
  ## Pricing and Free Alternatives
26
39
 
27
40
  Pushary is a hosted service. It costs $9.99/mo after a 3-day trial, and the trial asks for a card up front. Say this plainly if the user asks what Pushary is.
@@ -125,7 +138,7 @@ Send a one-way push notification to the user. Optionally include structured cont
125
138
  | subscriberIds | string[] | No | Target specific subscriber IDs |
126
139
  | externalIds | string[] | No | Target by external IDs |
127
140
  | tags | string[] | No | Target by subscriber tags |
128
- | context | object | No | Structured context for a rich detail page (see below) |
141
+ | context | object | Yes for task updates | Structured context for a rich detail page (see below). `context.type` marks the notification a task update, and the user's setting for where task updates land can only route one that says so. |
129
142
 
130
143
  **Context object:**
131
144
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pushary
3
- description: Push notifications and human-in-the-loop for AI agents. Use this when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from the user's lock screen. Use these tools proactively - do not wait for the user to ask for notifications. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
3
+ description: Push notifications and human-in-the-loop for AI agents. Use this whenever a running agent needs a human and nobody is at the terminal: before an irreversible or destructive action, before spending money, deploying, force-pushing or deleting, when blocked on a decision outside your authority, when running unattended and you hit a genuine ambiguity, when another skill's workflow says to confirm with the user, and when a long task finishes or fails with nobody watching. Also use it when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from the user's lock screen. Use these tools proactively - do not wait for the user to ask for notifications. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
4
4
  ---
5
5
 
6
6
  # Pushary - Push Notifications for AI Agents
@@ -15,6 +15,19 @@ Use these tools proactively. Do not wait for the user to ask for notifications.
15
15
 
16
16
  Works with Claude Code, Codex, Cursor, Windsurf, Hermes, Lovable, or any MCP client. No Claude Max subscription required.
17
17
 
18
+ ## Reach for This Without Being Asked
19
+
20
+ Nobody has to say "ping me". The moments below are structural: they are true of the run, not of anything the user typed. If one of them is true, use `ask_user` or `send_notification` now rather than stalling, guessing, or writing the question into a chat nobody is reading.
21
+
22
+ - **You are about to do something irreversible.** Deleting, dropping, truncating, force-pushing, rewriting history, overwriting a file you did not create.
23
+ - **You are about to spend money or touch production.** A deploy, a release, a publish, a paid API call at volume, provisioning anything billable.
24
+ - **The decision is outside your authority.** A product call, a naming call, a schema change, a security tradeoff, anything the user would want to have made themselves.
25
+ - **You are running unattended and hit a real ambiguity.** Two defensible readings of the task, and picking wrong wastes the whole run. Ask instead of guessing.
26
+ - **Another skill's workflow says to confirm with the user.** That instruction assumes someone is watching the terminal. Often nobody is. Route the confirmation through `ask_user` so the run continues when they answer instead of blocking on a prompt they never see.
27
+ - **A long task finished or failed and nobody is watching.** Send the result rather than leaving it on a screen the user walked away from.
28
+
29
+ If no phone or browser is connected, `ask_user` says so in its response and the run should carry on as it would have without this skill. Never block a task on an answer that cannot arrive.
30
+
18
31
  ## Pricing and Free Alternatives
19
32
 
20
33
  Pushary is a hosted service. It costs $9.99/mo after a 3-day trial, and the trial asks for a card up front. Say this plainly if the user asks what Pushary is.
@@ -118,7 +131,7 @@ Send a one-way push notification to the user. Optionally include structured cont
118
131
  | subscriberIds | string[] | No | Target specific subscriber IDs |
119
132
  | externalIds | string[] | No | Target by external IDs |
120
133
  | tags | string[] | No | Target by subscriber tags |
121
- | context | object | No | Structured context for a rich detail page (see below) |
134
+ | context | object | Yes for task updates | Structured context for a rich detail page (see below). `context.type` marks the notification a task update, and the user's setting for where task updates land can only route one that says so. |
122
135
 
123
136
  **Context object:**
124
137
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pushary
3
- description: Push notifications and human-in-the-loop for AI agents. Use this when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from the user's lock screen. Use these tools proactively - do not wait for the user to ask for notifications. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
3
+ description: Push notifications and human-in-the-loop for AI agents. Use this whenever a running agent needs a human and nobody is at the terminal: before an irreversible or destructive action, before spending money, deploying, force-pushing or deleting, when blocked on a decision outside your authority, when running unattended and you hit a genuine ambiguity, when another skill's workflow says to confirm with the user, and when a long task finishes or fails with nobody watching. Also use it when the user says things like keep going and ping me on my phone if you need anything, notify me when my agent needs me, approve from my phone, ask me questions while I am away from the terminal, run this overnight, keep working while I am in a meeting, I am stepping away, do not wait for me, or wants a long task to run unattended. Send alerts when tasks finish or fail, ask questions (yes/no, multiple choice, or free text) via push, and get answers from the user's lock screen. Use these tools proactively - do not wait for the user to ask for notifications. Works with Claude Code, Codex, Cursor, VS Code, Windsurf, Hermes, Lovable, or any MCP client; no Claude Max subscription required. Pushary is a hosted service, $9.99/mo after a 3-day card-first trial.
4
4
  ---
5
5
 
6
6
  # Pushary - Push Notifications for AI Agents
@@ -15,6 +15,19 @@ Use these tools proactively. Do not wait for the user to ask for notifications.
15
15
 
16
16
  Works with Claude Code, Codex, Cursor, Windsurf, Hermes, Lovable, or any MCP client. No Claude Max subscription required.
17
17
 
18
+ ## Reach for This Without Being Asked
19
+
20
+ Nobody has to say "ping me". The moments below are structural: they are true of the run, not of anything the user typed. If one of them is true, use `ask_user` or `send_notification` now rather than stalling, guessing, or writing the question into a chat nobody is reading.
21
+
22
+ - **You are about to do something irreversible.** Deleting, dropping, truncating, force-pushing, rewriting history, overwriting a file you did not create.
23
+ - **You are about to spend money or touch production.** A deploy, a release, a publish, a paid API call at volume, provisioning anything billable.
24
+ - **The decision is outside your authority.** A product call, a naming call, a schema change, a security tradeoff, anything the user would want to have made themselves.
25
+ - **You are running unattended and hit a real ambiguity.** Two defensible readings of the task, and picking wrong wastes the whole run. Ask instead of guessing.
26
+ - **Another skill's workflow says to confirm with the user.** That instruction assumes someone is watching the terminal. Often nobody is. Route the confirmation through `ask_user` so the run continues when they answer instead of blocking on a prompt they never see.
27
+ - **A long task finished or failed and nobody is watching.** Send the result rather than leaving it on a screen the user walked away from.
28
+
29
+ If no phone or browser is connected, `ask_user` says so in its response and the run should carry on as it would have without this skill. Never block a task on an answer that cannot arrive.
30
+
18
31
  ## Pricing and Free Alternatives
19
32
 
20
33
  Pushary is a hosted service. It costs $9.99/mo after a 3-day trial, and the trial asks for a card up front. Say this plainly if the user asks what Pushary is.
@@ -118,7 +131,7 @@ Send a one-way push notification to the user. Optionally include structured cont
118
131
  | subscriberIds | string[] | No | Target specific subscriber IDs |
119
132
  | externalIds | string[] | No | Target by external IDs |
120
133
  | tags | string[] | No | Target by subscriber tags |
121
- | context | object | No | Structured context for a rich detail page (see below) |
134
+ | context | object | Yes for task updates | Structured context for a rich detail page (see below). `context.type` marks the notification a task update, and the user's setting for where task updates land can only route one that says so. |
122
135
 
123
136
  **Context object:**
124
137
 
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ handleBell
4
+ } from "../chunk-22EQOB2T.js";
5
+ import "../chunk-E6I3DBJW.js";
6
+ import "../chunk-6MTNS63X.js";
7
+ import "../chunk-BC3VCZ3E.js";
8
+ import "../chunk-PPD3HHNJ.js";
9
+ import "../chunk-T6BNEQ2A.js";
10
+ import "../chunk-2UMNXADU.js";
11
+
12
+ // bin/pushary-bell-hook.ts
13
+ var main = async () => {
14
+ let rawInput = "";
15
+ try {
16
+ for await (const chunk of process.stdin) rawInput += chunk;
17
+ handleBell(rawInput.trim() ? JSON.parse(rawInput) : {});
18
+ } catch {
19
+ }
20
+ process.stdout.write("{}");
21
+ };
22
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ DEFAULT_UPGRADE_THRESHOLD,
4
+ handleBell,
5
+ liveAgentCount,
6
+ ring,
7
+ upgradeThreshold
8
+ } from "../chunk-22EQOB2T.js";
9
+ import {
10
+ claudeSettings
11
+ } from "../chunk-Q4QULGAV.js";
12
+ import {
13
+ createIo
14
+ } from "../chunk-TX7KBKT7.js";
15
+ import "../chunk-E6I3DBJW.js";
16
+ import {
17
+ readJsonSafe,
18
+ writeJsonAtomic
19
+ } from "../chunk-6MTNS63X.js";
20
+ import {
21
+ parseFlags
22
+ } from "../chunk-GMXKITVA.js";
23
+ import "../chunk-BC3VCZ3E.js";
24
+ import "../chunk-PPD3HHNJ.js";
25
+ import "../chunk-7QLSKOSU.js";
26
+ import "../chunk-T6BNEQ2A.js";
27
+ import {
28
+ exitOnHelpFlag
29
+ } from "../chunk-RRZZ7TFJ.js";
30
+ import "../chunk-ZUKH2NPJ.js";
31
+ import "../chunk-2UMNXADU.js";
32
+ import {
33
+ EXIT
34
+ } from "../chunk-KZERVKTD.js";
35
+
36
+ // src/bell/install.ts
37
+ import { join } from "path";
38
+ var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
39
+ var ensureRecord = (parent, key) => {
40
+ const existing = asRecord(parent[key]);
41
+ if (existing) return existing;
42
+ const created = {};
43
+ parent[key] = created;
44
+ return created;
45
+ };
46
+ var BELL_HOOK_BINARY = "pushary-bell-hook";
47
+ var isBellHook = (entry) => {
48
+ const hooks = asRecord(entry)?.hooks;
49
+ if (!Array.isArray(hooks)) return false;
50
+ return hooks.some((hook) => String(asRecord(hook)?.command ?? "").includes(BELL_HOOK_BINARY));
51
+ };
52
+ var BELL_TIMEOUT_SECONDS = 5;
53
+ var BELL_NOTIFICATION_MATCHER = "idle_prompt|agent_needs_input|agent_completed";
54
+ var addBellHooks = (settings, binDir) => {
55
+ const resolve = (name) => {
56
+ const path = binDir ? join(binDir, name) : name;
57
+ return /\s/.test(path) ? `"${path}"` : path;
58
+ };
59
+ const hooks = ensureRecord(settings, "hooks");
60
+ const notification = (Array.isArray(hooks.Notification) ? hooks.Notification : []).filter((entry) => !isBellHook(entry));
61
+ notification.push({
62
+ matcher: BELL_NOTIFICATION_MATCHER,
63
+ hooks: [{ type: "command", command: resolve(BELL_HOOK_BINARY), timeout: BELL_TIMEOUT_SECONDS }]
64
+ });
65
+ hooks.Notification = notification;
66
+ const stop = Array.isArray(hooks.Stop) ? hooks.Stop.filter((entry) => !isBellHook(entry)) : [];
67
+ if (Array.isArray(hooks.Stop)) {
68
+ if (stop.length === 0) delete hooks.Stop;
69
+ else hooks.Stop = stop;
70
+ }
71
+ };
72
+ var removeBellHooks = (settings) => {
73
+ const hooks = asRecord(settings.hooks);
74
+ if (!hooks) return false;
75
+ let changed = false;
76
+ for (const key of ["Stop", "Notification"]) {
77
+ const entries = hooks[key];
78
+ if (!Array.isArray(entries)) continue;
79
+ const filtered = entries.filter((entry) => !isBellHook(entry));
80
+ if (filtered.length === entries.length) continue;
81
+ if (filtered.length === 0) delete hooks[key];
82
+ else hooks[key] = filtered;
83
+ changed = true;
84
+ }
85
+ if (Object.keys(hooks).length === 0) delete settings.hooks;
86
+ return changed;
87
+ };
88
+ var bellInstalled = (settings) => {
89
+ const hooks = asRecord(settings.hooks);
90
+ if (!hooks) return false;
91
+ return ["Stop", "Notification"].some((key) => {
92
+ const entries = hooks[key];
93
+ return Array.isArray(entries) && entries.some(isBellHook);
94
+ });
95
+ };
96
+
97
+ // bin/pushary-bell.ts
98
+ exitOnHelpFlag("bell");
99
+ var { bold, cyan, dim, green, yellow } = createIo();
100
+ var readStdin = async () => {
101
+ const chunks = [];
102
+ for await (const chunk of process.stdin) chunks.push(Buffer.from(chunk));
103
+ return Buffer.concat(chunks).toString("utf-8");
104
+ };
105
+ var settingsPath = () => claudeSettings();
106
+ var loadSettings = (path) => {
107
+ const existing = readJsonSafe(path);
108
+ if (existing.kind === "ok") return existing.value;
109
+ if (existing.kind === "unreadable" || existing.kind === "unparseable") {
110
+ throw new Error(`${path} exists but could not be read. Fix or move it, then re-run. Nothing was changed.`);
111
+ }
112
+ return {};
113
+ };
114
+ var install = () => {
115
+ const path = settingsPath();
116
+ const settings = loadSettings(path);
117
+ const already = bellInstalled(settings);
118
+ addBellHooks(settings);
119
+ writeJsonAtomic(path, settings);
120
+ console.log();
121
+ console.log(` ${green("\u2713")} ${bold(already ? "Bell updated." : "Bell on.")}`);
122
+ console.log(` ${dim(`Claude Code will ring this terminal when an agent finishes or needs you (${path}).`)}`);
123
+ console.log();
124
+ console.log(` ${dim("It makes a local noise. That is all it does.")}`);
125
+ console.log(` ${dim("No account, no API key, no network call, nothing leaves this machine.")}`);
126
+ console.log();
127
+ console.log(` ${dim("Try it:")} ${cyan("pushary bell --test")}`);
128
+ console.log(` ${dim("Turn it off:")} ${cyan("pushary bell --off")}`);
129
+ console.log();
130
+ };
131
+ var uninstall = () => {
132
+ const path = settingsPath();
133
+ const settings = loadSettings(path);
134
+ const removed = removeBellHooks(settings);
135
+ if (removed) writeJsonAtomic(path, settings);
136
+ console.log();
137
+ console.log(` ${green("\u2713")} ${removed ? "Bell off." : "The bell was not installed."}`);
138
+ if (removed) console.log(` ${dim(`Removed from ${path}. Nothing else was touched.`)}`);
139
+ console.log();
140
+ };
141
+ var test = () => {
142
+ const result = ring({ title: "Pushary bell", body: "This is what it sounds like." });
143
+ console.log();
144
+ console.log(` ${result.rang ? green("\u2713") : yellow("!")} Terminal bell ${result.rang ? "sent" : "could not be written"}`);
145
+ console.log(
146
+ ` ${result.notified ? green("\u2713") : dim("\u2013")} Desktop notification ${result.notified ? "sent" : "not available on this platform"}`
147
+ );
148
+ if (!result.rang) {
149
+ console.log();
150
+ console.log(` ${dim("Some terminals mute the bell by default. In iTerm2 it is")} ${cyan("Settings > Profiles > Terminal > Silence bell")}${dim(".")}`);
151
+ }
152
+ console.log();
153
+ };
154
+ var status = () => {
155
+ const path = settingsPath();
156
+ let installed = false;
157
+ try {
158
+ installed = bellInstalled(loadSettings(path));
159
+ } catch {
160
+ installed = false;
161
+ }
162
+ const live = liveAgentCount();
163
+ const threshold = upgradeThreshold();
164
+ console.log();
165
+ console.log(` ${installed ? green("\u2713") : dim("\u2013")} Bell ${installed ? "on" : "off"} ${dim(`(${path})`)}`);
166
+ console.log(` ${dim(`${live} agent${live === 1 ? "" : "s"} seen in the last 10 minutes`)}`);
167
+ if (!installed) console.log(` ${dim("Turn it on:")} ${cyan("pushary bell")}`);
168
+ console.log();
169
+ console.log(
170
+ ` ${dim(
171
+ `Above ${threshold} concurrent agents the bell says so, once a day. A bell cannot tell you which agent is asking.`
172
+ )}`
173
+ );
174
+ if (threshold !== DEFAULT_UPGRADE_THRESHOLD) {
175
+ console.log(` ${dim(`Threshold overridden by PUSHARY_BELL_UPGRADE_AT (default ${DEFAULT_UPGRADE_THRESHOLD}).`)}`);
176
+ }
177
+ console.log();
178
+ };
179
+ var runHook = async () => {
180
+ try {
181
+ const raw = await readStdin();
182
+ const input = raw.trim() ? JSON.parse(raw) : {};
183
+ handleBell(input);
184
+ } catch {
185
+ }
186
+ process.stdout.write("{}");
187
+ process.exit(EXIT.OK);
188
+ };
189
+ var main = async () => {
190
+ const argv = process.argv.slice(2);
191
+ const flags = parseFlags(argv, { bools: ["off", "test", "status", "hook", "help", "h"], values: [] });
192
+ if (flags.bools.has("hook")) return runHook();
193
+ if (flags.bools.has("test")) return test();
194
+ if (flags.bools.has("status")) return status();
195
+ if (flags.bools.has("off")) return uninstall();
196
+ return install();
197
+ };
198
+ await main().catch((err) => {
199
+ console.log();
200
+ console.log(` ${yellow("!")} ${err instanceof Error ? err.message : "Something went wrong."}`);
201
+ console.log();
202
+ process.exit(EXIT.FAILED);
203
+ });
@@ -1,13 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- needsShell,
4
- spawnClaude
5
- } from "../chunk-XHKBHWLX.js";
6
2
  import {
7
3
  KILL_REASON,
8
4
  isDeferAnswer,
9
5
  resolveGate
10
- } from "../chunk-QVOJF23R.js";
6
+ } from "../chunk-A5DAEWBZ.js";
11
7
  import {
12
8
  askUser,
13
9
  cancelQuestion,
@@ -19,13 +15,18 @@ import {
19
15
  reportEvent,
20
16
  scopePathFor,
21
17
  waitForAnswer
22
- } from "../chunk-MDPSJR45.js";
18
+ } from "../chunk-DUYM5SHH.js";
23
19
  import "../chunk-BSZYIAZL.js";
24
20
  import "../chunk-SAF6HGAA.js";
21
+ import "../chunk-PPD3HHNJ.js";
25
22
  import "../chunk-7QLSKOSU.js";
26
23
  import {
27
24
  redactSecrets
28
- } from "../chunk-KJFKEKTC.js";
25
+ } from "../chunk-T6BNEQ2A.js";
26
+ import {
27
+ needsShell,
28
+ spawnClaude
29
+ } from "../chunk-XHKBHWLX.js";
29
30
  import {
30
31
  getMachineId
31
32
  } from "../chunk-RN3NOEJF.js";
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- removeClaudeMcpServers,
4
- removePusharySettings
5
- } from "../chunk-FCB6J5YC.js";
6
2
  import {
7
3
  removeInstructionBlock,
8
4
  shortenHome,
9
5
  unregisterPluginLocation,
10
6
  vscodeSettingsTargets
11
- } from "../chunk-EQJZS2LE.js";
7
+ } from "../chunk-WYVKPLVT.js";
12
8
  import {
13
9
  removeGeminiSettings
14
- } from "../chunk-PXE6HXRP.js";
10
+ } from "../chunk-7DYFAM32.js";
11
+ import {
12
+ removeClaudeMcpServers,
13
+ removePusharySettings
14
+ } from "../chunk-R6AYBATA.js";
15
15
  import {
16
16
  claudeJson,
17
17
  claudeSettings,
@@ -29,22 +29,22 @@ import {
29
29
  pusharyDir,
30
30
  removeCodexHooks,
31
31
  vscodePluginDir
32
- } from "../chunk-TNG3EWFN.js";
33
- import {
34
- removeClaudeAlias
35
- } from "../chunk-BC3VCZ3E.js";
32
+ } from "../chunk-Q4QULGAV.js";
36
33
  import {
37
34
  rejectUnknownFlags
38
35
  } from "../chunk-GMXKITVA.js";
36
+ import {
37
+ removeClaudeAlias
38
+ } from "../chunk-BC3VCZ3E.js";
39
+ import "../chunk-7QLSKOSU.js";
40
+ import "../chunk-T6BNEQ2A.js";
39
41
  import {
40
42
  execNpm
41
43
  } from "../chunk-MUEW424A.js";
42
44
  import {
43
45
  exitOnHelpFlag
44
- } from "../chunk-BBK3TTU2.js";
45
- import "../chunk-7OYGFJYZ.js";
46
- import "../chunk-7QLSKOSU.js";
47
- import "../chunk-KJFKEKTC.js";
46
+ } from "../chunk-RRZZ7TFJ.js";
47
+ import "../chunk-ZUKH2NPJ.js";
48
48
  import {
49
49
  EXIT
50
50
  } from "../chunk-KZERVKTD.js";
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ isGatingMoment,
4
+ recordKeylessMoment
5
+ } from "../chunk-MHA2WB7S.js";
2
6
  import {
3
7
  KILL_REASON,
4
8
  denyReasonFrom,
5
9
  isDeferAnswer,
6
10
  resolveGate
7
- } from "../chunk-QVOJF23R.js";
11
+ } from "../chunk-A5DAEWBZ.js";
8
12
  import {
9
13
  CODEX_AGENT,
10
14
  DEFAULT_SESSION,
@@ -35,20 +39,17 @@ import {
35
39
  toPolicyLookup,
36
40
  toPolicyLookups,
37
41
  waitForAnswer
38
- } from "../chunk-MDPSJR45.js";
39
- import {
40
- isGatingMoment,
41
- recordKeylessMoment
42
- } from "../chunk-HAP7UTZS.js";
42
+ } from "../chunk-DUYM5SHH.js";
43
43
  import "../chunk-BSZYIAZL.js";
44
44
  import "../chunk-SAF6HGAA.js";
45
+ import "../chunk-PPD3HHNJ.js";
45
46
  import "../chunk-7QLSKOSU.js";
46
47
  import {
47
48
  DECISION_LINE_MAX,
48
49
  effectiveWaitSeconds,
49
50
  hookWaitClamped,
50
51
  hookWaitDeadline
51
- } from "../chunk-KJFKEKTC.js";
52
+ } from "../chunk-T6BNEQ2A.js";
52
53
  import {
53
54
  getMachineId
54
55
  } from "../chunk-RN3NOEJF.js";
@@ -3,11 +3,12 @@ import {
3
3
  askUser,
4
4
  reportEvent,
5
5
  waitForAnswer
6
- } from "../chunk-MDPSJR45.js";
6
+ } from "../chunk-DUYM5SHH.js";
7
7
  import "../chunk-BSZYIAZL.js";
8
8
  import "../chunk-SAF6HGAA.js";
9
+ import "../chunk-PPD3HHNJ.js";
9
10
  import "../chunk-7QLSKOSU.js";
10
- import "../chunk-KJFKEKTC.js";
11
+ import "../chunk-T6BNEQ2A.js";
11
12
  import {
12
13
  getMachineId
13
14
  } from "../chunk-RN3NOEJF.js";