agentic-qe 3.3.3 → 3.3.5

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 (553) hide show
  1. package/.claude/agents/v3/README.md +100 -0
  2. package/.claude/agents/v3/qe-accessibility-auditor.md +112 -11
  3. package/.claude/agents/v3/qe-bdd-generator.md +40 -0
  4. package/.claude/agents/v3/qe-coverage-specialist.md +39 -0
  5. package/.claude/agents/v3/qe-defect-predictor.md +36 -0
  6. package/.claude/agents/v3/qe-gap-detector.md +39 -0
  7. package/.claude/agents/v3/qe-pattern-learner.md +31 -0
  8. package/.claude/agents/v3/qe-product-factors-assessor.md +34 -0
  9. package/.claude/agents/v3/qe-quality-criteria-recommender.md +32 -0
  10. package/.claude/agents/v3/qe-quality-gate.md +39 -0
  11. package/.claude/agents/v3/qe-queen-coordinator.md +332 -166
  12. package/.claude/agents/v3/qe-requirements-validator.md +37 -0
  13. package/.claude/agents/v3/qe-risk-assessor.md +33 -0
  14. package/.claude/agents/v3/qe-tdd-specialist.md +33 -0
  15. package/.claude/agents/v3/qe-test-architect.md +36 -0
  16. package/.claude/helpers/statusline-v3.cjs +38 -42
  17. package/.claude/skills/README.md +30 -104
  18. package/.claude/skills/a11y-ally/SKILL.md +1658 -0
  19. package/.claude/skills/qcsd-ideation-swarm/SKILL.md +1750 -0
  20. package/.claude/skills/skills-manifest.json +78 -8
  21. package/README.md +18 -4
  22. package/package.json +1 -1
  23. package/scripts/cloud-db-config.json +10 -5
  24. package/scripts/demo-warmup.sh +45 -0
  25. package/scripts/fetch-content.js +460 -0
  26. package/scripts/merge-v3-to-root.sql +48 -0
  27. package/v3/CHANGELOG.md +166 -0
  28. package/v3/README.md +11 -6
  29. package/v3/assets/agents/v3/README.md +100 -0
  30. package/v3/assets/agents/v3/qe-accessibility-auditor.md +112 -11
  31. package/v3/assets/agents/v3/qe-bdd-generator.md +40 -0
  32. package/v3/assets/agents/v3/qe-coverage-specialist.md +39 -0
  33. package/v3/assets/agents/v3/qe-defect-predictor.md +36 -0
  34. package/v3/assets/agents/v3/qe-gap-detector.md +39 -0
  35. package/v3/assets/agents/v3/qe-pattern-learner.md +31 -0
  36. package/v3/assets/agents/v3/qe-product-factors-assessor.md +34 -0
  37. package/v3/assets/agents/v3/qe-quality-criteria-recommender.md +32 -0
  38. package/v3/assets/agents/v3/qe-quality-gate.md +39 -0
  39. package/v3/assets/agents/v3/qe-queen-coordinator.md +332 -166
  40. package/v3/assets/agents/v3/qe-requirements-validator.md +37 -0
  41. package/v3/assets/agents/v3/qe-risk-assessor.md +33 -0
  42. package/v3/assets/agents/v3/qe-tdd-specialist.md +33 -0
  43. package/v3/assets/agents/v3/qe-test-architect.md +36 -0
  44. package/v3/assets/hooks/cross-phase-memory.yaml +253 -0
  45. package/v3/assets/skills/a11y-ally/SKILL.md +1658 -0
  46. package/v3/assets/skills/qcsd-ideation-swarm/SKILL.md +1750 -0
  47. package/v3/assets/skills/skills-manifest.json +753 -0
  48. package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts.map +1 -1
  49. package/v3/dist/adapters/claude-flow/model-router-bridge.js +6 -4
  50. package/v3/dist/adapters/claude-flow/model-router-bridge.js.map +1 -1
  51. package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts.map +1 -1
  52. package/v3/dist/adapters/claude-flow/pretrain-bridge.js +13 -8
  53. package/v3/dist/adapters/claude-flow/pretrain-bridge.js.map +1 -1
  54. package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts.map +1 -1
  55. package/v3/dist/adapters/claude-flow/trajectory-bridge.js +9 -6
  56. package/v3/dist/adapters/claude-flow/trajectory-bridge.js.map +1 -1
  57. package/v3/dist/benchmarks/performance-benchmarks.d.ts.map +1 -1
  58. package/v3/dist/benchmarks/performance-benchmarks.js +5 -3
  59. package/v3/dist/benchmarks/performance-benchmarks.js.map +1 -1
  60. package/v3/dist/cli/bundle.js +27646 -23204
  61. package/v3/dist/cli/commands/hooks.d.ts.map +1 -1
  62. package/v3/dist/cli/commands/hooks.js +288 -0
  63. package/v3/dist/cli/commands/hooks.js.map +1 -1
  64. package/v3/dist/cli/commands/sync.d.ts.map +1 -1
  65. package/v3/dist/cli/commands/sync.js +0 -6
  66. package/v3/dist/cli/commands/sync.js.map +1 -1
  67. package/v3/dist/cli/handlers/init-handler.d.ts.map +1 -1
  68. package/v3/dist/cli/handlers/init-handler.js +11 -0
  69. package/v3/dist/cli/handlers/init-handler.js.map +1 -1
  70. package/v3/dist/cli/index.js +14 -2
  71. package/v3/dist/cli/index.js.map +1 -1
  72. package/v3/dist/cli/scheduler/persistent-scheduler.d.ts.map +1 -1
  73. package/v3/dist/cli/scheduler/persistent-scheduler.js +3 -2
  74. package/v3/dist/cli/scheduler/persistent-scheduler.js.map +1 -1
  75. package/v3/dist/cli/wizards/test-wizard.d.ts.map +1 -1
  76. package/v3/dist/cli/wizards/test-wizard.js +6 -4
  77. package/v3/dist/cli/wizards/test-wizard.js.map +1 -1
  78. package/v3/dist/coordination/consensus/providers/claude-provider.js +1 -1
  79. package/v3/dist/coordination/consensus/providers/gemini-provider.js +1 -1
  80. package/v3/dist/coordination/consensus/providers/native-learning-provider.d.ts.map +1 -1
  81. package/v3/dist/coordination/consensus/providers/native-learning-provider.js +10 -8
  82. package/v3/dist/coordination/consensus/providers/native-learning-provider.js.map +1 -1
  83. package/v3/dist/coordination/consensus/providers/ollama-provider.d.ts.map +1 -1
  84. package/v3/dist/coordination/consensus/providers/ollama-provider.js +5 -4
  85. package/v3/dist/coordination/consensus/providers/ollama-provider.js.map +1 -1
  86. package/v3/dist/coordination/consensus/providers/openai-provider.d.ts.map +1 -1
  87. package/v3/dist/coordination/consensus/providers/openai-provider.js +5 -4
  88. package/v3/dist/coordination/consensus/providers/openai-provider.js.map +1 -1
  89. package/v3/dist/coordination/constants.d.ts +198 -0
  90. package/v3/dist/coordination/constants.d.ts.map +1 -0
  91. package/v3/dist/coordination/constants.js +210 -0
  92. package/v3/dist/coordination/constants.js.map +1 -0
  93. package/v3/dist/coordination/mincut/dream-integration.d.ts.map +1 -1
  94. package/v3/dist/coordination/mincut/dream-integration.js +5 -1
  95. package/v3/dist/coordination/mincut/dream-integration.js.map +1 -1
  96. package/v3/dist/coordination/queen-coordinator.d.ts +9 -1
  97. package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
  98. package/v3/dist/coordination/queen-coordinator.js +49 -9
  99. package/v3/dist/coordination/queen-coordinator.js.map +1 -1
  100. package/v3/dist/coordination/task-executor.d.ts.map +1 -1
  101. package/v3/dist/coordination/task-executor.js +7 -8
  102. package/v3/dist/coordination/task-executor.js.map +1 -1
  103. package/v3/dist/coordination/workflow-orchestrator.d.ts.map +1 -1
  104. package/v3/dist/coordination/workflow-orchestrator.js +261 -0
  105. package/v3/dist/coordination/workflow-orchestrator.js.map +1 -1
  106. package/v3/dist/domains/chaos-resilience/plugin.d.ts +14 -3
  107. package/v3/dist/domains/chaos-resilience/plugin.d.ts.map +1 -1
  108. package/v3/dist/domains/chaos-resilience/plugin.js +96 -0
  109. package/v3/dist/domains/chaos-resilience/plugin.js.map +1 -1
  110. package/v3/dist/domains/chaos-resilience/services/performance-profiler.d.ts.map +1 -1
  111. package/v3/dist/domains/chaos-resilience/services/performance-profiler.js +12 -8
  112. package/v3/dist/domains/chaos-resilience/services/performance-profiler.js.map +1 -1
  113. package/v3/dist/domains/code-intelligence/plugin.d.ts +13 -3
  114. package/v3/dist/domains/code-intelligence/plugin.d.ts.map +1 -1
  115. package/v3/dist/domains/code-intelligence/plugin.js +85 -0
  116. package/v3/dist/domains/code-intelligence/plugin.js.map +1 -1
  117. package/v3/dist/domains/code-intelligence/services/product-factors-bridge.d.ts.map +1 -1
  118. package/v3/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -2
  119. package/v3/dist/domains/code-intelligence/services/product-factors-bridge.js.map +1 -1
  120. package/v3/dist/domains/constants.d.ts +481 -0
  121. package/v3/dist/domains/constants.d.ts.map +1 -0
  122. package/v3/dist/domains/constants.js +503 -0
  123. package/v3/dist/domains/constants.js.map +1 -0
  124. package/v3/dist/domains/contract-testing/plugin.d.ts +6 -1
  125. package/v3/dist/domains/contract-testing/plugin.d.ts.map +1 -1
  126. package/v3/dist/domains/contract-testing/plugin.js +80 -1
  127. package/v3/dist/domains/contract-testing/plugin.js.map +1 -1
  128. package/v3/dist/domains/contract-testing/services/contract-validator.d.ts.map +1 -1
  129. package/v3/dist/domains/contract-testing/services/contract-validator.js +5 -4
  130. package/v3/dist/domains/contract-testing/services/contract-validator.js.map +1 -1
  131. package/v3/dist/domains/coverage-analysis/services/hnsw-index.d.ts.map +1 -1
  132. package/v3/dist/domains/coverage-analysis/services/hnsw-index.js +1 -0
  133. package/v3/dist/domains/coverage-analysis/services/hnsw-index.js.map +1 -1
  134. package/v3/dist/domains/defect-intelligence/coordinator.d.ts +2 -2
  135. package/v3/dist/domains/defect-intelligence/coordinator.d.ts.map +1 -1
  136. package/v3/dist/domains/defect-intelligence/coordinator.js.map +1 -1
  137. package/v3/dist/domains/defect-intelligence/plugin.d.ts +6 -1
  138. package/v3/dist/domains/defect-intelligence/plugin.d.ts.map +1 -1
  139. package/v3/dist/domains/defect-intelligence/plugin.js +101 -0
  140. package/v3/dist/domains/defect-intelligence/plugin.js.map +1 -1
  141. package/v3/dist/domains/defect-intelligence/services/defect-predictor.d.ts.map +1 -1
  142. package/v3/dist/domains/defect-intelligence/services/defect-predictor.js +3 -2
  143. package/v3/dist/domains/defect-intelligence/services/defect-predictor.js.map +1 -1
  144. package/v3/dist/domains/domain-interface.d.ts.map +1 -1
  145. package/v3/dist/domains/domain-interface.js +24 -9
  146. package/v3/dist/domains/domain-interface.js.map +1 -1
  147. package/v3/dist/domains/learning-optimization/plugin.d.ts +2 -1
  148. package/v3/dist/domains/learning-optimization/plugin.d.ts.map +1 -1
  149. package/v3/dist/domains/learning-optimization/plugin.js +49 -0
  150. package/v3/dist/domains/learning-optimization/plugin.js.map +1 -1
  151. package/v3/dist/domains/quality-assessment/coordinator.d.ts +90 -1
  152. package/v3/dist/domains/quality-assessment/coordinator.d.ts.map +1 -1
  153. package/v3/dist/domains/quality-assessment/coordinator.js +310 -0
  154. package/v3/dist/domains/quality-assessment/coordinator.js.map +1 -1
  155. package/v3/dist/domains/requirements-validation/index.d.ts +1 -0
  156. package/v3/dist/domains/requirements-validation/index.d.ts.map +1 -1
  157. package/v3/dist/domains/requirements-validation/index.js +2 -0
  158. package/v3/dist/domains/requirements-validation/index.js.map +1 -1
  159. package/v3/dist/domains/requirements-validation/plugin.d.ts +13 -1
  160. package/v3/dist/domains/requirements-validation/plugin.d.ts.map +1 -1
  161. package/v3/dist/domains/requirements-validation/plugin.js +94 -0
  162. package/v3/dist/domains/requirements-validation/plugin.js.map +1 -1
  163. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.d.ts +245 -0
  164. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.d.ts.map +1 -0
  165. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.js +1143 -0
  166. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.js.map +1 -0
  167. package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.d.ts.map +1 -1
  168. package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js +3 -2
  169. package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js.map +1 -1
  170. package/v3/dist/domains/security-compliance/plugin.d.ts +3 -2
  171. package/v3/dist/domains/security-compliance/plugin.d.ts.map +1 -1
  172. package/v3/dist/domains/security-compliance/plugin.js +64 -0
  173. package/v3/dist/domains/security-compliance/plugin.js.map +1 -1
  174. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts +25 -0
  175. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts.map +1 -0
  176. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.js +160 -0
  177. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.js.map +1 -0
  178. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts +48 -0
  179. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts.map +1 -0
  180. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.js +385 -0
  181. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.js.map +1 -0
  182. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts +20 -0
  183. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts.map +1 -0
  184. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.js +99 -0
  185. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.js.map +1 -0
  186. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +62 -0
  187. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts.map +1 -0
  188. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.js +329 -0
  189. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.js.map +1 -0
  190. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.d.ts +46 -0
  191. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.d.ts.map +1 -0
  192. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.js +180 -0
  193. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.js.map +1 -0
  194. package/v3/dist/domains/security-compliance/services/scanners/index.d.ts +14 -0
  195. package/v3/dist/domains/security-compliance/services/scanners/index.d.ts.map +1 -0
  196. package/v3/dist/domains/security-compliance/services/scanners/index.js +16 -0
  197. package/v3/dist/domains/security-compliance/services/scanners/index.js.map +1 -0
  198. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts +92 -0
  199. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts.map +1 -0
  200. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.js +440 -0
  201. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.js.map +1 -0
  202. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.d.ts +78 -0
  203. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.d.ts.map +1 -0
  204. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js +179 -0
  205. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js.map +1 -0
  206. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.d.ts +91 -0
  207. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.d.ts.map +1 -0
  208. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.js +15 -0
  209. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.js.map +1 -0
  210. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.d.ts +16 -0
  211. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.d.ts.map +1 -0
  212. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.js +507 -0
  213. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.js.map +1 -0
  214. package/v3/dist/domains/security-compliance/services/security-auditor.d.ts.map +1 -1
  215. package/v3/dist/domains/security-compliance/services/security-auditor.js +2 -1
  216. package/v3/dist/domains/security-compliance/services/security-auditor.js.map +1 -1
  217. package/v3/dist/domains/security-compliance/services/security-scanner.d.ts +20 -213
  218. package/v3/dist/domains/security-compliance/services/security-scanner.d.ts.map +1 -1
  219. package/v3/dist/domains/security-compliance/services/security-scanner.js +37 -2013
  220. package/v3/dist/domains/security-compliance/services/security-scanner.js.map +1 -1
  221. package/v3/dist/domains/security-compliance/services/semgrep-integration.d.ts.map +1 -1
  222. package/v3/dist/domains/security-compliance/services/semgrep-integration.js +7 -6
  223. package/v3/dist/domains/security-compliance/services/semgrep-integration.js.map +1 -1
  224. package/v3/dist/domains/test-execution/services/auth-state-manager.d.ts.map +1 -1
  225. package/v3/dist/domains/test-execution/services/auth-state-manager.js +6 -4
  226. package/v3/dist/domains/test-execution/services/auth-state-manager.js.map +1 -1
  227. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.d.ts +55 -0
  228. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.d.ts.map +1 -0
  229. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.js +407 -0
  230. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.js.map +1 -0
  231. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts +122 -0
  232. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts.map +1 -0
  233. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.js +325 -0
  234. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.js.map +1 -0
  235. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts +97 -0
  236. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts.map +1 -0
  237. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.js +297 -0
  238. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.js.map +1 -0
  239. package/v3/dist/domains/test-execution/services/e2e/index.d.ts +22 -0
  240. package/v3/dist/domains/test-execution/services/e2e/index.d.ts.map +1 -0
  241. package/v3/dist/domains/test-execution/services/e2e/index.js +52 -0
  242. package/v3/dist/domains/test-execution/services/e2e/index.js.map +1 -0
  243. package/v3/dist/domains/test-execution/services/e2e/result-collector.d.ts +51 -0
  244. package/v3/dist/domains/test-execution/services/e2e/result-collector.d.ts.map +1 -0
  245. package/v3/dist/domains/test-execution/services/e2e/result-collector.js +133 -0
  246. package/v3/dist/domains/test-execution/services/e2e/result-collector.js.map +1 -0
  247. package/v3/dist/domains/test-execution/services/e2e/step-executors.d.ts +48 -0
  248. package/v3/dist/domains/test-execution/services/e2e/step-executors.d.ts.map +1 -0
  249. package/v3/dist/domains/test-execution/services/e2e/step-executors.js +422 -0
  250. package/v3/dist/domains/test-execution/services/e2e/step-executors.js.map +1 -0
  251. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.d.ts +49 -0
  252. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.d.ts.map +1 -0
  253. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.js +146 -0
  254. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.js.map +1 -0
  255. package/v3/dist/domains/test-execution/services/e2e/types.d.ts +138 -0
  256. package/v3/dist/domains/test-execution/services/e2e/types.d.ts.map +1 -0
  257. package/v3/dist/domains/test-execution/services/e2e/types.js +65 -0
  258. package/v3/dist/domains/test-execution/services/e2e/types.js.map +1 -0
  259. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.d.ts +33 -0
  260. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.d.ts.map +1 -0
  261. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.js +114 -0
  262. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.js.map +1 -0
  263. package/v3/dist/domains/test-execution/services/e2e-runner.d.ts +18 -392
  264. package/v3/dist/domains/test-execution/services/e2e-runner.d.ts.map +1 -1
  265. package/v3/dist/domains/test-execution/services/e2e-runner.js +25 -1757
  266. package/v3/dist/domains/test-execution/services/e2e-runner.js.map +1 -1
  267. package/v3/dist/domains/test-execution/services/flaky-detector.d.ts.map +1 -1
  268. package/v3/dist/domains/test-execution/services/flaky-detector.js +12 -9
  269. package/v3/dist/domains/test-execution/services/flaky-detector.js.map +1 -1
  270. package/v3/dist/domains/test-execution/services/retry-handler.d.ts.map +1 -1
  271. package/v3/dist/domains/test-execution/services/retry-handler.js +7 -5
  272. package/v3/dist/domains/test-execution/services/retry-handler.js.map +1 -1
  273. package/v3/dist/domains/test-execution/services/test-executor.d.ts.map +1 -1
  274. package/v3/dist/domains/test-execution/services/test-executor.js +4 -3
  275. package/v3/dist/domains/test-execution/services/test-executor.js.map +1 -1
  276. package/v3/dist/domains/visual-accessibility/coordinator.d.ts +70 -0
  277. package/v3/dist/domains/visual-accessibility/coordinator.d.ts.map +1 -1
  278. package/v3/dist/domains/visual-accessibility/coordinator.js +172 -0
  279. package/v3/dist/domains/visual-accessibility/coordinator.js.map +1 -1
  280. package/v3/dist/domains/visual-accessibility/plugin.d.ts +2 -1
  281. package/v3/dist/domains/visual-accessibility/plugin.d.ts.map +1 -1
  282. package/v3/dist/domains/visual-accessibility/plugin.js +63 -0
  283. package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
  284. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts.map +1 -1
  285. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js +3 -2
  286. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js.map +1 -1
  287. package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.d.ts.map +1 -1
  288. package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.js +22 -12
  289. package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.js.map +1 -1
  290. package/v3/dist/domains/visual-accessibility/services/viewport-capture.d.ts.map +1 -1
  291. package/v3/dist/domains/visual-accessibility/services/viewport-capture.js +3 -2
  292. package/v3/dist/domains/visual-accessibility/services/viewport-capture.js.map +1 -1
  293. package/v3/dist/domains/visual-accessibility/services/visual-regression.d.ts.map +1 -1
  294. package/v3/dist/domains/visual-accessibility/services/visual-regression.js +3 -2
  295. package/v3/dist/domains/visual-accessibility/services/visual-regression.js.map +1 -1
  296. package/v3/dist/hooks/cross-phase-hooks.d.ts +42 -0
  297. package/v3/dist/hooks/cross-phase-hooks.d.ts.map +1 -0
  298. package/v3/dist/hooks/cross-phase-hooks.js +338 -0
  299. package/v3/dist/hooks/cross-phase-hooks.js.map +1 -0
  300. package/v3/dist/hooks/index.d.ts +9 -0
  301. package/v3/dist/hooks/index.d.ts.map +1 -0
  302. package/v3/dist/hooks/index.js +9 -0
  303. package/v3/dist/hooks/index.js.map +1 -0
  304. package/v3/dist/init/agents-installer.d.ts.map +1 -1
  305. package/v3/dist/init/agents-installer.js +6 -4
  306. package/v3/dist/init/agents-installer.js.map +1 -1
  307. package/v3/dist/init/enhancements/claude-flow-adapter.d.ts.map +1 -1
  308. package/v3/dist/init/enhancements/claude-flow-adapter.js +15 -9
  309. package/v3/dist/init/enhancements/claude-flow-adapter.js.map +1 -1
  310. package/v3/dist/init/enhancements/detector.js +6 -4
  311. package/v3/dist/init/enhancements/detector.js.map +1 -1
  312. package/v3/dist/init/init-wizard.d.ts +5 -0
  313. package/v3/dist/init/init-wizard.d.ts.map +1 -1
  314. package/v3/dist/init/init-wizard.js +77 -14
  315. package/v3/dist/init/init-wizard.js.map +1 -1
  316. package/v3/dist/init/migration/data-migrator.d.ts.map +1 -1
  317. package/v3/dist/init/migration/data-migrator.js +6 -4
  318. package/v3/dist/init/migration/data-migrator.js.map +1 -1
  319. package/v3/dist/init/phases/02-analysis.js +2 -2
  320. package/v3/dist/init/phases/02-analysis.js.map +1 -1
  321. package/v3/dist/init/phases/04-database.d.ts.map +1 -1
  322. package/v3/dist/init/phases/04-database.js +0 -1
  323. package/v3/dist/init/phases/04-database.js.map +1 -1
  324. package/v3/dist/init/phases/05-learning.js +1 -1
  325. package/v3/dist/init/phases/05-learning.js.map +1 -1
  326. package/v3/dist/init/phases/11-claude-md.d.ts.map +1 -1
  327. package/v3/dist/init/phases/11-claude-md.js +25 -0
  328. package/v3/dist/init/phases/11-claude-md.js.map +1 -1
  329. package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
  330. package/v3/dist/init/phases/12-verification.js +2 -1
  331. package/v3/dist/init/phases/12-verification.js.map +1 -1
  332. package/v3/dist/init/project-analyzer.d.ts.map +1 -1
  333. package/v3/dist/init/project-analyzer.js +12 -8
  334. package/v3/dist/init/project-analyzer.js.map +1 -1
  335. package/v3/dist/init/skills-installer.d.ts.map +1 -1
  336. package/v3/dist/init/skills-installer.js +6 -4
  337. package/v3/dist/init/skills-installer.js.map +1 -1
  338. package/v3/dist/init/token-bootstrap.d.ts.map +1 -1
  339. package/v3/dist/init/token-bootstrap.js +2 -1
  340. package/v3/dist/init/token-bootstrap.js.map +1 -1
  341. package/v3/dist/integrations/agent-booster-wasm/index.d.ts.map +1 -1
  342. package/v3/dist/integrations/agent-booster-wasm/index.js +8 -4
  343. package/v3/dist/integrations/agent-booster-wasm/index.js.map +1 -1
  344. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts.map +1 -1
  345. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js +3 -2
  346. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js.map +1 -1
  347. package/v3/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts.map +1 -1
  348. package/v3/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js.map +1 -1
  349. package/v3/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.d.ts.map +1 -1
  350. package/v3/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js.map +1 -1
  351. package/v3/dist/integrations/browser/agent-browser/client.d.ts.map +1 -1
  352. package/v3/dist/integrations/browser/agent-browser/client.js +9 -6
  353. package/v3/dist/integrations/browser/agent-browser/client.js.map +1 -1
  354. package/v3/dist/integrations/browser/agent-browser/command-executor.d.ts.map +1 -1
  355. package/v3/dist/integrations/browser/agent-browser/command-executor.js +3 -2
  356. package/v3/dist/integrations/browser/agent-browser/command-executor.js.map +1 -1
  357. package/v3/dist/integrations/browser/index.d.ts +1 -0
  358. package/v3/dist/integrations/browser/index.d.ts.map +1 -1
  359. package/v3/dist/integrations/browser/index.js +6 -0
  360. package/v3/dist/integrations/browser/index.js.map +1 -1
  361. package/v3/dist/integrations/browser/web-content-fetcher.d.ts +154 -0
  362. package/v3/dist/integrations/browser/web-content-fetcher.d.ts.map +1 -0
  363. package/v3/dist/integrations/browser/web-content-fetcher.js +529 -0
  364. package/v3/dist/integrations/browser/web-content-fetcher.js.map +1 -0
  365. package/v3/dist/integrations/coherence/threshold-tuner.d.ts.map +1 -1
  366. package/v3/dist/integrations/coherence/threshold-tuner.js +3 -2
  367. package/v3/dist/integrations/coherence/threshold-tuner.js.map +1 -1
  368. package/v3/dist/integrations/coherence/wasm-loader.d.ts.map +1 -1
  369. package/v3/dist/integrations/coherence/wasm-loader.js +3 -2
  370. package/v3/dist/integrations/coherence/wasm-loader.js.map +1 -1
  371. package/v3/dist/integrations/n8n/agent-factory.d.ts.map +1 -1
  372. package/v3/dist/integrations/n8n/agent-factory.js +6 -4
  373. package/v3/dist/integrations/n8n/agent-factory.js.map +1 -1
  374. package/v3/dist/integrations/rl-suite/persistence/q-value-store.d.ts.map +1 -1
  375. package/v3/dist/integrations/rl-suite/persistence/q-value-store.js.map +1 -1
  376. package/v3/dist/integrations/ruvector/interfaces.js +1 -1
  377. package/v3/dist/integrations/ruvector/interfaces.js.map +1 -1
  378. package/v3/dist/integrations/ruvector/sona-persistence.d.ts.map +1 -1
  379. package/v3/dist/integrations/ruvector/sona-persistence.js +6 -4
  380. package/v3/dist/integrations/ruvector/sona-persistence.js.map +1 -1
  381. package/v3/dist/integrations/vibium/client.d.ts.map +1 -1
  382. package/v3/dist/integrations/vibium/client.js +3 -2
  383. package/v3/dist/integrations/vibium/client.js.map +1 -1
  384. package/v3/dist/kernel/agent-coordinator.d.ts +1 -1
  385. package/v3/dist/kernel/agent-coordinator.d.ts.map +1 -1
  386. package/v3/dist/kernel/agent-coordinator.js +4 -4
  387. package/v3/dist/kernel/agent-coordinator.js.map +1 -1
  388. package/v3/dist/kernel/constants.d.ts +155 -0
  389. package/v3/dist/kernel/constants.d.ts.map +1 -0
  390. package/v3/dist/kernel/constants.js +169 -0
  391. package/v3/dist/kernel/constants.js.map +1 -0
  392. package/v3/dist/kernel/event-bus.d.ts +8 -0
  393. package/v3/dist/kernel/event-bus.d.ts.map +1 -1
  394. package/v3/dist/kernel/event-bus.js +79 -17
  395. package/v3/dist/kernel/event-bus.js.map +1 -1
  396. package/v3/dist/kernel/hybrid-backend.d.ts.map +1 -1
  397. package/v3/dist/kernel/hybrid-backend.js +4 -3
  398. package/v3/dist/kernel/hybrid-backend.js.map +1 -1
  399. package/v3/dist/kernel/index.d.ts +1 -1
  400. package/v3/dist/kernel/index.d.ts.map +1 -1
  401. package/v3/dist/kernel/index.js +3 -1
  402. package/v3/dist/kernel/index.js.map +1 -1
  403. package/v3/dist/kernel/kernel.d.ts.map +1 -1
  404. package/v3/dist/kernel/kernel.js +3 -2
  405. package/v3/dist/kernel/kernel.js.map +1 -1
  406. package/v3/dist/kernel/memory-backend.d.ts.map +1 -1
  407. package/v3/dist/kernel/memory-backend.js +4 -3
  408. package/v3/dist/kernel/memory-backend.js.map +1 -1
  409. package/v3/dist/kernel/unified-memory.d.ts +26 -0
  410. package/v3/dist/kernel/unified-memory.d.ts.map +1 -1
  411. package/v3/dist/kernel/unified-memory.js +68 -13
  412. package/v3/dist/kernel/unified-memory.js.map +1 -1
  413. package/v3/dist/kernel/unified-persistence.js +3 -2
  414. package/v3/dist/kernel/unified-persistence.js.map +1 -1
  415. package/v3/dist/learning/aqe-learning-engine.d.ts.map +1 -1
  416. package/v3/dist/learning/aqe-learning-engine.js +12 -8
  417. package/v3/dist/learning/aqe-learning-engine.js.map +1 -1
  418. package/v3/dist/learning/dream/index.d.ts +1 -1
  419. package/v3/dist/learning/dream/index.d.ts.map +1 -1
  420. package/v3/dist/learning/dream/index.js +3 -1
  421. package/v3/dist/learning/dream/index.js.map +1 -1
  422. package/v3/dist/learning/dream/spreading-activation.d.ts +41 -0
  423. package/v3/dist/learning/dream/spreading-activation.d.ts.map +1 -1
  424. package/v3/dist/learning/dream/spreading-activation.js +79 -0
  425. package/v3/dist/learning/dream/spreading-activation.js.map +1 -1
  426. package/v3/dist/learning/pattern-store.d.ts.map +1 -1
  427. package/v3/dist/learning/pattern-store.js +16 -6
  428. package/v3/dist/learning/pattern-store.js.map +1 -1
  429. package/v3/dist/learning/qe-unified-memory.js +1 -1
  430. package/v3/dist/learning/qe-unified-memory.js.map +1 -1
  431. package/v3/dist/learning/real-embeddings.d.ts.map +1 -1
  432. package/v3/dist/learning/real-embeddings.js +7 -1
  433. package/v3/dist/learning/real-embeddings.js.map +1 -1
  434. package/v3/dist/learning/real-qe-reasoning-bank.js +2 -2
  435. package/v3/dist/learning/real-qe-reasoning-bank.js.map +1 -1
  436. package/v3/dist/learning/sqlite-persistence.d.ts +2 -2
  437. package/v3/dist/learning/sqlite-persistence.d.ts.map +1 -1
  438. package/v3/dist/learning/sqlite-persistence.js +1 -1
  439. package/v3/dist/learning/sqlite-persistence.js.map +1 -1
  440. package/v3/dist/learning/v2-to-v3-migration.d.ts +2 -2
  441. package/v3/dist/learning/v2-to-v3-migration.d.ts.map +1 -1
  442. package/v3/dist/learning/v2-to-v3-migration.js +2 -2
  443. package/v3/dist/learning/v2-to-v3-migration.js.map +1 -1
  444. package/v3/dist/logging/console-logger.d.ts +96 -0
  445. package/v3/dist/logging/console-logger.d.ts.map +1 -0
  446. package/v3/dist/logging/console-logger.js +247 -0
  447. package/v3/dist/logging/console-logger.js.map +1 -0
  448. package/v3/dist/logging/index.d.ts +42 -0
  449. package/v3/dist/logging/index.d.ts.map +1 -0
  450. package/v3/dist/logging/index.js +39 -0
  451. package/v3/dist/logging/index.js.map +1 -0
  452. package/v3/dist/logging/logger-factory.d.ts +145 -0
  453. package/v3/dist/logging/logger-factory.d.ts.map +1 -0
  454. package/v3/dist/logging/logger-factory.js +218 -0
  455. package/v3/dist/logging/logger-factory.js.map +1 -0
  456. package/v3/dist/logging/logger.d.ts +89 -0
  457. package/v3/dist/logging/logger.d.ts.map +1 -0
  458. package/v3/dist/logging/logger.js +74 -0
  459. package/v3/dist/logging/logger.js.map +1 -0
  460. package/v3/dist/mcp/bundle.js +11385 -7526
  461. package/v3/dist/mcp/handlers/agent-handlers.js +2 -2
  462. package/v3/dist/mcp/handlers/agent-handlers.js.map +1 -1
  463. package/v3/dist/mcp/handlers/core-handlers.d.ts +2 -0
  464. package/v3/dist/mcp/handlers/core-handlers.d.ts.map +1 -1
  465. package/v3/dist/mcp/handlers/core-handlers.js +33 -0
  466. package/v3/dist/mcp/handlers/core-handlers.js.map +1 -1
  467. package/v3/dist/mcp/handlers/cross-phase-handlers.d.ts +110 -0
  468. package/v3/dist/mcp/handlers/cross-phase-handlers.d.ts.map +1 -0
  469. package/v3/dist/mcp/handlers/cross-phase-handlers.js +216 -0
  470. package/v3/dist/mcp/handlers/cross-phase-handlers.js.map +1 -0
  471. package/v3/dist/mcp/handlers/domain-handler-configs.d.ts +151 -0
  472. package/v3/dist/mcp/handlers/domain-handler-configs.d.ts.map +1 -0
  473. package/v3/dist/mcp/handlers/domain-handler-configs.js +486 -0
  474. package/v3/dist/mcp/handlers/domain-handler-configs.js.map +1 -0
  475. package/v3/dist/mcp/handlers/domain-handlers.d.ts +174 -120
  476. package/v3/dist/mcp/handlers/domain-handlers.d.ts.map +1 -1
  477. package/v3/dist/mcp/handlers/domain-handlers.js +178 -1049
  478. package/v3/dist/mcp/handlers/domain-handlers.js.map +1 -1
  479. package/v3/dist/mcp/handlers/handler-factory.d.ts +182 -0
  480. package/v3/dist/mcp/handlers/handler-factory.d.ts.map +1 -0
  481. package/v3/dist/mcp/handlers/handler-factory.js +327 -0
  482. package/v3/dist/mcp/handlers/handler-factory.js.map +1 -0
  483. package/v3/dist/mcp/handlers/index.d.ts +1 -0
  484. package/v3/dist/mcp/handlers/index.d.ts.map +1 -1
  485. package/v3/dist/mcp/handlers/index.js +2 -0
  486. package/v3/dist/mcp/handlers/index.js.map +1 -1
  487. package/v3/dist/mcp/handlers/task-handlers.d.ts +1 -0
  488. package/v3/dist/mcp/handlers/task-handlers.d.ts.map +1 -1
  489. package/v3/dist/mcp/handlers/task-handlers.js +91 -7
  490. package/v3/dist/mcp/handlers/task-handlers.js.map +1 -1
  491. package/v3/dist/mcp/server.d.ts.map +1 -1
  492. package/v3/dist/mcp/server.js +107 -1
  493. package/v3/dist/mcp/server.js.map +1 -1
  494. package/v3/dist/mcp/types.d.ts +5 -3
  495. package/v3/dist/mcp/types.d.ts.map +1 -1
  496. package/v3/dist/memory/cross-phase-memory.d.ts +55 -0
  497. package/v3/dist/memory/cross-phase-memory.d.ts.map +1 -0
  498. package/v3/dist/memory/cross-phase-memory.js +265 -0
  499. package/v3/dist/memory/cross-phase-memory.js.map +1 -0
  500. package/v3/dist/memory/index.d.ts +9 -0
  501. package/v3/dist/memory/index.d.ts.map +1 -0
  502. package/v3/dist/memory/index.js +9 -0
  503. package/v3/dist/memory/index.js.map +1 -0
  504. package/v3/dist/shared/io/file-reader.d.ts.map +1 -1
  505. package/v3/dist/shared/io/file-reader.js +3 -2
  506. package/v3/dist/shared/io/file-reader.js.map +1 -1
  507. package/v3/dist/shared/utils/binary-insert.d.ts +85 -0
  508. package/v3/dist/shared/utils/binary-insert.d.ts.map +1 -0
  509. package/v3/dist/shared/utils/binary-insert.js +122 -0
  510. package/v3/dist/shared/utils/binary-insert.js.map +1 -0
  511. package/v3/dist/shared/utils/index.d.ts +1 -0
  512. package/v3/dist/shared/utils/index.d.ts.map +1 -1
  513. package/v3/dist/shared/utils/index.js +1 -0
  514. package/v3/dist/shared/utils/index.js.map +1 -1
  515. package/v3/dist/strange-loop/belief-reconciler.d.ts.map +1 -1
  516. package/v3/dist/strange-loop/belief-reconciler.js +3 -2
  517. package/v3/dist/strange-loop/belief-reconciler.js.map +1 -1
  518. package/v3/dist/sync/claude-flow-bridge.d.ts +1 -1
  519. package/v3/dist/sync/claude-flow-bridge.d.ts.map +1 -1
  520. package/v3/dist/sync/claude-flow-bridge.js +7 -5
  521. package/v3/dist/sync/claude-flow-bridge.js.map +1 -1
  522. package/v3/dist/sync/cloud/postgres-writer.d.ts.map +1 -1
  523. package/v3/dist/sync/cloud/postgres-writer.js +0 -1
  524. package/v3/dist/sync/cloud/postgres-writer.js.map +1 -1
  525. package/v3/dist/sync/interfaces.d.ts +6 -0
  526. package/v3/dist/sync/interfaces.d.ts.map +1 -1
  527. package/v3/dist/sync/interfaces.js +34 -47
  528. package/v3/dist/sync/interfaces.js.map +1 -1
  529. package/v3/dist/sync/readers/sqlite-reader.d.ts +1 -1
  530. package/v3/dist/sync/readers/sqlite-reader.d.ts.map +1 -1
  531. package/v3/dist/sync/readers/sqlite-reader.js +4 -3
  532. package/v3/dist/sync/readers/sqlite-reader.js.map +1 -1
  533. package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.d.ts.map +1 -1
  534. package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.js +3 -2
  535. package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.js.map +1 -1
  536. package/v3/dist/test-scheduling/git-aware/test-selector.d.ts.map +1 -1
  537. package/v3/dist/test-scheduling/git-aware/test-selector.js +3 -2
  538. package/v3/dist/test-scheduling/git-aware/test-selector.js.map +1 -1
  539. package/v3/dist/types/cross-phase-signals.d.ts +119 -0
  540. package/v3/dist/types/cross-phase-signals.d.ts.map +1 -0
  541. package/v3/dist/types/cross-phase-signals.js +33 -0
  542. package/v3/dist/types/cross-phase-signals.js.map +1 -0
  543. package/v3/dist/types/index.d.ts +9 -0
  544. package/v3/dist/types/index.d.ts.map +1 -0
  545. package/v3/dist/types/index.js +9 -0
  546. package/v3/dist/types/index.js.map +1 -0
  547. package/v3/dist/workers/worker-manager.d.ts.map +1 -1
  548. package/v3/dist/workers/worker-manager.js +3 -2
  549. package/v3/dist/workers/worker-manager.js.map +1 -1
  550. package/v3/dist/workflows/browser/workflow-loader.d.ts +3 -3
  551. package/v3/dist/workflows/browser/workflow-loader.d.ts.map +1 -1
  552. package/v3/dist/workflows/browser/workflow-loader.js.map +1 -1
  553. package/v3/package.json +4 -1
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Web Content Fetcher - V3 Browser Cascade
3
+ *
4
+ * Provides resilient web content fetching with a 5-tier cascade:
5
+ * 1. Vibium MCP Browser (best for bot-protected sites)
6
+ * 2. Agent Browser (CLI-based with refs)
7
+ * 3. Playwright + Stealth (headless with anti-detection)
8
+ * 4. Simple HTTP Fetch (for static sites)
9
+ * 5. Web Search Fallback (research-based, last resort)
10
+ *
11
+ * @module integrations/browser/web-content-fetcher
12
+ * @version 1.0.0
13
+ * @since v3
14
+ */
15
+ /**
16
+ * Fetch tier identifiers
17
+ */
18
+ export type FetchTier = 'vibium' | 'agent-browser' | 'playwright-stealth' | 'http-fetch' | 'websearch-fallback';
19
+ /**
20
+ * Fetch status
21
+ */
22
+ export type FetchStatus = 'success' | 'degraded' | 'failed';
23
+ /**
24
+ * Result of a web content fetch operation
25
+ */
26
+ export interface WebContentFetchResult {
27
+ /** Whether the fetch succeeded */
28
+ success: boolean;
29
+ /** The fetched HTML content (or research-based content for websearch tier) */
30
+ content: string | null;
31
+ /** Which tier was used to fetch the content */
32
+ tier: FetchTier | null;
33
+ /** Overall fetch status */
34
+ status: FetchStatus;
35
+ /** Size of content in bytes */
36
+ contentSize: number;
37
+ /** Path to screenshot if captured */
38
+ screenshotPath?: string;
39
+ /** URL that was fetched */
40
+ url: string;
41
+ /** Error message if failed */
42
+ error?: string;
43
+ /** Tier-specific metadata */
44
+ metadata?: Record<string, unknown>;
45
+ /** Tiers that were attempted */
46
+ tiersAttempted: FetchTier[];
47
+ /** Errors from each tier that failed */
48
+ tierErrors: Record<FetchTier, string>;
49
+ }
50
+ /**
51
+ * Options for web content fetching
52
+ */
53
+ export interface WebContentFetchOptions {
54
+ /** URL to fetch */
55
+ url: string;
56
+ /** Output directory for screenshots and cached content */
57
+ outputDir?: string;
58
+ /** Timeout in milliseconds (default: 60000) */
59
+ timeout?: number;
60
+ /** Whether to capture screenshots (default: true) */
61
+ captureScreenshot?: boolean;
62
+ /** Tiers to skip (for testing or preference) */
63
+ skipTiers?: FetchTier[];
64
+ /** User agent to use */
65
+ userAgent?: string;
66
+ /** Locale for the browser (default: 'en-US') */
67
+ locale?: string;
68
+ /** Whether to try dismissing cookie banners (default: true) */
69
+ dismissCookieBanners?: boolean;
70
+ /** MCP tools reference (for Vibium integration) */
71
+ mcpTools?: {
72
+ vibiumLaunch?: (options: {
73
+ headless: boolean;
74
+ }) => Promise<unknown>;
75
+ vibiumNavigate?: (options: {
76
+ url: string;
77
+ }) => Promise<unknown>;
78
+ vibiumScreenshot?: (options: {
79
+ filename?: string;
80
+ }) => Promise<unknown>;
81
+ vibiumFind?: (options: {
82
+ selector: string;
83
+ }) => Promise<unknown>;
84
+ vibiumQuit?: () => Promise<unknown>;
85
+ webFetch?: (options: {
86
+ url: string;
87
+ prompt: string;
88
+ }) => Promise<string>;
89
+ webSearch?: (options: {
90
+ query: string;
91
+ }) => Promise<string>;
92
+ };
93
+ }
94
+ /**
95
+ * Fetches web content using a resilient 5-tier cascade
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const fetcher = new WebContentFetcher();
100
+ * const result = await fetcher.fetch({
101
+ * url: 'https://www.example.com',
102
+ * outputDir: '/tmp/fetch-output'
103
+ * });
104
+ *
105
+ * if (result.success) {
106
+ * console.log(`Fetched via ${result.tier}: ${result.contentSize} bytes`);
107
+ * console.log(result.content);
108
+ * }
109
+ * ```
110
+ */
111
+ export declare class WebContentFetcher {
112
+ private readonly defaultTimeout;
113
+ private readonly defaultUserAgent;
114
+ /**
115
+ * Fetch web content with automatic tier selection
116
+ *
117
+ * @param options Fetch options
118
+ * @returns Promise<WebContentFetchResult> Fetch result with content and metadata
119
+ */
120
+ fetch(options: WebContentFetchOptions): Promise<WebContentFetchResult>;
121
+ /**
122
+ * Fetch using a specific tier
123
+ */
124
+ private fetchWithTier;
125
+ private fetchWithVibium;
126
+ private fetchWithAgentBrowser;
127
+ private fetchWithPlaywrightStealth;
128
+ private fetchWithHttp;
129
+ private fetchWithWebSearch;
130
+ private sleep;
131
+ }
132
+ /**
133
+ * Create a new WebContentFetcher instance
134
+ *
135
+ * @returns WebContentFetcher instance
136
+ */
137
+ export declare function createWebContentFetcher(): WebContentFetcher;
138
+ /**
139
+ * Fetch web content with a single function call
140
+ *
141
+ * @param url URL to fetch
142
+ * @param options Additional options
143
+ * @returns Promise<WebContentFetchResult> Fetch result
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const result = await fetchWebContent('https://example.com', {
148
+ * outputDir: '/tmp/fetch',
149
+ * captureScreenshot: true
150
+ * });
151
+ * ```
152
+ */
153
+ export declare function fetchWebContent(url: string, options?: Omit<WebContentFetchOptions, 'url'>): Promise<WebContentFetchResult>;
154
+ //# sourceMappingURL=web-content-fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-content-fetcher.d.ts","sourceRoot":"","sources":["../../../src/integrations/browser/web-content-fetcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgBH;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,eAAe,GACf,oBAAoB,GACpB,YAAY,GACZ,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,+CAA+C;IAC/C,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,2BAA2B;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gCAAgC;IAChC,cAAc,EAAE,SAAS,EAAE,CAAC;IAC5B,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IACxB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,QAAQ,EAAE,OAAO,CAAA;SAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;QACpE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;QAChE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;QACxE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;QACjE,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QACzE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;KAC7D,CAAC;CACH;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqH;IAEtJ;;;;;OAKG;IACG,KAAK,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA2E5E;;OAEG;YACW,aAAa;YAwBb,eAAe;YA2Df,qBAAqB;YAwErB,0BAA0B;YA0K1B,aAAa;YAuDb,kBAAkB;IAgEhC,OAAO,CAAC,KAAK;CAGd;AAMD;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,iBAAiB,CAE3D;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAM,GAChD,OAAO,CAAC,qBAAqB,CAAC,CAGhC"}
@@ -0,0 +1,529 @@
1
+ /**
2
+ * Web Content Fetcher - V3 Browser Cascade
3
+ *
4
+ * Provides resilient web content fetching with a 5-tier cascade:
5
+ * 1. Vibium MCP Browser (best for bot-protected sites)
6
+ * 2. Agent Browser (CLI-based with refs)
7
+ * 3. Playwright + Stealth (headless with anti-detection)
8
+ * 4. Simple HTTP Fetch (for static sites)
9
+ * 5. Web Search Fallback (research-based, last resort)
10
+ *
11
+ * @module integrations/browser/web-content-fetcher
12
+ * @version 1.0.0
13
+ * @since v3
14
+ */
15
+ import { exec, execSync } from 'child_process';
16
+ import { promisify } from 'util';
17
+ import * as fs from 'fs';
18
+ import * as path from 'path';
19
+ import { createBrowserClient, isAgentBrowserAvailable } from './client-factory';
20
+ const execAsync = promisify(exec);
21
+ // ============================================================================
22
+ // WebContentFetcher Class
23
+ // ============================================================================
24
+ /**
25
+ * Fetches web content using a resilient 5-tier cascade
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const fetcher = new WebContentFetcher();
30
+ * const result = await fetcher.fetch({
31
+ * url: 'https://www.example.com',
32
+ * outputDir: '/tmp/fetch-output'
33
+ * });
34
+ *
35
+ * if (result.success) {
36
+ * console.log(`Fetched via ${result.tier}: ${result.contentSize} bytes`);
37
+ * console.log(result.content);
38
+ * }
39
+ * ```
40
+ */
41
+ export class WebContentFetcher {
42
+ defaultTimeout = 60000;
43
+ defaultUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
44
+ /**
45
+ * Fetch web content with automatic tier selection
46
+ *
47
+ * @param options Fetch options
48
+ * @returns Promise<WebContentFetchResult> Fetch result with content and metadata
49
+ */
50
+ async fetch(options) {
51
+ const { url, outputDir = '/tmp/web-content-fetch', timeout = this.defaultTimeout, captureScreenshot = true, skipTiers = [], userAgent = this.defaultUserAgent, locale = 'en-US', dismissCookieBanners = true, mcpTools, } = options;
52
+ // Ensure output directory exists
53
+ if (!fs.existsSync(outputDir)) {
54
+ fs.mkdirSync(outputDir, { recursive: true });
55
+ }
56
+ const result = {
57
+ success: false,
58
+ content: null,
59
+ tier: null,
60
+ status: 'failed',
61
+ contentSize: 0,
62
+ url,
63
+ tiersAttempted: [],
64
+ tierErrors: {},
65
+ };
66
+ const tiersToTry = [
67
+ 'vibium',
68
+ 'agent-browser',
69
+ 'playwright-stealth',
70
+ 'http-fetch',
71
+ 'websearch-fallback',
72
+ ].filter(tier => !skipTiers.includes(tier));
73
+ for (const tier of tiersToTry) {
74
+ result.tiersAttempted.push(tier);
75
+ try {
76
+ const tierResult = await this.fetchWithTier(tier, {
77
+ url,
78
+ outputDir,
79
+ timeout,
80
+ captureScreenshot,
81
+ userAgent,
82
+ locale,
83
+ dismissCookieBanners,
84
+ mcpTools,
85
+ });
86
+ if (tierResult.success && tierResult.content) {
87
+ result.success = true;
88
+ result.content = tierResult.content;
89
+ result.tier = tier;
90
+ result.contentSize = Buffer.byteLength(tierResult.content, 'utf8');
91
+ result.screenshotPath = tierResult.screenshotPath;
92
+ result.metadata = tierResult.metadata;
93
+ result.status = tier === 'websearch-fallback' ? 'degraded' : 'success';
94
+ console.log(`[WebContentFetcher] SUCCESS via ${tier}: ${result.contentSize} bytes`);
95
+ return result;
96
+ }
97
+ }
98
+ catch (error) {
99
+ const errorMessage = error instanceof Error ? error.message : String(error);
100
+ result.tierErrors[tier] = errorMessage;
101
+ console.log(`[WebContentFetcher] ${tier} failed: ${errorMessage}`);
102
+ }
103
+ }
104
+ result.error = 'All fetch tiers failed';
105
+ return result;
106
+ }
107
+ /**
108
+ * Fetch using a specific tier
109
+ */
110
+ async fetchWithTier(tier, options) {
111
+ switch (tier) {
112
+ case 'vibium':
113
+ return this.fetchWithVibium(options);
114
+ case 'agent-browser':
115
+ return this.fetchWithAgentBrowser(options);
116
+ case 'playwright-stealth':
117
+ return this.fetchWithPlaywrightStealth(options);
118
+ case 'http-fetch':
119
+ return this.fetchWithHttp(options);
120
+ case 'websearch-fallback':
121
+ return this.fetchWithWebSearch(options);
122
+ default:
123
+ throw new Error(`Unknown tier: ${tier}`);
124
+ }
125
+ }
126
+ // ========================================================================
127
+ // Tier 1: Vibium MCP Browser
128
+ // ========================================================================
129
+ async fetchWithVibium(options) {
130
+ console.log('[WebContentFetcher] Trying Tier 1: Vibium MCP');
131
+ if (!options.mcpTools?.vibiumLaunch) {
132
+ throw new Error('Vibium MCP tools not provided');
133
+ }
134
+ const { vibiumLaunch, vibiumNavigate, vibiumScreenshot, vibiumFind, vibiumQuit } = options.mcpTools;
135
+ try {
136
+ // Launch browser
137
+ await vibiumLaunch({ headless: true });
138
+ // Navigate to URL
139
+ await vibiumNavigate({ url: options.url });
140
+ // Wait for content to load
141
+ await this.sleep(3000);
142
+ // Get page content
143
+ const bodyResult = await vibiumFind({ selector: 'html' });
144
+ const content = bodyResult?.text || '';
145
+ // Capture screenshot
146
+ let screenshotPath;
147
+ if (options.captureScreenshot) {
148
+ const screenshotFile = path.join(options.outputDir, 'screenshot-vibium.png');
149
+ await vibiumScreenshot({ filename: screenshotFile });
150
+ screenshotPath = screenshotFile;
151
+ }
152
+ // Cleanup
153
+ await vibiumQuit();
154
+ if (!content || content.length < 100) {
155
+ throw new Error('Vibium returned insufficient content');
156
+ }
157
+ return {
158
+ success: true,
159
+ content,
160
+ screenshotPath,
161
+ metadata: { tool: 'vibium-mcp' },
162
+ };
163
+ }
164
+ catch (error) {
165
+ // Ensure cleanup on error
166
+ try {
167
+ await vibiumQuit?.();
168
+ }
169
+ catch { /* ignore cleanup errors */ }
170
+ throw error;
171
+ }
172
+ }
173
+ // ========================================================================
174
+ // Tier 2: Agent Browser (CLI)
175
+ // ========================================================================
176
+ async fetchWithAgentBrowser(options) {
177
+ console.log('[WebContentFetcher] Trying Tier 2: Agent Browser');
178
+ const available = await isAgentBrowserAvailable();
179
+ if (!available) {
180
+ throw new Error('Agent Browser is not available');
181
+ }
182
+ const client = await createBrowserClient({ preference: 'agent-browser' });
183
+ try {
184
+ // Launch browser
185
+ const launchResult = await client.launch({ headless: true });
186
+ if (!launchResult.success) {
187
+ const err = launchResult;
188
+ throw err.error || new Error('Failed to launch agent-browser');
189
+ }
190
+ // Navigate to URL
191
+ const navResult = await client.navigate(options.url);
192
+ if (!navResult.success) {
193
+ const err = navResult;
194
+ throw err.error || new Error('Failed to navigate');
195
+ }
196
+ // Wait for content
197
+ await this.sleep(3000);
198
+ // Get page content via evaluate
199
+ const evalResult = await client.evaluate('document.documentElement.outerHTML');
200
+ if (!evalResult.success || !evalResult.value) {
201
+ throw new Error('Failed to get page content');
202
+ }
203
+ const content = evalResult.value;
204
+ // Capture screenshot
205
+ let screenshotPath;
206
+ if (options.captureScreenshot) {
207
+ const screenshotFile = path.join(options.outputDir, 'screenshot-agent-browser.png');
208
+ const ssResult = await client.screenshot({ path: screenshotFile });
209
+ if (ssResult.success) {
210
+ screenshotPath = screenshotFile;
211
+ }
212
+ }
213
+ // Cleanup
214
+ await client.quit();
215
+ await client.dispose();
216
+ return {
217
+ success: true,
218
+ content,
219
+ screenshotPath,
220
+ metadata: { tool: 'agent-browser' },
221
+ };
222
+ }
223
+ catch (error) {
224
+ // Ensure cleanup
225
+ try {
226
+ await client.quit();
227
+ await client.dispose();
228
+ }
229
+ catch { /* ignore cleanup errors */ }
230
+ throw error;
231
+ }
232
+ }
233
+ // ========================================================================
234
+ // Tier 3: Playwright + Stealth
235
+ // ========================================================================
236
+ async fetchWithPlaywrightStealth(options) {
237
+ console.log('[WebContentFetcher] Trying Tier 3: Playwright + Stealth');
238
+ const workDir = path.join(options.outputDir, 'playwright-work');
239
+ if (!fs.existsSync(workDir)) {
240
+ fs.mkdirSync(workDir, { recursive: true });
241
+ }
242
+ // Check if playwright-extra is installed, install if needed
243
+ const packageJsonPath = path.join(workDir, 'package.json');
244
+ if (!fs.existsSync(packageJsonPath)) {
245
+ fs.writeFileSync(packageJsonPath, JSON.stringify({ name: 'pw-fetch', type: 'commonjs' }));
246
+ try {
247
+ execSync('npm install playwright-extra puppeteer-extra-plugin-stealth playwright', {
248
+ cwd: workDir,
249
+ stdio: 'pipe',
250
+ timeout: 120000,
251
+ });
252
+ }
253
+ catch (installError) {
254
+ console.log('[WebContentFetcher] Playwright install failed, trying with existing installation');
255
+ }
256
+ }
257
+ // Create the fetch script
258
+ const scriptPath = path.join(workDir, 'fetch-stealth.js');
259
+ const outputPath = path.join(workDir, 'content.html');
260
+ const screenshotPath = path.join(options.outputDir, 'screenshot-playwright.png');
261
+ const fetchScript = `
262
+ const { chromium } = require('playwright-extra');
263
+ const stealth = require('puppeteer-extra-plugin-stealth')();
264
+
265
+ chromium.use(stealth);
266
+
267
+ const TARGET_URL = ${JSON.stringify(options.url)};
268
+ const OUTPUT_FILE = ${JSON.stringify(outputPath)};
269
+ const SCREENSHOT_FILE = ${JSON.stringify(screenshotPath)};
270
+ const USER_AGENT = ${JSON.stringify(options.userAgent)};
271
+ const LOCALE = ${JSON.stringify(options.locale)};
272
+ const DISMISS_COOKIES = ${options.dismissCookieBanners};
273
+
274
+ (async () => {
275
+ const browser = await chromium.launch({
276
+ headless: true,
277
+ args: [
278
+ '--no-sandbox',
279
+ '--disable-setuid-sandbox',
280
+ '--disable-dev-shm-usage',
281
+ '--disable-accelerated-2d-canvas',
282
+ '--no-first-run',
283
+ '--no-zygote',
284
+ '--disable-gpu'
285
+ ]
286
+ });
287
+
288
+ const context = await browser.newContext({
289
+ userAgent: USER_AGENT,
290
+ viewport: { width: 1920, height: 1080 },
291
+ locale: LOCALE
292
+ });
293
+
294
+ const page = await context.newPage();
295
+
296
+ try {
297
+ await page.goto(TARGET_URL, {
298
+ waitUntil: 'domcontentloaded',
299
+ timeout: ${options.timeout}
300
+ });
301
+
302
+ // Wait for content to load
303
+ await page.waitForTimeout(3000);
304
+
305
+ // Try to dismiss cookie banners
306
+ if (DISMISS_COOKIES) {
307
+ try {
308
+ const cookieSelectors = [
309
+ '[data-testid="consent-accept-all"]',
310
+ '.consent-accept',
311
+ '#onetrust-accept-btn-handler',
312
+ '[class*="cookie"] button[class*="accept"]',
313
+ 'button[id*="accept"]',
314
+ '[aria-label*="Accept"]'
315
+ ];
316
+
317
+ for (const selector of cookieSelectors) {
318
+ const btn = await page.$(selector);
319
+ if (btn) {
320
+ await btn.click();
321
+ await page.waitForTimeout(1000);
322
+ break;
323
+ }
324
+ }
325
+ } catch (e) {
326
+ // Ignore cookie banner errors
327
+ }
328
+ }
329
+
330
+ // Scroll to trigger lazy loading
331
+ await page.evaluate(() => {
332
+ window.scrollTo(0, document.body.scrollHeight / 2);
333
+ });
334
+ await page.waitForTimeout(2000);
335
+
336
+ // Get content
337
+ const content = await page.content();
338
+ require('fs').writeFileSync(OUTPUT_FILE, content);
339
+
340
+ // Screenshot
341
+ await page.screenshot({ path: SCREENSHOT_FILE, fullPage: false });
342
+
343
+ console.log(JSON.stringify({
344
+ success: true,
345
+ size: content.length,
346
+ title: await page.title()
347
+ }));
348
+
349
+ } catch (error) {
350
+ console.log(JSON.stringify({
351
+ success: false,
352
+ error: error.message
353
+ }));
354
+ process.exit(1);
355
+ } finally {
356
+ await browser.close();
357
+ }
358
+ })();
359
+ `;
360
+ fs.writeFileSync(scriptPath, fetchScript);
361
+ // Run the script
362
+ try {
363
+ const { stdout } = await execAsync(`node ${scriptPath}`, {
364
+ cwd: workDir,
365
+ timeout: options.timeout + 30000,
366
+ });
367
+ const result = JSON.parse(stdout.trim());
368
+ if (!result.success) {
369
+ throw new Error(result.error || 'Playwright fetch failed');
370
+ }
371
+ const content = fs.readFileSync(outputPath, 'utf8');
372
+ return {
373
+ success: true,
374
+ content,
375
+ screenshotPath: fs.existsSync(screenshotPath) ? screenshotPath : undefined,
376
+ metadata: {
377
+ tool: 'playwright-stealth',
378
+ title: result.title,
379
+ },
380
+ };
381
+ }
382
+ catch (error) {
383
+ // Cleanup temp files on error
384
+ try {
385
+ if (fs.existsSync(scriptPath))
386
+ fs.unlinkSync(scriptPath);
387
+ }
388
+ catch { /* ignore */ }
389
+ throw error;
390
+ }
391
+ }
392
+ // ========================================================================
393
+ // Tier 4: Simple HTTP Fetch
394
+ // ========================================================================
395
+ async fetchWithHttp(options) {
396
+ console.log('[WebContentFetcher] Trying Tier 4: HTTP Fetch');
397
+ // Try using MCP webFetch if available
398
+ if (options.mcpTools?.webFetch) {
399
+ const content = await options.mcpTools.webFetch({
400
+ url: options.url,
401
+ prompt: 'Return the complete HTML content of this page',
402
+ });
403
+ if (content && content.length > 100) {
404
+ return {
405
+ success: true,
406
+ content,
407
+ metadata: { tool: 'mcp-webfetch' },
408
+ };
409
+ }
410
+ }
411
+ // Fallback to native fetch
412
+ const response = await fetch(options.url, {
413
+ headers: {
414
+ 'User-Agent': options.userAgent,
415
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
416
+ 'Accept-Language': `${options.locale},en;q=0.5`,
417
+ },
418
+ signal: AbortSignal.timeout(options.timeout),
419
+ });
420
+ if (!response.ok) {
421
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
422
+ }
423
+ const content = await response.text();
424
+ if (content.length < 100) {
425
+ throw new Error('HTTP fetch returned insufficient content');
426
+ }
427
+ return {
428
+ success: true,
429
+ content,
430
+ metadata: {
431
+ tool: 'http-fetch',
432
+ statusCode: response.status,
433
+ },
434
+ };
435
+ }
436
+ // ========================================================================
437
+ // Tier 5: Web Search Fallback
438
+ // ========================================================================
439
+ async fetchWithWebSearch(options) {
440
+ console.log('[WebContentFetcher] Trying Tier 5: WebSearch Fallback');
441
+ if (!options.mcpTools?.webSearch) {
442
+ throw new Error('WebSearch MCP tool not provided - cannot use fallback tier');
443
+ }
444
+ // Extract domain for search
445
+ const urlObj = new URL(options.url);
446
+ const domain = urlObj.hostname;
447
+ const pathname = urlObj.pathname;
448
+ // Search for information about the page
449
+ const searchQuery = `${domain} ${pathname} site features functionality`;
450
+ const searchResults = await options.mcpTools.webSearch({ query: searchQuery });
451
+ if (!searchResults || searchResults.length < 50) {
452
+ throw new Error('WebSearch returned insufficient results');
453
+ }
454
+ // Create a research-based document
455
+ const researchContent = `
456
+ <!DOCTYPE html>
457
+ <html>
458
+ <head>
459
+ <title>Research: ${options.url}</title>
460
+ <meta name="fetch-method" content="websearch-fallback">
461
+ <meta name="fetch-status" content="degraded">
462
+ <meta name="original-url" content="${options.url}">
463
+ <meta name="fetch-date" content="${new Date().toISOString()}">
464
+ </head>
465
+ <body>
466
+ <h1>Research-Based Content: ${domain}</h1>
467
+ <p><strong>Note:</strong> This content was generated from web search research because direct page access was blocked.</p>
468
+ <p><strong>Original URL:</strong> ${options.url}</p>
469
+ <hr>
470
+ <div class="research-content">
471
+ ${searchResults}
472
+ </div>
473
+ </body>
474
+ </html>
475
+ `;
476
+ // Save to file for reference
477
+ const researchPath = path.join(options.outputDir, 'research-content.html');
478
+ fs.writeFileSync(researchPath, researchContent);
479
+ return {
480
+ success: true,
481
+ content: researchContent,
482
+ metadata: {
483
+ tool: 'websearch-fallback',
484
+ searchQuery,
485
+ note: 'Content is research-based, not live page capture',
486
+ },
487
+ };
488
+ }
489
+ // ========================================================================
490
+ // Utility Methods
491
+ // ========================================================================
492
+ sleep(ms) {
493
+ return new Promise(resolve => setTimeout(resolve, ms));
494
+ }
495
+ }
496
+ // ============================================================================
497
+ // Factory Function
498
+ // ============================================================================
499
+ /**
500
+ * Create a new WebContentFetcher instance
501
+ *
502
+ * @returns WebContentFetcher instance
503
+ */
504
+ export function createWebContentFetcher() {
505
+ return new WebContentFetcher();
506
+ }
507
+ // ============================================================================
508
+ // Convenience Function
509
+ // ============================================================================
510
+ /**
511
+ * Fetch web content with a single function call
512
+ *
513
+ * @param url URL to fetch
514
+ * @param options Additional options
515
+ * @returns Promise<WebContentFetchResult> Fetch result
516
+ *
517
+ * @example
518
+ * ```typescript
519
+ * const result = await fetchWebContent('https://example.com', {
520
+ * outputDir: '/tmp/fetch',
521
+ * captureScreenshot: true
522
+ * });
523
+ * ```
524
+ */
525
+ export async function fetchWebContent(url, options = {}) {
526
+ const fetcher = new WebContentFetcher();
527
+ return fetcher.fetch({ url, ...options });
528
+ }
529
+ //# sourceMappingURL=web-content-fetcher.js.map