Skip to content

@agent-os/attached-stream

Runtime-neutral frame algebra and JSON text codecs for attached live streams: a session can receive input frames, emit output/progress frames, and eventually emit one terminal frame.

Attached stream frames are transport/progress data, not ledger facts. The package does not open sockets, allocate streamRef, write ledger events, own tenant auth, or promise reconnect/resume. Terminal settlement belongs to the runtime handler that consumes the terminal frame.

Inbound and outbound frames use independent sequence spaces. Only explicit cancel input is cancel intent; transport detach is not cancel.

Use the package for codec and projection at the UI or backend wire boundary.

import {
decodeAttachedStreamMessage,
encodeAttachedStreamMessage,
projectAttachedStream,
} from "@agent-os/attached-stream";

For v1, clients reconnect by attaching a new stream. Old stream state is not resumed.

Terminal window
cd packages/composers/attached-stream
bun run test