refactor: 移除 Team 和 Swarm 协作功能
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

功能论证结论:Team(团队)和 Swarm(协作)为零后端支持的
纯前端 localStorage 空壳,Pipeline 系统已完全覆盖其全部能力。

删除 16 个文件,约 7,950 行代码:
- 5 个组件:TeamCollaborationView, TeamOrchestrator, TeamList, DevQALoop, SwarmDashboard
- 1 个 Store:teamStore.ts
- 3 个 Client/库:team-client.ts, useTeamEvents.ts, agent-swarm.ts
- 1 个类型文件:team.ts
- 4 个测试文件
- 1 个文档(归档 swarm-coordination.md)

修改 4 个文件:
- Sidebar.tsx:移除"团队"和"协作"导航项
- App.tsx:移除 team/swarm 视图路由
- types/index.ts:移除 team 类型导出
- chatStore.ts:移除 dispatchSwarmTask 方法

更新 CHANGELOG.md 和功能文档 README.md
This commit is contained in:
iven
2026-03-26 20:27:19 +08:00
parent 978dc5cdd8
commit c3996573aa
22 changed files with 11 additions and 7689 deletions

View File

@@ -27,8 +27,6 @@
| [01-agent-clones.md](01-core-features/01-agent-clones.md) | Agent 分身 | L4 | 高 |
| [02-hands-system.md](01-core-features/02-hands-system.md) | Hands 系统 | L3 | 中 |
| [03-workflow-engine.md](01-core-features/03-workflow-engine.md) | 工作流引擎 | L3 | 中 |
| [04-team-collaboration.md](01-core-features/04-team-collaboration.md) | 团队协作 | L3 | 中 |
| [05-swarm-coordination.md](01-core-features/05-swarm-coordination.md) | 多 Agent 协作 | L4 | 高 |
### 1.3 智能层 (Intelligence Layer) - ✅ 完全集成 (2026-03-24 更新)
@@ -164,7 +162,7 @@
| 身份演化 | 8 | 9 | 9 | 648 | 已完成 |
| 上下文压缩 | 9 | 8 | 6 | 432 | 已完成 |
| 心跳巡检 | 9 | 8 | 6 | 432 | 已完成 |
| 多 Agent 协作 | 9 | 6 | 4 | 216 | 已完成 |
| 多 Agent 协作 | 9 | 6 | 4 | 216 | 已移除Pipeline 替代) |
| 自主授权 | 8 | 7 | 5 | 280 | 已完成 |
| 向量记忆 | 9 | 7 | 5 | 315 | 已完成 |
| 会话持久化 | 7 | 9 | 8 | 504 | 已完成 |
@@ -194,7 +192,7 @@
```
┌─────────────────────────────────────────────────────────────┐
│ UI 组件层 │
│ ChatArea │ SwarmDashboard │ RightPanel │ Settings │
│ ChatArea │ PipelinesPanel │ RightPanel │ Settings │
└─────────────────────────────┬───────────────────────────────┘
┌─────────────────────────────▼───────────────────────────────┐
@@ -280,6 +278,7 @@ skills hands protocols pipeline growth channels
| 日期 | 版本 | 变更内容 |
|------|------|---------|
| 2026-03-26 | v0.1.0 | **v1.0 发布准备**:移除 Team/Swarm 功能(~8,100 行Pipeline 替代安全修复CI/CD 建立 |
| 2026-03-26 | v0.5.0 | **Smart Presentation Layer**自动类型检测Chart/Quiz/Slideshow/Document 渲染器PresentationAnalyzer Rust 后端 |
| 2026-03-25 | v0.4.0 | **代码现状深度分析**8 个 Rust Crates 完整度评估78+ 技能确认18+ Store 状态管理,新增 Mesh/Persona 智能组件 |
| 2026-03-25 | v0.3.0 | **Pipeline DSL 系统实现**5 类 Pipeline 模板Agent 智能推荐,结果预览组件 |

View File

@@ -1,138 +0,0 @@
# 团队功能开发笔记
**完成日期**: 2026-03-19
**任务**: 修复团队功能页面空白问题
---
## 一、问题描述
点击"团队"导航后,页面显示空白,控制台报错 `teams.map is not a function`
## 二、根因分析
### 2.1 数据格式冲突
Zustand 的 `persist` 中间件存储格式为:
```json
{
"state": { "teams": [...], "activeTeam": ... },
"version": 0
}
```
`loadTeams` 函数期望的是直接的数组格式 `Team[]`
### 2.2 类型安全问题
TeamList 组件中的 `availableAgents` 变量使用了条件表达式,返回类型不一致:
- `clones``Clone[]` 类型
- `agents.map(...)` 返回的是 `{ id, name, role }[]` 类型
TypeScript 无法推断统一类型,运行时可能导致错误。
## 三、解决方案
### 3.1 修复 loadTeams 函数
```typescript
loadTeams: async () => {
set({ isLoading: true, error: null });
try {
const stored = localStorage.getItem('zclaw-teams');
let teams: Team[] = [];
if (stored) {
const parsed = JSON.parse(stored);
// 处理 persist 中间件格式
if (parsed?.state?.teams && Array.isArray(parsed.state.teams)) {
teams = parsed.state.teams;
} else if (Array.isArray(parsed)) {
teams = parsed;
}
}
set({ teams, isLoading: false });
} catch (error) {
set({ teams: [], isLoading: false });
}
},
```
### 3.2 修复 availableAgents 类型
```typescript
const availableAgents: Array<{ id: string; name: string; role?: string }> =
(clones && clones.length > 0)
? clones.map(c => ({ id: c.id, name: c.name, role: c.role }))
: (agents && agents.length > 0)
? agents.map(a => ({ id: a.id, name: a.name, role: '默认助手' }))
: [];
```
### 3.3 添加防御性检查
```typescript
// TeamList.tsx
{!Array.isArray(teams) || teams.length === 0 ? (
<EmptyState ... />
) : (
teams.map(...)
)}
```
## 四、相关文件
| 文件 | 修改内容 |
|------|----------|
| `store/teamStore.ts` | loadTeams 函数处理 persist 格式 |
| `components/TeamList.tsx` | 类型修复、防御性检查、中文化 |
| `components/ui/EmptyState.tsx` | CSS 修复 (flex-1 → h-full) |
| `App.tsx` | motion.main 添加 flex flex-col |
## 五、经验教训
1. **persist 中间件存储格式**: Zustand persist 存储的是 `{ state, version }` 结构,不是直接的状态值
2. **条件表达式类型一致性**: 三元表达式的两个分支必须返回相同类型
3. **防御性编程**: 对从 store 获取的数据进行 Array.isArray 检查
---
*文档创建: 2026-03-19*
---
## 六、协作功能修复 (2026-03-19)
### 6.1 问题描述
1. **UI 颜色不一致**: SwarmDashboard 使用蓝色(blue-500)作为主色调,与系统的橙色/灰色风格不匹配
2. **内容重复渲染**: 左侧边栏和主内容区同时渲染 SwarmDashboard导致内容重复
### 6.2 解决方案
**问题 1: 内容重复**
-`Sidebar.tsx` 移除 `{activeTab === 'swarm' && <SwarmDashboard />}` 渲染
- 只保留 `App.tsx` 中的主内容区渲染
- 移除未使用的 `import { SwarmDashboard }` 语句
**问题 2: 颜色一致性**
修改 `SwarmDashboard.tsx` 中的配色:
- 主色调: `blue-500``orange-500`
- 按钮背景: `bg-blue-500``bg-orange-500`
- Filter tabs: `bg-blue-100``bg-orange-100`
- 选中边框: `border-blue-500``border-orange-500`
- Focus ring: `ring-blue-500``ring-orange-500`
- 保留执行状态(`executing`/`running`)的蓝色作为状态指示色
### 6.3 相关文件
| 文件 | 修改内容 |
|------|----------|
| `components/Sidebar.tsx` | 移除 SwarmDashboard 渲染和 import |
| `components/SwarmDashboard.tsx` | 配色从蓝色改为橙色 |
### 6.4 设计原则
1. **单一渲染原则**: 每个视图组件只在唯一位置渲染,避免多处同时显示
2. **颜色一致性**: 交互元素使用系统主色调(橙色),状态指示可保留语义色(蓝色=执行中,绿色=完成,红色=失败)