@pushary/agent-hooks 0.27.0 → 0.28.1
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.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/dist/bin/pushary-clean.js +3 -3
- package/dist/bin/pushary-codex-hook.js +2 -2
- package/dist/bin/pushary-codex.js +2 -2
- package/dist/bin/pushary-doctor.js +2 -2
- package/dist/bin/pushary-gemini-hook.js +2 -2
- package/dist/bin/pushary-hook.js +3 -3
- package/dist/bin/pushary-post-hook.js +2 -2
- package/dist/bin/pushary-prompt-hook.js +2 -2
- package/dist/bin/pushary-setup.js +4 -4
- package/dist/bin/pushary-stop-hook.js +2 -2
- package/dist/chunk-22CV7V7A.js +38 -0
- package/dist/chunk-2BE2IPMO.js +315 -0
- package/dist/chunk-2CRLBMOX.js +244 -0
- package/dist/chunk-2HMNOZPY.js +109 -0
- package/dist/chunk-2I6DLXJN.js +219 -0
- package/dist/chunk-2Q6XPZ4Q.js +395 -0
- package/dist/chunk-3LC4YUMA.js +194 -0
- package/dist/chunk-3MIR7ODJ.js +112 -0
- package/dist/chunk-3QZESA66.js +222 -0
- package/dist/chunk-4Z4MB37G.js +96 -0
- package/dist/chunk-5GFUI5N6.js +132 -0
- package/dist/chunk-5JEDLXEC.js +99 -0
- package/dist/chunk-5LTQNC7R.js +824 -0
- package/dist/chunk-5MA3CPZB.js +141 -0
- package/dist/chunk-5QHQVXWN.js +174 -0
- package/dist/{chunk-WXWHRXDK.js → chunk-5V3XJ2ES.js} +1 -1
- package/dist/chunk-6A3WCJO2.js +416 -0
- package/dist/chunk-6QWFMVCD.js +328 -0
- package/dist/chunk-6SRXMZAN.js +99 -0
- package/dist/chunk-7OXL2QQ4.js +357 -0
- package/dist/chunk-7PTU7TGE.js +96 -0
- package/dist/chunk-AB4KX4XT.js +109 -0
- package/dist/chunk-AC4UYAGX.js +136 -0
- package/dist/chunk-ACE77TKQ.js +328 -0
- package/dist/chunk-BHAMEPOP.js +323 -0
- package/dist/chunk-BYNYYZWW.js +412 -0
- package/dist/{chunk-FDR5WYT7.js → chunk-C4BMEVK7.js} +1 -1
- package/dist/chunk-C5TFTNHG.js +244 -0
- package/dist/chunk-CH53PBQN.js +265 -0
- package/dist/chunk-DF3BM6BF.js +195 -0
- package/dist/chunk-DKZVKEOW.js +175 -0
- package/dist/chunk-EMPL27ZV.js +96 -0
- package/dist/chunk-EQJXMEIR.js +175 -0
- package/dist/{chunk-MVNOP5IZ.js → chunk-FB3N633T.js} +1 -1
- package/dist/chunk-FGZZRCOG.js +194 -0
- package/dist/chunk-FXYTRZHC.js +177 -0
- package/dist/chunk-GTJGZBTQ.js +328 -0
- package/dist/chunk-GYPPVD3P.js +1047 -0
- package/dist/chunk-HJMFYDWY.js +222 -0
- package/dist/chunk-HRQEECB6.js +315 -0
- package/dist/chunk-HWEMAAOY.js +370 -0
- package/dist/{chunk-VHD3GMZ3.js → chunk-I4GMPUYN.js} +2 -2
- package/dist/{chunk-TUILTFLS.js → chunk-IAOXM7X5.js} +1 -1
- package/dist/chunk-IBWCHA5M.js +10 -0
- package/dist/chunk-JPRRYC5X.js +328 -0
- package/dist/chunk-KTM4ZQ3W.js +96 -0
- package/dist/chunk-KTP2EPVB.js +27 -0
- package/dist/chunk-KYARP7KP.js +97 -0
- package/dist/chunk-LXUHXG2X.js +937 -0
- package/dist/chunk-M2N5DYWN.js +247 -0
- package/dist/chunk-M4GDBGXF.js +824 -0
- package/dist/chunk-M5F2L4KF.js +177 -0
- package/dist/chunk-M6S3M6E3.js +244 -0
- package/dist/chunk-N7VXDBQU.js +6 -0
- package/dist/chunk-O2QL6U6G.js +194 -0
- package/dist/chunk-O6A5RHWY.js +122 -0
- package/dist/chunk-ODUXELPM.js +219 -0
- package/dist/chunk-OF5WIOYS.js +129 -0
- package/dist/chunk-OP4QAN23.js +99 -0
- package/dist/chunk-P4JH2Q7Z.js +102 -0
- package/dist/chunk-P6QBZS27.js +231 -0
- package/dist/chunk-PMD5JSV3.js +242 -0
- package/dist/chunk-PSSHNBEL.js +177 -0
- package/dist/chunk-PZO7RZ5W.js +145 -0
- package/dist/chunk-QEPRH7JB.js +315 -0
- package/dist/chunk-QNEYHDKR.js +145 -0
- package/dist/chunk-QRXWPZKN.js +308 -0
- package/dist/chunk-QY4L6XHN.js +384 -0
- package/dist/chunk-RNWPCELY.js +176 -0
- package/dist/chunk-RSHN2AQ7.js +29 -0
- package/dist/chunk-RZLVE57X.js +38 -0
- package/dist/chunk-SDCIKREA.js +241 -0
- package/dist/chunk-SDREQWNI.js +175 -0
- package/dist/chunk-SH26ZOHU.js +159 -0
- package/dist/chunk-SJ5MC36D.js +882 -0
- package/dist/chunk-TRLBBLSS.js +176 -0
- package/dist/chunk-U6OXZPYC.js +384 -0
- package/dist/chunk-UDQZNO5H.js +231 -0
- package/dist/chunk-UIBTFZUD.js +314 -0
- package/dist/chunk-USUCPCUC.js +156 -0
- package/dist/chunk-UTK3TJC4.js +882 -0
- package/dist/chunk-V4GLWPD7.js +174 -0
- package/dist/chunk-VC6U3QGF.js +142 -0
- package/dist/chunk-VIST7ACL.js +88 -0
- package/dist/chunk-VUNL35KE.js +16 -0
- package/dist/chunk-VWBNI4SC.js +174 -0
- package/dist/chunk-W5KRWUNE.js +262 -0
- package/dist/chunk-WCGKLHCL.js +154 -0
- package/dist/chunk-WNXGIEX7.js +219 -0
- package/dist/chunk-WPVL6VIT.js +160 -0
- package/dist/chunk-X3YCHQQK.js +357 -0
- package/dist/chunk-X6LV22NZ.js +229 -0
- package/dist/chunk-XHTZ2DWC.js +206 -0
- package/dist/chunk-XPVSZIA3.js +315 -0
- package/dist/chunk-Y633ZIJF.js +384 -0
- package/dist/chunk-YCL4GUFR.js +222 -0
- package/dist/chunk-YTMKB44I.js +220 -0
- package/dist/chunk-Z5PL3K7C.js +322 -0
- package/dist/chunk-ZWBS3T7Q.js +244 -0
- package/dist/pushary-mode-T7XOPI6Z.js +83 -0
- package/dist/pushary-wait-4BUC6ZM6.js +93 -0
- package/dist/src/index.js +3 -3
- package/package.json +25 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getApiKey,
|
|
4
|
+
getBaseUrl
|
|
5
|
+
} from "./chunk-NKXSILEW.js";
|
|
6
|
+
|
|
7
|
+
// bin/pushary-wait.ts
|
|
8
|
+
var dim = (s) => `\x1B[2m${s}\x1B[0m`;
|
|
9
|
+
var bold = (s) => `\x1B[1m${s}\x1B[0m`;
|
|
10
|
+
var green = (s) => `\x1B[32m${s}\x1B[0m`;
|
|
11
|
+
var cyan = (s) => `\x1B[36m${s}\x1B[0m`;
|
|
12
|
+
var yellow = (s) => `\x1B[33m${s}\x1B[0m`;
|
|
13
|
+
var MAX_WINDOW = 300;
|
|
14
|
+
var describeLadder = (p) => {
|
|
15
|
+
if (p.mode === "terminal_only") return "decide in the terminal, no push";
|
|
16
|
+
if (p.mode === "notify_only") return "send a heads-up, the terminal decides";
|
|
17
|
+
if (p.mode === "push_only") {
|
|
18
|
+
const tail = p.timeoutAction === "approve" ? "then auto-approve" : p.timeoutAction === "deny" ? "then auto-deny" : p.timeoutAction === "wait" ? "holding for your phone, then ask in the terminal" : "then ask in the terminal";
|
|
19
|
+
if (p.timeoutAction === "wait") return `wait for your phone, ${tail}`;
|
|
20
|
+
return `wait for your phone up to ${p.timeoutSeconds}s, ${tail}`;
|
|
21
|
+
}
|
|
22
|
+
return `ping your phone ${p.pushFirstSeconds}s, then ask in the terminal`;
|
|
23
|
+
};
|
|
24
|
+
var printLadder = (data) => {
|
|
25
|
+
console.log();
|
|
26
|
+
console.log(` ${bold("Wait ladder")} ${dim("(what happens when you don't answer)")}`);
|
|
27
|
+
console.log();
|
|
28
|
+
console.log(` Default push window: ${cyan(`${data.defaultPushFirstSeconds}s`)} ${dim("(catch-all tools)")}`);
|
|
29
|
+
if (data.modeOverride) {
|
|
30
|
+
console.log(` ${yellow("!")} Active mode override: ${cyan(data.modeOverride)} ${dim("(pushary mode status)")}`);
|
|
31
|
+
}
|
|
32
|
+
console.log();
|
|
33
|
+
const rows = [...data.policies].sort((a, b) => a.tool === "*" ? -1 : b.tool === "*" ? 1 : a.tool.localeCompare(b.tool));
|
|
34
|
+
const width = Math.max(...rows.map((p) => p.tool.length), 4);
|
|
35
|
+
for (const p of rows) {
|
|
36
|
+
const label = p.tool === "*" ? "default (*)" : p.tool;
|
|
37
|
+
console.log(` ${label.padEnd(width + 2)} ${dim("\xB7")} ${describeLadder(p)}`);
|
|
38
|
+
}
|
|
39
|
+
console.log();
|
|
40
|
+
console.log(` ${dim("Set the default window:")} ${cyan("pushary wait <seconds>")}`);
|
|
41
|
+
console.log(` ${dim("Reset it:")} ${cyan("pushary wait clear")}`);
|
|
42
|
+
console.log(` ${dim("Per-tool rules live in the dashboard under Agent \u2192 Policies.")}`);
|
|
43
|
+
};
|
|
44
|
+
var fetchPolicy = async (baseUrl, headers) => {
|
|
45
|
+
const res = await fetch(`${baseUrl}/api/mcp/policy`, { headers });
|
|
46
|
+
if (!res.ok) throw new Error(`policy fetch failed (${res.status})`);
|
|
47
|
+
return res.json();
|
|
48
|
+
};
|
|
49
|
+
var setWindow = async (baseUrl, headers, seconds) => {
|
|
50
|
+
const res = await fetch(`${baseUrl}/api/mcp/policy`, {
|
|
51
|
+
method: "PATCH",
|
|
52
|
+
headers,
|
|
53
|
+
body: JSON.stringify({ defaultPushFirstSeconds: seconds })
|
|
54
|
+
});
|
|
55
|
+
if (!res.ok) {
|
|
56
|
+
const err = await res.json().catch(() => ({}));
|
|
57
|
+
throw new Error(err.error ?? res.statusText);
|
|
58
|
+
}
|
|
59
|
+
const data = await res.json();
|
|
60
|
+
return data.defaultPushFirstSeconds;
|
|
61
|
+
};
|
|
62
|
+
var main = async () => {
|
|
63
|
+
const apiKey = getApiKey();
|
|
64
|
+
const baseUrl = getBaseUrl();
|
|
65
|
+
const headers = {
|
|
66
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
};
|
|
69
|
+
const rest = process.argv.slice(2);
|
|
70
|
+
const args = rest[0] === "wait" ? rest.slice(1) : rest;
|
|
71
|
+
const arg = args[0];
|
|
72
|
+
if (!arg || arg === "status") {
|
|
73
|
+
printLadder(await fetchPolicy(baseUrl, headers));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (arg === "clear" || arg === "reset") {
|
|
77
|
+
const value2 = await setWindow(baseUrl, headers, 20);
|
|
78
|
+
console.log(` ${green("\u2713")} Default push window reset to ${cyan(`${value2}s`)}`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const seconds = Number(arg);
|
|
82
|
+
if (!Number.isFinite(seconds) || seconds < 0 || seconds > MAX_WINDOW) {
|
|
83
|
+
console.log(` ${yellow("!")} Invalid window: ${arg} ${dim(`(use 0-${MAX_WINDOW} seconds, or "status" / "clear")`)}`);
|
|
84
|
+
console.log(` ${dim("Usage: pushary wait <seconds> | status | clear")}`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const value = await setWindow(baseUrl, headers, Math.trunc(seconds));
|
|
88
|
+
console.log(` ${green("\u2713")} Default push window set to ${cyan(`${value}s`)} ${dim("\u2014 ping your phone that long, then the terminal takes over")}`);
|
|
89
|
+
};
|
|
90
|
+
main().catch((err) => {
|
|
91
|
+
console.error(` ${yellow("!")} ${err instanceof Error ? err.message : err}`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
});
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-P6QBZS27.js";
|
|
4
4
|
import "../chunk-KQYIHZ5E.js";
|
|
5
5
|
import {
|
|
6
6
|
askUser,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
reportEvent,
|
|
15
15
|
resolvePolicy,
|
|
16
16
|
waitForAnswer
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-IAOXM7X5.js";
|
|
18
18
|
import "../chunk-DWED7BS3.js";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-Z5PL3K7C.js";
|
|
20
20
|
import {
|
|
21
21
|
getApiKey,
|
|
22
22
|
getBaseUrl
|
package/package.json
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushary/agent-hooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pushary",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"claude-code-hooks",
|
|
9
|
+
"codex",
|
|
10
|
+
"cursor",
|
|
11
|
+
"gemini-cli",
|
|
12
|
+
"hermes",
|
|
13
|
+
"mcp",
|
|
14
|
+
"mcp-server",
|
|
15
|
+
"ai-agent",
|
|
16
|
+
"ai-coding-agent",
|
|
17
|
+
"human-in-the-loop",
|
|
18
|
+
"hitl",
|
|
19
|
+
"push-notifications",
|
|
20
|
+
"notifications",
|
|
21
|
+
"agent-permissions",
|
|
22
|
+
"permission-hooks",
|
|
23
|
+
"tool-approvals",
|
|
24
|
+
"pretooluse"
|
|
25
|
+
],
|
|
5
26
|
"author": "Pushary <business@pushary.com>",
|
|
6
27
|
"homepage": "https://pushary.com",
|
|
7
28
|
"repository": {
|
|
@@ -9,6 +30,9 @@
|
|
|
9
30
|
"url": "git+https://github.com/pushary/pushary.git",
|
|
10
31
|
"directory": "packages/agent-hooks"
|
|
11
32
|
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/pushary/pushary/issues"
|
|
35
|
+
},
|
|
12
36
|
"license": "MIT",
|
|
13
37
|
"type": "module",
|
|
14
38
|
"engines": {
|