feat(hands): implement 4 new Hands and fix BrowserHand registration
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

- Add ResearcherHand: DuckDuckGo search, web fetch, report generation
- Add CollectorHand: data collection, aggregation, multiple output formats
- Add ClipHand: video processing (trim, convert, thumbnail, concat)
- Add TwitterHand: Twitter/X automation (tweet, retweet, like, search)
- Fix BrowserHand not registered in Kernel (critical bug)
- Add HandError variant to ZclawError enum
- Update documentation: 9/11 Hands implemented (82%)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-24 13:22:44 +08:00
parent 3ff08faa56
commit 1441f98c5e
15 changed files with 2376 additions and 36 deletions

View File

@@ -3,29 +3,53 @@
> **分类**: Hands 系统
> **优先级**: P1 - 重要
> **成熟度**: L3 - 成熟
> **最后更新**: 2026-03-16
> **最后更新**: 2026-03-24
> ✅ **实现状态更新**: 11 个 Hands 中有 **9 个** 已有完整 Rust 后端实现 (Browser, Slideshow, Speech, Quiz, Whiteboard, Researcher, Collector, Clip, Twitter)。所有 9 个已实现 Hands 均已在 Kernel 中注册并可通过 `hand_execute` 命令调用。
---
## 一、功能概述
## 一、功能概述### 1.1 基本信息
### 1.1 基本信息
Hands 是 OpenFang 的自主能力包系统,每个 Hand 封装了一类自动化任务,支持多种触发方式和审批流程。
Hands 是 ZCLAW 的自主能力包系统,每个 Hand 封装了一类自动化任务,支持多种触发方式和审批流程。
| 属性 | 值 |
|------|-----|
| 分类 | Hands 系统 |
| 优先级 | P1 |
| 成熟度 | L3 |
| 依赖 | handStore, GatewayClient |
| 依赖 | handStore, KernelClient, HandRegistry (Rust) |
| Hand 配置数 | 11 |
| **已实现后端** | **9 (82%)** |
| **Kernel 注册** | **9/9 (100%)** |
### 1.2 相关文件
### 1.2 实现状态
| Hand | 配置文件 | 后端实现 | Kernel 注册 | 可用性 |
|------|---------|---------|-------------|--------|
| **browser** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **slideshow** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **speech** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **quiz** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **whiteboard** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **researcher** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **collector** | ✅ | ✅ Rust impl | ✅ | ✅ **可用** |
| **clip** | ✅ | ✅ Rust impl | ✅ | ⚠️ **需 FFmpeg** |
| **twitter** | ✅ | ✅ Rust impl | ✅ | ⚠️ **需 API Key** |
| predictor | ✅ | ❌ 规划中 | ❌ | ❌ 不可用 |
| lead | ✅ | ❌ 规划中 | ❌ | ❌ 不可用 |
### 1.3 相关文件
| 文件 | 路径 | 用途 |
|------|------|------|
| 配置文件 | `hands/*.HAND.toml` | 7 个 Hand 定义 |
| 配置文件 | `hands/*.HAND.toml` | 11 个 Hand 定义 |
| Rust Hand 实现 | `crates/zclaw-hands/src/hands/` | 9 个 Hand 实现 |
| Hand Registry | `crates/zclaw-hands/src/registry.rs` | 注册和执行 |
| Kernel 集成 | `crates/zclaw-kernel/src/kernel.rs` | Kernel 集成 HandRegistry |
| Tauri 命令 | `desktop/src-tauri/src/kernel_commands.rs` | hand_list, hand_execute |
| 状态管理 | `desktop/src/store/handStore.ts` | Hand 状态 |
| Browser Hand Store | `desktop/src/store/browserHandStore.ts` | Browser Hand 专用状态 |
| UI 组件 | `desktop/src/components/HandList.tsx` | Hand 列表 |
| 详情面板 | `desktop/src/components/HandTaskPanel.tsx` | Hand 详情 |
@@ -113,8 +137,31 @@ retention_days = 30
| collector | data | 数据收集和聚合 | 定时/事件/手动 | 否 |
| predictor | data | 预测分析、回归/分类/时间序列 | 手动/定时 | 否 |
| twitter | communication | Twitter/X 自动化 | 定时/事件 | 是 |
| whiteboard | collaboration | 白板协作和绘图 | 手动 | 否 |
| slideshow | presentation | 幻灯片生成和演示 | 手动 | 否 |
| speech | communication | 语音合成和识别 | 手动/事件 | 否 |
| quiz | education | 问答和测验生成 | 手动 | 否 |
### 3.2 核心接口
### 3.2 高级 Hand 功能
**支持参数的 Hands:**
- `collector`: targetUrl, selector, outputFormat, pagination
- `predictor`: dataSource, model, targetColumn, featureColumns
- `clip`: inputPath, outputFormat, trimStart, trimEnd
- `twitter`: action, content, schedule, mediaUrls
**支持工作流步骤的 Hands:**
- `researcher`: search → extract → analyze → report
- `collector`: fetch → parse → transform → export
- `predictor`: load → preprocess → train → evaluate → predict → report
**支持 Actions 的 Hands:**
- `whiteboard`: draw_text, draw_shape, draw_line, draw_chart, draw_latex, draw_table, clear, export
- `slideshow`: next_slide, prev_slide, goto_slide, spotlight, laser, highlight, play_animation
- `speech`: speak, speak_ssml, pause, resume, stop, list_voices, set_voice
- `quiz`: generate, grade, analyze, hint, explain, adaptive_next, generate_report
### 3.3 核心接口
```typescript
interface Hand {
@@ -230,7 +277,7 @@ const useHandStore = create<HandState>((set, get) => ({
| 指标 | 基线 | 目标 | 当前 |
|------|------|------|------|
| Hand 数量 | 0 | 10+ | 7 |
| Hand 数量 | 0 | 10+ | 11 |
| 执行成功率 | 50% | 95% | 90% |
| 审批响应时间 | - | <5min | 3min |
@@ -240,13 +287,15 @@ const useHandStore = create<HandState>((set, get) => ({
### 5.1 已实现功能
- [x] 7 Hand 定义
- [x] 11 Hand 定义
- [x] HAND.toml 配置格式
- [x] 触发执行
- [x] 审批流程
- [x] 状态追踪
- [x] Hand 列表 UI
- [x] Hand 详情面板
- [x] Browser Hand 完整实现 (Fantoccini WebDriver)
- [x] Rust 后端集成
### 5.2 测试覆盖

View File

@@ -1,11 +1,11 @@
# ZCLAW 功能全景文档
> **版本**: v1.1
> **更新日期**: 2026-03-17
> **项目状态**: 开发收尾317 测试通过
> **审计状态**: ⚠️ 部分功能代码存在但未集成到 UI
> **版本**: v0.2.0
> **更新日期**: 2026-03-24
> **项目状态**: 内部 Kernel 架构Streaming + MCP 协议
> **架构**: Tauri 桌面应用Rust 后端 + React 前端
> 📋 **重要**: 详见 [FRONTEND_INTEGRATION_AUDIT.md](FRONTEND_INTEGRATION_AUDIT.md) 了解完整集成状态审计报告
> 📋 **重要**: ZCLAW 现已采用内部 Kernel 架构,所有核心能力集成在 Tauri 桌面应用中,无需外部进程
---
@@ -52,21 +52,23 @@
| [02-session-persistence.md](03-context-database/02-session-persistence.md) | 会话持久化 | L4 | 高 |
| [03-memory-extraction.md](03-context-database/03-memory-extraction.md) | 记忆提取 | L4 | 高 |
### 1.5 Skills 生态 - ⚠️ SkillMarket UI 未集成
### 1.5 Skills 生态 - ✅ 动态扫描已实现
| 文档 | 功能 | 成熟度 | UI 集成 |
|------|------|--------|---------|
| [00-skill-system.md](04-skills-ecosystem/00-skill-system.md) | Skill 系统概述 | L4 | ⚠️ 部分 |
| [01-builtin-skills.md](04-skills-ecosystem/01-builtin-skills.md) | 内置技能 (74个) | L4 | N/A |
| [02-skill-discovery.md](04-skills-ecosystem/02-skill-discovery.md) | 技能发现 | **L2** | **集成** |
| [00-skill-system.md](04-skills-ecosystem/00-skill-system.md) | Skill 系统概述 | L4 | ✅ 通过 Tauri 命令 |
| [01-builtin-skills.md](04-skills-ecosystem/01-builtin-skills.md) | 内置技能 (73个 SKILL.md) | L4 | N/A |
| [02-skill-discovery.md](04-skills-ecosystem/02-skill-discovery.md) | 技能发现 (动态扫描 73 个) | **L4** | **集成** |
> ⚠️ **注意**: `SkillMarket.tsx` 组件存在但未集成到任何视图
> **更新**: Skills 动态扫描已实现。Kernel 集成 `SkillRegistry`,通过 Tauri 命令 `skill_list` 和 `skill_refresh` 动态发现所有 73 个技能。
### 1.6 Hands 系统
### 1.6 Hands 系统 - ✅ 9/11 已实现 (2026-03-24 更新)
| 文档 | 功能 | 成熟度 | 测试覆盖 |
|------|------|--------|---------|
| [00-hands-overview.md](05-hands-system/00-hands-overview.md) | Hands 概述 (7个) | L3 | |
| 文档 | 功能 | 成熟度 | 可用 Hands |
|------|------|--------|-----------|
| [00-hands-overview.md](05-hands-system/00-hands-overview.md) | Hands 概述 (11个) | L3 | **9/11 (82%)** |
> ✅ **更新**: 9 个 Hands 已有完整 Rust 后端实现: Browser, Slideshow, Speech, Quiz, Whiteboard, Researcher, Collector, Clip (需 FFmpeg), Twitter (需 API Key)。所有 9 个已实现 Hands 均已在 Kernel 中注册,通过 Tauri 命令 `hand_list` 和 `hand_execute` 可用。
### 1.7 Tauri 后端
@@ -180,12 +182,16 @@
| 指标 | 数值 |
|------|------|
| 功能模块总数 | 25+ |
| Skills 数量 | 74 |
| Hands 数量 | 7 |
| 测试用例 | 317 |
| 测试通过率 | 100% |
| 代码行数 (前端) | ~15,000 |
| 代码行数 (后端) | ~2,000 |
| SKILL.md 文件 | 73 |
| 动态发现技能 | 73 (100%) |
| Hands 总数 | 11 |
| **已实现 Hands** | **9 (82%)** |
| **Kernel 注册 Hands** | **9/9 (100%)** |
| Zustand Store | 15 |
| Tauri 命令 | 100+ |
| 代码行数 (前端) | ~20,000 |
| 代码行数 (后端 Rust) | ~8,000 |
| LLM Provider 支持 | 7+ (Kimi, Qwen, DeepSeek, Zhipu, OpenAI, Anthropic, Local) |
---
@@ -193,4 +199,10 @@
| 日期 | 版本 | 变更内容 |
|------|------|---------|
| 2026-03-24 | v0.2.4 | Hands Review: 修复 BrowserHand Kernel 注册问题,所有 9 个已实现 Hands 均可访问 |
| 2026-03-24 | v0.2.3 | Hands 后端集成: 9/11 Hands 可用 (新增 Clip, Twitter) |
| 2026-03-24 | v0.2.2 | Hands 后端集成: 7/11 Hands 可用 (新增 Researcher, Collector) |
| 2026-03-24 | v0.2.1 | Hands 后端集成: 5/11 Hands 可用 (Browser, Slideshow, Speech, Quiz, Whiteboard) |
| 2026-03-24 | v0.2.0 | 更新为内部 Kernel 架构Streaming + MCP 协议,修正 Skills/Hands 数量 |
| 2026-03-17 | v1.1 | 智能层集成状态更新 |
| 2026-03-16 | v1.0 | 初始版本,完成全部功能文档 |