antenna-fyi 1.2.39 ā 1.2.40
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/lib/cli.js +43 -5
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -471,6 +471,25 @@ export function handleInstallHermesPlugin() {
|
|
|
471
471
|
console.log(" cd ~/.hermes/hermes-agent && uv pip install supabase");
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
// 4. Auto-configure webhook for deliver-only push notifications
|
|
475
|
+
try {
|
|
476
|
+
// Check if hermes CLI supports --deliver-only
|
|
477
|
+
const helpText = execSync('hermes webhook subscribe --help', { stdio: 'pipe', timeout: 5000 }).toString();
|
|
478
|
+
if (helpText.includes('--deliver-only')) {
|
|
479
|
+
// Check if antenna-notify already exists
|
|
480
|
+
const existing = execSync('hermes webhook list --json', { stdio: 'pipe', timeout: 5000 }).toString();
|
|
481
|
+
const hooks = JSON.parse(existing);
|
|
482
|
+
if (!hooks.find(h => h.name === 'antenna-notify')) {
|
|
483
|
+
execSync('hermes webhook subscribe antenna-notify --prompt "{message}" --deliver telegram --deliver-only --description "Antenna push notifications"', { stdio: 'pipe', timeout: 10000 });
|
|
484
|
+
console.log("\nš Webhook: antenna-notify (deliver-only ā telegram)");
|
|
485
|
+
} else {
|
|
486
|
+
console.log("\nš Webhook: antenna-notify already configured");
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
} catch {
|
|
490
|
+
// Webhook not available (older Hermes or gateway not running), skip silently
|
|
491
|
+
}
|
|
492
|
+
|
|
474
493
|
console.log("\nā
Antenna installed for Hermes! (Plugin + Skill + deps)");
|
|
475
494
|
console.log(" Restart Hermes to activate.");
|
|
476
495
|
console.log();
|
|
@@ -613,12 +632,31 @@ export async function handleWatch(f) {
|
|
|
613
632
|
} catch (err) { /* terminal output is the fallback */ }
|
|
614
633
|
}
|
|
615
634
|
if (pushMethods.has("hermes")) {
|
|
635
|
+
// Try webhook deliver-only first (instant, zero LLM cost), fallback to cron
|
|
636
|
+
let hermesPushed = false;
|
|
616
637
|
try {
|
|
617
|
-
execSync(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
)
|
|
621
|
-
|
|
638
|
+
const webhookInfo = execSync('hermes webhook list --json', { timeout: 10_000, stdio: 'pipe' }).toString();
|
|
639
|
+
const hooks = JSON.parse(webhookInfo);
|
|
640
|
+
const antennaHook = hooks.find(h => h.name === 'antenna-notify' && h.deliver_only);
|
|
641
|
+
if (antennaHook) {
|
|
642
|
+
const url = antennaHook.url || 'http://localhost:8644/webhooks/antenna-notify';
|
|
643
|
+
const secret = antennaHook.secret;
|
|
644
|
+
const body = JSON.stringify({ message });
|
|
645
|
+
const curlCmd = secret
|
|
646
|
+
? `curl -s -X POST ${JSON.stringify(url)} -H 'Content-Type: application/json' -H 'X-Webhook-Signature: sha256='$(echo -n ${JSON.stringify(body)} | openssl dgst -sha256 -hmac ${JSON.stringify(secret)} | cut -d' ' -f2) -d ${JSON.stringify(body)}`
|
|
647
|
+
: `curl -s -X POST ${JSON.stringify(url)} -H 'Content-Type: application/json' -d ${JSON.stringify(body)}`;
|
|
648
|
+
execSync(curlCmd, { timeout: 10_000, stdio: 'pipe' });
|
|
649
|
+
hermesPushed = true;
|
|
650
|
+
}
|
|
651
|
+
} catch { /* webhook not available */ }
|
|
652
|
+
if (!hermesPushed) {
|
|
653
|
+
try {
|
|
654
|
+
execSync(
|
|
655
|
+
`hermes cron create "1m" ${JSON.stringify("[SYSTEM] Forward the following notification to the user exactly as-is. Do not analyze, reply, or add anything.\n\n" + message)} --name "Antenna" --deliver telegram --repeat 1`,
|
|
656
|
+
{ timeout: 30_000, stdio: "pipe" }
|
|
657
|
+
);
|
|
658
|
+
} catch (err) { /* terminal output is the fallback */ }
|
|
659
|
+
}
|
|
622
660
|
}
|
|
623
661
|
}
|
|
624
662
|
|