Are you an LLM? You can read better optimized documentation at /adr/005-transport-abi.md for this page in Markdown format
ADR 005: Transport ABI Package
- Date: 2025-11-23
- Status: Accepted
- Applies to: Architecture
- Tags: architecture, transport
Context
The project architecture requires a @sideband/transport package as the ABI layer between protocol and concrete implementations. The initial architecture inadvertently mixed transport concerns into @sideband/protocol via a low-level callback-based RawTransport interface.
Decision
Created @sideband/transport as a dedicated, transport-agnostic ABI layer:
Core interfaces:
Transport: Entry point forconnect()(client) and optionallisten()(server)TransportConnection: Bidirectional channel withsend(),close(), andinbound: AsyncIterable<Uint8Array>TransportEndpoint: Branded string for connection targets (format is transport-specific)
Dependency rule:
@sideband/transportdepends only on@sideband/protocol(importsConnectionId)- All concrete transports (
transport-browser,transport-node) depend on@sideband/transport @sideband/runtimedepends on@sideband/transport, not on concrete implementations
Key constraint: No I/O, codec, or environment-specific logic. Transport is purely an interface contract.
Rationale
- Layered isolation: Concrete transports depend on the ABI, not vice versa; enables swappable implementations
- Testability: MemoryTransport reference implementation serves as both documentation and test harness
- Async iterables: Inbound stream via
AsyncIterable<Uint8Array>enables backpressure, composition, and natural error handling - Stateless types:
TransportEndpointandConnectionIdare transport-agnostic, avoiding implicit coupling