172 lines
7.1 KiB
Markdown
172 lines
7.1 KiB
Markdown
# Phase 0:智慧神殿现状与目标
|
||
|
||
日期:2026-04-08
|
||
状态:已完成
|
||
|
||
---
|
||
|
||
## 1. 本阶段目的
|
||
|
||
本文件用于统一背景认知,明确:
|
||
|
||
- Temple 页面当前处于什么状态
|
||
- 主要短板是什么
|
||
- 为什么要升级
|
||
- 升级后的目标形态是什么
|
||
|
||
---
|
||
|
||
## 2. 当前 Temple 页面状态
|
||
|
||
### 2.1 现有实现
|
||
|
||
`frontend/src/pages/temple/index.vue` 是一个**空白占位页**:
|
||
|
||
```vue
|
||
<script setup lang="ts">
|
||
// 智慧神殿 - Temple of Wisdom
|
||
</script>
|
||
|
||
<template>
|
||
<div class="temple-page">
|
||
<div class="page-header">
|
||
<h1>⛩️ 智慧神殿</h1>
|
||
<p class="subtitle">深邃智慧,永恒传承</p>
|
||
</div>
|
||
<div class="page-content">
|
||
<div class="placeholder-content">
|
||
<div class="temple-icon">🏛️</div>
|
||
<p>智慧神殿 - 敬请期待</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
```
|
||
|
||
### 2.2 触发入口
|
||
|
||
聊天输入框上方三个按钮之一(`◈`),跳转到 `/temple`:
|
||
|
||
```html
|
||
<!-- frontend/src/pages/chat/index.vue -->
|
||
<div class="top-buttons-row">
|
||
<button class="top-action-btn" @click="$router.push('/temple')" title="Temple">
|
||
<span class="btn-icon temple-icon">◈</span>
|
||
</button>
|
||
<button class="top-action-btn" @click="$router.push('/knowledge')" title="Knowledge">
|
||
<span class="btn-icon knowledge-icon">◉</span>
|
||
</button>
|
||
<button class="top-action-btn" @click="$router.push('/war-room')" title="War Room">
|
||
<span class="btn-icon war-icon">⬡</span>
|
||
</button>
|
||
</div>
|
||
```
|
||
|
||
---
|
||
|
||
## 3. 当前系统现状
|
||
|
||
### 3.1 Tools 系统(两套并存)
|
||
|
||
#### A. 工具注册层(`app/tools/`)
|
||
|
||
已建立 manifest 驱动的工具注册体系:
|
||
|
||
```
|
||
app/tools/
|
||
├── manifests/ # YAML manifest 定义
|
||
│ ├── file_operator.yaml # 4 commands: read_file, write_file, list_directory, search_files
|
||
│ ├── task_manager.yaml # 5 commands: create_task, list_tasks, get_task, complete_task, fail_task
|
||
│ ├── web_fetch.yaml # 2 commands: fetch, screenshot
|
||
│ └── web_search.yaml # 2 commands: search, deep_search
|
||
├── registry.py # ToolRegistry 动态注册中心
|
||
├── implementations/ # 工具 Python 实现
|
||
├── permissions.py # 权限控制
|
||
├── hooks/ # Hook 系统(审计日志、安全扫描、危险确认)
|
||
└── schemas/ # Pydantic Schema
|
||
```
|
||
|
||
#### B. Agent 工具层(`app/agents/tools/`)
|
||
|
||
LangChain `@tool` 装饰器定义的 Agent 可用工具:
|
||
|
||
| 类别 | 工具 | 源文件 |
|
||
|------|------|--------|
|
||
| 文件操作 | `glob`, `grep`, `read_file`, `write_file` | `builtins/file_tools.py` |
|
||
| 系统命令 | `bash`, `powershell` | `builtins/system_tools.py` |
|
||
| 开发工具 | `git`, `lsp_tools` | `builtins/dev_tools.py` |
|
||
| 协作工具 | `team_agent`, `task_broadcast` | `builtins/collaboration_tools.py` |
|
||
| 知识检索 | `search_knowledge`, `get_knowledge_graph_context`, `build_knowledge_graph`, `hybrid_search`, `web_search` | `search.py` |
|
||
| 日程管理 | `get_schedule_day`, `create_todo`, `create_schedule_task`, `create_reminder`, `create_goal` | `schedule.py` |
|
||
| 任务管理 | `get_tasks`, `create_task`, `update_task_status` | `task.py` |
|
||
| 论坛功能 | `get_forum_posts`, `create_forum_post`, `scan_forum_for_instructions` | `forum.py` |
|
||
| 时间推理 | `resolve_time_expression` | `time_reasoning.py` |
|
||
|
||
### 3.2 Skills 系统
|
||
|
||
#### A. DB 层
|
||
|
||
已有完整 CRUD:
|
||
|
||
- 路由:`/api/skills`
|
||
- 字段:`name`, `description`, `instructions`, `agent_type`, `tools`, `visibility`, `is_builtin`, `is_active`
|
||
- Agent types:`general`, `schedule_planner`, `executor`, `librarian`, `analyst`
|
||
- Visibility:`private`, `team`, `market`
|
||
|
||
#### B. 文件层
|
||
|
||
`SkillRegistry` 加载 `.md` 文件供 Agent 运行时使用。
|
||
|
||
加载器:
|
||
- `MCPSkillLoader` - MCP 能力包加载
|
||
- `LocalSkillLoader` - 本地 `.md` 文件加载
|
||
- `PluginLoader` - 插件式加载
|
||
|
||
### 3.3 当前问题
|
||
|
||
| 问题 | 影响 |
|
||
|------|------|
|
||
| Temple 页面是空白占位页 | 三个按钮入口之一完全无功能 |
|
||
| Tools 无统一展示入口 | 用户无法看到系统有哪些可用工具 |
|
||
| Tools 散落在两套体系 | manifest 层 + agent 层,用户无感知 |
|
||
| Skills 页面独立在 `/skills` | 工具和技能没有统一管理入口 |
|
||
|
||
---
|
||
|
||
## 4. 目标架构
|
||
|
||
```
|
||
┌─────────────────────────────────────────────────────────────┐
|
||
│ /temple │
|
||
│ ┌──────────────────────────────────────────────────────┐ │
|
||
│ │ [◈ 智慧神殿] [Tools] [Skills] │ │
|
||
│ └──────────────────────────────────────────────────────┘ │
|
||
│ ┌──────────────────────────────────────────────────────┐ │
|
||
│ │ TOTAL: 30 ACTIVE: 28 AGENTS: 5 (Metrics) │ │
|
||
│ └──────────────────────────────────────────────────────┘ │
|
||
│ │
|
||
│ ┌────────────────┐ ┌─────────────────────────────────┐ │
|
||
│ │ [分类树] │ │ [工具详情] │ │
|
||
│ │ │ │ │ │
|
||
│ │ ▼ 注册层 │ │ file_operator │ │
|
||
│ │ 文件操作 │ │ 描述: 强大的文件系统操作工具 │ │
|
||
│ │ 任务管理 │ │ 命令: 4 个 │ │
|
||
│ │ ▼ Agent层 │ │ 调用: 1,234 次 错误率: 0.2% │ │
|
||
│ │ 知识检索 │ │ │ │
|
||
│ │ 日程管理 │ │ [Commands] │ │
|
||
│ │ 任务管理 │ │ • read_file │ │
|
||
│ │ 论坛功能 │ │ • write_file │ │
|
||
│ │ 时间推理 │ │ • list_directory │ │
|
||
│ └────────────────┘ └─────────────────────────────────┘ │
|
||
└─────────────────────────────────────────────────────────────┘
|
||
```
|
||
|
||
---
|
||
|
||
## 5. 本阶段产出要求
|
||
|
||
- [x] 团队对 Temple 当前状态和目标方向达成一致
|
||
- [x] Tools 系统两套并存的现状已梳理清楚
|
||
- [x] Skills 系统现有架构已梳理清楚
|
||
- [x] 后续 phase 文档能够在这个认知基础上展开
|