deepspider 0.2.11 → 0.3.0

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 (146) hide show
  1. package/README.md +71 -24
  2. package/bin/cli.js +45 -0
  3. package/package.json +10 -4
  4. package/src/agent/core/PanelBridge.js +133 -0
  5. package/src/agent/core/RetryManager.js +51 -0
  6. package/src/agent/core/StreamHandler.js +263 -0
  7. package/src/agent/core/index.js +7 -0
  8. package/src/agent/errors/ErrorClassifier.js +43 -0
  9. package/src/agent/errors/SpiderError.js +68 -0
  10. package/src/agent/errors/index.js +19 -0
  11. package/src/agent/run.js +67 -460
  12. package/src/agent/setup.js +14 -14
  13. package/src/agent/subagents/factory.js +60 -0
  14. package/src/agent/subagents/index.js +3 -0
  15. package/src/agent/tools/report.js +36 -4
  16. package/src/browser/client.js +47 -10
  17. package/src/cli/commands/config.js +94 -0
  18. package/src/cli/commands/help.js +34 -0
  19. package/src/cli/commands/update.js +78 -0
  20. package/src/cli/commands/version.js +9 -0
  21. package/src/cli/config.js +15 -0
  22. package/src/config/settings.js +102 -0
  23. package/.claude/agents/check.md +0 -122
  24. package/.claude/agents/debug.md +0 -106
  25. package/.claude/agents/dispatch.md +0 -214
  26. package/.claude/agents/implement.md +0 -96
  27. package/.claude/agents/plan.md +0 -396
  28. package/.claude/agents/research.md +0 -120
  29. package/.claude/commands/evolve/merge.md +0 -80
  30. package/.claude/commands/trellis/before-backend-dev.md +0 -13
  31. package/.claude/commands/trellis/before-frontend-dev.md +0 -13
  32. package/.claude/commands/trellis/break-loop.md +0 -107
  33. package/.claude/commands/trellis/check-backend.md +0 -13
  34. package/.claude/commands/trellis/check-cross-layer.md +0 -153
  35. package/.claude/commands/trellis/check-frontend.md +0 -13
  36. package/.claude/commands/trellis/create-command.md +0 -154
  37. package/.claude/commands/trellis/finish-work.md +0 -129
  38. package/.claude/commands/trellis/integrate-skill.md +0 -219
  39. package/.claude/commands/trellis/onboard.md +0 -358
  40. package/.claude/commands/trellis/parallel.md +0 -193
  41. package/.claude/commands/trellis/record-session.md +0 -62
  42. package/.claude/commands/trellis/start.md +0 -280
  43. package/.claude/commands/trellis/update-spec.md +0 -213
  44. package/.claude/hooks/inject-subagent-context.py +0 -758
  45. package/.claude/hooks/ralph-loop.py +0 -374
  46. package/.claude/hooks/session-start.py +0 -126
  47. package/.claude/settings.json +0 -41
  48. package/.claude/skills/deepagents-guide/SKILL.md +0 -428
  49. package/.cursor/commands/trellis-before-backend-dev.md +0 -13
  50. package/.cursor/commands/trellis-before-frontend-dev.md +0 -13
  51. package/.cursor/commands/trellis-break-loop.md +0 -107
  52. package/.cursor/commands/trellis-check-backend.md +0 -13
  53. package/.cursor/commands/trellis-check-cross-layer.md +0 -153
  54. package/.cursor/commands/trellis-check-frontend.md +0 -13
  55. package/.cursor/commands/trellis-create-command.md +0 -154
  56. package/.cursor/commands/trellis-finish-work.md +0 -129
  57. package/.cursor/commands/trellis-integrate-skill.md +0 -219
  58. package/.cursor/commands/trellis-onboard.md +0 -358
  59. package/.cursor/commands/trellis-record-session.md +0 -62
  60. package/.cursor/commands/trellis-start.md +0 -156
  61. package/.cursor/commands/trellis-update-spec.md +0 -213
  62. package/.github/workflows/publish.yml +0 -63
  63. package/.husky/pre-commit +0 -1
  64. package/.mcp.json +0 -8
  65. package/.trellis/.template-hashes.json +0 -65
  66. package/.trellis/.version +0 -1
  67. package/.trellis/scripts/add-session.sh +0 -384
  68. package/.trellis/scripts/common/developer.sh +0 -129
  69. package/.trellis/scripts/common/git-context.sh +0 -263
  70. package/.trellis/scripts/common/paths.sh +0 -208
  71. package/.trellis/scripts/common/phase.sh +0 -150
  72. package/.trellis/scripts/common/registry.sh +0 -247
  73. package/.trellis/scripts/common/task-queue.sh +0 -142
  74. package/.trellis/scripts/common/task-utils.sh +0 -151
  75. package/.trellis/scripts/common/worktree.sh +0 -128
  76. package/.trellis/scripts/create-bootstrap.sh +0 -299
  77. package/.trellis/scripts/get-context.sh +0 -7
  78. package/.trellis/scripts/get-developer.sh +0 -15
  79. package/.trellis/scripts/init-developer.sh +0 -34
  80. package/.trellis/scripts/multi-agent/cleanup.sh +0 -396
  81. package/.trellis/scripts/multi-agent/create-pr.sh +0 -241
  82. package/.trellis/scripts/multi-agent/plan.sh +0 -207
  83. package/.trellis/scripts/multi-agent/start.sh +0 -310
  84. package/.trellis/scripts/multi-agent/status.sh +0 -828
  85. package/.trellis/scripts/task.sh +0 -1118
  86. package/.trellis/spec/backend/ci-cd-guidelines.md +0 -73
  87. package/.trellis/spec/backend/deepagents-guide.md +0 -380
  88. package/.trellis/spec/backend/directory-structure.md +0 -126
  89. package/.trellis/spec/backend/examples/skills/deepagents-guide/README.md +0 -11
  90. package/.trellis/spec/backend/examples/skills/deepagents-guide/agent.js.template +0 -20
  91. package/.trellis/spec/backend/examples/skills/deepagents-guide/skills-config.js.template +0 -13
  92. package/.trellis/spec/backend/examples/skills/deepagents-guide/subagent.js.template +0 -19
  93. package/.trellis/spec/backend/hook-guidelines.md +0 -218
  94. package/.trellis/spec/backend/index.md +0 -37
  95. package/.trellis/spec/backend/quality-guidelines.md +0 -302
  96. package/.trellis/spec/backend/state-management.md +0 -76
  97. package/.trellis/spec/backend/tool-guidelines.md +0 -144
  98. package/.trellis/spec/backend/type-safety.md +0 -71
  99. package/.trellis/spec/guides/code-reuse-thinking-guide.md +0 -92
  100. package/.trellis/spec/guides/cross-layer-thinking-guide.md +0 -94
  101. package/.trellis/spec/guides/index.md +0 -79
  102. package/.trellis/tasks/archive/02-02-evolving-skills/prd.md +0 -61
  103. package/.trellis/tasks/archive/02-02-evolving-skills/task.json +0 -29
  104. package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/prd.md +0 -86
  105. package/.trellis/tasks/archive/2026-02/00-bootstrap-guidelines/task.json +0 -27
  106. package/.trellis/tasks/archive/2026-02/02-02-skills-system/check.jsonl +0 -3
  107. package/.trellis/tasks/archive/2026-02/02-02-skills-system/debug.jsonl +0 -2
  108. package/.trellis/tasks/archive/2026-02/02-02-skills-system/implement.jsonl +0 -5
  109. package/.trellis/tasks/archive/2026-02/02-02-skills-system/prd.md +0 -33
  110. package/.trellis/tasks/archive/2026-02/02-02-skills-system/task.json +0 -41
  111. package/.trellis/workflow.md +0 -407
  112. package/.trellis/workspace/index.md +0 -123
  113. package/.trellis/workspace/pony/index.md +0 -42
  114. package/.trellis/workspace/pony/journal-1.md +0 -125
  115. package/.trellis/worktree.yaml +0 -47
  116. package/AGENTS.md +0 -18
  117. package/CLAUDE.md +0 -315
  118. package/agents/deepspider.md +0 -142
  119. package/docs/DEBUG.md +0 -42
  120. package/docs/GUIDE.md +0 -334
  121. package/docs/PROMPT.md +0 -60
  122. package/docs/USAGE.md +0 -226
  123. package/eslint.config.js +0 -51
  124. package/test/analyze.test.js +0 -90
  125. package/test/envdump.test.js +0 -74
  126. package/test/flow.test.js +0 -90
  127. package/test/hooks.test.js +0 -138
  128. package/test/plugin.test.js +0 -35
  129. package/test/refactor-full.test.js +0 -30
  130. package/test/refactor.test.js +0 -21
  131. package/test/samples/obfuscated.js +0 -61
  132. package/test/samples/original.js +0 -66
  133. package/test/samples/v10_eval_chain.js +0 -52
  134. package/test/samples/v11_bytecode_vm.js +0 -81
  135. package/test/samples/v12_polymorphic.js +0 -69
  136. package/test/samples/v1_ob_basic.js +0 -98
  137. package/test/samples/v2_ob_advanced.js +0 -99
  138. package/test/samples/v3_jjencode.js +0 -77
  139. package/test/samples/v4_aaencode.js +0 -73
  140. package/test/samples/v5_control_flow.js +0 -86
  141. package/test/samples/v6_string_encryption.js +0 -71
  142. package/test/samples/v7_jsvmp.js +0 -83
  143. package/test/samples/v8_anti_debug.js +0 -79
  144. package/test/samples/v9_proxy_trap.js +0 -49
  145. package/test/samples.test.js +0 -96
  146. package/test/webcrack.test.js +0 -55
@@ -0,0 +1,43 @@
1
+ /**
2
+ * DeepSpider - 错误分类器
3
+ * 判断错误类型,决定重试策略
4
+ */
5
+
6
+ /**
7
+ * 判断是否为工具参数错误(需要 LLM 修正)
8
+ */
9
+ export function isToolSchemaError(errMsg) {
10
+ return /did not match expected schema|Invalid input|tool input/i.test(errMsg);
11
+ }
12
+
13
+ /**
14
+ * 判断是否为 API 服务错误(可直接重试)
15
+ */
16
+ export function isApiServiceError(errMsg) {
17
+ return /503|502|429|rate limit|无可用渠道|timeout|ECONNRESET|ETIMEDOUT/i.test(errMsg);
18
+ }
19
+
20
+ /**
21
+ * 判断是否为浏览器错误
22
+ */
23
+ export function isBrowserError(errMsg) {
24
+ return /Target closed|page closed|context closed|browser disconnected/i.test(errMsg);
25
+ }
26
+
27
+ /**
28
+ * 判断是否为网络错误
29
+ */
30
+ export function isNetworkError(errMsg) {
31
+ return /ENOTFOUND|ECONNREFUSED|network|fetch failed/i.test(errMsg);
32
+ }
33
+
34
+ /**
35
+ * 获取错误类型
36
+ */
37
+ export function classifyError(errMsg) {
38
+ if (isToolSchemaError(errMsg)) return 'tool_schema';
39
+ if (isApiServiceError(errMsg)) return 'api_service';
40
+ if (isBrowserError(errMsg)) return 'browser';
41
+ if (isNetworkError(errMsg)) return 'network';
42
+ return 'unknown';
43
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * DeepSpider - 结构化错误类型
3
+ */
4
+
5
+ /**
6
+ * 基础错误类
7
+ */
8
+ export class SpiderError extends Error {
9
+ constructor(message, code, details = {}) {
10
+ super(message);
11
+ this.name = 'SpiderError';
12
+ this.code = code;
13
+ this.details = details;
14
+ }
15
+
16
+ toJSON() {
17
+ return {
18
+ name: this.name,
19
+ code: this.code,
20
+ message: this.message,
21
+ details: this.details,
22
+ };
23
+ }
24
+ }
25
+
26
+ /**
27
+ * API 服务错误 - 503/502/429 等
28
+ */
29
+ export class ApiServiceError extends SpiderError {
30
+ constructor(message, details = {}) {
31
+ super(message, 'API_SERVICE_ERROR', details);
32
+ this.name = 'ApiServiceError';
33
+ this.retryable = true;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * 工具参数错误 - 工具调用参数不匹配
39
+ */
40
+ export class ToolSchemaError extends SpiderError {
41
+ constructor(message, details = {}) {
42
+ super(message, 'TOOL_SCHEMA_ERROR', details);
43
+ this.name = 'ToolSchemaError';
44
+ this.retryable = true;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * 浏览器错误 - 页面关闭、上下文丢失等
50
+ */
51
+ export class BrowserError extends SpiderError {
52
+ constructor(message, details = {}) {
53
+ super(message, 'BROWSER_ERROR', details);
54
+ this.name = 'BrowserError';
55
+ this.retryable = false;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * 网络错误 - 连接失败、DNS 解析等
61
+ */
62
+ export class NetworkError extends SpiderError {
63
+ constructor(message, details = {}) {
64
+ super(message, 'NETWORK_ERROR', details);
65
+ this.name = 'NetworkError';
66
+ this.retryable = true;
67
+ }
68
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * DeepSpider - Errors 模块索引
3
+ */
4
+
5
+ export {
6
+ isToolSchemaError,
7
+ isApiServiceError,
8
+ isBrowserError,
9
+ isNetworkError,
10
+ classifyError,
11
+ } from './ErrorClassifier.js';
12
+
13
+ export {
14
+ SpiderError,
15
+ ApiServiceError,
16
+ ToolSchemaError,
17
+ BrowserError,
18
+ NetworkError,
19
+ } from './SpiderError.js';