添加消息平台 Adapter
当 messaging platform 能把用户消息投递到 resident gateway,并能通过同一平台接收回复时,才添加 channel adapter。
Adapter Interface
Adapters 实现 channels.Adapter。Optional interfaces 增加 polling、lifecycle、webhook routes、typing、
status、acknowledgements 和 outbound media。
Factories 实现 channels.Factory,并在 runtime assembly 中注册到 channel registry。
入站事件
Inbound platform events 会变成 protocol.ChannelInbound。包含 channel name、account、identity、external
peer/thread IDs、text、attachments、timestamps,以及 delivery 需要的 metadata。
不要在 adapter 中调用模型。把 inbound work 提交给 gateway。
投递
Outbound delivery 从 gateway/runtime 接收 protocol.ChannelOutbound。Platform retry/backoff 和 message-size
chunking 应留在 adapter 内。
Delivery status 应通过 channel status、audit 和 errors 反映,且不能泄露 tokens。
媒体附件
Inbound media 应以 bounded size 和 safe download rules staged 为 artifacts。Outbound media 需要
MediaOutboundAdapter 和明确 supported kinds。
除非 platform API 和 media guard 让它安全,否则不要 fetch private/internal URLs。
访问策略
平台支持时,用 channel config 中的 dm_policy、group_policy、allow_from 和 allow_groups。
Access policy 是 channel-level authorization。它不会改变 profile、provider、tool 或 filesystem permissions。
Doctor 检查
添加 setup templates、secret ref checks、channel doctor coverage、redacted config views,以及存在安全 live target 时的 live-smoke tests。
Doctor 应验证 local readiness。Live tests 必须放在显式 environment gates 后面。