{"_id":"@antonvishal/browserbase-tracking","name":"@antonvishal/browserbase-tracking","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@antonvishal/browserbase-tracking","version":"0.1.0","description":"Transparent Search and Fetch observability for the Browserbase Node SDK","keywords":["browserbase","observability","tracking","drizzle","postgresql"],"author":{"name":"Anton Vishal"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/antonvishal/browserbase-dashboard.git","directory":"packages/browserbase-tracking"},"homepage":"https://github.com/antonvishal/browserbase-dashboard#readme","bugs":{"url":"https://github.com/antonvishal/browserbase-dashboard/issues"},"type":"module","sideEffects":false,"engines":{"node":">=22","bun":">=1.2.0"},"publishConfig":{"access":"public"},"module":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs"}},"scripts":{"build":"tsdown","typecheck":"tsc --noEmit","test":"bun test ./test/*.test.ts","check":"bun run typecheck && bun run test && bun run build","prepack":"bun run check"},"peerDependencies":{"@browserbasehq/sdk":">=2.16.0 <2.17.0","drizzle-orm":">=1.0.0-rc.4 <2"},"peerDependenciesMeta":{"drizzle-orm":{"optional":true}},"devDependencies":{"@browserbasehq/sdk":"2.16.0","@types/bun":"^1.3.14","@types/node":"^26.1.1","drizzle-orm":"1.0.0-rc.4","tsdown":"^0.22.8","typescript":"^5.9.3"},"gitHead":"dce2c2aec8e976acf13acf319e159fcb93c05e68","_id":"@antonvishal/browserbase-tracking@0.1.0","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-3BbZz/W8LjS8ojJkpXhHvh9/PxQZy8VccuPXBfhsJ6W6VRq3sd417DgP8D+56lxaxuDQ+aKsdlPDg0ihVpXWPQ==","shasum":"cec7f9c51d0cc9a6a90eeced08838df692b39aff","tarball":"https://registry.npmjs.org/@antonvishal/browserbase-tracking/-/browserbase-tracking-0.1.0.tgz","fileCount":11,"unpackedSize":186363,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDtDQghgu60PPHh1QthB7nP8hsK6jThMwSyyY0S2joNuQIgbwhAqFK2kQGzPvuK6jTMR5LiCgkDjwiQA0O2kEWtiQY="}]},"_npmUser":{"name":"antonvishal","email":"vishalanton@appexert.com"},"directories":{},"maintainers":[{"name":"antonvishal","email":"vishalanton@appexert.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/browserbase-tracking_0.1.0_1784217654095_0.06530818271942018"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-16T16:00:53.869Z","0.1.0":"2026-07-16T16:00:54.234Z","modified":"2026-07-16T16:00:54.709Z"},"maintainers":[{"name":"antonvishal","email":"vishalanton@appexert.com"}],"description":"Transparent Search and Fetch observability for the Browserbase Node SDK","homepage":"https://github.com/antonvishal/browserbase-dashboard#readme","keywords":["browserbase","observability","tracking","drizzle","postgresql"],"repository":{"type":"git","url":"git+https://github.com/antonvishal/browserbase-dashboard.git","directory":"packages/browserbase-tracking"},"author":{"name":"Anton Vishal"},"bugs":{"url":"https://github.com/antonvishal/browserbase-dashboard/issues"},"license":"MIT","readme":"# @antonvishal/browserbase-tracking\n\n> Early-stage, community-maintained software. Not affiliated with or endorsed by\n> Browserbase.\n\nSmall runtime package that transparently records Browserbase Search and Fetch calls using a caller-provided Drizzle PostgreSQL client.\n\nRequires Node.js 22+ or Bun 1.2+. The package is ESM-only.\n\n```bash\nbun add @antonvishal/browserbase-tracking @browserbasehq/sdk drizzle-orm@rc\n```\n\nThe adapter currently targets the Drizzle ORM 1.0 release-candidate API. The\nunqualified npm `latest` tag still points to Drizzle 0.x, so install the `rc`\ntag explicitly as shown above.\n\nThe supported Browserbase SDK range is the tested `2.16.x` line. New SDK minor\nversions are adopted deliberately because tracking observes the SDK's\n`APIPromise` consumption methods while preserving the original promise object.\n\n```ts\nimport Browserbase from \"@browserbasehq/sdk\";\nimport { flushTracking, withTracking } from \"@antonvishal/browserbase-tracking\";\nimport { drizzleAdapter } from \"@antonvishal/browserbase-tracking/drizzle\";\nimport { db } from \"./db\";\n\nconst adapter = drizzleAdapter(db);\n\nconst bb = withTracking({\n  client: new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! }),\n  adapter,\n});\n\nawait bb.search.web({ query: \"Browserbase pricing\" });\nawait flushTracking(bb); // Wait for pending tracking writes before a short-lived process exits.\n```\n\nThe PostgreSQL-only integration point is `drizzleAdapter`. It accepts the\napplication's existing Drizzle PostgreSQL client; application schema files do\nnot import tracking tables from this package.\n\n`browserbase_search_calls` and `browserbase_fetch_calls` are the physical owner tables. `browserbase_calls` is a read-only `UNION ALL` view used by dashboards and analytics; it is not a third copy of tracked data. `browserbase_tracking_metadata` exposes the schema version expected by both writers and readers.\n\nRequest and response fields follow the Browserbase SDK Search and Fetch contracts and are stored once in normalized columns. The read view reconstructs SDK-shaped `request` and `response` JSON for inspection. Derived analytics fields such as result hosts, result count, content bytes, and effective Fetch billing mode remain materialized intentionally.\n\nThe schema deliberately avoids database checks for SDK behavior. PostgreSQL\nenforces identity, nullability, physical types, and uniqueness; the tracking\nwriter normalizes outcomes, response shapes, timestamps, and derived metrics.\nThis prevents best-effort observability writes from becoming coupled to\nevolving SDK response semantics.\n\nThe database owner must declare the documented schema as normal Drizzle tables\nand views, generate and apply its own migrations, and provision that schema\nbefore calls are tracked. The package ships a complete, copyable Drizzle\ndefinition at [`examples/schema.ts`](./examples/schema.ts); it imports only from\nDrizzle and can be copied into an application's schema. Generate and review a\nmigration from that application-owned definition. The adapter attempts inserts\ndirectly and never creates, validates, alters, migrates, or deletes database\nobjects. Missing or incompatible schema errors are logged as best-effort\ntracking failures and never replace the Browserbase SDK result.\n\nOnly `search.web` and `fetchAPI.create` are tracked. Original SDK promises, raw responses, errors, retries, and all other resources are preserved. Writes are asynchronous and best-effort. `flushTracking()` waits until every Tracked Call started through that client has attempted persistence; write failures remain logged and do not replace SDK results. Request headers and API keys are never persisted.\n\nWrap each Browserbase client once. `withTracking()` rejects both an already\ntracked proxy and its original client so a logical SDK call cannot acquire\nduplicate tracking observers accidentally.\n\n## Data and privacy\n\nTracking stores Search queries and results, Fetch URLs and returned content,\ntarget response headers, transport response headers, and normalized error\ndetails. Those fields can contain personal, confidential, copyrighted, or\nsecurity-sensitive data. Operators are responsible for access control,\nretention, redaction, and deletion policies for their database. Do not enable\ntracking where storing full request or response content would violate policy.\n\nThis package does not send tracking data to a separate service; it writes only\nthrough the adapter supplied by the application. The default Drizzle adapter\ndoes not create or migrate database objects.\n\n`withTracking` depends only on the `BrowserbaseTrackingAdapter` interface. The\napplication owns database provisioning and migrations. The local dashboard and\nits operational configuration belong to `@antonvishal/browserbase-tracking-kit`.\n\n## License\n\nMIT. Browserbase is a trademark of its respective owner; use of the name here\nonly describes compatibility.\n","readmeFilename":"README.md","_rev":"1-fd0b695eed93deeba249499cfeb5912b"}