pub struct OpenCodeBackend { /* private fields */ }Implementations§
Source§impl OpenCodeBackend
impl OpenCodeBackend
Sourcepub fn builder() -> OpenCodeBackendBuilder
pub fn builder() -> OpenCodeBackendBuilder
Create an instance of OpenCodeBackend using the builder syntax
Source§impl OpenCodeBackend
impl OpenCodeBackend
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a backend, reading API key from env vars or ~/.local/share/opencode/auth.json.
Priority:
OPENCODE_ZEN_KEYorOPENCODE_API_KEYenv vars (Zen provider)OPENCODE_GO_API_KEYenv var (Go provider)OPENROUTER_API_KEYenv var (OpenRouter direct provider)auth.jsonprovider records (opencodeor legacyopencode-go)
Trait Implementations§
Source§impl Backend for OpenCodeBackend
impl Backend for OpenCodeBackend
Source§type Config = OpenCodeConfig
type Config = OpenCodeConfig
Backend-specific session configuration type.
Source§type Session = OpenCodeSession
type Session = OpenCodeSession
Concrete session type returned by this backend.
Source§fn capabilities(&self) -> BackendCapabilities
fn capabilities(&self) -> BackendCapabilities
Backend feature support exposed by this implementation. Read more
Source§async fn session(
&self,
config: SessionConfig<OpenCodeConfig>,
) -> Result<OpenCodeSession>
async fn session( &self, config: SessionConfig<OpenCodeConfig>, ) -> Result<OpenCodeSession>
Start a new agent session.
Source§async fn resume(
&self,
session_id: &str,
config: SessionConfig<OpenCodeConfig>,
) -> Result<OpenCodeSession>
async fn resume( &self, session_id: &str, config: SessionConfig<OpenCodeConfig>, ) -> Result<OpenCodeSession>
Resume a previously saved session by ID.
Source§impl Clone for OpenCodeBackend
impl Clone for OpenCodeBackend
Source§fn clone(&self) -> OpenCodeBackend
fn clone(&self) -> OpenCodeBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OpenCodeBackend
impl RefUnwindSafe for OpenCodeBackend
impl Send for OpenCodeBackend
impl Sync for OpenCodeBackend
impl Unpin for OpenCodeBackend
impl UnsafeUnpin for OpenCodeBackend
impl UnwindSafe for OpenCodeBackend
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