pub struct ClaudeCodeDriver { /* private fields */ }Expand description
Driver that talks to the Claude Code CLI (or any stream-json compatible
agent) via the SDK’s --input-format=stream-json --output-format=stream-json
protocol.
Implementations§
Source§impl ClaudeCodeDriver
impl ClaudeCodeDriver
Sourcepub fn finish_input(&mut self)
pub fn finish_input(&mut self)
Signal that no more user input will be sent in this session. This
closes claude’s stdin, after which claude will process any pending
frames, emit its final result frame, and exit.
For one-shot interactions this should be called immediately after
the final Driver::send. For long-running sessions (multi-turn
interactive use) leave stdin open and rely on Driver::shutdown
to terminate.
Source§impl ClaudeCodeDriver
impl ClaudeCodeDriver
Sourcepub async fn spawn(cwd: impl AsRef<Path>) -> Result<Self, DriverError>
pub async fn spawn(cwd: impl AsRef<Path>) -> Result<Self, DriverError>
Spawn a fresh Claude Code session in the given working directory,
using the binary on PATH (or $CLAUDE_BIN env override).
Defaults to persistent session mode via --replay-user-messages
— one claude process serves an unbounded number of turns. Call
Self::finish_input when you’re done so claude can exit
gracefully. For multi-turn use, just keep calling
Driver::send.
Sourcepub fn builder(cwd: impl AsRef<Path>) -> ClaudeCodeDriverBuilder
pub fn builder(cwd: impl AsRef<Path>) -> ClaudeCodeDriverBuilder
Begin building a Claude Code session with custom options.
Trait Implementations§
Source§impl Debug for ClaudeCodeDriver
impl Debug for ClaudeCodeDriver
Source§impl Driver for ClaudeCodeDriver
impl Driver for ClaudeCodeDriver
Source§fn send<'life0, 'async_trait>(
&'life0 mut self,
frame: ClientFrame,
) -> Pin<Box<dyn Future<Output = Result<(), DriverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
frame: ClientFrame,
) -> Pin<Box<dyn Future<Output = Result<(), DriverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Driver::next_event.Source§fn next_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Option<AgentEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Option<AgentEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
None when the
agent has exited cleanly.Auto Trait Implementations§
impl Freeze for ClaudeCodeDriver
impl !RefUnwindSafe for ClaudeCodeDriver
impl Send for ClaudeCodeDriver
impl Sync for ClaudeCodeDriver
impl Unpin for ClaudeCodeDriver
impl UnsafeUnpin for ClaudeCodeDriver
impl !UnwindSafe for ClaudeCodeDriver
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.