deepfish-ai 1.0.29 → 2.0.2

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.
Files changed (62) hide show
  1. package/README.md +126 -368
  2. package/dist/index.js +23320 -0
  3. package/dist/serve/client/assets/index-DUHYC91l.js +1 -0
  4. package/dist/serve/client/assets/index-zcrdNLZs.css +1 -0
  5. package/dist/serve/client/index.html +14 -0
  6. package/dist/serve/pm2-server.js +21015 -0
  7. package/dist/serve/server/entry-server.mjs +224 -0
  8. package/package.json +61 -83
  9. package/LICENSE +0 -21
  10. package/README_CN.md +0 -460
  11. package/src/AgentRobot/AgentRobotFactory/MainAgentRobot.js +0 -88
  12. package/src/AgentRobot/AgentRobotFactory/SubAgentRobot.js +0 -45
  13. package/src/AgentRobot/AgentRobotFactory/SubSkillAgentRobot.js +0 -45
  14. package/src/AgentRobot/AgentRobotFactory/index.js +0 -48
  15. package/src/AgentRobot/BaseAgentRobot/Brain.js +0 -210
  16. package/src/AgentRobot/BaseAgentRobot/BrainEvent.js +0 -17
  17. package/src/AgentRobot/BaseAgentRobot/Hand.js +0 -119
  18. package/src/AgentRobot/BaseAgentRobot/Heart.js +0 -0
  19. package/src/AgentRobot/BaseAgentRobot/Logger.js +0 -114
  20. package/src/AgentRobot/BaseAgentRobot/ScreenPrinter.js +0 -49
  21. package/src/AgentRobot/BaseAgentRobot/index.js +0 -266
  22. package/src/AgentRobot/BaseAgentRobot/lazy-tools/AliBailian.js +0 -997
  23. package/src/AgentRobot/BaseAgentRobot/lazy-tools/doc-transform.js +0 -204
  24. package/src/AgentRobot/BaseAgentRobot/lazy-tools/docx.js +0 -1286
  25. package/src/AgentRobot/BaseAgentRobot/lazy-tools/img.js +0 -765
  26. package/src/AgentRobot/BaseAgentRobot/lazy-tools/pdf.js +0 -736
  27. package/src/AgentRobot/BaseAgentRobot/lazy-tools/pptx.js +0 -567
  28. package/src/AgentRobot/BaseAgentRobot/lazy-tools/video.js +0 -36
  29. package/src/AgentRobot/BaseAgentRobot/lazy-tools/xlsx.js +0 -611
  30. package/src/AgentRobot/BaseAgentRobot/tools/BaseTools.js +0 -13
  31. package/src/AgentRobot/BaseAgentRobot/tools/CreateAgentTools.js +0 -158
  32. package/src/AgentRobot/BaseAgentRobot/tools/FileTools.js +0 -768
  33. package/src/AgentRobot/BaseAgentRobot/tools/GenerateTools.js +0 -441
  34. package/src/AgentRobot/BaseAgentRobot/tools/InquirerTools.js +0 -244
  35. package/src/AgentRobot/BaseAgentRobot/tools/SystemTools.js +0 -424
  36. package/src/AgentRobot/BaseAgentRobot/tools/TaskTools.js +0 -211
  37. package/src/AgentRobot/BaseAgentRobot/tools/TestTools.js +0 -100
  38. package/src/AgentRobot/BaseAgentRobot/tools/UserTool.js +0 -87
  39. package/src/AgentRobot/BaseAgentRobot/tools/WebTools.js +0 -257
  40. package/src/AgentRobot/BaseAgentRobot/utils/AIRequest.js +0 -297
  41. package/src/AgentRobot/BaseAgentRobot/utils/AIToolManager.js +0 -131
  42. package/src/AgentRobot/BaseAgentRobot/utils/AgentTree.js +0 -66
  43. package/src/AgentRobot/BaseAgentRobot/utils/AttachmentToolScanner.js +0 -235
  44. package/src/AgentRobot/BaseAgentRobot/utils/MessageCompresser.js +0 -236
  45. package/src/AgentRobot/BaseAgentRobot/utils/aiConsole.js +0 -74
  46. package/src/AgentRobot/BaseAgentRobot/utils/aiInquirer.js +0 -78
  47. package/src/AgentRobot/BaseAgentRobot/utils/analyzeReturn.test.js +0 -104
  48. package/src/AgentRobot/BaseAgentRobot/utils/copilot.js +0 -117
  49. package/src/AgentRobot/BaseAgentRobot/utils/node-root.js +0 -138
  50. package/src/AgentRobot/BaseAgentRobot/utils/normal.js +0 -399
  51. package/src/cli/ConfigManager.js +0 -283
  52. package/src/cli/DefaultConfig.js +0 -98
  53. package/src/cli/GlobalVariable.js +0 -8
  54. package/src/cli/MemoryManager.js +0 -53
  55. package/src/cli/SkillConfigManager.js +0 -354
  56. package/src/cli/SkillParser.js +0 -58
  57. package/src/cli/ai-auth.js +0 -231
  58. package/src/cli/ai-config.js +0 -225
  59. package/src/cli/ai-memory.js +0 -22
  60. package/src/cli/ai-skill.js +0 -65
  61. package/src/cli/index.js +0 -77
  62. package/src/index.js +0 -54
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center" style="display:flex;align-items: center;justify-content: center;">
2
- <img src="./images/title-img.png" alt="DeepFish" width="300" />
2
+ <img src="https://github.com/qq306863030/deepfish-ai/blob/master/images/title-img.png" alt="DeepFish" width="300" />
3
3
  </div>
4
4
 
5
5
  ---
@@ -24,80 +24,68 @@
24
24
  />
25
25
  </div>
26
26
 
27
- <img src="./images/banner.png" alt="banner" style="width:100%;text-align:center;" />
27
+ <img src="https://github.com/qq306863030/deepfish-ai/blob/master/images/banner.png" alt="banner" style="width:100%;text-align:center;" />
28
28
 
29
+ - [English](README_EN.md) | [中文](README.md)
29
30
 
31
+ ## 目录
30
32
 
31
- - [English](README.md) | [中文](README_CN.md)
33
+ - [目录](#目录)
34
+ - [1. 介绍](#1-介绍)
35
+ - [2. 安装](#2-安装)
36
+ - [前置要求](#前置要求)
37
+ - [通过npm安装](#通过npm安装)
38
+ - [从源码安装](#从源码安装)
39
+ - [3. 快速使用](#3-快速使用)
40
+ - [4. 命令说明](#4-命令说明)
41
+ - [基础对话](#基础对话)
42
+ - [配置管理](#配置管理)
43
+ - [模型管理](#模型管理)
44
+ - [Skill 管理](#skill-管理)
45
+ - [工具管理](#工具管理)
46
+ - [会话管理](#会话管理)
47
+ - [任务管理](#任务管理)
48
+ - [MCP 管理](#mcp-管理)
49
+ - [服务管理](#服务管理)
50
+ - [缓存管理(AI自我学习的缓存)](#缓存管理ai自我学习的缓存)
51
+ - [5. MCP 扩展配置](#5-mcp-扩展配置)
52
+ - [配置示例](#配置示例)
53
+ - [6. 贡献](#6-贡献)
54
+ - [7. 许可证](#7-许可证)
55
+ - [8. 支持](#8-支持)
32
56
 
33
- ## Table of Contents
57
+ ## 1. 介绍
34
58
 
35
- - [Table of Contents](#table-of-contents)
36
- - [1. Introduction](#1-introduction)
37
- - [2. Installation](#2-installation)
38
- - [Prerequisites](#prerequisites)
39
- - [Installation via npm](#installation-via-npm)
40
- - [Installation from Source](#installation-from-source)
41
- - [3. Quick Start](#3-quick-start)
42
- - [4. Configuration](#4-configuration)
43
- - [Initial Setup](#initial-setup)
44
- - [Configuration Commands](#configuration-commands)
45
- - [Configuration File Structure](#configuration-file-structure)
46
- - [Directory Structure](#directory-structure)
47
- - [5. Usage](#5-usage)
48
- - [Interactive Mode](#interactive-mode)
49
- - [Direct Command Mode](#direct-command-mode)
50
- - [Usage Examples](#usage-examples)
51
- - [6. Extension Development](#6-extension-development)
52
- - [Creating an Extension](#creating-an-extension)
53
- - [Registering Extensions](#registering-extensions)
54
- - [7. Recommendations](#7-recommendations)
55
- - [AI Service Selection](#ai-service-selection)
56
- - [8. Usage Notes](#8-usage-notes)
57
- - [Using Relative Paths](#using-relative-paths)
58
- - [Conversation History](#conversation-history)
59
- - [9. Troubleshooting](#9-troubleshooting)
60
- - [Configuration Issues](#configuration-issues)
61
- - [AI Service Connection](#ai-service-connection)
62
- - [Extension Not Loading](#extension-not-loading)
63
- - [10. Contributing](#10-contributing)
64
- - [11. License](#11-license)
65
- - [12. Support](#12-support)
59
+ 一款高效便捷的AI驱动命令行工具,致力于打破自然语言与操作系统指令、文件操作指令之间的壁垒,让非专业开发者也能通过简单的自然语言描述,快速生成可直接执行的操作指令,大幅提升终端操作效率。
60
+ 核心特性:
66
61
 
62
+ - 多模型兼容:无缝支持DeepSeek、Ollama,以及所有遵循OpenAI API规范的AI模型,可根据需求灵活切换,适配不同场景下的指令生成需求。
67
63
 
64
+ - 自然语言转指令:精准解析自然语言需求,自动转换为对应的操作系统命令(如Linux、Windows、macOS终端指令)和文件操作指令(如创建、删除、修改文件/目录),无需手动编写复杂命令。
68
65
 
69
- ## 1. Introduction
66
+ - **Skill 扩展**:Skill 是 AI 的工作流知识包,通过 Markdown 文件定义特定领域的操作流程和最佳实践。安装 Skill 后,AI 能自动遵循其中的规范来执行任务,例如代码审查流程、文档生成模板等。支持兼容 OpenClaw 的 Skill 生态,可通过 `ai skills` 命令进行安装、启用与管理。
70
67
 
71
- An efficient and convenient AI-driven command-line tool designed to break down the barrier between natural language and operating system commands or file operation instructions. It enables non-professional developers to quickly generate directly executable operation instructions through simple natural language descriptions, significantly improving terminal operation efficiency.
72
- Core Features:
68
+ - **Tool 扩展**:Tool AI 可调用的自定义函数工具,通过 TypeScript 文件定义。你可以编写 Tool 来扩展 AI 的能力边界,例如调用第三方 API、操作数据库、处理特定文件格式等。支持通过 `ai tools generate` 命令让 AI 自动生成 Tool,降低开发门槛。
73
69
 
74
- - Multi-model Compatibility: Seamlessly supports DeepSeek, Ollama, and all AI models that comply with the OpenAI API specification. It can be flexibly switched according to needs to adapt to instruction generation requirements in different scenarios.
70
+ - **MCP 扩展**:MCP(Model Context Protocol)是一种标准化的模型上下文协议,允许 AI 连接外部工具和数据源。通过配置 MCP Server,AI 可以获得浏览器自动化、数据库查询、文件系统访问等能力。DeepFish 内置 MCP 支持,只需简单配置即可接入各类 MCP 服务。
75
71
 
76
- - OpenClaw Skill Compatibility: Supports the OpenClaw Skill ecosystem. Skills can be installed, enabled, and managed through the existing Skill commands to quickly expand workflow capabilities.
72
+ - 高度可扩展:支持通过扩展机制拓展功能边界,除基础的终端、文件操作外,可轻松实现翻译、小说创作、文件格式转换、数据处理等复杂任务,满足多样化使用需求。
77
73
 
78
- - Natural Language to Instructions: Precisely parses natural language requirements and automatically converts them into corresponding operating system commands (such as Linux, Windows, and macOS terminal commands) and file operation instructions (such as creating, deleting, and modifying files/directories), eliminating the need to manually write complex commands.
79
74
 
80
- - Highly Extensible: Supports expanding functional boundaries through an extension mechanism. In addition to basic terminal and file operations, it can easily implement complex tasks such as translation, novel writing, file format conversion, and data processing to meet diverse usage needs.
75
+ ## 2. 安装
81
76
 
82
- - AI Automatic Extension Generation: There is no need to manually develop complex extension tools. Custom extensions can be directly generated through AI, reducing the threshold for extension development and making function expansion more efficient and flexible.[Extensions-Example](https://github.com/qq306863030/deepfish-extensions)
77
+ ### 前置要求
83
78
 
84
- Suitable for various groups such as developers, operation and maintenance personnel, and daily terminal users. Whether it is quickly executing terminal operations, batch processing files, or realizing personalized needs through extensions, this tool can simplify the operation process, improve work efficiency, and empower every terminal operation with AI.
79
+ - Node.js(v22.14.0或更高版本)
80
+ - npm或yarn
85
81
 
86
-
87
- ## 2. Installation
88
-
89
- ### Prerequisites
90
-
91
- - Node.js (v22.14.0 or higher)
92
- - npm or yarn
93
-
94
- ### Installation via npm
82
+ ### 通过npm安装
95
83
 
96
84
  ```bash
97
85
  npm install -g deepfish-ai
98
86
  ```
99
87
 
100
- ### Installation from Source
88
+ ### 从源码安装
101
89
 
102
90
  ```bash
103
91
  git clone https://github.com/qq306863030/deepfish-ai.git
@@ -106,359 +94,129 @@ npm install
106
94
  npm link
107
95
  ```
108
96
 
109
- ## 3. Quick Start
97
+ ## 3. 快速使用
110
98
 
111
99
  ```bash
112
- ai config add # Enter a name, then select deepseek, and enter your DeepSeek API key
113
- ai config use [the_name_you_entered]
114
- ai "Help me write an article about future technology in the current directory, output in markdown format"
100
+ ai models add # 输入名称, 输入你的模型配置
101
+ ai config use 你输入的名称
102
+ ai ”帮我在当前目录写一篇关于未来科技的文章,用markdown格式输出“
115
103
  ```
116
104
 
117
- ## 4. Configuration
118
-
119
- ### Initial Setup
105
+ ## 4. 命令说明
120
106
 
121
- Run the configuration wizard to set up your AI service:
107
+ ### 基础对话
122
108
 
123
109
  ```bash
124
- ai config add
110
+ ai "你的问题或指令"
125
111
  ```
126
112
 
127
- This will prompt you to configure the following:
113
+ 直接输入自然语言,AI 将自动解析并执行对应操作。
128
114
 
129
- - **AI Service Type**: Choose DeepSeek, MiniMax, Qwen, Ollama, or OpenAI
130
- - **API Base URL**: Default URL provided for each service
131
- - **Model Name**: Choose the AI model to use
132
- - **API Key**: Required for DeepSeek and OpenAI
133
- - **Temperature**: Controls response randomness (0-2)
134
- - **Max Tokens**: Maximum response length
135
- - **Streaming Output**: Enable/disable streaming response
115
+ ### 配置管理
136
116
 
137
- ### Configuration Commands
117
+ | 命令 | 说明 |
118
+ |------|------|
119
+ | `ai config edit` | 编辑配置文件 |
120
+ | `ai config view` | 查看当前配置 |
121
+ | `ai config reset` | 重置配置 |
122
+ | `ai config dir` | 查看配置目录 |
138
123
 
139
- ```bash
140
- # Configuration commands
141
- ai config add # Add a new AI configuration
142
- ai config ls # List all AI configurations
143
- ai config use <name> # Set the specified AI configuration as the current one
144
- ai config del <name> # Delete the specified AI configuration
145
- ai config view [name] # View details of the specified AI configuration
146
- ai config edit # Edit the configuration file manually
147
- ai config dir # Open the configuration file directory
148
- ai config reset # Reset configuration
149
-
150
- # Skill commands
151
- ai skill ls # List all registered skills
152
- ai skill add <name> # Add a local skill directory or zip file from the current directory
153
- ai skill del <name|index> # Remove a skill by name or index, exp: ai skill del 1
154
- ai skill install <url> # Install a skill from ClawHub,exp: ai skill install https://clawhub.ai/TheSethRose/agent-browser
155
- ai skill enable <name|index> # Enable a skill by name or index, exp: ai skill enable 1
156
- ai skill disable <name|index> # Disable a skill by name or index, exp: ai skill disable 1
157
- ai skill dir # Open the skill directory
158
-
159
- # Memory commands
160
- ai memory clear # Clear the history messages for the current directory
161
- ai memory dir # Open the memory directory
162
- ```
124
+ ### 模型管理
163
125
 
164
- ### Configuration File Structure
165
-
166
- The configuration file (`~/.deepfish-ai/config.js`) has the following structure:
167
-
168
- ```javascript
169
- export default {
170
- ai: [
171
- {
172
- name: "default", // AI configuration name
173
- type: "deepseek", // AI service type: "ollama", "deepseek", or "openai"
174
- baseUrl: "https://api.deepseek.com", // API base URL
175
- model: "deepseek-reasoner", // AI model name
176
- apiKey: "", // API key (required for DeepSeek and OpenAI)
177
- temperature: 0.7, // Response randomness (0-2)
178
- maxTokens: 8, // Maximum response length (KB)
179
- maxContextLength: 64, // Maximum context length (KB)
180
- stream: true, // Enable/disable streaming output
181
- }
182
- ],
183
- currentAi: "default", // Name of the currently active AI configuration
184
- maxIterations: -1, // Maximum iterations for AI to complete the workflow, -1 for unlimited
185
- maxMemoryExpireTime: 30, // Maximum session expiration time in days, -1 for unlimited, 0 to disable recording
186
- maxLogExpireTime: 3, // Log expiration time in days, -1 for unlimited, 0 to disable recording
187
- maxBlockFileSize: 20, // Maximum block file size in KB; files exceeding this size need to be processed in blocks
188
- isThinkPrint: true, // Whether to print the thinking process
189
- encoding: "auto", // Command line encoding format, can be set to utf-8, gbk, etc., or auto/empty for auto-detection
190
- EMBEDDING_API: "", // Embedding API endpoint URL
191
- EMBEDDING_API_KEY: "", // Embedding API key
192
- };
193
- ```
126
+ | 命令 | 说明 |
127
+ |------|------|
128
+ | `ai models add` | 添加新模型 |
129
+ | `ai models ls` | 列出所有模型 |
130
+ | `ai models use <name>` | 切换使用的模型 |
131
+ | `ai models del <name>` | 删除指定模型 |
194
132
 
195
- ### Directory Structure
133
+ ### Skill 管理
196
134
 
197
- DeepFish uses `.deepfish-ai` as the default working directory. You can open it directly with:
198
-
199
- ```bash
200
- ai config dir
201
- ```
135
+ | 命令 | 说明 |
136
+ |------|------|
137
+ | `ai skills ls` | 列出所有 Skill |
138
+ | `ai skills add <name>` | 添加 Skill |
139
+ | `ai skills del <index>` | 删除指定 Skill |
140
+ | `ai skills enable <name\|index>` | 启用 Skill |
141
+ | `ai skills disable <name\|index>` | 禁用 Skill |
142
+ | `ai skills dir` | 查看 Skill 目录 |
143
+ | `ai skills generate xxx` | 通过 AI 生成 Skill |
202
144
 
203
- Default paths:
204
-
205
- - Windows: `C:/Users/<username>/.deepfish-ai`
206
- - macOS/Linux: `~/.deepfish-ai`
207
-
208
- Based on the structure in DevPlan, the directory layout is:
209
-
210
- ```text
211
- .deepfish-ai/
212
- ├─ config.js # Global configuration
213
- ├─ user-info/
214
- │ └─ user.md # User profile data
215
- ├─ clawSkills/
216
- │ ├─ clawSkills.json # OpenClaw skill index
217
- │ └─ <skill>/
218
- │ └─ SKILL.md # Single skill definition
219
- └─ memery/
220
- ├─ agentRecord.json # Workspace to main-agent mapping
221
- └─ <main-agent-id>/
222
- ├─ memery.json # Main agent memory
223
- ├─ memery-<sub-agent-id>.json # Sub-agent memory
224
- ├─ agentTree.json # Agent hierarchy
225
- ├─ bakup/
226
- │ └─ <timestamp>/
227
- │ ├─ record.json # Backup operation record
228
- │ └─ <uuid>.* # Backup files
229
- └─ logs/
230
- └─ log-{YYYY-MM-DD HH}.txt # Hourly rolling logs
231
- ```
145
+ ### 工具管理
232
146
 
233
- ## 5. Usage
147
+ | 命令 | 说明 |
148
+ |------|------|
149
+ | `ai tools dir` | 查看工具目录 |
150
+ | `ai tools generate xxx` | 通过 AI 生成工具 |
234
151
 
235
- ### Interactive Mode
152
+ ### 会话管理
236
153
 
237
- Start an interactive session (multi-turn dialogue):
154
+ | 命令 | 说明 |
155
+ |------|------|
156
+ | `ai session clear` | 清除会话历史 |
157
+ | `ai session dir` | 查看会话目录 |
238
158
 
239
- ```bash
240
- ai
241
- ```
159
+ ### 任务管理
242
160
 
243
- Or explicitly specify:
161
+ | 命令 | 说明 |
162
+ |------|------|
163
+ | `ai task ls` | 列出所有任务 |
164
+ | `ai task add <task>` | 添加任务 |
165
+ | `ai task del <index>` | 删除指定任务 |
166
+ | `ai task clear` | 清除所有任务 |
244
167
 
245
- ```bash
246
- ai -i or ai -interactive
247
- ```
168
+ ### MCP 管理
248
169
 
249
- ### Direct Command Mode
170
+ | 命令 | 说明 |
171
+ |------|------|
172
+ | `ai mcp edit` | 编辑 MCP 配置 |
250
173
 
251
- Execute a single command:
174
+ ### 服务管理
252
175
 
253
- ```bash
254
- ai "Create a file named hello.txt with the content 'Hello World'"
255
- ```
176
+ | 命令 | 说明 |
177
+ |------|------|
178
+ | `ai serve` | 启动服务 |
179
+ | `ai serve start` | 启动服务 |
180
+ | `ai serve stop` | 停止服务 |
181
+ | `ai serve restart` | 重启服务 |
256
182
 
257
- ### Usage Examples
183
+ ### 缓存管理(AI自我学习的缓存)
258
184
 
259
- **File Operations:**
185
+ | 命令 | 说明 |
186
+ |------|------|
187
+ | `ai cache ls` | 列出缓存 |
188
+ | `ai cache edit <index\|id>` | 编辑缓存项 |
189
+ | `ai cache del <index\|id>` | 删除缓存项 |
260
190
 
261
- ```bash
262
- ai "Create 10 text documents, each with 100 random characters"
263
- ai "Clear the current directory"
264
- ```
191
+ ## 5. MCP 扩展配置
265
192
 
266
- **Code Generation:**
193
+ MCP(Model Context Protocol)允许 AI 连接外部工具和服务。通过 `ai mcp edit` 命令编辑 MCP 配置文件,添加你需要的 MCP Server。
267
194
 
268
- ```bash
269
- ai "Create a simple Express server with a /hello endpoint"
270
- ai "Create a browser-based airplane shooting game"
271
- ```
272
-
273
- **System Commands:**
274
-
275
- ```bash
276
- ai "List all files in the current directory with their sizes"
277
- ai "Check disk usage for the current directory"
278
- ```
279
-
280
- **Extension Tool Generation:**
281
-
282
- ```bash
283
- ai "Create a weather.js extension tool for querying weather"
284
- ```
285
-
286
- **Skill Management:**
287
-
288
- ```bash
289
- ai skill install https://clawhub.ai/TheSethRose/agent-browser
290
- ai skill install https://clawhub.ai/steipete/weather
291
- ai skill ls
292
- ai skill enable 1
293
- ai skill disable 0
294
- ```
295
-
296
- **OpenClaw Skill Generation:**
297
-
298
- ```bash
299
- ai "Create a weather query skill"
300
- ai skill add weather-query
301
- ai skill enable weather-query
302
- ```
303
-
304
- **Media Processing:**
305
-
306
- ```bash
307
- ai "I have ffmpeg5 installed on my system, help me convert all MP4 files in the directory to AVI format"
308
- ```
195
+ ### 配置示例
309
196
 
310
- **File Organization:**
197
+ 以下示例配置了 Chrome DevTools MCP Server,使 AI 能够操控浏览器进行自动化操作:
311
198
 
312
- ```bash
313
- ai "Classify all files under the 'model' directory into the 'model2' directory by month, date format YYYY-MM"
314
- ```
315
-
316
- **Task List Execution:**
317
-
318
- ```bash
319
- ai "Create a task list: 1.xxxx; 2.xxxx; ..."
320
- ai "Execute task list" # Start execution
321
-
322
- ai "I want to implement an extension tool for long-form novel writing that supports large-scale writing, maintains contextual logic coherence, and avoids AI context explosion issues. This extension tool may be a bit complex to implement. You need to carefully read the extension tool generation rules first, then create a task list"
323
- ai "Execute task list" # Start execution
324
- ```
325
-
326
- ## 6. Extension Development
327
-
328
- Extensions allow you to add custom functions that AI can use in its workflows. For complex processes, you can develop them yourself or try generating extensions using this program, then register the extension with the program and use the command line to complete tasks.
329
-
330
- ### Creating an Extension
331
-
332
- 1. Extensions should export an object containing `descriptions` (an array of tool descriptions) and `functions` (an object of functions).
333
- 2. Tip: You can generate extensions via AI, e.g., `ai "Create a weather.js extension tool for querying weather"`
334
- 3. View [example extensions](https://github.com/qq306863030/deepfish-extensions).
335
-
336
- ```javascript
337
- // Example extension: Weather Extension
338
- const axios = require('axios');
339
-
340
- const descriptions = [
341
- {
342
- type: 'function',
343
- function: {
344
- name: 'getWeather',
345
- description: 'Get current weather information for a city',
346
- parameters: {
347
- type: 'object',
348
- properties: {
349
- city: { type: 'string' }
350
- },
351
- required: ['city']
352
- }
199
+ ```json
200
+ {
201
+ "mcpServers": {
202
+ "chrome-devtools": {
203
+ "command": "npx",
204
+ "args": ["-y", "chrome-devtools-mcp@latest"]
353
205
  }
354
206
  }
355
- ];
356
-
357
- const functions = {
358
- async getWeather(city) {
359
- // Implement weather API call
360
- const response = await axios.get(`https://api.weatherapi.com/v1/current.json?key=YOUR_KEY&q=${city}`);
361
- return `${city} weather: ${response.data.current.temp_c}°C, ${response.data.current.condition.text}`;
362
- }
363
- };
364
-
365
- module.exports = {
366
- descriptions,
367
- functions
368
- };
369
- ```
370
-
371
- ### Registering Extensions
372
-
373
- **Method 1: Manual Configuration**
374
-
375
- 1. ai config edit
376
- 2. Add it to your configuration:
377
-
378
- ```javascript
379
- export default {
380
- // ... other configurations
381
- extensions: [
382
- '/path/to/weather-extension.js'
383
- ],
384
- };
385
- ```
386
-
387
- **Method 2: Automatic Scanning**
388
-
389
- Rules for automatic scanning of extension modules upon program startup:
390
-
391
- 1. Scanning locations:
392
- - the DeepFish installation directory (where `deepfish-ai` is located)
393
- - `node_modules` under the current working directory
394
- - the current working directory itself
395
-
396
- 2. Scanned files:
397
- - scoped packages under `@deepfish-ai/*` in the locations above
398
- - packages starting with `deepfish-` in the locations above (excluding `deepfish-ai` itself)
399
- - top-level `.js` / `.mjs` files in the current working directory are scanned additionally; files containing `module.exports`, `descriptions`, and `functions` are treated as auto-loadable extensions
400
-
401
- ## 7. Recommendations
402
-
403
- ### AI Service Selection
404
-
405
- **Recommendation: Use online AI services (DeepSeek/OpenAI) for best results**
406
-
407
- While local AI services (like Ollama) offer privacy and offline capabilities, they may have the following limitations:
408
-
409
- - **Response Accuracy**: Local models may not be as rigorous and precise as online models
410
- - **Code Quality**: Generated code may require more manual review and correction
411
- - **Complex Task Handling**: May encounter difficulties with multi-step or complex operations
412
- - **Language Understanding**: Online services provide better language models
413
-
414
- For production environments or complex tasks, we recommend using DeepSeek, OpenAI services, or cloud services within Ollama for more reliable and accurate results.
415
-
416
- ## 8. Usage Notes
417
-
418
- ### Using Relative Paths
419
-
420
- AI always uses paths relative to the current working directory.
421
-
422
- ### Conversation History
423
-
424
- Conversation history is created on a per-directory basis — each execution directory corresponds to its own Agent context. This means that conversations started in different directories are independent of each other.
425
-
426
- > **⚠️ Important Note:** AI context is directory-based — each directory corresponds to one context. **Please do not open two command-line dialogs in the same directory**, as this may cause context conflicts and unexpected behavior.
427
-
428
- Conversation history will be automatically cleared after a configurable period (controlled by the `maxMemoryExpireTime` field in the configuration file, default is 30 days). You can also manage it manually:
429
-
430
- - `ai memory dir` — Open the memory directory to view stored conversation contexts
431
- - `ai memory clear` — Manually clear the conversation history for the current directory
432
-
433
- ## 9. Troubleshooting
434
-
435
- ### Configuration Issues
436
-
437
- If you encounter configuration errors, try resetting:
438
-
439
- ```bash
440
- ai config reset
207
+ }
441
208
  ```
442
209
 
443
- ### AI Service Connection
444
-
445
- - **Ollama**: Ensure Ollama is running locally on port 11434
446
- - **DeepSeek/MiniMax/Qwen/OpenAI**: Verify your API key is correct and you have sufficient quota
447
-
448
- ### Extension Not Loading
449
-
450
- - Check the file path in the configuration
451
- - Ensure the file exports the correct object
452
- - Verify the file has no syntax errors
210
+ 配置完成后,AI 将自动加载 MCP Server 提供的工具,你可以在对话中直接让 AI 使用这些能力。
453
211
 
454
- ## 10. Contributing
212
+ ## 6. 贡献
455
213
 
456
- Contributions are welcome! Please feel free to submit a Pull Request.
214
+ 欢迎贡献!请随时提交Pull Request
457
215
 
458
- ## 11. License
216
+ ## 7. 许可证
459
217
 
460
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
218
+ 本项目采用MIT许可证 - 详见[LICENSE](LICENSE)文件。
461
219
 
462
- ## 12. Support
220
+ ## 8. 支持
463
221
 
464
- For issues and questions, please submit an issue on the GitHub repository.
222
+ 如有问题和疑问,请在GitHub仓库上提交issue