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
@@ -0,0 +1,224 @@
1
+ import { createComponent, escape, renderToString, ssr, ssrAttribute, ssrHydrationKey } from "solid-js/web";
2
+ import { For, Show, createSignal, onCleanup, onMount } from "solid-js";
3
+ //#region src/serve/service/agent-room/web-client.ts
4
+ var AgentRoomWebClient = class {
5
+ url;
6
+ id = null;
7
+ ws = null;
8
+ opts;
9
+ reconnectTimer = null;
10
+ reconnecting = false;
11
+ constructor(opts) {
12
+ this.opts = opts;
13
+ this.url = opts.url || `ws://localhost:8866/agent-room`;
14
+ this.id = opts.id ?? null;
15
+ this.connect();
16
+ }
17
+ /** 连接到服务端 */
18
+ connect() {
19
+ if (this.ws) return;
20
+ this.ws = new WebSocket(this.url);
21
+ this.ws.onopen = () => {
22
+ const register = {
23
+ type: "register",
24
+ clientType: "web"
25
+ };
26
+ if (this.id) register["id"] = this.id;
27
+ this.ws.send(JSON.stringify(register));
28
+ };
29
+ this.ws.onmessage = (e) => {
30
+ const msg = JSON.parse(e.data);
31
+ if (msg.type === "registered") {
32
+ this.id = msg.id;
33
+ this.opts.onReady?.(this);
34
+ return;
35
+ }
36
+ if (msg.type === "sessions-push") {
37
+ const payload = msg.payload ?? [];
38
+ this.opts.onSessionsPush?.(this, payload);
39
+ return;
40
+ }
41
+ if (msg.type === "error") {
42
+ this.opts.onError?.(this, msg.code || "", msg.message || "");
43
+ return;
44
+ }
45
+ this.opts.onMessage?.(this, msg);
46
+ };
47
+ this.ws.onclose = (e) => {
48
+ this.opts.onClose?.(this, e.code, e.reason);
49
+ this.ws = null;
50
+ this.tryReconnect();
51
+ };
52
+ this.ws.onerror = () => {};
53
+ }
54
+ /** 发送消息 */
55
+ send(type, payload, to) {
56
+ if (!this.ws || this.ws.readyState !== WebSocket.OPEN) return;
57
+ this.ws.send(JSON.stringify({
58
+ type,
59
+ payload,
60
+ to
61
+ }));
62
+ }
63
+ /** 回复消息(自动填充 to 为消息来源) */
64
+ reply(msg, payload) {
65
+ if (!msg.from) return;
66
+ this.send(msg.type + "-result", payload, msg.from);
67
+ }
68
+ /** 断开连接,不重连 */
69
+ disconnect() {
70
+ this.clearReconnect();
71
+ this.reconnecting = false;
72
+ if (this.ws) {
73
+ this.ws.close(1e3, "client disconnect");
74
+ this.ws = null;
75
+ }
76
+ }
77
+ /** 是否已连接 */
78
+ get connected() {
79
+ return this.ws?.readyState === WebSocket.OPEN;
80
+ }
81
+ clearReconnect() {
82
+ if (this.reconnectTimer) {
83
+ clearTimeout(this.reconnectTimer);
84
+ this.reconnectTimer = null;
85
+ }
86
+ }
87
+ tryReconnect() {
88
+ const interval = this.opts.reconnectInterval ?? 3e3;
89
+ if (interval <= 0 || this.reconnecting) return;
90
+ this.reconnecting = true;
91
+ this.reconnectTimer = setTimeout(() => {
92
+ this.reconnecting = false;
93
+ this.connect();
94
+ }, interval);
95
+ }
96
+ };
97
+ //#endregion
98
+ //#region src/serve/ui/App.tsx
99
+ var _tmpl$ = [
100
+ "<div",
101
+ " class=\"table-wrap\"><table class=\"sessions\"><thead><tr><th>ID</th><th>Name</th><th>Workspace</th><th>Status</th><th>Created</th><th>Updated</th><th class=\"th-actions\">Actions</th></tr></thead><tbody>",
102
+ "</tbody></table></div>"
103
+ ], _tmpl$2 = [
104
+ "<div",
105
+ " class=\"modal-backdrop\"><div class=\"modal\" role=\"dialog\" aria-modal=\"true\" aria-label=\"确认删除\"><div class=\"modal-body\">",
106
+ "</div><div class=\"modal-actions\"><button type=\"button\" class=\"btn btn-cancel\">取消</button><button type=\"button\" class=\"btn btn-confirm\"",
107
+ ">",
108
+ "</button></div></div></div>"
109
+ ], _tmpl$3 = [
110
+ "<div",
111
+ " class=\"app-shell\"><header class=\"app-header\"><div><h1 class=\"app-title\">DeepFish Sessions</h1><p class=\"app-subtitle\">// agent-room · realtime</p></div><div class=\"status-pill\"",
112
+ "><span class=\"",
113
+ "\"></span><!--$-->",
114
+ "<!--/--></div></header><section class=\"panel\"><div class=\"panel-header\"><h2 class=\"panel-title\">Active Sessions<span class=\"badge\">",
115
+ "</span></h2></div><!--$-->",
116
+ "<!--/--></section><!--$-->",
117
+ "<!--/--></div>"
118
+ ], _tmpl$4 = [
119
+ "<div",
120
+ " class=\"empty-state\"><div class=\"icon\">◇</div><div>",
121
+ "</div></div>"
122
+ ], _tmpl$5 = [
123
+ "<tr",
124
+ "><td class=\"cell-mono\">",
125
+ "</td><td class=\"cell-name\">",
126
+ "</td><td class=\"cell-mono\">",
127
+ "</td><td><span class=\"",
128
+ "\">",
129
+ "</span></td><td class=\"cell-time\">",
130
+ "</td><td class=\"cell-time\">",
131
+ "</td><td class=\"cell-actions\"><button type=\"button\" class=\"btn-delete\"",
132
+ ">",
133
+ "</button></td></tr>"
134
+ ];
135
+ var STATUS_LABEL = {
136
+ 0: "Idle",
137
+ 1: "Working"
138
+ };
139
+ var STATUS_DOT_CLASS = {
140
+ connecting: "is-connecting",
141
+ connected: "is-connected",
142
+ disconnected: "is-disconnected",
143
+ error: "is-error",
144
+ ssr: "is-disconnected"
145
+ };
146
+ var STATUS_PILL_TEXT = {
147
+ ssr: "LOADING",
148
+ connecting: "CONNECTING",
149
+ connected: "CONNECTED",
150
+ disconnected: "DISCONNECTED",
151
+ error: "ERROR"
152
+ };
153
+ /** 把 ISO 时间格式化为本地字符串(兼容 invalid)。 */
154
+ function formatTime(value) {
155
+ if (!value) return "-";
156
+ const d = new Date(value);
157
+ if (Number.isNaN(d.getTime())) return value;
158
+ return d.toLocaleString();
159
+ }
160
+ function App() {
161
+ const [sessions, setSessions] = createSignal([]);
162
+ const [status, setStatus] = createSignal("ssr");
163
+ const [errorMsg, setErrorMsg] = createSignal("");
164
+ const [deletingId, setDeletingId] = createSignal("");
165
+ const [confirmingId, setConfirmingId] = createSignal("");
166
+ const [showConfirm, setShowConfirm] = createSignal(false);
167
+ const [confirmMessage, setConfirmMessage] = createSignal("");
168
+ let client = null;
169
+ onMount(() => {
170
+ if (typeof window === "undefined") return;
171
+ setStatus("connecting");
172
+ client = new AgentRoomWebClient({
173
+ url: `ws://${window.location.host}/agent-room`,
174
+ onReady: () => {
175
+ setStatus("connected");
176
+ setErrorMsg("");
177
+ },
178
+ onSessionsPush: (_c, list) => {
179
+ setSessions(list ?? []);
180
+ setDeletingId("");
181
+ },
182
+ onError: (_c, _code, message) => {
183
+ setStatus("error");
184
+ setErrorMsg(message);
185
+ setDeletingId("");
186
+ },
187
+ onClose: () => {
188
+ setStatus("disconnected");
189
+ setDeletingId("");
190
+ }
191
+ });
192
+ });
193
+ onCleanup(() => client?.disconnect());
194
+ return ssr(_tmpl$3, ssrHydrationKey(), ssrAttribute("title", escape(errorMsg(), true), false), `status-dot ${escape(STATUS_DOT_CLASS[status()], true)}`, escape(STATUS_PILL_TEXT[status()]), escape(sessions().length), escape(createComponent(Show, {
195
+ get when() {
196
+ return sessions().length > 0;
197
+ },
198
+ get fallback() {
199
+ return ssr(_tmpl$4, ssrHydrationKey(), status() === "connected" ? "No active sessions" : status() === "ssr" ? "Hydrating…" : "Waiting for data…");
200
+ },
201
+ get children() {
202
+ return ssr(_tmpl$, ssrHydrationKey(), escape(createComponent(For, {
203
+ get each() {
204
+ return sessions();
205
+ },
206
+ children: (s) => ssr(_tmpl$5, ssrHydrationKey(), escape(s.id), escape(s.name), escape(s.workspace), `status-tag ${s.status === 1 ? "is-online" : "is-offline"}`, escape(STATUS_LABEL[s.status ?? 0]), escape(formatTime(s.createdAt)), escape(formatTime(s.updatedAt)), ssrAttribute("disabled", deletingId() === s.id, true), deletingId() === s.id ? "Deleting..." : "Delete")
207
+ })));
208
+ }
209
+ })), escape(createComponent(Show, {
210
+ get when() {
211
+ return showConfirm();
212
+ },
213
+ get children() {
214
+ return ssr(_tmpl$2, ssrHydrationKey(), escape(confirmMessage()), ssrAttribute("disabled", deletingId() === confirmingId(), true), deletingId() === confirmingId() ? "Deleting..." : "确认删除");
215
+ }
216
+ })));
217
+ }
218
+ //#endregion
219
+ //#region src/serve/ui/entry-server.tsx
220
+ function render() {
221
+ return { html: renderToString(() => createComponent(App, {})) };
222
+ }
223
+ //#endregion
224
+ export { render };
package/package.json CHANGED
@@ -1,83 +1,61 @@
1
- {
2
- "name": "deepfish-ai",
3
- "version": "1.0.29",
4
- "description": "This is an AI-driven command-line tool built on Node.js, equipped with AI agent and workflow capabilities. It is compatible with a wide range of AI models, can convert natural language into cross-system terminal and file operation commands, and features high extensibility. It supports complex tasks such as translation, content creation, and format conversion, while allowing custom extensions to be automatically generated via AI.",
5
- "main": "src/index.js",
6
- "type": "commonjs",
7
- "bin": {
8
- "ai": "src/cli/index.js"
9
- },
10
- "scripts": {
11
- "test": "echo \"Error: no test specified\" && exit 1",
12
- "build": "package-offline.bat"
13
- },
14
- "keywords": [
15
- "ai",
16
- "deepseek",
17
- "agent",
18
- "assistant",
19
- "cli",
20
- "command-line",
21
- "cmd",
22
- "openclaw",
23
- "openai",
24
- "ollama",
25
- "deepfish"
26
- ],
27
- "author": "Roman",
28
- "license": "MIT",
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/qq306863030/deepfish-ai.git"
32
- },
33
- "bugs": {
34
- "url": "https://github.com/qq306863030/deepfish-ai/issues"
35
- },
36
- "homepage": "https://github.com/qq306863030/deepfish-ai#readme",
37
- "dependencies": {
38
- "@ast-grep/cli": "^0.37.0",
39
- "adm-zip": "^0.5.16",
40
- "axios": "^1.13.5",
41
- "canvas": "^3.2.3",
42
- "chalk": "^4.1.0",
43
- "chardet": "^2.1.1",
44
- "cheerio": "^1.2.0",
45
- "commander": "^11.0.0",
46
- "dayjs": "^1.11.19",
47
- "deepfish-ai": "file:",
48
- "docx": "^9.6.1",
49
- "docxtemplater": "^3.68.4",
50
- "echarts": "^6.0.0",
51
- "eventemitter-super": "^1.0.8",
52
- "extract-zip": "^2.0.1",
53
- "fs-extra": "^11.3.3",
54
- "iconv-lite": "^0.7.2",
55
- "inquirer": "^9.0.0",
56
- "js-yaml": "^4.1.1",
57
- "lodash": "^4.17.23",
58
- "mammoth": "^1.12.0",
59
- "openai": "^6.18.0",
60
- "pdf-lib": "^1.17.1",
61
- "pdf-parse": "^2.4.5",
62
- "pdf-to-img": "5.0.0",
63
- "pdfkit": "^0.18.0",
64
- "pizzip": "^3.2.0",
65
- "pptxgenjs": "^4.0.1",
66
- "puppeteer": "^24.41.0",
67
- "sharp": "^0.34.5",
68
- "uuid": "^13.0.0",
69
- "xlsx": "^0.18.5"
70
- },
71
- "devDependencies": {
72
- "@eslint/js": "^10.0.1",
73
- "@eslint/json": "^1.0.1",
74
- "eslint": "^10.0.3",
75
- "globals": "^17.4.0"
76
- },
77
- "files": [
78
- "src",
79
- "README.md",
80
- "README_CN.md",
81
- "LICENSE"
82
- ]
83
- }
1
+ {
2
+ "name": "deepfish-ai",
3
+ "version": "2.0.2",
4
+ "private": false,
5
+ "description": "AI Agent CLI tool with agent-room for multi-agent collaboration",
6
+ "main": "./dist/index.js",
7
+ "bin": {
8
+ "ai": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist/"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsup src/index.ts src/serve/pm2-server.ts --format cjs --out-dir dist --clean --external iconv-lite && npm run build:ui",
15
+ "build:ui": "vite build && vite build --config vite.server.config.ts",
16
+ "dev": "tsx src/cli/index.ts",
17
+ "format": "prettier --write \"src/**/*.{ts,js,json,css,md}\"",
18
+ "format:check": "prettier --check \"src/**/*.{ts,js,json,css,md}\"",
19
+ "typecheck": "tsc --noEmit",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "dependencies": {
23
+ "@langchain/anthropic": "^1.4.0",
24
+ "@langchain/core": "^1.1.48",
25
+ "@langchain/deepseek": "^1.0.27",
26
+ "@langchain/langgraph": "^1.4.1",
27
+ "@langchain/mcp-adapters": "^1.1.3",
28
+ "@langchain/openai": "^1.4.7",
29
+ "@langchain/tavily": "^1.2.0",
30
+ "adm-zip": "^0.5.17",
31
+ "axios": "^1.17.0",
32
+ "chalk": "^5.6.2",
33
+ "commander": "^11.0.0",
34
+ "dayjs": "^1.11.21",
35
+ "deepagents": "^1.10.2",
36
+ "eventemitter-super": "^1.0.9",
37
+ "express": "^5.2.1",
38
+ "fs-extra": "^11.3.5",
39
+ "inquirer": "^14.0.2",
40
+ "json5": "^2.2.3",
41
+ "langchain": "^1.4.4",
42
+ "pm2": "^7.0.1",
43
+ "solid-js": "^1.9.13",
44
+ "tsx": "^4.19.0",
45
+ "ws": "^8.21.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/adm-zip": "^0.5.8",
49
+ "@types/express": "^5.0.6",
50
+ "@types/fs-extra": "^11.0.4",
51
+ "@types/node": "^22.0.0",
52
+ "@types/ws": "^8.18.1",
53
+ "less": "^4.6.6",
54
+ "prettier": "^3.8.3",
55
+ "tsup": "^8.4.0",
56
+ "typescript": "^5.0.0",
57
+ "vite": "^8.0.16",
58
+ "vite-plugin-solid": "^2.11.12",
59
+ "vitest": "^3.0.0"
60
+ }
61
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 [Your Name]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.