Skip to content

About

Chat with LLMs and agents in Hoist React apps: models, streaming transports, desktop components and generative UI.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

178 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 Hoist Chat Kit

Chat components for Hoist React applications.


Hoist Chat Kit is a companion library to Hoist React (@xh/hoist), published to npm as @xh/hoist-chat-kit. It gives a Hoist app a complete chat with an LLM or an agent. It holds the models, the transports that stream replies from a backend, and the desktop components. Its code follows Hoist's own conventions, so it reads and behaves like the rest of a Hoist app.

Features

  • Real token streaming - replies render as they arrive, and a stop closes the connection, so the server stops generating.
  • A client-side tool loop - the model calls tools that run in the browser and act on the app. It can filter a grid, change a dashboard, or open a view.
  • Human in the loop - tool calls can wait for the user to approve them, with a question that suits each call, or for the user to answer them.
  • Generative UI - the model shows the app's own Hoist components inline in its reply: grids, charts, KPI tiles and cards, or components the app writes. A catalog the app controls limits the model to known components with checked props, and adapters draw A2UI or OpenUI payloads with the same components.
  • Rich message parts - markdown text, reasoning, tool call cards, files, sources with inline citations, and app-defined data parts.
  • Conversation actions - stop, retry, regenerate, edit a past message, and persist history.
  • Protocol-neutral - AG-UI events are the wire vocabulary. Codecs translate AG-UI and the Anthropic Messages API, and you can add your own.
  • Built for hoist-core - the default transport streams NDJSON from your own server, with Hoist's auth, tracing and error handling.

Quick Start: Add a Chat to an App

Create a ChatModel with a transport and a tool, then render it with chatPanel.

import {ChatModel} from '@xh/hoist-chat-kit/core';
import {chatPanel} from '@xh/hoist-chat-kit/desktop/cmp/chat';
import {AnthropicCodec, HoistChatTransport} from '@xh/hoist-chat-kit/transport';
import {hoistCmp, HoistModel, managed, uses, XH} from '@xh/hoist/core';
import {Icon} from '@xh/hoist/icon';

export class AssistantModel extends HoistModel {
    @managed readonly chatModel = new ChatModel({
        transport: new HoistChatTransport({
            url: 'chat/stream',
            codec: new AnthropicCodec({system: 'You are a helpful assistant in a Hoist app.'})
        }),
        tools: [
            {
                name: 'set_theme',
                description: 'Switch the app between its light and dark themes.',
                parameters: {
                    type: 'object',
                    properties: {dark: {type: 'boolean', description: 'True for the dark theme.'}},
                    required: ['dark']
                },
                displayName: 'Change theme',
                icon: Icon.sun(),
                execute: ({dark}) => {
                    XH.setTheme(dark ? 'dark' : 'light');
                    return `The app now uses the ${dark ? 'dark' : 'light'} theme.`;
                }
            }
        ]
    });
}

export const assistantPanel = hoistCmp.factory({
    model: uses(AssistantModel),
    render({model}) {
        return chatPanel({model: model.chatModel, title: 'Assistant', icon: Icon.ai(), flex: 1});
    }
});

The chat/stream endpoint is a hoist-core controller that relays the Anthropic Messages API as NDJSON. See the Hoist Server Example for a complete controller and service.

Installation

The kit needs @xh/hoist v91 or later, with react and react-dom v19. Your app supplies these as peer dependencies.

The package ships as TypeScript and SCSS source, as @xh/hoist does, and your app compiles it with the rest of its code. It depends on the official AG-UI packages, @ag-ui/core and @ag-ui/client. They bring RxJS with them, and take Zod 4 as a peer, which the kit and @xh/hoist both supply.

Add the package with pnpm add @xh/hoist-chat-kit. The app's build compiles it with no further config, as configureRsbuild() compiles TypeScript wherever it finds it, node_modules included.

Documentation

Start with the Documentation Index. Its Quick Reference table maps common tasks to the right doc.

Doc Covers
Architecture Layers, the flow of one turn, render performance, extension points
/core/ ChatModel, messages and parts, tools, approvals, persistence, errors
/transport/ Transports, codecs, ChatEvent, server contracts, the Grails example
/genui/ The generative UI catalog, component specs and protocol adapters
/desktop/cmp/chat/ Desktop components and theming
/desktop/cmp/genui/ The built-in grid, chart, KPI tile and card components
/cmp/markdown/ The streaming markdown renderer
Protocols AG-UI, Anthropic, OpenAI, A2UI, OpenUI, MCP Apps, the Vercel AI SDK

Development

This repo uses pnpm, pinned via the packageManager field in package.json. Install any recent pnpm (see pnpm.io/installation), and it switches to the pinned version automatically.

pnpm install     # needs a Font Awesome Pro registry token in ~/.npmrc
pnpm lint        # eslint, stylelint, prettier --check
pnpm typecheck   # tsc, against the installed @xh/hoist
pnpm test        # unit tests (Vitest), on the @xh/hoist test kit
pnpm build       # pack the package and check what it ships

AGENTS.md, at the root of the repository, holds the full development guide: architecture, conventions, testing, and the Git and release workflow. It serves human and AI developers alike.


info@xh.io | https://xh.io

Copyright © 2026 Extremely Heavy Industries Inc.

About

Chat with LLMs and agents in Hoist React apps: models, streaming transports, desktop components and generative UI.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages