pub struct CliRunnerBase { /* private fields */ }Expand description
Shared base struct for all CLI runners.
Holds the common fields (config, model info, session tracking) that every CLI runner needs. Individual runners wrap this and add only their command-building and response-parsing logic.
Implementations§
Source§impl CliRunnerBase
impl CliRunnerBase
Sourcepub fn new(
config: RunnerConfig,
default_model: &str,
fallback_models: &[&str],
) -> Self
pub fn new( config: RunnerConfig, default_model: &str, fallback_models: &[&str], ) -> Self
Create a new base with the given config, default model, and fallback model list.
Sourcepub fn default_model(&self) -> &str
pub fn default_model(&self) -> &str
Get the default model identifier
Sourcepub fn available_models(&self) -> &[String]
pub fn available_models(&self) -> &[String]
Get the list of available models
Sourcepub async fn set_session(&self, key: &str, session_id: &str)
pub async fn set_session(&self, key: &str, session_id: &str)
Store a session ID for later resumption
Sourcepub async fn get_session(&self, key: &str) -> Option<String>
pub async fn get_session(&self, key: &str) -> Option<String>
Get a stored session ID
Sourcepub async fn health_check(&self, runner_name: &str) -> Result<bool, RunnerError>
pub async fn health_check(&self, runner_name: &str) -> Result<bool, RunnerError>
Run a --version health check against the runner binary.
Returns true if the binary exits 0, false otherwise.
§Errors
Returns RunnerError if the subprocess cannot be spawned.
Sourcepub fn check_exit_code(
&self,
output: &CliOutput,
runner_name: &str,
) -> Result<(), RunnerError>
pub fn check_exit_code( &self, output: &CliOutput, runner_name: &str, ) -> Result<(), RunnerError>
Check CLI exit code and return an error if non-zero.
Logs output byte lengths (not content) and constructs an error
message that surfaces the most diagnostic stream available.
Stderr is preferred (where well-behaved Unix programs report
errors), but some CLIs — notably claude-code exit-1 paths —
write the error to stdout instead, so a non-empty stdout is used
as a fallback rather than rendering the misleading (no output)
the earlier implementation produced. Up to 500 chars are
surfaced so multi-line diagnostics aren’t truncated to one line.
§Errors
Returns RunnerError::external_service when output.exit_code != 0.
Auto Trait Implementations§
impl !RefUnwindSafe for CliRunnerBase
impl !UnwindSafe for CliRunnerBase
impl Freeze for CliRunnerBase
impl Send for CliRunnerBase
impl Sync for CliRunnerBase
impl Unpin for CliRunnerBase
impl UnsafeUnpin for CliRunnerBase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more