npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@stablebrowse/client

v0.3.0

Published

TypeScript client for the stablebrowse browser agent API

Readme

stablebrowse (TypeScript)

TypeScript / JavaScript client for the stablebrowse browser agent API.

Install

From npm:

npm install @stablebrowse/client

From source (for local development):

cd sdks/typescript
npm install
npm run build
# Then in the consuming project:
npm install /path/to/stablebrowse-agent/sdks/typescript

Requires Node 18+ (uses native fetch). Works in any fetch-capable runtime — Node, Deno, Cloudflare Workers, Bun, modern browsers.

Quick start

import { Stablebrowse } from "@stablebrowse/client";

// Bearer token comes from either the constructor or the
// STABLEBROWSE_API_KEY environment variable.
const client = new Stablebrowse({ apiKey: "sb_live_..." });

// (Optional) upload per-end-user social creds.
await client.endUsers("alice").credentials.set({
  twitterAuthToken: "...",
  twitterCt0: "...",
});

// Sync-feeling submit. Polls internally until the task terminates.
const result = await client.tasks.run({
  endUserId: "alice",
  task: "find the top AI tweets today",
});
console.log(result.result);

Async primitives

If you want to drive the poll loop yourself:

const submission = await client.tasks.submit({ endUserId: "alice", task: "..." });
while (true) {
  const task = await client.tasks.get(submission.taskId);
  if (task.status === "completed" || task.status === "failed") break;
  await new Promise(r => setTimeout(r, 2000));
}

Multi-turn conversations

Pass the returned sessionId back on subsequent calls to continue a thread:

const first = await client.tasks.run({ endUserId: "alice", task: "who's trending on X?" });
const follow = await client.tasks.run({
  endUserId: "alice",
  task: "what about in music specifically?",
  sessionId: first.sessionId,
});

End users and credentials

const alice = client.endUsers("alice");

await alice.credentials.set({
  tiktokSessionId: "...",
  tiktokCsrfToken: "...",
});

const status = await alice.credentials.get();
// status.platforms = { twitter: false, reddit: false, tiktok: true, instagram: false }

// Clear everything:
await alice.credentials.delete();
// Or a subset:
await alice.credentials.delete(["twitterAuthToken", "twitterCt0"]);

API key management

Create and revoke keys in the dashboard under Settings → API Keys. Key lifecycle is dashboard-only by design — a leaked key can't mint more.

Errors

Every exception extends StablebrowseError:

  • TaskFailedrun() saw the task finish with status=failed. Access the failed Task via .task.
  • TaskTimeout — the poll deadline expired before the task terminated. The still-running Task is on .task, so you can keep polling.
  • StablebrowseError — every other HTTP or transport error. .statusCode and .body are populated when the server returned JSON.

Configuration

Environment variables the constructor reads if not passed explicitly:

  • STABLEBROWSE_API_KEY — bearer token
  • STABLEBROWSE_BASE_URL — API base override (beta / local gateway)

Timeout defaults:

| Option | Default | Notes | | ----------------- | -------- | ---------------------------------------- | | timeoutMs | 30_000 | per-HTTP-request | | pollIntervalMs | 2_000 | tasks.run() poll cadence | | pollTimeoutMs | 300_000 | tasks.run() total wait |