pub enum OpenCodeSession {
Http(Box<HttpSession>),
Agent(Box<OpenCodeAgentSession>),
}Expand description
Public session type – dispatches between HTTP (direct API) and Agent (subprocess) modes.
Variants§
Http(Box<HttpSession>)
HTTP mode: calls the OpenCode Zen API (or compatible endpoint) directly.
Agent(Box<OpenCodeAgentSession>)
Agent mode: spawns opencode serve and communicates via the local HTTP API.
Trait Implementations§
Source§impl Session for OpenCodeSession
impl Session for OpenCodeSession
Source§fn turn_stream(
&mut self,
input: Input,
options: TurnOptions,
) -> Pin<Box<dyn Future<Output = Result<EventStream>> + Send + '_>>
fn turn_stream( &mut self, input: Input, options: TurnOptions, ) -> Pin<Box<dyn Future<Output = Result<EventStream>> + Send + '_>>
Run a turn and return a stream of events.
Source§fn session_id(&self) -> Option<&str>
fn session_id(&self) -> Option<&str>
Session ID (populated after the first turn completes).
Source§fn interrupt(&mut self) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
fn interrupt(&mut self) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
Interrupt the current turn. No-op if idle.
Source§fn turn(
&mut self,
input: Input,
options: TurnOptions,
) -> Pin<Box<dyn Future<Output = Result<TurnOutput, AgentError>> + Send + '_>>
fn turn( &mut self, input: Input, options: TurnOptions, ) -> Pin<Box<dyn Future<Output = Result<TurnOutput, AgentError>> + Send + '_>>
Run a turn and return the buffered result. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for OpenCodeSession
impl !UnwindSafe for OpenCodeSession
impl Freeze for OpenCodeSession
impl Send for OpenCodeSession
impl Sync for OpenCodeSession
impl Unpin for OpenCodeSession
impl UnsafeUnpin for OpenCodeSession
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