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

@bymos/agentkit-sdk

v0.2.0

Published

AgentKit embeddable widget — CDN build and npm package

Readme

@bymos/agentkit-sdk

Embeddable AI chat widget for AgentForge. Add a fully-featured, themeable chat widget to any website or app — via a <script> tag or npm.

Installation

npm install @bymos/agentkit-sdk
# or
pnpm add @bymos/agentkit-sdk

Peer dependency: preact@^10.0.0


Quick start

CDN (no build step)

<script src="https://unpkg.com/@bymos/[email protected]/agentkit-widget.iife.js"></script>
<script>
  window.AgentKit.init({
    agentId: 'your-agent-id',
    tenantId: 'your-tenant-id',
    apiBaseUrl: 'https://api-agentforge.bymos.dev',
    title: 'Support',
    greeting: 'Hi! How can I help?',
  });
</script>

npm (ESM / CJS)

import { init, renderWidget, buildWidgetCSS, normalizeConfig } from '@bymos/agentkit-sdk';

const config = {
  agentId: 'your-agent-id',
  tenantId: 'your-tenant-id',
  apiBaseUrl: 'https://api-agentforge.bymos.dev',
};
const widget = init(config, renderWidget, buildWidgetCSS(normalizeConfig(config)));

widget.on('message:received', (msg) => console.log(msg.content));

Configuration

type AgentKitWidgetConfig = {
  // Required
  agentId: string; // Agent ID from your AgentForge dashboard
  tenantId: string; // Tenant ID from your AgentForge dashboard
  apiBaseUrl: string; // Base URL of your AgentForge API

  // Identity (optional)
  userId?: string;
  authUserId?: string; // Your authenticated user ID — links widget conversations to users in your app (highest-priority contact identifier)
  name?: string;
  email?: string;
  sessionId?: string; // Resume a conversation across tabs/page loads (within a tab, sessions are automatic)

  // Display (optional)
  mode?: 'floating' | 'inline'; // Default: 'floating'
  title?: string;
  greeting?: string;
  avatarUrl?: string;
  subtitle?: string;
  privacyPolicyUrl?: string;

  // Behaviour (optional)
  streaming?: boolean; // Default: true
  metadata?: Record<string, unknown>; // Sent with every message

  // Theming (optional)
  theme?: {
    mode?: 'light' | 'dark' | 'system'; // Default: 'light'
    accentColor?: string; // Default: '#6366f1'
    fontFamily?: string;
    borderRadius?: string; // Default: '12px'
  };
};

At init time the widget fetches any widget config set for your agent in the AgentForge dashboard (title, greeting, avatar, etc.) and uses it as defaults. Any values you pass here override the dashboard config.


Widget instance API

Both init() and mount() return a WidgetInstance:

widget.open();
widget.close();
widget.toggle();
widget.sendMessage('Hello!');
widget.reset(); // Clear conversation and show greeting again
widget.destroy();
widget.getState(); // → WidgetState
widget.on(event, fn);
widget.off(event, fn);

Events

| Event | Payload | | ---------------------- | ------------------------ | | ready | WidgetState | | open / close | — | | message:sent | WidgetMessage | | message:received | WidgetMessage | | message:error | { error, message } | | conversation:started | { sessionId } | | stream:start | — | | stream:delta | { delta, accumulated } | | stream:end | { content } | | reset | — | | destroy | — |


CDN global API (window.AgentKit)

| Method | Description | | ------------------------ | ---------------------------------------------------- | | init(config) | Create a floating widget anchored to document.body | | mount(element, config) | Mount a widget inline inside a DOM element | | destroy(id?) | Destroy widget by ID, or all widgets if no ID given |

Inline mount example

<div id="chat"></div>
<script src="https://unpkg.com/@bymos/[email protected]/agentkit-widget.iife.js"></script>
<script>
  window.AgentKit.mount(document.getElementById('chat'), {
    agentId: 'your-agent-id',
    tenantId: 'your-tenant-id',
    apiBaseUrl: 'https://api-agentforge.bymos.dev',
    mode: 'inline',
  });
</script>

npm exports

// Lifecycle
import { init, mount, destroyWidget, listWidgets, createWidget } from '@bymos/agentkit-sdk';

// Config
import { normalizeConfig } from '@bymos/agentkit-sdk';

// Session
import { getSessionId, setSessionId, clearSession } from '@bymos/agentkit-sdk';

// UI (requires preact peer dep)
import { renderWidget, buildWidgetCSS, buildThemeVars } from '@bymos/agentkit-sdk';

// Lower-level
import { ApiClient, streamChat, EventEmitter } from '@bymos/agentkit-sdk';
import {
  createShadowHost,
  createFloatingContainer,
  prepareInlineContainer,
} from '@bymos/agentkit-sdk';

// Types
import type {
  AgentKitWidgetConfig,
  NormalizedWidgetConfig,
  WidgetInstance,
  WidgetState,
  WidgetMessage,
  WidgetEventMap,
  RenderFn,
} from '@bymos/agentkit-sdk';

Session management

Within a browser tab, sessions are automatic — the SDK reads and writes sessionStorage keyed by agentId with no configuration needed. Sessions are cleared when the tab closes.

To persist a conversation across tabs or page reloads, save and restore the session ID yourself:

widget.on('conversation:started', ({ sessionId }) => {
  localStorage.setItem('chat-session', sessionId);
});

// Later, on next load:
const widget = window.AgentKit.init({
  agentId: 'your-agent-id',
  tenantId: 'your-tenant-id',
  apiBaseUrl: '...',
  sessionId: localStorage.getItem('chat-session') ?? undefined,
});

Theming

The widget renders inside a Shadow DOM to prevent CSS conflicts with your page. Use the theme config to customise it:

window.AgentKit.init({
  agentId: 'your-agent-id',
  apiBaseUrl: '...',
  theme: {
    mode: 'dark',
    accentColor: '#ec4899',
    fontFamily: "'Inter', sans-serif",
    borderRadius: '8px',
  },
});

Requirements

  • Node.js ≥ 18 (for npm usage)
  • Modern browser with Shadow DOM support