Skip to content

ts: Use Stream abstraction instead of raw byte streams#93

Merged
agu-z merged 4 commits intomainfrom
abstract-stream
Sep 15, 2025
Merged

ts: Use Stream abstraction instead of raw byte streams#93
agu-z merged 4 commits intomainfrom
abstract-stream

Conversation

@agu-z
Copy link
Copy Markdown
Contributor

@agu-z agu-z commented Sep 15, 2025

The current connection API expects ND-JSON streams, but this approach doesn't work well for all transports. While stdio requires newline-delimited JSON for message framing, other transports like WebSockets or HTTP handle their own message boundaries and shouldn't be forced to use ND-JSON encoding.

To address this, this PR refactors the connection classes to accept a new Stream type that works with _Stream<AnyMessage> instead of raw _Stream<Uint8Array>. For stdio-based connections, we provide an ndJsonStream function that handles the conversion, preserving the existing ND-JSON behavior where it's actually needed.

@cla-bot cla-bot Bot added the cla-signed label Sep 15, 2025
@agu-z agu-z merged commit f0b2e16 into main Sep 15, 2025
4 checks passed
@agu-z agu-z deleted the abstract-stream branch September 15, 2025 23:39
nerzhulart pushed a commit to nerzhulart/agent-client-protocol that referenced this pull request Oct 21, 2025
…otocol#93)

* ts: Use Stream abstraction instead of raw byte streams

* Fix format

* Fix typos

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant