pub struct OpenCodeRunner;Expand description
Adapter for OpenCode CLI (opencode binary).
Headless invocation:
opencode run –format json “
The run subcommand is non-interactive: all permissions are auto-approved,
and the process exits after the task completes.
With --format json, output is NDJSON with event types:
- { type: “step_start”, sessionID, part: { type: “step-start”, … } }
- { type: “text”, sessionID, part: { type: “text”, text, … } }
- { type: “tool_use”, sessionID, part: { type: “tool”, callID, tool, state: { status, input, output, … } } }
- { type: “step_finish”, sessionID, part: { type: “step-finish”, reason, cost, tokens: { input, output, cache: { read, write } } } }
Trait Implementations§
Source§impl AgentRunner for OpenCodeRunner
impl AgentRunner for OpenCodeRunner
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Check whether the agent binary is available on the system.
Source§fn binary_path(&self, config: &TaskConfig) -> Result<PathBuf>
fn binary_path(&self, config: &TaskConfig) -> Result<PathBuf>
Resolve the binary path (user override or PATH lookup).
Source§fn build_args(&self, config: &TaskConfig) -> Vec<String>
fn build_args(&self, config: &TaskConfig) -> Vec<String>
Build the command-line arguments for the agent process.
Source§fn build_env(&self, _config: &TaskConfig) -> Vec<(String, String)>
fn build_env(&self, _config: &TaskConfig) -> Vec<(String, String)>
Build the environment variables for the agent process.
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskConfig,
cancel_token: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = Result<StreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskConfig,
cancel_token: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = Result<StreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the task and return a
StreamHandle with event stream and cancel token.Source§fn capabilities(&self) -> AgentCapabilities
fn capabilities(&self) -> AgentCapabilities
What features this agent supports.
Source§fn version(&self, config: &TaskConfig) -> Option<String>
fn version(&self, config: &TaskConfig) -> Option<String>
Get the version of the installed agent binary.
Source§fn validate_config(&self, config: &TaskConfig) -> Vec<ConfigWarning>
fn validate_config(&self, config: &TaskConfig) -> Vec<ConfigWarning>
Validate config against this agent’s capabilities.
Auto Trait Implementations§
impl Freeze for OpenCodeRunner
impl RefUnwindSafe for OpenCodeRunner
impl Send for OpenCodeRunner
impl Sync for OpenCodeRunner
impl Unpin for OpenCodeRunner
impl UnwindSafe for OpenCodeRunner
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
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>
Converts
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>
Converts
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