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

@bernierllc/chat-suite

v1.2.0

Published

Comprehensive chat orchestration suite with AI-powered routing

Downloads

159

Readme

@bernierllc/chat-suite

Comprehensive chat orchestration suite with AI-powered routing and multi-provider support.

Installation

npm install @bernierllc/chat-suite

Overview

The Chat Suite provides a unified interface for orchestrating multiple chat providers (ChatKit, Slack, Discord, Teams) with AI-powered routing, analytics, and NeverHub integration. It handles cross-platform message bridging, user management, health monitoring, and intelligent message routing.

Features

  • Multi-Provider Orchestration - Unified interface for multiple chat platforms
  • AI-Powered Routing - Intelligent message routing based on intent analysis
  • Cross-Platform Bridging - Seamless message flow between platforms
  • User Management - Unified user identity across all platforms
  • Health Monitoring - Real-time health status of all providers
  • NeverHub Integration - Service discovery and event orchestration
  • Analytics Integration - Comprehensive usage metrics and insights
  • Graceful Degradation - Works with minimal configuration

Quick Start

Minimal Configuration (ChatKit Only)

import { ChatSuite } from '@bernierllc/chat-suite';

const chatSuite = new ChatSuite({
  providers: {
    chatkit: {
      enabled: true,
      priority: 1,
      config: {
        serviceName: 'chatkit-adapter'
      }
    }
  }
});

await chatSuite.initialize();

// Send a message
const result = await chatSuite.sendMessage('chatkit', {
  content: 'Hello from the chat suite!',
  userId: 'user123'
});

console.log('Message sent:', result.data?.messageId);

Full Configuration (Multiple Providers)

import { ChatSuite } from '@bernierllc/chat-suite';

const chatSuite = new ChatSuite({
  enabled: true,

  providers: {
    chatkit: {
      enabled: true,
      priority: 1,
      config: {
        serviceName: 'chatkit-adapter',
        features: ['streaming', 'attachments', 'threads']
      }
    },
    slack: {
      enabled: true,
      priority: 2,
      config: {
        serviceName: 'chat-integration-slack',
        channels: ['#general', '#dev']
      }
    }
  },

  aiRouting: {
    enabled: true,
    serviceName: 'chat-ai-router',
    fallbackToHuman: true,
    intentThreshold: 0.8
  },

  analytics: {
    enabled: true,
    serviceName: 'chat-analytics',
    metricsInterval: 60000
  },

  neverhub: {
    enabled: true,
    serviceName: 'chat-suite',
    capabilities: [
      { type: 'chat', name: 'multi-provider-chat', version: '1.0.0' },
      { type: 'orchestration', name: 'chat-orchestration', version: '1.0.0' }
    ],
    dependencies: ['chat-provider-*', 'chat-ai-router', 'chat-analytics']
  }
});

await chatSuite.initialize();

Core Concepts

Providers

Providers are chat platform adapters that implement a common interface:

  • ChatKit (Required) - Primary chat provider using @bernierllc/chatkit-adapter
  • Slack (Optional) - Requires @bernierllc/chat-integration-slack
  • Discord (Optional) - Requires @bernierllc/chat-integration-discord
  • Teams (Optional) - Requires @bernierllc/chat-integration-teams

Priority System

Providers are assigned priorities (1 = highest). Messages are routed to the highest priority available provider unless specified otherwise.

Message Orchestration

The suite coordinates messages across providers, handling:

  • Message queueing and delivery
  • Cross-platform bridging
  • Retry logic with exponential backoff
  • Error handling and recovery

API Reference

ChatSuite

Main orchestration class.

constructor(config?: Partial<ChatSuiteConfig>)

Create a new chat suite instance.

const suite = new ChatSuite({
  providers: {
    chatkit: { enabled: true, priority: 1, config: {} }
  }
});

async initialize(): Promise<SuiteInitResult>

Initialize the chat suite and all enabled providers.

const result = await suite.initialize();
console.log('Initialized providers:', result.providersInitialized);

async sendMessage(providerType, message): Promise<SuiteResult<ProviderMessageResult>>

Send a message through a specific provider.

const result = await suite.sendMessage('chatkit', {
  content: 'Hello!',
  userId: 'user123',
  channelId: 'channel456'
});

async broadcastMessage(config): Promise<SuiteResult<ProviderMessageResult[]>>

Broadcast a message to multiple providers.

const result = await suite.broadcastMessage({
  content: 'Important announcement!',
  platforms: ['chatkit', 'slack'],
  channels: ['#announcements'],
  priority: MessagePriority.HIGH
});

async getHealth(): Promise<ChatSuiteHealth>

Get health status of all providers.

const health = await suite.getHealth();
console.log('Suite status:', health.status);
console.log('Provider health:', health.providers);

getUserManager(): UserManager

Get the user manager for cross-platform user management.

const userManager = suite.getUserManager();

userManager.registerUser({
  provider: 'chatkit',
  platformUserId: 'chatkit123',
  displayName: 'John Doe',
  email: '[email protected]'
});

getConfigManager(): ConfigManager

Get the configuration manager.

const configManager = suite.getConfigManager();

configManager.updateConfig({
  analytics: { enabled: false }
});

async shutdown(): Promise<void>

Shutdown the chat suite and all providers.

await suite.shutdown();

UserManager

Cross-platform user identity management.

const userManager = suite.getUserManager();

// Register a user
const result = userManager.registerUser({
  provider: 'chatkit',
  platformUserId: 'chatkit123',
  displayName: 'Alice',
  email: '[email protected]'
});

const unifiedId = result.data?.unifiedId;

// Link another platform
userManager.linkPlatform(unifiedId!, 'slack', 'slack456');

// Get unified ID from platform ID
const id = userManager.getUnifiedId('chatkit', 'chatkit123');

// Search users
const users = userManager.searchUsers('Alice');

Usage Examples

Basic Chat Operations

import { ChatSuite, MessagePriority } from '@bernierllc/chat-suite';

const suite = new ChatSuite();
await suite.initialize();

// Send a simple message
await suite.sendMessage('chatkit', {
  content: 'Hello, world!',
  userId: 'user123'
});

// Send a message with attachments
await suite.sendMessage('chatkit', {
  content: 'Check out this file',
  userId: 'user123',
  attachments: [{
    filename: 'document.pdf',
    contentType: 'application/pdf',
    data: fileBuffer,
    size: fileBuffer.length
  }]
});

// Broadcast to multiple platforms
await suite.broadcastMessage({
  content: 'System maintenance tonight at 10 PM',
  platforms: ['chatkit', 'slack'],
  priority: MessagePriority.URGENT
});

User Management

const userManager = suite.getUserManager();

// Register users from different platforms
userManager.registerUser({
  provider: 'chatkit',
  platformUserId: 'chatkit123',
  displayName: 'Alice',
  email: '[email protected]'
});

userManager.registerUser({
  provider: 'slack',
  platformUserId: 'slack456',
  displayName: 'Bob',
  email: '[email protected]'
});

// Link platforms for the same user
const aliceId = userManager.getUnifiedId('chatkit', 'chatkit123');
userManager.linkPlatform(aliceId!, 'slack', 'slackAlice');

// Search for users
const results = userManager.searchUsers('[email protected]');

Health Monitoring

// Get overall health
const health = await suite.getHealth();

console.log('Suite Status:', health.status);
console.log('ChatKit Health:', health.providers.chatkit);

// Check specific provider
const providerManager = suite.getProviderManager();
const chatkit = providerManager.getProvider('chatkit');

if (chatkit) {
  const providerHealth = await chatkit.getHealth();
  console.log('ChatKit Latency:', providerHealth.latency);
  console.log('Error Count:', providerHealth.errorCount);
}

Configuration Management

const configManager = suite.getConfigManager();

// Update configuration
configManager.updateConfig({
  analytics: { enabled: false },
  aiRouting: {
    enabled: true,
    intentThreshold: 0.9
  }
});

// Get current config
const config = configManager.getConfig();

// Export configuration
const json = configManager.toJSON();

// Load configuration
configManager.fromJSON(json);

External Provider Integration

The suite supports optional external providers. To enable them:

Slack Integration

npm install @bernierllc/chat-integration-slack
import { ChatSuite } from '@bernierllc/chat-suite';
// When available: import { SlackProvider } from '@bernierllc/chat-integration-slack';

const suite = new ChatSuite({
  providers: {
    chatkit: { enabled: true, priority: 1, config: {} },
    slack: {
      enabled: true,
      priority: 2,
      config: {
        token: process.env.SLACK_BOT_TOKEN,
        channels: ['#general', '#dev']
      }
    }
  }
});

Discord Integration

npm install @bernierllc/chat-integration-discord
// When available: import { DiscordProvider } from '@bernierllc/chat-integration-discord';

const suite = new ChatSuite({
  providers: {
    chatkit: { enabled: true, priority: 1, config: {} },
    discord: {
      enabled: true,
      priority: 3,
      config: {
        token: process.env.DISCORD_BOT_TOKEN,
        guilds: ['123456789012345678']
      }
    }
  }
});

Teams Integration

npm install @bernierllc/chat-integration-teams
// When available: import { TeamsProvider } from '@bernierllc/chat-integration-teams';

const suite = new ChatSuite({
  providers: {
    chatkit: { enabled: true, priority: 1, config: {} },
    teams: {
      enabled: true,
      priority: 4,
      config: {
        tenantId: process.env.TEAMS_TENANT_ID,
        clientId: process.env.TEAMS_CLIENT_ID,
        clientSecret: process.env.TEAMS_CLIENT_SECRET
      }
    }
  }
});

NeverHub Integration

The suite integrates with NeverHub for service discovery and event orchestration:

const suite = new ChatSuite({
  neverhub: {
    enabled: true,
    serviceName: 'chat-suite',
    capabilities: [
      { type: 'chat', name: 'multi-provider-chat', version: '1.0.0' },
      { type: 'orchestration', name: 'chat-orchestration', version: '1.0.0' }
    ],
    dependencies: ['chat-provider-*', 'chat-ai-router', 'chat-analytics']
  }
});

await suite.initialize();

// NeverHub will automatically:
// - Register the chat suite as a service
// - Discover available chat providers
// - Publish message events
// - Subscribe to relevant events
// - Report health status

Integration Status

  • Logger: Not applicable (suite-level component, uses console logging)
  • Docs-Suite: Ready - All types and APIs documented with JSDoc
  • NeverHub: Integrated - Full service discovery, event publishing, and health monitoring

TypeScript Support

Full TypeScript support with strict type checking:

import {
  ChatSuite,
  ChatSuiteConfig,
  MessagePriority,
  ProviderType,
  SuiteResult
} from '@bernierllc/chat-suite';

const config: ChatSuiteConfig = {
  enabled: true,
  providers: {
    chatkit: {
      enabled: true,
      priority: 1,
      config: {}
    }
  }
};

const suite = new ChatSuite(config);

Error Handling

All operations return structured results:

const result = await suite.sendMessage('chatkit', {
  content: 'Test message'
});

if (!result.success) {
  console.error('Message failed:', result.error);
} else {
  console.log('Message sent:', result.data?.messageId);
}

Dependencies

Required

  • @bernierllc/neverhub-adapter - NeverHub integration
  • @bernierllc/chatkit-adapter - ChatKit provider
  • @bernierllc/chat-ai-router - AI routing (optional feature)
  • @bernierllc/chat-analytics - Analytics (optional feature)
  • zod - Configuration validation

Optional (Peer Dependencies)

  • @bernierllc/chat-integration-slack - Slack integration
  • @bernierllc/chat-integration-discord - Discord integration
  • @bernierllc/chat-integration-teams - Teams integration

License

Copyright (c) 2025 Bernier LLC. All rights reserved.

See Also