JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q67610F
  • License Apache-2.0

Streaming primitives for Kortyx.

Package Exports

  • @kortyx/stream
  • @kortyx/stream/browser

Readme

@kortyx/stream

npm version CI License TypeScript

Streaming primitives, SSE helpers, readers, collectors, and structured-data reducers for Kortyx.

Most application code should import server/runtime stream helpers from kortyx and browser-safe stream helpers from kortyx/browser. Use @kortyx/stream directly when you need the lower-level protocol package.

Install

pnpm add @kortyx/stream
npm install @kortyx/stream

Key APIs

  • StreamChunk
  • createStreamResponse(...)
  • toSSE(...)
  • readStream(...)
  • consumeStream(...)
  • collectStream(...)
  • collectBufferedStream(...)
  • createStructuredStreamAccumulator(...)
  • applyStructuredChunk(...)

Example

import { collectBufferedStream } from "@kortyx/stream";

const result = await collectBufferedStream(agent.streamChat(messages));

console.log(result.text);
console.log(result.structured);

Documentation

License

Apache-2.0. See LICENSE.