Expand description
Low-level REST transport for the opencode server.
This module owns three concerns shared by every hand-wrapped endpoint:
- Base-URL handling — a normalized origin (trailing slashes stripped) against which typed path builders produce absolute request URLs.
- HTTP Basic auth — opencode requires Basic auth only when the server was
started with a password (username defaults to
"opencode"). Credentials are supplied explicitly; theOPENCODE_SERVER_PASSWORDenvironment variable is read only throughBasicAuth::from_env, never silently on a request path. - A typed request helper —
HttpTransport::request_json/HttpTransport::request_unitsend a JSON body (if any), apply auth and the optional per-request timeout, and map any non-2xx status toError::Httpcarrying the server’s response body.
Path parameters ({sessionID}, {permissionID}) are percent-encoded against
the RFC 3986 unreserved set before being placed into the path.
Structs§
- Basic
Auth - HTTP Basic credentials for the opencode server.
- Http
Transport - Low-level JSON-over-HTTP transport bound to one opencode base URL.
- Scope
- Directory / workspace scoping for the session endpoints.
Constants§
- DEFAULT_
USERNAME - Default HTTP Basic auth username opencode expects when a server password is configured.
- SERVER_
PASSWORD_ ENV - Environment variable opencode reads for its server password. Used only by
BasicAuth::from_env.