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

@octanejs/tanstack-ai

v0.0.46

Published

TanStack AI bindings for Octane — reuses @tanstack/ai and @tanstack/ai-client and ports the React adapter's hooks (chat, realtime, generation, transcription, media).

Downloads

3,470

Readme

@octanejs/tanstack-ai

TanStack AI bindings for the Octane UI framework.

This package ports @tanstack/[email protected] onto Octane while reusing @tanstack/ai and @tanstack/ai-client unchanged. The runtime export surface matches the React adapter, so migration starts by changing the package import:

// before
import { useChat } from '@tanstack/ai-react'

// after
import { useChat } from '@octanejs/tanstack-ai'

The renderer-bearing hook modules are authored as .tsrx and compiled by Octane. Matching .tsrx.d.ts companions are checked declaration emits of those implementations, preserving the complete generic surface for TypeScript consumers.

Install

npm install @octanejs/tanstack-ai @tanstack/ai @tanstack/ai-client octane
pnpm add @octanejs/tanstack-ai @tanstack/ai @tanstack/ai-client octane

Usage

import { useState } from 'octane'
import { useChat } from '@octanejs/tanstack-ai'

export function Chat() @{
  const [input, setInput] = useState('')
  const chat = useChat({
    fetcher: myFetcher,
  })

  <div>
    @for (const message of chat.messages; key message.id) {
      <p>
        {(message.role +
          ': ' +
          message.parts
            .map((part) => (part.type === 'text' ? part.content : ''))
            .join('')) as string}
      </p>
    }
    <input
      value={input}
      onInput={(event) => setInput(event.currentTarget.value)}
    />
    <button
      onClick={() => {
        void chat.sendMessage(input)
        setInput('')
      }}
    >
      Send
    </button>
  </div>
}

useChat has no input state of its own — hold the text box value in a local useState and pass it to sendMessage. Note the onInput handler: Octane drives text controls per keystroke through the native input event, not a synthetic onChange.

API

The adapter includes useChat, useRealtimeChat, useMcpAppBridge, useGeneration, useGenerateImage, useGenerateAudio, useGenerateSpeech, useGenerateVideo, useTranscription, useSummarize, and useAudioRecorder. It also re-exports all 30 @tanstack/ai-client convenience helpers and types (fetchServerSentEvents, fetchHttpStream, xhrServerSentEvents, xhrHttpStream, stream, rpcStream, createChatClientOptions, createMcpAppBridge, and their associated types) unchanged, mirroring the upstream @tanstack/ai-react index.

Server rendering through octane/server is supported. useChat renders its initial message snapshot without browser-only setup.

Divergences from @tanstack/ai-react

  • The ./mcp-apps subpath and its MCPAppResource component are not ported: they render AppRenderer from the React-only @mcp-ui/client, which has no Octane equivalent. The framework-agnostic useMcpAppBridge hook is ported and available on the main entry.
  • Octane uses native events: text/file/recorder inputs drive updates via onInput; there is no synthetic onChange layer.
  • Octane has no StrictMode double-invoke and always provides useId, so no random-id fallback is needed.
  • Realtime reconnects and token refreshes use the latest getToken and adapter supplied to the hook; upstream captures the first render's callbacks.
  • The declared realtime onStatusChange callback is invoked alongside the hook's state update; upstream 0.17.0 currently drops the external callback.
  • One upstream useChat test case ("auto-resume on mount / when the browser comes back online") is omitted: it targets ChatClient.prototype.maybeAutoResume, an API absent from the pinned (and latest published) @tanstack/[email protected] and never invoked by useChat. It is untestable in this binding until that dependency ships the method.

Verification

The port runs TanStack AI's React adapter tests against Octane across all eleven hooks, with no skipped, todo, or expected-failure cases (except the untestable auto-resume case above). A differential test compiles a shared chat fixture for Octane and React and compares streamed output after each step; output is byte-equal against real @tanstack/[email protected]. An SSR fixture and the upstream compile-time type tests are also included.

Current scope and verification status are tracked in the generated bindings status table, sourced from this package's status.json.

License

MIT — contains source derived from TanStack AI (MIT), adapted for Octane.