mirror of
https://github.com/0xMassi/webclaw.git
synced 2026-07-22 07:11:01 +02:00
- Add LlmError::Subprocess(#[from] io::Error) and LlmError::Timeout variants - Implement GeminiCliProvider: new(model) -> Self matching OllamaProvider pattern - Prompts passed exclusively via stdin (Stdio::piped), never as CLI args - 30s subprocess timeout via tokio::time::timeout to prevent hung processes - 6-slot Semaphore to bound concurrent subprocess spawns in MCP context - Stderr captured and included (first 500 bytes) in non-zero exit errors - is_available(): pure `gemini --version` PATH check, no live inference - GEMINI_MODEL env override; default model gemini-2.5-pro - strip_thinking_tags + strip_code_fences applied to stdout output
24 lines
616 B
Rust
24 lines
616 B
Rust
/// LLM-specific errors. Kept flat — one enum covers transport, provider, and parsing failures.
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum LlmError {
|
|
#[error("HTTP error: {0}")]
|
|
Http(#[from] reqwest::Error),
|
|
|
|
#[error("subprocess error: {0}")]
|
|
Subprocess(#[from] std::io::Error),
|
|
|
|
#[error("subprocess timed out")]
|
|
Timeout,
|
|
|
|
#[error("no providers available")]
|
|
NoProviders,
|
|
|
|
#[error("all providers failed: {0}")]
|
|
AllProvidersFailed(String),
|
|
|
|
#[error("invalid JSON response: {0}")]
|
|
InvalidJson(String),
|
|
|
|
#[error("provider error: {0}")]
|
|
ProviderError(String),
|
|
}
|