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 测试覆盖