Skip to content
AbhinRustagiPublic

About

A lightweight, protocol-agnostic converter for AI event streams in any runtime.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation

Eventport

Core minified size Core gzip size npm unpacked size

Lightweight, typed conversion between AI protocols. Works on the server and in the browser, with zero runtime dependencies.

pnpm add eventport
import { eventport } from "eventport";
import { responses } from "eventport/openai";
import { agUI } from "eventport/agui";

const converter = eventport
  .from(responses())
  .to(agUI({ threadId, runId }));

return converter.convert(upstream).toResponse();

Use the same API for live streams and stored event arrays. Return an SSE response with .toResponse(), collect events with .collect(), or iterate with for await.

Adapters

Adapters translate through AG-UI internally. Provider details use namespaced CUSTOM events and metadata; unsupported mappings follow .onUnsupported().

Import Adapters
eventport/openai chatCompletions(), responses()
eventport/anthropic anthropic()
eventport/agui agUI({ threadId, runId })
eventport/vercel aiSDK()
eventport/langgraph langGraph() — source only

aiSDK() uses the UI message stream. See adapter coverage for supported events and limits.

Customize

Modify native events with typed middleware:

const converter = eventport
  .from(responses())
  .middleware({
    "response.output_text.delta": event => ({
      ...event,
      delta: event.delta.toUpperCase(),
    }),
  })
  .to(agUI({ threadId, runId }));

Replace a conversion with an override:

const custom = converter.overrides({
  "response.output_text.delta": event => ({
    type: "CUSTOM",
    name: "text.fragment",
    value: { text: event.delta },
  }),
});

Return eventport.DEFAULT to keep the default mapping, or null to suppress its output. Keep destination start/end events consistent.

Documentation · API reference · Assistant-ui example

Development

Requires Node.js 22+ and pnpm 10.34.3.

pnpm install
pnpm check
pnpm test
pnpm build

See release instructions for npm publishing.

MIT © 2026 AbhinRustagi.

About

A lightweight, protocol-agnostic converter for AI event streams in any runtime.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages