Skip to content

toServerSentEventsResponse function missing from @tanstack/ai latest package #187

Closed

Description

@cfngc4594

TanStack AI version

v0.2.0

Framework/Library version

React v19.2.3

Describe the bug and the steps to reproduce it

The toServerSentEventsResponse function is documented in the latest documentation and exists in the main branch, but it's not available in the published npm package @tanstack/[email protected].

Steps to reproduce:

  1. Install @tanstack/[email protected]
  2. Try to import: import { toServerSentEventsResponse } from "@tanstack/ai"
  3. Get error: toServerSentEventsResponse is not exported from @tanstack/ai

The documentation (updated 2 days ago) shows this function as the recommended way to convert streams to SSE responses, but the npm package (released 4 days ago) doesn't include it.

The function exists in the main branch at packages/typescript/ai/src/stream-to-response.ts but wasn't included in the v0.2.0 release.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/2mmljw?file=%2Fapp%2Fapi%2Fchat%2Froute.ts%3A1%2C16-1%2C42

Screenshots or Videos (Optional)

Image

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

  1. jjrise commented on Jan 1, 2026

    @jjrise

    looks like the pattern now is to use toServerSentEventsStream?
    import { toServerSentEventsStream } from "@tanstack/ai"

      return new Response(toServerSentEventsStream(stream), {
        headers: { "Content-Type": "text/event-stream" },
      });
  2. cameo-js commented on Jan 2, 2026

    @cameo-js

    It seems the toServerSentEventsResponse related code doesn't seem to have been released yet.

    The PR related to toServerSentEventsResponse was merged a week ago, but the latest version is 0.2.0, which was released two weeks ago.

    It appears there's a discrepancy because the example documentation was updated when the PR was merged.

    Based on the previous version of example, you can use toStreamResponse(deprecated) for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions