Files
noc/doc/suite.md
Fam Zheng 035d9b9be2 add suite: all-in-one Docker image with noc + Gitea
- Switch to rustls (drop OpenSSL dependency) for musl static build
- Add deploy/ with Dockerfile and entrypoint (Gitea auto-setup + admin token)
- Add Makefile targets: build-musl, docker
- Add doc/suite.md: design doc for human-AI collaboration interfaces
2026-04-10 21:09:15 +01:00

136 lines
5.4 KiB
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.
# Suite — 人与 AI 的协作套件
## 一句话
同一个 AI 内核,多种协作界面,覆盖人与 AI 互动的全部场景。
## 四种界面
```
┌─────────────────────────────────────────────────────┐
│ AI Core │
│ persona · inner_state · memory · tools · context │
└──────┬──────────┬──────────┬──────────┬──────────────┘
│ │ │ │
┌───▼───┐ ┌───▼───┐ ┌───▼───┐ ┌───▼───┐
│ Chat │ │ Gitea │ │Worker │ │ Self │
│ │ │ Bot │ │ │ │ │
└───────┘ └───────┘ └───────┘ └───────┘
```
### Chat — 对话
实时聊天,最直接的人机沟通。
- 触发:用户发消息
- 输出:流式文字回复、文件、语音
- 前端Telegram、飞书、未来更多
- 已有:当前 suite 的主体
### Gitea Bot — 代码协作
AI 作为团队成员出现在代码流程中。
- 触发webhookpush、PR、issue、comment
- 输出PR review comment、issue 回复、CI 状态通知
- 上下文git diff、commit history、issue 内容
- 场景:
- PR 提交后自动 review
- issue 里 @bot 触发分析或执行
- CI 失败后主动分析原因并评论
- 代码变更后自动更新相关 issue 状态
### Worker — 后台任务
AI 在后台安静地干活,做完了才来找你。
- 触发定时cron、事件文件变化、监控告警、Chat/Gitea 中委派
- 输出:执行结果推送到 Chat 或 Gitea
- 场景:
- 定时巡检服务健康状态
- 监控日志异常,发现问题主动通知
- 跑长任务(数据分析、批量操作),完成后汇报
- Chat 里说"帮我查一下 X",转为后台任务异步执行
- 已有SubAgent雏形
### Self — AI 自身
不被触发AI 按自己的节奏存在。
- 触发内部驱动life loop、反思周期
- 输出:可能发消息,也可能只是更新内心状态
- 场景:
- 早上主动问好,晚上道晚安
- 感知用户状态(很久没聊、最近很累),决定是否主动关心
- 定期整理记忆、反思最近的互动
- 主动沉默也是一种行为
- 已有life loop + reflect + inner_state
## 共享内核
四种界面共享同一个 AI Core
| 组件 | 说明 |
|------|------|
| Persona | 定义 AI 是谁 |
| Inner State | AI 对当前情况的感知LLM 自更新 |
| Memory | 跨会话的持久记忆 |
| Context | 对话历史、summary、scratch |
| Tools | 统一的工具注册表,各界面按需可见 |
所有界面的交互最终都流经同一个 LLM 调用路径,共享 persona 和 inner_state——无论 AI 是在回复聊天、review 代码还是自言自语,它都是同一个"人"。
## 界面之间的联动
界面不是孤立的,它们之间会互相触发:
```
Chat ──"帮我 review 那个 PR"──→ Gitea Bot
Gitea Bot ──"CI 挂了,要不要我看看"──→ Chat
Worker ──任务完成──→ Chat / Gitea Bot
Self ──"Fam 今天还没动过代码"──→ Chat主动关心
```
## 部署架构
Suite 是自包含的——不依赖外部服务,自己带齐所有组件:
```
┌─ suite 部署 ─────────────────────────────────┐
│ │
│ noc (Rust binary) │
│ ├─ telegram loop (Chat) │
│ ├─ axum http server (Gitea webhook) │
│ ├─ life loop (Self) │
│ └─ worker loop (Worker) │
│ │
│ Gitea (self-hosted, AI 专属) │
│ ├─ noc 持有 admin token完全控制 │
│ ├─ webhook → noc http server │
│ └─ noc 通过 REST API 读写一切 │
│ │
│ SQLite (共享状态) │
│ │
│ LLM backend (外部OpenAI-compatible) │
│ │
└───────────────────────────────────────────────┘
```
Gitea 是 noc 的"专属地盘"——admin token 意味着 noc 可以:
- 创建/删除 repo 和 branch
- 读写任意 PR、issue、comment
- 管理 webhook、CI、用户
- 不用操心权限,想干嘛干嘛
部署方式docker-compose 或 systemd 同机编排,一键拉起。
## 现状 → 目标
| 界面 | 现状 | 下一步 |
|------|------|--------|
| Chat | ✅ Telegram, streaming, tools | 多前端抽象Telegram + 飞书) |
| Gitea Bot | ❌ 不存在 | webhook 接收 + PR review |
| Worker | 🟡 SubAgent 雏形 | 独立任务队列 + 结果路由 |
| Self | 🟡 life loop + reflect | 更丰富的自主行为 |
| Gitea | ❌ 外部依赖 | 纳入 suite 部署self-hosted |