{"_id":"@stablebrowse/client","_rev":"4-a2f48f7a44240b01e5537d73843f5ec0","name":"@stablebrowse/client","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.1":{"name":"@stablebrowse/client","version":"0.1.1","license":"MIT","_id":"@stablebrowse/client@0.1.1","maintainers":[{"name":"jaymehta12","email":"team@stablebrowse.ai"}],"homepage":"https://github.com/StableBrowse/stablebrowse-agent#readme","bugs":{"url":"https://github.com/StableBrowse/stablebrowse-agent/issues"},"dist":{"shasum":"87c322daca51ffaa45bfcd3b05f5850f3ee47e75","tarball":"https://registry.npmjs.org/@stablebrowse/client/-/client-0.1.1.tgz","fileCount":10,"integrity":"sha512-AU/pwA5wqJpZf+CCh4KMSeifJdiFl0u/+uApe/n8E2tREqH9hJJ03lDa1S/10Kj7cA4cubxWZtwrUeMxVU42fA==","signatures":[{"sig":"MEUCIBEv5vNCl45yy7jWnbEHQZpeMxlZgvArE+fB0YvKMYjfAiEA1pCOMJrMUI9ludpcrrnD+yklQFa0FeERwo/bqOmgsMg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22137},"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"}},"gitHead":"948f975228a6a7ae0ada3abbe89769c1635c923c","scripts":{"build":"tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"jaymehta12","email":"team@stablebrowse.ai"},"repository":{"url":"git+https://github.com/StableBrowse/stablebrowse-agent.git","type":"git","directory":"sdks/typescript"},"_npmVersion":"10.8.2","description":"TypeScript client for the stablebrowse browser agent API","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.1_1776725331377_0.23958918490903702","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@stablebrowse/client","version":"0.1.2","license":"MIT","_id":"@stablebrowse/client@0.1.2","maintainers":[{"name":"jaymehta12","email":"team@stablebrowse.ai"}],"homepage":"https://github.com/StableBrowse/stablebrowse-agent#readme","bugs":{"url":"https://github.com/StableBrowse/stablebrowse-agent/issues"},"dist":{"shasum":"6647ff1e96544d5b398ba35ebc035ce6b9af1dde","tarball":"https://registry.npmjs.org/@stablebrowse/client/-/client-0.1.2.tgz","fileCount":10,"integrity":"sha512-jBXgYV7kIhWWF5UkSfIAheTTnzqbHzNN2optPG+dNxDwF5GzHmfA8bQNfr5qbIFZ4ak9g7BFzMB/freRDC823g==","signatures":[{"sig":"MEUCIEjV2LmdKHC6eRSakOtehzQ46Lkk3Uec2g97UWAPZZjAAiEAs24YOBV3yztj7WryReIASLp9rB9q9Oui7odPuPsKXUo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22173},"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","default":"./dist/index.js"}},"gitHead":"af1d0aaf50225b60e4c55b45d5f91547b9f6f5dc","scripts":{"build":"tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"jaymehta12","email":"team@stablebrowse.ai"},"repository":{"url":"git+https://github.com/StableBrowse/stablebrowse-agent.git","type":"git","directory":"sdks/typescript"},"_npmVersion":"10.8.2","description":"TypeScript client for the stablebrowse browser agent API","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.2_1776744455186_0.4086686007897571","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@stablebrowse/client","version":"0.2.0","license":"MIT","_id":"@stablebrowse/client@0.2.0","maintainers":[{"name":"jaymehta12","email":"team@stablebrowse.ai"}],"homepage":"https://docs.stablebrowse.com/introduction","dist":{"shasum":"e25f18bb848e03fe8d44b47c98d40db1a6619f01","tarball":"https://registry.npmjs.org/@stablebrowse/client/-/client-0.2.0.tgz","fileCount":10,"integrity":"sha512-g36/IBJfd5Kwa3ntoyUla2VVhyOuDrCMT6iZOnkd56ZkkQIInxz2G6ym1YWy7h5ZrBqz0KeTuCQwFM8CM8TKmA==","signatures":[{"sig":"MEQCIFxk+KcL7ZteqgtAqmjnwe5CQUt61CIp8kBB3BslmQK3AiAdMhIe9+SBpIpBvzEsafTNTG5NoykLzlwtKcsZy0IB0w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19807},"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","default":"./dist/index.js"}},"gitHead":"c7bd4071b317dd8920470f5b889c787a7f9e8a5c","scripts":{"build":"tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"jaymehta12","email":"team@stablebrowse.ai"},"_npmVersion":"10.8.2","description":"TypeScript client for the stablebrowse browser agent API","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.2.0_1776883122976_0.904523647809103","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@stablebrowse/client","version":"0.3.0","description":"TypeScript client for the stablebrowse browser agent API","license":"MIT","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","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit"},"engines":{"node":">=18"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.9.2"},"homepage":"https://docs.stablebrowse.com/introduction","_id":"@stablebrowse/client@0.3.0","gitHead":"1987d310440993e40e2a771c6a439d33f0c23a06","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-thM8NuBm1OEQrsvps69NFudTk+UCI0ebWEKGYsMJ3XXUKCxxsyxt0HoULnorgfcrpqJ00eCyVjmN29AUqHN1rg==","shasum":"8dc48c470e825616c7f535d4a5d0090aae2ff57b","tarball":"https://registry.npmjs.org/@stablebrowse/client/-/client-0.3.0.tgz","fileCount":10,"unpackedSize":23261,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD06gtcH01yw2IEG3x7uHjwUixnWpvoGx6la4aD9objMAIhAOPAdTrLOFanl4iovM1zinMv9cle9UcsB2/+2I4uUvTp"}]},"_npmUser":{"name":"jaymehta12","email":"team@stablebrowse.ai"},"directories":{},"maintainers":[{"name":"jaymehta12","email":"team@stablebrowse.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.3.0_1778017023996_0.04994378399273591"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T22:48:50.926Z","modified":"2026-05-05T21:37:04.278Z","0.1.1":"2026-04-20T22:48:51.510Z","0.1.2":"2026-04-21T04:07:35.350Z","0.2.0":"2026-04-22T18:38:43.124Z","0.3.0":"2026-05-05T21:37:04.156Z"},"license":"MIT","homepage":"https://docs.stablebrowse.com/introduction","description":"TypeScript client for the stablebrowse browser agent API","maintainers":[{"name":"jaymehta12","email":"team@stablebrowse.ai"}],"readme":"# stablebrowse (TypeScript)\n\nTypeScript / JavaScript client for the stablebrowse browser agent API.\n\n## Install\n\nFrom npm:\n\n```bash\nnpm install @stablebrowse/client\n```\n\nFrom source (for local development):\n\n```bash\ncd sdks/typescript\nnpm install\nnpm run build\n# Then in the consuming project:\nnpm install /path/to/stablebrowse-agent/sdks/typescript\n```\n\nRequires Node 18+ (uses native `fetch`). Works in any fetch-capable runtime\n— Node, Deno, Cloudflare Workers, Bun, modern browsers.\n\n## Quick start\n\n```ts\nimport { Stablebrowse } from \"@stablebrowse/client\";\n\n// Bearer token comes from either the constructor or the\n// STABLEBROWSE_API_KEY environment variable.\nconst client = new Stablebrowse({ apiKey: \"sb_live_...\" });\n\n// (Optional) upload per-end-user social creds.\nawait client.endUsers(\"alice\").credentials.set({\n  twitterAuthToken: \"...\",\n  twitterCt0: \"...\",\n});\n\n// Sync-feeling submit. Polls internally until the task terminates.\nconst result = await client.tasks.run({\n  endUserId: \"alice\",\n  task: \"find the top AI tweets today\",\n});\nconsole.log(result.result);\n```\n\n## Async primitives\n\nIf you want to drive the poll loop yourself:\n\n```ts\nconst submission = await client.tasks.submit({ endUserId: \"alice\", task: \"...\" });\nwhile (true) {\n  const task = await client.tasks.get(submission.taskId);\n  if (task.status === \"completed\" || task.status === \"failed\") break;\n  await new Promise(r => setTimeout(r, 2000));\n}\n```\n\n## Multi-turn conversations\n\nPass the returned `sessionId` back on subsequent calls to continue a thread:\n\n```ts\nconst first = await client.tasks.run({ endUserId: \"alice\", task: \"who's trending on X?\" });\nconst follow = await client.tasks.run({\n  endUserId: \"alice\",\n  task: \"what about in music specifically?\",\n  sessionId: first.sessionId,\n});\n```\n\n## End users and credentials\n\n```ts\nconst alice = client.endUsers(\"alice\");\n\nawait alice.credentials.set({\n  tiktokSessionId: \"...\",\n  tiktokCsrfToken: \"...\",\n});\n\nconst status = await alice.credentials.get();\n// status.platforms = { twitter: false, reddit: false, tiktok: true, instagram: false }\n\n// Clear everything:\nawait alice.credentials.delete();\n// Or a subset:\nawait alice.credentials.delete([\"twitterAuthToken\", \"twitterCt0\"]);\n```\n\n## API key management\n\nCreate and revoke keys in the dashboard under **Settings → API Keys**.\nKey lifecycle is dashboard-only by design — a leaked key can't mint more.\n\n## Errors\n\nEvery exception extends `StablebrowseError`:\n\n- `TaskFailed` — `run()` saw the task finish with status=failed. Access the\n  failed `Task` via `.task`.\n- `TaskTimeout` — the poll deadline expired before the task terminated. The\n  still-running `Task` is on `.task`, so you can keep polling.\n- `StablebrowseError` — every other HTTP or transport error. `.statusCode`\n  and `.body` are populated when the server returned JSON.\n\n## Configuration\n\nEnvironment variables the constructor reads if not passed explicitly:\n\n- `STABLEBROWSE_API_KEY` — bearer token\n- `STABLEBROWSE_BASE_URL` — API base override (beta / local gateway)\n\nTimeout defaults:\n\n| Option            | Default  | Notes                                    |\n| ----------------- | -------- | ---------------------------------------- |\n| `timeoutMs`       | 30_000   | per-HTTP-request                         |\n| `pollIntervalMs`  | 2_000    | `tasks.run()` poll cadence               |\n| `pollTimeoutMs`   | 300_000  | `tasks.run()` total wait                 |\n","readmeFilename":"README.md"}