Skip to content

feat: opencode client profile (#89) — release 0.38.0 - #90

Merged
lroolle merged 1 commit into
mainfrom
feat/opencode-client
Aug 7, 2026
Merged

feat: opencode client profile (#89) — release 0.38.0#90
lroolle merged 1 commit into
mainfrom
feat/opencode-client

Conversation

@lroolle

@lroolle lroolle commented Aug 7, 2026

Copy link
Copy Markdown
Member

Closes #89.

What

cctrace opencode traces opencode.ai's multi-provider CLI. deva#541 (deva opencode --trace) wraps this.

  • No per-host dialect machinery needed — the issue's hard part dissolved: wireDialect(pair) is already per-pair and shape-first, and the OpenCode Zen gateway mounts BOTH dialects side by side (/zen/v1/messages + /zen/v1/responses|chat/completions). One live run produced both; both reconstruct.
  • ClientWire.providerHosts (new optional field): single-purpose LLM API hosts a multi-provider client can route to, enrolled unconditionally by buildInterceptSet — decrypting a model-API host can only capture model traffic. Shared hosts (github.com, which mints the copilot token; googleapis.com) deliberately stay opaque tunnels; the existing api.github.com-never-intercepted regression guards this.
  • Continuity: zen calls carry x-opencode-session: ses_… — cross-run preload + exit auto-merge work unchanged (live-verified: a two-process continued session merged into one session-ses_…jsonl, 4 turns, thinking blocks).
  • Custom providers: opencodeConfigHosts scans "baseURL" in every opencode.json(c) the client reads ($OPENCODE_CONFIG, XDG global, cwd) — the codex config.toml precedent, one well-specified key, fail-soft.
  • Pricing: models.dev opencode provider (OpenCode Zen, wire-exact ids) appended LAST in trust order — zen-only models get cost chips, resold claude/gpt/grok ids keep originating rates.
  • Icon glyph, help text, docs (clients.md/README/SKILL.md/CLAUDE.md/llms.txt/index.html en+zh), CHANGELOG, renderVer highlights, version 0.38.0.

Test plan (issue #89)

  • cctrace opencode -- run … captures gateway traffic with CA installed (live, zen)
  • anthropic-dialect leg: zen /zen/v1/messages mount intercepted + dialect-detected; BYO key not available in this container (unit-covered)
  • openai-compatible gateway session reconstructs (live: deepseek-v4-flash-free, 2-run continuation)
  • host categorization: console.opencode.ai oauth, models.dev bootstrap (16 categorize cases)
  • bun test: 643 pass, 0 fail

🤖 Generated with Claude Code

…+ providerHosts (#89)

- src/clients/opencode.ts: zen gateway + device oauth + models.dev pins,
  x-opencode-session continuity, baseURL auto-enroll from opencode.json(c)
- ClientWire.providerHosts: single-purpose LLM API hosts enrolled for
  interception; shared hosts (github.com, googleapis.com) stay tunnels
- pricing: models.dev opencode provider last in trust order (zen-only ids
  priced, resold ids keep originating rates)
- live-verified against the zen gateway: both dialect mounts captured,
  cross-process continuation merged into one session file

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lroolle
lroolle merged commit c09458c into main Aug 7, 2026
1 check passed
@lroolle
lroolle deleted the feat/opencode-client branch August 7, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: opencode client profile

1 participant