{"_id":"@answeredge/sdk","_rev":"7-a6721ff96f75c12ece510e2f905ccd0a","name":"@answeredge/sdk","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.2":{"name":"@answeredge/sdk","version":"0.1.2","keywords":["aeo","ai-agents","gptbot","answeredge","bot-analytics"],"license":"UNLICENSED","_id":"@answeredge/sdk@0.1.2","maintainers":[{"name":"aetx","email":"abiykibru6@gmail.com"}],"dist":{"shasum":"3aac4a4665a4cea130c874259a4e38a51e50bf8f","tarball":"https://registry.npmjs.org/@answeredge/sdk/-/sdk-0.1.2.tgz","fileCount":23,"integrity":"sha512-HWBzV+dnaSqt5rRQ/YcoWCeNeE+8ONcEP4EMOAq88hSschBANqe01rlBe2/6pUFfQWEJI8dE1CosiAyPIHqiRQ==","signatures":[{"sig":"MEYCIQD3PoiiT6E0gVkhcVCgsFbhN9o8pyHagxiguzxZM+R+MwIhAO8fGnfeA6tcNj5tMGnnF3pJ2VK7n0+B3G9Y0TpTOSwT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36006},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"aetx","email":"abiykibru6@gmail.com"},"_npmVersion":"11.12.1","description":"AnswerEdge SDK — drop-in middleware that tracks AI-agent visits to your site and reports them to AnswerEdge.","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4","@types/node":"^20.14.10"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.2_1781945896514_0.0796163472136906","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@answeredge/sdk","version":"0.1.3","keywords":["aeo","ai-agents","gptbot","answeredge","bot-analytics"],"license":"UNLICENSED","_id":"@answeredge/sdk@0.1.3","maintainers":[{"name":"aetx","email":"abiykibru6@gmail.com"}],"dist":{"shasum":"cdde85a7828d221b9d929272a36980427a39134b","tarball":"https://registry.npmjs.org/@answeredge/sdk/-/sdk-0.1.3.tgz","fileCount":23,"integrity":"sha512-WbzrBzdcdrUyjIich3Zm3V2h46hHw/u8KmVNmJxc0JGCmY3nQVY4NHUEqQaSoqNNNdRpQbtUrbIGV4pclW48dQ==","signatures":[{"sig":"MEUCIGexXKUXlrF7FgfYZ6wnEKqyS/Reqv3p1ciDhfDmZ3WFAiEAxbNbm3PWro+AQHdtX+ipAxOpiCzIduaYmE+NPC9GdSM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36415},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"aetx","email":"abiykibru6@gmail.com"},"_npmVersion":"11.12.1","description":"AnswerEdge SDK — drop-in middleware that tracks AI-agent visits to your site and reports them to AnswerEdge.","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4","@types/node":"^20.14.10"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.3_1782064896856_0.6831925589048853","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@answeredge/sdk","version":"0.1.4","description":"AnswerEdge SDK — drop-in middleware that tracks AI-agent visits to your site and reports them to AnswerEdge.","license":"UNLICENSED","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"engines":{"node":">=18"},"keywords":["aeo","ai-agents","gptbot","answeredge","bot-analytics"],"devDependencies":{"typescript":"^5.5.4","@types/node":"^20.14.10"},"_id":"@answeredge/sdk@0.1.4","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-/nzcA73IF8Tf/8g+nrfmylHQqPVnfUxvtMdEHWTb+JymxEzkmdNTbO4NTQNSKW+gA79Hb+sw720TCWi7Hk3bCw==","shasum":"73483c5f15a5d442f15941701711416604b402a3","tarball":"https://registry.npmjs.org/@answeredge/sdk/-/sdk-0.1.4.tgz","fileCount":23,"unpackedSize":41840,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDrn8EL0Gtjbc6QIOTb4CGVizrfocNxuYk1S3Po0z9hhwIgLnDdzjlMyVffMQT2q7tF4PTDqAGeRWe8BcC8AUqGhQA="}]},"_npmUser":{"name":"aetx","email":"abiykibru6@gmail.com"},"directories":{},"maintainers":[{"name":"aetx","email":"abiykibru6@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.4_1782068446876_0.8561184447384123"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-20T08:58:16.390Z","modified":"2026-06-21T19:00:47.113Z","0.1.0":"2026-06-19T15:54:42.529Z","0.1.1":"2026-06-19T17:15:45.867Z","0.1.2":"2026-06-20T08:58:16.635Z","0.1.3":"2026-06-21T18:01:36.992Z","0.1.4":"2026-06-21T19:00:47.000Z"},"license":"UNLICENSED","keywords":["aeo","ai-agents","gptbot","answeredge","bot-analytics"],"description":"AnswerEdge SDK — drop-in middleware that tracks AI-agent visits to your site and reports them to AnswerEdge.","maintainers":[{"name":"aetx","email":"abiykibru6@gmail.com"}],"readme":"# @answeredge/sdk\n\nDrop-in server-side middleware that tracks **AI-agent visits** to your site and\nreports them to AnswerEdge. One init call, then it watches each request, detects\nknown AI bots, and fire-and-forgets the visit to the backend. It never blocks or\nslows down your responses.\n\n> First of the package forms in the plan (npm for Node/Next.js). Python SDK and\n> WordPress plugin follow.\n\n## Install\n\n```bash\nnpm install @answeredge/sdk\n```\n\n## Use\n\n**Express / Connect**\n\n```ts\nimport { AnswerEdge, expressMiddleware } from \"@answeredge/sdk\";\n\n// Key is issued in the AnswerEdge dashboard. Treat it like a password:\n// keep it in an env var, never hardcode or commit it.\nAnswerEdge.init({ apiKey: process.env.ANSWEREDGE_API_KEY! });\napp.use(expressMiddleware());            // before your routes\n```\n\n**Next.js / Vercel** (`middleware.ts`) — `await` the call so the visit is sent\nbefore Vercel freezes the function:\n\n```ts\nimport { AnswerEdge, trackNextRequest } from \"@answeredge/sdk\";\nimport { NextResponse } from \"next/server\";\n\nAnswerEdge.init({\n  apiKey: process.env.ANSWEREDGE_API_KEY!, // env var, never hardcoded\n  endpoint: process.env.ANSWEREDGE_ENDPOINT, // your backend (must be https on Vercel)\n});\n\nexport async function middleware(req) {\n  await trackNextRequest(req); // immediate send; resolves instantly for human traffic\n  return NextResponse.next();\n}\n```\n\n> On serverless/edge (Vercel, Cloudflare Workers, Lambda) you must `await`\n> `trackNextRequest`/`trackRequest` (or pass it to the platform's `waitUntil`).\n> On a long-running Node server you can ignore the returned promise.\n\n**Anything else** — `await trackRequest(req)` with any request-like object.\n\n## What it sends\n\nFor each request whose `User-Agent` matches a known AI bot, one event:\n\n```json\n{ \"customer_id\": \"...\", \"bot_name\": \"ChatGPT (real-time)\", \"url_path\": \"/pricing\", \"ip\": \"203.0.113.10\", \"timestamp\": \"2026-06-19T10:00:00.000Z\" }\n```\n\nEvents are batched and sent in the background to `POST /sdk/crawls`. The `ip` is\nsent so bot verification (IP-range / reverse-DNS) can run **server-side**, so the\nbot list and IP ranges update centrally without you upgrading this package.\n\n## Options\n\n| Option | Default | Meaning |\n|---|---|---|\n| `apiKey` | — (required) | Per-customer key |\n| `endpoint` | `https://api.answeredge.com` | Backend base URL |\n| `flushIntervalMs` | `5000` | Background flush cadence |\n| `maxBatchSize` | `50` | Events per request |\n| `maxQueueSize` | `1000` | Buffer cap (oldest dropped past this) |\n| `includeTrainingBots` | `true` | Track training crawlers too, not just citation bots |\n| `debug` | `false` | Log internal warnings |\n","readmeFilename":"README.md"}