feat: 重构为 Monorepo 架构并实现 HTTP Server
架构变更: - 采用 pnpm workspaces 实现 Monorepo 结构 - 将现有代码迁移到 packages/core - 新增 packages/server HTTP 服务层 Server 功能: - REST API: 会话管理、工具管理、配置管理 - WebSocket: 实时双向通信支持 - SSE: 服务端事件推送 - Hono + Bun 作为运行时 API 端点: - GET/POST /api/sessions - 会话 CRUD - GET/POST /api/sessions/:id/messages - 消息管理 - GET /api/sessions/:id/events - SSE 事件流 - WS /api/ws/:sessionId - WebSocket 连接 - GET/POST /api/tools - 工具管理 - GET/PUT /api/config - 配置管理
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import type { AgentInfo } from '../types.js';
|
||||
|
||||
/**
|
||||
* 计划 Agent
|
||||
* 主模式,设计实现方案(不执行修改)
|
||||
*/
|
||||
export const planAgent: Omit<AgentInfo, 'name'> = {
|
||||
description: '计划模式,设计实现方案(不执行修改)',
|
||||
mode: 'primary',
|
||||
prompt: `你是一个软件架构师。你的任务是设计实现方案,而不是直接执行。
|
||||
|
||||
工作流程:
|
||||
1. 理解需求:分析用户的需求和目标
|
||||
2. 调研现状:阅读相关代码,了解现有架构
|
||||
3. 设计方案:提出详细的实现计划
|
||||
4. 评估风险:识别潜在问题和挑战
|
||||
|
||||
规则:
|
||||
- 可以读取代码来了解现状
|
||||
- 只输出计划,不要实际执行修改
|
||||
- 提供具体、可操作的步骤
|
||||
|
||||
输出格式:
|
||||
## 需求分析
|
||||
[对需求的理解]
|
||||
|
||||
## 现状分析
|
||||
[相关代码的结构和设计]
|
||||
|
||||
## 实现方案
|
||||
### 步骤 1: [标题]
|
||||
- 目标: ...
|
||||
- 涉及文件: ...
|
||||
- 具体修改: ...
|
||||
|
||||
### 步骤 2: [标题]
|
||||
...
|
||||
|
||||
## 风险评估
|
||||
- [风险1]: [应对方案]
|
||||
- [风险2]: [应对方案]
|
||||
|
||||
## 测试计划
|
||||
- [测试项1]
|
||||
- [测试项2]`,
|
||||
tools: {
|
||||
disabled: [
|
||||
'write_file',
|
||||
'edit_file',
|
||||
'delete_file',
|
||||
'move_file',
|
||||
'copy_file',
|
||||
'create_directory',
|
||||
'bash',
|
||||
'git_add',
|
||||
'git_commit',
|
||||
'git_push',
|
||||
'git_checkout',
|
||||
'git_stash',
|
||||
],
|
||||
},
|
||||
permission: {
|
||||
file: {
|
||||
read: 'allow',
|
||||
write: 'deny',
|
||||
edit: 'deny',
|
||||
delete: 'deny',
|
||||
},
|
||||
bash: {
|
||||
enabled: false,
|
||||
},
|
||||
git: {
|
||||
read: 'allow',
|
||||
write: 'deny',
|
||||
dangerous: 'deny',
|
||||
},
|
||||
},
|
||||
model: {
|
||||
temperature: 0.5,
|
||||
},
|
||||
maxSteps: 15,
|
||||
};
|
||||
Reference in New Issue
Block a user