pub struct CliSpec {Show 16 fields
pub command: String,
pub command_env: Option<String>,
pub args: Vec<String>,
pub prompt_delivery: PromptDelivery,
pub prompt_flag: String,
pub model_flag: String,
pub default_model: String,
pub output_format_flag: String,
pub output_format_value: String,
pub system_prompt_flag: String,
pub output_mode: OutputMode,
pub result_json_paths: JsonPaths,
pub ndjson_match: LineMatchers,
pub extra_args: Vec<String>,
pub timeout: Option<Duration>,
pub env_remove: Vec<String>,
}Expand description
Everything needed to call one agent CLI once.
Built by CliSpec::resolve from a preset plus [llm.cli]; pure data, so
CliSpec::invocation is testable without spawning anything.
Fields§
§command: StringBinary name or path.
command_env: Option<String>Environment variable that overrides command when config does not.
args: Vec<String>Fixed arguments before every generated flag.
prompt_delivery: PromptDeliveryHow the prompt reaches the process.
prompt_flag: StringFlag carrying the prompt under PromptDelivery::Flag.
model_flag: StringFlag selecting the model; empty omits it.
default_model: StringModel used when the config names none.
output_format_flag: StringFlag selecting the output format; empty omits it.
output_format_value: StringValue for output_format_flag; empty passes the flag alone.
system_prompt_flag: StringFlag carrying the system prompt; empty prepends it to the message.
output_mode: OutputModeShape of the CLI’s stdout.
result_json_paths: JsonPathsCandidate paths to the answer inside JSON output; empty means stdout is the answer.
ndjson_match: LineMatchersPredicates selecting the answer’s line under OutputMode::Ndjson.
extra_args: Vec<String>Arguments after the generated flags.
timeout: Option<Duration>Per-call limit; None waits forever.
env_remove: Vec<String>Variables unset before spawning.
Implementations§
Source§impl CliSpec
impl CliSpec
Sourcepub fn preset(preset: CliPreset) -> Self
pub fn preset(preset: CliPreset) -> Self
Defaults for a known CLI.
Verified on live calls against the installed binaries: claude 2.1.x,
grok (JSON envelope confirmed) and codex 0.146.x (NDJSON stream
confirmed). gemini 0.27.x is flags-only — its success field could not
be checked without auth, so that preset tries several and falls back to
stdout. See the provider table in the README.
Sourcepub fn resolve(
provider: &Provider,
section: &CliSection,
) -> Result<Self, RecallError>
pub fn resolve( provider: &Provider, section: &CliSection, ) -> Result<Self, RecallError>
Resolve the spec for a provider: its preset, then [llm.cli] on top.
Fails for the HTTP providers, which have no CLI to spawn, and for a spec left unusable — no command, or flag delivery with no flag.
Sourcepub fn resolve_command(&self) -> String
pub fn resolve_command(&self) -> String
The binary to spawn: config first, then the preset’s environment override, then the preset default.
Sourcepub fn resolve_model(&self, configured: &str) -> String
pub fn resolve_model(&self, configured: &str) -> String
The model this spec uses, given what the config asked for.
Sourcepub fn invocation(
&self,
model: &str,
system_prompt: &str,
user_message: &str,
) -> Invocation
pub fn invocation( &self, model: &str, system_prompt: &str, user_message: &str, ) -> Invocation
Build the exact argv and stdin payload for one completion.
Sourcepub fn argv_preview(&self, model: &str) -> String
pub fn argv_preview(&self, model: &str) -> String
A human-readable, single-line argv for config show, with the prompts
as placeholders.
Trait Implementations§
impl Eq for CliSpec
impl StructuralPartialEq for CliSpec
Auto Trait Implementations§
impl Freeze for CliSpec
impl RefUnwindSafe for CliSpec
impl Send for CliSpec
impl Sync for CliSpec
impl Unpin for CliSpec
impl UnsafeUnpin for CliSpec
impl UnwindSafe for CliSpec
Blanket Implementations§
impl<T> AsyncFriendly for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request