@detiq/crawler 0.1.3
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 +49 -0
- package/README.md +11 -0
- 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/ai-login.d.ts +32 -0
- package/dist/ai-login.js +177 -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 +329 -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/crawler.d.ts +179 -0
- package/dist/crawler.js +3672 -0
- package/dist/crawler.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/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 +54 -0
- package/dist/extractors/advanced.js +245 -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/failure-analysis-agent.d.ts +16 -0
- package/dist/failure-analysis-agent.js +40 -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/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 +32 -0
- package/dist/frontier.js +83 -0
- package/dist/frontier.js.map +7 -0
- package/dist/gap-pass.d.ts +35 -0
- package/dist/gap-pass.js +81 -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 +304 -0
- package/dist/http-engine.js.map +7 -0
- package/dist/incremental-diff.d.ts +59 -0
- package/dist/incremental-diff.js +61 -0
- package/dist/incremental-diff.js.map +7 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +61 -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 +104 -0
- package/dist/interactive-probe.js +442 -0
- package/dist/interactive-probe.js.map +7 -0
- package/dist/job-queue.d.ts +171 -0
- package/dist/job-queue.js +2256 -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 +100 -0
- package/dist/live-view.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/native-crawler.d.ts +69 -0
- package/dist/native-crawler.js +839 -0
- package/dist/native-crawler.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.d.ts +53 -0
- package/dist/performance-metrics.js +83 -0
- package/dist/performance-metrics.js.map +7 -0
- package/dist/phash.d.ts +38 -0
- package/dist/phash.js +115 -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 +37 -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 +140 -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 +16 -0
- package/dist/screen-reader.js +46 -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/session-capture.d.ts +35 -0
- package/dist/session-capture.js +267 -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/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 +152 -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 +2 -0
- package/dist/sqs-queue.js +47 -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/stealth/human-behavior.d.ts +20 -0
- package/dist/stealth/human-behavior.js +168 -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 +67 -0
- package/dist/test-executor.js +311 -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 +87 -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 +25 -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 +45 -0
- package/src/accessibility-auditor.ts +102 -0
- package/src/ai-login.ts +218 -0
- package/src/auth-token-rotator.ts +89 -0
- package/src/auth.ts +396 -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/crawler.ts +4305 -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/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 +283 -0
- package/src/extractors/artifact-envelope.ts +111 -0
- package/src/failure-analysis-agent.ts +49 -0
- package/src/feature-flag-detector.ts +97 -0
- package/src/form-detector.ts +103 -0
- package/src/frontier.test.ts +64 -0
- package/src/frontier.ts +112 -0
- package/src/gap-pass.ts +122 -0
- package/src/graphql-detector.ts +129 -0
- package/src/http-engine.ts +433 -0
- package/src/incremental-diff.ts +121 -0
- package/src/index.ts +35 -0
- package/src/input-fuzzer.ts +129 -0
- package/src/interactive-probe.ts +623 -0
- package/src/job-queue.test.ts +120 -0
- package/src/job-queue.ts +2701 -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 +141 -0
- package/src/logger.ts +9 -0
- package/src/markdown-extract.test.ts +73 -0
- package/src/markdown-extract.ts +76 -0
- package/src/native-crawler.ts +1106 -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.ts +134 -0
- package/src/phash.ts +151 -0
- package/src/pii-scrubber.ts +99 -0
- package/src/playwright-recorder.ts +170 -0
- package/src/policies/crawl-safety.ts +46 -0
- package/src/profiles/domain-profile.ts +167 -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 +89 -0
- package/src/screenshot-masker.ts +98 -0
- package/src/seo-checker.ts +134 -0
- package/src/session-capture.ts +325 -0
- package/src/session-export.test.ts +75 -0
- package/src/session-export.ts +172 -0
- package/src/sitemap-writer.ts +65 -0
- package/src/sitemap.test.ts +131 -0
- package/src/sitemap.ts +224 -0
- package/src/skyvern.ts +199 -0
- package/src/sqs-queue.ts +49 -0
- package/src/sso-token.ts +120 -0
- package/src/stealth/human-behavior.ts +191 -0
- package/src/telemetry.ts +122 -0
- package/src/test-executor.test.ts +72 -0
- package/src/test-executor.ts +424 -0
- package/src/tls-fingerprint.ts +111 -0
- package/src/url-pattern-completer.ts +114 -0
- package/src/visual-diff-verdict.test.ts +80 -0
- package/src/visual-diff-verdict.ts +57 -0
- package/src/webhook-notifier.ts +109 -0
- package/src/websocket-detector.ts +83 -0
- package/src/worker.ts +48 -0
- package/tsconfig.json +13 -0
- package/types/accessibility-auditor.d.ts +29 -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/crawler.d.ts +179 -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/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 +54 -0
- package/types/extractors/artifact-envelope.d.ts +63 -0
- package/types/failure-analysis-agent.d.ts +16 -0
- package/types/feature-flag-detector.d.ts +30 -0
- package/types/form-detector.d.ts +34 -0
- package/types/frontier.d.ts +32 -0
- package/types/gap-pass.d.ts +35 -0
- package/types/graphql-detector.d.ts +39 -0
- package/types/http-engine.d.ts +80 -0
- package/types/incremental-diff.d.ts +59 -0
- package/types/index.d.ts +35 -0
- package/types/input-fuzzer.d.ts +30 -0
- package/types/interactive-probe.d.ts +104 -0
- package/types/job-queue.d.ts +171 -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/logger.d.ts +2 -0
- package/types/markdown-extract.d.ts +8 -0
- package/types/native-crawler.d.ts +69 -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.d.ts +53 -0
- package/types/phash.d.ts +38 -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 +16 -0
- package/types/screenshot-masker.d.ts +28 -0
- package/types/seo-checker.d.ts +33 -0
- package/types/session-capture.d.ts +38 -0
- package/types/session-export.d.ts +49 -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 +2 -0
- package/types/sso-token.d.ts +29 -0
- package/types/stealth/human-behavior.d.ts +20 -0
- package/types/telemetry.d.ts +34 -0
- package/types/test-executor.d.ts +67 -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,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CAPTCHA auto-solving via 2captcha or CapSolver APIs.
|
|
3
|
+
* Supports reCAPTCHA v2, hCaptcha, and Cloudflare Turnstile.
|
|
4
|
+
*/
|
|
5
|
+
export type CaptchaSolverProvider = '2captcha' | 'capsolver';
|
|
6
|
+
interface SolveResult {
|
|
7
|
+
token: string;
|
|
8
|
+
provider: CaptchaSolverProvider;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Detect CAPTCHA type and sitekey on the page, then solve it.
|
|
12
|
+
* Returns null if no CAPTCHA found or solver not configured.
|
|
13
|
+
* Throws on solve failure.
|
|
14
|
+
*/
|
|
15
|
+
export declare function solveCaptcha(page: any, pageUrl: string, apiKey: string, provider?: CaptchaSolverProvider): Promise<SolveResult | null>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WCAG color contrast checker.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates text contrast ratios against backgrounds for all visible text elements.
|
|
5
|
+
* Reports elements that fail WCAG 2.1 AA (4.5:1 for normal text, 3:1 for large text)
|
|
6
|
+
* or AAA (7:1 for normal, 4.5:1 for large text) requirements.
|
|
7
|
+
*
|
|
8
|
+
* Uses computedStyle to get actual rendered colors — accounts for CSS variables
|
|
9
|
+
* and inheritance.
|
|
10
|
+
*/
|
|
11
|
+
import type { Page } from 'playwright';
|
|
12
|
+
export interface ContrastViolation {
|
|
13
|
+
selector: string;
|
|
14
|
+
text: string;
|
|
15
|
+
foreground: string;
|
|
16
|
+
background: string;
|
|
17
|
+
ratio: number;
|
|
18
|
+
required: number;
|
|
19
|
+
level: 'AA' | 'AAA';
|
|
20
|
+
isLargeText: boolean;
|
|
21
|
+
severity: 'fail' | 'warn';
|
|
22
|
+
}
|
|
23
|
+
export interface ContrastAuditResult {
|
|
24
|
+
url: string;
|
|
25
|
+
violations: ContrastViolation[];
|
|
26
|
+
passCount: number;
|
|
27
|
+
score: number;
|
|
28
|
+
auditedAt: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function auditColorContrast(page: Page, url: string): Promise<ContrastAuditResult>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ChunkingStrategy = 'fixed' | 'overlap' | 'sentence' | 'paragraph' | 'markdown-heading' | 'semantic' | 'recursive';
|
|
2
|
+
export interface ChunkOpts {
|
|
3
|
+
strategy: ChunkingStrategy;
|
|
4
|
+
chunkSize?: number;
|
|
5
|
+
overlap?: number;
|
|
6
|
+
separators?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface Chunk {
|
|
9
|
+
index: number;
|
|
10
|
+
text: string;
|
|
11
|
+
tokenEstimate: number;
|
|
12
|
+
startChar: number;
|
|
13
|
+
endChar: number;
|
|
14
|
+
heading?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function estimateTokens(text: string): number;
|
|
17
|
+
export declare function chunkContent(text: string, opts: ChunkOpts): Chunk[];
|
|
18
|
+
export declare function mergeSmallChunks(chunks: Chunk[], minTokens: number): Chunk[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content deduplication — detect near-duplicate pages during crawl.
|
|
3
|
+
*
|
|
4
|
+
* Uses MinHash-inspired approach: instead of full MinHash (needs many hash functions),
|
|
5
|
+
* we use 8 structural fingerprints extracted from the markdown to detect pages that
|
|
6
|
+
* share the same layout/template even if the data differs.
|
|
7
|
+
*
|
|
8
|
+
* Typical duplicates: /products?page=1 vs /products?page=2 (same template, different data).
|
|
9
|
+
* These waste crawl budget and generate redundant test cases.
|
|
10
|
+
*/
|
|
11
|
+
export interface DedupResult {
|
|
12
|
+
isDuplicate: boolean;
|
|
13
|
+
similarUrl?: string;
|
|
14
|
+
similarityScore: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class ContentDeduplicator {
|
|
17
|
+
private seen;
|
|
18
|
+
private readonly threshold;
|
|
19
|
+
constructor(threshold?: number);
|
|
20
|
+
check(url: string, markdown: string): DedupResult;
|
|
21
|
+
size(): number;
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie consent auto-acceptor.
|
|
3
|
+
*
|
|
4
|
+
* Detects and clicks "Accept" on common cookie consent banners before the
|
|
5
|
+
* crawler proceeds. Without this, many EU sites show a consent wall that
|
|
6
|
+
* blocks content or shows a different layout, making crawl results unreliable.
|
|
7
|
+
*
|
|
8
|
+
* Supports: Cookiebot, OneTrust, TrustArc, Usercentrics, GDPR Cookie Compliance,
|
|
9
|
+
* generic "Accept All" / "Accept Cookies" buttons.
|
|
10
|
+
*
|
|
11
|
+
* Strategy: try known selectors first, then fall back to text-based button search.
|
|
12
|
+
* Non-blocking — if no banner is found or click fails, crawl proceeds normally.
|
|
13
|
+
*/
|
|
14
|
+
import type { Page } from 'playwright';
|
|
15
|
+
export interface ConsentResult {
|
|
16
|
+
found: boolean;
|
|
17
|
+
clicked: boolean;
|
|
18
|
+
method?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function acceptCookieConsent(page: Page, opts?: {
|
|
22
|
+
waitMs?: number;
|
|
23
|
+
}): Promise<ConsentResult>;
|
|
24
|
+
/** Check if a consent banner is still visible after attempted dismissal */
|
|
25
|
+
export declare function isConsentBannerVisible(page: Page): Promise<boolean>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie jar — persist and restore Playwright storageState cookies between
|
|
3
|
+
* crawl segments and restarts. Enables continuous auth across session boundaries
|
|
4
|
+
* (e.g. segment 1 logs in, segment 2–N inherit the session without re-login).
|
|
5
|
+
*
|
|
6
|
+
* Storage: JSON file per project in the crawl cache dir.
|
|
7
|
+
* Format: Playwright's storageState shape (cookies + origins).
|
|
8
|
+
*/
|
|
9
|
+
export interface CookieJarEntry {
|
|
10
|
+
projectId: string;
|
|
11
|
+
tenantId: string;
|
|
12
|
+
storageState: string;
|
|
13
|
+
savedAt: string;
|
|
14
|
+
domain: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function saveCookieJar(cacheDir: string, projectId: string, tenantId: string, storageState: string, domain: string): Promise<void>;
|
|
17
|
+
export declare function loadCookieJar(cacheDir: string, projectId: string, maxAgeMs?: number): Promise<string | null>;
|
|
18
|
+
export declare function clearCookieJar(cacheDir: string, projectId: string): Promise<void>;
|
|
19
|
+
/** Merge two storageState JSON strings — second takes priority for same-domain cookies. */
|
|
20
|
+
export declare function mergeStorageStates(base: string, overlay: string): string;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZeTa-AI Crawler — Stagehand hybrid architecture
|
|
3
|
+
*
|
|
4
|
+
* Three-layer stack:
|
|
5
|
+
* Layer 1 — Playwright (deterministic): navigation, screenshots, DOM fallbacks
|
|
6
|
+
* Layer 2 — Stagehand act/extract (AI): login, element understanding, smart link discovery
|
|
7
|
+
* Layer 3 — Skyvern (vision): fallback for CAPTCHAs, legacy apps, visual-only flows
|
|
8
|
+
*
|
|
9
|
+
* enableCaching: true → repeat crawls of the same site cost ~zero AI tokens after first run.
|
|
10
|
+
*/
|
|
11
|
+
import type { Credentials } from './auth.js';
|
|
12
|
+
import { type SkyvernConfig } from './skyvern.js';
|
|
13
|
+
import { type TraversalStrategy } from './frontier.js';
|
|
14
|
+
import { type ApiEndpointObservationInput } from './network-observer.js';
|
|
15
|
+
import type { ProxyTierConfig } from './proxy.js';
|
|
16
|
+
interface PerformanceMetric {
|
|
17
|
+
url: string;
|
|
18
|
+
screenName: string;
|
|
19
|
+
lcp?: number;
|
|
20
|
+
fcp?: number;
|
|
21
|
+
ttfb?: number;
|
|
22
|
+
cls?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lightweight pre-crawl link discovery: loads the app URL in a headless (proxy-aware) browser
|
|
26
|
+
* and returns same-site `<a href>` links. Complements sitemap discovery for SPA/app sites that
|
|
27
|
+
* have no sitemap.xml. Best-effort — returns [] on any failure (bot wall, timeout, etc.).
|
|
28
|
+
* chromium.launch({ proxy }) handles proxy 407 auth itself (same client), so no CDP handler needed.
|
|
29
|
+
*/
|
|
30
|
+
export declare function discoverLinksViaBrowser(appUrl: string, opts?: {
|
|
31
|
+
proxyUrl?: string;
|
|
32
|
+
maxLinks?: number;
|
|
33
|
+
}): Promise<string[]>;
|
|
34
|
+
export declare function crawlProject(opts: {
|
|
35
|
+
tenantId: string;
|
|
36
|
+
projectId: string;
|
|
37
|
+
appUrl: string;
|
|
38
|
+
credentials?: Credentials;
|
|
39
|
+
/** Playwright storageState JSON string — if present, session is restored and AI login is skipped. */
|
|
40
|
+
storageState?: string;
|
|
41
|
+
screenshotDir?: string;
|
|
42
|
+
/** When true, run a fast URL-only discovery crawl — skips screenshots, DB saves, and AI element extraction. Returns discoveredUrls in the result object. */
|
|
43
|
+
discoveryMode?: boolean;
|
|
44
|
+
maxScreens?: number;
|
|
45
|
+
/** Seed URLs added to the initial crawl queue — link discovery still runs from each page. */
|
|
46
|
+
startUrls?: string[];
|
|
47
|
+
/** When provided, crawl ONLY these exact URLs (no link-following, no full screen clear). Used for selected-screen recrawl. */
|
|
48
|
+
selectiveUrls?: string[];
|
|
49
|
+
/** When true, run the interactive probe after static crawl to capture real validation errors, toasts, and modals. */
|
|
50
|
+
interactive?: boolean;
|
|
51
|
+
/** Optional abort signal — abort() cancels the crawl between page navigations. */
|
|
52
|
+
abortSignal?: AbortSignal;
|
|
53
|
+
/** Platform job ID — stored on screens so we can diff which were found in each crawl. */
|
|
54
|
+
jobId?: string;
|
|
55
|
+
/** Device profiles to capture screenshots for after the main DESKTOP crawl.
|
|
56
|
+
* Values: 'MOBILE_PORTRAIT' | 'TABLET'
|
|
57
|
+
* The main crawl always runs as DESKTOP. Extra profiles trigger a screenshot-only pass.
|
|
58
|
+
*/
|
|
59
|
+
deviceProfiles?: string[];
|
|
60
|
+
/** HTTP Basic Auth credentials — injected as Authorization header on same-origin requests. */
|
|
61
|
+
httpBasicUsername?: string;
|
|
62
|
+
httpBasicPassword?: string;
|
|
63
|
+
/** Bearer/API token — injected as a request header and into localStorage. Skips AI login. */
|
|
64
|
+
authToken?: string;
|
|
65
|
+
/** Header name for authToken (default: 'Authorization'). */
|
|
66
|
+
authTokenHeader?: string;
|
|
67
|
+
/** Prefix for authToken value (default: 'Bearer '). */
|
|
68
|
+
authTokenPrefix?: string;
|
|
69
|
+
/** CAPTCHA solving API key (2captcha or CapSolver). */
|
|
70
|
+
captchaSolverApiKey?: string;
|
|
71
|
+
/** CAPTCHA solving service provider (default: '2captcha'). */
|
|
72
|
+
captchaSolverProvider?: '2captcha' | 'capsolver';
|
|
73
|
+
/**
|
|
74
|
+
* Path to a Chrome user data directory for profile inheritance.
|
|
75
|
+
* When set, the crawler exports the existing session from this profile and injects it,
|
|
76
|
+
* so the agent is already logged in. Works for local/self-hosted deployments only.
|
|
77
|
+
* Ignored on cloud/Docker (headless env cannot open another Chrome instance safely).
|
|
78
|
+
*/
|
|
79
|
+
chromeProfilePath?: string;
|
|
80
|
+
/** MailSlurp API key for email OTP auto-retrieval (GAP 5). */
|
|
81
|
+
mailslurpApiKey?: string;
|
|
82
|
+
/** MailSlurp inbox ID to poll for OTP emails (GAP 5). */
|
|
83
|
+
mailslurpInboxId?: string;
|
|
84
|
+
/** SSO provider for ROPC token flow — 'okta' | 'azure_ad' | 'generic_oidc' (GAP 18). */
|
|
85
|
+
ssoProvider?: string;
|
|
86
|
+
/** SSO domain or Azure tenant ID (GAP 18). */
|
|
87
|
+
ssoDomain?: string;
|
|
88
|
+
/** SSO OAuth2 client ID (GAP 18). */
|
|
89
|
+
ssoClientId?: string;
|
|
90
|
+
/** SSO OAuth2 client secret (GAP 18). */
|
|
91
|
+
ssoClientSecret?: string;
|
|
92
|
+
/** SSO scopes (space-separated, default: 'openid profile') (GAP 18). */
|
|
93
|
+
ssoScope?: string;
|
|
94
|
+
/** HTTP/HTTPS/SOCKS5 proxy URL — e.g. 'http://user:pass@proxy.example.com:8080' or 'socks5://proxy:1080'.
|
|
95
|
+
* Useful for sites that block datacenter IPs (Akamai, Cloudflare Bot Manager). */
|
|
96
|
+
proxyUrl?: string;
|
|
97
|
+
/** Tiered proxy configuration for automatic per-domain escalation (free → datacenter → residential → premium). */
|
|
98
|
+
proxyTiers?: ProxyTierConfig[];
|
|
99
|
+
/** Use Camoufox (Firefox) as a cookie bootstrapper before the main Chromium crawl.
|
|
100
|
+
* Camoufox visits the URL first to solve Cloudflare JS challenges and extract session
|
|
101
|
+
* cookies, which are then injected into the Chromium crawl as storageState.
|
|
102
|
+
* Enable via Project Settings → Crawl Config → useFirefox: true. */
|
|
103
|
+
useFirefox?: boolean;
|
|
104
|
+
/** Natural language login instructions for Stagehand AI login. E.g. "Click Sign In in the nav, fill email, click Continue". */
|
|
105
|
+
loginInstructions?: string;
|
|
106
|
+
/** Skyvern vision fallback config from workspace settings (overrides SKYVERN_API_URL/KEY env vars). */
|
|
107
|
+
skyvernConfig?: SkyvernConfig;
|
|
108
|
+
/**
|
|
109
|
+
* Max screens to crawl per segment (default 50).
|
|
110
|
+
* After this limit the crawl pauses and remaining URLs are saved so the
|
|
111
|
+
* next job can continue. Total crawl is unlimited — just runs in multiple jobs.
|
|
112
|
+
*/
|
|
113
|
+
segmentSize?: number;
|
|
114
|
+
/** URLs still queued from a previous segment — injected by the job-queue auto-continuation. */
|
|
115
|
+
resumeUrls?: string[];
|
|
116
|
+
/** Segment number (1-based) — used for progress display only. */
|
|
117
|
+
segmentIndex?: number;
|
|
118
|
+
/** Seed the crawl queue from the project's sitemap.xml, in addition to link-following. */
|
|
119
|
+
useSitemap?: boolean;
|
|
120
|
+
/** Explicit sitemap URL override — defaults to `${origin}/sitemap.xml` when useSitemap is set. */
|
|
121
|
+
sitemapUrl?: string;
|
|
122
|
+
/** Crawl queue traversal order. Default BFS — unchanged behavior from before this option existed. */
|
|
123
|
+
traversalStrategy?: TraversalStrategy;
|
|
124
|
+
/** BEST_FIRST only: URLs containing any of these (case-insensitive) are prioritized. */
|
|
125
|
+
bestFirstKeywords?: string[];
|
|
126
|
+
/** When true, skip URLs disallowed by the site's robots.txt. Default false. */
|
|
127
|
+
respectRobotsTxt?: boolean;
|
|
128
|
+
/** When true, dynamically slow crawl speed when server response latency is high (Scrapy-style AutoThrottle). Default false. */
|
|
129
|
+
autoThrottle?: boolean;
|
|
130
|
+
/** Regex pattern — only crawl URLs whose path+query match this pattern. */
|
|
131
|
+
urlFilter?: string;
|
|
132
|
+
/** Already-captured URLs from a previous failed job — pre-seeded into visited map so they're never re-crawled. */
|
|
133
|
+
skipUrls?: string[];
|
|
134
|
+
/** DOM hashes collected in a prior segment — prevents re-screenshotting structurally identical pages across segments. */
|
|
135
|
+
knownDomHashes?: string[];
|
|
136
|
+
/** Called every 10 successful screen captures with current visited URLs and remaining queue — used for checkpoint persistence. */
|
|
137
|
+
onCheckpoint?: (visitedUrls: string[], pendingQueue: string[]) => Promise<void>;
|
|
138
|
+
/** Discovery mode only: called after each page with the current set of discovered original URLs — enables streaming partial results to callers. */
|
|
139
|
+
onUrlsDiscovered?: (urls: string[]) => Promise<void>;
|
|
140
|
+
}, onProgress?: (pct: number, step: string) => Promise<void>): Promise<{
|
|
141
|
+
discoveredUrls: string[];
|
|
142
|
+
screensFound: number;
|
|
143
|
+
screensErrored: number;
|
|
144
|
+
screensSkippedToNextSegment: number;
|
|
145
|
+
isPartial: boolean;
|
|
146
|
+
discovered: never[];
|
|
147
|
+
apiEndpoints: never[];
|
|
148
|
+
performanceMetrics: never[];
|
|
149
|
+
pendingUrls: never[];
|
|
150
|
+
segmentIndex: number;
|
|
151
|
+
hasMoreSegments: boolean;
|
|
152
|
+
domHashes: string[];
|
|
153
|
+
} | {
|
|
154
|
+
screensFound: number;
|
|
155
|
+
screensErrored: number;
|
|
156
|
+
screensSkippedToNextSegment: number;
|
|
157
|
+
isPartial: boolean;
|
|
158
|
+
discovered: {
|
|
159
|
+
url: string;
|
|
160
|
+
screenId?: string;
|
|
161
|
+
elements?: number;
|
|
162
|
+
elementFacts?: Array<{
|
|
163
|
+
meaning: string;
|
|
164
|
+
role: string;
|
|
165
|
+
expectedData?: string;
|
|
166
|
+
}>;
|
|
167
|
+
screenshotPath?: string;
|
|
168
|
+
version?: number;
|
|
169
|
+
error?: string;
|
|
170
|
+
}[];
|
|
171
|
+
apiEndpoints: ApiEndpointObservationInput[];
|
|
172
|
+
performanceMetrics: PerformanceMetric[];
|
|
173
|
+
pendingUrls: string[];
|
|
174
|
+
segmentIndex: number;
|
|
175
|
+
hasMoreSegments: boolean;
|
|
176
|
+
domHashes: string[];
|
|
177
|
+
discoveredUrls?: undefined;
|
|
178
|
+
}>;
|
|
179
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom JS injector — run user-provided JavaScript in the context of each crawled page.
|
|
3
|
+
*
|
|
4
|
+
* Use cases:
|
|
5
|
+
* - Extract custom data points not captured by standard extractors
|
|
6
|
+
* - Set localStorage/sessionStorage values before crawl
|
|
7
|
+
* - Override fetch() to intercept API calls
|
|
8
|
+
* - Simulate user events (keydown, focus, etc.)
|
|
9
|
+
* - Bypass specific anti-bot checks
|
|
10
|
+
*
|
|
11
|
+
* Security: scripts run in the page context (sandboxed by Chromium's renderer).
|
|
12
|
+
* They cannot access the Node.js process or file system.
|
|
13
|
+
* ZeTa validates scripts are strings before injection.
|
|
14
|
+
*/
|
|
15
|
+
import type { Page } from 'playwright';
|
|
16
|
+
export interface JsInjectionOpts {
|
|
17
|
+
/** Script to run on every page BEFORE navigation (via page.addInitScript) */
|
|
18
|
+
initScript?: string;
|
|
19
|
+
/** Script to run on every page AFTER navigation completes (via page.evaluate) */
|
|
20
|
+
postLoadScript?: string;
|
|
21
|
+
/** Key-value pairs to set in localStorage before page load */
|
|
22
|
+
localStorage?: Record<string, string>;
|
|
23
|
+
/** Key-value pairs to set in sessionStorage before page load */
|
|
24
|
+
sessionStorage?: Record<string, string>;
|
|
25
|
+
/** Cookie key-value pairs to add before page load */
|
|
26
|
+
cookies?: Array<{
|
|
27
|
+
name: string;
|
|
28
|
+
value: string;
|
|
29
|
+
domain?: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface JsInjectionResult {
|
|
34
|
+
initScriptApplied: boolean;
|
|
35
|
+
postLoadResult: unknown;
|
|
36
|
+
storageSet: boolean;
|
|
37
|
+
cookiesSet: number;
|
|
38
|
+
error?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function injectCustomJs(page: Page, opts: JsInjectionOpts): Promise<JsInjectionResult>;
|
|
41
|
+
/** Safe string validator — ensures script is a string, not an object/function reference */
|
|
42
|
+
export declare function validateScript(script: unknown): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dark mode capture — screenshot pages in both light and dark color schemes.
|
|
3
|
+
*
|
|
4
|
+
* Uses Playwright's page.emulateMedia({ colorScheme: 'dark' }) to force dark mode,
|
|
5
|
+
* then captures a screenshot. Compares with light mode to determine if dark mode
|
|
6
|
+
* is supported (significant visual difference).
|
|
7
|
+
*
|
|
8
|
+
* Also detects prefers-color-scheme media query support in CSS.
|
|
9
|
+
*/
|
|
10
|
+
import type { Page } from 'playwright';
|
|
11
|
+
export interface DarkModeCapture {
|
|
12
|
+
url: string;
|
|
13
|
+
lightScreenshot?: Buffer;
|
|
14
|
+
darkScreenshot?: Buffer;
|
|
15
|
+
hasDarkMode: boolean;
|
|
16
|
+
hasCssDarkMode: boolean;
|
|
17
|
+
backgroundColorLight?: string;
|
|
18
|
+
backgroundColorDark?: string;
|
|
19
|
+
capturedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function captureDarkMode(page: Page, url: string, opts?: {
|
|
22
|
+
takeScreenshots?: boolean;
|
|
23
|
+
}): Promise<DarkModeCapture>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dead link detector — tracks broken links discovered during crawl.
|
|
3
|
+
*
|
|
4
|
+
* A "dead link" is a URL that:
|
|
5
|
+
* - Returns 404, 410, or other 4xx/5xx responses
|
|
6
|
+
* - Times out after maxRetries
|
|
7
|
+
* - Redirects to an error page (detected by title heuristic)
|
|
8
|
+
*
|
|
9
|
+
* Results: list of broken links with source page, status code, and anchor text.
|
|
10
|
+
* Used for: SEO audit export, test report enrichment.
|
|
11
|
+
*/
|
|
12
|
+
export interface DeadLink {
|
|
13
|
+
url: string;
|
|
14
|
+
statusCode: number;
|
|
15
|
+
sourceUrl?: string;
|
|
16
|
+
anchorText?: string;
|
|
17
|
+
checkedAt: string;
|
|
18
|
+
reason: 'http-error' | 'timeout' | 'dns-error';
|
|
19
|
+
}
|
|
20
|
+
export declare class DeadLinkTracker {
|
|
21
|
+
private deadLinks;
|
|
22
|
+
private checked;
|
|
23
|
+
record(url: string, statusCode: number, source?: {
|
|
24
|
+
sourceUrl?: string;
|
|
25
|
+
anchorText?: string;
|
|
26
|
+
}): void;
|
|
27
|
+
recordTimeout(url: string, sourceUrl?: string): void;
|
|
28
|
+
getDeadLinks(): DeadLink[];
|
|
29
|
+
isKnownBroken(url: string): boolean;
|
|
30
|
+
stats(): {
|
|
31
|
+
total: number;
|
|
32
|
+
by404: number;
|
|
33
|
+
by5xx: number;
|
|
34
|
+
byTimeout: number;
|
|
35
|
+
};
|
|
36
|
+
toCsv(): string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute a stable fingerprint of a screen's element set.
|
|
3
|
+
* Sorted so insertion-order changes (React re-renders) don't produce false positives.
|
|
4
|
+
* Returns first 16 hex chars of SHA-256.
|
|
5
|
+
*/
|
|
6
|
+
export declare function computeElementHash(elements: Array<{
|
|
7
|
+
role: string;
|
|
8
|
+
meaning: string;
|
|
9
|
+
}>): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email OTP retrieval — supports 3 providers:
|
|
3
|
+
* mailslurp — managed SaaS (existing, no self-hosting)
|
|
4
|
+
* imap — any real IMAP mailbox (Gmail, Outlook, custom domain catch-all)
|
|
5
|
+
* mailpit — self-hosted SMTP trap (dev/staging only)
|
|
6
|
+
*
|
|
7
|
+
* Use mailslurp or imap for production apps.
|
|
8
|
+
* Use mailpit only when you can point the app's SMTP at the trap server.
|
|
9
|
+
*/
|
|
10
|
+
export type EmailOTPProvider = 'mailslurp' | 'imap' | 'mailpit';
|
|
11
|
+
export interface EmailContent {
|
|
12
|
+
/** 4-8 digit OTP code, if found. */
|
|
13
|
+
otp?: string;
|
|
14
|
+
/** Magic link URL to navigate to, if found. */
|
|
15
|
+
magicLink?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface EmailOTPConfig {
|
|
18
|
+
provider: EmailOTPProvider;
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
inboxId?: string;
|
|
21
|
+
imapHost?: string;
|
|
22
|
+
imapPort?: number;
|
|
23
|
+
imapUser?: string;
|
|
24
|
+
imapPass?: string;
|
|
25
|
+
imapTls?: boolean;
|
|
26
|
+
mailpitBaseUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Wait for an email and return its OTP code or magic link URL.
|
|
30
|
+
* Prefer this over waitForEmailOTP when the app may send passwordless magic links.
|
|
31
|
+
*/
|
|
32
|
+
export declare function waitForEmailContent(config: EmailOTPConfig, since: string | Date): Promise<EmailContent | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Wait for an OTP email and extract the code.
|
|
35
|
+
* @deprecated Use waitForEmailContent which also handles magic links.
|
|
36
|
+
*/
|
|
37
|
+
export declare function waitForEmailOTP(config: EmailOTPConfig, since: string | Date): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the email address for a MailSlurp inbox (used to display in UI).
|
|
40
|
+
* Returns null for IMAP/Mailpit providers — use imapUser directly.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getInboxEmail(configOrApiKey: EmailOTPConfig | string, inboxId?: string): Promise<string | null>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DomainProfile } from './profiles/domain-profile.js';
|
|
2
|
+
export type CrawlEngineName = 'http' | 'browser' | 'browser-stealth' | 'stagehand' | 'vision' | 'recorded-session' | 'native';
|
|
3
|
+
export interface CrawlRouteDecisionInput {
|
|
4
|
+
appUrl: string;
|
|
5
|
+
appType?: string | null;
|
|
6
|
+
hasCredentials: boolean;
|
|
7
|
+
hasStorageState: boolean;
|
|
8
|
+
hasAuthToken: boolean;
|
|
9
|
+
hasSkyvern: boolean;
|
|
10
|
+
hasProxy: boolean;
|
|
11
|
+
profile: DomainProfile;
|
|
12
|
+
previousFailureReason?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CrawlRouteDecision {
|
|
15
|
+
engines: CrawlEngineName[];
|
|
16
|
+
reasons: string[];
|
|
17
|
+
confidence: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Per-domain rendering predictor — learns whether a domain requires a full browser
|
|
21
|
+
* or can be served by the fast HTTP engine. Implements adaptive crawlee-python pattern.
|
|
22
|
+
*
|
|
23
|
+
* Strategy:
|
|
24
|
+
* 1. On first encounter of a domain, classify the HTTP response body.
|
|
25
|
+
* 2. Store the decision in memory (Map). All future URLs on same domain skip re-testing.
|
|
26
|
+
* 3. "Requires browser" signals: React/Vue/Angular root with no content, tiny body (<500 chars meaningful text).
|
|
27
|
+
*/
|
|
28
|
+
export declare class RenderingTypePredictor {
|
|
29
|
+
private cache;
|
|
30
|
+
/** Return cached decision if available, undefined if unknown. */
|
|
31
|
+
getCached(url: string): 'http' | 'browser' | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Analyze an HTTP response body to predict if JS rendering is required.
|
|
34
|
+
* Returns 'browser' if JS-heavy signals detected, 'http' otherwise.
|
|
35
|
+
*/
|
|
36
|
+
predict(url: string, htmlBody: string, statusCode: number): 'http' | 'browser';
|
|
37
|
+
/** Force a domain to use a specific engine (e.g. after observing crawl errors). */
|
|
38
|
+
set(url: string, engine: 'http' | 'browser'): void;
|
|
39
|
+
stats(): {
|
|
40
|
+
cached: number;
|
|
41
|
+
browserDomains: string[];
|
|
42
|
+
httpDomains: string[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Singleton predictor — shared across crawl jobs in the same process. */
|
|
46
|
+
export declare const renderingPredictor: RenderingTypePredictor;
|
|
47
|
+
export declare function chooseCrawlEngines(input: CrawlRouteDecisionInput): CrawlRouteDecision;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bulk export — export crawled screens to CSV / JSON / Markdown digest.
|
|
3
|
+
*
|
|
4
|
+
* Outputs:
|
|
5
|
+
* - CSV: url, name, wordCount, screenshotPath, markdownPath, createdAt — for spreadsheet analysis
|
|
6
|
+
* - JSON: full screen records array — for API integration
|
|
7
|
+
* - Markdown digest: concatenated markdown of all screens — for LLM context windows
|
|
8
|
+
*/
|
|
9
|
+
export interface ExportScreen {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
url: string;
|
|
13
|
+
projectId: string;
|
|
14
|
+
wordCount?: number;
|
|
15
|
+
screenshotPath?: string | null;
|
|
16
|
+
markdownPath?: string | null;
|
|
17
|
+
markdown?: string | null;
|
|
18
|
+
createdAt?: Date;
|
|
19
|
+
updatedAt?: Date;
|
|
20
|
+
}
|
|
21
|
+
export declare function exportToCsv(screens: ExportScreen[], outputPath: string): Promise<void>;
|
|
22
|
+
export declare function exportToJson(screens: ExportScreen[], outputPath: string): Promise<void>;
|
|
23
|
+
export declare function exportToMarkdownDigest(screens: ExportScreen[], outputPath: string, opts?: {
|
|
24
|
+
readMarkdownFromPath?: boolean;
|
|
25
|
+
maxScreens?: number;
|
|
26
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector DB export — convert crawled screens to embedding-ready chunks.
|
|
3
|
+
*
|
|
4
|
+
* Produces a JSONL file where each line is one chunk ready for upsert into
|
|
5
|
+
* Pinecone, Qdrant, Weaviate, or any vector store. The embedding itself is
|
|
6
|
+
* NOT generated here (requires an embedding model at the user's end) — we
|
|
7
|
+
* produce the text chunks + metadata, and the caller embeds them.
|
|
8
|
+
*
|
|
9
|
+
* Format per line (JSONL):
|
|
10
|
+
* {
|
|
11
|
+
* "id": "<screenId>-<chunkIndex>",
|
|
12
|
+
* "text": "<chunk text>",
|
|
13
|
+
* "metadata": {
|
|
14
|
+
* "screenId": "...",
|
|
15
|
+
* "projectId": "...",
|
|
16
|
+
* "tenantId": "...",
|
|
17
|
+
* "url": "...",
|
|
18
|
+
* "screenName": "...",
|
|
19
|
+
* "chunkIndex": 0,
|
|
20
|
+
* "totalChunks": 3,
|
|
21
|
+
* "crawledAt": "2026-...",
|
|
22
|
+
* "wordCount": 142
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
export interface VectorChunk {
|
|
27
|
+
id: string;
|
|
28
|
+
text: string;
|
|
29
|
+
metadata: {
|
|
30
|
+
screenId: string;
|
|
31
|
+
projectId: string;
|
|
32
|
+
tenantId: string;
|
|
33
|
+
url: string;
|
|
34
|
+
screenName: string;
|
|
35
|
+
chunkIndex: number;
|
|
36
|
+
totalChunks: number;
|
|
37
|
+
crawledAt: string;
|
|
38
|
+
wordCount: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface ScreenRecord {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
url: string;
|
|
45
|
+
projectId: string;
|
|
46
|
+
tenantId: string;
|
|
47
|
+
markdown?: string | null;
|
|
48
|
+
markdownPath?: string | null;
|
|
49
|
+
updatedAt?: Date;
|
|
50
|
+
}
|
|
51
|
+
export declare function exportScreensToVectorJsonl(screens: ScreenRecord[], outputPath: string, opts?: {
|
|
52
|
+
maxChunkWords?: number;
|
|
53
|
+
readMarkdownFromPath?: boolean;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
totalChunks: number;
|
|
56
|
+
skipped: number;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Pinecone-compatible upsert batch format.
|
|
60
|
+
* Call this after generating embeddings to produce the final upsert payload.
|
|
61
|
+
*/
|
|
62
|
+
export declare function toPineconeUpsert(chunks: VectorChunk[], embeddings: number[][], namespace?: string): Array<{
|
|
63
|
+
id: string;
|
|
64
|
+
values: number[];
|
|
65
|
+
metadata: VectorChunk['metadata'];
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Qdrant-compatible point format.
|
|
69
|
+
*/
|
|
70
|
+
export declare function toQdrantPoints(chunks: VectorChunk[], embeddings: number[][]): Array<{
|
|
71
|
+
id: string;
|
|
72
|
+
vector: number[];
|
|
73
|
+
payload: VectorChunk['metadata'] & {
|
|
74
|
+
text: string;
|
|
75
|
+
};
|
|
76
|
+
}>;
|