Skip to main content

Module transport

Module transport 

Source
Expand description

Transport layer abstraction for CLI communication.

This module defines the Transport trait, which abstracts the communication channel between the SDK and the Claude Code CLI process. The default implementation is SubprocessCliTransport, which spawns the CLI as a child process and communicates via stdin/stdout.

Custom transports can be implemented for testing or alternative communication mechanisms by implementing the Transport trait.

§Split I/O

For concurrent read/write scenarios, the transport can be split into independent reader and writer halves via Transport::into_split(). Implementations can use split_with_adapter() for a simple lock-based fallback via SplitAdapter.

Modules§

subprocess_cli
Subprocess-based transport for the Claude Code CLI.

Structs§

SplitAdapter
Lock-based split adapter for backward-compatible transport splitting.
SplitAdapterReader
Reader half of a SplitAdapter.
SplitAdapterWriter
Writer half of a SplitAdapter.

Traits§

Transport
Async transport trait for bidirectional communication with the Claude Code CLI.
TransportCloseHandle
Handle for closing a transport after it has been split.
TransportFactory
Factory for creating fresh Transport instances.
TransportReader
Async reader half of a split transport.
TransportWriter
Async writer half of a split transport.

Functions§

split_with_adapter
Splits a transport using a lock-based adapter.

Type Aliases§

TransportSplitResult
The result of splitting a transport into independent reader, writer, and close handle.