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
package/requirements-crypto.txt
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
#
|
|
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
|
-
|
|
10
|
+
# HTTP 请求
|
|
11
|
+
requests>=2.31.0 # HTTP 客户端
|
|
12
|
+
httpx>=0.27.0 # 异步 HTTP 客户端
|
|
9
13
|
|
|
10
|
-
#
|
|
11
|
-
|
|
14
|
+
# JS 执行
|
|
15
|
+
PyExecJS>=1.5.1 # 执行 JS 代码
|
|
12
16
|
|
|
13
|
-
#
|
|
14
|
-
|
|
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. 使用 \`
|
|
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. 已使用 \`
|
|
91
|
+
1. 已使用 \`run_python_code\` 或 \`verify_with_python\` 验证代码能正确运行
|
|
92
92
|
2. 验证结果与预期一致
|
|
93
93
|
3. 已用 \`artifact_save\` 保存代码文件
|
|
94
94
|
|
package/src/agent/setup.js
CHANGED
|
@@ -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 ||
|
|
472
|
+
const result = await executePython(code, timeout || 30000);
|
|
473
473
|
return JSON.stringify(result);
|
|
474
474
|
},
|
|
475
475
|
{
|
|
476
|
-
name: '
|
|
477
|
-
description: '
|
|
476
|
+
name: 'run_python_code',
|
|
477
|
+
description: '执行 Python 代码。可用于加密验证、HTTP 请求、数据处理等任务。环境已预装 pycryptodome、requests 等常用库。',
|
|
478
478
|
schema: z.object({
|
|
479
|
-
code: z.string().describe('
|
|
480
|
-
timeout: z.number().optional().default(
|
|
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) {
|