deepfish-ai 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -231,6 +231,7 @@ DeepFish 支持通过 Tool 和 Skill 扩展 AI 的能力。扩展文件可以放
231
231
 
232
232
  - **Tool 扩展**:用于定义 AI 可直接调用的自定义函数工具,适合封装 API 调用、数据库操作、文件处理等能力。可以使用 `ai tools generate xxx` 命令让 AI 根据描述生成 Tool。
233
233
  - 在 Tool 函数中,可以通过调用 `this.createSubAgent(prompt: string)` 创建子 Agent,并将任务说明作为 `prompt` 传入。
234
+ - 在 Tool 函数中,可以通过 `this.curAgent` 获取当前正在执行该 Tool 的 Agent 实例;当 Tool 运行在子 Agent 中时,`this.curAgent` 指向该子 Agent,而不是主 Agent。可用于访问当前 Agent 的上下文能力,例如 `this.curAgent.createSubAgent()` 继续创建下级子 Agent。
234
235
  - **Skill 扩展**:用于定义 AI 的工作流知识包,适合沉淀某类任务的执行步骤、规范和最佳实践。可以使用 `ai skills generate xxx` 命令让 AI 根据描述生成 Skill。
235
236
 
236
237
  ### 当前目录扩展
@@ -48,7 +48,7 @@ const descriptions = [
48
48
  {
49
49
  type: 'function',
50
50
  function: {
51
- name: 'my_function',
51
+ name: 'myFunction',
52
52
  description: '工具的功能描述,说明何时使用、做什么、返回什么',
53
53
  parameters: {
54
54
  type: 'object',
@@ -74,7 +74,7 @@ module.exports = { functions, descriptions };
74
74
  ## 规范
75
75
 
76
76
  1. **返回值**:必须是 `{ success: true, data: any }` 或 `{ success: false, error: string }`
77
- 2. **命名**:函数名用 camelCase,工具名用 snake_case
77
+ 2. **命名**:函数名用 camelCase,描述的function中的name必须和函数名称一致
78
78
  3. **描述**:每个工具和参数都要有清晰的中文描述
79
79
  4. **错误处理**:函数内部必须 try-catch,出错返回 `{ success: false, error: '...' }`
80
80
  5. **一个文件一个工具**:每个 index.js 只导出一个工具函数
@@ -85,4 +85,5 @@ module.exports = { functions, descriptions };
85
85
  1. 理解用户要生成的工具功能
86
86
  2. 在当前工作目录下创建 `deepfish-tool-{功能名}/` 目录
87
87
  3. 编写 `index.js`,导出 `functions` 和 `descriptions`
88
- 4. 确保代码语法正确、可以直接使用 `require`
88
+ 4. 对于需要Agent参与的复杂任务,可以直接使用 `this.createSubAgent(prompt: string)` 创建子 Agent 执行任务,并将任务说明作为 `prompt` 传入
89
+ 5. 需要引入第三方模块时,需要将该tool创建成NodeJs项目,在tool中引入模块