Files
ops-assistant/docs/channel-adapter-template.md
2026-03-19 21:23:28 +08:00

29 lines
747 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Channel Adapter Template
目标:新通道只做 I/O 适配,不耦合业务执行。
## 责任边界
- 接收平台消息并标准化为统一结构
- 调用 `ops.Service.Handle(...)` 处理命令
- 将文本回复回传到平台
## 禁止事项
- 不在通道内直接执行 shell/ssh/http 运维动作
- 不在通道内做模块业务判断(应交给 command/module
## 最小流程
1. `Normalize(raw)` -> `UnifiedMessage`
2. `handled, out := opsSvc.Handle(msg.OperatorID, msg.Text)`
3. `if handled { Reply(out) }`
4. 未处理消息再回退到历史业务逻辑(如记账)
## 接入检查
- [ ] 仅实现消息适配与回复
- [ ] 已接入 opsSvc.Handle
- [ ] 未绕过 policy/runbook
- [ ] 错误信息对用户可读