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

@primeradianthq/bot-toolkit

v1.0.1

Published

Reusable TypeScript core for building unattended Claude-powered chat agents.

Downloads

320

Readme

@primeradianthq/bot-toolkit

Reusable TypeScript core for building unattended Claude-powered chat agents.

@primeradianthq/bot-toolkit provides shared bot infrastructure: session storage, Claude session management, per-room workspaces, wakeups, logging, config/secrets loading, responder base classes, adapter base classes, attention tracking, task tracking, and native chat route primitives.

It does not bundle concrete Slack/Bolt or email transport adapters. Applications own their platform adapters and compose them with BaseAdapter, BaseResponder, and the toolkit's shared types.

Install

npm install @primeradianthq/bot-toolkit

For local validation before npm publication:

TARBALL=$(npm pack --silent)
npm install "./$TARBALL"

Requirements and Configuration

This package requires Node.js 20 or newer.

loadConfig() reads these optional environment variables:

  • DATABASE_PATH: SQLite database path. Defaults to ./data/infrastructure/sessions.db.
  • DATA_DIRECTORY: persistent data root for room directories and related files. Defaults to the grandparent directory of DATABASE_PATH.
  • CONFIG_DIR: directory containing instance.json and secrets.json. Defaults to ~/etc/sen.
  • CLAUDE_PA_DIR: application root passed through to Claude session setup.
  • TZ: runtime timezone. Defaults to America/Los_Angeles.
  • USE_AGENT_SDK: set to false to use CLI mode instead of Agent SDK mode.

Public Surface

import {
  BaseAdapter,
  BaseResponder,
  ClaudeSessionManagerSDK,
  ConversationOrchestrator,
  Logger,
  MessageSessionStore,
  SessionDatabase,
  getRoomDirectory,
  type BaseAdapterConfig,
  type IncomingMessage,
  type MessageOrchestrator,
  type Platform,
  type PlatformResponder,
  type SessionCallbacks,
  type WakeupPayload,
} from '@primeradianthq/bot-toolkit';

Platform Identifiers

The public Platform type is:

type Platform = 'slack' | 'native' | 'email';

These identifiers are used by core APIs for room paths, wakeups, task rows, environment setup, and adapter interfaces. They are not claims that this package exports a bundled SlackAdapter or EmailAdapter.

Task Tools

createTaskToolsServer() exposes toolkit task inspection/cancellation tools to Claude through ClaudeSessionManagerSDK:

import {
  ClaudeSessionManagerSDK,
  MessageSessionStore,
  SessionDatabase,
  TaskRegistry,
  createTaskToolsServer,
  loadConfig,
} from '@primeradianthq/bot-toolkit';

const config = loadConfig();
const database = new SessionDatabase(config.database.path);
const sessionStore = new MessageSessionStore(database.db);
const taskRegistry = new TaskRegistry(database.db);

const sessionManager = new ClaudeSessionManagerSDK(config, sessionStore, {
  taskManagement: createTaskToolsServer(taskRegistry),
});

Adapter Boundary

Applications should implement concrete platform adapters in their own packages:

import {
  BaseAdapter,
  type BaseAdapterConfig,
  type WakeupPayload,
} from '@primeradianthq/bot-toolkit';

export interface ApplicationAdapterConfig extends BaseAdapterConfig {
  token: string;
}

export class ApplicationAdapter extends BaseAdapter {
  readonly platform = 'slack' as const;

  constructor(private readonly config: ApplicationAdapterConfig) {
    super(config);
  }

  async start(): Promise<void> {
    throw new Error('Start the application-owned platform client here');
  }

  async stop(): Promise<void> {}
  async stopListening(): Promise<void> {}
  async sendRecoveryNotice(): Promise<void> {}
  async handleWakeup(
    _channelId: string,
    _payload: WakeupPayload,
  ): Promise<void> {}

  protected async sendUnauthorizedResponse(): Promise<void> {}
}

Security Model

The toolkit is a trusted local/headless runtime, not a sandbox. ClaudeSessionManagerSDK runs Claude Code in unattended mode with:

permissionMode: 'bypassPermissions';
allowDangerouslySkipPermissions: true;

Use a dedicated user or container, least-privilege filesystem mounts, trusted MCP/plugin configuration, trusted Claude settings, and an allowlisted SDK environment. Do not run this package against untrusted repositories, untrusted MCP servers, untrusted plugin paths, or broad host filesystem mounts.

The wakeup/native HTTP server defaults to loopback. If you bind it to a non-loopback host, configure an authToken.

Local Development

npm ci
npm run format:check
npm run lint
npm run typecheck
npm test
npm run build
npm pack --dry-run

npm run check runs the full quality gate.