@taodigital/crawler 0.0.0-stage → 1.2.1
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/Dockerfile +82 -0
- package/README.md +10 -2
- package/dist/accessibility-auditor.d.ts +29 -0
- package/dist/accessibility-auditor.js +57 -0
- package/dist/accessibility-auditor.js.map +7 -0
- package/dist/accessibility-tree-crawler.d.ts +44 -0
- package/dist/accessibility-tree-crawler.js +156 -0
- package/dist/accessibility-tree-crawler.js.map +7 -0
- package/dist/advanced-ui-probes.d.ts +47 -0
- package/dist/advanced-ui-probes.js +310 -0
- package/dist/advanced-ui-probes.js.map +7 -0
- package/dist/ai-login.d.ts +32 -0
- package/dist/ai-login.js +250 -0
- package/dist/ai-login.js.map +7 -0
- package/dist/auth-token-rotator.d.ts +47 -0
- package/dist/auth-token-rotator.js +58 -0
- package/dist/auth-token-rotator.js.map +7 -0
- package/dist/auth.d.ts +20 -0
- package/dist/auth.js +348 -0
- package/dist/auth.js.map +7 -0
- package/dist/browser-extension.d.ts +37 -0
- package/dist/browser-extension.js +113 -0
- package/dist/browser-extension.js.map +7 -0
- package/dist/captcha-solver.d.ts +16 -0
- package/dist/captcha-solver.js +105 -0
- package/dist/captcha-solver.js.map +7 -0
- package/dist/color-contrast.d.ts +30 -0
- package/dist/color-contrast.js +78 -0
- package/dist/color-contrast.js.map +7 -0
- package/dist/content-chunker.d.ts +18 -0
- package/dist/content-chunker.js +152 -0
- package/dist/content-chunker.js.map +7 -0
- package/dist/content-dedup.d.ts +23 -0
- package/dist/content-dedup.js +60 -0
- package/dist/content-dedup.js.map +7 -0
- package/dist/cookie-consent.d.ts +25 -0
- package/dist/cookie-consent.js +78 -0
- package/dist/cookie-consent.js.map +7 -0
- package/dist/cookie-jar.d.ts +20 -0
- package/dist/cookie-jar.js +61 -0
- package/dist/cookie-jar.js.map +7 -0
- package/dist/crawl-session-manager.d.ts +44 -0
- package/dist/crawl-session-manager.js +145 -0
- package/dist/crawl-session-manager.js.map +7 -0
- package/dist/crawler.d.ts +233 -0
- package/dist/crawler.js +6239 -0
- package/dist/crawler.js.map +7 -0
- package/dist/crud-interaction.d.ts +31 -0
- package/dist/crud-interaction.js +264 -0
- package/dist/crud-interaction.js.map +7 -0
- package/dist/custom-js-injector.d.ts +42 -0
- package/dist/custom-js-injector.js +50 -0
- package/dist/custom-js-injector.js.map +7 -0
- package/dist/dark-mode-capture.d.ts +23 -0
- package/dist/dark-mode-capture.js +75 -0
- package/dist/dark-mode-capture.js.map +7 -0
- package/dist/dead-link-detector.d.ts +37 -0
- package/dist/dead-link-detector.js +50 -0
- package/dist/dead-link-detector.js.map +7 -0
- package/dist/dropdown-enumerator.d.ts +20 -0
- package/dist/dropdown-enumerator.js +230 -0
- package/dist/dropdown-enumerator.js.map +7 -0
- package/dist/element-hash.d.ts +9 -0
- package/dist/element-hash.js +9 -0
- package/dist/element-hash.js.map +7 -0
- package/dist/email-otp.d.ts +42 -0
- package/dist/email-otp.js +177 -0
- package/dist/email-otp.js.map +7 -0
- package/dist/engine-router.d.ts +47 -0
- package/dist/engine-router.js +94 -0
- package/dist/engine-router.js.map +7 -0
- package/dist/export/bulk-export.d.ts +26 -0
- package/dist/export/bulk-export.js +76 -0
- package/dist/export/bulk-export.js.map +7 -0
- package/dist/export/vector-export.d.ts +76 -0
- package/dist/export/vector-export.js +85 -0
- package/dist/export/vector-export.js.map +7 -0
- package/dist/extractors/advanced.d.ts +64 -0
- package/dist/extractors/advanced.js +265 -0
- package/dist/extractors/advanced.js.map +7 -0
- package/dist/extractors/artifact-envelope.d.ts +63 -0
- package/dist/extractors/artifact-envelope.js +63 -0
- package/dist/extractors/artifact-envelope.js.map +7 -0
- package/dist/extractors/branding-extractor.d.ts +46 -0
- package/dist/extractors/branding-extractor.js +104 -0
- package/dist/extractors/branding-extractor.js.map +7 -0
- package/dist/extractors/summary-extractor.d.ts +10 -0
- package/dist/extractors/summary-extractor.js +36 -0
- package/dist/extractors/summary-extractor.js.map +7 -0
- package/dist/failure-analysis-agent.d.ts +16 -0
- package/dist/failure-analysis-agent.js +42 -0
- package/dist/failure-analysis-agent.js.map +7 -0
- package/dist/feature-flag-detector.d.ts +30 -0
- package/dist/feature-flag-detector.js +55 -0
- package/dist/feature-flag-detector.js.map +7 -0
- package/dist/filter-pagination-crawler.d.ts +52 -0
- package/dist/filter-pagination-crawler.js +299 -0
- package/dist/filter-pagination-crawler.js.map +7 -0
- package/dist/form-detector.d.ts +34 -0
- package/dist/form-detector.js +58 -0
- package/dist/form-detector.js.map +7 -0
- package/dist/frontier.d.ts +40 -0
- package/dist/frontier.js +103 -0
- package/dist/frontier.js.map +7 -0
- package/dist/gap-pass.d.ts +36 -0
- package/dist/gap-pass.js +115 -0
- package/dist/gap-pass.js.map +7 -0
- package/dist/graphql-detector.d.ts +39 -0
- package/dist/graphql-detector.js +86 -0
- package/dist/graphql-detector.js.map +7 -0
- package/dist/http-engine.d.ts +80 -0
- package/dist/http-engine.js +318 -0
- package/dist/http-engine.js.map +7 -0
- package/dist/incremental-diff.d.ts +116 -0
- package/dist/incremental-diff.js +137 -0
- package/dist/incremental-diff.js.map +7 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +7 -0
- package/dist/input-fuzzer.d.ts +30 -0
- package/dist/input-fuzzer.js +105 -0
- package/dist/input-fuzzer.js.map +7 -0
- package/dist/interactive-probe.d.ts +144 -0
- package/dist/interactive-probe.js +865 -0
- package/dist/interactive-probe.js.map +7 -0
- package/dist/job-queue.d.ts +297 -0
- package/dist/job-queue.js +3812 -0
- package/dist/job-queue.js.map +7 -0
- package/dist/js-coverage.d.ts +29 -0
- package/dist/js-coverage.js +56 -0
- package/dist/js-coverage.js.map +7 -0
- package/dist/js-router-detector.d.ts +17 -0
- package/dist/js-router-detector.js +90 -0
- package/dist/js-router-detector.js.map +7 -0
- package/dist/language-detector.d.ts +22 -0
- package/dist/language-detector.js +57 -0
- package/dist/language-detector.js.map +7 -0
- package/dist/link-classifier.d.ts +23 -0
- package/dist/link-classifier.js +40 -0
- package/dist/link-classifier.js.map +7 -0
- package/dist/live-view.d.ts +36 -0
- package/dist/live-view.js +105 -0
- package/dist/live-view.js.map +7 -0
- package/dist/locator-extractor.d.ts +46 -0
- package/dist/locator-extractor.js +220 -0
- package/dist/locator-extractor.js.map +7 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +10 -0
- package/dist/logger.js.map +7 -0
- package/dist/markdown-extract.d.ts +8 -0
- package/dist/markdown-extract.js +54 -0
- package/dist/markdown-extract.js.map +7 -0
- package/dist/multi-context-handler.d.ts +55 -0
- package/dist/multi-context-handler.js +182 -0
- package/dist/multi-context-handler.js.map +7 -0
- package/dist/native-crawler.d.ts +69 -0
- package/dist/native-crawler.js +839 -0
- package/dist/native-crawler.js.map +7 -0
- package/dist/nested-window-crawler.d.ts +41 -0
- package/dist/nested-window-crawler.js +172 -0
- package/dist/nested-window-crawler.js.map +7 -0
- package/dist/network-action-correlator.d.ts +47 -0
- package/dist/network-action-correlator.js +209 -0
- package/dist/network-action-correlator.js.map +7 -0
- package/dist/network-observer.d.ts +49 -0
- package/dist/network-observer.js +149 -0
- package/dist/network-observer.js.map +7 -0
- package/dist/network-throttle.d.ts +25 -0
- package/dist/network-throttle.js +34 -0
- package/dist/network-throttle.js.map +7 -0
- package/dist/openapi-generator.d.ts +49 -0
- package/dist/openapi-generator.js +89 -0
- package/dist/openapi-generator.js.map +7 -0
- package/dist/pdf-extractor.d.ts +28 -0
- package/dist/pdf-extractor.js +81 -0
- package/dist/pdf-extractor.js.map +7 -0
- package/dist/performance-metrics-collector.d.ts +50 -0
- package/dist/performance-metrics-collector.js +155 -0
- package/dist/performance-metrics-collector.js.map +7 -0
- package/dist/performance-metrics.d.ts +52 -0
- package/dist/performance-metrics.js +83 -0
- package/dist/performance-metrics.js.map +7 -0
- package/dist/phash.d.ts +50 -0
- package/dist/phash.js +136 -0
- package/dist/phash.js.map +7 -0
- package/dist/pii-scrubber.d.ts +21 -0
- package/dist/pii-scrubber.js +75 -0
- package/dist/pii-scrubber.js.map +7 -0
- package/dist/playwright-recorder.d.ts +39 -0
- package/dist/playwright-recorder.js +123 -0
- package/dist/playwright-recorder.js.map +7 -0
- package/dist/policies/crawl-safety.d.ts +9 -0
- package/dist/policies/crawl-safety.js +41 -0
- package/dist/policies/crawl-safety.js.map +7 -0
- package/dist/profiles/domain-profile.d.ts +19 -0
- package/dist/profiles/domain-profile.js +160 -0
- package/dist/profiles/domain-profile.js.map +7 -0
- package/dist/proxy.d.ts +50 -0
- package/dist/proxy.js +165 -0
- package/dist/proxy.js.map +7 -0
- package/dist/rate-limiter.d.ts +31 -0
- package/dist/rate-limiter.js +64 -0
- package/dist/rate-limiter.js.map +7 -0
- package/dist/redirect-tracker.d.ts +37 -0
- package/dist/redirect-tracker.js +65 -0
- package/dist/redirect-tracker.js.map +7 -0
- package/dist/redis-frontier.d.ts +48 -0
- package/dist/redis-frontier.js +126 -0
- package/dist/redis-frontier.js.map +7 -0
- package/dist/redis-queue.d.ts +48 -0
- package/dist/redis-queue.js +165 -0
- package/dist/redis-queue.js.map +7 -0
- package/dist/response-cache.d.ts +38 -0
- package/dist/response-cache.js +140 -0
- package/dist/response-cache.js.map +7 -0
- package/dist/responsive-detector.d.ts +29 -0
- package/dist/responsive-detector.js +46 -0
- package/dist/responsive-detector.js.map +7 -0
- package/dist/retry-policy.d.ts +20 -0
- package/dist/retry-policy.js +54 -0
- package/dist/retry-policy.js.map +7 -0
- package/dist/robots-txt.d.ts +9 -0
- package/dist/robots-txt.js +77 -0
- package/dist/robots-txt.js.map +7 -0
- package/dist/screen-reader.d.ts +15 -0
- package/dist/screen-reader.js +48 -0
- package/dist/screen-reader.js.map +7 -0
- package/dist/screenshot-masker.d.ts +28 -0
- package/dist/screenshot-masker.js +62 -0
- package/dist/screenshot-masker.js.map +7 -0
- package/dist/seo-checker.d.ts +33 -0
- package/dist/seo-checker.js +91 -0
- package/dist/seo-checker.js.map +7 -0
- package/dist/service-worker-interceptor.d.ts +36 -0
- package/dist/service-worker-interceptor.js +136 -0
- package/dist/service-worker-interceptor.js.map +7 -0
- package/dist/session-capture.d.ts +39 -0
- package/dist/session-capture.js +274 -0
- package/dist/session-capture.js.map +7 -0
- package/dist/session-export.d.ts +49 -0
- package/dist/session-export.js +117 -0
- package/dist/session-export.js.map +7 -0
- package/dist/shadow-dom-crawler.d.ts +35 -0
- package/dist/shadow-dom-crawler.js +132 -0
- package/dist/shadow-dom-crawler.js.map +7 -0
- package/dist/sitemap-writer.d.ts +21 -0
- package/dist/sitemap-writer.js +47 -0
- package/dist/sitemap-writer.js.map +7 -0
- package/dist/sitemap.d.ts +51 -0
- package/dist/sitemap.js +160 -0
- package/dist/sitemap.js.map +7 -0
- package/dist/skyvern.d.ts +56 -0
- package/dist/skyvern.js +129 -0
- package/dist/skyvern.js.map +7 -0
- package/dist/sqs-queue.d.ts +13 -0
- package/dist/sqs-queue.js +115 -0
- package/dist/sqs-queue.js.map +7 -0
- package/dist/sso-token.d.ts +29 -0
- package/dist/sso-token.js +76 -0
- package/dist/sso-token.js.map +7 -0
- package/dist/state-graph.d.ts +59 -0
- package/dist/state-graph.js +193 -0
- package/dist/state-graph.js.map +7 -0
- package/dist/stealth/human-behavior.d.ts +20 -0
- package/dist/stealth/human-behavior.js +202 -0
- package/dist/stealth/human-behavior.js.map +7 -0
- package/dist/telemetry.d.ts +34 -0
- package/dist/telemetry.js +77 -0
- package/dist/telemetry.js.map +7 -0
- package/dist/test-executor.d.ts +81 -0
- package/dist/test-executor.js +443 -0
- package/dist/test-executor.js.map +7 -0
- package/dist/tls-fingerprint.d.ts +50 -0
- package/dist/tls-fingerprint.js +81 -0
- package/dist/tls-fingerprint.js.map +7 -0
- package/dist/url-pattern-completer.d.ts +28 -0
- package/dist/url-pattern-completer.js +122 -0
- package/dist/url-pattern-completer.js.map +7 -0
- package/dist/visual-diff-verdict.d.ts +40 -0
- package/dist/visual-diff-verdict.js +27 -0
- package/dist/visual-diff-verdict.js.map +7 -0
- package/dist/webhook-notifier.d.ts +30 -0
- package/dist/webhook-notifier.js +76 -0
- package/dist/webhook-notifier.js.map +7 -0
- package/dist/websocket-detector.d.ts +24 -0
- package/dist/websocket-detector.js +60 -0
- package/dist/websocket-detector.js.map +7 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +33 -0
- package/dist/worker.js.map +7 -0
- package/package.json +49 -4
- package/src/accessibility-auditor.ts +102 -0
- package/src/accessibility-tree-crawler.ts +246 -0
- package/src/advanced-ui-probes.ts +470 -0
- package/src/ai-login.ts +298 -0
- package/src/auth-token-rotator.ts +89 -0
- package/src/auth.ts +418 -0
- package/src/browser-extension.ts +186 -0
- package/src/captcha-solver.ts +143 -0
- package/src/color-contrast.ts +116 -0
- package/src/content-chunker.ts +170 -0
- package/src/content-dedup.ts +99 -0
- package/src/cookie-consent.ts +106 -0
- package/src/cookie-jar.ts +91 -0
- package/src/crawl-session-manager.ts +231 -0
- package/src/crawler.ts +7123 -0
- package/src/crawler.ts.rej +12 -0
- package/src/crud-interaction.ts +386 -0
- package/src/custom-js-injector.ts +93 -0
- package/src/dark-mode-capture.ts +110 -0
- package/src/dead-link-detector.ts +76 -0
- package/src/dropdown-enumerator.ts +312 -0
- package/src/element-hash.ts +16 -0
- package/src/email-otp.ts +252 -0
- package/src/engine-router.ts +141 -0
- package/src/export/bulk-export.ts +85 -0
- package/src/export/vector-export.ts +160 -0
- package/src/extractors/advanced.ts +309 -0
- package/src/extractors/artifact-envelope.ts +111 -0
- package/src/extractors/branding-extractor.ts +159 -0
- package/src/extractors/summary-extractor.ts +49 -0
- package/src/failure-analysis-agent.ts +51 -0
- package/src/feature-flag-detector.ts +97 -0
- package/src/filter-pagination-crawler.ts +500 -0
- package/src/form-detector.ts +103 -0
- package/src/frontier.test.ts +64 -0
- package/src/frontier.ts +144 -0
- package/src/gap-pass.ts +165 -0
- package/src/graphql-detector.ts +129 -0
- package/src/http-engine.ts +453 -0
- package/src/incremental-diff.ts +259 -0
- package/src/index.ts +52 -0
- package/src/input-fuzzer.ts +129 -0
- package/src/interactive-probe.ts +1136 -0
- package/src/job-queue.test.ts +187 -0
- package/src/job-queue.ts +4504 -0
- package/src/js-coverage.ts +87 -0
- package/src/js-router-detector.ts +112 -0
- package/src/language-detector.ts +82 -0
- package/src/link-classifier.ts +65 -0
- package/src/live-view.ts +146 -0
- package/src/locator-extractor.ts +309 -0
- package/src/logger.ts +9 -0
- package/src/markdown-extract.test.ts +73 -0
- package/src/markdown-extract.ts +76 -0
- package/src/multi-context-handler.ts +296 -0
- package/src/native-crawler.ts +1108 -0
- package/src/nested-window-crawler.ts +310 -0
- package/src/network-action-correlator.ts +320 -0
- package/src/network-observer.ts +204 -0
- package/src/network-throttle.ts +69 -0
- package/src/openapi-generator.ts +135 -0
- package/src/pdf-extractor.ts +123 -0
- package/src/performance-metrics-collector.ts +243 -0
- package/src/performance-metrics.ts +134 -0
- package/src/phash.ts +184 -0
- package/src/pii-scrubber.ts +99 -0
- package/src/playwright-recorder.ts +170 -0
- package/src/policies/crawl-safety.ts +52 -0
- package/src/profiles/domain-profile.ts +190 -0
- package/src/proxy.ts +238 -0
- package/src/rate-limiter.ts +87 -0
- package/src/redirect-tracker.ts +97 -0
- package/src/redis-frontier.ts +143 -0
- package/src/redis-queue.ts +208 -0
- package/src/response-cache.ts +150 -0
- package/src/responsive-detector.ts +92 -0
- package/src/retry-policy.ts +87 -0
- package/src/robots-txt.ts +96 -0
- package/src/screen-reader.ts +98 -0
- package/src/screenshot-masker.ts +98 -0
- package/src/seo-checker.ts +134 -0
- package/src/service-worker-interceptor.ts +185 -0
- package/src/session-capture.ts +335 -0
- package/src/session-export.test.ts +75 -0
- package/src/session-export.ts +172 -0
- package/src/shadow-dom-crawler.ts +198 -0
- package/src/sitemap-writer.ts +65 -0
- package/src/sitemap.test.ts +127 -0
- package/src/sitemap.ts +233 -0
- package/src/skyvern.ts +199 -0
- package/src/sqs-queue.ts +129 -0
- package/src/sso-token.ts +120 -0
- package/src/state-graph.ts +280 -0
- package/src/stealth/human-behavior.ts +227 -0
- package/src/telemetry.ts +122 -0
- package/src/test-executor.test.ts +72 -0
- package/src/test-executor.ts +578 -0
- package/src/tls-fingerprint.ts +111 -0
- package/src/url-pattern-completer.ts +161 -0
- package/src/vendor.d.ts +20 -0
- package/src/visual-diff-verdict.test.ts +80 -0
- package/src/visual-diff-verdict.ts +59 -0
- package/src/webhook-notifier.ts +109 -0
- package/src/websocket-detector.ts +83 -0
- package/src/worker.ts +50 -0
- package/tsconfig.json +13 -0
- package/types/accessibility-auditor.d.ts +29 -0
- package/types/accessibility-tree-crawler.d.ts +44 -0
- package/types/advanced-ui-probes.d.ts +47 -0
- package/types/ai-login.d.ts +32 -0
- package/types/auth-token-rotator.d.ts +47 -0
- package/types/auth.d.ts +20 -0
- package/types/browser-extension.d.ts +37 -0
- package/types/bull-worker.d.ts +6 -0
- package/types/captcha-solver.d.ts +16 -0
- package/types/color-contrast.d.ts +30 -0
- package/types/content-chunker.d.ts +18 -0
- package/types/content-dedup.d.ts +23 -0
- package/types/cookie-consent.d.ts +25 -0
- package/types/cookie-jar.d.ts +20 -0
- package/types/crawl-session-manager.d.ts +44 -0
- package/types/crawler.d.ts +233 -0
- package/types/crud-interaction.d.ts +31 -0
- package/types/custom-js-injector.d.ts +42 -0
- package/types/dark-mode-capture.d.ts +23 -0
- package/types/dead-link-detector.d.ts +37 -0
- package/types/dropdown-enumerator.d.ts +20 -0
- package/types/element-hash.d.ts +9 -0
- package/types/email-otp.d.ts +42 -0
- package/types/engine-router.d.ts +47 -0
- package/types/export/bulk-export.d.ts +26 -0
- package/types/export/vector-export.d.ts +76 -0
- package/types/extractors/advanced.d.ts +64 -0
- package/types/extractors/artifact-envelope.d.ts +63 -0
- package/types/extractors/branding-extractor.d.ts +46 -0
- package/types/extractors/summary-extractor.d.ts +10 -0
- package/types/failure-analysis-agent.d.ts +16 -0
- package/types/feature-flag-detector.d.ts +30 -0
- package/types/filter-pagination-crawler.d.ts +52 -0
- package/types/form-detector.d.ts +34 -0
- package/types/frontier.d.ts +40 -0
- package/types/gap-pass.d.ts +36 -0
- package/types/graphql-detector.d.ts +39 -0
- package/types/http-engine.d.ts +80 -0
- package/types/incremental-diff.d.ts +116 -0
- package/types/index.d.ts +52 -0
- package/types/input-fuzzer.d.ts +30 -0
- package/types/interactive-probe.d.ts +144 -0
- package/types/job-queue.d.ts +308 -0
- package/types/js-coverage.d.ts +29 -0
- package/types/js-router-detector.d.ts +17 -0
- package/types/language-detector.d.ts +22 -0
- package/types/link-classifier.d.ts +23 -0
- package/types/live-view.d.ts +36 -0
- package/types/locator-extractor.d.ts +46 -0
- package/types/logger.d.ts +2 -0
- package/types/markdown-extract.d.ts +8 -0
- package/types/multi-context-handler.d.ts +55 -0
- package/types/native-crawler.d.ts +69 -0
- package/types/nested-window-crawler.d.ts +41 -0
- package/types/network-action-correlator.d.ts +47 -0
- package/types/network-observer.d.ts +49 -0
- package/types/network-throttle.d.ts +25 -0
- package/types/openapi-generator.d.ts +49 -0
- package/types/pdf-extractor.d.ts +28 -0
- package/types/performance-metrics-collector.d.ts +50 -0
- package/types/performance-metrics.d.ts +52 -0
- package/types/phash.d.ts +50 -0
- package/types/pii-scrubber.d.ts +21 -0
- package/types/playwright-recorder.d.ts +39 -0
- package/types/policies/crawl-safety.d.ts +9 -0
- package/types/profiles/domain-profile.d.ts +19 -0
- package/types/proxy.d.ts +50 -0
- package/types/rate-limiter.d.ts +31 -0
- package/types/redirect-tracker.d.ts +37 -0
- package/types/redis-frontier.d.ts +48 -0
- package/types/redis-queue.d.ts +48 -0
- package/types/response-cache.d.ts +38 -0
- package/types/responsive-detector.d.ts +29 -0
- package/types/retry-policy.d.ts +20 -0
- package/types/robots-txt.d.ts +9 -0
- package/types/screen-reader.d.ts +15 -0
- package/types/screenshot-masker.d.ts +28 -0
- package/types/seo-checker.d.ts +33 -0
- package/types/service-worker-interceptor.d.ts +36 -0
- package/types/session-capture.d.ts +39 -0
- package/types/session-export.d.ts +49 -0
- package/types/shadow-dom-crawler.d.ts +35 -0
- package/types/sitemap-writer.d.ts +21 -0
- package/types/sitemap.d.ts +51 -0
- package/types/skyvern.d.ts +56 -0
- package/types/sqs-queue.d.ts +13 -0
- package/types/sso-token.d.ts +29 -0
- package/types/state-graph.d.ts +59 -0
- package/types/stealth/human-behavior.d.ts +20 -0
- package/types/telemetry.d.ts +34 -0
- package/types/test-executor.d.ts +84 -0
- package/types/tls-fingerprint.d.ts +50 -0
- package/types/url-pattern-completer.d.ts +28 -0
- package/types/visual-diff-verdict.d.ts +40 -0
- package/types/webhook-notifier.d.ts +30 -0
- package/types/websocket-detector.d.ts +24 -0
- package/types/worker.d.ts +1 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import type { RawElement } from '../screen-reader.js';
|
|
3
|
+
|
|
4
|
+
export interface CrawlEvidenceFact {
|
|
5
|
+
type: string;
|
|
6
|
+
payload: unknown;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CrawlArtifactEnvelope {
|
|
10
|
+
tenantId: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
jobId?: string;
|
|
13
|
+
url: string;
|
|
14
|
+
canonicalUrl: string;
|
|
15
|
+
screenId?: string;
|
|
16
|
+
status: 'ok' | 'blocked' | 'auth_expired' | 'error' | 'skipped';
|
|
17
|
+
outputs: {
|
|
18
|
+
screenshot?: string;
|
|
19
|
+
html?: string;
|
|
20
|
+
markdown?: string;
|
|
21
|
+
fitMarkdown?: string;
|
|
22
|
+
accessibilityTree?: string;
|
|
23
|
+
structuredJson?: unknown;
|
|
24
|
+
networkTrace?: string;
|
|
25
|
+
consoleLog?: string;
|
|
26
|
+
};
|
|
27
|
+
fingerprints: {
|
|
28
|
+
textHash?: string;
|
|
29
|
+
domHash?: string;
|
|
30
|
+
accessibilityHash?: string;
|
|
31
|
+
urlCanonicalHash: string;
|
|
32
|
+
};
|
|
33
|
+
evidence: CrawlEvidenceFact[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function sha256(input: string): string {
|
|
37
|
+
return crypto.createHash('sha256').update(input).digest('hex');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function buildFitMarkdown(markdown: string, keywords: string[] = []): string {
|
|
41
|
+
const lines = markdown
|
|
42
|
+
.split('\n')
|
|
43
|
+
.map((line) => line.trimEnd())
|
|
44
|
+
.filter((line) => line.trim().length > 0);
|
|
45
|
+
const lowerKeywords = keywords.map((k) => k.toLowerCase()).filter(Boolean);
|
|
46
|
+
const filtered = lines.filter((line) => {
|
|
47
|
+
const plain = line.replace(/[#*_`>\-[\]()]/g, '').trim();
|
|
48
|
+
if (plain.length < 3) return false;
|
|
49
|
+
if (/^(cookie|privacy|terms|copyright|all rights reserved|subscribe|newsletter)$/i.test(plain)) return false;
|
|
50
|
+
if (lowerKeywords.length === 0) return true;
|
|
51
|
+
const lower = plain.toLowerCase();
|
|
52
|
+
return lowerKeywords.some((kw) => lower.includes(kw)) || /^#{1,4}\s/.test(line);
|
|
53
|
+
});
|
|
54
|
+
const candidate = filtered.join('\n');
|
|
55
|
+
return candidate.length >= 200 ? candidate : markdown;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function summarizeStructuredElements(elements: RawElement[]) {
|
|
59
|
+
const forms = elements.filter((e) => ['email', 'password', 'text', 'tel', 'date', 'number', 'select', 'textarea'].includes(e.role));
|
|
60
|
+
const actions = elements.filter((e) => e.role === 'button' || e.role === 'submit' || e.role === 'link' || e.role === 'a');
|
|
61
|
+
return {
|
|
62
|
+
elementCount: elements.length,
|
|
63
|
+
formFieldCount: forms.length,
|
|
64
|
+
actionCount: actions.length,
|
|
65
|
+
fields: forms.slice(0, 50).map((e) => ({ label: e.label, role: e.role, expectedData: e.expectedData })),
|
|
66
|
+
actions: actions.slice(0, 50).map((e) => ({ label: e.label, role: e.role })),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function buildCrawlArtifactEnvelope(input: {
|
|
71
|
+
tenantId: string;
|
|
72
|
+
projectId: string;
|
|
73
|
+
jobId?: string;
|
|
74
|
+
url: string;
|
|
75
|
+
canonicalUrl: string;
|
|
76
|
+
screenId?: string;
|
|
77
|
+
screenshotPath?: string;
|
|
78
|
+
domPath?: string;
|
|
79
|
+
domContent?: string;
|
|
80
|
+
markdown?: string;
|
|
81
|
+
fitMarkdown?: string;
|
|
82
|
+
accessibilityElements?: RawElement[];
|
|
83
|
+
structuredJson?: unknown;
|
|
84
|
+
evidence?: CrawlEvidenceFact[];
|
|
85
|
+
}): CrawlArtifactEnvelope {
|
|
86
|
+
const accessibilityTree = input.accessibilityElements ? JSON.stringify(input.accessibilityElements) : undefined;
|
|
87
|
+
return {
|
|
88
|
+
tenantId: input.tenantId,
|
|
89
|
+
projectId: input.projectId,
|
|
90
|
+
jobId: input.jobId,
|
|
91
|
+
url: input.url,
|
|
92
|
+
canonicalUrl: input.canonicalUrl,
|
|
93
|
+
screenId: input.screenId,
|
|
94
|
+
status: 'ok',
|
|
95
|
+
outputs: {
|
|
96
|
+
screenshot: input.screenshotPath,
|
|
97
|
+
html: input.domPath,
|
|
98
|
+
markdown: input.markdown,
|
|
99
|
+
fitMarkdown: input.fitMarkdown,
|
|
100
|
+
accessibilityTree,
|
|
101
|
+
structuredJson: input.structuredJson,
|
|
102
|
+
},
|
|
103
|
+
fingerprints: {
|
|
104
|
+
textHash: input.markdown ? sha256(input.markdown) : undefined,
|
|
105
|
+
domHash: input.domContent ? sha256(input.domContent) : undefined,
|
|
106
|
+
accessibilityHash: accessibilityTree ? sha256(accessibilityTree) : undefined,
|
|
107
|
+
urlCanonicalHash: sha256(input.canonicalUrl),
|
|
108
|
+
},
|
|
109
|
+
evidence: input.evidence ?? [],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { Page } from 'playwright';
|
|
2
|
+
|
|
3
|
+
export interface BrandingColors {
|
|
4
|
+
primary?: string;
|
|
5
|
+
accent?: string;
|
|
6
|
+
background?: string;
|
|
7
|
+
textPrimary?: string;
|
|
8
|
+
link?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface BrandingFont {
|
|
12
|
+
family: string;
|
|
13
|
+
role: 'heading' | 'body';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface BrandingImages {
|
|
17
|
+
logo?: string;
|
|
18
|
+
favicon?: string;
|
|
19
|
+
ogImage?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface BrandingPersonality {
|
|
23
|
+
tone?: string;
|
|
24
|
+
energy?: 'high' | 'medium' | 'low';
|
|
25
|
+
targetAudience?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface BrandingResult {
|
|
29
|
+
colorScheme: 'light' | 'dark';
|
|
30
|
+
colors: BrandingColors;
|
|
31
|
+
fonts: BrandingFont[];
|
|
32
|
+
images: BrandingImages;
|
|
33
|
+
personality?: BrandingPersonality;
|
|
34
|
+
designSystem?: { framework?: string; componentLibrary?: string };
|
|
35
|
+
metadata?: { title?: string; description?: string; themeColor?: string; language?: string };
|
|
36
|
+
confidence: { colors: number; fonts: number; images: number; overall: number };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function extractBranding(page: Page): Promise<BrandingResult> {
|
|
40
|
+
try {
|
|
41
|
+
const result = await page.evaluate(() => {
|
|
42
|
+
const bodyStyle = window.getComputedStyle(document.body);
|
|
43
|
+
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches ||
|
|
44
|
+
document.documentElement.getAttribute('data-theme') === 'dark' ||
|
|
45
|
+
document.body.classList.contains('dark');
|
|
46
|
+
|
|
47
|
+
// Extract colors from computed styles
|
|
48
|
+
const bg = bodyStyle.backgroundColor;
|
|
49
|
+
const text = bodyStyle.color;
|
|
50
|
+
|
|
51
|
+
// Find primary button color
|
|
52
|
+
const primaryBtn = document.querySelector(
|
|
53
|
+
'button[class*="primary"], .btn-primary, [class*="btn-primary"], [class*="button-primary"]'
|
|
54
|
+
);
|
|
55
|
+
const primaryColor = primaryBtn ? window.getComputedStyle(primaryBtn).backgroundColor : undefined;
|
|
56
|
+
|
|
57
|
+
// Find link color
|
|
58
|
+
const firstLink = document.querySelector('a');
|
|
59
|
+
const linkColor = firstLink ? window.getComputedStyle(firstLink).color : undefined;
|
|
60
|
+
|
|
61
|
+
// Extract font families
|
|
62
|
+
const headingEl = document.querySelector('h1, h2');
|
|
63
|
+
const bodyEl = document.body;
|
|
64
|
+
const headingFont = headingEl ? window.getComputedStyle(headingEl).fontFamily : bodyStyle.fontFamily;
|
|
65
|
+
const bodyFont = bodyStyle.fontFamily;
|
|
66
|
+
|
|
67
|
+
// Extract images
|
|
68
|
+
const logoEl = document.querySelector(
|
|
69
|
+
'header img, img[alt*="logo" i], img[class*="logo" i], [class*="logo"] img, [id*="logo"] img'
|
|
70
|
+
) as HTMLImageElement | null;
|
|
71
|
+
const faviconEl = document.querySelector('link[rel="icon"], link[rel="shortcut icon"]') as HTMLLinkElement | null;
|
|
72
|
+
const ogImageEl = document.querySelector('meta[property="og:image"]') as HTMLMetaElement | null;
|
|
73
|
+
|
|
74
|
+
// Extract metadata
|
|
75
|
+
const titleEl = document.querySelector('title');
|
|
76
|
+
const descEl = document.querySelector('meta[name="description"]') as HTMLMetaElement | null;
|
|
77
|
+
const themeColorEl = document.querySelector('meta[name="theme-color"]') as HTMLMetaElement | null;
|
|
78
|
+
|
|
79
|
+
// Detect design framework
|
|
80
|
+
const hasBootstrap = !!document.querySelector('[class*="btn btn-"], .container-fluid, .navbar-expand');
|
|
81
|
+
const hasTailwind = !!document.querySelector('[class*="flex "], [class*="text-"], [class*="bg-"]');
|
|
82
|
+
const hasChakra = !!(document as any).__chakra_factory__ || !!document.querySelector('[class*="chakra-"]');
|
|
83
|
+
const hasMUI = !!document.querySelector('.MuiButton-root, .MuiTypography-root');
|
|
84
|
+
|
|
85
|
+
const framework = hasBootstrap ? 'Bootstrap' : hasTailwind ? 'Tailwind CSS' : hasChakra ? 'Chakra UI' : hasMUI ? 'Material UI' : null;
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
isDark,
|
|
89
|
+
bg,
|
|
90
|
+
text,
|
|
91
|
+
primaryColor,
|
|
92
|
+
linkColor,
|
|
93
|
+
headingFont,
|
|
94
|
+
bodyFont,
|
|
95
|
+
logo: logoEl?.src || logoEl?.getAttribute('src') || undefined,
|
|
96
|
+
favicon: faviconEl?.href || undefined,
|
|
97
|
+
ogImage: ogImageEl?.content || undefined,
|
|
98
|
+
title: titleEl?.textContent || undefined,
|
|
99
|
+
description: descEl?.content || undefined,
|
|
100
|
+
themeColor: themeColorEl?.content || undefined,
|
|
101
|
+
language: document.documentElement.lang || undefined,
|
|
102
|
+
framework,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const fonts: BrandingFont[] = [];
|
|
107
|
+
if (result.headingFont && result.headingFont !== result.bodyFont) {
|
|
108
|
+
fonts.push({ family: result.headingFont.split(',')[0].replace(/['"]/g, '').trim(), role: 'heading' });
|
|
109
|
+
}
|
|
110
|
+
if (result.bodyFont) {
|
|
111
|
+
fonts.push({ family: result.bodyFont.split(',')[0].replace(/['"]/g, '').trim(), role: 'body' });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const colorConfidence = (result.bg || result.text || result.primaryColor) ? 0.8 : 0.3;
|
|
115
|
+
const fontConfidence = fonts.length > 0 ? 0.7 : 0.2;
|
|
116
|
+
const imageConfidence = (result.logo || result.ogImage) ? 0.9 : 0.2;
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
colorScheme: result.isDark ? 'dark' : 'light',
|
|
120
|
+
colors: {
|
|
121
|
+
background: result.bg || undefined,
|
|
122
|
+
textPrimary: result.text || undefined,
|
|
123
|
+
primary: result.primaryColor || undefined,
|
|
124
|
+
link: result.linkColor || undefined,
|
|
125
|
+
},
|
|
126
|
+
fonts,
|
|
127
|
+
images: {
|
|
128
|
+
logo: result.logo,
|
|
129
|
+
favicon: result.favicon,
|
|
130
|
+
ogImage: result.ogImage,
|
|
131
|
+
},
|
|
132
|
+
designSystem: {
|
|
133
|
+
framework: result.framework || undefined,
|
|
134
|
+
componentLibrary: undefined,
|
|
135
|
+
},
|
|
136
|
+
metadata: {
|
|
137
|
+
title: result.title,
|
|
138
|
+
description: result.description,
|
|
139
|
+
themeColor: result.themeColor,
|
|
140
|
+
language: result.language,
|
|
141
|
+
},
|
|
142
|
+
confidence: {
|
|
143
|
+
colors: colorConfidence,
|
|
144
|
+
fonts: fontConfidence,
|
|
145
|
+
images: imageConfidence,
|
|
146
|
+
overall: (colorConfidence + fontConfidence + imageConfidence) / 3,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
} catch (err) {
|
|
150
|
+
console.warn('[branding-extractor] Extraction failed:', err);
|
|
151
|
+
return {
|
|
152
|
+
colorScheme: 'light',
|
|
153
|
+
colors: {},
|
|
154
|
+
fonts: [],
|
|
155
|
+
images: {},
|
|
156
|
+
confidence: { colors: 0, fonts: 0, images: 0, overall: 0 },
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface SummaryResult {
|
|
2
|
+
summary: string;
|
|
3
|
+
wordCount: number;
|
|
4
|
+
method: 'llm' | 'truncated';
|
|
5
|
+
model?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export async function extractSummary(
|
|
9
|
+
markdown: string,
|
|
10
|
+
options?: { model?: string; maxTokens?: number },
|
|
11
|
+
): Promise<SummaryResult> {
|
|
12
|
+
// Truncate to 8000 chars to stay within token budget
|
|
13
|
+
const input = markdown.slice(0, 8000);
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
// Dynamic import to avoid hard dependency if agents package unavailable
|
|
17
|
+
const { ask } = await import('@taodigital/agents').catch(() => ({ ask: null as any }));
|
|
18
|
+
|
|
19
|
+
if (!ask) {
|
|
20
|
+
return makeTruncated(input);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const summary: string = await ask(
|
|
24
|
+
'Summarize the following web page content in 2-4 concise sentences. Focus on the main purpose, key features, and primary value proposition. Return only the summary text, no preamble.',
|
|
25
|
+
input,
|
|
26
|
+
options?.model ? { provider: 'anthropic', model: options.model } : undefined,
|
|
27
|
+
options?.maxTokens ?? 300,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
summary: summary.trim(),
|
|
32
|
+
wordCount: markdown.split(/\s+/).length,
|
|
33
|
+
method: 'llm',
|
|
34
|
+
model: options?.model,
|
|
35
|
+
};
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.warn('[summary-extractor] LLM call failed, using truncated fallback:', err);
|
|
38
|
+
return makeTruncated(input);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function makeTruncated(input: string): SummaryResult {
|
|
43
|
+
const excerpt = input.slice(0, 500).trim();
|
|
44
|
+
return {
|
|
45
|
+
summary: excerpt + (input.length > 500 ? '...' : ''),
|
|
46
|
+
wordCount: excerpt.split(/\s+/).length,
|
|
47
|
+
method: 'truncated',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { askTrackedWithImages, askTracked, deterministicSeed } from '@taodigital/agents';
|
|
3
|
+
import type { LLMConfig } from '@taodigital/agents';
|
|
4
|
+
import { AppBrain } from '@taodigital/app-brain';
|
|
5
|
+
|
|
6
|
+
export interface FailureContext {
|
|
7
|
+
tenantId?: string;
|
|
8
|
+
error: string;
|
|
9
|
+
stepDescription?: string;
|
|
10
|
+
consoleLogs?: Array<{ type: string; text: string }>;
|
|
11
|
+
networkErrors?: Array<{ url: string; status: number; method: string }>;
|
|
12
|
+
screenshotPath?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function analyzeFailure(ctx: FailureContext): Promise<string | null> {
|
|
16
|
+
try {
|
|
17
|
+
let llmCfg: LLMConfig | undefined;
|
|
18
|
+
if (ctx.tenantId) {
|
|
19
|
+
llmCfg = await AppBrain.getTaskLLMConfig(ctx.tenantId, 'testRunner').catch(() => undefined) as LLMConfig | undefined ?? undefined;
|
|
20
|
+
}
|
|
21
|
+
if (!llmCfg) return null;
|
|
22
|
+
|
|
23
|
+
const consoleSection = ctx.consoleLogs?.length
|
|
24
|
+
? `\n\nBrowser console (last ${ctx.consoleLogs.length} entries):\n${ctx.consoleLogs.map(l => `[${l.type}] ${l.text}`).join('\n')}`
|
|
25
|
+
: '';
|
|
26
|
+
|
|
27
|
+
const networkSection = ctx.networkErrors?.length
|
|
28
|
+
? `\n\nFailed network requests:\n${ctx.networkErrors.map(n => `${n.method} ${n.url} → ${n.status}`).join('\n')}`
|
|
29
|
+
: '';
|
|
30
|
+
|
|
31
|
+
const userText = `A Playwright automated test failed. Identify the root cause in 2-3 sentences. Be specific — name the failing element, API endpoint, or error type. Do not suggest fixes.
|
|
32
|
+
|
|
33
|
+
Test step: ${ctx.stepDescription ?? 'unknown'}
|
|
34
|
+
Error: ${ctx.error}${consoleSection}${networkSection}`;
|
|
35
|
+
|
|
36
|
+
if (ctx.screenshotPath) {
|
|
37
|
+
try {
|
|
38
|
+
const img = readFileSync(ctx.screenshotPath);
|
|
39
|
+
const imgSeed = deterministicSeed(`failure-img:${ctx.tenantId ?? ''}:${(ctx.stepDescription ?? '').slice(0, 100)}:${ctx.error.slice(0, 200)}`);
|
|
40
|
+
const result = await askTrackedWithImages('', userText, [{ base64: img.toString('base64'), mediaType: 'image/png' }], llmCfg, { temperature: 0, seed: imgSeed });
|
|
41
|
+
return result.text || null;
|
|
42
|
+
} catch { /* fall through to text-only */ }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const failureSeed = deterministicSeed(`${ctx.tenantId ?? ''}:failure:${(ctx.stepDescription ?? '').slice(0, 100)}:${ctx.error.slice(0, 200)}`);
|
|
46
|
+
const result = await askTracked('', userText, llmCfg, 256, undefined, { temperature: 0, seed: failureSeed });
|
|
47
|
+
return result.text || null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature flag + A/B test detector.
|
|
3
|
+
*
|
|
4
|
+
* Detects popular feature flag / experiment SDKs loaded on the page:
|
|
5
|
+
* LaunchDarkly, Optimizely, Split.io, Unleash, GrowthBook, Statsig, Flagsmith, Amplitude Experiment.
|
|
6
|
+
*
|
|
7
|
+
* Also detects common A/B test patterns: data-testid attributes, gtm.js experiment layers,
|
|
8
|
+
* Optimizely variation IDs, VWO, etc.
|
|
9
|
+
*
|
|
10
|
+
* Why: ZeTa needs to know when a page shows different content to different users
|
|
11
|
+
* so test generation can account for variants and not generate flaky tests.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { Page } from 'playwright';
|
|
15
|
+
|
|
16
|
+
export interface FeatureFlagInfo {
|
|
17
|
+
sdk: string;
|
|
18
|
+
confidence: 'high' | 'medium' | 'low';
|
|
19
|
+
details?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AbTestInfo {
|
|
23
|
+
tool: string;
|
|
24
|
+
experiments?: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface FeatureFlagDetectionResult {
|
|
28
|
+
url: string;
|
|
29
|
+
flagSdks: FeatureFlagInfo[];
|
|
30
|
+
abTools: AbTestInfo[];
|
|
31
|
+
hasAnyFlags: boolean;
|
|
32
|
+
detectedAt: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// SDK detectors — checked against window object + script URLs
|
|
36
|
+
const FLAG_SDK_CHECKS: Array<{
|
|
37
|
+
sdk: string;
|
|
38
|
+
windowKeys?: string[];
|
|
39
|
+
scriptPattern?: RegExp;
|
|
40
|
+
}> = [
|
|
41
|
+
{ sdk: 'LaunchDarkly', windowKeys: ['LDClient', 'LaunchDarkly', 'ldClient'], scriptPattern: /launchdarkly/i },
|
|
42
|
+
{ sdk: 'Optimizely', windowKeys: ['optimizely', 'optimizelySdk'], scriptPattern: /optimizely/i },
|
|
43
|
+
{ sdk: 'Split.io', windowKeys: ['splitio', 'SplitFactory'], scriptPattern: /split\.io/i },
|
|
44
|
+
{ sdk: 'GrowthBook', windowKeys: ['growthbook', 'GrowthBook'], scriptPattern: /growthbook/i },
|
|
45
|
+
{ sdk: 'Statsig', windowKeys: ['statsig', 'StatsigClient'], scriptPattern: /statsig/i },
|
|
46
|
+
{ sdk: 'Flagsmith', windowKeys: ['flagsmith'], scriptPattern: /flagsmith/i },
|
|
47
|
+
{ sdk: 'Unleash', windowKeys: ['unleash', 'UnleashClient'], scriptPattern: /unleash/i },
|
|
48
|
+
{ sdk: 'VWO', windowKeys: ['vwo', '_vwo'], scriptPattern: /vwo\.com/i },
|
|
49
|
+
{ sdk: 'Google Optimize', windowKeys: ['gaData', 'google_optimize'], scriptPattern: /googleoptimize/i },
|
|
50
|
+
{ sdk: 'AB Tasty', windowKeys: ['ABTasty'], scriptPattern: /abtasty/i },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export async function detectFeatureFlags(page: Page, url: string): Promise<FeatureFlagDetectionResult> {
|
|
54
|
+
const detectedAt = new Date().toISOString();
|
|
55
|
+
|
|
56
|
+
const result = await page.evaluate((checks) => {
|
|
57
|
+
const flagSdks: any[] = [];
|
|
58
|
+
const scripts = Array.from(document.querySelectorAll('script[src]')).map((s: any) => s.src ?? '');
|
|
59
|
+
|
|
60
|
+
for (const check of checks) {
|
|
61
|
+
let found = false;
|
|
62
|
+
let confidence = 'low';
|
|
63
|
+
|
|
64
|
+
// Check window keys
|
|
65
|
+
if (check.windowKeys?.some((k: string) => k in (window as any))) {
|
|
66
|
+
found = true;
|
|
67
|
+
confidence = 'high';
|
|
68
|
+
}
|
|
69
|
+
// Check script URLs
|
|
70
|
+
if (!found && check.scriptPattern) {
|
|
71
|
+
const re = new RegExp(check.scriptPattern.source, 'i');
|
|
72
|
+
const matchingSrc = scripts.find(s => re.test(s));
|
|
73
|
+
if (matchingSrc) { found = true; confidence = 'medium'; }
|
|
74
|
+
}
|
|
75
|
+
if (found) flagSdks.push({ sdk: check.sdk, confidence, details: undefined });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// A/B tools
|
|
79
|
+
const abTools: any[] = [];
|
|
80
|
+
if ('_vwo_code' in window || '_vis_opt_queue' in (window as any)) abTools.push({ tool: 'VWO', experiments: [] });
|
|
81
|
+
if ('dataLayer' in window) {
|
|
82
|
+
const dl = (window as any).dataLayer ?? [];
|
|
83
|
+
const expEvents = dl.filter((e: any) => e?.event?.includes('experiment') || e?.experimentId);
|
|
84
|
+
if (expEvents.length > 0) abTools.push({ tool: 'Google Tag Manager Experiments', experiments: expEvents.slice(0, 5).map((e: any) => e.experimentId ?? '') });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return { flagSdks, abTools };
|
|
88
|
+
}, FLAG_SDK_CHECKS as any).catch(() => ({ flagSdks: [], abTools: [] }));
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
url,
|
|
92
|
+
flagSdks: result.flagSdks,
|
|
93
|
+
abTools: result.abTools,
|
|
94
|
+
hasAnyFlags: result.flagSdks.length > 0 || result.abTools.length > 0,
|
|
95
|
+
detectedAt,
|
|
96
|
+
};
|
|
97
|
+
}
|