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

@visma-swno/gaia-chat-ui

v5.0.1

Published

Web component library for the Gaia Assistant Chat UI

Readme

@visma-swno/gaia-chat-ui

Web component library for the GAiA Assistant Chat UI, built with Lit for Visma Software Nordic products.

Installation

npm install @visma-swno/gaia-chat-ui

lit is an external dependency and must be available in your bundle:

npm install lit@^3.3.0

Quick Start

import '@visma-swno/gaia-chat-ui';

Visitor Mode (Anonymous)

<gaia-chat
  profile-id="YOUR_PROFILE_ID"
  base-url="https://api.assistant.vsn.dev"
  auth-strategy="visitor"
></gaia-chat>

Visma Connect Mode (Authenticated)

Provide a tokenProvider that returns a valid OAuth access token. Implement caching and refresh: reuse a valid token until shortly before its exp claim, then silently refresh.

<gaia-chat
  id="assistant"
  profile-id="YOUR_PROFILE_ID"
  base-url="https://api.assistant.vsn.dev"
  auth-strategy="visma"
></gaia-chat>

<script type="module">
  const assistant = document.getElementById('assistant');

  assistant.tokenProvider = async () => {
    const res = await fetch('/api/auth/assistant-token');
    const { token } = await res.json();
    return token;
  };
</script>

Properties

| Property / Attribute | Type | Default | Description | | ----------------------- | ----------------------- | ------------------------------------------ | ------------------------------------------------------------ | | base-url | string | 'https://api.assistant.stag.vsn.dev' | Backend API base URL. | | profile-id | string | 'default' | Assistant profile identifier. | | auth-strategy | 'visitor' \| 'visma' | 'visitor' | Authentication strategy. | | closeable | boolean | true | Show a close button in the header. | | selected-model | string | '' | Override the default AI model. Must be in the profile's allowed overrides. | | tokenProvider | () => Promise<string> | — | Async function returning an OAuth access token (Visma mode). Set via JS. | | hostContextProvider | HostContextProvider | — | Async function returning application context per message. Set via JS. | | tools | FrontendTool[] | [] | Frontend tool definitions sent to the agent. Set via JS. |

Events

All events bubble and are composed (cross shadow DOM).

| Event | Detail Type | Description | | ---------------------- | ------------------------------------------------------------------------------------------------ | --------------------------------------- | | conversation-cleared | void | User cleared the conversation. | | message-sent | { message: string; channel: 'assistant' \| 'support' } | User sent a message. | | tool-call-approved | { messageId: string } | User approved a tool call. | | tool-call-declined | { messageId: string } | User declined a tool call. | | feedback-submitted | { rating: number; comment: string \| null } | User submitted feedback. | | close-requested | void | User clicked the close button. | | tool-call | { toolCallId: string; toolCallName: string; arguments: Record<string, unknown> \| string \| null; result: unknown } | A frontend tool call was executed. |

document.querySelector('gaia-chat').addEventListener('message-sent', (e) => {
  console.log('User sent:', e.detail.message);
});

Methods

| Method | Description | | -------------------- | ------------------------------------------------- | | clearConversation()| Clear the current conversation and reset the chat.| | stopSupport() | Stop any active support session. |

Host Context Provider

Provide dynamic application context with each message. The agent and its plugins can use this context for personalized responses.

const chat = document.querySelector('gaia-chat');

chat.hostContextProvider = async () => ({
  customerId: getCurrentCustomerId(),
  companyId: getCurrentCompanyId(),
  partnerId: getPartnerId(),
  data: {
    environment: 'production',
    userRole: getUserRole(),
  },
});

HostContext

interface HostContext {
  customerId?: string;
  companyId?: string;
  partnerId?: string;
  data?: Record<string, unknown>;
}

type HostContextProvider = () => HostContext | Promise<HostContext | null> | null;

Frontend Tools

Register custom tools that the agent can invoke. Tool results are returned to the agent and a tool-call event is dispatched to the host.

const chat = document.querySelector('gaia-chat');

chat.tools = [
  {
    name: 'getInvoice',
    description: 'Retrieve an invoice by ID',
    parameters: {
      type: 'object',
      properties: {
        invoiceId: { type: 'string', description: 'The invoice ID' },
      },
      required: ['invoiceId'],
    },
  },
];

chat.addEventListener('tool-call', (e) => {
  const { toolCallName, arguments: args } = e.detail;
  // Handle the tool call and return data to the agent
});

FrontendTool

interface FrontendTool {
  name: string;
  description: string;
  parameters: JSONSchema7; // JSON Schema draft-07, must be type: 'object'
}

Icon Registry

Register custom SVG icons for use in the component:

import { registerIcons } from '@visma-swno/gaia-chat-ui';

registerIcons({ 'my-icon': '<svg>...</svg>' });

Styling

The component exposes CSS custom properties prefixed with --gaia- for theming. Set these on the <gaia-chat> element or any ancestor.

Typography

| Property | Description | | -------------------------------- | ------------------ | | --gaia-font-family | Font family | | --gaia-font-size-xs3xl | Font sizes | | --gaia-line-height-xs3xl | Line heights | | --gaia-font-weight-regular | Regular weight | | --gaia-font-weight-medium | Medium weight | | --gaia-font-weight-semibold | Semibold weight | | --gaia-font-weight-bold | Bold weight |

Colors

| Property group | Examples | | ------------------------------- | ------------------------------------------------------------ | | --gaia-color-surface-* | page, primary, action, action-hover, error, success, information, warning, disabled, selected | | --gaia-color-text-* | headings, body, body-secondary, action, action-hover, disabled, error, success, link-visited | | --gaia-color-border-* | primary, secondary, tertiary, action, action-hover, focus, error, success | | --gaia-color-icon-* | primary, action, action-hover, disabled, error, success, on-action, on-primary | | --gaia-color-message-* | user, system, operator | | --gaia-color-neutral-* | 10 through 100 |

Example

gaia-chat {
  --gaia-font-family: 'Inter', sans-serif;
  --gaia-color-surface-page: #ffffff;
  --gaia-color-surface-action: #0066cc;
  --gaia-color-text-body: #1a1a1a;
  --gaia-color-message-user: #e6f0ff;
}

Localization

The component reads the lang attribute (on itself or <html>) and responds to changes at runtime. Supported locales are bundled with the component.

<gaia-chat lang="nb"></gaia-chat>

Exports

import { ChatApp, ToolCallEvent, registerIcons } from '@visma-swno/gaia-chat-ui';
import type { FrontendTool, HostContext, HostContextProvider } from '@visma-swno/gaia-chat-ui';

Documentation

For development instructions and architecture details, see the main repository.