Skip to main content

Module client_async

Module client_async 

Source
Expand description

High-level async client for the opencode server.

OpencodeClient wraps the low-level crate::http::HttpTransport with typed methods for the six hand-wrapped endpoints. Construct one with OpencodeClient::builder:

use opencode_codes::client_async::OpencodeClient;
use opencode_codes::protocol_generated::types::SessionCreateParams;

let client = OpencodeClient::builder()
    .base_url("http://127.0.0.1:4096")
    .build()?;
let session = client.create_session(&SessionCreateParams {
    title: Some("demo".into()),
    ..Default::default()
}).await?;

§Reconciliation

The GET /event SSE stream (see crate::sse) is best-effort and must not be trusted as the sole source of truth. After observing activity on the stream, poll OpencodeClient::list_messages to reconcile against the server’s authoritative message state.

Structs§

OpencodeClient
Async client for the opencode HTTP/SSE server.
OpencodeClientBuilder
Builder for OpencodeClient.

Constants§

DEFAULT_BASE_URL
Base URL of a default local opencode serve instance.