🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@cxai/stream

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cxai/stream

## Overview `@cxai/stream` is a powerful TypeScript streaming library designed for advanced streaming capabilities, with a focus on AI-driven applications, state management, and real-time data processing.

latest
npmnpm
Version
1.0.20
Version published
Maintainers
1
Created
Source

@cxai/stream - Streaming Library

Overview

@cxai/stream is a powerful TypeScript streaming library designed for advanced streaming capabilities, with a focus on AI-driven applications, state management, and real-time data processing.

Features

  • AI Streaming Support
  • XState Integration
  • Server-Sent Events (SSE)
  • Async Iterator Utilities
  • Yjs Collaborative Editing Support
  • Observable Actors
  • UI Rendering Helpers

Installation

npm install @cxai/stream

Prerequisites

  • Node.js 22.8.0+
  • Optional Peer Dependencies:
    • yjs
    • openai

Core Modules

AI Streaming

Stream text and objects from AI models with advanced configuration options.

import { streamText } from '@cxai/stream/ai';

const result = await streamText({
  model: openaiGP4o(),
  prompt: "Generate a creative idea"
});

XState Integration

Create observable actors and manage complex state transitions.

import { fromAIEventStream } from '@cxai/stream/xstate';

const machine = createMachine({
  // Machine configuration with streaming support
});

Async Iterator Utilities

Advanced async iterator manipulation and cloning.

import { cloneable } from '@cxai/stream/iterator';

const clonableStream = cloneable(originalStream);

Server-Sent Events

Convert async iterators to SSE-compatible streams.

import { sseReadableStream } from '@cxai/stream/iterator/sse';

const sseStream = sseReadableStream(asyncIterator);

Development

# Install dependencies
pnpm install

# Build the library
pnpm run build

# Run tests
pnpm test

Technologies

  • TypeScript
  • XState
  • Yjs
  • OpenAI
  • Atomico
  • Server-Sent Events

Contributing

  • Fork the repository
  • Create a feature branch
  • Commit your changes
  • Push to the branch
  • Create a Pull Request

License

ISC License

Peer Dependencies

  • yjs: Collaborative editing support (optional)
  • openai: AI model streaming (optional)

FAQs

Package last updated on 10 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts