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
@@ -1,204 +0,0 @@
1
- /**
2
- * @Author: Roman 306863030@qq.com
3
- * @Description: 文档格式转换工具集(Markdown / HTML / PDF 互转)
4
- * 依赖:puppeteer / fs-extra
5
- * Word 相关转换(wordToPdf / wordToHtml / wordToMarkdown / markdownToWord / htmlToWord)已集成在 DocxTool 中
6
- */
7
- const path = require('path')
8
- const fs = require('fs-extra')
9
-
10
- // ─── 统一返回结构 ─────────────────────────────────────────────────────────────
11
-
12
- function ok(data = null) {
13
- return { success: true, data }
14
- }
15
-
16
- function fail(error, data = null) {
17
- return { success: false, error: error?.message || String(error), data }
18
- }
19
-
20
- function resolvePath(filePath) {
21
- return path.resolve(process.cwd(), filePath)
22
- }
23
-
24
- // ─── 内部辅助 ─────────────────────────────────────────────────────────────────
25
-
26
- /**
27
- * 使用 puppeteer 将 HTML 字符串渲染为 PDF 文件
28
- */
29
- async function htmlStringToPdf(html, outputPath) {
30
- let puppeteer
31
- try {
32
- puppeteer = require('puppeteer')
33
- } catch {
34
- throw new Error('puppeteer 未安装,请先执行 npm install puppeteer')
35
- }
36
- const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] })
37
- try {
38
- const page = await browser.newPage()
39
- await page.setContent(html, { waitUntil: 'networkidle0' })
40
- fs.ensureDirSync(path.dirname(outputPath))
41
- await page.pdf({ path: outputPath, format: 'A4', printBackground: true })
42
- } finally {
43
- await browser.close()
44
- }
45
- }
46
-
47
- function escapeHtml(str) {
48
- return str
49
- .replace(/&/g, '&')
50
- .replace(/</g, '&lt;')
51
- .replace(/>/g, '&gt;')
52
- }
53
-
54
- /**
55
- * 将 Markdown 文本转换为 HTML 字符串(基础实现,无需额外依赖)
56
- */
57
- function markdownToHtmlString(md) {
58
- let html = md
59
- // 代码块
60
- .replace(/```(\w*)\n([\s\S]*?)```/g, (_, lang, code) =>
61
- `<pre><code class="language-${lang}">${escapeHtml(code.trimEnd())}</code></pre>`)
62
- // 行内代码
63
- .replace(/`([^`]+)`/g, (_, c) => `<code>${escapeHtml(c)}</code>`)
64
- // 标题
65
- .replace(/^###### (.+)$/gm, '<h6>$1</h6>')
66
- .replace(/^##### (.+)$/gm, '<h5>$1</h5>')
67
- .replace(/^#### (.+)$/gm, '<h4>$1</h4>')
68
- .replace(/^### (.+)$/gm, '<h3>$1</h3>')
69
- .replace(/^## (.+)$/gm, '<h2>$1</h2>')
70
- .replace(/^# (.+)$/gm, '<h1>$1</h1>')
71
- // 水平线
72
- .replace(/^[-*_]{3,}$/gm, '<hr>')
73
- // 粗斜体
74
- .replace(/\*\*\*(.+?)\*\*\*/g, '<strong><em>$1</em></strong>')
75
- // 粗体
76
- .replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
77
- .replace(/__(.+?)__/g, '<strong>$1</strong>')
78
- // 斜体
79
- .replace(/\*(.+?)\*/g, '<em>$1</em>')
80
- .replace(/_(.+?)_/g, '<em>$1</em>')
81
- // 删除线
82
- .replace(/~~(.+?)~~/g, '<del>$1</del>')
83
- // 图片
84
- .replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img alt="$1" src="$2">')
85
- // 链接
86
- .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>')
87
- // 无序列表
88
- .replace(/^[ \t]*[-*+] (.+)$/gm, '<li>$1</li>')
89
- // 有序列表
90
- .replace(/^[ \t]*\d+\. (.+)$/gm, '<li>$1</li>')
91
- // 引用
92
- .replace(/^> (.+)$/gm, '<blockquote>$1</blockquote>')
93
-
94
- // 将连续 <li> 包裹进 <ul>
95
- html = html.replace(/(<li>[\s\S]+?<\/li>)(\n(?!<li>)|$)/g, (_, items) => `<ul>${items}</ul>`)
96
-
97
- // 段落:连续非标签行
98
- html = html.replace(/^(?!<[a-z]|$)(.+)$/gm, '<p>$1</p>')
99
-
100
- return `<!DOCTYPE html><html><head><meta charset="utf-8"><style>
101
- body{font-family:sans-serif;line-height:1.7;max-width:900px;margin:40px auto;padding:0 20px;color:#333}
102
- h1,h2,h3,h4,h5,h6{margin-top:1.2em}
103
- pre{background:#f5f5f5;padding:12px;border-radius:4px;overflow:auto}
104
- code{background:#f0f0f0;padding:2px 4px;border-radius:3px}
105
- blockquote{border-left:4px solid #ddd;margin:0;padding-left:1em;color:#666}
106
- table{border-collapse:collapse;width:100%}td,th{border:1px solid #ddd;padding:6px 10px}
107
- </style></head><body>${html}</body></html>`
108
- }
109
-
110
- // ─── 工具函数 ─────────────────────────────────────────────────────────────────
111
-
112
- /**
113
- * Markdown 转 PDF
114
- */
115
- async function markdownToPdf(inputPath, outputPath) {
116
- try {
117
- const fullInput = resolvePath(inputPath)
118
- const fullOutput = resolvePath(outputPath)
119
- if (!fs.existsSync(fullInput)) {
120
- return fail(`File does not exist: ${fullInput}`, { inputPath: fullInput })
121
- }
122
- const md = fs.readFileSync(fullInput, 'utf8')
123
- const html = markdownToHtmlString(md)
124
- await htmlStringToPdf(html, fullOutput)
125
- return ok({ inputPath: fullInput, outputPath: fullOutput })
126
- } catch (error) {
127
- return fail(error, { inputPath, outputPath })
128
- }
129
- }
130
-
131
- /**
132
- * Markdown 转 HTML
133
- */
134
- async function markdownToHtml(inputPath, outputPath) {
135
- try {
136
- const fullInput = resolvePath(inputPath)
137
- const fullOutput = resolvePath(outputPath)
138
- if (!fs.existsSync(fullInput)) {
139
- return fail(`File does not exist: ${fullInput}`, { inputPath: fullInput })
140
- }
141
- const md = fs.readFileSync(fullInput, 'utf8')
142
- const html = markdownToHtmlString(md)
143
- fs.ensureDirSync(path.dirname(fullOutput))
144
- fs.writeFileSync(fullOutput, html, 'utf8')
145
- return ok({ inputPath: fullInput, outputPath: fullOutput })
146
- } catch (error) {
147
- return fail(error, { inputPath, outputPath })
148
- }
149
- }
150
-
151
- // ─── 工具描述 ─────────────────────────────────────────────────────────────────
152
-
153
- const descriptions = [
154
- {
155
- type: 'function',
156
- function: {
157
- name: 'markdownToPdf',
158
- description:
159
- '将 Markdown 文件(.md)转换为 PDF 文件。依赖 puppeteer,转换时应用默认样式。参数:inputPath 为源 .md 路径;outputPath 为输出 .pdf 路径。返回值:对象,包含 success、data(含 inputPath、outputPath)、error。',
160
- parameters: {
161
- type: 'object',
162
- properties: {
163
- inputPath: { type: 'string', description: '源 .md 文件路径。' },
164
- outputPath: { type: 'string', description: '输出 .pdf 文件路径。' },
165
- },
166
- required: ['inputPath', 'outputPath'],
167
- },
168
- },
169
- },
170
- {
171
- type: 'function',
172
- function: {
173
- name: 'markdownToHtml',
174
- description:
175
- '将 Markdown 文件(.md)转换为 HTML 文件,包含内联样式,可直接在浏览器中打开。参数:inputPath 为源 .md 路径;outputPath 为输出 .html 路径。返回值:对象,包含 success、data(含 inputPath、outputPath)、error。',
176
- parameters: {
177
- type: 'object',
178
- properties: {
179
- inputPath: { type: 'string', description: '源 .md 文件路径。' },
180
- outputPath: { type: 'string', description: '输出 .html 文件路径。' },
181
- },
182
- required: ['inputPath', 'outputPath'],
183
- },
184
- },
185
- },
186
- ]
187
-
188
- // ─── 导出 ──────────────────────────────────────────────────────────────────────
189
-
190
- const functions = {
191
- markdownToPdf,
192
- markdownToHtml,
193
- }
194
-
195
- const DocTransformTool = {
196
- name: 'DocTransformTool',
197
- description: '提供 Markdown 与 HTML/PDF 之间的格式互转能力,支持 markdown转pdf、markdown转html。Word 相关转换请使用 DocxTool。',
198
- platform: 'all',
199
- descriptions,
200
- functions,
201
- isSystem: true
202
- }
203
-
204
- module.exports = DocTransformTool