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

@gistui/chat

v0.2.1

Published

GistUI chat: a headless chat store, model adapters, thread storage and React chat layouts.

Readme

A headless chat for GistUI answers: a message store, model adapters (OpenAI, Anthropic, Vercel AI SDK, AG-UI, plain text) and thread storage, with no framework. React layouts (full page, sidebar, bottom tray) are in @gistui/chat/react.

npm install @gistui/chat @gistui/react @gistui/styles
import { aiSdk, createChat, localThread } from "@gistui/chat";
import { Chat } from "@gistui/chat/react";
import "@gistui/chat/chat.css";
import "@gistui/styles/styles.css";
import { ui } from "@gistui/react/ui";

// Your endpoint adds GistUI's system prompt: prompt({ mode: "inline" }) from @gistui/catalog.
const store = createChat({ adapter: aiSdk({ url: "/api/chat" }), storage: localThread("support") });

<Chat store={store} library={ui} layout="sidebar" title="Assistant" suggestions={["Show last month's sales"]} />;
  • createChat({ adapter, system?, initialMessages?, storage?, onError? }): send(text), regenerate(), stop(), clear(), and a subscribable snapshot of the messages.
  • Adapters: openai({ model, url?, apiKey? }), anthropic({ model, apiKey? }), aiSdk({ url }), agui({ url }), textStream({ url }). Call models from your server; browser keys are for demos.
  • <Chat> takes the same tools, mutations, onToolCall, theme, color, tokens, darkTokens and lockUntil as <GistUI>. tools are read-only and may run when an answer renders; mutations run only when the person presses a button.
  • In the UI, a button's label and a form's submit go back to the model as the next message. Such a message has origin: "ui": the thread labels it "Sent from the UI", and the model receives it wrapped (wrapUiMessage), so text chosen by a generated program is never mistaken for typed text. Send one yourself with store.send(text, { origin: "ui" }).
  • One reply is one UI: all its ```gistui blocks form one program (splitReply, replyProgram), shown where the first block is. Other code blocks stay chat text.
  • Only the latest answer keeps refreshing its data on a timer; earlier answers still load and still respond to the person.
  • The thread is saved after each sent message, about once a second while a reply streams, and at the end. A saved error keeps its HTTP status but not the provider's text.
  • requestHistory(messages) is what the model receives: failed, empty and still-streaming replies are left out.

All packages

GistUI is one project in several packages, released together under one version.

| Package | What it is | |---|---| | @gistui/react | React renderer and default components | | @gistui/vue | Vue 3.5+ and Nuxt | | @gistui/svelte | Svelte 5 and SvelteKit | | @gistui/solid | Solid and SolidStart | | @gistui/vanilla | Vanilla JavaScript renderer, no framework | | @gistui/catalog | Component schemas, the system prompt and the agent skill | | @gistui/styles | One stylesheet for every framework | | @gistui/server | Stream reading, validation and repair on the server | | @gistui/chat | Headless chat store, model adapters, React chat layouts | | @gistui/core | The language: streaming parser, validator, autofix, prompt generator | | @gistui/headless | Shared internals: engine, themes, forms | | @gistui/widgets | Shared internals: charts, Markdown |

Licence

MIT