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.
- package/.claude/agents/v3/README.md +100 -0
- package/.claude/agents/v3/qe-accessibility-auditor.md +112 -11
- package/.claude/agents/v3/qe-bdd-generator.md +40 -0
- package/.claude/agents/v3/qe-coverage-specialist.md +39 -0
- package/.claude/agents/v3/qe-defect-predictor.md +36 -0
- package/.claude/agents/v3/qe-gap-detector.md +39 -0
- package/.claude/agents/v3/qe-pattern-learner.md +31 -0
- package/.claude/agents/v3/qe-product-factors-assessor.md +34 -0
- package/.claude/agents/v3/qe-quality-criteria-recommender.md +32 -0
- package/.claude/agents/v3/qe-quality-gate.md +39 -0
- package/.claude/agents/v3/qe-queen-coordinator.md +332 -166
- package/.claude/agents/v3/qe-requirements-validator.md +37 -0
- package/.claude/agents/v3/qe-risk-assessor.md +33 -0
- package/.claude/agents/v3/qe-tdd-specialist.md +33 -0
- package/.claude/agents/v3/qe-test-architect.md +36 -0
- package/.claude/helpers/statusline-v3.cjs +38 -42
- package/.claude/skills/README.md +30 -104
- package/.claude/skills/a11y-ally/SKILL.md +1658 -0
- package/.claude/skills/qcsd-ideation-swarm/SKILL.md +1750 -0
- package/.claude/skills/skills-manifest.json +78 -8
- package/README.md +18 -4
- package/package.json +1 -1
- package/scripts/cloud-db-config.json +10 -5
- package/scripts/demo-warmup.sh +45 -0
- package/scripts/fetch-content.js +460 -0
- package/scripts/merge-v3-to-root.sql +48 -0
- package/v3/CHANGELOG.md +166 -0
- package/v3/README.md +11 -6
- package/v3/assets/agents/v3/README.md +100 -0
- package/v3/assets/agents/v3/qe-accessibility-auditor.md +112 -11
- package/v3/assets/agents/v3/qe-bdd-generator.md +40 -0
- package/v3/assets/agents/v3/qe-coverage-specialist.md +39 -0
- package/v3/assets/agents/v3/qe-defect-predictor.md +36 -0
- package/v3/assets/agents/v3/qe-gap-detector.md +39 -0
- package/v3/assets/agents/v3/qe-pattern-learner.md +31 -0
- package/v3/assets/agents/v3/qe-product-factors-assessor.md +34 -0
- package/v3/assets/agents/v3/qe-quality-criteria-recommender.md +32 -0
- package/v3/assets/agents/v3/qe-quality-gate.md +39 -0
- package/v3/assets/agents/v3/qe-queen-coordinator.md +332 -166
- package/v3/assets/agents/v3/qe-requirements-validator.md +37 -0
- package/v3/assets/agents/v3/qe-risk-assessor.md +33 -0
- package/v3/assets/agents/v3/qe-tdd-specialist.md +33 -0
- package/v3/assets/agents/v3/qe-test-architect.md +36 -0
- package/v3/assets/hooks/cross-phase-memory.yaml +253 -0
- package/v3/assets/skills/a11y-ally/SKILL.md +1658 -0
- package/v3/assets/skills/qcsd-ideation-swarm/SKILL.md +1750 -0
- package/v3/assets/skills/skills-manifest.json +753 -0
- package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts.map +1 -1
- package/v3/dist/adapters/claude-flow/model-router-bridge.js +6 -4
- package/v3/dist/adapters/claude-flow/model-router-bridge.js.map +1 -1
- package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts.map +1 -1
- package/v3/dist/adapters/claude-flow/pretrain-bridge.js +13 -8
- package/v3/dist/adapters/claude-flow/pretrain-bridge.js.map +1 -1
- package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts.map +1 -1
- package/v3/dist/adapters/claude-flow/trajectory-bridge.js +9 -6
- package/v3/dist/adapters/claude-flow/trajectory-bridge.js.map +1 -1
- package/v3/dist/benchmarks/performance-benchmarks.d.ts.map +1 -1
- package/v3/dist/benchmarks/performance-benchmarks.js +5 -3
- package/v3/dist/benchmarks/performance-benchmarks.js.map +1 -1
- package/v3/dist/cli/bundle.js +27646 -23204
- package/v3/dist/cli/commands/hooks.d.ts.map +1 -1
- package/v3/dist/cli/commands/hooks.js +288 -0
- package/v3/dist/cli/commands/hooks.js.map +1 -1
- package/v3/dist/cli/commands/sync.d.ts.map +1 -1
- package/v3/dist/cli/commands/sync.js +0 -6
- package/v3/dist/cli/commands/sync.js.map +1 -1
- package/v3/dist/cli/handlers/init-handler.d.ts.map +1 -1
- package/v3/dist/cli/handlers/init-handler.js +11 -0
- package/v3/dist/cli/handlers/init-handler.js.map +1 -1
- package/v3/dist/cli/index.js +14 -2
- package/v3/dist/cli/index.js.map +1 -1
- package/v3/dist/cli/scheduler/persistent-scheduler.d.ts.map +1 -1
- package/v3/dist/cli/scheduler/persistent-scheduler.js +3 -2
- package/v3/dist/cli/scheduler/persistent-scheduler.js.map +1 -1
- package/v3/dist/cli/wizards/test-wizard.d.ts.map +1 -1
- package/v3/dist/cli/wizards/test-wizard.js +6 -4
- package/v3/dist/cli/wizards/test-wizard.js.map +1 -1
- package/v3/dist/coordination/consensus/providers/claude-provider.js +1 -1
- package/v3/dist/coordination/consensus/providers/gemini-provider.js +1 -1
- package/v3/dist/coordination/consensus/providers/native-learning-provider.d.ts.map +1 -1
- package/v3/dist/coordination/consensus/providers/native-learning-provider.js +10 -8
- package/v3/dist/coordination/consensus/providers/native-learning-provider.js.map +1 -1
- package/v3/dist/coordination/consensus/providers/ollama-provider.d.ts.map +1 -1
- package/v3/dist/coordination/consensus/providers/ollama-provider.js +5 -4
- package/v3/dist/coordination/consensus/providers/ollama-provider.js.map +1 -1
- package/v3/dist/coordination/consensus/providers/openai-provider.d.ts.map +1 -1
- package/v3/dist/coordination/consensus/providers/openai-provider.js +5 -4
- package/v3/dist/coordination/consensus/providers/openai-provider.js.map +1 -1
- package/v3/dist/coordination/constants.d.ts +198 -0
- package/v3/dist/coordination/constants.d.ts.map +1 -0
- package/v3/dist/coordination/constants.js +210 -0
- package/v3/dist/coordination/constants.js.map +1 -0
- package/v3/dist/coordination/mincut/dream-integration.d.ts.map +1 -1
- package/v3/dist/coordination/mincut/dream-integration.js +5 -1
- package/v3/dist/coordination/mincut/dream-integration.js.map +1 -1
- package/v3/dist/coordination/queen-coordinator.d.ts +9 -1
- package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
- package/v3/dist/coordination/queen-coordinator.js +49 -9
- package/v3/dist/coordination/queen-coordinator.js.map +1 -1
- package/v3/dist/coordination/task-executor.d.ts.map +1 -1
- package/v3/dist/coordination/task-executor.js +7 -8
- package/v3/dist/coordination/task-executor.js.map +1 -1
- package/v3/dist/coordination/workflow-orchestrator.d.ts.map +1 -1
- package/v3/dist/coordination/workflow-orchestrator.js +261 -0
- package/v3/dist/coordination/workflow-orchestrator.js.map +1 -1
- package/v3/dist/domains/chaos-resilience/plugin.d.ts +14 -3
- package/v3/dist/domains/chaos-resilience/plugin.d.ts.map +1 -1
- package/v3/dist/domains/chaos-resilience/plugin.js +96 -0
- package/v3/dist/domains/chaos-resilience/plugin.js.map +1 -1
- package/v3/dist/domains/chaos-resilience/services/performance-profiler.d.ts.map +1 -1
- package/v3/dist/domains/chaos-resilience/services/performance-profiler.js +12 -8
- package/v3/dist/domains/chaos-resilience/services/performance-profiler.js.map +1 -1
- package/v3/dist/domains/code-intelligence/plugin.d.ts +13 -3
- package/v3/dist/domains/code-intelligence/plugin.d.ts.map +1 -1
- package/v3/dist/domains/code-intelligence/plugin.js +85 -0
- package/v3/dist/domains/code-intelligence/plugin.js.map +1 -1
- package/v3/dist/domains/code-intelligence/services/product-factors-bridge.d.ts.map +1 -1
- package/v3/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -2
- package/v3/dist/domains/code-intelligence/services/product-factors-bridge.js.map +1 -1
- package/v3/dist/domains/constants.d.ts +481 -0
- package/v3/dist/domains/constants.d.ts.map +1 -0
- package/v3/dist/domains/constants.js +503 -0
- package/v3/dist/domains/constants.js.map +1 -0
- package/v3/dist/domains/contract-testing/plugin.d.ts +6 -1
- package/v3/dist/domains/contract-testing/plugin.d.ts.map +1 -1
- package/v3/dist/domains/contract-testing/plugin.js +80 -1
- package/v3/dist/domains/contract-testing/plugin.js.map +1 -1
- package/v3/dist/domains/contract-testing/services/contract-validator.d.ts.map +1 -1
- package/v3/dist/domains/contract-testing/services/contract-validator.js +5 -4
- package/v3/dist/domains/contract-testing/services/contract-validator.js.map +1 -1
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.d.ts.map +1 -1
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.js +1 -0
- package/v3/dist/domains/coverage-analysis/services/hnsw-index.js.map +1 -1
- package/v3/dist/domains/defect-intelligence/coordinator.d.ts +2 -2
- package/v3/dist/domains/defect-intelligence/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/defect-intelligence/coordinator.js.map +1 -1
- package/v3/dist/domains/defect-intelligence/plugin.d.ts +6 -1
- package/v3/dist/domains/defect-intelligence/plugin.d.ts.map +1 -1
- package/v3/dist/domains/defect-intelligence/plugin.js +101 -0
- package/v3/dist/domains/defect-intelligence/plugin.js.map +1 -1
- package/v3/dist/domains/defect-intelligence/services/defect-predictor.d.ts.map +1 -1
- package/v3/dist/domains/defect-intelligence/services/defect-predictor.js +3 -2
- package/v3/dist/domains/defect-intelligence/services/defect-predictor.js.map +1 -1
- package/v3/dist/domains/domain-interface.d.ts.map +1 -1
- package/v3/dist/domains/domain-interface.js +24 -9
- package/v3/dist/domains/domain-interface.js.map +1 -1
- package/v3/dist/domains/learning-optimization/plugin.d.ts +2 -1
- package/v3/dist/domains/learning-optimization/plugin.d.ts.map +1 -1
- package/v3/dist/domains/learning-optimization/plugin.js +49 -0
- package/v3/dist/domains/learning-optimization/plugin.js.map +1 -1
- package/v3/dist/domains/quality-assessment/coordinator.d.ts +90 -1
- package/v3/dist/domains/quality-assessment/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/quality-assessment/coordinator.js +310 -0
- package/v3/dist/domains/quality-assessment/coordinator.js.map +1 -1
- package/v3/dist/domains/requirements-validation/index.d.ts +1 -0
- package/v3/dist/domains/requirements-validation/index.d.ts.map +1 -1
- package/v3/dist/domains/requirements-validation/index.js +2 -0
- package/v3/dist/domains/requirements-validation/index.js.map +1 -1
- package/v3/dist/domains/requirements-validation/plugin.d.ts +13 -1
- package/v3/dist/domains/requirements-validation/plugin.d.ts.map +1 -1
- package/v3/dist/domains/requirements-validation/plugin.js +94 -0
- package/v3/dist/domains/requirements-validation/plugin.js.map +1 -1
- package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.d.ts +245 -0
- package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.d.ts.map +1 -0
- package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.js +1143 -0
- package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.js.map +1 -0
- package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.d.ts.map +1 -1
- package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js +3 -2
- package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js.map +1 -1
- package/v3/dist/domains/security-compliance/plugin.d.ts +3 -2
- package/v3/dist/domains/security-compliance/plugin.d.ts.map +1 -1
- package/v3/dist/domains/security-compliance/plugin.js +64 -0
- package/v3/dist/domains/security-compliance/plugin.js.map +1 -1
- package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts +25 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.js +160 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts +48 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.js +385 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts +20 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.js +99 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +62 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.js +329 -0
- package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.d.ts +46 -0
- package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.js +180 -0
- package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/index.d.ts +14 -0
- package/v3/dist/domains/security-compliance/services/scanners/index.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/index.js +16 -0
- package/v3/dist/domains/security-compliance/services/scanners/index.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts +92 -0
- package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.js +440 -0
- package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.d.ts +78 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js +179 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-types.d.ts +91 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-types.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-types.js +15 -0
- package/v3/dist/domains/security-compliance/services/scanners/scanner-types.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/security-patterns.d.ts +16 -0
- package/v3/dist/domains/security-compliance/services/scanners/security-patterns.d.ts.map +1 -0
- package/v3/dist/domains/security-compliance/services/scanners/security-patterns.js +507 -0
- package/v3/dist/domains/security-compliance/services/scanners/security-patterns.js.map +1 -0
- package/v3/dist/domains/security-compliance/services/security-auditor.d.ts.map +1 -1
- package/v3/dist/domains/security-compliance/services/security-auditor.js +2 -1
- package/v3/dist/domains/security-compliance/services/security-auditor.js.map +1 -1
- package/v3/dist/domains/security-compliance/services/security-scanner.d.ts +20 -213
- package/v3/dist/domains/security-compliance/services/security-scanner.d.ts.map +1 -1
- package/v3/dist/domains/security-compliance/services/security-scanner.js +37 -2013
- package/v3/dist/domains/security-compliance/services/security-scanner.js.map +1 -1
- package/v3/dist/domains/security-compliance/services/semgrep-integration.d.ts.map +1 -1
- package/v3/dist/domains/security-compliance/services/semgrep-integration.js +7 -6
- package/v3/dist/domains/security-compliance/services/semgrep-integration.js.map +1 -1
- package/v3/dist/domains/test-execution/services/auth-state-manager.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/services/auth-state-manager.js +6 -4
- package/v3/dist/domains/test-execution/services/auth-state-manager.js.map +1 -1
- package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.d.ts +55 -0
- package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.js +407 -0
- package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts +122 -0
- package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.js +325 -0
- package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts +97 -0
- package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.js +297 -0
- package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/index.d.ts +22 -0
- package/v3/dist/domains/test-execution/services/e2e/index.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/index.js +52 -0
- package/v3/dist/domains/test-execution/services/e2e/index.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/result-collector.d.ts +51 -0
- package/v3/dist/domains/test-execution/services/e2e/result-collector.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/result-collector.js +133 -0
- package/v3/dist/domains/test-execution/services/e2e/result-collector.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/step-executors.d.ts +48 -0
- package/v3/dist/domains/test-execution/services/e2e/step-executors.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/step-executors.js +422 -0
- package/v3/dist/domains/test-execution/services/e2e/step-executors.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.d.ts +49 -0
- package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.js +146 -0
- package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/types.d.ts +138 -0
- package/v3/dist/domains/test-execution/services/e2e/types.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/types.js +65 -0
- package/v3/dist/domains/test-execution/services/e2e/types.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.d.ts +33 -0
- package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.d.ts.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.js +114 -0
- package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.js.map +1 -0
- package/v3/dist/domains/test-execution/services/e2e-runner.d.ts +18 -392
- package/v3/dist/domains/test-execution/services/e2e-runner.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/services/e2e-runner.js +25 -1757
- package/v3/dist/domains/test-execution/services/e2e-runner.js.map +1 -1
- package/v3/dist/domains/test-execution/services/flaky-detector.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/services/flaky-detector.js +12 -9
- package/v3/dist/domains/test-execution/services/flaky-detector.js.map +1 -1
- package/v3/dist/domains/test-execution/services/retry-handler.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/services/retry-handler.js +7 -5
- package/v3/dist/domains/test-execution/services/retry-handler.js.map +1 -1
- package/v3/dist/domains/test-execution/services/test-executor.d.ts.map +1 -1
- package/v3/dist/domains/test-execution/services/test-executor.js +4 -3
- package/v3/dist/domains/test-execution/services/test-executor.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/coordinator.d.ts +70 -0
- package/v3/dist/domains/visual-accessibility/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/coordinator.js +172 -0
- package/v3/dist/domains/visual-accessibility/coordinator.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/plugin.d.ts +2 -1
- package/v3/dist/domains/visual-accessibility/plugin.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/plugin.js +63 -0
- package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js +3 -2
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.js +22 -12
- package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/viewport-capture.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/viewport-capture.js +3 -2
- package/v3/dist/domains/visual-accessibility/services/viewport-capture.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/visual-regression.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/visual-regression.js +3 -2
- package/v3/dist/domains/visual-accessibility/services/visual-regression.js.map +1 -1
- package/v3/dist/hooks/cross-phase-hooks.d.ts +42 -0
- package/v3/dist/hooks/cross-phase-hooks.d.ts.map +1 -0
- package/v3/dist/hooks/cross-phase-hooks.js +338 -0
- package/v3/dist/hooks/cross-phase-hooks.js.map +1 -0
- package/v3/dist/hooks/index.d.ts +9 -0
- package/v3/dist/hooks/index.d.ts.map +1 -0
- package/v3/dist/hooks/index.js +9 -0
- package/v3/dist/hooks/index.js.map +1 -0
- package/v3/dist/init/agents-installer.d.ts.map +1 -1
- package/v3/dist/init/agents-installer.js +6 -4
- package/v3/dist/init/agents-installer.js.map +1 -1
- package/v3/dist/init/enhancements/claude-flow-adapter.d.ts.map +1 -1
- package/v3/dist/init/enhancements/claude-flow-adapter.js +15 -9
- package/v3/dist/init/enhancements/claude-flow-adapter.js.map +1 -1
- package/v3/dist/init/enhancements/detector.js +6 -4
- package/v3/dist/init/enhancements/detector.js.map +1 -1
- package/v3/dist/init/init-wizard.d.ts +5 -0
- package/v3/dist/init/init-wizard.d.ts.map +1 -1
- package/v3/dist/init/init-wizard.js +77 -14
- package/v3/dist/init/init-wizard.js.map +1 -1
- package/v3/dist/init/migration/data-migrator.d.ts.map +1 -1
- package/v3/dist/init/migration/data-migrator.js +6 -4
- package/v3/dist/init/migration/data-migrator.js.map +1 -1
- package/v3/dist/init/phases/02-analysis.js +2 -2
- package/v3/dist/init/phases/02-analysis.js.map +1 -1
- package/v3/dist/init/phases/04-database.d.ts.map +1 -1
- package/v3/dist/init/phases/04-database.js +0 -1
- package/v3/dist/init/phases/04-database.js.map +1 -1
- package/v3/dist/init/phases/05-learning.js +1 -1
- package/v3/dist/init/phases/05-learning.js.map +1 -1
- package/v3/dist/init/phases/11-claude-md.d.ts.map +1 -1
- package/v3/dist/init/phases/11-claude-md.js +25 -0
- package/v3/dist/init/phases/11-claude-md.js.map +1 -1
- package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
- package/v3/dist/init/phases/12-verification.js +2 -1
- package/v3/dist/init/phases/12-verification.js.map +1 -1
- package/v3/dist/init/project-analyzer.d.ts.map +1 -1
- package/v3/dist/init/project-analyzer.js +12 -8
- package/v3/dist/init/project-analyzer.js.map +1 -1
- package/v3/dist/init/skills-installer.d.ts.map +1 -1
- package/v3/dist/init/skills-installer.js +6 -4
- package/v3/dist/init/skills-installer.js.map +1 -1
- package/v3/dist/init/token-bootstrap.d.ts.map +1 -1
- package/v3/dist/init/token-bootstrap.js +2 -1
- package/v3/dist/init/token-bootstrap.js.map +1 -1
- package/v3/dist/integrations/agent-booster-wasm/index.d.ts.map +1 -1
- package/v3/dist/integrations/agent-booster-wasm/index.js +8 -4
- package/v3/dist/integrations/agent-booster-wasm/index.js.map +1 -1
- package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts.map +1 -1
- package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js +3 -2
- package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js.map +1 -1
- package/v3/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts.map +1 -1
- package/v3/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js.map +1 -1
- package/v3/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.d.ts.map +1 -1
- package/v3/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js.map +1 -1
- package/v3/dist/integrations/browser/agent-browser/client.d.ts.map +1 -1
- package/v3/dist/integrations/browser/agent-browser/client.js +9 -6
- package/v3/dist/integrations/browser/agent-browser/client.js.map +1 -1
- package/v3/dist/integrations/browser/agent-browser/command-executor.d.ts.map +1 -1
- package/v3/dist/integrations/browser/agent-browser/command-executor.js +3 -2
- package/v3/dist/integrations/browser/agent-browser/command-executor.js.map +1 -1
- package/v3/dist/integrations/browser/index.d.ts +1 -0
- package/v3/dist/integrations/browser/index.d.ts.map +1 -1
- package/v3/dist/integrations/browser/index.js +6 -0
- package/v3/dist/integrations/browser/index.js.map +1 -1
- package/v3/dist/integrations/browser/web-content-fetcher.d.ts +154 -0
- package/v3/dist/integrations/browser/web-content-fetcher.d.ts.map +1 -0
- package/v3/dist/integrations/browser/web-content-fetcher.js +529 -0
- package/v3/dist/integrations/browser/web-content-fetcher.js.map +1 -0
- package/v3/dist/integrations/coherence/threshold-tuner.d.ts.map +1 -1
- package/v3/dist/integrations/coherence/threshold-tuner.js +3 -2
- package/v3/dist/integrations/coherence/threshold-tuner.js.map +1 -1
- package/v3/dist/integrations/coherence/wasm-loader.d.ts.map +1 -1
- package/v3/dist/integrations/coherence/wasm-loader.js +3 -2
- package/v3/dist/integrations/coherence/wasm-loader.js.map +1 -1
- package/v3/dist/integrations/n8n/agent-factory.d.ts.map +1 -1
- package/v3/dist/integrations/n8n/agent-factory.js +6 -4
- package/v3/dist/integrations/n8n/agent-factory.js.map +1 -1
- package/v3/dist/integrations/rl-suite/persistence/q-value-store.d.ts.map +1 -1
- package/v3/dist/integrations/rl-suite/persistence/q-value-store.js.map +1 -1
- package/v3/dist/integrations/ruvector/interfaces.js +1 -1
- package/v3/dist/integrations/ruvector/interfaces.js.map +1 -1
- package/v3/dist/integrations/ruvector/sona-persistence.d.ts.map +1 -1
- package/v3/dist/integrations/ruvector/sona-persistence.js +6 -4
- package/v3/dist/integrations/ruvector/sona-persistence.js.map +1 -1
- package/v3/dist/integrations/vibium/client.d.ts.map +1 -1
- package/v3/dist/integrations/vibium/client.js +3 -2
- package/v3/dist/integrations/vibium/client.js.map +1 -1
- package/v3/dist/kernel/agent-coordinator.d.ts +1 -1
- package/v3/dist/kernel/agent-coordinator.d.ts.map +1 -1
- package/v3/dist/kernel/agent-coordinator.js +4 -4
- package/v3/dist/kernel/agent-coordinator.js.map +1 -1
- package/v3/dist/kernel/constants.d.ts +155 -0
- package/v3/dist/kernel/constants.d.ts.map +1 -0
- package/v3/dist/kernel/constants.js +169 -0
- package/v3/dist/kernel/constants.js.map +1 -0
- package/v3/dist/kernel/event-bus.d.ts +8 -0
- package/v3/dist/kernel/event-bus.d.ts.map +1 -1
- package/v3/dist/kernel/event-bus.js +79 -17
- package/v3/dist/kernel/event-bus.js.map +1 -1
- package/v3/dist/kernel/hybrid-backend.d.ts.map +1 -1
- package/v3/dist/kernel/hybrid-backend.js +4 -3
- package/v3/dist/kernel/hybrid-backend.js.map +1 -1
- package/v3/dist/kernel/index.d.ts +1 -1
- package/v3/dist/kernel/index.d.ts.map +1 -1
- package/v3/dist/kernel/index.js +3 -1
- package/v3/dist/kernel/index.js.map +1 -1
- package/v3/dist/kernel/kernel.d.ts.map +1 -1
- package/v3/dist/kernel/kernel.js +3 -2
- package/v3/dist/kernel/kernel.js.map +1 -1
- package/v3/dist/kernel/memory-backend.d.ts.map +1 -1
- package/v3/dist/kernel/memory-backend.js +4 -3
- package/v3/dist/kernel/memory-backend.js.map +1 -1
- package/v3/dist/kernel/unified-memory.d.ts +26 -0
- package/v3/dist/kernel/unified-memory.d.ts.map +1 -1
- package/v3/dist/kernel/unified-memory.js +68 -13
- package/v3/dist/kernel/unified-memory.js.map +1 -1
- package/v3/dist/kernel/unified-persistence.js +3 -2
- package/v3/dist/kernel/unified-persistence.js.map +1 -1
- package/v3/dist/learning/aqe-learning-engine.d.ts.map +1 -1
- package/v3/dist/learning/aqe-learning-engine.js +12 -8
- package/v3/dist/learning/aqe-learning-engine.js.map +1 -1
- package/v3/dist/learning/dream/index.d.ts +1 -1
- package/v3/dist/learning/dream/index.d.ts.map +1 -1
- package/v3/dist/learning/dream/index.js +3 -1
- package/v3/dist/learning/dream/index.js.map +1 -1
- package/v3/dist/learning/dream/spreading-activation.d.ts +41 -0
- package/v3/dist/learning/dream/spreading-activation.d.ts.map +1 -1
- package/v3/dist/learning/dream/spreading-activation.js +79 -0
- package/v3/dist/learning/dream/spreading-activation.js.map +1 -1
- package/v3/dist/learning/pattern-store.d.ts.map +1 -1
- package/v3/dist/learning/pattern-store.js +16 -6
- package/v3/dist/learning/pattern-store.js.map +1 -1
- package/v3/dist/learning/qe-unified-memory.js +1 -1
- package/v3/dist/learning/qe-unified-memory.js.map +1 -1
- package/v3/dist/learning/real-embeddings.d.ts.map +1 -1
- package/v3/dist/learning/real-embeddings.js +7 -1
- package/v3/dist/learning/real-embeddings.js.map +1 -1
- package/v3/dist/learning/real-qe-reasoning-bank.js +2 -2
- package/v3/dist/learning/real-qe-reasoning-bank.js.map +1 -1
- package/v3/dist/learning/sqlite-persistence.d.ts +2 -2
- package/v3/dist/learning/sqlite-persistence.d.ts.map +1 -1
- package/v3/dist/learning/sqlite-persistence.js +1 -1
- package/v3/dist/learning/sqlite-persistence.js.map +1 -1
- package/v3/dist/learning/v2-to-v3-migration.d.ts +2 -2
- package/v3/dist/learning/v2-to-v3-migration.d.ts.map +1 -1
- package/v3/dist/learning/v2-to-v3-migration.js +2 -2
- package/v3/dist/learning/v2-to-v3-migration.js.map +1 -1
- package/v3/dist/logging/console-logger.d.ts +96 -0
- package/v3/dist/logging/console-logger.d.ts.map +1 -0
- package/v3/dist/logging/console-logger.js +247 -0
- package/v3/dist/logging/console-logger.js.map +1 -0
- package/v3/dist/logging/index.d.ts +42 -0
- package/v3/dist/logging/index.d.ts.map +1 -0
- package/v3/dist/logging/index.js +39 -0
- package/v3/dist/logging/index.js.map +1 -0
- package/v3/dist/logging/logger-factory.d.ts +145 -0
- package/v3/dist/logging/logger-factory.d.ts.map +1 -0
- package/v3/dist/logging/logger-factory.js +218 -0
- package/v3/dist/logging/logger-factory.js.map +1 -0
- package/v3/dist/logging/logger.d.ts +89 -0
- package/v3/dist/logging/logger.d.ts.map +1 -0
- package/v3/dist/logging/logger.js +74 -0
- package/v3/dist/logging/logger.js.map +1 -0
- package/v3/dist/mcp/bundle.js +11385 -7526
- package/v3/dist/mcp/handlers/agent-handlers.js +2 -2
- package/v3/dist/mcp/handlers/agent-handlers.js.map +1 -1
- package/v3/dist/mcp/handlers/core-handlers.d.ts +2 -0
- package/v3/dist/mcp/handlers/core-handlers.d.ts.map +1 -1
- package/v3/dist/mcp/handlers/core-handlers.js +33 -0
- package/v3/dist/mcp/handlers/core-handlers.js.map +1 -1
- package/v3/dist/mcp/handlers/cross-phase-handlers.d.ts +110 -0
- package/v3/dist/mcp/handlers/cross-phase-handlers.d.ts.map +1 -0
- package/v3/dist/mcp/handlers/cross-phase-handlers.js +216 -0
- package/v3/dist/mcp/handlers/cross-phase-handlers.js.map +1 -0
- package/v3/dist/mcp/handlers/domain-handler-configs.d.ts +151 -0
- package/v3/dist/mcp/handlers/domain-handler-configs.d.ts.map +1 -0
- package/v3/dist/mcp/handlers/domain-handler-configs.js +486 -0
- package/v3/dist/mcp/handlers/domain-handler-configs.js.map +1 -0
- package/v3/dist/mcp/handlers/domain-handlers.d.ts +174 -120
- package/v3/dist/mcp/handlers/domain-handlers.d.ts.map +1 -1
- package/v3/dist/mcp/handlers/domain-handlers.js +178 -1049
- package/v3/dist/mcp/handlers/domain-handlers.js.map +1 -1
- package/v3/dist/mcp/handlers/handler-factory.d.ts +182 -0
- package/v3/dist/mcp/handlers/handler-factory.d.ts.map +1 -0
- package/v3/dist/mcp/handlers/handler-factory.js +327 -0
- package/v3/dist/mcp/handlers/handler-factory.js.map +1 -0
- package/v3/dist/mcp/handlers/index.d.ts +1 -0
- package/v3/dist/mcp/handlers/index.d.ts.map +1 -1
- package/v3/dist/mcp/handlers/index.js +2 -0
- package/v3/dist/mcp/handlers/index.js.map +1 -1
- package/v3/dist/mcp/handlers/task-handlers.d.ts +1 -0
- package/v3/dist/mcp/handlers/task-handlers.d.ts.map +1 -1
- package/v3/dist/mcp/handlers/task-handlers.js +91 -7
- package/v3/dist/mcp/handlers/task-handlers.js.map +1 -1
- package/v3/dist/mcp/server.d.ts.map +1 -1
- package/v3/dist/mcp/server.js +107 -1
- package/v3/dist/mcp/server.js.map +1 -1
- package/v3/dist/mcp/types.d.ts +5 -3
- package/v3/dist/mcp/types.d.ts.map +1 -1
- package/v3/dist/memory/cross-phase-memory.d.ts +55 -0
- package/v3/dist/memory/cross-phase-memory.d.ts.map +1 -0
- package/v3/dist/memory/cross-phase-memory.js +265 -0
- package/v3/dist/memory/cross-phase-memory.js.map +1 -0
- package/v3/dist/memory/index.d.ts +9 -0
- package/v3/dist/memory/index.d.ts.map +1 -0
- package/v3/dist/memory/index.js +9 -0
- package/v3/dist/memory/index.js.map +1 -0
- package/v3/dist/shared/io/file-reader.d.ts.map +1 -1
- package/v3/dist/shared/io/file-reader.js +3 -2
- package/v3/dist/shared/io/file-reader.js.map +1 -1
- package/v3/dist/shared/utils/binary-insert.d.ts +85 -0
- package/v3/dist/shared/utils/binary-insert.d.ts.map +1 -0
- package/v3/dist/shared/utils/binary-insert.js +122 -0
- package/v3/dist/shared/utils/binary-insert.js.map +1 -0
- package/v3/dist/shared/utils/index.d.ts +1 -0
- package/v3/dist/shared/utils/index.d.ts.map +1 -1
- package/v3/dist/shared/utils/index.js +1 -0
- package/v3/dist/shared/utils/index.js.map +1 -1
- package/v3/dist/strange-loop/belief-reconciler.d.ts.map +1 -1
- package/v3/dist/strange-loop/belief-reconciler.js +3 -2
- package/v3/dist/strange-loop/belief-reconciler.js.map +1 -1
- package/v3/dist/sync/claude-flow-bridge.d.ts +1 -1
- package/v3/dist/sync/claude-flow-bridge.d.ts.map +1 -1
- package/v3/dist/sync/claude-flow-bridge.js +7 -5
- package/v3/dist/sync/claude-flow-bridge.js.map +1 -1
- package/v3/dist/sync/cloud/postgres-writer.d.ts.map +1 -1
- package/v3/dist/sync/cloud/postgres-writer.js +0 -1
- package/v3/dist/sync/cloud/postgres-writer.js.map +1 -1
- package/v3/dist/sync/interfaces.d.ts +6 -0
- package/v3/dist/sync/interfaces.d.ts.map +1 -1
- package/v3/dist/sync/interfaces.js +34 -47
- package/v3/dist/sync/interfaces.js.map +1 -1
- package/v3/dist/sync/readers/sqlite-reader.d.ts +1 -1
- package/v3/dist/sync/readers/sqlite-reader.d.ts.map +1 -1
- package/v3/dist/sync/readers/sqlite-reader.js +4 -3
- package/v3/dist/sync/readers/sqlite-reader.js.map +1 -1
- package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.d.ts.map +1 -1
- package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.js +3 -2
- package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.js.map +1 -1
- package/v3/dist/test-scheduling/git-aware/test-selector.d.ts.map +1 -1
- package/v3/dist/test-scheduling/git-aware/test-selector.js +3 -2
- package/v3/dist/test-scheduling/git-aware/test-selector.js.map +1 -1
- package/v3/dist/types/cross-phase-signals.d.ts +119 -0
- package/v3/dist/types/cross-phase-signals.d.ts.map +1 -0
- package/v3/dist/types/cross-phase-signals.js +33 -0
- package/v3/dist/types/cross-phase-signals.js.map +1 -0
- package/v3/dist/types/index.d.ts +9 -0
- package/v3/dist/types/index.d.ts.map +1 -0
- package/v3/dist/types/index.js +9 -0
- package/v3/dist/types/index.js.map +1 -0
- package/v3/dist/workers/worker-manager.d.ts.map +1 -1
- package/v3/dist/workers/worker-manager.js +3 -2
- package/v3/dist/workers/worker-manager.js.map +1 -1
- package/v3/dist/workflows/browser/workflow-loader.d.ts +3 -3
- package/v3/dist/workflows/browser/workflow-loader.d.ts.map +1 -1
- package/v3/dist/workflows/browser/workflow-loader.js.map +1 -1
- 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
|