pub struct CliAgentChannel { /* private fields */ }Expand description
AgentChannel adapter that spawns one CLI subprocess per agent turn.
Stdout lines are classified by
agent::parse_stream_output_line and transient loader updates are
forwarded as TurnEvent::ThoughtDelta. A kill signal transitions the
turn to a failed state with a [Stopped] banner. A spawn failure is
surfaced through AgentError.
Implementations§
Source§impl CliAgentChannel
impl CliAgentChannel
Sourcepub fn with_backend(backend: Arc<dyn AgentBackend>, kind: AgentKind) -> Self
pub fn with_backend(backend: Arc<dyn AgentBackend>, kind: AgentKind) -> Self
Creates a CLI channel backed by the given pre-built backend.
Channel factories use this helper so transport selection can be done
once before constructing the concrete channel. Tests also use it to
inject a [MockAgentBackend] that controls command construction and
process spawning without relying on a real provider binary.
Trait Implementations§
Source§impl AgentChannel for CliAgentChannel
impl AgentChannel for CliAgentChannel
Source§fn start_session(
&self,
req: StartSessionRequest,
) -> AgentFuture<Result<SessionRef, AgentError>>
fn start_session( &self, req: StartSessionRequest, ) -> AgentFuture<Result<SessionRef, AgentError>>
Returns a SessionRef immediately; CLI turns are stateless.
Source§fn run_turn(
&self,
_session_id: String,
req: TurnRequest,
events: UnboundedSender<TurnEvent>,
) -> AgentFuture<Result<TurnResult, AgentError>>
fn run_turn( &self, _session_id: String, req: TurnRequest, events: UnboundedSender<TurnEvent>, ) -> AgentFuture<Result<TurnResult, AgentError>>
Spawns a CLI process for the turn and streams its output as events.
Stdout lines are parsed with the provider-specific stream parser and
loader-oriented interim text is forwarded as
TurnEvent::ThoughtDelta. After the process exits, usage
statistics are extracted from the raw stdout/stderr and the final
parsed response is returned in TurnResult.
§Errors
Returns AgentError when command construction fails, the process
cannot be spawned, or the process is killed by a signal.
Source§fn shutdown_session(
&self,
_session_id: String,
) -> AgentFuture<Result<(), AgentError>>
fn shutdown_session( &self, _session_id: String, ) -> AgentFuture<Result<(), AgentError>>
No-op; CLI sessions are stateless and require no teardown.