Learn the family route's absence per connection where the data layer already invalidates on disconnect. server.connected is delivered after the connection reports connected, so route effects started family reads before the old reset and kept using the fallback after reconnecting to an upgraded server. Key family membership by the client's own root. The server roots a family whose top names a missing parent at the top, while resolveRoot walks to the missing ID, so such a family read showed no members and dropped its journaled events. A fallback read invalidated in flight no longer starts member reads that could complete with pre-reconnect data. Metadata updates and permission replies now go through the journal, so an in-flight read cannot undo them, and metadata updates raise time.updated like the projector does. Test fixtures drop status values that were only needed while status was required, and the TUI fixture's family route now roots orphan families and forwards failed sub-reads as the real server does. The spec states what is implemented and what is still to do. |
||
|---|---|---|
| .. | ||
| script | ||
| src | ||
| test | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
@opencode/client
Private generation target for clients derived directly from OpenCode's authoritative Effect HttpApi.
Entrypoints
@opencode/client: zero-Effect Promise client usingfetch.@opencode/client/effect: rich Effect network client using an environment-providedHttpClient.
The generated surface includes every standard HTTP group from Server's concrete API. The build compiler reads @opencode/server/api; the generated Effect runtime imports a client-local projection built from Protocol, with a generation-equivalence test preventing transport drift. Custom transports such as the PTY WebSocket connection remain outside the generic HTTP client. Run bun run generate after changing the contract and bun run check:generated to detect committed-output drift.
The Effect entrypoint uses canonical decoded values such as Session.ID, Location.Ref, and Prompt. These datatypes come from the lightweight @opencode/schema package and are re-exported so callers depend only on the client surface. Protocol owns endpoint construction and middleware placement; Server supplies the concrete middleware keys used by the build-time API.
The Promise root remains structural and has no Core or Effect runtime dependency. /effect depends only on Effect, Schema, and Protocol and is browser-bundle safe. Bundle-boundary tests enforce both import graphs.
Effect consumers construct canonical decoded inputs:
import { AbsolutePath, Location, OpenCode, Prompt } from "@opencode/client/effect"
const client = yield * OpenCode.make({ baseUrl: "https://opencode.example" })
yield *
client.sessions.create({
location: Location.Ref.make({ directory: AbsolutePath.make("/workspace") }),
})
yield * client.sessions.prompt({ sessionID, prompt: Prompt.make({ text: "Hello" }) })