@pushary/agent-hooks 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/pushary-setup.js +13 -19
- package/package.json +1 -1
|
@@ -78,19 +78,8 @@ var addPermissionHooks = (settings) => {
|
|
|
78
78
|
var addToolPermissions = (settings) => {
|
|
79
79
|
const permissions = settings.permissions ?? {};
|
|
80
80
|
const allow = permissions.allow ?? [];
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
"mcp__pushary__ask_user",
|
|
84
|
-
"mcp__pushary__ask_user_yes_no",
|
|
85
|
-
"mcp__pushary__wait_for_answer",
|
|
86
|
-
"mcp__pushary__cancel_question",
|
|
87
|
-
"mcp__pushary__list_subscribers",
|
|
88
|
-
"mcp__pushary__get_subscriber",
|
|
89
|
-
"mcp__pushary__count_subscribers"
|
|
90
|
-
];
|
|
91
|
-
for (const tool of tools) {
|
|
92
|
-
if (!allow.includes(tool)) allow.push(tool);
|
|
93
|
-
}
|
|
81
|
+
const rule = "MCP(pushary:*)";
|
|
82
|
+
if (!allow.includes(rule)) allow.push(rule);
|
|
94
83
|
permissions.allow = allow;
|
|
95
84
|
settings.permissions = permissions;
|
|
96
85
|
};
|
|
@@ -176,6 +165,7 @@ export PUSHARY_API_KEY="${apiKey}"
|
|
|
176
165
|
});
|
|
177
166
|
};
|
|
178
167
|
var sendTestNotification = async (apiKey) => {
|
|
168
|
+
let notifResult = "";
|
|
179
169
|
await spinner("Sending test notification", async () => {
|
|
180
170
|
const response = await fetch("https://pushary.com/api/v1/server/send", {
|
|
181
171
|
method: "POST",
|
|
@@ -188,15 +178,19 @@ var sendTestNotification = async (apiKey) => {
|
|
|
188
178
|
body: "Your AI agent can now send you push notifications."
|
|
189
179
|
})
|
|
190
180
|
});
|
|
181
|
+
const data = await response.json().catch(() => ({}));
|
|
191
182
|
if (!response.ok) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
const data = await response.json();
|
|
196
|
-
if (!data.delivered || data.delivered === 0) {
|
|
197
|
-
throw new Error("no subscribers");
|
|
183
|
+
notifResult = `Could not send: ${data.error ?? response.statusText}`;
|
|
184
|
+
return;
|
|
198
185
|
}
|
|
186
|
+
notifResult = "sent";
|
|
199
187
|
});
|
|
188
|
+
if (notifResult === "sent") {
|
|
189
|
+
console.log(` ${dim("Check your phone!")}`);
|
|
190
|
+
} else if (notifResult) {
|
|
191
|
+
console.log(` ${dim(notifResult)}`);
|
|
192
|
+
console.log(` ${dim("Make sure you enabled notifications at")} ${cyan("pushary.com")}`);
|
|
193
|
+
}
|
|
200
194
|
};
|
|
201
195
|
var main = async () => {
|
|
202
196
|
console.log();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushary/agent-hooks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Permission hooks for AI coding agents — route tool approvals through Pushary push notifications",
|
|
5
5
|
"author": "Pushary <business@pushary.com>",
|
|
6
6
|
"homepage": "https://pushary.com",
|