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

@kilnai/runtime

v2.1.0

Published

Gateway runtime and channel adapters for the Kiln control plane

Readme


What is this?

@kilnai/runtime is the production runtime for Kiln. It turns your YAML-configured AI apps into a running server with:

  • Multi-app gateway -- host multiple Kiln apps in one Bun/Hono process
  • 8 channel adapters -- CLI, Web (WebSocket), WhatsApp, Instagram, Messenger, Slack, Email, REST API
  • Multi-tenant isolation -- tenant-scoped governed memory, system prompts, billing, and channel credentials
  • Budget middleware -- per-tenant token budgets with fail-open enforcement
  • Trigger runtime -- webhooks (HMAC-SHA256), event listeners, cron scheduler
  • Cross-app delegation -- Kiln-native and A2A protocol support
  • Session management -- per-user sessions with idle cleanup
  • Safety & security middleware -- prompt injection scanning, PII/content/rails pipeline

Install

bun add @kilnai/runtime

This package depends on @kilnai/core, @kilnai/gateway-contracts, and the public @kilnai/gui static asset package.

Usage

Minimal gateway

import { startGateway } from "@kilnai/runtime";

await startGateway("gateway.yaml");

Gateway config (gateway.yaml)

port: 3000

apps:
  - name: my-agent
    config: app.yaml
    channels:
      - type: web
      - type: api
        path: /api/chat

Multi-tenant with WhatsApp

port: 3000

apps:
  - name: my-saas
    config: app.yaml
    channels:
      - type: whatsapp
        multiTenant: true
      - type: web
        multiTenant: true

Dev mode with hot-reload

import { startDevServer } from "@kilnai/runtime";

await startDevServer("app.yaml", { port: 3000 });

Key exports

| Module | Exports | |--------|---------| | Gateway | startGateway(), startDevServer(), createGatewayApp(), resolveApps() | | Session | RuntimeSessionOrchestrator, RuntimeSession, SessionRegistry, SessionMode, SessionStore, InMemorySessionStore, RedisSessionStore, serializeSession, deserializeSession | | Tenant | TenantRegistry, buildTenantSystemPrompt(), extractSuggestions() | | Triggers | TriggerRegistry, createWebhookHandler(), EventListener, Scheduler | | Channels | WebChannel, WhatsAppChannel, InstagramChannel, MessengerChannel, SlackChannel, EmailChannel, CliChannel, ApiChannel | | Budget | checkBudget(), reportUsage() |

Endpoints

When the gateway starts, it automatically mounts:

| Path | Purpose | |------|---------| | GET /health | Health check with per-app and per-subsystem status | | GET /apps/{name}/ws | WebSocket channel (non-tenant) | | GET /apps/{name}/ws?widgetId=X | WebSocket channel (multi-tenant) | | POST /api/{path}/message | REST API channel | | POST /whatsapp/{name}/webhook | WhatsApp webhook | | POST /webhooks/{name}/{path} | Webhook triggers | | POST /admin/{name}/tenants | Tenant CRUD (admin API) | | POST /{path}/handoff | Initiate handoff (transition to queued/human_active) | | POST /{path}/release | Release session back to ai_active | | POST /{path}/operator-message | Send operator message to end user | | GET /{path}/session-history | Retrieve full conversation history |

Documentation

License

Apache-2.0