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

@entropy-softworks/chat-client

v2026.8.14

Published

Transport for Entropy Softworks chat: conversations, messages, and the server-sent-event stream, over cookie or bearer authentication

Readme

@entropy-softworks/chat-client

The transport for Entropy Softworks chat: conversations, messages, and the server-sent-event stream, over either authentication scheme wheatley accepts.

It exists because there were about to be two copies. wheatley's own clients had this code in clients/shared/src/chat/; konsole's assistant dock became the second consumer when konsole deleted its own inference proxy and started calling wheatley directly. The estate rule is that a second consumer moves the code rather than copying it.

Installation

npm install @entropy-softworks/chat-client

Usage

Same origin — wheatley's own clients, cookie session plus the CSRF echo:

import { createChatClient } from "@entropy-softworks/chat-client";

const chat = createChatClient({
  baseUrl: "/api",
  auth: { mode: "cookie", csrfToken: () => readCsrfCookie() },
});

const conversations = await chat.listConversations();
await chat.sendMessage(conversations[0].id, "What broke last night?", {
  onDelta: (text) => append(text),
  onDone: ({ finish_reason }) => finish(finish_reason),
  onError: (code, message) => show(message),
});

Another origin — konsole's dock, bearer token from the handoff flow:

import {
  createChatClient,
  readHandoffCode,
  redeemHandoff,
  signInUrl,
} from "@entropy-softworks/chat-client";

// 1. No token yet: send the browser through wheatley's own sign-in.
window.location.assign(signInUrl(wheatleyBaseUrl, window.location.origin));

// 2. Back on our page, the code is in the fragment. Redeem it once, then clean the URL.
const handoff = readHandoffCode(window.location.hash);
if (handoff) {
  const session = await redeemHandoff(wheatleyBaseUrl, handoff.code);
  store(session.session_token);
  history.replaceState(null, "", window.location.pathname + window.location.search + handoff.rest);
}

const chat = createChatClient({
  baseUrl: wheatleyBaseUrl,
  auth: { mode: "bearer", token: () => stored() },
});

Why the auth scheme is a parameter

The two are not preferences, they are consequences of where the page is served from. A same-origin client gets an HttpOnly cookie — unreadable by script, and therefore requiring a CSRF echo on writes, because the browser attaches it to any request to the origin including one a third-party page caused. A cross-origin client cannot use that cookie at all (SameSite=Lax), so it holds a bearer token, and needs no CSRF echo because a cross-site page cannot read its storage to set the header.

What it is not

No React, no components, no state management. Rendering belongs to @entropy-softworks/chat-ui, which is a separate package for a separate phase — this one is the wire and stays usable from a script, a worker, or a test.

License

MIT.