deepspider 0.2.10 → 0.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepspider",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "智能爬虫工程平台 - 基于 DeepAgents + Patchright 的 AI 爬虫 Agent",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,14 +1,20 @@
1
- # JSForge Python 加密库依赖
1
+ # DeepSpider Python 依赖
2
2
  # 安装: uv pip install -r requirements-crypto.txt
3
3
 
4
- # 通用加密库
4
+ # 加密库
5
5
  pycryptodome>=3.20.0 # AES/DES/RSA/MD5/SHA 等
6
+ gmssl>=3.2.2 # SM2/SM3/SM4 国密算法
7
+ rsa>=4.9 # RSA
8
+ pyDes>=2.0.1 # DES/3DES
6
9
 
7
- # 国密算法
8
- gmssl>=3.2.2 # SM2/SM3/SM4
10
+ # HTTP 请求
11
+ requests>=2.31.0 # HTTP 客户端
12
+ httpx>=0.27.0 # 异步 HTTP 客户端
9
13
 
10
- # RSA
11
- rsa>=4.9
14
+ # JS 执行
15
+ PyExecJS>=1.5.1 # 执行 JS 代码
12
16
 
13
- # 其他常用
14
- pyDes>=2.0.1 # DES/3DES
17
+ # 数据处理
18
+ lxml>=5.0.0 # HTML/XML 解析
19
+ beautifulsoup4>=4.12.0 # HTML 解析
20
+ parsel>=1.8.0 # XPath/CSS 选择器
@@ -59,7 +59,7 @@ export const fullAnalysisPrompt = `
59
59
 
60
60
  #### 第一层:算法验证(必须)
61
61
  验证加密/解密函数本身是否正确:
62
- 1. 使用 \`execute_python\` 执行加密/解密代码
62
+ 1. 使用 \`run_python_code\` 执行加密/解密代码
63
63
  2. 检查:encrypt(plaintext) → ciphertext → decrypt() → plaintext
64
64
 
65
65
  #### 第二层:端到端验证(必须)
@@ -88,7 +88,7 @@ export const fullAnalysisPrompt = `
88
88
  3. **必须在最终输出中告知用户文件保存路径**
89
89
 
90
90
  **调用 save_analysis_report 的前提条件**(必须全部满足):
91
- 1. 已使用 \`execute_python\` 或 \`verify_with_python\` 验证代码能正确运行
91
+ 1. 已使用 \`run_python_code\` 或 \`verify_with_python\` 验证代码能正确运行
92
92
  2. 验证结果与预期一致
93
93
  3. 已用 \`artifact_save\` 保存代码文件
94
94
 
@@ -35,7 +35,7 @@ export function ensureConfig() {
35
35
 
36
36
  配置方式(任选其一):
37
37
 
38
- 1. 环境变量(推荐):
38
+ 1. 配置环境变量(推荐):
39
39
  export DEEPSPIDER_API_KEY=sk-xxx
40
40
  export DEEPSPIDER_BASE_URL=https://api.openai.com/v1
41
41
  export DEEPSPIDER_MODEL=gpt-4o
@@ -43,9 +43,7 @@ export function ensureConfig() {
43
43
  2. 一行命令:
44
44
  DEEPSPIDER_API_KEY=sk-xxx DEEPSPIDER_BASE_URL=https://api.openai.com/v1 DEEPSPIDER_MODEL=gpt-4o deepspider <url>
45
45
 
46
- 常用供应商配置:
47
- OpenAI: BASE_URL=https://api.openai.com/v1 MODEL=gpt-4o
48
- DeepSeek: BASE_URL=https://api.deepseek.com/v1 MODEL=deepseek-chat
46
+ 请根据提示补全配置后重试。
49
47
  `);
50
48
 
51
49
  return false;
@@ -465,19 +465,19 @@ export const generatePythonCrypto = tool(
465
465
  );
466
466
 
467
467
  /**
468
- * 执行 Python 加密验证代码
468
+ * 执行 Python 代码
469
469
  */
470
470
  export const executePythonCode = tool(
471
471
  async ({ code, timeout }) => {
472
- const result = await executePython(code, timeout || 10000);
472
+ const result = await executePython(code, timeout || 30000);
473
473
  return JSON.stringify(result);
474
474
  },
475
475
  {
476
- name: 'run_python_crypto_test',
477
- description: '运行 Python 加密/解密测试代码。仅用于验证标准加密算法(AES、DES、SM4、MD5、SHA等)的 Python 实现是否正确。不要用于执行 JS 代码或调用 subprocess。',
476
+ name: 'run_python_code',
477
+ description: '执行 Python 代码。可用于加密验证、HTTP 请求、数据处理等任务。环境已预装 pycryptodome、requests 等常用库。',
478
478
  schema: z.object({
479
- code: z.string().describe('Python 加密验证代码,不要包含 subprocess 或调用外部程序'),
480
- timeout: z.number().optional().default(10000).describe('超时时间(毫秒)'),
479
+ code: z.string().describe('Python 代码'),
480
+ timeout: z.number().optional().default(30000).describe('超时时间(毫秒)'),
481
481
  }),
482
482
  }
483
483
  );
@@ -129,9 +129,8 @@ export const saveAnalysisReport = tool(
129
129
  }
130
130
  }
131
131
 
132
- // 保存 Markdown
132
+ // 保存 Markdown(先收集所有路径,最后追加文件列表)
133
133
  paths.markdown = join(domainDir, 'analysis.md');
134
- writeFileSync(paths.markdown, markdown, 'utf-8');
135
134
 
136
135
  // 保存 Python 代码
137
136
  if (finalPythonCode) {
@@ -150,6 +149,13 @@ export const saveAnalysisReport = tool(
150
149
  const html = generateHtmlPage(title || domain, markdown, finalPythonCode, finalJsCode);
151
150
  writeFileSync(paths.html, html, 'utf-8');
152
151
 
152
+ // 在 markdown 末尾自动追加生成文件列表
153
+ const fileList = Object.entries(paths)
154
+ .map(([type, p]) => `- ${type}: \`${p}\``)
155
+ .join('\n');
156
+ const finalMarkdown = markdown + '\n\n## 生成文件\n\n' + fileList;
157
+ writeFileSync(paths.markdown, finalMarkdown, 'utf-8');
158
+
153
159
  console.log('[report] 已保存:', domainDir);
154
160
  return JSON.stringify({ success: true, paths, dir: domainDir });
155
161
  } catch (e) {