feat(telegram): generic inline keyboard buttons for gateway commands - #5857
Closed
rahimsais wants to merge 1 commit into
Closed
feat(telegram): generic inline keyboard buttons for gateway commands#5857rahimsais wants to merge 1 commit into
rahimsais wants to merge 1 commit into
Conversation
Add a reusable inline keyboard button system for Telegram gateway commands, complementing the existing model picker. Architecture: - BasePlatformAdapter.send_inline_options() with text fallback - TelegramAdapter override renders native InlineKeyboardButton - Generic callback routing: 'cmd:args' -> synthetic '/cmd args' - Dedicated cpg: prefix for /commands pagination (edit-in-place) - Cancel button (mc) and approval buttons (approve:once/session/always/deny) - gateway_runner ref set on all adapters for cross-reference Commands with inline buttons: - /commands: paginated Prev/Next that edits in-place (like model picker) - /personality: picker with all configured personalities - /rollback: checkpoint list picker - /resume: named session picker - Dangerous command approval: Allow Once/Session/Always/Deny buttons Fixes: - Drop ParseMode.MARKDOWN from callback edits (skill descriptions with unbalanced backticks break Telegram's markdown parser) - Truncate skill descriptions to 120 chars in /commands pages - Use getattr for dynamically-set gateway_runner attribute
Contributor
|
The approval button functionality was merged in #5890 (approval buttons for Slack & Telegram + callback handling). The generic inline button system for other commands (/commands, /personality, etc.) is an interesting idea but would need a full rebase and removal of the now-redundant approval parts. Closing as substantially superseded — if you'd like to resubmit just the generic button system as a separate PR, that would be welcome. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a reusable inline keyboard button system for Telegram gateway commands, complementing the existing model picker (#5742).
Architecture
BasePlatformAdapter.send_inline_options()— generic method with text fallback for non-Telegram platformsTelegramAdapteroverride renders nativeInlineKeyboardButtoncmd:args→ synthetic/cmd argsthrough_message_handlercpg:callback prefix for/commandspagination (edit-in-place, like model picker'smp:/mg:)mccancel callback as standard UX patterngateway_runnerreference set on all adapters during init for cross-referenceCommands with inline buttons
/commands/personality/rollback/resumeFixes included
ParseMode.MARKDOWNfrom callback message edits — skill descriptions with unbalanced backticks break Telegram's markdown parser/commandspages to stay under Telegram's 4096 char limitgetattrfor dynamically-setgateway_runnerattributeFiles changed
gateway/platforms/base.py—send_inline_options()base methodgateway/platforms/telegram.py— native inline keyboard + callback handlersgateway/run.py— extracted_build_commands_page()helper, inline buttons for 4 commands,gateway_runnerinit on all adapters