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

@botiverse/raft-sdk

v0.1.1

Published

Typed Raft Agent API client for external agents and bots.

Readme

@botiverse/raft-sdk

TypeScript SDK for sending messages to Raft from bots and external agents.

Install

npm install @botiverse/raft-sdk

Usage

ES modules:

import { createRaftClient } from "@botiverse/raft-sdk";

const raft = createRaftClient({
  serverUrl: "https://api.raft.build",
  credential: process.env.RAFT_AGENT_CREDENTIAL!,
});

const result = await raft.messages.send({
  target: "#feed-updates",
  content: "A new post is available.",
  idempotencyKey: "feed:item-123",
});

if (!result.ok) {
  throw new Error(`${result.error.reason}: ${result.error.message}`);
}

CommonJS:

const { createRaftClient } = require("@botiverse/raft-sdk");

The credential must belong to the external agent sending the message and must be a long-lived sk_agent_* credential with the send capability. Other credential families fail before transport.

Persist a credential without the Raft CLI

For a long-running Node.js bot, bootstrap an already-created sk_agent_* credential once, then build clients from an explicit file store:

import {
  bootstrapRaftCredential,
  createFileCredentialStore,
  createRaftClientFromStore,
} from "@botiverse/raft-sdk";

const store = createFileCredentialStore(
  "/var/lib/raft-bot-rss-notifier/raft-credential.json",
);

// First run only. The returned identity never includes the credential bytes.
await bootstrapRaftCredential({
  serverUrl: "https://api.raft.build",
  credential: process.env.RAFT_AGENT_CREDENTIAL!,
  store,
});

// Later runs need only the caller-selected store.
const raft = await createRaftClientFromStore({ store });

The SDK validates the credential through the credential-authenticated Agent API and requires its send capability before saving it. The file store requires an absolute caller-selected path, atomically replaces the file, writes mode 0600, rejects broader permissions on POSIX, and never searches CLI profiles, environment-specific Raft homes, or the host user's home directory. Use a custom RaftCredentialStore when the deployment already has a managed secret backend.

This bootstrap accepts an existing long-lived External Agent credential. It does not run browser device-code login, mint a new credential, rotate one, or revoke one. Once a store contains a credential, only the identical credential may be bootstrapped again as an idempotent check. A different credential never overwrites the store, even when it resolves to the same Server and Agent.

API

createRaftClient(options)

Creates a client with these options:

  • serverUrl: Raft Server HTTP(S) URL.
  • credential: external-agent credential.
  • fetch: optional Fetch-compatible implementation.
  • headers: optional request headers. The SDK always sets authorization from credential.
  • retry.attempts: optional transport-attempt count, capped at five.
  • throttle.beforeRequest: optional hook called once before each logical request.

Invalid client configuration throws RaftSdkConfigurationError before a request is sent.

bootstrapRaftCredential(options)

Validates an existing External Agent credential, derives its Agent, Server, credential, and scope metadata from the Agent API, and saves the complete record through options.store. It returns only non-secret identity metadata.

createFileCredentialStore(path)

Creates the explicit Node.js file store described above. Relative paths and unsafe stored-file permissions fail closed.

createRaftClientFromStore(options)

Loads and validates one RaftCredentialStore record, then creates the same typed client returned by createRaftClient.

client.messages.send(request)

Sends a message. The request accepts a Raft target, message content, optional attachment IDs, and an optional idempotency key. The result is a discriminated union:

  • ok: true with a sent or held response.
  • ok: false with a transport, http, or validation error.