UNPKG

@usenotra/geo

Version:

Request capture SDK for AI traffic attribution and agent feedback collection

824 lines (821 loc) • 25 kB
// src/signatures.ts var AI_AGENT_SIGNATURES = [ { agent: "GPTBot", vendor: "OpenAI", category: "training-crawler", userAgents: ["GPTBot"], confidence: "verified", verification: "https://openai.com/gptbot.json", source: "https://developers.openai.com/api/docs/bots" }, { agent: "OAI-SearchBot", vendor: "OpenAI", category: "search-index", userAgents: ["OAI-SearchBot"], confidence: "verified", verification: "https://openai.com/searchbot.json", source: "https://developers.openai.com/api/docs/bots" }, { agent: "ChatGPT-User", vendor: "OpenAI", category: "assistant-browse", userAgents: ["ChatGPT-User"], confidence: "verified", verification: "https://openai.com/chatgpt-user.json", source: "https://developers.openai.com/api/docs/bots" }, { agent: "OAI-AdsBot", vendor: "OpenAI", category: "search-index", userAgents: ["OAI-AdsBot"], confidence: "verified", verification: "https://openai.com/adsbot.json", source: "https://developers.openai.com/api/docs/bots" }, { agent: "Claude Code", vendor: "Anthropic", category: "assistant-browse", userAgents: ["claude-code/"], confidence: "reported", verification: null, source: "https://github.com/monperrus/crawler-user-agents" }, { agent: "Claude-SearchBot", vendor: "Anthropic", category: "search-index", userAgents: ["Claude-SearchBot"], confidence: "verified", verification: "https://claude.com/crawling/bots.json", source: "https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler" }, { agent: "Claude-User", vendor: "Anthropic", category: "assistant-browse", userAgents: ["Claude-User"], confidence: "verified", verification: "https://claude.com/crawling/bots.json", source: "https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler" }, { agent: "ClaudeBot", vendor: "Anthropic", category: "training-crawler", userAgents: ["ClaudeBot"], confidence: "verified", verification: "https://claude.com/crawling/bots.json", source: "https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler" }, { agent: "anthropic-ai", vendor: "Anthropic", category: "training-crawler", userAgents: ["anthropic-ai"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "claude-web", vendor: "Anthropic", category: "assistant-browse", userAgents: ["claude-web"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "PerplexityBot", vendor: "Perplexity", category: "search-index", userAgents: ["PerplexityBot"], confidence: "verified", verification: "https://www.perplexity.ai/perplexitybot.json", source: "https://docs.perplexity.ai/docs/resources/perplexity-crawlers" }, { agent: "Perplexity-User", vendor: "Perplexity", category: "assistant-browse", userAgents: ["Perplexity-User"], confidence: "verified", verification: "https://www.perplexity.ai/perplexity-user.json", source: "https://docs.perplexity.ai/docs/resources/perplexity-crawlers" }, { agent: "Google-CloudVertexBot", vendor: "Google", category: "search-index", userAgents: ["Google-CloudVertexBot"], confidence: "verified", verification: "https://developers.google.com/static/crawling/ipranges/common-crawlers.json", source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers" }, { agent: "GoogleOther-Image", vendor: "Google", category: "training-crawler", userAgents: ["GoogleOther-Image"], confidence: "heuristic", verification: "https://developers.google.com/static/crawling/ipranges/common-crawlers.json", source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers" }, { agent: "GoogleOther-Video", vendor: "Google", category: "training-crawler", userAgents: ["GoogleOther-Video"], confidence: "heuristic", verification: "https://developers.google.com/static/crawling/ipranges/common-crawlers.json", source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers" }, { agent: "GoogleOther", vendor: "Google", category: "training-crawler", userAgents: ["GoogleOther"], confidence: "heuristic", verification: "https://developers.google.com/static/crawling/ipranges/common-crawlers.json", source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers" }, { agent: "Bytespider", vendor: "ByteDance", category: "training-crawler", userAgents: ["Bytespider"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Amazonbot", vendor: "Amazon", category: "training-crawler", userAgents: ["Amazonbot"], confidence: "verified", verification: "https://developer.amazon.com/amazonbot/ip-addresses/", source: "https://developer.amazon.com/amazonbot" }, { agent: "Amzn-SearchBot", vendor: "Amazon", category: "search-index", userAgents: ["Amzn-SearchBot"], confidence: "verified", verification: "https://developer.amazon.com/amazonbot/searchbot-ip-addresses/", source: "https://developer.amazon.com/amazonbot" }, { agent: "Amzn-User", vendor: "Amazon", category: "assistant-browse", userAgents: ["Amzn-User"], confidence: "verified", verification: "https://developer.amazon.com/amazonbot/live-ip-addresses/", source: "https://developer.amazon.com/amazonbot" }, { agent: "Applebot", vendor: "Apple", category: "search-index", userAgents: ["Applebot/"], confidence: "verified", verification: "https://search.developer.apple.com/applebot.json", source: "https://support.apple.com/en-us/119829" }, { agent: "cohere-training-data-crawler", vendor: "Cohere", category: "training-crawler", userAgents: ["cohere-training-data-crawler"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "cohere-ai", vendor: "Cohere", category: "assistant-browse", userAgents: ["cohere-ai"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "meta-externalagent", vendor: "Meta", category: "training-crawler", userAgents: ["meta-externalagent"], confidence: "verified", verification: null, source: "https://developers.facebook.com/documentation/sharing/webmasters/web-crawlers" }, { agent: "meta-externalfetcher", vendor: "Meta", category: "assistant-browse", userAgents: ["meta-externalfetcher"], confidence: "verified", verification: null, source: "https://developers.facebook.com/documentation/sharing/webmasters/web-crawlers" }, { agent: "meta-webindexer", vendor: "Meta", category: "search-index", userAgents: ["meta-webindexer"], confidence: "verified", verification: null, source: "https://developers.facebook.com/docs/sharing/webmasters/web-crawlers/" }, { agent: "meta-externalads", vendor: "Meta", category: "search-index", userAgents: ["meta-externalads"], confidence: "verified", verification: null, source: "https://developers.facebook.com/docs/sharing/webmasters/web-crawlers/" }, { agent: "FacebookBot", vendor: "Meta", category: "training-crawler", userAgents: ["FacebookBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "DuckAssistBot", vendor: "DuckDuckGo", category: "assistant-browse", userAgents: ["DuckAssistBot"], confidence: "verified", verification: "https://duckduckgo.com/duckassistbot.json", source: "https://duckduckgo.com/duckduckgo-help-pages/results/duckassistbot/" }, { agent: "LinerBot", vendor: "Liner", category: "search-index", userAgents: ["LinerBot"], confidence: "verified", verification: "https://docs.getliner.com/linerbot.json", source: "https://docs.getliner.com/docs/linerbot" }, { agent: "YouBot", vendor: "You.com", category: "search-index", userAgents: ["YouBot"], confidence: "verified", verification: "https://you.com/.well-known/http-message-signatures-directory", source: "https://you.com/docs/youbot" }, { agent: "MistralAI-User", vendor: "Mistral", category: "assistant-browse", userAgents: ["MistralAI-User"], confidence: "verified", verification: "https://mistral.ai/mistralai-user-ips.json", source: "https://docs.mistral.ai/robots" }, { agent: "CCBot", vendor: "Common Crawl", category: "training-crawler", userAgents: ["CCBot"], confidence: "heuristic", verification: "https://index.commoncrawl.org/ccbot.json", source: "https://commoncrawl.org/ccbot" }, { agent: "Diffbot", vendor: "Diffbot", category: "search-index", userAgents: ["Diffbot"], confidence: "verified", verification: null, source: "https://www.diffbot.com/docs/crawl/faq/robots-txt" }, { agent: "Timpibot", vendor: "Timpi", category: "training-crawler", userAgents: ["Timpibot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Devin", vendor: "Cognition", category: "assistant-browse", userAgents: ["Devin/"], confidence: "reported", verification: null, source: "https://radar.cloudflare.com/bots/directory/devin" }, { agent: "Google-Agent", vendor: "Google", category: "assistant-browse", userAgents: ["Google-Agent"], confidence: "verified", verification: "https://developers.google.com/static/crawling/ipranges/user-triggered-agents.json", source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers" }, { agent: "Google-GeminiNotebook", vendor: "Google", category: "assistant-browse", userAgents: ["Google-GeminiNotebook"], confidence: "verified", verification: "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers-google.json", source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers" }, { agent: "Gemini CLI", vendor: "Google", category: "assistant-browse", userAgents: ["GoogleAgent-URLContext"], confidence: "reported", verification: null, source: "https://www.checklyhq.com/blog/state-of-ai-agent-content-negotation/" }, { agent: "Gemini CLI (legacy)", vendor: "Google", category: "assistant-browse", userAgents: ["Google-Gemini-CLI"], confidence: "reported", verification: null, source: "https://knownagents.com/agents/google-gemini-cli" }, { agent: "Gemini", vendor: "Google", category: "assistant-browse", userAgents: ["Google"], match: "exact", confidence: "reported", verification: null, source: "https://developers.google.com/crawling/docs/crawlers-fetchers/google-user-triggered-fetchers" }, { agent: "OpenCode", vendor: "OpenCode", category: "assistant-browse", userAgents: ["opencode"], match: "exact", confidence: "reported", verification: null, source: "https://github.com/sst/opencode" }, { agent: "Cursor", vendor: "Anysphere", category: "assistant-browse", userAgents: ["Cursor/"], confidence: "reported", verification: null, source: "https://cursor.com/download" }, { agent: "Cline", vendor: "Cline Bot", category: "assistant-browse", userAgents: [ "Mozilla/5.0 (compatible; AgentBot/1.0)", "VSCodeExtension/1.0; +https://cline.bot" ], confidence: "reported", verification: null, source: "https://github.com/cline/cline/blob/main/apps/vscode/src/integrations/misc/link-preview.ts" }, { agent: "Trae-Agent", vendor: "ByteDance", category: "assistant-browse", userAgents: ["Trae-Agent"], confidence: "reported", verification: null, source: "https://knownagents.com/agents/trae" }, { agent: "omgili", vendor: "Webz.io", category: "training-crawler", userAgents: ["omgilibot", "omgili"], confidence: "heuristic", verification: null, source: "https://webz.io/blog/web-data/what-is-the-omgili-bot-and-why-is-it-crawling-your-website/" }, { agent: "Mozilla Tabstack", vendor: "Mozilla", category: "assistant-browse", userAgents: ["Mozilla-Tabstack"], confidence: "verified", verification: null, source: "https://docs.tabstack.ai/trust/controlling-access" }, { agent: "AI2Bot", vendor: "Ai2", category: "training-crawler", userAgents: ["AI2Bot"], confidence: "verified", verification: null, source: "https://allenai.org/crawler" }, { agent: "Kimi-User", vendor: "Moonshot AI", category: "assistant-browse", userAgents: ["Kimi-User"], confidence: "verified", verification: "https://www.kimi.ai/policies/kimi-user.json", source: "https://www.kimi.ai/policies/kimi-crawlers" }, { agent: "KimiBot", vendor: "Moonshot AI", category: "training-crawler", userAgents: ["KimiBot"], confidence: "verified", verification: "https://www.kimi.ai/policies/kimibot.json", source: "https://www.kimi.ai/policies/kimi-crawlers" }, { agent: "Kimi-SearchBot", vendor: "Moonshot AI", category: "search-index", userAgents: ["Kimi-SearchBot"], confidence: "verified", verification: "https://www.kimi.ai/policies/kimi-searchbot.json", source: "https://www.kimi.ai/policies/kimi-crawlers" }, { agent: "ChatGLM-Spider", vendor: "Zhipu AI", category: "training-crawler", userAgents: ["ChatGLM-Spider"], confidence: "reported", verification: null, source: "https://knownagents.com/agents/chatglm-spider" }, { agent: "TongyiBot", vendor: "Alibaba", category: "assistant-browse", userAgents: ["TongyiBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "YiyanBot", vendor: "Baidu", category: "assistant-browse", userAgents: ["YiyanBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Manus-User", vendor: "Butterfly Effect", category: "assistant-browse", userAgents: ["Manus-User"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "kagi-fetcher", vendor: "Kagi", category: "assistant-browse", userAgents: ["kagi-fetcher"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "DeepSeekBot", vendor: "DeepSeek", category: "training-crawler", userAgents: ["DeepSeekBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "TikTokSpider", vendor: "ByteDance", category: "training-crawler", userAgents: ["TikTokSpider"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "PanguBot", vendor: "Huawei", category: "training-crawler", userAgents: ["PanguBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Cloudflare-AutoRAG", vendor: "Cloudflare", category: "search-index", userAgents: ["Cloudflare-AutoRAG"], confidence: "reported", verification: null, source: "https://developers.cloudflare.com/autorag/configuration/data-source/website/" }, { agent: "ExaSearchBot", vendor: "Exa", category: "search-index", userAgents: ["ExaSearchBot"], confidence: "verified", verification: "https://crawler.exa.ai/.well-known/http-message-signatures-directory", source: "https://crawler.exa.ai/" }, { agent: "ExaBot", vendor: "Exa", category: "search-index", userAgents: ["ExaBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "ShapBot", vendor: "Parallel", category: "search-index", userAgents: ["ShapBot"], confidence: "verified", verification: "https://docs.parallel.ai/resources/shapbot.json", source: "https://docs.parallel.ai/resources/crawler" }, { agent: "Shap-User", vendor: "Parallel", category: "assistant-browse", userAgents: ["Shap-User"], confidence: "verified", verification: null, source: "https://parallel.ai/parallel-web-systems-bots" }, { agent: "TavilyBot", vendor: "Tavily", category: "search-index", userAgents: ["TavilyBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "FirecrawlAgent", vendor: "Firecrawl", category: "search-index", userAgents: ["FirecrawlAgent"], confidence: "heuristic", verification: null, source: "https://docs.firecrawl.dev/advanced-scraping-guide" }, { agent: "GrokBot", vendor: "xAI", category: "search-index", userAgents: ["GrokBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Codex CLI", vendor: "OpenAI", category: "assistant-browse", userAgents: ["codex_cli_rs/", "codex-cli"], confidence: "reported", verification: null, source: "https://github.com/openai/codex" }, { agent: "Google-NotebookLM", vendor: "Google", category: "assistant-browse", userAgents: ["Google-NotebookLM"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Grok-DeepSearch", vendor: "xAI", category: "assistant-browse", userAgents: ["Grok-DeepSearch"], confidence: "reported", verification: null, source: "https://www.mintlify.com/docs/analytics/traffic-classification" }, { agent: "Qwen-User", vendor: "Alibaba", category: "assistant-browse", userAgents: ["Qwen-User"], confidence: "reported", verification: null, source: "https://www.mintlify.com/docs/analytics/traffic-classification" }, { agent: "WarpBot", vendor: "Warp", category: "assistant-browse", userAgents: ["WarpBot"], confidence: "reported", verification: null, source: "https://www.mintlify.com/docs/analytics/traffic-classification" }, { agent: "Amazon-Bedrock-AgentCore-Browser", vendor: "Amazon", category: "assistant-browse", userAgents: ["Amazon-Bedrock-AgentCore-Browser"], confidence: "reported", verification: null, source: "https://knownagents.com/agents/amazon-bedrock-agentcore-browser" }, { agent: "MistralAI-Index", vendor: "Mistral", category: "search-index", userAgents: ["MistralAI-Index"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "ref-tools-crawler", vendor: "Ref", category: "search-index", userAgents: ["ref-tools-crawler"], confidence: "reported", verification: null, source: "https://www.mintlify.com/docs/analytics/traffic-classification" }, { agent: "ERNIEBot", vendor: "Baidu", category: "training-crawler", userAgents: ["ERNIEBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "QwenBot", vendor: "Alibaba", category: "training-crawler", userAgents: ["QwenBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Doubaobot", vendor: "ByteDance", category: "training-crawler", userAgents: ["Doubaobot"], confidence: "heuristic", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "ClueWeb-Crawler", vendor: "Carnegie Mellon University", category: "training-crawler", userAgents: ["ClueWeb-Crawler"], confidence: "reported", verification: null, source: "https://knownagents.com/agents/clueweb-crawler" }, { agent: "Cotoyogi", vendor: "ROIS", category: "training-crawler", userAgents: ["Cotoyogi"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "ICC-Crawler", vendor: "NICT", category: "training-crawler", userAgents: ["ICC-Crawler"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "img2dataset", vendor: "img2dataset", category: "training-crawler", userAgents: ["img2dataset"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Kangaroo Bot", vendor: "Unknown", category: "training-crawler", userAgents: ["Kangaroo Bot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "VelenPublicWebCrawler", vendor: "Velen", category: "training-crawler", userAgents: ["VelenPublicWebCrawler"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "ImagesiftBot", vendor: "ImageSift", category: "training-crawler", userAgents: ["ImagesiftBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "aiHitBot", vendor: "aiHit", category: "training-crawler", userAgents: ["aiHitBot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" }, { agent: "Factset_spyderbot", vendor: "FactSet", category: "training-crawler", userAgents: ["Factset_spyderbot"], confidence: "reported", verification: null, source: "https://raw.githubusercontent.com/ai-robots-txt/ai.robots.txt/main/robots.json" } ]; // src/classify.ts var NORMALIZED_AGENT_SIGNATURES = AI_AGENT_SIGNATURES.map((signature) => ({ signature, userAgents: signature.userAgents.map((token) => token.toLowerCase()) })); function classifyUserAgent(userAgent) { const haystack = userAgent.toLowerCase(); if (!haystack) { return null; } const exact = haystack.trim(); for (const { signature, userAgents } of NORMALIZED_AGENT_SIGNATURES) { for (const needle of userAgents) { const matched = signature.match === "exact" ? exact === needle : haystack.includes(needle); if (matched) { return { agent: signature.agent, vendor: signature.vendor, category: signature.category, confidence: signature.confidence }; } } } return null; } function classifyRequest(headers, _ip) { return classifyUserAgent(headers.get("user-agent") ?? ""); } export { classifyRequest, classifyUserAgent };