Tori: AI agent workflow manager - initial implementation

Rust (Axum) + Vue 3 + SQLite. Features:
- Project CRUD REST API with proper error handling
- Per-project agent loop (mpsc + broadcast channels)
- LLM-driven plan generation and replan on user feedback
- SSH command execution with status streaming
- WebSocket real-time updates to frontend
- Four-zone UI: requirement, plan (left), execution (right), comment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 10:36:50 +00:00
parent 1122ab27dd
commit 7edbbee471
43 changed files with 7164 additions and 83 deletions

85
doc/design.md Normal file
View File

@@ -0,0 +1,85 @@
# Tori — 产品设计文档
## 概述
Tori 是一个 AI agent 驱动的工作流管理器。类似 ChatGPT 的布局,但管理单元是项目/工作流。
用户描述需求AI 生成计划agent 执行,用户随时通过 comment 提供反馈。
## UI 布局
```
┌──────────┬─────────────────────────────────────────────┐
│ │ ① 需求区(输入/显示) │
│ 项目列表 ├──────────────────────┬──────────────────────┤
│ │ ② Plan │ ③ 执行(右) │
│ > proj-A │ AI 分析 + 步骤列表 │ 步骤状态 + 可折叠日志 │
│ proj-B │ │ │
│ ├──────────────────────┴──────────────────────┤
│ │ ④ Comment5-10行输入区
└──────────┴─────────────────────────────────────────────┘
```
### 关键设计决策
- Plan 和执行**左右并列**,不是上下堆叠
- Comment 区域 5-10 行高
- 侧边栏显示所有项目,点击切换
## Agent 架构
- 每个项目一个 async event loop + mpsc channel
- 用户操作和 SSH 输出都是 channel 中的事件
- Plan → Execute → Replan 循环由事件驱动
- Agent 状态机Idle → Planning → Executing → WaitingForFeedback
## 数据模型
### Project项目
- id, name, description, created_at, updated_at
### Workflow工作流
- id, project_id, requirement需求文本, status, created_at
### PlanStep计划步骤
- id, workflow_id, order, description, status, output
### Comment评论
- id, workflow_id, content, created_at
## API 设计
### REST
- `GET /api/projects` — 列出项目
- `POST /api/projects` — 创建项目
- `GET /api/projects/:id` — 获取项目详情
- `PUT /api/projects/:id` — 更新项目
- `DELETE /api/projects/:id` — 删除项目
- `POST /api/projects/:id/workflows` — 创建工作流(含需求描述)
- `GET /api/projects/:id/workflows` — 列出工作流
- `POST /api/workflows/:id/comments` — 添加评论
### WebSocket
- `GET /ws/:project_id` — 项目的实时更新通道
- Server → Clientplan 更新、执行日志、状态变化
- Client → Server评论、控制命令
## 配置结构
```yaml
llm:
base_url: "https://router.requesty.ai/v1"
api_key: "sk-..."
model: "anthropic/claude-sonnet-4-6-20250514"
ssh:
host: "target-server"
user: "deploy"
key_path: "~/.ssh/id_rsa"
server:
host: "0.0.0.0"
port: 3000
database:
path: "tori.db"
```

5
doc/todo.md Normal file
View File

@@ -0,0 +1,5 @@
# Tori 开发 TODO
所有初始 TODO 已完成。待笨笨指示的事项:
- [ ] ARM 部署方式(等笨笨说怎么搞)