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

@threadpoolai/sdk

v0.2.0

Published

Client for ThreadPool's governance gateway: scoped authority, independent QA and an accountability record for agents you run yourself.

Downloads

418

Readme

@threadpoolai/sdk

Dependency-free TypeScript client for the ThreadPool governance gateway. It asks ThreadPool to authorize each agent step, reports the result, and triggers independent verification. Your agent and its provider credentials stay in your infrastructure.

Install

npm install @threadpoolai/sdk

Requires Node.js 18 or later.

Use

import { ThreadPoolGateway } from "@threadpoolai/sdk";

const threadpool = new ThreadPoolGateway({
  baseUrl: process.env.THREADPOOL_URL!,
  apiKey: process.env.THREADPOOL_API_KEY!, // API key with gateway:run
});

const { run } = await threadpool.openRun({ title: "Weekly market report" });
const { step } = await threadpool.declareStep(run.id, {
  capability: "summarization",
  agent: { id: "reporter-v1", name: "Reporter" },
});

const result = await threadpool.governed(
  { runId: run.id, stepId: step.id },
  async () => ({ output: await myAgent.run() }),
);

if (!result.ran) console.log(`Not run: ${result.decision.reason.code}`);
else console.log(result.verdict.outcome);

await threadpool.closeRun(run.id);

governed() only calls your function after ThreadPool returns allow. A denial or pending approval returns without invoking it. API errors throw ThreadPoolGatewayError with HTTP status, API error code, details, and request ID.

Capabilities, step kinds and enforcement

  • capability is a catalog value, not a tool name. declareStep takes the GatewayCapability union (the GATEWAY_CAPABILITIES constant), so a typo or a tool name fails to compile instead of returning a 400. await threadpool.listCapabilities() returns the live list with what each is for. Pick the capability that describes the kind of work and put the tool's name in description.
  • kind: "data_retrieval" marks a step that only reports what a tool or provider returned (a quote, a price series, a computed statistic). QA then checks fidelity to the call and provenance (source, time) instead of asking for analytical hedging. The default is "analysis".
  • enforcement: "record" on openRun keeps a QA rejection on the record but off the agent's failure streak, so a strict review can't take the agent offline. The default is "block".
  • onRejected on governed() runs when ThreadPool rejects the output. Throw from it to make a rejection block your caller; otherwise governed() returns the verdict as before.
const { run } = await threadpool.openRun({ title: "Market snapshot", enforcement: "record" });
const { step } = await threadpool.declareStep(run.id, {
  capability: "data_extraction",
  kind: "data_retrieval",
  description: "Latest quote for RELIANCE.NS from the get_stock_quote tool.",
  agent: { id: "quote-agent", name: "Quote agent" },
});

const result = await threadpool.governed({ runId: run.id, stepId: step.id }, () => fetchQuote("RELIANCE.NS"), {
  onRejected: (v) => console.warn(`QA rejected: ${v.verdict.reason}`),
});

An agent that fails QA several times in a row is taken offline by the Circuit Breaker. A denial then carries decision.reason.retryAfter, the time the agent is reinstated automatically.

For endpoint behavior, policies, approval handling, and limits, see the gateway documentation.