@iflow-mcp/jakeliume-webpeel 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +313 -0
- package/dist/cache.d.ts +30 -0
- package/dist/cache.js +139 -0
- package/dist/cli/commands/auth.d.ts +5 -0
- package/dist/cli/commands/auth.js +411 -0
- package/dist/cli/commands/doctor.d.ts +37 -0
- package/dist/cli/commands/doctor.js +371 -0
- package/dist/cli/commands/fetch.d.ts +6 -0
- package/dist/cli/commands/fetch.js +1345 -0
- package/dist/cli/commands/guide.d.ts +2 -0
- package/dist/cli/commands/guide.js +183 -0
- package/dist/cli/commands/interact.d.ts +5 -0
- package/dist/cli/commands/interact.js +840 -0
- package/dist/cli/commands/jobs.d.ts +5 -0
- package/dist/cli/commands/jobs.js +997 -0
- package/dist/cli/commands/monitor.d.ts +12 -0
- package/dist/cli/commands/monitor.js +197 -0
- package/dist/cli/commands/observe.d.ts +12 -0
- package/dist/cli/commands/observe.js +158 -0
- package/dist/cli/commands/screenshot.d.ts +5 -0
- package/dist/cli/commands/screenshot.js +282 -0
- package/dist/cli/commands/search.d.ts +5 -0
- package/dist/cli/commands/search.js +1021 -0
- package/dist/cli/commands/setup.d.ts +13 -0
- package/dist/cli/commands/setup.js +244 -0
- package/dist/cli/commands/skill.d.ts +15 -0
- package/dist/cli/commands/skill.js +195 -0
- package/dist/cli/utils.d.ts +84 -0
- package/dist/cli/utils.js +806 -0
- package/dist/cli-auth.d.ts +75 -0
- package/dist/cli-auth.js +369 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +99 -0
- package/dist/core/actions.d.ts +69 -0
- package/dist/core/actions.js +495 -0
- package/dist/core/agent.d.ts +98 -0
- package/dist/core/agent.js +558 -0
- package/dist/core/answer.d.ts +42 -0
- package/dist/core/answer.js +395 -0
- package/dist/core/application-tracker.d.ts +84 -0
- package/dist/core/application-tracker.js +184 -0
- package/dist/core/apply.d.ts +162 -0
- package/dist/core/apply.js +816 -0
- package/dist/core/auth-detection.d.ts +35 -0
- package/dist/core/auth-detection.js +358 -0
- package/dist/core/auto-extract.d.ts +82 -0
- package/dist/core/auto-extract.js +604 -0
- package/dist/core/auto-interact.d.ts +23 -0
- package/dist/core/auto-interact.js +246 -0
- package/dist/core/bm25-filter.d.ts +66 -0
- package/dist/core/bm25-filter.js +288 -0
- package/dist/core/branding.d.ts +54 -0
- package/dist/core/branding.js +234 -0
- package/dist/core/browser-fetch.d.ts +323 -0
- package/dist/core/browser-fetch.js +1600 -0
- package/dist/core/browser-pool.d.ts +91 -0
- package/dist/core/browser-pool.js +550 -0
- package/dist/core/budget.d.ts +42 -0
- package/dist/core/budget.js +324 -0
- package/dist/core/business-intel.d.ts +47 -0
- package/dist/core/business-intel.js +279 -0
- package/dist/core/cache.d.ts +13 -0
- package/dist/core/cache.js +121 -0
- package/dist/core/cf-worker-proxy.d.ts +32 -0
- package/dist/core/cf-worker-proxy.js +87 -0
- package/dist/core/challenge-detection.d.ts +26 -0
- package/dist/core/challenge-detection.js +468 -0
- package/dist/core/change-tracking.d.ts +75 -0
- package/dist/core/change-tracking.js +276 -0
- package/dist/core/chunker.d.ts +46 -0
- package/dist/core/chunker.js +249 -0
- package/dist/core/chunking.d.ts +42 -0
- package/dist/core/chunking.js +181 -0
- package/dist/core/circuit-breaker.d.ts +44 -0
- package/dist/core/circuit-breaker.js +85 -0
- package/dist/core/content-pruner.d.ts +47 -0
- package/dist/core/content-pruner.js +425 -0
- package/dist/core/cookie-cache.d.ts +60 -0
- package/dist/core/cookie-cache.js +163 -0
- package/dist/core/crawl-checkpoint.d.ts +54 -0
- package/dist/core/crawl-checkpoint.js +104 -0
- package/dist/core/crawler.d.ts +84 -0
- package/dist/core/crawler.js +349 -0
- package/dist/core/cross-verify.d.ts +27 -0
- package/dist/core/cross-verify.js +93 -0
- package/dist/core/deep-fetch.d.ts +74 -0
- package/dist/core/deep-fetch.js +405 -0
- package/dist/core/deep-research.d.ts +141 -0
- package/dist/core/deep-research.js +972 -0
- package/dist/core/design-analysis.d.ts +70 -0
- package/dist/core/design-analysis.js +490 -0
- package/dist/core/design-compare.d.ts +38 -0
- package/dist/core/design-compare.js +264 -0
- package/dist/core/diff.d.ts +61 -0
- package/dist/core/diff.js +289 -0
- package/dist/core/dns-cache.d.ts +20 -0
- package/dist/core/dns-cache.js +198 -0
- package/dist/core/documents.d.ts +23 -0
- package/dist/core/documents.js +123 -0
- package/dist/core/domain-memory.d.ts +66 -0
- package/dist/core/domain-memory.js +163 -0
- package/dist/core/domain-verify.d.ts +40 -0
- package/dist/core/domain-verify.js +379 -0
- package/dist/core/engine-ranker.d.ts +112 -0
- package/dist/core/engine-ranker.js +395 -0
- package/dist/core/extract-inline.d.ts +38 -0
- package/dist/core/extract-inline.js +215 -0
- package/dist/core/extract-listings.d.ts +38 -0
- package/dist/core/extract-listings.js +461 -0
- package/dist/core/extract.d.ts +9 -0
- package/dist/core/extract.js +139 -0
- package/dist/core/fetch-cache.d.ts +57 -0
- package/dist/core/fetch-cache.js +95 -0
- package/dist/core/fetcher.d.ts +13 -0
- package/dist/core/fetcher.js +12 -0
- package/dist/core/google-cache.d.ts +29 -0
- package/dist/core/google-cache.js +180 -0
- package/dist/core/google-serp-parser.d.ts +82 -0
- package/dist/core/google-serp-parser.js +287 -0
- package/dist/core/hotel-search.d.ts +122 -0
- package/dist/core/hotel-search.js +382 -0
- package/dist/core/http-fetch.d.ts +72 -0
- package/dist/core/http-fetch.js +820 -0
- package/dist/core/human.d.ts +175 -0
- package/dist/core/human.js +680 -0
- package/dist/core/image-caption.d.ts +44 -0
- package/dist/core/image-caption.js +271 -0
- package/dist/core/jobs.d.ts +75 -0
- package/dist/core/jobs.js +634 -0
- package/dist/core/json-ld.d.ts +15 -0
- package/dist/core/json-ld.js +617 -0
- package/dist/core/language-detect.d.ts +18 -0
- package/dist/core/language-detect.js +135 -0
- package/dist/core/links.d.ts +10 -0
- package/dist/core/links.js +44 -0
- package/dist/core/llm-extract.d.ts +71 -0
- package/dist/core/llm-extract.js +507 -0
- package/dist/core/llm-provider.d.ts +100 -0
- package/dist/core/llm-provider.js +702 -0
- package/dist/core/local-search.d.ts +60 -0
- package/dist/core/local-search.js +308 -0
- package/dist/core/logger.d.ts +28 -0
- package/dist/core/logger.js +104 -0
- package/dist/core/map.d.ts +33 -0
- package/dist/core/map.js +127 -0
- package/dist/core/markdown.d.ts +92 -0
- package/dist/core/markdown.js +809 -0
- package/dist/core/metadata.d.ts +34 -0
- package/dist/core/metadata.js +422 -0
- package/dist/core/observe.d.ts +113 -0
- package/dist/core/observe.js +395 -0
- package/dist/core/ocr.d.ts +12 -0
- package/dist/core/ocr.js +33 -0
- package/dist/core/paginate.d.ts +31 -0
- package/dist/core/paginate.js +106 -0
- package/dist/core/pdf.d.ts +8 -0
- package/dist/core/pdf.js +25 -0
- package/dist/core/peel-tls.d.ts +25 -0
- package/dist/core/peel-tls.js +220 -0
- package/dist/core/pipeline.d.ts +132 -0
- package/dist/core/pipeline.js +1666 -0
- package/dist/core/profiles.d.ts +61 -0
- package/dist/core/profiles.js +350 -0
- package/dist/core/prompt-guard.d.ts +30 -0
- package/dist/core/prompt-guard.js +119 -0
- package/dist/core/proxy-config.d.ts +90 -0
- package/dist/core/proxy-config.js +172 -0
- package/dist/core/quick-answer.d.ts +53 -0
- package/dist/core/quick-answer.js +833 -0
- package/dist/core/rate-governor.d.ts +80 -0
- package/dist/core/rate-governor.js +238 -0
- package/dist/core/readability.d.ts +57 -0
- package/dist/core/readability.js +533 -0
- package/dist/core/research.d.ts +66 -0
- package/dist/core/research.js +270 -0
- package/dist/core/retry.d.ts +60 -0
- package/dist/core/retry.js +119 -0
- package/dist/core/safe-browsing.d.ts +30 -0
- package/dist/core/safe-browsing.js +206 -0
- package/dist/core/schema-extraction.d.ts +66 -0
- package/dist/core/schema-extraction.js +352 -0
- package/dist/core/schema-postprocess.d.ts +32 -0
- package/dist/core/schema-postprocess.js +469 -0
- package/dist/core/schema-templates.d.ts +19 -0
- package/dist/core/schema-templates.js +143 -0
- package/dist/core/screenshot.d.ts +224 -0
- package/dist/core/screenshot.js +207 -0
- package/dist/core/search-engines.d.ts +25 -0
- package/dist/core/search-engines.js +182 -0
- package/dist/core/search-provider.d.ts +243 -0
- package/dist/core/search-provider.js +1629 -0
- package/dist/core/searxng-provider.d.ts +35 -0
- package/dist/core/searxng-provider.js +105 -0
- package/dist/core/selective-evidence.d.ts +151 -0
- package/dist/core/selective-evidence.js +389 -0
- package/dist/core/site-search.d.ts +44 -0
- package/dist/core/site-search.js +252 -0
- package/dist/core/sitemap.d.ts +23 -0
- package/dist/core/sitemap.js +105 -0
- package/dist/core/source-credibility.d.ts +29 -0
- package/dist/core/source-credibility.js +584 -0
- package/dist/core/source-scoring.d.ts +166 -0
- package/dist/core/source-scoring.js +396 -0
- package/dist/core/stemmer.d.ts +38 -0
- package/dist/core/stemmer.js +509 -0
- package/dist/core/strategies.d.ts +104 -0
- package/dist/core/strategies.js +1044 -0
- package/dist/core/strategy-hooks.d.ts +145 -0
- package/dist/core/strategy-hooks.js +74 -0
- package/dist/core/structured-extract.d.ts +43 -0
- package/dist/core/structured-extract.js +550 -0
- package/dist/core/summarize.d.ts +17 -0
- package/dist/core/summarize.js +78 -0
- package/dist/core/synonyms.d.ts +42 -0
- package/dist/core/synonyms.js +184 -0
- package/dist/core/system-monitor.d.ts +61 -0
- package/dist/core/system-monitor.js +133 -0
- package/dist/core/table-format.d.ts +30 -0
- package/dist/core/table-format.js +146 -0
- package/dist/core/threat-feeds.d.ts +23 -0
- package/dist/core/threat-feeds.js +104 -0
- package/dist/core/timing.d.ts +21 -0
- package/dist/core/timing.js +33 -0
- package/dist/core/transcript-export.d.ts +47 -0
- package/dist/core/transcript-export.js +107 -0
- package/dist/core/user-agents.d.ts +82 -0
- package/dist/core/user-agents.js +239 -0
- package/dist/core/vertical-search.d.ts +54 -0
- package/dist/core/vertical-search.js +158 -0
- package/dist/core/watch-manager.d.ts +175 -0
- package/dist/core/watch-manager.js +416 -0
- package/dist/core/watch.d.ts +101 -0
- package/dist/core/watch.js +389 -0
- package/dist/core/youtube.d.ts +130 -0
- package/dist/core/youtube.js +1175 -0
- package/dist/ee/challenge-re-export.d.ts +1 -0
- package/dist/ee/challenge-re-export.js +1 -0
- package/dist/ee/challenge-solver.d.ts +72 -0
- package/dist/ee/challenge-solver.js +720 -0
- package/dist/ee/domain-extractors.d.ts +8 -0
- package/dist/ee/domain-extractors.js +8 -0
- package/dist/ee/domain-intel.d.ts +16 -0
- package/dist/ee/domain-intel.js +133 -0
- package/dist/ee/extractors/allrecipes.d.ts +2 -0
- package/dist/ee/extractors/allrecipes.js +120 -0
- package/dist/ee/extractors/amazon.d.ts +2 -0
- package/dist/ee/extractors/amazon.js +78 -0
- package/dist/ee/extractors/arxiv.d.ts +2 -0
- package/dist/ee/extractors/arxiv.js +137 -0
- package/dist/ee/extractors/bestbuy.d.ts +2 -0
- package/dist/ee/extractors/bestbuy.js +78 -0
- package/dist/ee/extractors/carscom.d.ts +2 -0
- package/dist/ee/extractors/carscom.js +121 -0
- package/dist/ee/extractors/coingecko.d.ts +2 -0
- package/dist/ee/extractors/coingecko.js +134 -0
- package/dist/ee/extractors/craigslist.d.ts +2 -0
- package/dist/ee/extractors/craigslist.js +92 -0
- package/dist/ee/extractors/devto.d.ts +2 -0
- package/dist/ee/extractors/devto.js +135 -0
- package/dist/ee/extractors/ebay.d.ts +2 -0
- package/dist/ee/extractors/ebay.js +90 -0
- package/dist/ee/extractors/espn.d.ts +2 -0
- package/dist/ee/extractors/espn.js +260 -0
- package/dist/ee/extractors/etsy.d.ts +2 -0
- package/dist/ee/extractors/etsy.js +52 -0
- package/dist/ee/extractors/facebook.d.ts +2 -0
- package/dist/ee/extractors/facebook.js +46 -0
- package/dist/ee/extractors/github.d.ts +2 -0
- package/dist/ee/extractors/github.js +196 -0
- package/dist/ee/extractors/google-flights.d.ts +2 -0
- package/dist/ee/extractors/google-flights.js +176 -0
- package/dist/ee/extractors/hackernews.d.ts +2 -0
- package/dist/ee/extractors/hackernews.js +147 -0
- package/dist/ee/extractors/imdb.d.ts +2 -0
- package/dist/ee/extractors/imdb.js +172 -0
- package/dist/ee/extractors/index.d.ts +26 -0
- package/dist/ee/extractors/index.js +247 -0
- package/dist/ee/extractors/instagram.d.ts +2 -0
- package/dist/ee/extractors/instagram.js +102 -0
- package/dist/ee/extractors/kalshi.d.ts +2 -0
- package/dist/ee/extractors/kalshi.js +121 -0
- package/dist/ee/extractors/kayak-cars.d.ts +2 -0
- package/dist/ee/extractors/kayak-cars.js +270 -0
- package/dist/ee/extractors/linkedin.d.ts +2 -0
- package/dist/ee/extractors/linkedin.js +113 -0
- package/dist/ee/extractors/medium.d.ts +2 -0
- package/dist/ee/extractors/medium.js +130 -0
- package/dist/ee/extractors/news.d.ts +4 -0
- package/dist/ee/extractors/news.js +173 -0
- package/dist/ee/extractors/npm.d.ts +2 -0
- package/dist/ee/extractors/npm.js +86 -0
- package/dist/ee/extractors/pdf.d.ts +2 -0
- package/dist/ee/extractors/pdf.js +108 -0
- package/dist/ee/extractors/pinterest.d.ts +2 -0
- package/dist/ee/extractors/pinterest.js +34 -0
- package/dist/ee/extractors/polymarket.d.ts +2 -0
- package/dist/ee/extractors/polymarket.js +358 -0
- package/dist/ee/extractors/producthunt.d.ts +2 -0
- package/dist/ee/extractors/producthunt.js +88 -0
- package/dist/ee/extractors/pubmed.d.ts +2 -0
- package/dist/ee/extractors/pubmed.js +162 -0
- package/dist/ee/extractors/pypi.d.ts +2 -0
- package/dist/ee/extractors/pypi.js +80 -0
- package/dist/ee/extractors/reddit.d.ts +2 -0
- package/dist/ee/extractors/reddit.js +438 -0
- package/dist/ee/extractors/redfin.d.ts +2 -0
- package/dist/ee/extractors/redfin.js +156 -0
- package/dist/ee/extractors/semanticscholar.d.ts +2 -0
- package/dist/ee/extractors/semanticscholar.js +131 -0
- package/dist/ee/extractors/shared.d.ts +12 -0
- package/dist/ee/extractors/shared.js +76 -0
- package/dist/ee/extractors/soundcloud.d.ts +2 -0
- package/dist/ee/extractors/soundcloud.js +34 -0
- package/dist/ee/extractors/sportsbetting.d.ts +2 -0
- package/dist/ee/extractors/sportsbetting.js +37 -0
- package/dist/ee/extractors/spotify.d.ts +2 -0
- package/dist/ee/extractors/spotify.js +34 -0
- package/dist/ee/extractors/stackoverflow.d.ts +2 -0
- package/dist/ee/extractors/stackoverflow.js +61 -0
- package/dist/ee/extractors/substack.d.ts +2 -0
- package/dist/ee/extractors/substack.js +115 -0
- package/dist/ee/extractors/substackroot.d.ts +2 -0
- package/dist/ee/extractors/substackroot.js +46 -0
- package/dist/ee/extractors/tiktok.d.ts +2 -0
- package/dist/ee/extractors/tiktok.js +29 -0
- package/dist/ee/extractors/tradingview.d.ts +2 -0
- package/dist/ee/extractors/tradingview.js +182 -0
- package/dist/ee/extractors/twitch.d.ts +2 -0
- package/dist/ee/extractors/twitch.js +36 -0
- package/dist/ee/extractors/twitter.d.ts +2 -0
- package/dist/ee/extractors/twitter.js +327 -0
- package/dist/ee/extractors/types.d.ts +14 -0
- package/dist/ee/extractors/types.js +1 -0
- package/dist/ee/extractors/walmart.d.ts +2 -0
- package/dist/ee/extractors/walmart.js +50 -0
- package/dist/ee/extractors/weather.d.ts +2 -0
- package/dist/ee/extractors/weather.js +133 -0
- package/dist/ee/extractors/wikipedia.d.ts +4 -0
- package/dist/ee/extractors/wikipedia.js +235 -0
- package/dist/ee/extractors/yelp.d.ts +2 -0
- package/dist/ee/extractors/yelp.js +216 -0
- package/dist/ee/extractors/youtube.d.ts +2 -0
- package/dist/ee/extractors/youtube.js +189 -0
- package/dist/ee/extractors/zillow.d.ts +54 -0
- package/dist/ee/extractors/zillow.js +247 -0
- package/dist/ee/extractors-re-export.d.ts +1 -0
- package/dist/ee/extractors-re-export.js +1 -0
- package/dist/ee/premium-hooks.d.ts +20 -0
- package/dist/ee/premium-hooks.js +50 -0
- package/dist/ee/spa-detection.d.ts +2 -0
- package/dist/ee/spa-detection.js +2 -0
- package/dist/ee/stability.d.ts +4 -0
- package/dist/ee/stability.js +29 -0
- package/dist/ee/swr-cache.d.ts +14 -0
- package/dist/ee/swr-cache.js +34 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.js +291 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/langchain.d.ts +64 -0
- package/dist/integrations/langchain.js +115 -0
- package/dist/integrations/llamaindex.d.ts +50 -0
- package/dist/integrations/llamaindex.js +91 -0
- package/dist/mcp/handlers/act.d.ts +5 -0
- package/dist/mcp/handlers/act.js +34 -0
- package/dist/mcp/handlers/definitions.d.ts +6 -0
- package/dist/mcp/handlers/definitions.js +395 -0
- package/dist/mcp/handlers/extract.d.ts +7 -0
- package/dist/mcp/handlers/extract.js +135 -0
- package/dist/mcp/handlers/fetch.d.ts +6 -0
- package/dist/mcp/handlers/fetch.js +98 -0
- package/dist/mcp/handlers/find.d.ts +5 -0
- package/dist/mcp/handlers/find.js +137 -0
- package/dist/mcp/handlers/index.d.ts +13 -0
- package/dist/mcp/handlers/index.js +63 -0
- package/dist/mcp/handlers/legacy.d.ts +25 -0
- package/dist/mcp/handlers/legacy.js +450 -0
- package/dist/mcp/handlers/meta.d.ts +6 -0
- package/dist/mcp/handlers/meta.js +40 -0
- package/dist/mcp/handlers/monitor.d.ts +5 -0
- package/dist/mcp/handlers/monitor.js +41 -0
- package/dist/mcp/handlers/observe.d.ts +8 -0
- package/dist/mcp/handlers/observe.js +37 -0
- package/dist/mcp/handlers/read.d.ts +6 -0
- package/dist/mcp/handlers/read.js +78 -0
- package/dist/mcp/handlers/see.d.ts +5 -0
- package/dist/mcp/handlers/see.js +75 -0
- package/dist/mcp/handlers/types.d.ts +29 -0
- package/dist/mcp/handlers/types.js +28 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +108 -0
- package/dist/mcp/smart-router.d.ts +23 -0
- package/dist/mcp/smart-router.js +178 -0
- package/dist/server/app.d.ts +14 -0
- package/dist/server/app.js +632 -0
- package/dist/server/auth-store.d.ts +28 -0
- package/dist/server/auth-store.js +88 -0
- package/dist/server/bull-queues.d.ts +60 -0
- package/dist/server/bull-queues.js +90 -0
- package/dist/server/email-service.d.ts +55 -0
- package/dist/server/email-service.js +291 -0
- package/dist/server/job-queue.d.ts +100 -0
- package/dist/server/job-queue.js +145 -0
- package/dist/server/logger.d.ts +10 -0
- package/dist/server/logger.js +37 -0
- package/dist/server/middleware/audit-log.d.ts +14 -0
- package/dist/server/middleware/audit-log.js +73 -0
- package/dist/server/middleware/auth.d.ts +35 -0
- package/dist/server/middleware/auth.js +225 -0
- package/dist/server/middleware/rate-limit.d.ts +50 -0
- package/dist/server/middleware/rate-limit.js +270 -0
- package/dist/server/middleware/scope-guard.d.ts +25 -0
- package/dist/server/middleware/scope-guard.js +45 -0
- package/dist/server/middleware/url-validator.d.ts +15 -0
- package/dist/server/middleware/url-validator.js +201 -0
- package/dist/server/openapi.yaml +6418 -0
- package/dist/server/pg-auth-store.d.ts +146 -0
- package/dist/server/pg-auth-store.js +576 -0
- package/dist/server/pg-job-queue.d.ts +59 -0
- package/dist/server/pg-job-queue.js +375 -0
- package/dist/server/routes/activity.d.ts +6 -0
- package/dist/server/routes/activity.js +79 -0
- package/dist/server/routes/admin-active.d.ts +7 -0
- package/dist/server/routes/admin-active.js +120 -0
- package/dist/server/routes/admin-stats.d.ts +7 -0
- package/dist/server/routes/admin-stats.js +176 -0
- package/dist/server/routes/agent.d.ts +24 -0
- package/dist/server/routes/agent.js +480 -0
- package/dist/server/routes/answer.d.ts +5 -0
- package/dist/server/routes/answer.js +125 -0
- package/dist/server/routes/ask.d.ts +28 -0
- package/dist/server/routes/ask.js +295 -0
- package/dist/server/routes/batch.d.ts +6 -0
- package/dist/server/routes/batch.js +493 -0
- package/dist/server/routes/cache-warm.d.ts +25 -0
- package/dist/server/routes/cache-warm.js +212 -0
- package/dist/server/routes/cli-usage.d.ts +6 -0
- package/dist/server/routes/cli-usage.js +127 -0
- package/dist/server/routes/compat.d.ts +23 -0
- package/dist/server/routes/compat.js +652 -0
- package/dist/server/routes/crawl.d.ts +13 -0
- package/dist/server/routes/crawl.js +287 -0
- package/dist/server/routes/deep-fetch.d.ts +8 -0
- package/dist/server/routes/deep-fetch.js +57 -0
- package/dist/server/routes/deep-research.d.ts +11 -0
- package/dist/server/routes/deep-research.js +232 -0
- package/dist/server/routes/demo.d.ts +24 -0
- package/dist/server/routes/demo.js +517 -0
- package/dist/server/routes/do.d.ts +8 -0
- package/dist/server/routes/do.js +72 -0
- package/dist/server/routes/extract.d.ts +14 -0
- package/dist/server/routes/extract.js +325 -0
- package/dist/server/routes/feed.d.ts +15 -0
- package/dist/server/routes/feed.js +311 -0
- package/dist/server/routes/fetch-queue.d.ts +13 -0
- package/dist/server/routes/fetch-queue.js +357 -0
- package/dist/server/routes/fetch.d.ts +7 -0
- package/dist/server/routes/fetch.js +1274 -0
- package/dist/server/routes/go.d.ts +14 -0
- package/dist/server/routes/go.js +81 -0
- package/dist/server/routes/health.d.ts +11 -0
- package/dist/server/routes/health.js +141 -0
- package/dist/server/routes/jobs.d.ts +7 -0
- package/dist/server/routes/jobs.js +574 -0
- package/dist/server/routes/map.d.ts +11 -0
- package/dist/server/routes/map.js +116 -0
- package/dist/server/routes/mcp.d.ts +14 -0
- package/dist/server/routes/mcp.js +197 -0
- package/dist/server/routes/metrics.d.ts +37 -0
- package/dist/server/routes/metrics.js +149 -0
- package/dist/server/routes/oauth.d.ts +9 -0
- package/dist/server/routes/oauth.js +396 -0
- package/dist/server/routes/playground.d.ts +17 -0
- package/dist/server/routes/playground.js +283 -0
- package/dist/server/routes/reader.d.ts +18 -0
- package/dist/server/routes/reader.js +192 -0
- package/dist/server/routes/research.d.ts +14 -0
- package/dist/server/routes/research.js +482 -0
- package/dist/server/routes/screenshot.d.ts +22 -0
- package/dist/server/routes/screenshot.js +820 -0
- package/dist/server/routes/search.d.ts +6 -0
- package/dist/server/routes/search.js +874 -0
- package/dist/server/routes/session.d.ts +17 -0
- package/dist/server/routes/session.js +548 -0
- package/dist/server/routes/share.d.ts +18 -0
- package/dist/server/routes/share.js +462 -0
- package/dist/server/routes/smart-search/handlers/cars.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/cars.js +102 -0
- package/dist/server/routes/smart-search/handlers/flights.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/flights.js +72 -0
- package/dist/server/routes/smart-search/handlers/general.d.ts +13 -0
- package/dist/server/routes/smart-search/handlers/general.js +717 -0
- package/dist/server/routes/smart-search/handlers/hotels.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/hotels.js +88 -0
- package/dist/server/routes/smart-search/handlers/products.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/products.js +1309 -0
- package/dist/server/routes/smart-search/handlers/rental.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/rental.js +154 -0
- package/dist/server/routes/smart-search/handlers/restaurants.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/restaurants.js +225 -0
- package/dist/server/routes/smart-search/handlers/transit-verdict.d.ts +41 -0
- package/dist/server/routes/smart-search/handlers/transit-verdict.js +224 -0
- package/dist/server/routes/smart-search/index.d.ts +19 -0
- package/dist/server/routes/smart-search/index.js +546 -0
- package/dist/server/routes/smart-search/intent.d.ts +3 -0
- package/dist/server/routes/smart-search/intent.js +264 -0
- package/dist/server/routes/smart-search/llm.d.ts +16 -0
- package/dist/server/routes/smart-search/llm.js +70 -0
- package/dist/server/routes/smart-search/sources/reddit.d.ts +18 -0
- package/dist/server/routes/smart-search/sources/reddit.js +34 -0
- package/dist/server/routes/smart-search/sources/yelp.d.ts +25 -0
- package/dist/server/routes/smart-search/sources/yelp.js +171 -0
- package/dist/server/routes/smart-search/sources/youtube.d.ts +8 -0
- package/dist/server/routes/smart-search/sources/youtube.js +9 -0
- package/dist/server/routes/smart-search/types.d.ts +81 -0
- package/dist/server/routes/smart-search/types.js +1 -0
- package/dist/server/routes/smart-search/utils.d.ts +20 -0
- package/dist/server/routes/smart-search/utils.js +146 -0
- package/dist/server/routes/stats.d.ts +6 -0
- package/dist/server/routes/stats.js +71 -0
- package/dist/server/routes/stripe.d.ts +15 -0
- package/dist/server/routes/stripe.js +296 -0
- package/dist/server/routes/transcript-export.d.ts +10 -0
- package/dist/server/routes/transcript-export.js +178 -0
- package/dist/server/routes/usage.d.ts +9 -0
- package/dist/server/routes/usage.js +279 -0
- package/dist/server/routes/users.d.ts +8 -0
- package/dist/server/routes/users.js +1867 -0
- package/dist/server/routes/watch.d.ts +15 -0
- package/dist/server/routes/watch.js +309 -0
- package/dist/server/routes/webhooks.d.ts +26 -0
- package/dist/server/routes/webhooks.js +170 -0
- package/dist/server/routes/youtube.d.ts +6 -0
- package/dist/server/routes/youtube.js +130 -0
- package/dist/server/sentry.d.ts +14 -0
- package/dist/server/sentry.js +104 -0
- package/dist/server/types.d.ts +15 -0
- package/dist/server/types.js +7 -0
- package/dist/server/utils/response.d.ts +44 -0
- package/dist/server/utils/response.js +69 -0
- package/dist/server/utils/sse.d.ts +22 -0
- package/dist/server/utils/sse.js +38 -0
- package/dist/types.d.ts +552 -0
- package/dist/types.js +39 -0
- package/llms.txt +105 -0
- package/package.json +189 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Porter Stemmer — Lightweight implementation of the Porter stemming algorithm.
|
|
3
|
+
*
|
|
4
|
+
* Based on: Martin Porter, "An algorithm for suffix stripping", 1980.
|
|
5
|
+
* Reference: https://tartarus.org/martin/PorterStemmer/
|
|
6
|
+
*
|
|
7
|
+
* This is a well-tested, deterministic implementation with no external dependencies.
|
|
8
|
+
* It correctly handles all standard Porter stemmer rules including steps 1a-5b.
|
|
9
|
+
*/
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Vowel / consonant helpers
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if character at position i in word is a vowel.
|
|
15
|
+
* 'y' is treated as a vowel when preceded by a consonant.
|
|
16
|
+
*/
|
|
17
|
+
function isVowelAt(word, i) {
|
|
18
|
+
const c = word[i];
|
|
19
|
+
if ('aeiou'.includes(c))
|
|
20
|
+
return true;
|
|
21
|
+
if (c === 'y' && i > 0 && !isVowelAt(word, i - 1))
|
|
22
|
+
return true;
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compute the "measure" m of a string stem.
|
|
27
|
+
* m = number of VC (vowel-then-consonant) transitions.
|
|
28
|
+
* The pattern is: [C](VC)^m[V]
|
|
29
|
+
*/
|
|
30
|
+
function getMeasure(stem) {
|
|
31
|
+
let m = 0;
|
|
32
|
+
let inVowel = false;
|
|
33
|
+
for (let i = 0; i < stem.length; i++) {
|
|
34
|
+
const v = isVowelAt(stem, i);
|
|
35
|
+
if (inVowel && !v) {
|
|
36
|
+
m++;
|
|
37
|
+
inVowel = false;
|
|
38
|
+
}
|
|
39
|
+
else if (!inVowel && v) {
|
|
40
|
+
inVowel = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return m;
|
|
44
|
+
}
|
|
45
|
+
/** Returns true if the stem contains at least one vowel. */
|
|
46
|
+
function containsVowel(stem) {
|
|
47
|
+
for (let i = 0; i < stem.length; i++) {
|
|
48
|
+
if (isVowelAt(stem, i))
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
/** Returns true if the stem ends in a double consonant (same consonant twice). */
|
|
54
|
+
function endsDoubleConsonant(stem) {
|
|
55
|
+
const n = stem.length;
|
|
56
|
+
if (n < 2)
|
|
57
|
+
return false;
|
|
58
|
+
return stem[n - 1] === stem[n - 2] && !isVowelAt(stem, n - 1);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if stem ends in CVC where the final C is not W, X, or Y.
|
|
62
|
+
* This is the "*o" condition in Porter's paper.
|
|
63
|
+
*/
|
|
64
|
+
function endsCVC(stem) {
|
|
65
|
+
const n = stem.length;
|
|
66
|
+
if (n < 3)
|
|
67
|
+
return false;
|
|
68
|
+
const c3 = stem[n - 1];
|
|
69
|
+
return (!isVowelAt(stem, n - 1) &&
|
|
70
|
+
isVowelAt(stem, n - 2) &&
|
|
71
|
+
!isVowelAt(stem, n - 3) &&
|
|
72
|
+
c3 !== 'w' && c3 !== 'x' && c3 !== 'y');
|
|
73
|
+
}
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// Step 1a — Plurals
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
function step1a(word) {
|
|
78
|
+
if (word.endsWith('sses')) {
|
|
79
|
+
return word.slice(0, -2); // caresses → caress
|
|
80
|
+
}
|
|
81
|
+
if (word.endsWith('ies')) {
|
|
82
|
+
return word.slice(0, -2); // ponies → poni
|
|
83
|
+
}
|
|
84
|
+
if (word.endsWith('ss')) {
|
|
85
|
+
return word; // caress → caress (no change)
|
|
86
|
+
}
|
|
87
|
+
if (word.endsWith('s') && word.length > 1) {
|
|
88
|
+
return word.slice(0, -1); // cats → cat
|
|
89
|
+
}
|
|
90
|
+
return word;
|
|
91
|
+
}
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Step 1b — Past tenses / gerunds
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
function step1bFixup(word) {
|
|
96
|
+
// AT → ATE
|
|
97
|
+
if (word.endsWith('at'))
|
|
98
|
+
return word + 'e'; // conflated → conflate
|
|
99
|
+
// BL → BLE
|
|
100
|
+
if (word.endsWith('bl'))
|
|
101
|
+
return word + 'e'; // troubled → trouble
|
|
102
|
+
// IZ → IZE
|
|
103
|
+
if (word.endsWith('iz'))
|
|
104
|
+
return word + 'e'; // sized → size
|
|
105
|
+
// Double consonant (not L, S, Z) → remove one
|
|
106
|
+
if (endsDoubleConsonant(word) &&
|
|
107
|
+
!word.endsWith('ll') &&
|
|
108
|
+
!word.endsWith('ss') &&
|
|
109
|
+
!word.endsWith('zz')) {
|
|
110
|
+
return word.slice(0, -1); // hopping → hop, tapping → tap
|
|
111
|
+
}
|
|
112
|
+
// m=1 and CVC (*o) → add E
|
|
113
|
+
if (getMeasure(word) === 1 && endsCVC(word)) {
|
|
114
|
+
return word + 'e'; // failing → fail handled differently... wait
|
|
115
|
+
// filing → file: after removing ING we get "fil" → m=1 and *o → add E → "file"
|
|
116
|
+
}
|
|
117
|
+
return word;
|
|
118
|
+
}
|
|
119
|
+
function step1b(word) {
|
|
120
|
+
// (m>0) EED → EE
|
|
121
|
+
if (word.endsWith('eed')) {
|
|
122
|
+
const stem = word.slice(0, -3);
|
|
123
|
+
if (getMeasure(stem) > 0) {
|
|
124
|
+
return word.slice(0, -1); // agreed → agre, feed → feed
|
|
125
|
+
}
|
|
126
|
+
return word;
|
|
127
|
+
}
|
|
128
|
+
// (*v*) ED → delete + fixup
|
|
129
|
+
if (word.endsWith('ed')) {
|
|
130
|
+
const stem = word.slice(0, -2);
|
|
131
|
+
if (containsVowel(stem)) {
|
|
132
|
+
return step1bFixup(stem);
|
|
133
|
+
}
|
|
134
|
+
return word;
|
|
135
|
+
}
|
|
136
|
+
// (*v*) ING → delete + fixup
|
|
137
|
+
if (word.endsWith('ing')) {
|
|
138
|
+
const stem = word.slice(0, -3);
|
|
139
|
+
if (containsVowel(stem)) {
|
|
140
|
+
return step1bFixup(stem);
|
|
141
|
+
}
|
|
142
|
+
return word;
|
|
143
|
+
}
|
|
144
|
+
return word;
|
|
145
|
+
}
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
// Step 1c — y → i
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
function step1c(word) {
|
|
150
|
+
if (word.endsWith('y') && word.length > 2) {
|
|
151
|
+
const stem = word.slice(0, -1);
|
|
152
|
+
if (containsVowel(stem)) {
|
|
153
|
+
return stem + 'i'; // happy → happi
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return word;
|
|
157
|
+
}
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Step 2 — Suffix removal (m > 0)
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
const STEP2_RULES = [
|
|
162
|
+
['ational', 'ate'],
|
|
163
|
+
['tional', 'tion'],
|
|
164
|
+
['enci', 'ence'],
|
|
165
|
+
['anci', 'ance'],
|
|
166
|
+
['izer', 'ize'],
|
|
167
|
+
['abli', 'able'],
|
|
168
|
+
['alli', 'al'],
|
|
169
|
+
['entli', 'ent'],
|
|
170
|
+
['eli', 'e'],
|
|
171
|
+
['ousli', 'ous'],
|
|
172
|
+
['ization', 'ize'],
|
|
173
|
+
['ation', 'ate'],
|
|
174
|
+
['ator', 'ate'],
|
|
175
|
+
['alism', 'al'],
|
|
176
|
+
['iveness', 'ive'],
|
|
177
|
+
['fulness', 'ful'],
|
|
178
|
+
['ousness', 'ous'],
|
|
179
|
+
['aliti', 'al'],
|
|
180
|
+
['iviti', 'ive'],
|
|
181
|
+
['biliti', 'ble'],
|
|
182
|
+
];
|
|
183
|
+
function step2(word) {
|
|
184
|
+
for (const [suffix, replacement] of STEP2_RULES) {
|
|
185
|
+
if (word.endsWith(suffix)) {
|
|
186
|
+
const stem = word.slice(0, -suffix.length);
|
|
187
|
+
if (getMeasure(stem) > 0) {
|
|
188
|
+
return stem + replacement;
|
|
189
|
+
}
|
|
190
|
+
return word;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return word;
|
|
194
|
+
}
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// Step 3 — Suffix removal (m > 0)
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
const STEP3_RULES = [
|
|
199
|
+
['icate', 'ic'],
|
|
200
|
+
['ative', ''],
|
|
201
|
+
['alize', 'al'],
|
|
202
|
+
['iciti', 'ic'],
|
|
203
|
+
['ical', 'ic'],
|
|
204
|
+
['ful', ''],
|
|
205
|
+
['ness', ''],
|
|
206
|
+
];
|
|
207
|
+
function step3(word) {
|
|
208
|
+
for (const [suffix, replacement] of STEP3_RULES) {
|
|
209
|
+
if (word.endsWith(suffix)) {
|
|
210
|
+
const stem = word.slice(0, -suffix.length);
|
|
211
|
+
if (getMeasure(stem) > 0) {
|
|
212
|
+
return stem + replacement;
|
|
213
|
+
}
|
|
214
|
+
return word;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return word;
|
|
218
|
+
}
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
// Step 4 — Suffix removal (m > 1)
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
const STEP4_RULES = [
|
|
223
|
+
['ement', ''],
|
|
224
|
+
['ment', ''],
|
|
225
|
+
['ance', ''],
|
|
226
|
+
['ence', ''],
|
|
227
|
+
['able', ''],
|
|
228
|
+
['ible', ''],
|
|
229
|
+
['ism', ''],
|
|
230
|
+
['ate', ''],
|
|
231
|
+
['iti', ''],
|
|
232
|
+
['ous', ''],
|
|
233
|
+
['ive', ''],
|
|
234
|
+
['ize', ''],
|
|
235
|
+
['ant', ''],
|
|
236
|
+
['ent', ''],
|
|
237
|
+
['al', ''],
|
|
238
|
+
['er', ''],
|
|
239
|
+
['ic', ''],
|
|
240
|
+
['ou', ''],
|
|
241
|
+
];
|
|
242
|
+
function step4(word) {
|
|
243
|
+
// Special case: ION — stem must end in S or T
|
|
244
|
+
if (word.endsWith('ion')) {
|
|
245
|
+
const stem = word.slice(0, -3);
|
|
246
|
+
if (getMeasure(stem) > 1 && (stem.endsWith('s') || stem.endsWith('t'))) {
|
|
247
|
+
return stem;
|
|
248
|
+
}
|
|
249
|
+
return word;
|
|
250
|
+
}
|
|
251
|
+
for (const [suffix, replacement] of STEP4_RULES) {
|
|
252
|
+
if (word.endsWith(suffix)) {
|
|
253
|
+
const stem = word.slice(0, -suffix.length);
|
|
254
|
+
if (getMeasure(stem) > 1) {
|
|
255
|
+
return stem + replacement;
|
|
256
|
+
}
|
|
257
|
+
return word;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return word;
|
|
261
|
+
}
|
|
262
|
+
// ---------------------------------------------------------------------------
|
|
263
|
+
// Step 5a — Final E removal
|
|
264
|
+
// ---------------------------------------------------------------------------
|
|
265
|
+
function step5a(word) {
|
|
266
|
+
if (word.endsWith('e')) {
|
|
267
|
+
const stem = word.slice(0, -1);
|
|
268
|
+
const m = getMeasure(stem);
|
|
269
|
+
if (m > 1)
|
|
270
|
+
return stem;
|
|
271
|
+
if (m === 1 && !endsCVC(stem))
|
|
272
|
+
return stem;
|
|
273
|
+
}
|
|
274
|
+
return word;
|
|
275
|
+
}
|
|
276
|
+
// ---------------------------------------------------------------------------
|
|
277
|
+
// Step 5b — Double L removal
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
function step5b(word) {
|
|
280
|
+
if (word.endsWith('ll') && getMeasure(word) > 1) {
|
|
281
|
+
return word.slice(0, -1);
|
|
282
|
+
}
|
|
283
|
+
return word;
|
|
284
|
+
}
|
|
285
|
+
// ---------------------------------------------------------------------------
|
|
286
|
+
// Irregular verb forms table
|
|
287
|
+
// ---------------------------------------------------------------------------
|
|
288
|
+
/**
|
|
289
|
+
* Irregular verb forms → base form.
|
|
290
|
+
* Porter stemmer only handles regular morphology (-ed, -ing, -s).
|
|
291
|
+
* English has ~200 irregular verbs; we cover the most common ones.
|
|
292
|
+
* This table normalizes irregular forms before stemming so that
|
|
293
|
+
* "built" → "build" → stem("build") = "build" matches stem("build").
|
|
294
|
+
*
|
|
295
|
+
* Ambiguous words are intentionally excluded:
|
|
296
|
+
* "found" — could be find (past) OR establish (base form "found a company")
|
|
297
|
+
* "left" — could be leave (past) OR direction
|
|
298
|
+
* "bore"/"borne"/"born" — could be bear (past) OR bore=boring OR born=birth
|
|
299
|
+
* "bound" — could be bind (past) OR boundary (noun)
|
|
300
|
+
*/
|
|
301
|
+
export const IRREGULAR_FORMS = {
|
|
302
|
+
// build
|
|
303
|
+
'built': 'build',
|
|
304
|
+
// run
|
|
305
|
+
'ran': 'run',
|
|
306
|
+
// make
|
|
307
|
+
'made': 'make',
|
|
308
|
+
// write
|
|
309
|
+
'wrote': 'write', 'written': 'write',
|
|
310
|
+
// begin
|
|
311
|
+
'began': 'begin', 'begun': 'begin',
|
|
312
|
+
// give
|
|
313
|
+
'gave': 'give', 'given': 'give',
|
|
314
|
+
// take
|
|
315
|
+
'took': 'take', 'taken': 'take',
|
|
316
|
+
// go
|
|
317
|
+
'went': 'go', 'gone': 'go',
|
|
318
|
+
// come
|
|
319
|
+
'came': 'come',
|
|
320
|
+
// see
|
|
321
|
+
'saw': 'see', 'seen': 'see',
|
|
322
|
+
// know
|
|
323
|
+
'knew': 'know', 'known': 'know',
|
|
324
|
+
// think
|
|
325
|
+
'thought': 'think',
|
|
326
|
+
// tell
|
|
327
|
+
'told': 'tell',
|
|
328
|
+
// say
|
|
329
|
+
'said': 'say',
|
|
330
|
+
// get
|
|
331
|
+
'got': 'get', 'gotten': 'get',
|
|
332
|
+
// buy
|
|
333
|
+
'bought': 'buy',
|
|
334
|
+
// bring
|
|
335
|
+
'brought': 'bring',
|
|
336
|
+
// send
|
|
337
|
+
'sent': 'send',
|
|
338
|
+
// spend
|
|
339
|
+
'spent': 'spend',
|
|
340
|
+
// keep
|
|
341
|
+
'kept': 'keep',
|
|
342
|
+
// hold
|
|
343
|
+
'held': 'hold',
|
|
344
|
+
// stand
|
|
345
|
+
'stood': 'stand',
|
|
346
|
+
// lose
|
|
347
|
+
'lost': 'lose',
|
|
348
|
+
// pay
|
|
349
|
+
'paid': 'pay',
|
|
350
|
+
// meet
|
|
351
|
+
'met': 'meet',
|
|
352
|
+
// lead
|
|
353
|
+
'led': 'lead',
|
|
354
|
+
// grow
|
|
355
|
+
'grew': 'grow', 'grown': 'grow',
|
|
356
|
+
// draw
|
|
357
|
+
'drew': 'draw', 'drawn': 'draw',
|
|
358
|
+
// break
|
|
359
|
+
'broke': 'break', 'broken': 'break',
|
|
360
|
+
// speak
|
|
361
|
+
'spoke': 'speak', 'spoken': 'speak',
|
|
362
|
+
// choose
|
|
363
|
+
'chose': 'choose', 'chosen': 'choose',
|
|
364
|
+
// fall
|
|
365
|
+
'fell': 'fall', 'fallen': 'fall',
|
|
366
|
+
// drive
|
|
367
|
+
'drove': 'drive', 'driven': 'drive',
|
|
368
|
+
// rise
|
|
369
|
+
'rose': 'rise', 'risen': 'rise',
|
|
370
|
+
// fly
|
|
371
|
+
'flew': 'fly', 'flown': 'fly',
|
|
372
|
+
// throw
|
|
373
|
+
'threw': 'throw', 'thrown': 'throw',
|
|
374
|
+
// wear
|
|
375
|
+
'wore': 'wear', 'worn': 'wear',
|
|
376
|
+
// hide
|
|
377
|
+
'hid': 'hide', 'hidden': 'hide',
|
|
378
|
+
// sit
|
|
379
|
+
'sat': 'sit',
|
|
380
|
+
// swim
|
|
381
|
+
'swam': 'swim', 'swum': 'swim',
|
|
382
|
+
// sing
|
|
383
|
+
'sang': 'sing', 'sung': 'sing',
|
|
384
|
+
// ring
|
|
385
|
+
'rang': 'ring', 'rung': 'ring',
|
|
386
|
+
// drink
|
|
387
|
+
'drank': 'drink', 'drunk': 'drink',
|
|
388
|
+
// wake
|
|
389
|
+
'woke': 'wake', 'woken': 'wake',
|
|
390
|
+
// freeze
|
|
391
|
+
'froze': 'freeze', 'frozen': 'freeze',
|
|
392
|
+
// steal
|
|
393
|
+
'stole': 'steal', 'stolen': 'steal',
|
|
394
|
+
// tear
|
|
395
|
+
'tore': 'tear', 'torn': 'tear',
|
|
396
|
+
// shake
|
|
397
|
+
'shook': 'shake', 'shaken': 'shake',
|
|
398
|
+
// forgive
|
|
399
|
+
'forgave': 'forgive', 'forgiven': 'forgive',
|
|
400
|
+
// forget
|
|
401
|
+
'forgot': 'forget', 'forgotten': 'forget',
|
|
402
|
+
// bite
|
|
403
|
+
'bit': 'bite', 'bitten': 'bite',
|
|
404
|
+
// blow
|
|
405
|
+
'blew': 'blow', 'blown': 'blow',
|
|
406
|
+
// catch
|
|
407
|
+
'caught': 'catch',
|
|
408
|
+
// teach
|
|
409
|
+
'taught': 'teach',
|
|
410
|
+
// fight
|
|
411
|
+
'fought': 'fight',
|
|
412
|
+
// seek
|
|
413
|
+
'sought': 'seek',
|
|
414
|
+
// sell
|
|
415
|
+
'sold': 'sell',
|
|
416
|
+
// win
|
|
417
|
+
'won': 'win',
|
|
418
|
+
// feed
|
|
419
|
+
'fed': 'feed',
|
|
420
|
+
// feel
|
|
421
|
+
'felt': 'feel',
|
|
422
|
+
// mean
|
|
423
|
+
'meant': 'mean',
|
|
424
|
+
// lend
|
|
425
|
+
'lent': 'lend',
|
|
426
|
+
// bend
|
|
427
|
+
'bent': 'bend',
|
|
428
|
+
// dig
|
|
429
|
+
'dug': 'dig',
|
|
430
|
+
// stick
|
|
431
|
+
'stuck': 'stick',
|
|
432
|
+
// strike
|
|
433
|
+
'struck': 'strike', 'stricken': 'strike',
|
|
434
|
+
// swear
|
|
435
|
+
'swore': 'swear', 'sworn': 'swear',
|
|
436
|
+
// spin
|
|
437
|
+
'spun': 'spin',
|
|
438
|
+
// hang
|
|
439
|
+
'hung': 'hang',
|
|
440
|
+
// slide
|
|
441
|
+
'slid': 'slide',
|
|
442
|
+
// shine
|
|
443
|
+
'shone': 'shine',
|
|
444
|
+
// shoot
|
|
445
|
+
'shot': 'shoot',
|
|
446
|
+
// sleep
|
|
447
|
+
'slept': 'sleep',
|
|
448
|
+
// sweep
|
|
449
|
+
'swept': 'sweep',
|
|
450
|
+
// creep
|
|
451
|
+
'crept': 'creep',
|
|
452
|
+
// weep
|
|
453
|
+
'wept': 'weep',
|
|
454
|
+
// deal
|
|
455
|
+
'dealt': 'deal',
|
|
456
|
+
// dream (irregular British)
|
|
457
|
+
'dreamt': 'dream',
|
|
458
|
+
// learn (irregular British)
|
|
459
|
+
'learnt': 'learn',
|
|
460
|
+
// burn (irregular British)
|
|
461
|
+
'burnt': 'burn',
|
|
462
|
+
// lean
|
|
463
|
+
'leant': 'lean',
|
|
464
|
+
// leap
|
|
465
|
+
'leapt': 'leap',
|
|
466
|
+
// spell
|
|
467
|
+
'spelt': 'spell',
|
|
468
|
+
// spill
|
|
469
|
+
'spilt': 'spill',
|
|
470
|
+
};
|
|
471
|
+
// ---------------------------------------------------------------------------
|
|
472
|
+
// Main stem function
|
|
473
|
+
// ---------------------------------------------------------------------------
|
|
474
|
+
/**
|
|
475
|
+
* Stem a single word using the Porter stemming algorithm.
|
|
476
|
+
*
|
|
477
|
+
* Returns the stemmed word (lowercase). Input is also lowercased.
|
|
478
|
+
* Words shorter than 3 characters are returned as-is.
|
|
479
|
+
*
|
|
480
|
+
* Irregular verb forms (e.g. "built", "ran", "spoke") are first normalized
|
|
481
|
+
* to their base form before Porter steps are applied, ensuring that
|
|
482
|
+
* stem("built") === stem("build"), stem("spoke") === stem("speak"), etc.
|
|
483
|
+
*/
|
|
484
|
+
export function stem(word) {
|
|
485
|
+
if (!word)
|
|
486
|
+
return word;
|
|
487
|
+
const lower = word.toLowerCase();
|
|
488
|
+
// Short words: don't stem
|
|
489
|
+
if (lower.length <= 2)
|
|
490
|
+
return lower;
|
|
491
|
+
// Normalize irregular verb forms to base before stemming
|
|
492
|
+
const normalized = IRREGULAR_FORMS[lower] ?? lower;
|
|
493
|
+
let w = normalized;
|
|
494
|
+
w = step1a(w);
|
|
495
|
+
w = step1b(w);
|
|
496
|
+
w = step1c(w);
|
|
497
|
+
w = step2(w);
|
|
498
|
+
w = step3(w);
|
|
499
|
+
w = step4(w);
|
|
500
|
+
w = step5a(w);
|
|
501
|
+
w = step5b(w);
|
|
502
|
+
return w;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Stem an array of tokens.
|
|
506
|
+
*/
|
|
507
|
+
export function stemTokens(tokens) {
|
|
508
|
+
return tokens.map(stem);
|
|
509
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart escalation strategy: try simple fetch first, escalate to browser if needed.
|
|
3
|
+
*
|
|
4
|
+
* Premium server-side optimisations (SWR cache, domain intelligence, parallel
|
|
5
|
+
* race) are injected via the hook system in `strategy-hooks.ts`. When no hooks
|
|
6
|
+
* are registered the strategy degrades gracefully to a simple escalation path
|
|
7
|
+
* that works great for CLI / npm library usage.
|
|
8
|
+
*/
|
|
9
|
+
import { type StrategyResult, type DomainRecommendation } from './strategy-hooks.js';
|
|
10
|
+
export type { StrategyResult } from './strategy-hooks.js';
|
|
11
|
+
export declare function shouldForceBrowser(url: string): DomainRecommendation | null;
|
|
12
|
+
export interface StrategyOptions {
|
|
13
|
+
forceBrowser?: boolean;
|
|
14
|
+
stealth?: boolean;
|
|
15
|
+
waitMs?: number;
|
|
16
|
+
userAgent?: string;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
screenshot?: boolean;
|
|
19
|
+
screenshotFullPage?: boolean;
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
cookies?: string[];
|
|
22
|
+
actions?: Array<{
|
|
23
|
+
type: 'wait' | 'click' | 'scroll' | 'type' | 'fill' | 'select' | 'press' | 'hover' | 'waitForSelector' | 'screenshot';
|
|
24
|
+
selector?: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
key?: string;
|
|
27
|
+
ms?: number;
|
|
28
|
+
to?: 'top' | 'bottom' | number;
|
|
29
|
+
timeout?: number;
|
|
30
|
+
}>;
|
|
31
|
+
keepPageOpen?: boolean;
|
|
32
|
+
noCache?: boolean;
|
|
33
|
+
raceTimeoutMs?: number;
|
|
34
|
+
location?: {
|
|
35
|
+
country?: string;
|
|
36
|
+
languages?: string[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Path to a persistent Chrome user-data-dir.
|
|
40
|
+
* When set, bypasses the shared browser pool so cookies/sessions survive
|
|
41
|
+
* between fetch calls in the same process.
|
|
42
|
+
*/
|
|
43
|
+
profileDir?: string;
|
|
44
|
+
/** Launch browser in headed (visible) mode — useful for debugging and profile setup. */
|
|
45
|
+
headed?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Playwright storage state (cookies + localStorage) to inject into the browser context.
|
|
48
|
+
* Loaded from a named profile by the CLI profile system.
|
|
49
|
+
*/
|
|
50
|
+
storageState?: any;
|
|
51
|
+
/**
|
|
52
|
+
* Proxy URL for routing requests through a proxy server.
|
|
53
|
+
* Supports HTTP, HTTPS, and SOCKS5 proxies.
|
|
54
|
+
* Format: protocol://[user:pass@]host:port
|
|
55
|
+
*/
|
|
56
|
+
proxy?: string;
|
|
57
|
+
/** Array of proxy URLs for rotation on failure */
|
|
58
|
+
proxies?: string[];
|
|
59
|
+
/** Device emulation: 'desktop' (default), 'mobile', 'tablet' */
|
|
60
|
+
device?: 'desktop' | 'mobile' | 'tablet';
|
|
61
|
+
/** Browser viewport width in pixels */
|
|
62
|
+
viewportWidth?: number;
|
|
63
|
+
/** Browser viewport height in pixels */
|
|
64
|
+
viewportHeight?: number;
|
|
65
|
+
/** Device scale factor (pixel density) for screenshots */
|
|
66
|
+
deviceScaleFactor?: number;
|
|
67
|
+
/** Wait condition: 'domcontentloaded' (default), 'networkidle', 'load', 'commit' */
|
|
68
|
+
waitUntil?: string;
|
|
69
|
+
/** CSS selector to wait for before extracting content */
|
|
70
|
+
waitSelector?: string;
|
|
71
|
+
/** Block resource types for faster loading: 'image', 'stylesheet', 'font', 'media', 'script' */
|
|
72
|
+
blockResources?: string[];
|
|
73
|
+
/** Use CloakBrowser patched Chromium for maximum stealth */
|
|
74
|
+
cloaked?: boolean;
|
|
75
|
+
/** Use PeelTLS TLS fingerprint spoofing */
|
|
76
|
+
cycle?: boolean;
|
|
77
|
+
/** Use PeelTLS TLS fingerprint spoofing */
|
|
78
|
+
tls?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Skip browser escalation on thin/shell content.
|
|
81
|
+
* When true, the simple HTTP result is returned as-is without escalating to browser.
|
|
82
|
+
* Use for Q&A/search workloads where speed matters more than JS-rendered content.
|
|
83
|
+
*/
|
|
84
|
+
noEscalate?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Per-user proxy context for bandwidth enforcement.
|
|
87
|
+
* When set, proxy usage is checked against the user's tier limit before each proxy attempt.
|
|
88
|
+
*/
|
|
89
|
+
proxyContext?: {
|
|
90
|
+
userId?: string;
|
|
91
|
+
tier?: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Smart fetch with automatic escalation.
|
|
96
|
+
*
|
|
97
|
+
* Without hooks: simple fetch → browser → stealth escalation.
|
|
98
|
+
* With premium hooks: SWR cache → domain intel → parallel race → escalation.
|
|
99
|
+
*/
|
|
100
|
+
export declare function smartFetch(url: string, options?: StrategyOptions): Promise<StrategyResult>;
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Use `clearStrategyHooks()` from strategy-hooks.ts instead.
|
|
103
|
+
*/
|
|
104
|
+
export { clearStrategyHooks as clearDomainIntel } from './strategy-hooks.js';
|