pub struct ClaudeCliBackend { /* private fields */ }Expand description
AI backend that spawns claude -p in non-interactive mode.
Implementations§
Source§impl ClaudeCliBackend
impl ClaudeCliBackend
pub fn new(config: &AiConfig) -> Self
Sourcepub fn is_available() -> bool
pub fn is_available() -> bool
Check if the claude CLI is available on PATH.
Sourcepub fn check_auth() -> Result<(), CoreError>
pub fn check_auth() -> Result<(), CoreError>
Pre-flight auth check: sends a minimal prompt WITHOUT –json-schema (which returns immediately on auth failure) and checks is_error. This prevents the infinite StructuredOutput retry loop that occurs when –json-schema is used with an expired/missing auth token.
Source§impl ClaudeCliBackend
impl ClaudeCliBackend
Sourcepub fn execute_agentic(
&self,
prompt: &str,
cwd: Option<&str>,
) -> Result<BackendResponse, CoreError>
pub fn execute_agentic( &self, prompt: &str, cwd: Option<&str>, ) -> Result<BackendResponse, CoreError>
Execute an agentic prompt: unlimited turns, full tool access, raw markdown output.
Key differences from execute():
- No
--max-turns(unlimited turns for codebase exploration) - No
--tools ""(model needs tool access) - No
--json-schema(output is raw markdown) - Longer timeout: 600 seconds (10 minutes)
- Result comes from
resultfield (notstructured_output) - Optional
cwdto set the working directory for tool calls
Trait Implementations§
Source§impl AnalysisBackend for ClaudeCliBackend
impl AnalysisBackend for ClaudeCliBackend
Source§fn execute(
&self,
prompt: &str,
json_schema: Option<&str>,
) -> Result<BackendResponse, CoreError>
fn execute( &self, prompt: &str, json_schema: Option<&str>, ) -> Result<BackendResponse, CoreError>
Execute a prompt and return the response text and cost.
When
json_schema is provided, the backend passes it to --json-schema
for constrained decoding (guaranteed valid JSON matching the schema).Auto Trait Implementations§
impl Freeze for ClaudeCliBackend
impl RefUnwindSafe for ClaudeCliBackend
impl Send for ClaudeCliBackend
impl Sync for ClaudeCliBackend
impl Unpin for ClaudeCliBackend
impl UnsafeUnpin for ClaudeCliBackend
impl UnwindSafe for ClaudeCliBackend
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
Mutably borrows from an owned value. Read more