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

ttc-chat-widget

v1.0.31

Published

Embeddable chat widget for TentaclesAI

Readme

TTC Chat Widget

Embeddable chat widget for TentaclesAI applications.

Installation

npm install ttc-chat-widget
# or
yarn add ttc-chat-widget
# or
pnpm add ttc-chat-widget

Quick Start

ES Modules (Recommended)

import { createChatWidget } from 'ttc-chat-widget'
// Import styles for full widget styling (optional - core positioning works without it)
import 'ttc-chat-widget/style.css'

const widget = createChatWidget({
  appId: 'your-app-id'
})

Note: The widget injects critical positioning styles automatically. Importing the CSS file adds visual polish (colors, shadows, animations) but is not required for basic functionality.

Script Tag (CDN)

<!-- Include the CSS (optional but recommended for full styling) -->
<link rel="stylesheet" href="https://unpkg.com/ttc-chat-widget/dist/ttc-chat-widget.css">

<!-- Include Vue 3 (required peer dependency) -->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>

<!-- Include the widget -->
<script src="https://unpkg.com/ttc-chat-widget/dist/ttc-chat-widget.iife.js"></script>

<script>
  const widget = TTCChatWidget.createChatWidget({
    appId: 'your-app-id'
  })
</script>

Configuration Options

interface ChatWidgetOptions {
  // Required: Your TentaclesAI App ID
  appId: string
  
  // Optional: Container element or selector (defaults to document.body)
  container?: string | HTMLElement
  
  // Optional: Start with panel open (default: false)
  open?: boolean
  
  // Optional: Theme mode (default: 'light')
  theme?: 'light' | 'dark' | 'auto'
  
  // Optional: Custom positioning
  position?: {
    bottom?: number
    right?: number
    left?: number
    top?: number
  }
  
  // Optional: Z-index (default: 9999)
  zIndex?: number
  
  // Optional: TTC modules (classes with @ttc.describe decorated methods)
  modules?: any[]
  
  // Optional: Callbacks
  onAuthenticated?: (token: string) => void
  onLogout?: () => void
  onMessageSent?: (message: string) => void
  onMessageReceived?: (message: string) => void
}

API Methods

The createChatWidget function returns a widget instance with the following methods:

const widget = createChatWidget({ appId: 'your-app-id' })

// Open the chat panel
widget.open()

// Close the chat panel
widget.close()

// Toggle the chat panel
widget.toggle()

// Check if user is authenticated
const isLoggedIn = widget.isAuthenticated()

// Programmatically logout
widget.logout()

// Destroy the widget and clean up
widget.destroy()

// Get the Vue app instance (advanced)
const app = widget.getApp()

Examples

Custom Position

const widget = createChatWidget({
  appId: 'your-app-id',
  position: {
    bottom: 100,
    left: 24  // Position on left side instead of right
  }
})

Dark Mode

const widget = createChatWidget({
  appId: 'your-app-id',
  theme: 'dark'  // or 'auto' to follow system preference
})

With Callbacks

const widget = createChatWidget({
  appId: 'your-app-id',
  onAuthenticated: (token) => {
    console.log('User authenticated!')
    // Save token, update UI, etc.
  },
  onLogout: () => {
    console.log('User logged out')
  }
})

Mount in Specific Container

const widget = createChatWidget({
  appId: 'your-app-id',
  container: '#my-chat-container'
})

With Custom Modules

Create a module class with functions the AI can call:

import { createChatWidget, ttc } from 'ttc-chat-widget'
import { z } from 'zod'

class MyModule {
  @ttc.describe({
    doc: "Get the current weather for a city",
    inputSchema: z.object({
      city: z.string()
    }),
    outputSchema: z.object({
      temperature: z.number(),
      condition: z.string()
    })
  })
  async getWeather(city) {
    // Your implementation
    return { temperature: 72, condition: 'sunny' }
  }
}

const widget = createChatWidget({
  appId: 'your-app-id',
  modules: [MyModule]
})

Authentication Flow

  1. User clicks the floating button
  2. If not authenticated, a "Connect Account" screen appears
  3. User clicks "Connect Account" → redirected to TentaclesAI OAuth
  4. After authorization, user is redirected back with auth token
  5. Widget automatically opens and user can start chatting

License

MIT