Skip to main content

opencode/
lib.rs

1//! # OpenCode SDK for Rust
2//!
3//! Rust implementation aligned with the official OpenCode JavaScript SDK.
4//! It provides:
5//! - Local server lifecycle helpers (`create_opencode_server`, `create_opencode_tui`)
6//! - HTTP client for OpenCode API (`create_opencode_client`)
7//! - Combined helper (`create_opencode`)
8
9pub mod client;
10pub mod errors;
11pub mod server;
12pub mod types;
13
14pub use client::{
15    ApiResponse, AppApi, AuthApi, CommandApi, ControlApi, EventApi, GlobalApi, InstanceApi, LspApi,
16    OauthApi, OpencodeClient, OpencodeClientConfig, PathApi, ProjectApi, ProviderApi, PtyApi,
17    RequestOptions, SessionApi, TuiApi, TuiControlApi, create_opencode_client,
18};
19pub use errors::{Error, Result};
20pub use server::{
21    Opencode, OpencodeServer, OpencodeServerOptions, OpencodeTui, OpencodeTuiOptions,
22    create_opencode, create_opencode_server, create_opencode_tui,
23};
24pub use types::{PartInput, PromptInput, SessionCreateInput};
25
26/// The version of the OpenCode Rust SDK, sourced from `Cargo.toml`.
27pub const SDK_VERSION: &str = env!("CARGO_PKG_VERSION");