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

@ariaflowagents/widget

v0.7.0

Published

Embeddable chat widget for AriaFlow Universal Inbox

Readme

@ariaflowagents/widget

Embeddable chat widget for the AriaFlow Universal Inbox.

Installation

Include the widget script on your website:

<script src="https://cdn.yourdomain.com/widget/v1.js"></script>

Usage

Method 1: Agent Resolution (Recommended)

Use agent-url (HTTP base URL) and agent-id to dynamically resolve agent configuration:

<ariaflow-widget
  agent-url="https://your-api-endpoint.com"
  agent-id="support"
  position="bottom-right"
  theme="light"
  title="Chat with us"
  subtitle="We're here to help!">
</ariaflow-widget>

The widget will:

  1. Call GET https://your-api-endpoint.com/api/agent/support
  2. Receive WebSocket URL and agent configuration
  3. Connect to the resolved WebSocket endpoint

Method 2: Legacy Direct Connection

For backward compatibility with fallback logic:

<ariaflow-widget
  agent-url="wss://your-server.com"
  agent-id="support"
  position="bottom-right"
  theme="light">
</ariaflow-widget>

Attributes

| Attribute | Type | Default | Description | |-----------|------|---------|-------------| | agent-url | string | required | HTTP base URL for API calls | | agent-id | string | required | Agent identifier to resolve configuration | | widget-id | string | - | Legacy: Widget config ID | | api-url | string | - | Legacy: API endpoint for widget config | | position | string | "bottom-right" | Widget position: bottom-right, bottom-left, top-right, top-left | | theme | string | "light" | Theme: light or dark | | title | string | "Chat with us" | Header title | | subtitle | string | "We typically reply within minutes" | Header subtitle | | accent-color | string | "#14B8A6" | Primary accent color | | base-color | string | - | Base color for theming | | button-base-color | string | "#000000" | Button base color | | button-accent-color | string | "#FFFFFF" | Button accent color |

Programmatic Usage

Config-based Connection

import { WidgetClient } from '@ariaflowagents/widget';

// Initialize with API endpoint
const client = new WidgetClient('https://your-api-endpoint.com');

// Initialize widget with config ID
const config = await client.initWidget('widget_abc123');

Direct Agent Connection

import { WidgetClient } from '@ariaflowagents/widget';

// Initialize with direct agent WebSocket URL
const client = new WidgetClient(undefined, 'ws://localhost:3333/agents/chat');

// Initialize (no widget ID needed)
const config = await client.initWidget();

Common Methods (Both Approaches)

// Send message
await client.sendMessage('Hello!');

// Listen for messages
client.onMessages((messages) => {
  console.log('New messages:', messages);
});

// Listen for connection changes
client.onConnectionChange((connected) => {
  console.log('Connected:', connected);
});

// Get current messages
const messages = client.getMessages();

// Cleanup
client.dispose();

Architecture

The widget supports two connection architectures:

Config-based Architecture (Production)

Widget → API → Config DB → Agent WebSocket URL
    ↓                    ↓
Real-time chat     ← WebSocket ← Agent
  1. Widget → API: Fetches configuration from /api/widget/:widgetId
  2. API → Agent: Returns WebSocket URL for agent connection
  3. Widget → Agent: Direct WebSocket connection for real-time chat

Direct Agent Architecture (Development/Debugging)

Widget → Agent WebSocket (Direct)
    ↓
Real-time chat
  1. Widget → Agent: Direct WebSocket connection using agent-url prop
  2. No config endpoint: Bypasses configuration for easier debugging

Benefits

Config-based (Production):

  • Centralized widget management
  • Dynamic agent routing
  • Environment-specific configurations
  • Security controls

Direct Agent (Development):

  • Easier debugging and testing
  • No config endpoint required
  • Direct connection visibility
  • Faster iteration during development

Development

# Install dependencies
bun install

# Build widget
bun run build

# Watch mode
bun run dev

# Type check
bun run typecheck

# Clean
bun run clean

Bundle Size

The widget is optimized to be under 50KB (gzipped) for fast loading.

License

MIT