@pushary/agent-hooks 1.9.145 → 1.9.148

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 (167) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +5 -4
  3. package/data/SKILL.md +3 -3
  4. package/data/cursor-plugin/scripts/redaction.mjs +2 -1
  5. package/data/cursor-plugin/skills/pushary/SKILL.md +2 -2
  6. package/data/openclaw-plugin/LICENSE +21 -0
  7. package/data/openclaw-plugin/README.md +113 -0
  8. package/data/openclaw-plugin/dist/api-key-shape.js +5 -0
  9. package/data/openclaw-plugin/dist/approval-hook.js +88 -0
  10. package/data/openclaw-plugin/dist/approval-question.js +66 -0
  11. package/data/openclaw-plugin/dist/connection.js +101 -0
  12. package/data/openclaw-plugin/dist/decision-reply.js +6 -0
  13. package/data/openclaw-plugin/dist/gate-result.js +58 -0
  14. package/data/openclaw-plugin/dist/gate.js +173 -0
  15. package/data/openclaw-plugin/dist/hook-budget.js +19 -0
  16. package/data/openclaw-plugin/dist/host-api.js +1 -0
  17. package/data/openclaw-plugin/dist/host-version.js +25 -0
  18. package/data/openclaw-plugin/dist/index.js +32 -0
  19. package/data/openclaw-plugin/dist/openclaw-paths.js +43 -0
  20. package/data/openclaw-plugin/dist/openclaw-write-guard.js +93 -0
  21. package/data/openclaw-plugin/dist/protected-writes.js +217 -0
  22. package/data/openclaw-plugin/dist/pushary-client.js +103 -0
  23. package/data/openclaw-plugin/dist/pushary-hosts.js +3 -0
  24. package/data/openclaw-plugin/dist/redaction.js +53 -0
  25. package/data/openclaw-plugin/dist/replies.js +65 -0
  26. package/data/openclaw-plugin/dist/settings.js +103 -0
  27. package/data/openclaw-plugin/openclaw.plugin.json +32 -0
  28. package/data/openclaw-plugin/package.json +70 -0
  29. package/data/vscode-plugin/scripts/redaction.mjs +2 -1
  30. package/data/vscode-plugin/skills/pushary/SKILL.md +2 -2
  31. package/dist/{api-KWJQMO6G.js → api-H7H75ARS.js} +11 -11
  32. package/dist/bin/pushary-audit.js +3 -3
  33. package/dist/bin/pushary-bell-hook.js +28 -28
  34. package/dist/bin/pushary-bell.js +11 -11
  35. package/dist/bin/pushary-claude.js +27 -27
  36. package/dist/bin/pushary-clean.js +76 -39
  37. package/dist/bin/pushary-codex-bridge.js +23 -23
  38. package/dist/bin/pushary-codex-hook.js +35 -35
  39. package/dist/bin/pushary-codex-session.js +8 -8
  40. package/dist/bin/pushary-codex.js +16 -16
  41. package/dist/bin/pushary-connect.js +78 -36
  42. package/dist/bin/pushary-cowork.js +5 -5
  43. package/dist/bin/pushary-daemon.js +44 -43
  44. package/dist/bin/pushary-disconnect.js +28 -28
  45. package/dist/bin/pushary-display-hook.js +96 -44
  46. package/dist/bin/pushary-doctor.js +124 -55
  47. package/dist/bin/pushary-elicitation-hook.js +28 -28
  48. package/dist/bin/pushary-gemini-bridge.js +17 -17
  49. package/dist/bin/pushary-gemini-hook.js +32 -32
  50. package/dist/bin/pushary-hook.js +35 -35
  51. package/dist/bin/pushary-login.js +22 -22
  52. package/dist/bin/pushary-logout.js +33 -31
  53. package/dist/bin/pushary-mcp.js +12 -12
  54. package/dist/bin/pushary-mode.js +16 -16
  55. package/dist/bin/pushary-notification-hook.js +27 -27
  56. package/dist/bin/pushary-opencode-hook.js +31 -31
  57. package/dist/bin/pushary-permission-denied-hook.js +35 -35
  58. package/dist/bin/pushary-permission-hook.js +35 -35
  59. package/dist/bin/pushary-post-hook.js +28 -28
  60. package/dist/bin/pushary-prompt-hook.js +27 -27
  61. package/dist/bin/pushary-session-end-hook.js +27 -27
  62. package/dist/bin/pushary-session-start-hook.js +37 -36
  63. package/dist/bin/pushary-setup.js +144 -106
  64. package/dist/bin/pushary-stats.js +5 -5
  65. package/dist/bin/pushary-status.js +38 -36
  66. package/dist/bin/pushary-stop-hook.js +27 -27
  67. package/dist/bin/pushary-stopfailure-hook.js +27 -27
  68. package/dist/bin/pushary-suggestions.js +16 -16
  69. package/dist/bin/pushary-transcript-register.js +17 -17
  70. package/dist/bin/pushary-transcripts.js +25 -25
  71. package/dist/bin/pushary-upgrade.js +42 -41
  72. package/dist/bin/pushary-wait.js +16 -16
  73. package/dist/bin/pushary.js +7 -7
  74. package/dist/{chunk-6IWOMXUF.js → chunk-2VPRLAKF.js} +4 -4
  75. package/dist/{chunk-GK5X2ZTN.js → chunk-3AAQJ75F.js} +5 -5
  76. package/dist/{chunk-YNCVSKUW.js → chunk-3OPXQK4D.js} +5 -5
  77. package/dist/{chunk-ZORBUQFG.js → chunk-3T7RA7WJ.js} +2 -2
  78. package/dist/{chunk-PXZTCR4M.js → chunk-3WD3BEPB.js} +2 -2
  79. package/dist/{chunk-VTJ4WZOC.js → chunk-43NHQUCY.js} +24 -3
  80. package/dist/{chunk-S7HGPKCL.js → chunk-4L2IYNLC.js} +1 -1
  81. package/dist/{chunk-KFALRZIN.js → chunk-5IG3VPHT.js} +4 -4
  82. package/dist/{chunk-S3A4PCRR.js → chunk-5ZIYTFPW.js} +10 -10
  83. package/dist/{chunk-A2H256WR.js → chunk-6HO36P3A.js} +1 -1
  84. package/dist/{chunk-FCSPMSDC.js → chunk-6RYJ3XCD.js} +200 -59
  85. package/dist/{chunk-PY6CM4NK.js → chunk-6YX3VB5P.js} +19 -12
  86. package/dist/{chunk-BYKRAYGD.js → chunk-A3URJPYH.js} +1 -1
  87. package/dist/{chunk-KS3PNTRT.js → chunk-ABTQG6XU.js} +1 -1
  88. package/dist/{chunk-72LP4RPC.js → chunk-AQ7L2E2U.js} +98 -47
  89. package/dist/{chunk-FNAH3YJC.js → chunk-B6RTPP3X.js} +16 -16
  90. package/dist/{chunk-K2SKUBYY.js → chunk-BP5HLKR6.js} +12 -12
  91. package/dist/{chunk-4L5WPDTB.js → chunk-BPKB7BI4.js} +1 -1
  92. package/dist/{chunk-YRJZF5RG.js → chunk-CABBLJD5.js} +3 -3
  93. package/dist/{chunk-ZBMVOMFG.js → chunk-CAHULQIO.js} +1 -1
  94. package/dist/chunk-CBIS7IYQ.js +157 -0
  95. package/dist/{chunk-LJRPWUST.js → chunk-CDQOARIF.js} +3 -3
  96. package/dist/{chunk-ZSOCJHL7.js → chunk-CIRTRWHM.js} +309 -5
  97. package/dist/{chunk-NTMKJRQ3.js → chunk-CMTDMZPV.js} +2 -2
  98. package/dist/{chunk-WOSO4YFQ.js → chunk-CU5SYUMK.js} +3 -6
  99. package/dist/{chunk-L4OGTRVW.js → chunk-D3QT4S7U.js} +4 -4
  100. package/dist/{chunk-YU5XE6VC.js → chunk-DHCJDYBT.js} +8 -7
  101. package/dist/{chunk-2LGDEPVL.js → chunk-DLPI45DF.js} +6 -6
  102. package/dist/{chunk-ZJZNT2G5.js → chunk-ENRL4WFD.js} +4 -4
  103. package/dist/{chunk-6UK4K5RS.js → chunk-FQLS37AX.js} +1 -1
  104. package/dist/{chunk-B4JQIH5M.js → chunk-H6FFNTSR.js} +7 -7
  105. package/dist/{chunk-JKWUF776.js → chunk-HEOBF5H6.js} +3 -3
  106. package/dist/{chunk-MNU5N3CQ.js → chunk-JSZ6LKX5.js} +23 -12
  107. package/dist/{chunk-RO6EVL5C.js → chunk-JUEQUYAT.js} +2 -2
  108. package/dist/{chunk-GURIOZE7.js → chunk-KP6ERYOA.js} +8 -8
  109. package/dist/{chunk-QKTF7WS6.js → chunk-KWJJYZ3T.js} +4 -4
  110. package/dist/{chunk-EPWOARGR.js → chunk-KXNAB76Z.js} +16 -5
  111. package/dist/chunk-LC53HRZ6.js +36 -0
  112. package/dist/{chunk-52UXNCZG.js → chunk-M7HJZ7HO.js} +3 -3
  113. package/dist/{chunk-WMBWKPKJ.js → chunk-MT4GBXLM.js} +10 -74
  114. package/dist/{chunk-WPBWJMBZ.js → chunk-MUSINFEU.js} +5 -5
  115. package/dist/{chunk-LD4R2P6N.js → chunk-NHZV2H63.js} +1 -1
  116. package/dist/{chunk-USFZJAB4.js → chunk-NLED3JGR.js} +1 -1
  117. package/dist/{chunk-DZIZ3XFL.js → chunk-NRPQUU3D.js} +2 -2
  118. package/dist/{chunk-LQXUWXQP.js → chunk-O5ARO3JM.js} +33 -10
  119. package/dist/chunk-OYIN77HO.js +72 -0
  120. package/dist/{chunk-TJXJGMSP.js → chunk-PH3MVQCQ.js} +21 -11
  121. package/dist/{chunk-2ELNRGNX.js → chunk-PUTX5BBE.js} +7 -4
  122. package/dist/{chunk-R34RWVN2.js → chunk-PVBDITRS.js} +14 -5
  123. package/dist/{chunk-33BYPZ52.js → chunk-Q7GZKNMH.js} +1 -1
  124. package/dist/{chunk-7LTP2GHO.js → chunk-QSZYHL7Z.js} +2 -2
  125. package/dist/{chunk-CUR2DCZN.js → chunk-QTQRQZIU.js} +4 -4
  126. package/dist/{chunk-SQL5YXUH.js → chunk-R2JRRCZK.js} +1 -1
  127. package/dist/{chunk-4KDRT3OA.js → chunk-RMBY7JGO.js} +1 -1
  128. package/dist/{chunk-KKPT7ROP.js → chunk-RWTH5RYA.js} +2 -2
  129. package/dist/chunk-RYDDLS62.js +176 -0
  130. package/dist/{chunk-Q6P7G4NY.js → chunk-S3MEI2D2.js} +17 -5
  131. package/dist/{chunk-HOQH5CLZ.js → chunk-T3CMGGNW.js} +1 -1
  132. package/dist/{chunk-IIN26HL7.js → chunk-T4PX3DRF.js} +1 -1
  133. package/dist/{chunk-6LZ7MXHD.js → chunk-TXXAQRX4.js} +7 -5
  134. package/dist/{chunk-YZA3YBHX.js → chunk-UAHBSOO4.js} +2 -2
  135. package/dist/{chunk-LMU6NG2G.js → chunk-UFGFO7QB.js} +1 -1
  136. package/dist/{chunk-TRV3ETGY.js → chunk-UJUGFLVF.js} +5 -5
  137. package/dist/{chunk-IRPIMQ7U.js → chunk-UL2NNDKD.js} +3 -3
  138. package/dist/{chunk-BWREST4F.js → chunk-VPADWVYD.js} +1 -1
  139. package/dist/{chunk-5TWW7ZUL.js → chunk-VPMSV35B.js} +5 -5
  140. package/dist/{chunk-G3VSMI7K.js → chunk-WQEJCDMR.js} +2 -2
  141. package/dist/{chunk-JZT2LPRM.js → chunk-WQJ5NJ35.js} +1 -1
  142. package/dist/{chunk-63WX5KZN.js → chunk-X4OEGFOG.js} +3 -3
  143. package/dist/{chunk-RWLNTZK5.js → chunk-X4OQ5UMH.js} +5 -5
  144. package/dist/{chunk-MOC2DN42.js → chunk-XSBW6TUH.js} +2 -2
  145. package/dist/{chunk-WH4ODOCE.js → chunk-XZGQZDFP.js} +6 -6
  146. package/dist/{chunk-FO3MDD26.js → chunk-YM2T76UM.js} +27 -0
  147. package/dist/{chunk-WUT3PO33.js → chunk-YOP7LFHW.js} +8 -8
  148. package/dist/{chunk-KGFB2LEB.js → chunk-YTD7RV6F.js} +3 -3
  149. package/dist/{chunk-IDLOJIIS.js → chunk-YWSIN7IH.js} +1 -1
  150. package/dist/{chunk-MKHVLDMN.js → chunk-ZCB5SCYM.js} +2 -2
  151. package/dist/{chunk-OONMKLUF.js → chunk-ZOATPL53.js} +4 -4
  152. package/dist/{chunk-Y7INHH5G.js → chunk-ZX2O66NS.js} +3 -3
  153. package/dist/{codex-app-cards-switch-F7WQ7Y3I.js → codex-app-cards-switch-BCM547E6.js} +11 -11
  154. package/dist/{codex-card-routing-EVL5L36G.js → codex-card-routing-222EKZJR.js} +2 -2
  155. package/dist/{codex-desktop-launch-PL6Z2ELZ.js → codex-desktop-launch-6AFOLMZ7.js} +1 -1
  156. package/dist/{codex-session-launch-7NQEAUDU.js → codex-session-launch-4YJR4ZGN.js} +20 -20
  157. package/dist/{config-KFFD4VWH.js → config-GWNPGS47.js} +3 -3
  158. package/dist/{global-upgrade-L3CY6EFF.js → global-upgrade-VRF6OSSU.js} +9 -9
  159. package/dist/{identity-DPYYIMHL.js → identity-PQIM7R2N.js} +4 -4
  160. package/dist/{live-capabilities-QJEXK6GH.js → live-capabilities-G3LMKZUB.js} +4 -4
  161. package/dist/{paths-PEF6C64P.js → paths-TFGIP5PU.js} +7 -3
  162. package/dist/{reapply-7APCQRRK.js → reapply-3IRAI6JF.js} +30 -29
  163. package/dist/src/index.js +34 -34
  164. package/dist/{upgrade-lock-A7OKXMRW.js → upgrade-lock-2G7ANYYO.js} +6 -4
  165. package/dist/{usage-HSS33762.js → usage-K3EGYCSU.js} +3 -3
  166. package/package.json +1 -1
  167. package/dist/chunk-D3UFDCTQ.js +0 -87
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.148
4
+
5
+ - Setup no longer prints your API key. If your shell profile already sets `PUSHARY_API_KEY` in a line Pushary did not write, setup used to print `export PUSHARY_API_KEY='<your full key>'` for you to paste. Now it says where the key is saved and tells you to delete that line or set it to the same key.
6
+ - If your npm only installs releases older than a set age (`min-release-age` or `before`), setup no longer fails with a bare "notarget" error. It says why and prints one command to run instead: `npm exec --yes --package=pushary@latest -c "pushary setup --agents <agents>"` (`npm.cmd` on Windows). npm then picks a release your setting allows. Setup still installs exactly the release that runs it.
7
+ - A failed install no longer blocks every later setup, upgrade and auto-update. When npm stopped because the version was not found (ETARGET or E404), it wrote nothing, so the install lock is now released. A lock left by an install whose process died more than 15 minutes ago is now cleared on the next run. Before, both stayed until you deleted `~/.pushary/auto-update.lock` by hand.
8
+ - When setup set up no agent, it now says "No agent was set up. Your key is saved.", says when push works, and gives a doctor command that runs without a global install. It used to say "Nothing was configured" even when your key was saved and a test notification arrived.
9
+ - The transcript notice now reads: "Your phone can decrypt them. Pushary can open a session only for a documented legal request, and every opening is logged."
10
+
11
+ ## 1.9.147
12
+
13
+ - `pushary setup` can connect OpenClaw. Pick OpenClaw, or pass `--agents openclaw`. This CLI carries the Pushary plugin for OpenClaw: setup writes it to `~/.pushary/openclaw-plugin` and runs `openclaw plugins install ~/.pushary/openclaw-plugin --force --accept-capabilities` and `openclaw plugins enable pushary`. Nothing is fetched from npm. `pushary upgrade` reinstalls the plugin when this CLI carries a newer copy, and keeps it disabled if you disabled it.
14
+ - The plugin gates every `exec` call, the `process` actions that type into a running session (`write`, `send-keys`, `submit`, `paste`), and the `plugins`, `gateway` and `openclaw` actions that install, disable, reconfigure, update or restart OpenClaw, every `automations` and `terminal` action except their reads, and any `write`, `edit` or `apply_patch` into OpenClaw's own state, `~/.config/openclaw`, `~/.pushary` or its gateway service files, outside the agent's own workspace. These are the tools OpenClaw gives the agent to turn the plugin off; the plugin README lists what the gate does not cover. A `sessions_spawn` into a folder outside the agent's workspace asks too. Writes anywhere else run without asking. The plugin only talks to `https://pushary.com` and `https://www.pushary.com`. It does this through OpenClaw's `before_tool_call` hook and asks you in Pushary. A call runs only on the answer yes, and a stop from Pushary wins over any answer; anything else, no answer within about five minutes, a cancelled call or an unreachable server blocks it. `plugins.entries.pushary.config.gatedTools` adds more tools. It needs OpenClaw 2026.11.3 or later. Phone calls are not offered for OpenClaw yet.
15
+ - Setup stops without changing anything when OpenClaw will not report its plugins, or when another package already uses the plugin id `pushary`. It acts on the OpenClaw your current shell points at, and keeps one record per OpenClaw state directory of what `plugins.entries.pushary` was before it ran, so clean can undo each install.
16
+ - `pushary doctor` reports whether the plugin is installed, enabled and registers its gate, and whether it can read your key, including a key in the gateway's `.env` file. `pushary clean` uninstalls the plugin and puts back the settings you had before setup. When the plugin cannot be removed, clean keeps and does not revoke your key, so the plugin is never left blocking every call.
17
+ - Setup finds OpenClaw from `openclaw` on PATH, `~/.openclaw/bin/openclaw` or `~/.local/bin/openclaw`, and its state directory as OpenClaw resolves it (`OPENCLAW_HOME`, `OPENCLAW_STATE_DIR`, `OPENCLAW_CONFIG_PATH`). Clean and upgrade run each recorded OpenClaw with the variables setup recorded for it.
18
+
19
+ ## 1.9.146
20
+
21
+ - Setup no longer sends you to the browser push page by default. When nothing of yours can receive an approval and setup did not pair a phone in this run, for example because it reused a saved key or you passed `--key`, it shows a QR code and the link for the Pushary app (https://pushary.com/download) and tells you to sign in with the same account and allow notifications. Before, it printed your site's subscribe page first and the app second. The subscribe page now appears only when you ask for it with `--connect web` or `--connect browser`.
22
+ - `pushary pair` pairs the Pushary app by default. If an app of yours is already connected it sends a test notification; otherwise it shows the pairing QR, the https://pushary.com/pair link and the fingerprint, waits for your phone to approve, as setup does, and then checks that the phone registered for notifications. This computer keeps the key it has: the key the pairing makes is revoked as soon as the phone approves. A phone that approved for another workspace, for another account, or as a teammate on this computer's own site is not tested; the command says which it is and how to fix it. The phone's approval screen names the agents found on this computer. Off a terminal, the first line says the command keeps running until the phone approves, for up to 15 minutes, so an agent should run it in the background. In CI it draws no QR, says which variable made it CI, and only checks what already reaches you, so a browser channel of yours still gets its test notification and exit 0. Browser web push now needs `--browser`; before, bare `pushary pair` opened your site's subscribe page. `--app` still works and means the same as no flag. When the phone approved but has not allowed notifications, it says to allow them and run `pushary doctor --roundtrip`, not to pair again, and each fix is printed once.
23
+ - `pushary status`, `pushary doctor` and setup's delivery check give the same advice when no phone of yours is connected: get the app at https://pushary.com/download and sign in with the same account. They used to say `pushary pair`, which opened the browser page. The hints that sent a computer with a key to `setup --connect app`, which makes a new key and switches the computer to it, now name `pushary pair`, which keeps the key: setup's closing lines, `pushary pair` itself, and the Pushary skill (0.13.4).
24
+ - Setup and `pushary pair` decide they are in CI from variables only a CI runner sets: `CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, `CIRCLECI`, `TRAVIS`, `TF_BUILD`, `BUILDKITE_BUILD_ID`, `CODEBUILD_BUILD_ID` or `CODEBUILD_BUILD_ARN`, `TEAMCITY_BUILD_PROPERTIES_FILE`, and for Jenkins `JENKINS_HOME` with `EXECUTOR_NUMBER` or a `BUILD_TAG` that starts with `jenkins-`. Setup used to look at `CI` alone, so Azure Pipelines, CodeBuild and Jenkins runs without it waited for a QR nobody could scan. A variable people export by hand, such as `JENKINS_URL` for the Jenkins CLI, does not count, so a laptop with it in the shell still pairs. When setup refuses to pair in CI it names the variable, for example "No API key, and setup does not pair in CI (JENKINS_HOME is set)."
25
+ - Setup run by an agent, with its output going to a log instead of a terminal, now confirms a pairing the same way a terminal run does. After the app approves, it waits up to 45 seconds for the phone to register for notifications and then sends the test notification. Before, it skipped that wait, printed the browser push link and could exit 6 with "Phone delivery is unverified" for a phone that was seconds from registering. When the phone still has not allowed notifications, the closing lines say to allow them and run `pushary doctor --roundtrip`, not to pair again.
26
+ - When setup is stopped with SIGTERM while it waits for your phone, which is usually an agent's command timing out, it says it was stopped before your phone approved and the pairing code was cancelled, and that the command has to keep running in the background until the phone approves. `pushary pair` says the same. It used to say "No app yet?", which named the wrong cause. Ctrl-C keeps its wording. A signal now always wins: setup and `pushary pair` exit 143 or 130 with the stop message only, even when the cancel request to pushary.com is slow, instead of sometimes printing a second way out and exiting 3 or 6. Messages after a failed pairing name the command you ran, `setup` or `pushary pair`.
27
+
3
28
  ## 1.9.145
4
29
 
5
30
  - Hermes: Hermes skips its own dangerous-command approvals when its terminal backend is a container: `docker` with no host folder mounted, `modal`, `daytona`, `vercel_sandbox`, or a plugin backend that marks itself as a sandbox. Pushary gets those approvals through Hermes, so on such a backend no shell command reached your phone, and nothing said so. `pushary doctor` now names the backend, says that Pushary only gates the tools listed in `PUSHARY_GATE_TOOLS` there, and gives the fix.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/pushary.svg)](https://www.npmjs.com/package/pushary)
5
5
  [![license](https://img.shields.io/npm/l/pushary.svg)](./LICENSE)
6
6
 
7
- Push notifications, questions, and permission approvals for AI agents. Get a push when your agent finishes work, answer its questions from your phone, and approve risky commands before they run. Works with Claude Code, Codex, Cursor, VS Code, OpenCode, Gemini CLI, Hermes, and fx.
7
+ Push notifications, questions, and permission approvals for AI agents. Get a push when your agent finishes work, answer its questions from your phone, and approve risky commands before they run. Works with Claude Code, Codex, Cursor, VS Code, OpenCode, Gemini CLI, Hermes, OpenClaw, and fx.
8
8
 
9
9
  Your agent froze waiting for a yes. This is how it reaches you.
10
10
 
@@ -129,11 +129,12 @@ does exactly what `npx pushary@latest setup` does.
129
129
  | Cursor | yes | yes | yes |
130
130
  | Gemini CLI | yes | yes | yes |
131
131
  | Hermes | yes | yes | yes |
132
+ | OpenClaw | no | no | yes |
132
133
  | VS Code | yes | yes | yes |
133
134
  | OpenCode | yes | yes | yes |
134
135
  | fx | yes | yes | no |
135
136
 
136
- Any other MCP client can use notify and ask by pointing at the Pushary MCP endpoint directly.
137
+ OpenClaw gets the approval gate from the Pushary plugin this CLI carries: setup writes it to `~/.pushary/openclaw-plugin` and installs it with `openclaw plugins install`, so nothing comes from npm. Any other MCP client can use notify and ask by pointing at the Pushary MCP endpoint directly.
137
138
 
138
139
  ## Control an agent from your phone
139
140
 
@@ -205,13 +206,13 @@ failing closed would let one malformed download silence every hook on the machin
205
206
 
206
207
  ```
207
208
  cowork Set up Claude Desktop and Cowork with the Pushary connector
208
- setup Configure Claude Code, Codex, Gemini CLI, Hermes, Cursor, VS Code, OpenCode, or fx with Pushary
209
+ setup Configure Claude Code, Codex, Gemini CLI, Hermes, OpenClaw, Cursor, VS Code, OpenCode, or fx with Pushary
209
210
  claude Run Claude Code through Pushary, reachable from your phone even when idle
210
211
  daemon Keep this machine reachable so your phone can START a new session
211
212
  status One screen: which key is in force, whether the server accepts it, what can receive an approval
212
213
  login Sign in from this terminal, no key to copy (--with-token to pipe one in)
213
214
  sign-out Sign out: remove the key this machine stores, and say what it does not remove (also: logout)
214
- pair Pair a phone without re-running setup (--app for the Pushary app; also: connect)
215
+ pair Pair a phone without re-running setup: the Pushary app, or --browser for web push (also: connect)
215
216
  bell Free local bell when an agent finishes or needs you. No account, no key, no network
216
217
  doctor Verify your Pushary installation is working
217
218
  disconnect Turn off one agent (claude|codex|gemini|cursor|opencode|qwen|codebuddy|qoder|droid|devin|antigravity|grok|fx|cline)
package/data/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pushary
3
- version: 0.13.3
3
+ version: 0.13.4
4
4
  description: Push notifications and human-in-the-loop for AI agents. Use it whenever a running agent needs a person who may not be at the terminal, such as before an irreversible or destructive action, spending money, deploying, force-pushing or deleting, when blocked on a decision outside your authority, on a genuine ambiguity while unattended, when another skill says to confirm with the user, and when a long task finishes or fails with nobody watching. Also use it when the user says keep going and ping me on my phone if you need anything, call me if you get stuck, notify me when my agent needs me, approve from my phone, ask me while I am away, run this overnight, I am stepping away, or do not wait for me. Ask yes/no, choice or free-text questions on their phone and send updates. Use these tools proactively. Works with Claude Code, Codex, Cursor, VS Code, Gemini CLI, Windsurf, Hermes, Lovable or any MCP client. Pushary is a hosted, paid service; web and native store checkout have different price and trial terms.
5
5
  metadata:
6
6
  hermes:
@@ -147,7 +147,7 @@ For any code but 0 or 8, run `npx pushary@latest status` without `--json` and fo
147
147
  - **`mac-app` printed and the code is 3:** have the user sign in to the Pushary Mac app, then check again.
148
148
  - **Status says the key was signed out on this Mac:** have the user sign in again to the Pushary Mac app, open Settings > Agents and press Repair on every agent that offers it (if none does yet, have them close Settings, wait a minute and open it again), then run setup as in "Running setup yourself". It reuses the key the app wrote into the agents' settings; if the first one it finds does not work, it pairs instead. If status then shows the old key `from $PUSHARY_API_KEY`, have the user restart this agent from a new terminal.
149
149
  - **The Key line says `from $PUSHARY_API_KEY`, the code is 2 or 4, and status does not say signed out on this Mac:** this shell exports a bad key, and it wins over any key setup saves. Run setup at most once. If status still fails or shows `Key drift`, have the user delete every `export PUSHARY_API_KEY` line that still sets the old key from their shell startup files, such as ~/.zshrc, ~/.zprofile, ~/.bashrc and ~/.bash_profile, including any setup said it could not update, then restart this agent from a new terminal.
150
- - **Code 6, instead of the steps status prints:** have them install the Pushary app from https://pushary.com/download, sign in to the account this machine uses and allow notifications, then check again. A user who does not use a phone always gets 6: say so and stop. If it still says 6, offer to pair the phone: in the Pushary Mac app under Settings > Phone > Pair when `mac-app` printed, otherwise with setup `--connect app` as in "Running setup yourself", which creates a new key.
150
+ - **Code 6, instead of the steps status prints:** have them install the Pushary app from https://pushary.com/download, sign in to the account this machine uses and allow notifications, then check again. A user who does not use a phone always gets 6: say so and stop. If it still says 6, offer to pair the phone: in the Pushary Mac app under Settings > Phone > Pair when `mac-app` printed, otherwise with `npx pushary@latest pair`, which keeps this machine's key. Run it like setup: in the background with its output going to a log, kept running until it exits, showing the user the link, the QR and the fingerprint as they print. It waits up to 15 minutes for the phone, and a foreground command that times out cancels the pairing code.
151
151
 
152
152
  For `mac-app` without Node or npm, or with a Node version the CLI refuses, open the Pushary Mac app. Check the account, the plan and the Agents connection there, and connect or repair agents in the app. Do not install Node to inspect a native setup, and do not claim an exit code when no CLI ran.
153
153
 
@@ -215,7 +215,7 @@ Asks a question and waits. Use `confirm` for yes or no, `select` for 2 to 6 know
215
215
 
216
216
  **Answers.** `value` is "yes" or "no" for confirm, the chosen option for select, and the typed text for input. Read `note` too: a denial with a note carries the reason or a condition. A select or input value containing "yes" is answer data, not approval of a separate action.
217
217
 
218
- **Phone calls.** When the user says "call me", "phone me" or "ring me if you get stuck", ask with `ask_user`; there is no separate call tool. Pushary may phone only when the reply includes `phoneCall`; without it no call is planned, so do not promise one. With it, Pushary phones the person who can answer if the question is still unanswered, and records what they say as the answer: an approval, a choice or free text. For a call to the user, `ringsAt` says when it rings, and `waiting_for_calling_hours` means it rings when their calling hours start. While the reply is pending and has no `handoffAction`, keep waiting with `wait_for_answer` and the same `correlationId`: the spoken answer arrives there like any other. Do not cancel the question, ask it again or give up because a call is coming.
218
+ **Phone calls.** When the user says "call me", "phone me" or "ring me if you get stuck", ask with `ask_user`; there is no separate call tool. Pushary may phone only when the reply includes `phoneCall`; without it no call is planned, so do not promise one. With it, Pushary phones the person who can answer if the question is still unanswered, and records what they say as the answer: an approval, a choice or free text. For a call to the user, `ringsAtLocal` says when it rings in their own time (tell them that, not the UTC `ringsAt`), and `waiting_for_calling_hours` means it rings when their calling hours start. While the reply is pending and has no `handoffAction`, keep waiting with `wait_for_answer` and the same `correlationId`: the spoken answer arrives there like any other. Do not cancel the question, ask it again or give up because a call is coming.
219
219
 
220
220
  ```json
221
221
  { "question": "Delete the 3 unused migration files in db/migrate/?", "type": "confirm", "context": "Cleaning up old migrations before the schema change", "toolName": "Bash", "toolTarget": "rm", "actionBody": "rm db/migrate/0003_*.sql", "agentName": "Claude Code - myproject" }
@@ -5,6 +5,7 @@ const DISPLAYED_CREDENTIAL_KEY = String.raw `${CREDENTIAL_NAME}(?:[ \t]*:[ \t]*|
5
5
  const SHELL_INERT_UNIT = String.raw `(?:[A-Za-z0-9_\-./+=:@%^!#]|\\[^\s'"])`;
6
6
  const SHELL_INERT_SINGLE_QUOTED_UNIT = String.raw `[A-Za-z0-9_\-./+=:@%^!#\\]`;
7
7
  const SHELL_INERT_URL_PASSWORD_UNIT = String.raw `(?:[A-Za-z0-9_\-.+=:%^!#]|\\[^\s'"@/])`;
8
+ const AUTHORIZATION_SCHEME = String.raw `(?:basic|digest|token|negotiate|ntlm)`;
8
9
  const PEM_LINE_BREAK = String.raw `(?:\r?\n|(?:\\r)?\\n)`;
9
10
  const credentialAssignmentRule = (key, doubleQuoted, singleQuoted, bare) => ({
10
11
  pattern: new RegExp(String.raw `(${key})(?:(")${doubleQuoted}|(')${singleQuoted}|(["']?)${bare})`, 'gi'),
@@ -41,7 +42,7 @@ const secretRedactionRules = (shapes) => [
41
42
  { pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, replacement: '[redacted]' },
42
43
  { pattern: new RegExp(String.raw `\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)${shapes.urlPassword}@`, 'gi'), replacement: '$1[redacted]@' },
43
44
  { pattern: new RegExp(String.raw `\bbearer${shapes.separator}+[A-Za-z0-9._~+/=-]+`, 'gi'), replacement: 'bearer [redacted]' },
44
- { pattern: new RegExp(String.raw `\bauthorization:${shapes.separator}*${shapes.authorizationValue}`, 'gi'), replacement: 'authorization: [redacted]' },
45
+ { pattern: new RegExp(String.raw `\bauthorization:${shapes.separator}*(?:${AUTHORIZATION_SCHEME}${shapes.separator}+)?${shapes.authorizationValue}`, 'gi'), replacement: 'authorization: [redacted]' },
45
46
  shapes.credentialAssignment,
46
47
  ];
47
48
  export const SECRET_REDACTION_RULES = secretRedactionRules(DISPLAYED_SECRET_SHAPES);
@@ -140,7 +140,7 @@ For any code but 0 or 8, run `npx pushary@latest status` without `--json` and fo
140
140
  - **`mac-app` printed and the code is 3:** have the user sign in to the Pushary Mac app, then check again.
141
141
  - **Status says the key was signed out on this Mac:** have the user sign in again to the Pushary Mac app, open Settings > Agents and press Repair on every agent that offers it (if none does yet, have them close Settings, wait a minute and open it again), then run setup as in "Running setup yourself". It reuses the key the app wrote into the agents' settings; if the first one it finds does not work, it pairs instead. If status then shows the old key `from $PUSHARY_API_KEY`, have the user restart this agent from a new terminal.
142
142
  - **The Key line says `from $PUSHARY_API_KEY`, the code is 2 or 4, and status does not say signed out on this Mac:** this shell exports a bad key, and it wins over any key setup saves. Run setup at most once. If status still fails or shows `Key drift`, have the user delete every `export PUSHARY_API_KEY` line that still sets the old key from their shell startup files, such as ~/.zshrc, ~/.zprofile, ~/.bashrc and ~/.bash_profile, including any setup said it could not update, then restart this agent from a new terminal.
143
- - **Code 6, instead of the steps status prints:** have them install the Pushary app from https://pushary.com/download, sign in to the account this machine uses and allow notifications, then check again. A user who does not use a phone always gets 6: say so and stop. If it still says 6, offer to pair the phone: in the Pushary Mac app under Settings > Phone > Pair when `mac-app` printed, otherwise with setup `--connect app` as in "Running setup yourself", which creates a new key.
143
+ - **Code 6, instead of the steps status prints:** have them install the Pushary app from https://pushary.com/download, sign in to the account this machine uses and allow notifications, then check again. A user who does not use a phone always gets 6: say so and stop. If it still says 6, offer to pair the phone: in the Pushary Mac app under Settings > Phone > Pair when `mac-app` printed, otherwise with `npx pushary@latest pair`, which keeps this machine's key. Run it like setup: in the background with its output going to a log, kept running until it exits, showing the user the link, the QR and the fingerprint as they print. It waits up to 15 minutes for the phone, and a foreground command that times out cancels the pairing code.
144
144
 
145
145
  For `mac-app` without Node or npm, or with a Node version the CLI refuses, open the Pushary Mac app. Check the account, the plan and the Agents connection there, and connect or repair agents in the app. Do not install Node to inspect a native setup, and do not claim an exit code when no CLI ran.
146
146
 
@@ -208,7 +208,7 @@ Asks a question and waits. Use `confirm` for yes or no, `select` for 2 to 6 know
208
208
 
209
209
  **Answers.** `value` is "yes" or "no" for confirm, the chosen option for select, and the typed text for input. Read `note` too: a denial with a note carries the reason or a condition. A select or input value containing "yes" is answer data, not approval of a separate action.
210
210
 
211
- **Phone calls.** When the user says "call me", "phone me" or "ring me if you get stuck", ask with `ask_user`; there is no separate call tool. Pushary may phone only when the reply includes `phoneCall`; without it no call is planned, so do not promise one. With it, Pushary phones the person who can answer if the question is still unanswered, and records what they say as the answer: an approval, a choice or free text. For a call to the user, `ringsAt` says when it rings, and `waiting_for_calling_hours` means it rings when their calling hours start. While the reply is pending and has no `handoffAction`, keep waiting with `wait_for_answer` and the same `correlationId`: the spoken answer arrives there like any other. Do not cancel the question, ask it again or give up because a call is coming.
211
+ **Phone calls.** When the user says "call me", "phone me" or "ring me if you get stuck", ask with `ask_user`; there is no separate call tool. Pushary may phone only when the reply includes `phoneCall`; without it no call is planned, so do not promise one. With it, Pushary phones the person who can answer if the question is still unanswered, and records what they say as the answer: an approval, a choice or free text. For a call to the user, `ringsAtLocal` says when it rings in their own time (tell them that, not the UTC `ringsAt`), and `waiting_for_calling_hours` means it rings when their calling hours start. While the reply is pending and has no `handoffAction`, keep waiting with `wait_for_answer` and the same `correlationId`: the spoken answer arrives there like any other. Do not cancel the question, ask it again or give up because a call is coming.
212
212
 
213
213
  ```json
214
214
  { "question": "Delete the 3 unused migration files in db/migrate/?", "type": "confirm", "context": "Cleaning up old migrations before the schema change", "toolName": "Bash", "toolTarget": "rm", "actionBody": "rm db/migrate/0003_*.sql", "agentName": "Claude Code - myproject" }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pushary
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,113 @@
1
+ # @pushary/openclaw
2
+
3
+ Phone approvals for [OpenClaw](https://openclaw.ai). Before your OpenClaw agent runs a gated tool call, Pushary asks you on your phone. The call runs only after you tap Approve. Anything else blocks it.
4
+
5
+ It is built for an OpenClaw that runs for you alone, often always on, on a small VPS. It works on the Agent and Agent Pro plans, with push approvals on your phone. Phone calls are not available for OpenClaw yet.
6
+
7
+ ## Install
8
+
9
+ Run the Pushary CLI on the machine that runs OpenClaw, as the user the gateway runs as:
10
+
11
+ ```bash
12
+ npx pushary@latest setup --agents openclaw
13
+ ```
14
+
15
+ Setup signs you in, saves your key in `~/.pushary/config.json`, writes this plugin to `~/.pushary/openclaw-plugin`, and runs:
16
+
17
+ ```bash
18
+ openclaw plugins install ~/.pushary/openclaw-plugin --force --accept-capabilities
19
+ openclaw plugins enable pushary --accept-capabilities
20
+ ```
21
+
22
+ The CLI carries the plugin itself, so `npx pushary@latest upgrade`, or running setup again, installs the newer copy. A running gateway picks up the plugin when the install finishes; a stopped one loads it at its next start. Check it with:
23
+
24
+ ```bash
25
+ openclaw plugins inspect pushary --runtime --json
26
+ ```
27
+
28
+ `typedHooks` should list `before_tool_call`. Requires OpenClaw 2026.11.3 or later and Node 24.16 or later.
29
+
30
+ If the gateway runs as another user, or as a service without that home folder, put the key in that user's `~/.openclaw/.env` and restart the gateway:
31
+
32
+ ```bash
33
+ PUSHARY_API_KEY=pk_your_key
34
+ ```
35
+
36
+ ## What it gates
37
+
38
+ - Every `exec` call.
39
+ - The `process` actions that send input to a running session: `write`, `send-keys`, `submit` and `paste`. `process send-keys` can type a command into a session that `exec` started in the background, so it asks like `exec` does. `list`, `poll`, `log`, `kill`, `clear` and `remove` do not ask.
40
+ - The actions that could switch the gate off or change OpenClaw itself: `plugins` `install`, `enable`, `disable`, `uninstall`, `reload` and `reloadAndResume`; `gateway` `update.run`; and every `openclaw` action that changes config, plugins, agents, channels or the gateway. Their read actions (`plugins` `list`, `inspect` and `search`; `gateway` `config.get` and `config.schema.lookup`; `openclaw` `status`, `config_get`, `plugin_list` and the other reads) do not ask. An action the plugin does not know asks.
41
+
42
+ - Every `automations` (also called `cron`) action except `status`, `list`, `get`, `runs` and `next_check`. A scheduled job can run a command outside `before_tool_call`, so adding, changing, running or waking one asks.
43
+ - Every `terminal` action except `read` and `list`. `terminal input` types into a shared operator terminal.
44
+ - A `sessions_spawn` with a `cwd` outside the agent's workspace or in its `hooks` folder, or with a `projectId`, `projectGitUrl` or `worktree`. The question names the folder.
45
+ - Every `write`, `edit` or `apply_patch` into OpenClaw's own files: anything inside an OpenClaw state directory, `~/.config/openclaw` (where Linux keeps `gateway.env`), `~/.pushary`, the `.env` in the gateway's working folder, the config file set by `OPENCLAW_CONFIG_PATH`, and the launchd and systemd files OpenClaw installs for its gateway. The one exception is the agent's own workspace when it lives inside the state directory, which is OpenClaw's default (`~/.openclaw/workspace`). The workspace `hooks` folder always asks, wherever the workspace is, because OpenClaw can load hooks from it as code. The plugin resolves `~`, `@` references, `file://` paths, relative paths against the agent's workspace, and symlinks before it decides, and a path it cannot resolve asks. Writes anywhere else run without asking.
46
+
47
+ To gate more tools, list their OpenClaw tool ids. The list adds to the defaults above; it never replaces them:
48
+
49
+ ```json5
50
+ {
51
+ plugins: {
52
+ entries: {
53
+ pushary: {
54
+ enabled: true,
55
+ config: { gatedTools: ["message", "browser"] },
56
+ },
57
+ },
58
+ },
59
+ }
60
+ ```
61
+
62
+ Ids are read the way OpenClaw names its tools: `bash` means `exec`, `cron` means `automations` and `tool_call` means `dispatch_action`. An entry that is not a tool id gates nothing, and the plugin logs it as an error when it starts. OpenClaw does not mark a tool call as a message send, a payment or a public post, so gate those by naming the tool that does it, such as `message`.
63
+
64
+ ## What happens to a gated call
65
+
66
+ | Pushary says | The call |
67
+ | --- | --- |
68
+ | You answer yes | Runs |
69
+ | You answer anything else | Blocked, and the agent is told not to retry |
70
+ | No answer before the wait ends | Blocked, and the question is withdrawn |
71
+ | OpenClaw cancels the run | Blocked, and the question is withdrawn |
72
+ | The agent was stopped from Pushary | Blocked |
73
+ | No phone, browser or Slack is connected | Blocked, with a link to connect one |
74
+ | Pushary cannot be reached, rejects the key or sends a reply the plugin cannot read | Blocked |
75
+ | Your delivery mode keeps approvals off the phone, or a When away push window passes with no answer | Withdrawn in Pushary and handed to OpenClaw's own approval prompt, which blocks the call when nobody can answer there. On an OpenClaw older than 2026.11.3 the call is blocked instead |
76
+
77
+ A missing answer never becomes an approval. A plugin error or timeout blocks the call: OpenClaw fails closed when a `before_tool_call` hook throws or runs out of time, and the plugin turns its own errors into a block rather than relying on that.
78
+
79
+ ## How long it waits
80
+
81
+ The plugin asks OpenClaw for a five minute `before_tool_call` budget and stops waiting ten seconds before it, so it has time to withdraw the question. If you set `plugins.entries.pushary.hooks.timeouts.before_tool_call` or `hooks.timeoutMs`, the plugin reads that value and ends its wait before it instead.
82
+
83
+ ## Where the key comes from
84
+
85
+ 1. `PUSHARY_API_KEY` in the gateway's environment, which OpenClaw also loads from `~/.openclaw/.env`.
86
+ 2. `apiKey` in `~/.pushary/config.json`, or the file named by `PUSHARY_CONFIG_FILE`.
87
+
88
+ With no key, every gated call is blocked and the reason says how to fix it.
89
+
90
+ ## Removing it
91
+
92
+ ```bash
93
+ npx pushary@latest clean
94
+ ```
95
+
96
+ Clean uninstalls the plugin and puts back the `plugins.entries.pushary` settings you had before setup. Without the plugin, OpenClaw's own exec approvals still apply, and nothing reaches your phone.
97
+
98
+ ## Limits
99
+
100
+ - The gate covers the tools listed above and any you add. It does not see other tools: for example the file-transfer plugin's `file_write` is not gated unless you add it to `gatedTools`.
101
+ - ACP sessions set to approve everything, and CLI backends, run tools inside the external harness. Those tool calls never reach `before_tool_call`, so the plugin cannot gate them.
102
+ - This is an approval layer, not a sandbox. Pair it with OpenClaw's own sandboxing and `tools.fs.workspaceOnly`.
103
+ - The plugin talks only to `https://pushary.com` and `https://www.pushary.com`, the hosts the CLI uses. Any other `PUSHARY_BASE_URL` blocks every gated call, so a changed setting cannot point it at a server that always says yes.
104
+ - The plugin is not told which folder a tool runs in. It resolves a relative path against the agent's workspace, any folder inside it, and the gateway's working folder, and a spawned session in any other folder asks first. A run started some other way in a folder inside OpenClaw's state is not covered.
105
+ - Config `$include` files outside the state directory, including roots named by `OPENCLAW_INCLUDE_ROOTS`, are not protected.
106
+ - Windows has not been tested.
107
+ - Pushary's tool rules from the dashboard are not evaluated on the machine. Every gated call asks.
108
+ - Another plugin that rewrites tool parameters can change what runs, including a plugin that runs before this one: OpenClaw gives each plugin its own copy of the call and keeps the earlier plugin's rewrite. Pushary shows and approves the parameters it was given.
109
+ - The wait is held inside one gateway process. If the gateway restarts during a wait, OpenClaw drops the call and the question stays in Pushary until it expires.
110
+
111
+ ## License
112
+
113
+ MIT
@@ -0,0 +1,5 @@
1
+ // Generated by scripts/generate-editor-redaction.mjs.
2
+ const API_KEY_PREFIX_SHAPE = 'pk_[a-f0-9]+';
3
+ export const API_KEY_PREFIX_PATTERN = new RegExp(`^${API_KEY_PREFIX_SHAPE}$`);
4
+ export const API_KEY_PATTERN = new RegExp(`^${API_KEY_PREFIX_SHAPE}\\.[a-f0-9]+$`);
5
+ export const isValidApiKey = (value) => API_KEY_PATTERN.test(value);
@@ -0,0 +1,88 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { approvalQuestionFor } from './approval-question.js';
3
+ import { runApprovalGate } from './gate.js';
4
+ import { notConnectedResultFor, openClawResultFor } from './gate-result.js';
5
+ import { holdMsWithin, hookBudgetFrom, REQUESTED_HOOK_TIMEOUT_MS } from './hook-budget.js';
6
+ import { BEFORE_TOOL_CALL_HOOK, } from './host-api.js';
7
+ import { handsBackToTheHost, hostSupportFrom, MIN_HOST_VERSION } from './host-version.js';
8
+ import { openClawWriteGuardFor } from './openclaw-write-guard.js';
9
+ import { askingAgentName, hookMatcherFor, hostToolId, needsApproval, readGateSettings } from './settings.js';
10
+ export const SESSION_ID_MAX = 128;
11
+ const MILLISECONDS_PER_SECOND = 1_000;
12
+ const UNEXPECTED_FAILURE_REASON = 'The Pushary approval gate failed unexpectedly, so this tool call was blocked. Nothing ran.';
13
+ const boundedSessionId = (value) => value.length <= SESSION_ID_MAX ? value : createHash('sha256').update(value, 'utf8').digest('hex');
14
+ const sessionIdOf = (context) => {
15
+ const session = (context.sessionId ?? context.sessionKey)?.trim();
16
+ return session ? boundedSessionId(session) : undefined;
17
+ };
18
+ export const createApprovalGateHandler = (options, environment) => async (event, context) => {
19
+ const reachesOpenClawState = options.reachesOpenClawState({ toolId: hostToolId(event.toolName), event, agentId: context.agentId });
20
+ if (!needsApproval(options.settings, event) && !reachesOpenClawState)
21
+ return undefined;
22
+ const agentName = askingAgentName(context.agentId);
23
+ const question = approvalQuestionFor(event, agentName);
24
+ const reading = environment.readConnection();
25
+ if (reading.kind !== 'ready')
26
+ return notConnectedResultFor(reading.kind, question.toolName);
27
+ const sessionId = sessionIdOf(context);
28
+ const outcome = await runApprovalGate({
29
+ question,
30
+ agentName,
31
+ requestId: environment.newRequestId(),
32
+ holdMs: options.holdMs,
33
+ withdrawReserveMs: options.withdrawReserveMs,
34
+ ...(sessionId === undefined ? {} : { sessionId }),
35
+ ...(reading.connection.machineId === null ? {} : { machineId: reading.connection.machineId }),
36
+ ...(context.abortSignal === undefined ? {} : { signal: context.abortSignal }),
37
+ }, { questions: environment.questionsFor(reading.connection), clock: environment.clock });
38
+ return openClawResultFor(outcome, question, options.handBackSurface);
39
+ };
40
+ const failingClosed = (handler, api) => async (event, context) => {
41
+ try {
42
+ return await handler(event, context);
43
+ }
44
+ catch (error) {
45
+ api.logger.error(`pushary: approval gate failed for ${event.toolName}: ${String(error)}`);
46
+ return { block: true, blockReason: UNEXPECTED_FAILURE_REASON };
47
+ }
48
+ };
49
+ const gatedToolsLine = (settings) => settings.gatedTools.join(', ');
50
+ const reportSettings = (api, reading) => {
51
+ if (reading.kind === 'invalid') {
52
+ api.logger.error(`pushary: plugins.entries.pushary.config.gatedTools must be a list of OpenClaw tool ids; it was ignored, and only ${gatedToolsLine(reading.settings)} ask`);
53
+ }
54
+ if (reading.kind === 'configured' && reading.rejected.length > 0) {
55
+ api.logger.error(`pushary: these gatedTools entries are not OpenClaw tool ids and gate nothing: ${reading.rejected.join(', ')}`);
56
+ }
57
+ };
58
+ const reportHostSupport = (api, support) => {
59
+ if (support.kind === 'supported')
60
+ return;
61
+ const found = support.kind === 'too_old' ? `OpenClaw ${support.version}` : 'an OpenClaw that does not report its version';
62
+ api.logger.warn(`pushary: this plugin is built for OpenClaw ${MIN_HOST_VERSION} or later and found ${found}; approvals that would go to OpenClaw's own prompt are blocked instead`);
63
+ };
64
+ const handBackSurfaceFor = (support) => (handsBackToTheHost(support) ? 'openclaw_prompt' : 'none');
65
+ export const registerApprovalGate = (api, environment) => {
66
+ const reading = readGateSettings(api.pluginConfig);
67
+ reportSettings(api, reading);
68
+ const support = hostSupportFrom(api.runtime);
69
+ reportHostSupport(api, support);
70
+ const hookTimeoutMs = hookBudgetFrom(api.config, api.id).timeoutMs;
71
+ const holdMs = holdMsWithin(hookTimeoutMs);
72
+ const handlerOptions = {
73
+ settings: reading.settings,
74
+ holdMs,
75
+ withdrawReserveMs: hookTimeoutMs - holdMs,
76
+ handBackSurface: handBackSurfaceFor(support),
77
+ reachesOpenClawState: openClawWriteGuardFor(api),
78
+ };
79
+ const handler = failingClosed(createApprovalGateHandler(handlerOptions, environment), api);
80
+ try {
81
+ api.on(BEFORE_TOOL_CALL_HOOK, handler, { matcher: hookMatcherFor(reading.settings), timeoutMs: REQUESTED_HOOK_TIMEOUT_MS });
82
+ }
83
+ catch (error) {
84
+ api.logger.error(`pushary: OpenClaw refused the tool list (${String(error)}), so every tool call is checked against it by name instead`);
85
+ api.on(BEFORE_TOOL_CALL_HOOK, handler, { timeoutMs: REQUESTED_HOOK_TIMEOUT_MS });
86
+ }
87
+ api.logger.info(`pushary: asking before ${gatedToolsLine(reading.settings)}, waiting up to ${Math.round(holdMs / MILLISECONDS_PER_SECOND)} s for an answer`);
88
+ };
@@ -0,0 +1,66 @@
1
+ import { redactSecrets, redactSecretsDeep } from './redaction.js';
2
+ import { SESSIONS_SPAWN_TOOL, SPAWN_FOLDER_PARAMETER } from './protected-writes.js';
3
+ import { AGENT_LABEL } from './settings.js';
4
+ export const QUESTION_SUMMARY_MAX = 160;
5
+ export const CONTEXT_MAX = 500;
6
+ export const ACTION_MAX = 500;
7
+ export const ACTION_BODY_MAX = 4000;
8
+ export const TOOL_TARGET_MAX = 80;
9
+ export const TOOL_NAME_MAX = 100;
10
+ export const APPROVAL_TITLE_MAX = 80;
11
+ export const APPROVAL_DESCRIPTION_MAX = 512;
12
+ const COMMAND_PARAMETERS = ['command', 'code'];
13
+ const WORKDIR_PARAMETER = 'workdir';
14
+ const TARGET_WORDS = 2;
15
+ const ELLIPSIS = '…';
16
+ const collapsed = (text) => text.split(/\s+/).filter(Boolean).join(' ');
17
+ export const truncated = (text, max) => text.length <= max ? text : `${text.slice(0, max - ELLIPSIS.length)}${ELLIPSIS}`;
18
+ const stringParameter = (params, name) => {
19
+ const value = params[name];
20
+ return typeof value === 'string' && value.trim().length > 0 ? value : undefined;
21
+ };
22
+ const commandOf = (event) => COMMAND_PARAMETERS.map(name => stringParameter(event.params, name)).find(value => value !== undefined);
23
+ const serializedParams = (params) => {
24
+ try {
25
+ return JSON.stringify(params) ?? '';
26
+ }
27
+ catch {
28
+ return '';
29
+ }
30
+ };
31
+ const questionFor = (toolName, summary, command, folder) => {
32
+ if (command !== undefined)
33
+ return `Allow ${AGENT_LABEL} to run \`${summary}\`?`;
34
+ if (folder !== undefined)
35
+ return `Allow ${AGENT_LABEL} to start a session in \`${truncated(collapsed(folder), QUESTION_SUMMARY_MAX)}\`?`;
36
+ return `Allow ${AGENT_LABEL} to use ${toolName}${summary ? `: \`${summary}\`` : ''}?`;
37
+ };
38
+ const contextLines = (event, agentName) => {
39
+ const workdir = stringParameter(event.params, WORKDIR_PARAMETER) ?? stringParameter(event.params, SPAWN_FOLDER_PARAMETER);
40
+ return [
41
+ `${agentName} wants to use its ${event.toolName} tool.`,
42
+ ...(workdir ? [`Working directory: ${workdir}`] : []),
43
+ ...(event.params.elevated === true ? ['It asked for elevated mode, outside the sandbox.'] : []),
44
+ ];
45
+ };
46
+ const targetOf = (command) => {
47
+ if (command === undefined)
48
+ return undefined;
49
+ const head = collapsed(command).split(' ').slice(0, TARGET_WORDS).join(' ');
50
+ return head ? truncated(head, TOOL_TARGET_MAX) : undefined;
51
+ };
52
+ export const approvalQuestionFor = (event, agentName) => {
53
+ const toolName = truncated(event.toolName.trim(), TOOL_NAME_MAX);
54
+ const command = commandOf(event);
55
+ const raw = command ?? serializedParams(event.params);
56
+ const body = redactSecrets(raw);
57
+ const summary = truncated(collapsed(body), QUESTION_SUMMARY_MAX);
58
+ return {
59
+ question: questionFor(toolName, summary, command, event.toolName === SESSIONS_SPAWN_TOOL ? stringParameter(event.params, SPAWN_FOLDER_PARAMETER) : undefined),
60
+ context: truncated(redactSecrets(contextLines(event, agentName).join(' ')), CONTEXT_MAX),
61
+ toolName,
62
+ toolTarget: targetOf(command === undefined ? undefined : body),
63
+ action: truncated(collapsed(body), ACTION_MAX),
64
+ actionBody: truncated(redactSecretsDeep(raw), ACTION_BODY_MAX),
65
+ };
66
+ };
@@ -0,0 +1,101 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import { homedir, hostname } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { isValidApiKey } from './api-key-shape.js';
6
+ import { isPusharyHost } from './pushary-hosts.js';
7
+ export const API_KEY_VARIABLE = 'PUSHARY_API_KEY';
8
+ export const BASE_URL_VARIABLE = 'PUSHARY_BASE_URL';
9
+ export const CONFIG_FILE_VARIABLE = 'PUSHARY_CONFIG_FILE';
10
+ export const DEFAULT_BASE_URL = 'https://pushary.com';
11
+ const PUSHARY_DIRECTORY = '.pushary';
12
+ const PUSHARY_CONFIG_FILE = 'config.json';
13
+ const SHARED_MACHINE_ID_FILE = 'machine-id';
14
+ const SHARED_MACHINE_ID_PATTERN = /^[A-Za-z0-9-]{1,128}$/;
15
+ const HOSTNAME_MACHINE_ID_LENGTH = 8;
16
+ const PUSHARY_PROTOCOL = 'https:';
17
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
18
+ const parsedJson = (text) => {
19
+ if (text === null)
20
+ return null;
21
+ try {
22
+ return JSON.parse(text);
23
+ }
24
+ catch {
25
+ return null;
26
+ }
27
+ };
28
+ const usableApiKey = (value) => {
29
+ if (typeof value !== 'string')
30
+ return null;
31
+ const key = value.trim();
32
+ return isValidApiKey(key) ? key : null;
33
+ };
34
+ const pusharyPath = (sources, file) => join(sources.homeDirectory, PUSHARY_DIRECTORY, file);
35
+ const configFilePath = (sources) => {
36
+ const configured = sources.environment[CONFIG_FILE_VARIABLE]?.trim();
37
+ return configured ? configured : pusharyPath(sources, PUSHARY_CONFIG_FILE);
38
+ };
39
+ const apiKeyFrom = (sources) => {
40
+ const fromEnvironment = usableApiKey(sources.environment[API_KEY_VARIABLE]);
41
+ if (fromEnvironment !== null)
42
+ return fromEnvironment;
43
+ const config = parsedJson(sources.readText(configFilePath(sources)));
44
+ return isRecord(config) ? usableApiKey(config.apiKey) : null;
45
+ };
46
+ const isPusharyOrigin = (url) => url.protocol === PUSHARY_PROTOCOL
47
+ && url.port === ''
48
+ && url.username === ''
49
+ && url.password === ''
50
+ && isPusharyHost(url.hostname);
51
+ const baseUrlFrom = (environment) => {
52
+ const configured = environment[BASE_URL_VARIABLE]?.trim();
53
+ if (!configured)
54
+ return DEFAULT_BASE_URL;
55
+ try {
56
+ const url = new URL(configured);
57
+ return isPusharyOrigin(url) ? url.origin : null;
58
+ }
59
+ catch {
60
+ return null;
61
+ }
62
+ };
63
+ const hostnameMachineId = (sources) => {
64
+ const host = sources.hostName();
65
+ return host ? createHash('sha256').update(host, 'utf8').digest('hex').slice(0, HOSTNAME_MACHINE_ID_LENGTH) : null;
66
+ };
67
+ const machineIdFrom = (sources) => {
68
+ const shared = sources.readText(pusharyPath(sources, SHARED_MACHINE_ID_FILE))?.trim() ?? '';
69
+ return SHARED_MACHINE_ID_PATTERN.test(shared) ? shared : hostnameMachineId(sources);
70
+ };
71
+ export const readPusharyConnection = (sources) => {
72
+ const baseUrl = baseUrlFrom(sources.environment);
73
+ if (baseUrl === null)
74
+ return { kind: 'invalid_base_url' };
75
+ const apiKey = apiKeyFrom(sources);
76
+ if (apiKey === null)
77
+ return { kind: 'missing_api_key' };
78
+ return { kind: 'ready', connection: { baseUrl, apiKey, machineId: machineIdFrom(sources) } };
79
+ };
80
+ const readTextFile = (path) => {
81
+ try {
82
+ return readFileSync(path, 'utf8');
83
+ }
84
+ catch {
85
+ return null;
86
+ }
87
+ };
88
+ const currentHostName = () => {
89
+ try {
90
+ return hostname() || null;
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ };
96
+ export const processConnectionSources = () => ({
97
+ environment: process.env,
98
+ homeDirectory: homedir(),
99
+ readText: readTextFile,
100
+ hostName: currentHostName,
101
+ });
@@ -0,0 +1,6 @@
1
+ // Generated by scripts/generate-editor-redaction.mjs.
2
+ export const APPROVE_ANSWER = 'yes';
3
+ export const STOP_HANDOFF_ACTION = 'stop';
4
+ export const DECISION_STOP_STATUSES = ['cancelled', 'unavailable', 'stopped', 'missing'];
5
+ export const isDecisionStoppedReply = (reply) => reply.handoffAction === STOP_HANDOFF_ACTION || (typeof reply.status === 'string' && DECISION_STOP_STATUSES.includes(reply.status));
6
+ export const isApprovingAnswer = (answer) => answer === APPROVE_ANSWER;
@@ -0,0 +1,58 @@
1
+ import { APPROVAL_DESCRIPTION_MAX, APPROVAL_TITLE_MAX, truncated } from './approval-question.js';
2
+ import { API_KEY_VARIABLE, BASE_URL_VARIABLE } from './connection.js';
3
+ import { MIN_HOST_VERSION } from './host-version.js';
4
+ export const SETUP_COMMAND = 'npx pushary@latest setup';
5
+ export const DEVICES_URL = 'https://pushary.com/dashboard/agent/settings';
6
+ export const HAND_BACK_DECISIONS = ['allow-once', 'deny'];
7
+ const SECONDS_PER_MINUTE = 60;
8
+ const MILLISECONDS_PER_SECOND = 1_000;
9
+ const blocked = (blockReason) => ({ block: true, blockReason });
10
+ const waitedFor = (heldMs) => {
11
+ const seconds = Math.round(heldMs / MILLISECONDS_PER_SECOND);
12
+ if (seconds < SECONDS_PER_MINUTE)
13
+ return `${seconds} seconds`;
14
+ const minutes = Math.round(seconds / SECONDS_PER_MINUTE);
15
+ return minutes === 1 ? '1 minute' : `${minutes} minutes`;
16
+ };
17
+ const unavailableReason = (toolName, outcome) => {
18
+ if (outcome.failure === 'unauthorized') {
19
+ return `Pushary rejected the API key, so this ${toolName} call was blocked. Nothing ran. Run ${SETUP_COMMAND} again to get a new key, then restart the OpenClaw gateway.`;
20
+ }
21
+ if (outcome.failure === 'tool_error' || outcome.failure === 'refused') {
22
+ return `Pushary refused the approval request, so this ${toolName} call was blocked. Nothing ran. Answer or cancel your open questions in Pushary, then try again.`;
23
+ }
24
+ return `Pushary could not be reached, so nobody could approve this ${toolName} call and it was blocked. Nothing ran. Try again in a moment.`;
25
+ };
26
+ const handedBack = (question) => ({
27
+ requireApproval: {
28
+ title: truncated(question.question, APPROVAL_TITLE_MAX),
29
+ description: truncated(`${question.context} ${question.action}`, APPROVAL_DESCRIPTION_MAX),
30
+ severity: 'warning',
31
+ allowedDecisions: [...HAND_BACK_DECISIONS],
32
+ },
33
+ });
34
+ const noPromptToHandBackTo = (toolName) => blocked(`Your Pushary delivery mode keeps this approval off your phone, and this OpenClaw is older than ${MIN_HOST_VERSION}, so it cannot ask in its own prompt. This ${toolName} call was blocked. Update OpenClaw, or change the delivery mode in Pushary.`);
35
+ export const openClawResultFor = (outcome, question, handBackSurface) => {
36
+ const tool = question.toolName;
37
+ switch (outcome.kind) {
38
+ case 'approved':
39
+ return undefined;
40
+ case 'denied':
41
+ return blocked(`The person you asked in Pushary did not approve this ${tool} call, so it was blocked. Do not retry it. Ask them what to do instead.`);
42
+ case 'unanswered':
43
+ return blocked(`Nobody answered the Pushary approval within ${waitedFor(outcome.heldMs)}, so this ${tool} call was blocked. Nothing ran.`);
44
+ case 'stopped':
45
+ return blocked(`Pushary stopped this request, so this ${tool} call was blocked. Stop and wait for instructions.`);
46
+ case 'cancelled':
47
+ return blocked(`This ${tool} call was cancelled before anyone answered the Pushary approval. Nothing ran.`);
48
+ case 'undeliverable':
49
+ return blocked(`No phone, browser or Slack is connected to Pushary, so nobody could approve this ${tool} call and it was blocked. Connect one at ${DEVICES_URL}.`);
50
+ case 'handed_back':
51
+ return handBackSurface === 'openclaw_prompt' ? handedBack(question) : noPromptToHandBackTo(tool);
52
+ case 'unavailable':
53
+ return blocked(unavailableReason(tool, outcome));
54
+ }
55
+ };
56
+ export const notConnectedResultFor = (problem, toolName) => problem === 'missing_api_key'
57
+ ? blocked(`Pushary is not set up for OpenClaw on this machine: ${API_KEY_VARIABLE} is missing, so this ${toolName} call was blocked. Run ${SETUP_COMMAND}, or add ${API_KEY_VARIABLE} to ~/.openclaw/.env, then restart the OpenClaw gateway.`)
58
+ : blocked(`${BASE_URL_VARIABLE} is not https://pushary.com or https://www.pushary.com, so this ${toolName} call was blocked. Remove it, then restart the OpenClaw gateway.`);