Commit Graph
20 Commits
Author SHA1 Message Date
Alessandro 9ae1939bd6 Restore secure Telegram scopes and preserve legacy configuration
Restore global, project, profile, and project/profile configuration with
one bot identity per saved scope. Preserve inherited configuration and
pause conflicting legacy bot identities without discarding their settings.

Revalidate scope, activation, and access rules for inbound messages,
commands, callbacks, session selection, and outbound delivery. Keep scoped
bots within their owning project/profile, omit credentials from persisted
chat metadata, and sanitize attachment filenames.

Automatically back up existing configuration, activation, and session
mappings before upgrade. Preserve their contents and stable global session
keys, while provisioning secure webhook secrets where legacy settings
require them. Document scope ownership, conflict recovery, and migration.

Validation:
- Docker framework suite: 216 passed, plus 73 subtests.
- Live Telegram status and message/reply round-trip confirmed.
- Missing and forged webhook credentials rejected with HTTP 403.
- Existing live configuration, activation, and session mappings unchanged.
2026-11-12 17:27:15 +01:00
Alessandro 1eba072653 Require explicit Telegram administrators for settings changes
Accepted Telegram senders could use /permissions and its callbacks to
persistently remove their own tool restrictions. The same access also
exposed instance-wide plugin toggles.

Add a per-bot admin_users allowlist and enforce it when opening settings
and processing every settings callback. Administrators must still pass
allowed_users; an omitted or empty admin_users list grants nobody settings
access. Resolve membership from the current bot configuration on each
event so revocation applies to existing buttons.

Expose the administrator list in the WebUI and document its defaults.
Add regression coverage for message and callback routes, denied writes,
authorized policy persistence, runtime tool decisions, and revocation.

Validation:
- Conda framework: 123 tests and 41 subtests passed.
- Docker framework: 9 focused tests and 41 subtests passed.
- WebUI: administrator field renders, parses entries, and clears correctly.
- JavaScript syntax and git diff checks passed.
- Restarted the bound Docker instance and verified HTTP 200.

Telegram network delivery was not exercised; tests use synthetic events
and disposable policy files without changing live bot access settings.
2026-11-01 07:22:49 +01:00
Alessandro 17033d277e Extend slash commands coverage and menus in Telegram
Resolve built-in, plugin, global, and project slash commands before wrapping Telegram messages, preserving custom overrides and existing integration controls. Add paginated command, plugin, and permission menus, compaction confirmation, transcript export, and fresh-chat session binding.

Generate stable names for unnamed bots, reject duplicate names on save, and restart bots when their connection settings change. Preserve webhook authentication and private-only group controls, and prevent rendered or queued messages from resolving a second slash command.

Validation: 80 tests and 11 webhook subtests passed. Verified command execution and menu rendering in the Docker framework runtime, source/runtime file hashes, HTTP health, and polling with 33 registered commands. Telegram replies were confirmed by the user; direct in-app browser automation was unavailable.
2026-09-14 13:21:15 +02:00
Anmol Malik abf0cef8e8 Scope Telegram integration commands 2026-06-07 21:20:30 +05:30
Anmol Malik 97ef4797e0 Send Telegram media attachments natively 2026-05-29 00:10:04 +05:30
Anmol Malik 1bbbfa44ac Improve Telegram integration command and streaming UX 2026-05-29 00:10:04 +05:30
Alessandro 395ef8dd33 integrations: add native chat controls and email config presets
Add shared transport-level control commands so Telegram, WhatsApp, and
email threads can manage the active chat directly.

- add a shared integration command helper for /project, /config, /send,
  and /queue send
- wire native command handling into Telegram and WhatsApp sessions
- expose Telegram control commands through bot command routing and update
  transport docs
- add email thread command handling for existing A0 email conversations
- add an optional per-handler email conversation preset backed by model
  presets in the email settings UI and default config
- document the new transport control flow across Telegram, WhatsApp, and
  email
2026-04-11 18:49:13 +02:00
frdel 247c8d845f Change default self-update backup directory from /a0/tmp to /root and add lazy aiogram dependency loading for Telegram plugin
- Update default backup path from /a0/tmp/self-update-backups to /root/update-backups in self_update_manager.py, helpers/self_update.py, and documentation
- Move aiogram from global requirements.txt to plugin-local requirements for _telegram_integration
- Add ensure_dependencies() helper that installs aiogram on-demand via uv pip install
- Add has_aiogram() check to avoid
2026-03-26 10:20:35 +01:00
keyboardstaff 1bd5bc01d6 refactor(chat_branching): ID-based log ↔ history linking for precise branch trimming 2026-03-24 03:04:09 -07:00
keyboardstaff 24eb762963 fix(telegram): group attachment detection, typing lifecycle, per-chat session isolation
- Fix group @mention with attachments being silently dropped: filter now checks caption / caption_entities for media messages
- Fix typing indicator cancelled prematurely on inline updates (break_loop=false): typing and reply_to cleanup moved to process_chain_end's finally block
- Fix same user's group and private chat interfering with each other: _map_key now includes chat_id for per-chat context isolation
- Refactor _make_handler to use direct function references instead of string-based getattr
2026-03-23 07:18:42 -07:00
keyboardstaff 40a72c0c51 feat(telegram): group reply-to + formatting pipeline cleanup
- Group reply matching: Bot quotes user's message when user replies to bot in groups; normal send for @mentions or private chats
- System prompt formatting guidance: Added formatting rules block guiding the agent to use Telegram-compatible Markdown subset (no tables/HR/deep nesting)
- md_to_telegram_html refactor: Simplified table handling (strip pipes vs complex bullet-list conversion), added ~~~ tilde fence support, ***bold italic*** support, strip trailing newlines from code blocks
2026-03-22 20:39:22 -07:00
keyboardstaff 035d53067b fix(telegram): solve attachment path issues for Dev and Docker environments 2026-03-22 17:14:44 -07:00
keyboardstaff 4a06e0c05e feat(telegram): add welcome message for new group members
- handler.py: Added handle_new_members() to send customized greetings (supports {name} placeholder, skips bots).

- bot_manager.py: Registered new handler using NEW_CHAT_MEMBERS filter.

- _10_telegram_bot.py: Integrated _wrap_new_members to ensure the bot uses the latest configuration.

- config.html: Added Welcome New Members toggle and Welcome Message input (conditional visibility based on Group Mode).

- telegram-config-store.js & default_config.yaml: Added default state (false) and documentation.
2026-03-22 10:09:31 -07:00
keyboardstaff d6811c1ec4 refactor(telegram): optimize message handling and unify system context
- handler.py: Cleaned up. All functions and imports are now actively used.

- _enqueue_user_message: Refactored to handle both messages and callback queries, eliminating duplicate building logic.

- _20_telegram_context.py: Now the single source of truth for injecting agent_instructions and system_context_reply.

- File Cleanup: Deleted unused fw.telegram.system_context.md and fw.telegram.cleared.md.

- fix: Corrected bot invocation logic within group chats.
2026-03-22 10:05:36 -07:00
keyboardstaff 5dbc177069 feat(telegram): add Quick Start Guide, notification toggle, and UX improvements 2026-03-22 08:40:00 -07:00
keyboardstaff 5f996eded5 refactor(telegram): restructure handler.py and integrate model configuration 2026-03-21 23:54:38 -07:00
keyboardstaff af60a6e291 feat(telegram): message formatting rewrite, cross-event-loop fixes & hot mode switching 2026-03-21 09:02:49 -07:00
keyboardstaff eb92fde009 chore(telegram): remove unused imports, fix exception masking, and add explicit boundary checks 2026-03-21 01:18:59 -07:00
keyboardstaff 3389682bd1 refactor(telegram): cleanup dead code, unused imports, constants 2026-03-20 19:29:18 -07:00
keyboardstaff 83ffa27d13 feat: add Telegram integration plugin - core backend 2026-03-20 10:12:36 -07:00