添加AOL路由和UI/UX增强组件
Some checks failed
CI / Check / macos-latest (push) Has been cancelled
CI / Check / ubuntu-latest (push) Has been cancelled
CI / Check / windows-latest (push) Has been cancelled
CI / Test / macos-latest (push) Has been cancelled
CI / Test / ubuntu-latest (push) Has been cancelled
CI / Test / windows-latest (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / Secrets Scan (push) Has been cancelled
CI / Install Script Smoke Test (push) Has been cancelled
Some checks failed
CI / Check / macos-latest (push) Has been cancelled
CI / Check / ubuntu-latest (push) Has been cancelled
CI / Check / windows-latest (push) Has been cancelled
CI / Test / macos-latest (push) Has been cancelled
CI / Test / ubuntu-latest (push) Has been cancelled
CI / Test / windows-latest (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / Secrets Scan (push) Has been cancelled
CI / Install Script Smoke Test (push) Has been cancelled
This commit is contained in:
183
NEW_SESSION_PROMPT.md
Normal file
183
NEW_SESSION_PROMPT.md
Normal file
@@ -0,0 +1,183 @@
|
||||
# OpenFang 项目开发 - 新会话提示词
|
||||
|
||||
## 项目概述
|
||||
|
||||
OpenFang 是一个开源的 Agent 操作系统,使用 Rust 编写 (14 crates)。这是继续推进开发的提示词。
|
||||
|
||||
**关键文件**:
|
||||
- 项目根目录: `c:\Users\szend\Downloads\openfang-main\openfang-main`
|
||||
- 计划文件: `plans/radiant-yawning-raven.md` (完整分析和任务列表)
|
||||
- 开发规则: `CLAUDE.md` (必须遵守的开发规则)
|
||||
|
||||
---
|
||||
|
||||
## 已完成的工作 (2026-03-01)
|
||||
|
||||
### 1. Agent Registry 持久化修复 ✅
|
||||
- 在 `kernel.rs` 添加了 5 个包装方法: `set_agent_state`, `set_agent_mode`, `update_agent_identity`, `update_agent_name`, `update_agent_description`
|
||||
- 更新了 `routes.rs` 调用 kernel 方法而非直接调用 registry
|
||||
- 在 `registry.rs` 添加了 8 个测试用例
|
||||
|
||||
### 2. 知识图谱递归遍历实现 ✅
|
||||
- 文件: `crates/openfang-memory/src/knowledge.rs`
|
||||
- 实现了 BFS 迭代遍历算法
|
||||
- 支持 `max_depth` 参数 (最大 10)
|
||||
- 环路检测 (HashSet)
|
||||
- 4 个新测试用例
|
||||
|
||||
### 3. AOL (Agent 编排语言) AST 类型定义 ✅
|
||||
- 文件: `crates/openfang-types/src/aol.rs` (1074 行)
|
||||
- 定义了 `AolWorkflow`, `AolStep`, `AgentRef`, `ErrorMode` 等类型
|
||||
- 40+ 单元测试
|
||||
- 已在 `lib.rs` 中导出
|
||||
|
||||
### 4. E2E 测试框架 ✅
|
||||
- 文件: `tests/e2e_test.rs`, `tests/e2e_common.rs`, `tests/e2e_api_test.rs`, `tests/e2e_fixtures.rs`
|
||||
- 测试工具: `spawn_daemon()`, `wait_for_health()`, `create_test_agent()`, `send_message()`
|
||||
- 30+ 测试用例
|
||||
|
||||
### 5. 实时协作层 Migration v8 ✅
|
||||
- 文件: `crates/openfang-memory/src/migration.rs`
|
||||
- 新增表: `annotations`, `annotation_reactions`, `collab_sessions`, `presence_log`
|
||||
- SCHEMA_VERSION: 7 → 8
|
||||
|
||||
### 6. CLAUDE.md 开发规则更新 ✅
|
||||
- 添加了架构规则、持久化规则、API 开发规则、安全规则、测试规则、前端规则
|
||||
|
||||
### 7. 智谱 GLM-5 和百炼 Coding Plan 支持 ✅
|
||||
- 在 `model_catalog.rs` 添加了 BAILIAN_BASE_URL
|
||||
- 在 `drivers/mod.rs` 添加了百炼提供商支持
|
||||
|
||||
---
|
||||
|
||||
## 后续待实现任务
|
||||
|
||||
按优先级排序:
|
||||
|
||||
### 高优先级
|
||||
|
||||
1. **AOL 解析器实现** (2-3 天)
|
||||
- 文件: `crates/openfang-kernel/src/aol/parser.rs`
|
||||
- 实现 TOML → AST 解析
|
||||
- 模板变量展开
|
||||
|
||||
2. **AOL 执行引擎实现** (5 天)
|
||||
- 文件: `crates/openfang-kernel/src/aol_executor.rs`
|
||||
- DAG 构建与拓扑排序
|
||||
- 并行执行支持
|
||||
- 错误处理与重试
|
||||
|
||||
3. **验证构建和测试**
|
||||
- 运行 `cargo build --workspace --lib`
|
||||
- 运行 `cargo test --workspace`
|
||||
- 运行 `cargo clippy --workspace --all-targets -- -D warnings`
|
||||
|
||||
### 中优先级
|
||||
|
||||
4. **PresenceManager 实现** (3 天)
|
||||
- 文件: `crates/openfang-api/src/presence.rs`
|
||||
- 用户在线状态管理
|
||||
- WebSocket 协议扩展
|
||||
|
||||
5. **AnnotationStore 实现** (2 天)
|
||||
- 文件: `crates/openfang-api/src/annotation.rs`
|
||||
- 评论/批注 CRUD 操作
|
||||
- 反应系统
|
||||
|
||||
### 低优先级
|
||||
|
||||
6. **前端协作 UI 组件** (4 天)
|
||||
- 文件: `crates/openfang-api/static/js/collab.js`
|
||||
- Presence 指示器
|
||||
- 光标叠加层
|
||||
- 评论面板
|
||||
|
||||
7. **Agent 市场设计**
|
||||
8. **联邦 Agent 网络**
|
||||
|
||||
---
|
||||
|
||||
## 开发规则摘要
|
||||
|
||||
### 持久化规则 (CRITICAL)
|
||||
所有 Agent 修改操作必须同时更新内存和 SQLite:
|
||||
|
||||
```rust
|
||||
// ✅ 正确: Kernel 层包装方法
|
||||
pub fn set_agent_mode(&self, agent_id: AgentId, mode: AgentMode) -> KernelResult<()> {
|
||||
self.registry.set_mode(agent_id, mode)?; // 内存
|
||||
if let Some(entry) = self.registry.get(agent_id) {
|
||||
let _ = self.memory.save_agent(&entry); // SQLite
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ❌ 错误: 直接调用 registry (不持久化)
|
||||
state.kernel.registry.set_mode(agent_id, mode)
|
||||
```
|
||||
|
||||
### API 开发规则
|
||||
- 新路由必须在 `server.rs` 和 `routes.rs` 两处注册
|
||||
- 使用统一的错误/成功响应格式
|
||||
|
||||
### 配置字段规则
|
||||
添加新配置字段需要:
|
||||
1. 在 struct 中添加字段
|
||||
2. 添加 `#[serde(default)]`
|
||||
3. 在 `Default` impl 中添加默认值
|
||||
|
||||
---
|
||||
|
||||
## 关键文件路径
|
||||
|
||||
| 文件 | 用途 |
|
||||
|------|------|
|
||||
| `crates/openfang-kernel/src/kernel.rs` | 核心协调器 |
|
||||
| `crates/openfang-kernel/src/registry.rs` | Agent 内存注册表 |
|
||||
| `crates/openfang-memory/src/structured.rs` | Agent SQLite 持久化 |
|
||||
| `crates/openfang-memory/src/knowledge.rs` | 知识图谱 (已实现递归遍历) |
|
||||
| `crates/openfang-memory/src/migration.rs` | 数据库迁移 (v8) |
|
||||
| `crates/openfang-api/src/server.rs` | HTTP 路由注册 |
|
||||
| `crates/openfang-api/src/routes.rs` | HTTP 处理函数 |
|
||||
| `crates/openfang-types/src/aol.rs` | AOL AST 类型 (新建) |
|
||||
| `tests/e2e_*.rs` | E2E 测试框架 (新建) |
|
||||
| `CLAUDE.md` | 开发规则 (已更新) |
|
||||
| `plans/radiant-yawning-raven.md` | 完整计划文件 |
|
||||
|
||||
---
|
||||
|
||||
## 新会话启动提示
|
||||
|
||||
复制以下内容到新会话:
|
||||
|
||||
```
|
||||
我正在继续开发 OpenFang 项目 (Rust Agent 操作系统)。
|
||||
|
||||
项目路径: c:\Users\szend\Downloads\openfang-main\openfang-main
|
||||
|
||||
请先阅读:
|
||||
1. CLAUDE.md - 开发规则
|
||||
2. plans/radiant-yawning-raven.md - 完整计划 (特别是附录 L: 实现完成记录)
|
||||
|
||||
已完成的工作:
|
||||
- Agent Registry 持久化修复
|
||||
- 知识图谱递归遍历实现
|
||||
- AOL AST 类型定义 (aol.rs)
|
||||
- E2E 测试框架
|
||||
- Migration v8 (协作层表结构)
|
||||
- CLAUDE.md 开发规则更新
|
||||
|
||||
待实现的任务 (按优先级):
|
||||
1. AOL 解析器 (TOML → AST)
|
||||
2. AOL 执行引擎
|
||||
3. 验证构建和测试
|
||||
4. PresenceManager 实现
|
||||
5. AnnotationStore 实现
|
||||
|
||||
请继续推进后续开发工作。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 当前日期
|
||||
2026-03-01
|
||||
Reference in New Issue
Block a user