mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 21:06:03 +00:00
feat(platform): add slack eba adapter
This commit is contained in:
@@ -24,6 +24,7 @@ Current acceptance report: [EBA Adapter Acceptance Report](./acceptance-report.m
|
||||
| WeComBot | Migrated; private text and outbound/API plugin E2E verified, feedback/group gaps remain | [WeComBot](./wecombot.md) |
|
||||
| Official Account | Migrated; private text plugin E2E verified, proactive outbound not supported | [Official Account](./officialaccount.md) |
|
||||
| QQ Official API | Migrated; WebSocket inbound reached LangBot, model config blocked reply | [QQ Official API](./qqofficial.md) |
|
||||
| Slack | Migrated; private text and outbound/API plugin E2E verified | [Slack](./slack.md) |
|
||||
|
||||
## Documentation Checklist
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ Scope:
|
||||
- `wecomcs-eba`
|
||||
- `officialaccount-eba`
|
||||
- `qqofficial-eba`
|
||||
- `slack-eba`
|
||||
|
||||
This report follows `acceptance-checklist.md`. Evidence levels are intentionally strict:
|
||||
|
||||
@@ -38,6 +39,7 @@ This report follows `acceptance-checklist.md`. Evidence levels are intentionally
|
||||
| WeCom Customer Service | Partial EBA acceptance | WeCom Customer Service is split into the EBA directory with manifest, converters, API mixin, platform API map, unit tests, docs, and a direct live probe scaffold. Real WeChat customer-side UI text reached `EBAEventProbe`; plugin outbound text/image and safe cache-backed common APIs passed. Inbound media and platform-specific API live coverage remain pending; later fallback text sends were blocked by WeCom `95001 send msg count limit`. |
|
||||
| Official Account | Partial EBA acceptance | WeChat Official Account is split into the EBA directory with manifest, converters, cache-backed safe APIs, platform API map, unit tests, and a direct live probe scaffold. Real WeChat Official Account UI private text reached `EBAEventProbe`; safe cache-backed common APIs and declared platform APIs passed. Proactive outbound `send_message` is not supported because replies must be tied to inbound webhook windows; inbound image/voice live UI evidence remains pending. |
|
||||
| QQ Official API | Partial EBA acceptance | QQ Official API is split into the EBA directory with manifest, converters, cache-backed safe APIs, platform API map, unit tests, docs, and a direct live probe scaffold. A real WebSocket-mode QQ Official bot reached the LangBot pipeline on `dev.rockchin.top`; reply/outbound evidence is blocked by the test model provider returning `model_not_found` for `deepseek-v3`. |
|
||||
| Slack | Partial EBA acceptance | Slack is split into the EBA directory with manifest, converters, cache-backed safe APIs, platform API map, unit tests, docs, and a direct live probe scaffold. Real Slack private text reached `EBAEventProbe`; safe common APIs, outbound component fallback sweep, and declared Slack platform APIs passed. Channel mention and real inbound media evidence remain pending. |
|
||||
|
||||
Telegram and DingTalk now have real user-side UI image/file upload evidence in plugin JSONL. Discord and aiocqhttp do not yet have real UI inbound image/file evidence.
|
||||
|
||||
@@ -58,6 +60,8 @@ Telegram and DingTalk now have real user-side UI image/file upload evidence in p
|
||||
| WeCom Customer Service | WeChat customer-side UI, `客服消息 -> 浪波智能客服` on `dev.rockchin.top` | `/home/wgc/LangBotxg/LangBotEbaTest/data/temp/wecomcs_eba_plugin_probe.jsonl` |
|
||||
| Official Account | WeChat desktop client, subscribed Official Account on `dev.rockchin.top` | `/home/wgc/LangBotxg/LangBotEbaTest/data/temp/officialaccount_eba_plugin_probe.jsonl` |
|
||||
| QQ Official API unit | local mocked QQ Official client paths | `tests/unit_tests/platform/test_qqofficial_eba_adapter.py` |
|
||||
| Slack unit | local mocked Slack client paths | `tests/unit_tests/platform/test_slack_eba_adapter.py` |
|
||||
| Slack private | Slack workspace private DM on `dev.rockchin.top` | `/home/wgc/LangBotxg/LangBotEbaTest/data/temp/slack_eba_plugin_probe.jsonl` |
|
||||
|
||||
All plugin runs used SDK standalone runtime ports `5400/5401`, LangBot `--standalone-runtime`, and the real plugin at `langbot-plugin-demo/EBAEventProbe`.
|
||||
|
||||
|
||||
84
docs/event-based-agents/adapters/slack.md
Normal file
84
docs/event-based-agents/adapters/slack.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Slack EBA Adapter
|
||||
|
||||
## Structure
|
||||
|
||||
Slack is migrated into `src/langbot/pkg/platform/adapters/slack/` with the standard EBA adapter layout:
|
||||
|
||||
- `adapter.py` owns lifecycle, listener dispatch, unified webhook handling, outbound send/reply, and event caches.
|
||||
- `event_converter.py` maps Slack `im` and `app_mention` channel events to `message.received`.
|
||||
- `message_converter.py` maps common `MessageChain` components to Slack text fallback and maps inbound Slack text/image payloads back to EBA components.
|
||||
- `api_impl.py` provides cache-backed common read APIs.
|
||||
- `platform_api.py` declares safe Slack-specific API actions.
|
||||
- `manifest.yaml` declares `slack-eba`.
|
||||
|
||||
The legacy `src/langbot/pkg/platform/sources/slack.py` adapter is kept unchanged.
|
||||
|
||||
## Configuration
|
||||
|
||||
| Field | Required | Notes |
|
||||
|-------|----------|-------|
|
||||
| `webhook_url` | No | Generated by LangBot. Paste it into Slack Event Subscriptions. |
|
||||
| `bot_token` | Yes | Slack bot token, usually `xoxb-...`. |
|
||||
| `signing_secret` | Yes | Slack app signing secret. |
|
||||
|
||||
## Events
|
||||
|
||||
| Event | Notes |
|
||||
|-------|-------|
|
||||
| `message.received` | Emitted for private `im` messages and channel `app_mention` events. Channel messages are mapped to group chats. |
|
||||
| `platform.specific` | Reserved for Slack event types that are not converted into common message events. |
|
||||
|
||||
## Common APIs
|
||||
|
||||
Required:
|
||||
|
||||
- `send_message`
|
||||
- `reply_message`
|
||||
|
||||
Optional:
|
||||
|
||||
- `get_message`
|
||||
- `get_user_info`
|
||||
- `get_friend_list`
|
||||
- `get_group_info`
|
||||
- `get_group_list`
|
||||
- `get_group_member_list`
|
||||
- `get_group_member_info`
|
||||
- `call_platform_api`
|
||||
|
||||
Cache-backed APIs are only available after the relevant inbound event has been observed.
|
||||
|
||||
## Platform APIs
|
||||
|
||||
| Action | Notes |
|
||||
|--------|-------|
|
||||
| `get_mode` | Returns webhook mode and configured bot account id. |
|
||||
| `auth_test` | Calls Slack `auth.test` with the configured bot token. |
|
||||
|
||||
## Known Limits
|
||||
|
||||
- Slack file/image outbound is currently represented as text fallback because the existing Slack SDK wrapper only exposes `chat_postMessage`.
|
||||
- Inbound channel coverage follows the legacy adapter behavior: only `app_mention` events are treated as group messages.
|
||||
- Real live testing requires a public callback URL configured in Slack Event Subscriptions.
|
||||
|
||||
## Verification
|
||||
|
||||
Local mocked unit coverage validates manifest parity, event conversion, legacy listener compatibility, cache-backed APIs, send/reply routing, and declared platform APIs.
|
||||
|
||||
Plugin E2E evidence was captured on June 2, 2026 against `dev.rockchin.top` with Slack private DM input and `EBAEventProbe` through the standalone runtime.
|
||||
|
||||
Evidence file: `/home/wgc/LangBotxg/LangBotEbaTest/data/temp/slack_eba_plugin_probe.jsonl`.
|
||||
|
||||
Observed:
|
||||
|
||||
- Real Slack private text produced `MessageReceived` with `adapter_name=slack-eba`, `Source + Plain`, private chat type, and filled `bot_uuid`.
|
||||
- Safe common APIs passed: `get_message`, `get_user_info`, `get_friend_list`.
|
||||
- Outbound component fallback sweep passed through `send_message`: plain/at/face, image, quote, file, and forward.
|
||||
- Declared Slack platform APIs passed: `get_mode`, `auth_test`.
|
||||
|
||||
Still pending:
|
||||
|
||||
- Channel `app_mention` plugin E2E.
|
||||
- Real inbound Slack file/image UI evidence.
|
||||
|
||||
Live probe scaffold: `tests/e2e/live_slack_eba_probe.py`.
|
||||
Reference in New Issue
Block a user