opencode/packages/client
Luke Parker 4a14d03164 Merge remote-tracking branch 'origin/dev' into persisted-browser
Conflicts with dev's device toolbar (#63819), text file tabs (#64463), the new icon set (#64466) and the Code Mode split (#64487, #64510):
- chromium.ts: dev's viewport writer, device emulation and per-page reports, with our retry-only detail; pointer commands run in the writer's queue inside our refusal and passkey wrapper; captures share the queue, and a fixed viewport is captured through the device's CDP clip while Auto keeps the fresh-redraw path.
- panel.tsx: dev's device toolbar, preview frame and spotlight, with our extensions menu, options menu (data-browser-popup), prompt-aware native view, error pages and two-view site popover; our page area box is declared again.
- embeds.tsx: our measure and place split and layout spine observers, with dev's scrollport clip in the shown test, the cover rect and the layout key.
- model.ts, pane.ts, ipc users, keys.ts (find previous stays claimed), i18n, fixtures and tests keep both sides.
- artifact-view.tsx: dev's fixed modes; desktop HTML stays source only.
- codemode: a removed tool's sentence is returned as dev's unknown-tool failure; core tool.ts keys the catalog cache by visible names and whether Node's path is on.
- icons: dev's set, our puzzle icon.
2026-11-18 10:50:48 +10:00
..
script feat(core): turn experimental schedules into automations (#64160) 2026-11-16 17:14:59 -08:00
src Merge remote-tracking branch 'origin/dev' into persisted-browser 2026-11-18 10:50:48 +10:00
test Merge remote-tracking branch 'origin/dev' into persisted-browser 2026-11-17 11:19:37 +10:00
package.json release: v2.3.0 (#63719) 2026-11-13 09:04:03 +00:00
README.md refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
tsconfig.build.json feat(plugin): align hooks with client APIs 2026-07-03 18:12:22 -04:00
tsconfig.json chore: upgrade typecheck to TypeScript 7.0.2 (#56300) 2026-10-17 13:26:46 -07:00

@opencode/client

Private generation target for clients derived directly from OpenCode's authoritative Effect HttpApi.

Entrypoints

  • @opencode/client: zero-Effect Promise client using fetch.
  • @opencode/client/effect: rich Effect network client using an environment-provided HttpClient.

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" }) })