feat(tools): refactor pushover into conditional notify tool with Telegram fallback

Replace the always-registered PushoverTool with a NotifyTool that
auto-selects its backend at startup: Pushover if .env credentials exist,
otherwise Telegram (using bot_token + first allowed_users entry as
chat_id). If neither backend is available, the tool is not registered,
saving a tool slot and avoiding agent confusion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
harald 2026-02-25 17:01:28 +01:00
parent 6e8c799af5
commit 5cdf1b74f3
5 changed files with 638 additions and 446 deletions

View file

@ -1725,10 +1725,13 @@ pub async fn start_channels(config: Config) -> Result<()> {
"schedule",
"Manage scheduled tasks (create/list/get/cancel/pause/resume). Supports recurring cron and one-shot delays.",
));
tool_descs.push((
"pushover",
"Send a Pushover notification to your device. Requires PUSHOVER_TOKEN and PUSHOVER_USER_KEY in .env file.",
));
// notify tool is conditionally registered (Pushover or Telegram fallback)
if tools_registry.iter().any(|t| t.name() == "notify") {
tool_descs.push((
"notify",
"Send a push notification (via Pushover or Telegram depending on configuration).",
));
}
if !config.agents.is_empty() {
tool_descs.push((
"delegate",