通道配置
所有 45 个通道适配器的配置、每通道行为覆盖以及 Sidecar 通道集成。
[channels]
所有 45 个通道适配器均在 [channels.<name>] 下配置。每个通道采用 Option<T> 类型——省略该节将完全禁用该适配器。即使只写了节头(内容为空),也会以默认值启用该适配器。
通用通道字段: 每个通道适配器除了自身特有的字段外,还支持以下通用字段:
| 字段 | 类型 | 默认值 | 说明 |
|---|
default_agent | string 或 null | null | 默认将消息路由到的 Agent 名称。 |
account_id | string 或 null | null | 当前 Bot 实例的唯一标识符。用于通过 [[bindings]] 匹配规则进行多 Bot 路由。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.telegram]
[channels.telegram]
bot_token_env = "TELEGRAM_BOT_TOKEN"
allowed_users = []
# default_agent = "assistant"
poll_interval_secs = 1
# api_url = "https://api.telegram.org" # 覆盖用于本地 Bot API 服务器
# account_id = "my-telegram-bot"
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "TELEGRAM_BOT_TOKEN" | 存放 Telegram Bot API 令牌的环境变量。 |
allowed_users | list of i64 | [] | 允许交互的 Telegram 用户 ID 列表。空列表 = 允许所有人。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
poll_interval_secs | u64 | 1 | 长轮询间隔(秒)。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
api_url | string 或 null | null | 覆盖 Telegram Bot API 基础 URL。适用于本地 Bot API 服务器实例。默认为 https://api.telegram.org。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.discord]
[channels.discord]
bot_token_env = "DISCORD_BOT_TOKEN"
allowed_guilds = []
# default_agent = "assistant"
intents = 37376
ignore_bots = true
# account_id = "my-discord-bot"
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "DISCORD_BOT_TOKEN" | 存放 Discord Bot 令牌的环境变量。 |
allowed_guilds | list of u64 | [] | 允许的服务器(Guild)ID 列表。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
allowed_users | list of strings | [] | 允许交互的 Discord 用户 ID 列表。空列表 = 允许所有。 |
intents | u64 | 37376 | Gateway Intents 位掩码。默认 = GUILD_MESSAGES | DIRECT_MESSAGES | MESSAGE_CONTENT(37376)。 |
ignore_bots | bool | true | 为 true 时,忽略来自其他 Bot 的消息。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.slack]
[channels.slack]
app_token_env = "SLACK_APP_TOKEN"
bot_token_env = "SLACK_BOT_TOKEN"
allowed_channels = []
# account_id = "my-slack-bot"
| 字段 | 类型 | 默认值 | 说明 |
|---|
app_token_env | string | "SLACK_APP_TOKEN" | 存放 Slack 应用级令牌(xapp-)的环境变量,用于 Socket Mode。 |
bot_token_env | string | "SLACK_BOT_TOKEN" | 存放 Slack Bot 令牌(xoxb-)的环境变量,用于 REST API。 |
allowed_channels | list of strings | [] | 允许的频道 ID 列表。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.whatsapp]
[channels.whatsapp]
access_token_env = "WHATSAPP_ACCESS_TOKEN"
verify_token_env = "WHATSAPP_VERIFY_TOKEN"
phone_number_id = ""
# webhook_port = 8443 # 已弃用:Webhook 现共享 API 端口
allowed_users = []
# gateway_url_env = "WHATSAPP_WEB_GATEWAY_URL" # 用于 QR/Web 模式
# account_id = "my-whatsapp-bot"
# owner_numbers = [] # 可选的管理员手机号
| 字段 | 类型 | 默认值 | 说明 |
|---|
access_token_env | string | "WHATSAPP_ACCESS_TOKEN" | 存放 WhatsApp Cloud API 访问令牌的环境变量。 |
verify_token_env | string | "WHATSAPP_VERIFY_TOKEN" | 存放 Webhook 验证令牌的环境变量。 |
phone_number_id | string | "" | WhatsApp Business 手机号 ID。 |
webhook_port | u16 | 8443 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
gateway_url_env | string | "WHATSAPP_WEB_GATEWAY_URL" | 存放 WhatsApp Web 网关 URL 的环境变量。设置后,发送消息将通过 QR/Web 网关而非 Cloud API 路由。 |
allowed_users | list of strings | [] | 允许的手机号列表。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
owner_numbers | list of strings | [] | 对此 Bot 实例拥有管理权限的手机号列表。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.signal]
[channels.signal]
api_url = "http://localhost:8080"
phone_number = ""
allowed_users = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
api_url | string | "http://localhost:8080" | signal-cli REST API 的 URL。 |
phone_number | string | "" | Bot 注册的手机号。 |
allowed_users | list of strings | [] | 允许的手机号列表。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.matrix]
[channels.matrix]
homeserver_url = "https://matrix.org"
user_id = "@librefang:matrix.org"
access_token_env = "MATRIX_ACCESS_TOKEN"
allowed_rooms = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
homeserver_url | string | "https://matrix.org" | Matrix 家服务器 URL。 |
user_id | string | "" | Bot 用户 ID(例如 "@librefang:matrix.org")。 |
access_token_env | string | "MATRIX_ACCESS_TOKEN" | 存放 Matrix 访问令牌的环境变量。 |
allowed_rooms | list of strings | [] | 监听的房间 ID 列表。空列表 = 所有已加入的房间。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.email]
[channels.email]
imap_host = "imap.gmail.com"
imap_port = 993
smtp_host = "smtp.gmail.com"
smtp_port = 587
username = "bot@example.com"
password_env = "EMAIL_PASSWORD"
poll_interval_secs = 30
folders = ["INBOX"]
allowed_senders = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
imap_host | string | "" | IMAP 服务器主机名。 |
imap_port | u16 | 993 | IMAP 服务器端口(993 用于 TLS)。 |
smtp_host | string | "" | SMTP 服务器主机名。 |
smtp_port | u16 | 587 | SMTP 服务器端口(587 用于 STARTTLS)。 |
username | string | "" | 用于 IMAP 和 SMTP 的邮箱地址。 |
password_env | string | "EMAIL_PASSWORD" | 存放邮箱密码或应用专用密码的环境变量。 |
poll_interval_secs | u64 | 30 | IMAP 轮询间隔(秒)。 |
folders | list of strings | ["INBOX"] | 监控的 IMAP 文件夹。 |
allowed_senders | list of strings | [] | 仅处理来自这些发件人的邮件。空列表 = 全部处理。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.teams]
[channels.teams]
app_id = ""
app_password_env = "TEAMS_APP_PASSWORD"
# webhook_port = 3978 # 已弃用:Webhook 现共享 API 端口
allowed_tenants = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
app_id | string | "" | Azure Bot 应用 ID。 |
app_password_env | string | "TEAMS_APP_PASSWORD" | 存放 Azure Bot Framework 应用密码的环境变量。 |
webhook_port | u16 | 3978 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
allowed_tenants | list of strings | [] | 允许的 Azure AD 租户 ID 列表。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.mattermost]
[channels.mattermost]
server_url = "https://mattermost.example.com"
token_env = "MATTERMOST_TOKEN"
allowed_channels = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
server_url | string | "" | Mattermost 服务器 URL。 |
token_env | string | "MATTERMOST_TOKEN" | 存放 Mattermost Bot 令牌的环境变量。 |
allowed_channels | list of strings | [] | 监听的频道 ID 列表。空列表 = 所有频道。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.irc]
[channels.irc]
server = "irc.libera.chat"
port = 6667
nick = "librefang"
# password_env = "IRC_PASSWORD"
channels = ["#librefang"]
use_tls = false
| 字段 | 类型 | 默认值 | 说明 |
|---|
server | string | "irc.libera.chat" | IRC 服务器主机名。 |
port | u16 | 6667 | IRC 服务器端口。 |
nick | string | "librefang" | Bot 昵称。 |
password_env | string 或 null | null | 存放服务器密码的环境变量(可选)。 |
channels | list of strings | [] | 要加入的 IRC 频道(例如 ["#librefang", "#general"])。 |
use_tls | bool | false | 是否使用 TLS 连接。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.google_chat]
[channels.google_chat]
service_account_env = "GOOGLE_CHAT_SERVICE_ACCOUNT"
space_ids = []
# webhook_port = 8444 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
service_account_env | string | "GOOGLE_CHAT_SERVICE_ACCOUNT" | 存放服务账号 JSON 密钥的环境变量。 |
space_ids | list of strings | [] | 监听的 Google Chat 聊天室 ID 列表。 |
webhook_port | u16 | 8444 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.twitch]
[channels.twitch]
oauth_token_env = "TWITCH_OAUTH_TOKEN"
channels = ["mychannel"]
nick = "librefang"
| 字段 | 类型 | 默认值 | 说明 |
|---|
oauth_token_env | string | "TWITCH_OAUTH_TOKEN" | 存放 Twitch OAuth 令牌的环境变量。 |
channels | list of strings | [] | 要加入的 Twitch 频道(不带 # 前缀)。 |
nick | string | "librefang" | 在 Twitch 聊天中的 Bot 昵称。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.rocketchat]
[channels.rocketchat]
server_url = "https://rocketchat.example.com"
token_env = "ROCKETCHAT_TOKEN"
user_id = ""
allowed_channels = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
server_url | string | "" | Rocket.Chat 服务器 URL。 |
token_env | string | "ROCKETCHAT_TOKEN" | 存放 Rocket.Chat 认证令牌的环境变量。 |
user_id | string | "" | Bot 用户 ID。 |
allowed_channels | list of strings | [] | 监听的频道 ID 列表。空列表 = 所有频道。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.zulip]
[channels.zulip]
server_url = "https://zulip.example.com"
bot_email = "bot@zulip.example.com"
api_key_env = "ZULIP_API_KEY"
streams = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
server_url | string | "" | Zulip 服务器 URL。 |
bot_email | string | "" | 在 Zulip 中注册的 Bot 邮箱地址。 |
api_key_env | string | "ZULIP_API_KEY" | 存放 Zulip API Key 的环境变量。 |
streams | list of strings | [] | 监听的 Stream 名称列表。空列表 = 所有 Stream。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.xmpp]
[channels.xmpp]
jid = "bot@jabber.org"
password_env = "XMPP_PASSWORD"
server = ""
port = 5222
rooms = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
jid | string | "" | XMPP JID(例如 "bot@jabber.org")。 |
password_env | string | "XMPP_PASSWORD" | 存放 XMPP 密码的环境变量。 |
server | string | "" | XMPP 服务器主机名。为空时默认使用 JID 的域名。 |
port | u16 | 5222 | XMPP 服务器端口。 |
rooms | list of strings | [] | 要加入的 MUC(多人聊天)房间。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.line]
[channels.line]
channel_secret_env = "LINE_CHANNEL_SECRET"
access_token_env = "LINE_CHANNEL_ACCESS_TOKEN"
# webhook_port = 8450 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
channel_secret_env | string | "LINE_CHANNEL_SECRET" | 存放 LINE Channel Secret 的环境变量。 |
access_token_env | string | "LINE_CHANNEL_ACCESS_TOKEN" | 存放 LINE Channel Access Token 的环境变量。 |
webhook_port | u16 | 8450 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.viber]
[channels.viber]
auth_token_env = "VIBER_AUTH_TOKEN"
webhook_url = ""
# webhook_port = 8451 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
auth_token_env | string | "VIBER_AUTH_TOKEN" | 存放 Viber Bot 认证令牌的环境变量。 |
webhook_url | string | "" | Viber Webhook 端点的公网 URL。 |
webhook_port | u16 | 8451 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.messenger]
[channels.messenger]
page_token_env = "MESSENGER_PAGE_TOKEN"
verify_token_env = "MESSENGER_VERIFY_TOKEN"
# webhook_port = 8452 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
page_token_env | string | "MESSENGER_PAGE_TOKEN" | 存放 Facebook 页面访问令牌的环境变量。 |
verify_token_env | string | "MESSENGER_VERIFY_TOKEN" | 存放 Webhook 验证令牌的环境变量。 |
webhook_port | u16 | 8452 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.reddit]
[channels.reddit]
client_id = ""
client_secret_env = "REDDIT_CLIENT_SECRET"
username = ""
password_env = "REDDIT_PASSWORD"
subreddits = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
client_id | string | "" | Reddit 应用客户端 ID。 |
client_secret_env | string | "REDDIT_CLIENT_SECRET" | 存放 Reddit 客户端密钥的环境变量。 |
username | string | "" | Reddit Bot 用户名。 |
password_env | string | "REDDIT_PASSWORD" | 存放 Reddit Bot 密码的环境变量。 |
subreddits | list of strings | [] | 要监控的子版块名称。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.mastodon]
[channels.mastodon]
instance_url = "https://mastodon.social"
access_token_env = "MASTODON_ACCESS_TOKEN"
| 字段 | 类型 | 默认值 | 说明 |
|---|
instance_url | string | "" | Mastodon 实例 URL(例如 "https://mastodon.social")。 |
access_token_env | string | "MASTODON_ACCESS_TOKEN" | 存放 Mastodon 访问令牌的环境变量。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.bluesky]
[channels.bluesky]
identifier = "mybot.bsky.social"
app_password_env = "BLUESKY_APP_PASSWORD"
service_url = "https://bsky.social"
| 字段 | 类型 | 默认值 | 说明 |
|---|
identifier | string | "" | Bluesky 用户名或 DID。 |
app_password_env | string | "BLUESKY_APP_PASSWORD" | 存放 Bluesky 应用密码的环境变量。 |
service_url | string | "https://bsky.social" | PDS(个人数据服务器)URL。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.feishu]
[channels.feishu]
app_id = ""
app_secret_env = "FEISHU_APP_SECRET"
# webhook_port = 8453 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
app_id | string | "" | 飞书/Lark 应用 ID。 |
app_secret_env | string | "FEISHU_APP_SECRET" | 存放飞书应用密钥的环境变量。 |
webhook_port | u16 | 8453 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.revolt]
[channels.revolt]
bot_token_env = "REVOLT_BOT_TOKEN"
api_url = "https://api.revolt.chat"
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "REVOLT_BOT_TOKEN" | 存放 Revolt Bot 令牌的环境变量。 |
api_url | string | "https://api.revolt.chat" | Revolt API 基础 URL。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.nextcloud]
[channels.nextcloud]
server_url = "https://nextcloud.example.com"
token_env = "NEXTCLOUD_TOKEN"
allowed_rooms = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
server_url | string | "" | Nextcloud 服务器 URL。 |
token_env | string | "NEXTCLOUD_TOKEN" | 存放 Nextcloud Talk 认证令牌的环境变量。 |
allowed_rooms | list of strings | [] | 监听的房间令牌列表。空列表 = 所有房间。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.guilded]
[channels.guilded]
bot_token_env = "GUILDED_BOT_TOKEN"
server_ids = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "GUILDED_BOT_TOKEN" | 存放 Guilded Bot 令牌的环境变量。 |
server_ids | list of strings | [] | 监听的服务器 ID 列表。空列表 = 所有服务器。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.keybase]
[channels.keybase]
username = ""
paperkey_env = "KEYBASE_PAPERKEY"
allowed_teams = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
username | string | "" | Keybase 用户名。 |
paperkey_env | string | "KEYBASE_PAPERKEY" | 存放 Keybase 纸钥匙的环境变量。 |
allowed_teams | list of strings | [] | 监听的团队名称列表。空列表 = 仅私聊。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.threema]
[channels.threema]
threema_id = ""
secret_env = "THREEMA_SECRET"
# webhook_port = 8454 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
threema_id | string | "" | Threema Gateway ID。 |
secret_env | string | "THREEMA_SECRET" | 存放 Threema API 密钥的环境变量。 |
webhook_port | u16 | 8454 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.nostr]
[channels.nostr]
private_key_env = "NOSTR_PRIVATE_KEY"
relays = ["wss://relay.damus.io"]
| 字段 | 类型 | 默认值 | 说明 |
|---|
private_key_env | string | "NOSTR_PRIVATE_KEY" | 存放 Nostr 私钥(nsec 或十六进制格式)的环境变量。 |
relays | list of strings | ["wss://relay.damus.io"] | 要连接的 Nostr 中继 WebSocket URL 列表。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.webex]
[channels.webex]
bot_token_env = "WEBEX_BOT_TOKEN"
allowed_rooms = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "WEBEX_BOT_TOKEN" | 存放 Webex Bot 令牌的环境变量。 |
allowed_rooms | list of strings | [] | 监听的房间 ID 列表。空列表 = 所有房间。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.pumble]
[channels.pumble]
bot_token_env = "PUMBLE_BOT_TOKEN"
# webhook_port = 8455 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "PUMBLE_BOT_TOKEN" | 存放 Pumble Bot 令牌的环境变量。 |
webhook_port | u16 | 8455 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.flock]
[channels.flock]
bot_token_env = "FLOCK_BOT_TOKEN"
# webhook_port = 8456 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "FLOCK_BOT_TOKEN" | 存放 Flock Bot 令牌的环境变量。 |
webhook_port | u16 | 8456 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.twist]
[channels.twist]
token_env = "TWIST_TOKEN"
workspace_id = ""
allowed_channels = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
token_env | string | "TWIST_TOKEN" | 存放 Twist API 令牌的环境变量。 |
workspace_id | string | "" | Twist 工作区 ID。 |
allowed_channels | list of strings | [] | 监听的频道 ID 列表。空列表 = 所有频道。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.mumble]
[channels.mumble]
host = "mumble.example.com"
port = 64738
username = "librefang"
password_env = "MUMBLE_PASSWORD"
channel = ""
| 字段 | 类型 | 默认值 | 说明 |
|---|
host | string | "" | Mumble 服务器主机名。 |
port | u16 | 64738 | Mumble 服务器端口。 |
username | string | "librefang" | Bot 在 Mumble 中的用户名。 |
password_env | string | "MUMBLE_PASSWORD" | 存放 Mumble 服务器密码的环境变量。 |
channel | string | "" | 要加入的 Mumble 频道。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.dingtalk]
支持两种模式:stream(默认,推荐)和 webhook(传统)。
# Stream 模式(推荐 — 无需公网 IP)
[channels.dingtalk]
receive_mode = "stream"
app_key_env = "DINGTALK_APP_KEY"
app_secret_env = "DINGTALK_APP_SECRET"
# Webhook 模式(传统)
[channels.dingtalk]
receive_mode = "webhook"
access_token_env = "DINGTALK_ACCESS_TOKEN"
secret_env = "DINGTALK_SECRET"
# webhook_port = 8457 # 已弃用:Webhook 现共享 API 端口
| 字段 | 类型 | 默认值 | 说明 |
|---|
receive_mode | string | "stream" | 连接模式:"stream" 或 "webhook"。 |
app_key_env | string | "DINGTALK_APP_KEY" | 存放钉钉 App Key 的环境变量(stream 模式)。 |
app_secret_env | string | "DINGTALK_APP_SECRET" | 存放钉钉 App Secret 的环境变量(stream 模式)。 |
access_token_env | string | "DINGTALK_ACCESS_TOKEN" | 存放钉钉 Webhook 访问令牌的环境变量(webhook 模式)。 |
secret_env | string | "DINGTALK_SECRET" | 存放钉钉签名密钥的环境变量(webhook 模式)。 |
webhook_port | u16 | 8457 | 已弃用。 之前用于独立 Webhook 服务器,现已忽略。所有 Webhook 共享 API 端口。 |
robot_code | string 或 null | null | Stream 模式回复使用的机器人编码(默认使用 app_key)。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.discourse]
[channels.discourse]
base_url = "https://forum.example.com"
api_key_env = "DISCOURSE_API_KEY"
api_username = "system"
categories = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
base_url | string | "" | Discourse 论坛基础 URL。 |
api_key_env | string | "DISCOURSE_API_KEY" | 存放 Discourse API Key 的环境变量。 |
api_username | string | "system" | Discourse API 用户名。 |
categories | list of strings | [] | 要监控的分类标识(slug)。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.gitter]
[channels.gitter]
token_env = "GITTER_TOKEN"
room_id = ""
| 字段 | 类型 | 默认值 | 说明 |
|---|
token_env | string | "GITTER_TOKEN" | 存放 Gitter 认证令牌的环境变量。 |
room_id | string | "" | 监听的 Gitter 房间 ID。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.ntfy]
[channels.ntfy]
server_url = "https://ntfy.sh"
topic = "my-agent-topic"
token_env = "NTFY_TOKEN"
| 字段 | 类型 | 默认值 | 说明 |
|---|
server_url | string | "https://ntfy.sh" | ntfy 服务器 URL。支持自托管。 |
topic | string | "" | 要订阅/发布的主题。 |
token_env | string | "NTFY_TOKEN" | 存放认证令牌的环境变量。公共主题可选。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.gotify]
[channels.gotify]
server_url = "https://gotify.example.com"
app_token_env = "GOTIFY_APP_TOKEN"
client_token_env = "GOTIFY_CLIENT_TOKEN"
| 字段 | 类型 | 默认值 | 说明 |
|---|
server_url | string | "" | Gotify 服务器 URL。 |
app_token_env | string | "GOTIFY_APP_TOKEN" | 存放 Gotify 应用令牌(用于发送消息)的环境变量。 |
client_token_env | string | "GOTIFY_CLIENT_TOKEN" | 存放 Gotify 客户端令牌(通过 WebSocket 接收消息)的环境变量。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.webhook]
[channels.webhook]
secret_env = "WEBHOOK_SECRET"
listen_port = 8460
# callback_url = "https://example.com/webhook"
| 字段 | 类型 | 默认值 | 说明 |
|---|
secret_env | string | "WEBHOOK_SECRET" | 存放用于验证入站 Webhook 的 HMAC 签名密钥的环境变量。 |
listen_port | u16 | 8460 | 监听入站 Webhook 请求的端口。 |
callback_url | string 或 null | null | 发送出站消息的 POST 目标 URL。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.voice]
基于 WebSocket 的语音渠道,支持 STT(语音转文字)和 TTS(文字转语音)。
[channels.voice]
api_key_env = "OPENAI_API_KEY"
stt_url = "https://api.openai.com"
tts_url = "https://api.openai.com"
tts_voice = "alloy"
# buffer_threshold = 32768
# default_agent = "assistant"
| 字段 | 类型 | 默认值 | 说明 |
|---|
api_key_env | string | "OPENAI_API_KEY" | 存放 STT/TTS 服务 API key 的环境变量名。 |
stt_url | string | "https://api.openai.com" | STT API 基础 URL(兼容 OpenAI Whisper)。 |
tts_url | string | "https://api.openai.com" | TTS API 基础 URL。 |
tts_voice | string | "alloy" | TTS 语音名称。可选:alloy、echo、fable、onyx、nova、shimmer。 |
buffer_threshold | usize | 32768 | 触发 STT 的音频缓冲区大小(字节)。 |
default_agent | string 或 null | null | 语音消息路由到的默认 Agent 名称。 |
[channels.linkedin]
[channels.linkedin]
access_token_env = "LINKEDIN_ACCESS_TOKEN"
organization_id = ""
| 字段 | 类型 | 默认值 | 说明 |
|---|
access_token_env | string | "LINKEDIN_ACCESS_TOKEN" | 存放 LinkedIn OAuth2 访问令牌的环境变量。 |
organization_id | string | "" | LinkedIn 组织 ID,用于消息收发。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
[channels.qq]
使用 QQ 机器人开放平台官方 API 的 QQ Bot 通道适配器。
[channels.qq]
app_id = "your-app-id"
app_secret_env = "QQ_BOT_APP_SECRET"
allowed_users = []
# default_agent = "assistant"
# account_id = "my-qq-bot"
| 字段 | 类型 | 默认值 | 说明 |
|---|
app_id | string | "" | 在 QQ 开放平台注册的 QQ Bot 应用 ID。 |
app_secret_env | string | "QQ_BOT_APP_SECRET" | 存放 QQ Bot 应用密钥的环境变量。实际密钥绝不存储在配置中。 |
allowed_users | list of strings | [] | 允许交互的 QQ 用户 ID 列表。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.wecom]
企业微信(WeCom)智能机器人通道适配器。通过 WebSocket 连接到 wss://openws.work.weixin.qq.com。
[channels.wecom]
bot_id = "YOUR_BOT_ID"
secret_env = "WECOM_BOT_SECRET"
# account_id = "my-wecom-bot"
# default_agent = "assistant"
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_id | string | "" | 企业微信管理后台的智能机器人 Bot ID。 |
secret_env | string | "WECOM_BOT_SECRET" | 存放机器人密钥的环境变量。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
[channels.wechat]
微信个人账号通道适配器,使用腾讯的 iLink Bot API。通过扫码登录连接,无需 API Key 或开发者账号。
[channels.wechat]
# bot_token_env = "WECHAT_BOT_TOKEN" # 可选:上次会话的持久化令牌
allowed_users = []
# default_agent = "assistant"
# account_id = "my-wechat-bot"
| 字段 | 类型 | 默认值 | 说明 |
|---|
bot_token_env | string | "WECHAT_BOT_TOKEN" | 存放上次二维码登录会话持久化令牌的环境变量。设置后可在重启时跳过二维码登录。 |
allowed_users | list of strings | [] | 允许交互的微信用户 ID(格式:hash@im.wechat)。空列表 = 允许所有。 |
default_agent | string 或 null | null | 消息路由的目标 Agent 名称。 |
account_id | string 或 null | null | 用于多 Bot 路由的唯一 Bot 实例标识符。 |
overrides | object | (默认值) | 每个通道的行为覆盖配置。详见通道行为覆盖。 |
通道行为覆盖
每个通道适配器都支持 [channels.<name>.overrides] 子表,用于按通道自定义 Agent 行为。
[channels.telegram.overrides]
model = "claude-haiku-4-5-20251001"
system_prompt = "You are a concise Telegram assistant."
dm_policy = "respond"
group_policy = "mention_only"
rate_limit_per_minute = 0
rate_limit_per_user = 10
threading = true
output_format = "telegram_html"
usage_footer = "tokens"
typing_mode = "instant"
disable_commands = false
allowed_commands = []
blocked_commands = []
| 字段 | 类型 | 默认值 | 说明 |
|---|
model | string 或 null | null | 该通道的模型覆盖。为 null 时使用 Agent 的默认模型。 |
system_prompt | string 或 null | null | 该通道的系统提示词覆盖。 |
dm_policy | string | "respond" | Bot 处理私聊消息的方式。见下表。 |
group_policy | string | "mention_only" | Bot 处理群组消息的方式。见下表。 |
rate_limit_per_minute | u32 | 0 | 该通道的全局速率限制(每分钟消息数)。0 = 无限制。 |
rate_limit_per_user | u32 | 0 | 每个用户每分钟的最大消息数。0 = 无限制。 |
threading | bool | false | 启用线程回复(在支持的平台上)。 |
output_format | string 或 null | null | 覆盖输出格式。见下表。 |
usage_footer | string 或 null | null | 覆盖该通道的用量页脚模式。可选值:off、tokens、cost、full。 |
typing_mode | string 或 null | null | 输入状态指示器行为。见下表。默认为 instant。 |
disable_commands | bool | false | 关闭该通道所有内置斜杠命令。参见命令策略。 |
allowed_commands | list of strings | [] | 命令名白名单(不带 /)。非空时仅这些命令可用。 |
blocked_commands | list of strings | [] | 命令名黑名单(不带 /)。仅在 allowed_commands 为空时生效。 |
dm_policy 值说明:
| 值 | 说明 |
|---|
respond | 回复所有私聊消息(默认)。 |
allowed_only | 仅回复允许列表中用户的私聊消息。 |
ignore | 忽略所有私聊消息。 |
group_policy 值说明:
| 值 | 说明 |
|---|
all | 回复群聊中的所有消息。 |
mention_only | 仅在被 @ 提及时回复(默认)。 |
commands_only | 仅回复斜杠命令。 |
ignore | 忽略所有群组消息。 |
output_format 值说明:
| 值 | 说明 |
|---|
markdown | 标准 Markdown(默认)。 |
telegram_html | Telegram HTML 子集(<b>、<i>、<code> 等)。 |
slack_mrkdwn | Slack mrkdwn 格式(*bold*、_italic_、`code`)。 |
plain_text | 无格式标记。 |
typing_mode 值说明:
| 值 | 说明 |
|---|
instant | 收到消息后立即发送输入状态指示(默认)。 |
message | 仅在 LLM 返回第一个文本增量时发送输入状态指示。 |
thinking | 仅在 LLM 推理/思考阶段发送输入状态指示。 |
never | 从不发送输入状态指示。 |
命令策略
每个通道都自带一组内置斜杠命令(/agent、/new、/reboot、/model、/usage 等),可用于切换 Agent、开启新会话、查看用量、触发工作流。在面向公众的 bot(客服、社区助手)上暴露这些命令是安全隐患——任何人都可以打 /agent admin 切到内部 Agent,/new 开一个新会话(旧会话仍保留并可在通道里恢复),或者 /model 换模型。
下面三个字段按通道对内置命令做访问控制。优先级: disable_commands > allowed_commands(白名单) > blocked_commands(黑名单)。
被拦截的命令会作为普通文本转发给 Agent——不会返回错误。所以一个设置了 disable_commands = true 的公共 bot,当用户打 /agent admin 时,会由 Agent 自然语言回复,用户永远不会发现命令系统的存在。
配方:完全锁定的公共 bot(禁用所有命令)
[channels.telegram.overrides]
disable_commands = true
配方:保留平台 UX 必需命令的公共 bot
Telegram 的 UX 约定要求 /start 展示欢迎语,只保留安全的几个:
[channels.telegram.overrides]
allowed_commands = ["start", "help"]
配方:只屏蔽危险命令的管理员 bot
对于面向运维人员的 bot(用 allowed_users 限制访问),你可能仍想屏蔽会改变昂贵状态的命令:
[channels.telegram.overrides]
blocked_commands = ["agent", "new", "reboot", "model", "stop"]
命令名是内部使用的裸 token —— TOML 里写 "agent" 或 "/agent" 都行,匹配时会自动去掉前导斜杠。完整命令列表见 /help。
[[sidecar_channels]]
Sidecar 通道适配器允许外部进程(使用任何编程语言编写)充当通道适配器。通过 stdin/stdout 上的换行分隔 JSON 进行通信。
[[sidecar_channels]]
name = "my-custom-channel"
command = "python3"
args = ["adapters/my_adapter.py"]
channel_type = "custom_platform"
[sidecar_channels.env]
MY_API_TOKEN = "secret"
| 字段 | 类型 | 默认值 | 说明 |
|---|
name | string | 必填 | 此适配器的显示名称。 |
command | string | 必填 | 要运行的可执行文件(例如 "python3"、"/usr/local/bin/my-adapter")。 |
args | list of strings | [] | 传递给命令的参数。 |
env | map of string to string | {} | 传递给子进程的额外环境变量。 |
channel_type | string 或 null | null | 通道类型标识符。为 null 时默认为 Custom(<name>)。 |