Add Slack extension hooks for plugins - #20936
Conversation
|
Supersedes #20589 (which only exposed |
|
Hi @teknium1 — thanks again for cherry-picking #20503 yesterday, really appreciated the careful authorship preservation. This PR (#20936) just moved out of draft. It adds a small Slack Block Kit extension surface for plugins (
Whenever you have a moment, would you mind taking a look or pointing it to the right reviewer? No rush. Happy to rebase / split if anything looks off. |
|
Thanks for this @dandacompany — the broader surface here (native slash commands + Block Kit actions + modal We're going with #20589 (@bcsmith528) as the baseline for the plugin Slack action API — salvaged onto current async def handle_slack_extension_command(ack, command, _extension_command=_extension_command):
await self._invoke_slack_extension_handler(_extension_command.handler, ...)slack_bolt resolves listener args by name, not by Python defaults — for any param name it doesn't recognize it logs So at the first real command / click / modal submit, The slash-command + view/modal surface is worth landing, though. Would you be up for re-submitting it as a focused follow-up on top of #44664 — loops switched to a closure factory, plus a test that drives Closing as superseded for now. Thanks again for the work here. |
Summary
Adds a small Slack Block Kit extension surface for Hermes plugins. Plugins can now register:
The goal is to make Slack-native interactive plugin UIs possible without requiring each plugin to patch
gateway/platforms/slack.py.Why
PluginContext.register_command()is the right API for cross-platform text commands, but it cannot cover Slack Block Kit workflows. Interactive Slack UIs need adapter-level Bolt registrations: immediate slash command ACKs,app.action(...),app.view(...), and controlled access to the Slack adapter/client context.Examples of plugin workflows that need this surface:
Today those workflows must be hardcoded in the Slack adapter. This PR gives plugin authors a supported extension point while keeping built-in Slack handlers authoritative.
What changed
SlackSlashCommand,SlackActionHandler, andSlackViewHandlerdata classes.PluginContext.register_slack_extension(...).PluginManager.slack_native_slashes()sohermes slack manifest --writecan emit them.SlackAdapter.connect().register_slack_extension()versusregister_command().Notes
/model,/help, etc.ctx.register_command()so they work across CLI and every gateway.Tests
Result: 18 passed.
uvemits an existing settings warning while parsingexclude-newer = "7 days"inpyproject.toml; tests still run and pass.