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

kb-bot-sdk

v1.0.10

Published

A TypeScript SDK with CommonJS and ESM support

Readme

kb-bot-sdk

A powerful TypeScript SDK for creating type-safe integrations with full autocomplete support, built with Zod validation and ready for npm publishing.

Features

  • ✅ TypeScript support with full type definitions
  • ✅ CommonJS and ESM builds
  • ✅ Source maps included
  • ✅ Tree-shaking friendly
  • ✅ Zod validation for all inputs and outputs
  • ✅ TypeScript autocompletion
  • ✅ Schema-driven integration creation
  • ✅ CLI tool with kbs alias

Installation

npm install kb-bot-sdk

Usage

TypeScript

import { createSchema, createIntegration, z } from 'kb-bot-sdk';

// Create a schema for your integration
const mySchema = createSchema({
  name: 'my-integration',
  version: '1.0.0',
  description: 'My awesome integration',
  config_settings: {
    schema: z.object({
      apiKey: z.string(),
      baseUrl: z.string().url()
    })
  },
  action_functions: {
    greet: {
      inputParameter: { schema: z.object({ name: z.string() }) },
      outputParameter: { schema: z.object({ message: z.string() }) }
    },
    calculate: {
      inputParameter: { schema: z.object({ a: z.number(), b: z.number() }) },
      outputParameter: { schema: z.object({ result: z.number() }) }
    }
  },
  incoming_events: {
    userCreated: {
      inputParameter: { schema: z.object({ userId: z.string(), email: z.string() }) },
      outputParameter: { schema: z.object({ success: z.boolean() }) }
    }
  },
  message_channels: {},
  webhooks: {}
});

// Create the integration implementation
const myIntegration = createIntegration(mySchema, {
  action_functions: {
    greet: ({ input }) => ({ message: `Hello, ${input.name}!` }),
    calculate: ({ input }) => ({ result: input.a + input.b })
  },
  incoming_events: {
    userCreated: ({ input }) => {
      console.log(`User created: ${input.email}`);
      return { success: true };
    }
  },
  config_settings: {
    apiKey: 'your-api-key',
    baseUrl: 'https://api.example.com'
  }
});

// Use the integration
const greeting = await myIntegration.action_functions.greet({ name: 'World' });
console.log(greeting.message); // "Hello, World!"

const calculation = await myIntegration.action_functions.calculate({ a: 5, b: 3 });
console.log(calculation.result); // 8

JavaScript (CommonJS)

const { createSchema, createIntegration, z } = require('kb-bot-sdk');

// Same usage as TypeScript but without type safety
const schema = createSchema({
  name: 'my-integration',
  version: '1.0.0',
  config_settings: {
    schema: z.object({
      apiKey: z.string()
    })
  },
  action_functions: {
    greet: {
      inputParameter: { schema: z.object({ name: z.string() }) },
      outputParameter: { schema: z.object({ message: z.string() }) }
    }
  },
  incoming_events: {},
  message_channels: {},
  webhooks: {}
});

CLI Usage

# Install globally
npm install -g kb-bot-sdk

# Use the CLI
kbs example
kbs help

API Reference

Core Functions

createSchema<T>(props: SchemaPropsType): SchemaCreator<T>

Creates a typed schema for your integration.

createIntegration<T>(schema: SchemaCreator, impl: IntegrationAllImplementations): WrappedIntegrationAllImplementations

Creates a type-safe integration from a schema and implementation.

Schema Types

SchemaPropsType

type SchemaPropsType = {
  name: string;
  description?: string;
  version: string;
  config_settings: {
    schema: ZodObject;
  };
  action_functions: Record<string, ActionDefinition>;
  incoming_events: Record<string, EventDefinition>;
  message_channels: Record<string, MessageChannelDefinition>;
  webhooks: Record<string, WebhookDefinition>;
};

ActionDefinition

type ActionDefinition<TInput, TOutput> = {
  inputParameter: { schema: TInput };
  outputParameter: { schema: TOutput };
};

Function Props

ActionFunctionProps<TInput>

type ActionFunctionProps<TInput> = {
  input: TInput;
  ctx?: {
    userId?: string;
    sessionId?: string;
    timestamp?: number;
    [key: string]: any;
  };
  logger?: {
    info: (message: string, data?: any) => void;
    error: (message: string, error?: any) => void;
    warn: (message: string, data?: any) => void;
    debug: (message: string, data?: any) => void;
  };
  [key: string]: any;
};

Development

Prerequisites

  • Node.js 16+
  • npm

Setup

# Install dependencies
npm install

# Build the project
npm run build

# Watch mode for development
npm run dev

# Clean build directory
npm run clean

Publishing

# Build and publish to npm
npm run prepublishOnly
npm publish

License

MIT