Commit Graph

2 Commits

Author SHA1 Message Date
curo1305 f59aa1a758 feat(plugin/telegram_bot): replace bare prompts with 5-step guided setup wizard
Step 1 — create bot via @BotFather (instructions + press-any-key pause)
Step 2 — find Telegram user ID via @userinfobot (instructions + pause)
Step 3 — set session passphrase with security explanation
Step 4 — save all three vault keys, print ✓ confirmations
Step 5 — configuration complete marker

Adds setup cancellation on empty token, updated tests: happy path, mismatch,
and cancel all covered; press_any_key_to_continue calls properly patched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 23:15:22 +02:00
curo1305 3f30b782d2 feat(plugin/telegram_bot): add Telegram bot plugin — remote Pyra chat over Telegram
Runs as a supervised daemon task (asyncio long-polling). Features:
- Sender allowlist + bcrypt passphrase challenge (3 attempts before lockout)
- Rate limiting: 20 messages/hour per user (in-memory, resets on restart)
- Injection scanning on every incoming message (pyra.security.injection)
- Full AI chat with litellm streaming → progressive Telegram message editing
- Tool-use loop (up to 10 iterations) with inline-button approval (120s timeout)
- Conversation history persisted per chat_id in ~/.pyra/telegram_history.db
- Memory context loaded from ~/.pyra/memory/ as system prompt on first message

Vault keys: plugin:telegram_bot:token, allowed_users, passphrase_hash
Deps: python-telegram-bot>=21.0, bcrypt>=4.0.0 (added to telegram + all-plugins extras)

22 new unit tests covering rate limiter, history DB, plugin lifecycle, and auth state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 22:45:36 +02:00