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>
3.0 KiB
3.0 KiB
Tori — 产品设计文档
概述
Tori 是一个 AI agent 驱动的工作流管理器。类似 ChatGPT 的布局,但管理单元是项目/工作流。 用户描述需求,AI 生成计划,agent 执行,用户随时通过 comment 提供反馈。
UI 布局
┌──────────┬─────────────────────────────────────────────┐
│ │ ① 需求区(输入/显示) │
│ 项目列表 ├──────────────────────┬──────────────────────┤
│ │ ② Plan(左) │ ③ 执行(右) │
│ > proj-A │ AI 分析 + 步骤列表 │ 步骤状态 + 可折叠日志 │
│ proj-B │ │ │
│ ├──────────────────────┴──────────────────────┤
│ │ ④ Comment(5-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 → Client:plan 更新、执行日志、状态变化
- Client → Server:评论、控制命令
配置结构
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"