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

@usebido/sdk

v0.1.0

Published

TypeScript SDK for Bido — sponsored-intent detection and matching API for AI agents.

Readme

@usebido/sdk

TypeScript SDK for Bido — the sponsored-intent decision API for AI agents. Detect whether a user message represents a sponsorable decision moment, run an auction across eligible sponsors, and record conversion feedback.

Install

npm install @usebido/sdk

Requires Node.js 18+ (uses the global fetch and AbortController). Works in modern browsers, Deno, Bun, and edge runtimes.

Quick start

import { BidoClient } from '@usebido/sdk';

const bido = new BidoClient({
  agentTreasuryWallet: process.env.SOLANA_AGENT_WALLET,
});

// 1. Easiest path: detect + match in one call (the 90% use case).
const { intent, match } = await bido.run('quero viajar pra Lisboa em julho');

if (match?.selected_candidate) {
  const sponsor = match.selected_candidate;
  console.log(`Sponsor: ${sponsor.advertiser} → ${sponsor.destination_url}`);
  console.log(`Decision id: ${sponsor.decision_id}`);
}

API

new BidoClient(options?)

| Option | Type | Default | Notes | | --------------------- | -------------------------- | ---------------------------------------- | ------------------------------------------------------------------ | | agentTreasuryWallet | string \| null | null | Solana wallet that receives the agent owner's settlement share. | | intentApiUrl | string | https://api-intent.usebido.com | Intent-detection service base URL. | | backendApiUrl | string | https://api.usebido.com/api | Bido backend base URL. | | timeoutMs | number | 5000 | Per-attempt request timeout. | | retry | Partial<RetryOptions> | { retries: 3, factor: 2, jitter: true }| Exponential backoff with jitter. | | headers | Record<string, string> | — | Extra headers (e.g. Authorization) attached to every request. |

run(query, options?) → Promise<RunResult>

Full pipeline. Calls detect, then match if intent.sponsorable === true. When the message is not sponsorable, match is null and no auction call is made.

detect(query, options?) → Promise<IntentResult>

Calls POST /detect-intent. Returns the structured intent classification (sponsorable flag, vertical, intent type, purchase stage, urgency, entities, reason).

match(intent, options?) → Promise<MatchResult>

Calls POST /intent/match with an IntentResult. The backend ranks eligible sponsor campaigns, picks the winner via first-price auction, and settles the winning bid on-chain in the same request. Returns the selected candidate (with decision_id and settlement_tx_hash) plus the top qualified candidates.

agentTreasuryWallet falls back to the client-level default if omitted.

Granular usage

const intent = await bido.detect('hotel pet friendly em Floripa semana que vem');

if (intent.sponsorable && intent.confidence >= 0.6) {
  const match = await bido.match(intent);
  const winner = match.selected_candidate;

  if (winner) {
    console.log(`Use sponsor ${winner.advertiser} (decision ${winner.decision_id})`);
  }
}

Errors

Every failure throws a BidoError with a discriminated code:

| code | When | | ------------------- | ------------------------------------------------------------- | | timeout | A single attempt exceeded timeoutMs. | | network | fetch rejected (DNS, connection, TLS). | | http_4xx | API returned a 4xx (not retried). | | http_5xx | API returned a 5xx after all retries. | | invalid_response | Response was not the expected JSON shape. | | invalid_input | Argument validation failed locally (no network call made). | | aborted | Caller signalled abort via options.signal. |

import { BidoClient, isBidoError } from '@usebido/sdk';

try {
  await bido.run(query);
} catch (err) {
  if (isBidoError(err)) {
    console.error(`[${err.code}] ${err.message}`, { status: err.status });
  } else {
    throw err;
  }
}

Retries: idempotent retries are applied on timeout, network, and HTTP 408/425/429/500/502/503/504. Other 4xx errors fail fast. Default policy: 3 attempts, exponential backoff (200ms → 400ms → 800ms, capped at 3s, with jitter).

Cancellation

Pass an AbortSignal to cancel pending work, including the backoff sleeps between retries:

const controller = new AbortController();
setTimeout(() => controller.abort(), 2_000);

await bido.run(query, { signal: controller.signal });

Types

IntentResult, MatchResult, Candidate, SelectedCandidate, RunResult, plus the literal unions (Vertical, IntentType, PurchaseStage, Urgency) are exported from the package root.

Build

npm install
npm run build      # emits dist/ (ESM + CJS + .d.ts)
npm test