From d60d445cbf46fa8c8c808ff054a0ea74fd2b5af3 Mon Sep 17 00:00:00 2001 From: iven Date: Sun, 15 Mar 2026 01:51:45 +0800 Subject: [PATCH] feat(phase4-5): add Workflow types and expand Skills ecosystem Phase 4: Type System Completion (P2) - Add comprehensive Workflow type definitions: - WorkflowStepType: hand, skill, agent, condition, parallel, delay - WorkflowStep: individual step configuration - Workflow: complete workflow definition - WorkflowRunStatus: pending, running, completed, failed, cancelled, paused - WorkflowRun: execution instance tracking - Request/Response types for API operations - Control types for pause/resume/cancel - Update types/index.ts with workflow exports Phase 5: Skills Ecosystem Expansion (P2) - Add 5 new Skills with SKILL.md definitions: - git: Git version control operations - file-operations: File system operations - web-search: Web search capabilities - data-analysis: Data analysis and visualization - shell-command: Shell command execution - Skills coverage now at 9/60+ (15%) Documentation: - Update SYSTEM_ANALYSIS.md Phase 4 & 5 status - Mark Phase 4 as completed - Update Phase 5 progress tracking Co-Authored-By: Claude Opus 4.6 --- desktop/src/types/index.ts | 18 +++ desktop/src/types/workflow.ts | 212 ++++++++++++++++++++++++++++++++ docs/SYSTEM_ANALYSIS.md | 27 ++-- skills/data-analysis/SKILL.md | 135 ++++++++++++++++++++ skills/file-operations/SKILL.md | 142 +++++++++++++++++++++ skills/git/SKILL.md | 131 ++++++++++++++++++++ skills/shell-command/SKILL.md | 174 ++++++++++++++++++++++++++ skills/web-search/SKILL.md | 118 ++++++++++++++++++ 8 files changed, 947 insertions(+), 10 deletions(-) create mode 100644 desktop/src/types/workflow.ts create mode 100644 skills/data-analysis/SKILL.md create mode 100644 skills/file-operations/SKILL.md create mode 100644 skills/git/SKILL.md create mode 100644 skills/shell-command/SKILL.md create mode 100644 skills/web-search/SKILL.md diff --git a/desktop/src/types/index.ts b/desktop/src/types/index.ts index 106a18b..45e90d3 100644 --- a/desktop/src/types/index.ts +++ b/desktop/src/types/index.ts @@ -38,3 +38,21 @@ export type { SettingsValidationError, SettingsResponse, } from './settings'; + +// Workflow Types +export type { + WorkflowStepType, + WorkflowStep, + Workflow, + WorkflowRunStatus, + WorkflowRun, + CreateWorkflowRequest, + UpdateWorkflowRequest, + WorkflowListResponse, + WorkflowResponse, + WorkflowRunListResponse, + TriggerWorkflowRequest, + TriggerWorkflowResponse, + WorkflowControlRequest, + WorkflowControlResponse, +} from './workflow'; diff --git a/desktop/src/types/workflow.ts b/desktop/src/types/workflow.ts new file mode 100644 index 0000000..7082653 --- /dev/null +++ b/desktop/src/types/workflow.ts @@ -0,0 +1,212 @@ +/** + * Workflow Type Definitions for OpenFang + * + * This module defines all TypeScript types related to workflow + * management, execution, and monitoring in the OpenFang system. + * + * @module types/workflow + */ + +/** + * Types of workflow steps available in OpenFang + */ +export type WorkflowStepType = + | 'hand' // Execute a Hand (autonomous capability) + | 'skill' // Execute a Skill + | 'agent' // Delegate to an Agent + | 'condition' // Conditional branching + | 'parallel' // Parallel execution of sub-steps + | 'delay'; // Time-based delay + +/** + * Represents a single step in a workflow + */ +export interface WorkflowStep { + /** Unique identifier for this step */ + id: string; + /** Optional display name for the step */ + name?: string; + /** Type of the workflow step */ + type: WorkflowStepType; + /** Name of the Hand to execute (when type='hand') */ + handName?: string; + /** Name of the Skill to execute (when type='skill') */ + skillName?: string; + /** ID of the Agent to delegate to (when type='agent') */ + agentId?: string; + /** Condition expression to evaluate (when type='condition') */ + condition?: string; + /** Parameters to pass to the step execution */ + params?: Record; + /** Timeout duration in seconds */ + timeout?: number; + /** Number of retry attempts on failure */ + retryCount?: number; + /** Error handling strategy */ + onError?: 'continue' | 'stop' | 'retry'; +} + +/** + * Complete workflow definition + */ +export interface Workflow { + /** Unique identifier for the workflow */ + id: string; + /** Display name of the workflow */ + name: string; + /** Optional description of what the workflow does */ + description?: string; + /** Ordered list of steps to execute */ + steps: WorkflowStep[]; + /** Workflow version for tracking changes */ + version?: string; + /** ISO timestamp of workflow creation */ + createdAt?: string; + /** ISO timestamp of last update */ + updatedAt?: string; + /** Current lifecycle status of the workflow */ + status?: 'draft' | 'active' | 'archived'; +} + +/** + * Possible states of a workflow run + */ +export type WorkflowRunStatus = + | 'pending' // Waiting to start + | 'running' // Currently executing + | 'completed' // Finished successfully + | 'failed' // Terminated with error + | 'cancelled' // Manually stopped + | 'paused'; // Temporarily suspended + +/** + * Represents a single execution instance of a workflow + */ +export interface WorkflowRun { + /** Unique identifier for this run instance */ + runId: string; + /** ID of the workflow being executed */ + workflowId: string; + /** Current execution status */ + status: WorkflowRunStatus; + /** ID of the currently executing step */ + step?: string; + /** Index of current step (0-based) */ + currentStepIndex?: number; + /** Total number of steps in workflow */ + totalSteps?: number; + /** ISO timestamp when run started */ + startedAt?: string; + /** ISO timestamp when run completed */ + completedAt?: string; + /** Result data from successful execution */ + result?: unknown; + /** Error message if run failed */ + error?: string; + /** Additional metadata about the run */ + metadata?: Record; +} + +/** + * Request payload for creating a new workflow + */ +export interface CreateWorkflowRequest { + /** Display name for the new workflow */ + name: string; + /** Optional description */ + description?: string; + /** Steps to include in the workflow (IDs will be auto-generated) */ + steps: Omit[]; +} + +/** + * Request payload for updating an existing workflow + */ +export interface UpdateWorkflowRequest { + /** New display name */ + name?: string; + /** New description */ + description?: string; + /** Updated step definitions */ + steps?: WorkflowStep[]; + /** New lifecycle status */ + status?: 'draft' | 'active' | 'archived'; +} + +/** + * API response for listing workflows + */ +export interface WorkflowListResponse { + /** Array of workflow definitions */ + workflows: Workflow[]; + /** Total count of workflows */ + total: number; +} + +/** + * API response for single workflow operations + */ +export interface WorkflowResponse { + /** The workflow data */ + workflow: Workflow; + /** Whether the operation succeeded */ + success: boolean; + /** Error message if operation failed */ + error?: string; +} + +/** + * API response for listing workflow runs + */ +export interface WorkflowRunListResponse { + /** Array of workflow run instances */ + runs: WorkflowRun[]; + /** Total count of runs */ + total: number; +} + +/** + * Request to trigger a workflow execution + */ +export interface TriggerWorkflowRequest { + /** ID of the workflow to execute */ + workflowId: string; + /** Optional parameters to pass to the workflow */ + params?: Record; + /** Whether to run asynchronously (default: true) */ + async?: boolean; +} + +/** + * API response for workflow trigger operations + */ +export interface TriggerWorkflowResponse { + /** ID of the started run */ + runId: string; + /** Whether the trigger was successful */ + success: boolean; + /** Error message if trigger failed */ + error?: string; +} + +/** + * Request to control a running workflow + */ +export interface WorkflowControlRequest { + /** ID of the run to control */ + runId: string; + /** Control action to perform */ + action: 'pause' | 'resume' | 'cancel'; +} + +/** + * API response for workflow control operations + */ +export interface WorkflowControlResponse { + /** Whether the control action succeeded */ + success: boolean; + /** New status after control action */ + newStatus?: WorkflowRunStatus; + /** Error message if action failed */ + error?: string; +} diff --git a/docs/SYSTEM_ANALYSIS.md b/docs/SYSTEM_ANALYSIS.md index c1ba340..6e6f8ef 100644 --- a/docs/SYSTEM_ANALYSIS.md +++ b/docs/SYSTEM_ANALYSIS.md @@ -253,7 +253,7 @@ ZCLAW 是基于 **OpenFang** (Rust Agent OS) 的 AI Agent 桌面客户端,核 | Agent 类型定义 | `types/agent.ts` | ✅ 已完成 | | Session 类型定义 | `types/session.ts` | ✅ 已完成 | | Settings 类型定义 | `types/settings.ts` | ✅ 已完成 | -| Workflow 详细类型 | `types/workflow.ts` | 🔴 待开始 | +| Workflow 详细类型 | `types/workflow.ts` | ✅ 已完成 | ### Phase 5: Skills 生态扩展 (P2) @@ -261,13 +261,19 @@ ZCLAW 是基于 **OpenFang** (Rust Agent OS) 的 AI Agent 桌面客户端,核 **时间**: 持续进行 -| 技能类别 | 示例技能 | 优先级 | -|----------|----------|--------| -| 开发工具 | git, docker, kubernetes | 高 | -| 数据处理 | csv, json, yaml, excel | 高 | -| 文档生成 | markdown, pdf, docx | 中 | -| 网络工具 | http, curl, websocket | 中 | -| AI 增强 | embedding, rag, memory | 中 | +| 技能 | 触发词 | 状态 | +|------|--------|------| +| chinese-writing | 写一篇, 帮我写, 撰写 | ✅ 已定义 | +| feishu-docs | 飞书文档, 创建文档 | ✅ 已定义 | +| code-review | 审查代码, code review | ✅ 已定义 | +| translation | 翻译, translate | ✅ 已定义 | +| git | git, 提交, commit, push, pull | ✅ 已定义 | +| file-operations | 读取文件, 写入文件, 创建文件 | ✅ 已定义 | +| web-search | 搜索, 查找, web search | ✅ 已定义 | +| data-analysis | 分析数据, 统计, 图表 | ✅ 已定义 | +| shell-command | 执行命令, 运行, shell | ✅ 已定义 | + +**当前 Skills 覆盖**: 9/60+ 潜在 (15%) --- @@ -329,7 +335,7 @@ ZCLAW 是基于 **OpenFang** (Rust Agent OS) 的 AI Agent 桌面客户端,核 - [x] Agent 类型定义完整 - [x] Session 类型定义完整 - [x] Settings 类型定义完整 -- [ ] Workflow 详细类型定义 +- [x] Workflow 详细类型定义 --- @@ -378,5 +384,6 @@ ZCLAW 是基于 **OpenFang** (Rust Agent OS) 的 AI Agent 桌面客户端,核 *最后更新: 2026-03-15* *Phase 1 & 2 已完成* *Phase 3 进行中 (2/3)* -*Phase 4 部分完成 (3/4)* +*Phase 4 已完成* +*Phase 5 进行中 (9/60+ Skills)* *下次审查: Phase 3 完成后* diff --git a/skills/data-analysis/SKILL.md b/skills/data-analysis/SKILL.md new file mode 100644 index 0000000..d01e143 --- /dev/null +++ b/skills/data-analysis/SKILL.md @@ -0,0 +1,135 @@ +--- +name: data-analysis +description: 数据分析和可视化 - 分析数据、生成统计、创建图表 +triggers: + - "分析数据" + - "数据分析" + - "统计" + - "图表" + - "可视化" + - "数据报告" + - "数据统计" +tools: + - bash + - read + - write +--- + +# 数据分析和可视化 + +分析数据、生成统计信息、创建数据可视化图表。 + +## 能力 + +- 数据统计:计算均值、中位数、标准差等 +- 数据清洗:处理缺失值、异常值 +- 数据转换:格式转换、数据聚合 +- 趋势分析:识别数据趋势和模式 +- 可视化建议:推荐合适的图表类型 +- 报告生成:生成数据分析报告 + +## 工具依赖 + +- bash: 执行数据处理脚本(Python/Node.js) +- read: 读取数据文件 +- write: 输出分析结果 + +## 支持的数据格式 + +| 格式 | 扩展名 | 说明 | +|------|--------|------| +| CSV | .csv | 逗号分隔值 | +| JSON | .json | JSON 数据 | +| Excel | .xlsx | Excel 表格 | +| TSV | .tsv | 制表符分隔 | +| YAML | .yaml/.yml | YAML 格式 | + +## 常用分析方法 + +### 描述性统计 + +```python +# 使用 pandas +import pandas as pd + +df = pd.read_csv('data.csv') + +# 基本统计 +print(df.describe()) + +# 缺失值检查 +print(df.isnull().sum()) +``` + +### 数据聚合 + +```python +# 分组统计 +df.groupby('category').agg({ + 'value': ['mean', 'sum', 'count'] +}) +``` + +### 时间序列分析 + +```python +# 日期转换 +df['date'] = pd.to_datetime(df['date']) + +# 按时间聚合 +df.set_index('date').resample('M').mean() +``` + +## 图表类型选择 + +| 数据类型 | 推荐图表 | 用途 | +|----------|----------|------| +| 对比 | 柱状图、条形图 | 比较不同类别 | +| 趋势 | 折线图、面积图 | 展示变化趋势 | +| 占比 | 饼图、环形图 | 显示部分与整体 | +| 分布 | 直方图、箱线图 | 展示数据分布 | +| 关系 | 散点图、气泡图 | 显示变量关系 | + +## 示例用法 + +``` +用户: 分析 data/sales.csv 文件,生成销售报告 +助手: 读取并分析数据... + +[使用 read 工具读取文件] +[使用 bash 执行 Python 分析脚本] + +## 销售数据分析报告 + +### 数据概览 +- 总记录数: 1,234 条 +- 时间范围: 2024-01 至 2024-12 +- 产品类别: 5 个 + +### 关键指标 +| 指标 | 值 | +|------|-----| +| 总销售额 | ¥1,234,567 | +| 平均订单额 | ¥1,000 | +| 最高单笔 | ¥15,000 | +| 月均增长 | 12.5% | + +### 趋势分析 +- Q1: 缓慢增长 +- Q2: 快速增长期 +- Q3: 稳定期 +- Q4: 年末冲刺 + +### 建议 +1. 加强 Q2 营销投入 +2. 优化低利润产品线 +3. 关注客户复购率 +``` + +## 输出规范 + +- 使用中文输出分析结果 +- 表格使用 Markdown 格式 +- 关键数据加粗标注 +- 提供数据解读和建议 +- 标注数据来源和时间范围 diff --git a/skills/file-operations/SKILL.md b/skills/file-operations/SKILL.md new file mode 100644 index 0000000..def7325 --- /dev/null +++ b/skills/file-operations/SKILL.md @@ -0,0 +1,142 @@ +--- +name: file-operations +description: 文件系统操作 - 读取、写入、创建、删除、复制文件和目录 +triggers: + - "读取文件" + - "写入文件" + - "创建文件" + - "删除文件" + - "复制文件" + - "移动文件" + - "创建目录" + - "列出文件" + - "查找文件" +tools: + - read + - write + - edit + - glob + - bash +--- + +# 文件系统操作 + +执行文件和目录的读写、创建、删除、复制等操作。 + +## 能力 + +- 读取文件:查看文件内容 +- 写入文件:创建或覆盖文件 +- 编辑文件:修改文件内容 +- 删除文件:删除指定文件 +- 复制文件:复制文件到新位置 +- 移动文件:移动或重命名文件 +- 创建目录:创建新目录 +- 列出文件:查看目录内容 +- 查找文件:按模式搜索文件 + +## 工具依赖 + +- read: 读取文件内容 +- write: 写入文件 +- edit: 编辑文件(字符串替换) +- glob: 按模式查找文件 +- bash: 执行复杂文件操作(复制、移动、删除目录等) + +## 安全原则 + +1. **确认操作**: 删除或覆盖文件前确认 +2. **路径验证**: 使用绝对路径,避免路径遍历 +3. **备份重要**: 修改重要文件前建议备份 +4. **权限检查**: 确保有足够的文件系统权限 + +## 常用操作 + +### 读取文件 + +```typescript +// 使用 read 工具 +read: { file_path: "/path/to/file" } +``` + +### 写入文件 + +```typescript +// 使用 write 工具 +write: { + file_path: "/path/to/file", + content: "文件内容" +} +``` + +### 编辑文件 + +```typescript +// 使用 edit 工具(替换字符串) +edit: { + file_path: "/path/to/file", + old_string: "old content", + new_string: "new content" +} +``` + +### 查找文件 + +```typescript +// 使用 glob 工具 +glob: { + pattern: "**/*.ts", + path: "/project/src" +} +``` + +### 复制/移动/删除 + +```bash +# 复制文件 +cp /source/file /dest/file + +# 复制目录 +cp -r /source/dir /dest/dir + +# 移动/重命名 +mv /old/path /new/path + +# 删除文件 +rm /path/to/file + +# 删除目录 +rm -rf /path/to/dir +``` + +## 示例用法 + +``` +用户: 读取 src/config.ts 文件 +助手: 读取文件内容... + +[使用 read 工具] + +文件内容如下: +```typescript +export const config = { + apiUrl: "https://api.example.com", + timeout: 5000 +}; +``` + +用户: 把 apiUrl 改成 http://localhost:3000 +助手: 修改配置... + +[使用 edit 工具] + +已将 apiUrl 从 "https://api.example.com" 修改为 "http://localhost:3000" +``` + +## 输出规范 + +- 显示操作的目标文件路径 +- 显示操作结果(成功/失败) +- 读取文件时显示完整内容 +- 编辑时显示变更的 diff +- 中文描述操作结果 diff --git a/skills/git/SKILL.md b/skills/git/SKILL.md new file mode 100644 index 0000000..5a6ade4 --- /dev/null +++ b/skills/git/SKILL.md @@ -0,0 +1,131 @@ +--- +name: git +description: Git 版本控制操作 - 执行提交、推送、拉取、分支管理等 Git 操作 +triggers: + - "git" + - "提交" + - "commit" + - "push" + - "pull" + - "分支" + - "branch" + - "合并" + - "merge" + - "rebase" + - "暂存" + - "stash" +tools: + - bash +--- + +# Git 版本控制操作 + +执行 Git 版本控制操作,管理代码仓库的版本历史。 + +## 能力 + +- 提交代码:创建新的 commit +- 推送代码:将本地更改推送到远程仓库 +- 拉取代码:从远程仓库获取最新更改 +- 分支管理:创建、切换、删除分支 +- 合并代码:合并分支,处理冲突 +- 查看历史:查看提交日志、文件变更 +- 暂存更改:stash 相关操作 + +## 工具依赖 + +- bash: 执行 git 命令 + +## 常用命令 + +### 提交相关 + +```bash +# 查看状态 +git status + +# 添加文件 +git add +git add . + +# 提交 +git commit -m "type(scope): message" + +# 推送 +git push origin +``` + +### 分支相关 + +```bash +# 查看分支 +git branch -a + +# 创建分支 +git checkout -b + +# 切换分支 +git checkout + +# 删除分支 +git branch -d +``` + +### 合并相关 + +```bash +# 合并分支 +git merge + +# rebase +git rebase + +# 处理冲突后继续 +git rebase --continue +``` + +## 提交信息规范 + +遵循 Conventional Commits 格式: + +``` +(): + +[optional body] + +[optional footer] +``` + +### 类型 (type) + +| 类型 | 说明 | +|------|------| +| feat | 新功能 | +| fix | 修复 bug | +| docs | 文档更新 | +| style | 代码格式(不影响功能) | +| refactor | 重构 | +| perf | 性能优化 | +| test | 测试相关 | +| chore | 构建/工具相关 | +| ci | CI/CD 相关 | + +## 示例用法 + +``` +用户: 帮我提交这些更改,提交信息是 "feat(auth): add OAuth2 login" +助手: 执行提交操作... + +$ git add . +$ git commit -m "feat(auth): add OAuth2 login" +$ git push origin main + +提交成功! +``` + +## 输出规范 + +- 显示执行的 git 命令 +- 显示命令输出结果 +- 遇到错误时提供解决建议 +- 中文描述操作结果 diff --git a/skills/shell-command/SKILL.md b/skills/shell-command/SKILL.md new file mode 100644 index 0000000..948496b --- /dev/null +++ b/skills/shell-command/SKILL.md @@ -0,0 +1,174 @@ +--- +name: shell-command +description: Shell 命令执行 - 执行终端命令、脚本运行、系统操作 +triggers: + - "执行命令" + - "运行" + - "shell" + - "terminal" + - "命令行" + - "终端" + - "运行脚本" + - "执行脚本" +tools: + - bash +--- + +# Shell 命令执行 + +执行终端命令、运行脚本、进行系统操作。 + +## 能力 + +- 命令执行:执行各种 shell 命令 +- 脚本运行:运行 bash/python/node 脚本 +- 系统操作:文件、进程、网络等系统命令 +- 管道操作:使用管道组合命令 +- 环境管理:管理环境变量和路径 + +## 工具依赖 + +- bash: 执行 shell 命令 + +## 安全原则 + +1. **危险命令确认**: 删除、格式化等危险操作需确认 +2. **权限最小化**: 使用最小必要权限 +3. **命令审查**: 执行前检查命令安全性 +4. **沙箱隔离**: 敏感操作在隔离环境执行 + +## 常用命令分类 + +### 文件操作 + +```bash +# 列出文件 +ls -la + +# 查找文件 +find . -name "*.ts" + +# 搜索内容 +grep -r "pattern" . + +# 文件权限 +chmod 755 script.sh +``` + +### 进程管理 + +```bash +# 查看进程 +ps aux | grep node + +# 终止进程 +kill + +# 后台运行 +nohup npm start & + +# 查看端口占用 +lsof -i :3000 +``` + +### 网络操作 + +```bash +# HTTP 请求 +curl -X GET https://api.example.com + +# 下载文件 +wget https://example.com/file.zip + +# 检查网络 +ping google.com + +# DNS 查询 +nslookup example.com +``` + +### 开发工具 + +```bash +# Node.js +npm install +npm run build +npm test + +# Python +pip install -r requirements.txt +python script.py + +# Git +git status +git commit -m "message" +``` + +### 系统信息 + +```bash +# 系统版本 +uname -a + +# 磁盘空间 +df -h + +# 内存使用 +free -m + +# CPU 信息 +cat /proc/cpuinfo +``` + +## 示例用法 + +``` +用户: 运行 npm run build 构建项目 +助手: 执行构建命令... + +$ npm run build + +> project@1.0.0 build +> vite build + +vite v5.0.0 building for production... +✓ 42 modules transformed. +dist/index.html 0.45 kB +dist/assets/index.js 125.00 kB +dist/assets/index.css 15.00 kB +✓ built in 2.5s + +构建成功!输出文件位于 dist/ 目录。 +``` + +``` +用户: 查看当前目录下最大的 5 个文件 +助手: 执行命令... + +$ du -ah . | sort -rh | head -5 + +1.2G ./node_modules +450M ./dist +120M ./coverage +85M ./node_modules/typescript +72M ./node_modules/@types + +最大的 5 个文件/目录已列出。 +``` + +## 输出规范 + +- 显示执行的完整命令 +- 显示命令的标准输出和错误输出 +- 中文描述命令结果 +- 错误时提供可能的原因和解决方案 +- 长输出进行适当截断和摘要 + +## 错误处理 + +遇到命令执行失败时: + +1. 显示完整的错误信息 +2. 分析可能的原因 +3. 提供解决建议 +4. 如需要,提供替代方案 diff --git a/skills/web-search/SKILL.md b/skills/web-search/SKILL.md new file mode 100644 index 0000000..e688606 --- /dev/null +++ b/skills/web-search/SKILL.md @@ -0,0 +1,118 @@ +--- +name: web-search +description: 网络搜索 - 执行网络搜索、获取网页内容、研究问题 +triggers: + - "搜索" + - "查找" + - "搜索一下" + - "web search" + - "搜索网络" + - "查一下" + - "了解一下" +tools: + - web_search + - web_fetch + - bash +--- + +# 网络搜索 + +执行网络搜索,获取网页内容,帮助用户研究和了解信息。 + +## 能力 + +- 网络搜索:使用搜索引擎搜索信息 +- 网页抓取:获取网页内容 +- 信息提取:从网页中提取关键信息 +- 多源对比:对比多个来源的信息 +- 实时信息:获取最新的网络信息 + +## 工具依赖 + +- web_search: 执行网络搜索 +- web_fetch: 获取网页内容 +- bash: 使用 curl 等工具获取资源 + +## 搜索策略 + +1. **关键词优化**: 使用精确的搜索关键词 +2. **多语言搜索**: 支持中英文搜索 +3. **时效性过滤**: 可按时间范围过滤结果 +4. **来源评估**: 评估信息来源的可靠性 +5. **交叉验证**: 多来源验证关键信息 + +## 搜索流程 + +``` +1. 理解搜索意图 + ↓ +2. 构建搜索关键词 + ↓ +3. 执行搜索 + ↓ +4. 分析搜索结果 + ↓ +5. 如需深入,获取网页内容 + ↓ +6. 整理并呈现结果 +``` + +## 常用场景 + +### 技术问题搜索 + +``` +搜索关键词: +- "[技术] + 错误信息" +- "[框架名] + 版本 + 问题" +- "site:stackoverflow.com + 问题" +``` + +### 文档查找 + +``` +搜索关键词: +- "[库名] + documentation" +- "[框架] + 官方文档" +- "site:github.com + 项目名" +``` + +### 新闻资讯 + +``` +搜索关键词: +- "[主题] + 最新" +- "[事件] + 新闻" +- 按时间过滤最近结果 +``` + +## 示例用法 + +``` +用户: 搜索一下 React 19 的新特性 +助手: 执行搜索... + +[使用 web_search 工具] + +搜索结果: + +1. React 19 新特性概览 - React 官方博客 + - 新的 use() Hook + - 服务端组件改进 + - 自动记忆化 + +2. React 19 升级指南 + - 破坏性变更列表 + - 迁移步骤 + +需要我获取某篇文章的详细内容吗? +``` + +## 输出规范 + +- 列出搜索结果来源 +- 提供结果摘要 +- 标注信息来源链接 +- 中文呈现结果 +- 区分事实和观点 +- 标注信息的时效性