feat(relay): add messenger command surfaces#56
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a registry-driven command-surface layer that lets the canonical PiRelay remote command set drive (a) Telegram BotCommand menu registration, (b) a best-effort Discord native /relay application command with subcommands, and (c) a Slack /relay slash-command surface (manifest entry + Socket Mode/webhook envelope handling). It also unifies all messenger text-command prefixes on relay …, dropping the legacy pirelay prefix in parsers, pairing helpers, error/help text, and docs.
Changes:
- New
extensions/relay/commands/surfaces.tspluscanonicalRemoteCommandNameand asendimagealias incommands/remote.ts; Telegram API gainssetBotCommands, runtime registers menu after setup with non-fatal failure handling. - Discord live-client adds
discordRelayApplicationCommandDataand best-effort global command sync; Slack adapter addsslash_commandenvelope type, form/Socket-Mode parsing,slackSlashCommandMetadata, and routes responses throughresponse_urlwhen present. Slack manifest snippet gains/relay. - Wide rename from
pirelay …torelay …across runtimes, pairing parsers, setup/wizard text, README, docs, OpenSpec specs/tasks, Slack live manifests, and tests; newcommand-surfacesparity test file.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/relay/commands/remote.ts | Adds sendimage alias and canonicalRemoteCommandName; routes parsers through canonicalization. |
| extensions/relay/commands/surfaces.ts | New module deriving Telegram/Discord/Slack command metadata from canonical registry. |
| extensions/relay/adapters/telegram/api.ts | Adds setBotCommands API wrapper. |
| extensions/relay/adapters/telegram/runtime.ts | Registers Telegram bot menu on startup; drops pirelay prefix. |
| extensions/relay/adapters/discord/live-client.ts | Adds /relay application command data + best-effort sync; nested option flattening. |
| extensions/relay/adapters/discord/runtime.ts | Drops pirelay prefix in command/pairing parsing. |
| extensions/relay/adapters/slack/adapter.ts | Adds slash_command envelope, form/socket parsing, /relay metadata, slash→message normalization; pairing command renamed. |
| extensions/relay/adapters/slack/live-client.ts | Adds Socket Mode slash-command envelope conversion. |
| extensions/relay/adapters/slack/runtime.ts | Renames help/usage strings to relay; reroutes sendText through response_url when available. |
| extensions/relay/adapters/channel-pairing.ts | Slack pairing legacy forms now relay//relay. |
| extensions/relay/notifications/lifecycle.ts | Lifecycle disconnect text updated to relay pair. |
| extensions/relay/config/setup.ts, setup-wizard.ts | Setup guidance, manifest snippet, Slack/Discord wizard copy updated; manifest gains /relay entry. |
| extensions/relay/runtime/extension-runtime.ts | Slack pairing command in TUI updated to relay pair. |
| README.md, docs/{adapters,config,testing,slack-live-integration}.md | Doc updates for new surfaces and prefix unification; state dir renamed to ~/.pi/agent/relay. |
| docs/slack-app-manifests/pirelay-live-bot-{a,b}.yaml | Add /relay slash-command entries. |
| openspec/changes/add-messenger-command-surfaces/* | Proposal/design/specs/tasks for the new capability and tasks marked complete. |
| tests/* (slack/telegram/discord/runtime/integration/relay/{setup-wizard,lifecycle,remote-command-parity,command-surfaces}) | Update prefix expectations and add new parity, slash-command, and Telegram menu tests. |
Comments suppressed due to low confidence (2)
README.md:269
- After the rename the Discord and Slack columns of this command table contain the exact same string for every row (e.g.
relay status/relay status,relay sessions/relay sessions, etc.). Either collapse the two columns into a single "Discord/Slack (text)" column, or differentiate them (e.g. native/relay statusfor Slack/Discord) so the table still carries information. As written, the table looks like a copy-paste mistake and obscures the new native/relaysurfaces this PR introduces.
| help | `/help` (also Telegram menu) | `relay help` or best-effort `/relay help` | `relay help` or installed `/relay help` |
| status dashboard | `/status` | `relay status` | `relay status` |
| list sessions | `/sessions` | `relay sessions` | `relay sessions` |
| select session | `/use <session>` | `relay use <session>` | `relay use <session>` |
| forget offline session | `/forget <session>` | `relay forget <session>` | `relay forget <session>` |
| one-shot prompt | `/to <session> <prompt>` | `relay to <session> <prompt>` | `relay to <session> <prompt>` |
| progress mode | `/progress <mode>` | `relay progress <mode>` | `relay progress <mode>` |
| current progress mode | `/progress` | `relay progress` | `relay progress` |
| alias current session | `/alias <name\|clear>` | `relay alias <name\|clear>` | `relay alias <name\|clear>` |
| recent activity | `/recent` or `/activity` | `relay recent` or `relay activity` | `relay recent` or `relay activity` |
| latest summary | `/summary` | `relay summary` | `relay summary` |
| full output | `/full` | `relay full` | `relay full` |
| latest images | `/images` | `relay images` | `relay images` |
| send workspace image | `/send-image <path>` | `relay send-image <path>` | `relay send-image <path>` |
| send safe workspace file to requester | `/send-file <path> [caption]` | `relay send-file <path> [caption]` | `relay send-file <path> [caption]` |
| steer active run | `/steer <text>` | `relay steer <text>` | `relay steer <text>` |
| queue follow-up | `/followup <text>` | `relay followup <text>` | `relay followup <text>` |
| abort current run | `/abort` | `relay abort` | `relay abort` |
| compact context | `/compact` | `relay compact` | `relay compact` |
| pause delivery | `/pause` | `relay pause` | `relay pause` |
| resume delivery | `/resume` | `relay resume` | `relay resume` |
| disconnect binding | `/disconnect` | `relay disconnect` | `relay disconnect` |
README.md:325
- Same redundancy as the command table: the sentence repeats
relay sessions/relay use/relay totwice for what used to be Discord and Slack. Consider rewording to "Use/sessions(Telegram) orrelay sessions(Discord/Slack)…" to avoid the apparent typo.
Use `/sessions`, `relay sessions`, or `relay sessions` to list targets. Use `/use`, `relay use`, or `relay use` to select an active target. Use `/to`, `relay to`, or `relay to` for one-shot prompts without switching sessions.
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
/relaynative commands without overwriting unrelated app commands/relayslash-command manifest/routing while unifying text commands onrelay ...pirelay ...text prefix; update external playbooks torelay ...Validation