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

@vettvangur/ai-sdk

v0.1.13

Published

Framework-agnostic AI chat client for server-rendered shells

Readme

@vettvangur/ai-sdk

Framework-agnostic, unstyled AI chat primitives for server-rendered shells.

It exports protocol-v1 contracts, parsing and SSE stream-reading primitives, a headless chat session, and a DOM binding for a server-rendered shell. It does not include styles or project-specific tools.

<section data-ai-chat data-ai-chat-endpoint="/webapi/aichat/stream"
  data-ai-chat-antiforgery-header="RequestVerificationToken" data-ai-chat-antiforgery-token="…">
  <div data-ai-chat-thread></div>
  <form data-ai-chat-form><textarea data-ai-chat-input></textarea><button data-ai-chat-send>Send</button></form>
  <button type="button" data-ai-chat-reset>Reset</button>
</section>
import { bindChat, createAiChatRegistry } from '@vettvangur/ai-sdk'

const registry = createAiChatRegistry()
registry.registerRenderer('weather', ({ document, data }) => {
  const card = document.createElement('article')
  card.textContent = String((data as { temperature?: unknown }).temperature ?? '')
  return card
})

const chat = bindChat(document.querySelector('[data-ai-chat]')!, { registry })
// Call chat.destroy() when its server-rendered shell is removed.

createChatSession() is available when a host owns its own rendering. It sends JSON POST requests to the configured same-origin endpoint and reads its SSE response. Supply the antiforgery header through bindChat options or the root attributes; blank header names or tokens are omitted.

tool_result payloads may select only registered tool renderers, an authored template[data-template], or an authored template[data-ai-surface]. Named actions come only from authored data-ai-action markup and receive an optional authored data-ai-action-value. Neither server payloads nor model output become executable markup. Generic answer cards, links and Markdown are rendered as safe DOM nodes. Host callbacks must return DOM nodes, not HTML strings.

The package accepts protocol-v1 events (delta, tool, tool_result, tool_done, done, and error). Host-specific card rendering, embedded-component activation and styling remain host responsibilities. Eimskip migration is deliberately outside this package.