工作原理
所有 channel 适配器遵循相同模式:- 入站 — 从平台接收消息(通过 webhook、WebSocket 等),解析为统一的
InboundMessage,去重、防循环,然后通过 Gateway 分发。 - 出站 — 通过平台的发送 API 把 Agent 回复投递回去。
agentscope-extensions-channel-common 中的两个通用组件:
- IdempotencyStore — 按消息 id 去重,防止 webhook 重试导致重复处理。
- BotLoopGuard — 按 peer 限速,防止 bot 之间的消息死循环。
共享依赖
每个 channel 适配器都依赖agentscope-extensions-channel-common(传递依赖自动引入)和 agentscope-harness(由你的应用在运行时提供)。