Skip to content

Commit 08ad431

Browse files
tonylee-shopbackclaude
authored andcommitted
feat: add Slack adapter with multi-platform ChatAdapter architecture
Introduces a platform-agnostic adapter layer (ChatAdapter trait + AdapterRouter) that decouples session management, streaming, and reactions from any specific chat platform. Refactors Discord support to implement this trait and adds a new Slack adapter using Socket Mode (WebSocket) with auto-reconnect. - Extract ChatAdapter trait with send/edit/thread/react methods + message_limit() - Extract AdapterRouter with shared session routing, edit-streaming, and reactions - Decouple StatusReactionController from serenity types (uses Arc<dyn ChatAdapter>) - Implement DiscordAdapter (ChatAdapter for Discord via serenity) - Implement SlackAdapter (ChatAdapter for Slack via reqwest + tokio-tungstenite) - Add [slack] config section (bot_token, app_token, allowed_channels, allowed_users) - Support running Discord + Slack simultaneously in one process - Session keys namespaced by platform (discord:xxx, slack:xxx) - Unicode emoji → Slack short name mapping for reactions Relates to openabdev#93, openabdev#94, openabdev#86 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 025d19a commit 08ad431

9 files changed

Lines changed: 1124 additions & 494 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ serenity = { version = "0.12", default-features = false, features = ["client", "
1414
uuid = { version = "1", features = ["v4"] }
1515
regex = "1"
1616
anyhow = "1"
17+
async-trait = "0.1"
18+
futures-util = "0.3"
1719
rand = "0.8"
1820
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "multipart", "json"] }
1921
base64 = "0.22"
2022
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "gif", "webp"] }
23+
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }

config.toml.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
# Enable one or more adapters. At least one [discord] or [slack] section is required.
2+
13
[discord]
24
bot_token = "${DISCORD_BOT_TOKEN}"
35
allowed_channels = ["1234567890"]
46
# allowed_users = ["<YOUR_DISCORD_USER_ID>"] # empty or omitted = allow all users
57

8+
# [slack]
9+
# bot_token = "${SLACK_BOT_TOKEN}" # Bot User OAuth Token (xoxb-...)
10+
# app_token = "${SLACK_APP_TOKEN}" # App-Level Token (xapp-...) for Socket Mode
11+
# allowed_channels = ["C0123456789"] # Slack channel IDs
12+
# allowed_users = ["U0123456789"] # Slack user IDs (optional)
13+
614
[agent]
715
command = "kiro-cli"
816
args = ["acp", "--trust-all-tools"]

0 commit comments

Comments
 (0)