HostedCliServerAiTransport class final

Reaches Anthropic through the CLI server of a running VS Code.

Implemented types

Constructors

HostedCliServerAiTransport({String host = '127.0.0.1', String? workspaceName, int minPort = defaultVSCodeBridgePort, int maxPort = maxVSCodeBridgePort, CliServerAiChannel channelFactory(String host, int port)?, Future<HostedServerResolution> resolve(String host, int minPort, int maxPort, String? workspaceName)?})

Properties

capabilities → LlmCapabilities
Both transports reach the same models through the same Agent SDK, so this is a constant rather than a handshake (see AgentSdkServerTransport).
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
host → String
The loopback host the CLI server is expected on.
final
id → String
A stable, human-readable identifier used in diagnostics and in the settings UI ("AI: connected via …"). Not a display string.
no setteroverride
isConnected → bool
Whether a live connection is currently held.
no setteroverride
maxPort → int
final
minPort → int
The inclusive port range the CLI server binds within.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectionNotice → String?
Something the user should be told once about a transport that is working, or null when there is nothing to say.
no setteroverride
sessionCopy → AgentSdkServerTransport Function()?
the same CLI server, on the port this transport resolved — the server takes any number of clients, so a session's connection is its own socket to it.
no setteroverride
unavailableReason → String?
Why the last probe answered false — the same remedy text connect raises, so a user sees it in the ordinary "the server is off" case and not only in the race where it disappears between the scan and the handshake.
no setteroverride
workspaceName → String?
The workspace whose VS Code window to use, or null to take the lowest-numbered responding server.
final

Methods

close() → Future<void>
Releases the connection and everything the transport owns — for the standalone path, that includes terminating the child process it started.
override
complete(AgentSdkCompletionRequest request) → Stream<AgentSdkCompletionEvent>
Returns the channel's stream directly, rather than re-yielding it from a generator: a wrapping async* would swallow cancellation exactly when the completion is still in flight, which is the only time cancelling is worth anything. No stall bound is applied here; the provider applies the one bound every transport gets (boundedAiRun).
override
connect() → Future<void>
Establishes the connection. Throws LlmTransportException with LlmErrorKind.unreachable when no server can be reached.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
probe() → Future<bool>
Tests reachability without side effects and without throwing.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited