Skip to content

0.6: Cockpit on OpenCode 2 — one package for 1 and 2, logging, doctor - #18

Merged
Codestz merged 5 commits into
mainfrom
feat/opencode-v2
Sep 24, 2026
Merged

Codestz merged 5 commits into
mainfrom
feat/opencode-v2

Conversation

@Codestz

@Codestz Codestz commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Cockpit runs on OpenCode 1.18+ and 2.0.15+ from the same packages. Each entry carries a v1 half (tui/server) and a v2 half (setup); whichever OpenCode loads it picks its own.

How

  • @opencode-cockpit/client/host — the interface half of every bay is written once against Host; fromV1 / fromV2 supply it, dualTui makes the entry.
  • @opencode-cockpit/client/server — the same for the agent half: tools and hooks once, registered as v1 hooks or on v2's tool.transform, session.hook("context") and event stream.
  • Everything about v2 was measured on real binaries, not read off docs — several documented assumptions turned out wrong (theme tokens, update commands, the 1.18.29 floor).

Also in this release

  • One log — ~/.cache/opencode-cockpit/cockpit.log for both halves of every bay; COCKPIT_DEBUG=1 for detail.
  • npx opencode-cockpit doctor — checks a setup on either OpenCode and prints the fix.
  • Fixes: full-screen console and Review see-through on transparent themes; v2 colours matching v1; statusline modules outside a project on v2.
  • Docs: "OpenCode 1 and 2" page, install for both, Doctor page, troubleshooting built on the log; landing gets a v2 install tab.

Known limits on OpenCode 2 (documented on the site)

  • shell_start runs without a permission prompt — v2 gives plugin tools no documented way to ask. Next up (roadmap).
  • Tools are reached through Code Mode (execute); /plugins-update defers to editing opencode.json; statusline lsp segment is empty.

Verified

  • bun run check: 933 tests pass; pack:check passes, including doctor --help under Node.
  • smoke:tui with AGENT=1 on OpenCode 2.0.15 and 1.18.32: panels live, console, full screen, statusline, Review diff, updater, and a real agent turn calling shell_start + review_list.
  • Full smoke also on 1.18.0 and 1.18.28 (floor unchanged); 1.17.20 fails full screen (unsupported, as before).
  • Transparent theme: 0.5.2 full screen had 1557/1564 see-through cells; this branch 0.
  • Colours: rendered cells identical on v1 and v2 (Review badge, + note, gutter).

Release as 0.6.0 after merge; the release script bumps every install pin, including the new v2 forms.

🤖 Generated with Claude Code

Codestz and others added 5 commits September 23, 2026 21:12
The full-screen shell console and the Review pane painted with the theme's background, which the
"system" theme leaves transparent, so the conversation showed through. Both now use the first opaque
background, or a solid fallback. docs/opencode/v2.md records what was measured on 1.18.32 and 2.0.15.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Bays will talk to Host, the ~30 calls they use named as v1 names them. fromV1 wraps the v1 API;
fromV2 builds the same shape on the v2 context (theme tokens under v1 names, slot paths, keymap
layers, storage-backed kv, renderer key stream for intercept). dualTui makes one entry both load.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Shell, Review, Statusline, Updater and the bundle start through dualTui. Component dialogs became
host prompt/confirm/select; the console's keys a host-owned layer; Review's submit and Statusline's
brief go through promptSession; Statusline reads v2 session data (cost, tokens, model limit). The
Updater points at OpenCode 2's own plugin update. v1 answers a dialog before clearing it — clearing
fires the close handler, which settled every prompt as cancelled. The smoke test takes OPENCODE.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…and 2

Agent side
- client/server: ServerHost, dualServer, composeParts. Shell and Review write
  their tools and hooks once; v1 gets hooks, v2 gets tool.transform, the
  "context" hook and the event stream. Tools keep v1's tool(); v2 is given
  their input-side JSON Schema and arguments are parsed here, so defaults
  apply on both. v1's preview call to setup is skipped.
- Measured end to end: a real agent turn on v1 1.18.32 and v2 2.0.15 calls
  shell_start and review_list and is told the guidance.

Fixes found on v2
- Review drew nothing: a dead titleColor prop blanked the overlay.
- Theme: action and feedback tokens are a colour per state; accent and
  primary are palettes, not text.action (which is white). Mapping checked
  against both default themes, captured as fixtures.
- Statusline modules outside a project: v2 words the resolve error
  differently, so the fallback never ran.

Logging
- client/log: one cockpit.log for both halves of every bay, levels, rotation,
  COCKPIT_DEBUG=1 (daemon too). Starts, errors with stacks, failed tools.
  First lines were lost before the cockpit home existed; tests no longer
  write the developer's log.

Doctor
- npx opencode-cockpit doctor: OpenCode version, config in both spellings,
  what last ran, recent errors, daemon, git/ps, settings. Prints the fix for
  the OpenCode installed; --json; exit 1 on failure. Node only.

Docs and floor
- Site: OpenCode 1 and 2 page, install for both, doctor page,
  troubleshooting around the log; landing install tab for v2.
- Floor stays OpenCode 1.18.0: the full smoke passes on 1.18.0 and 1.18.28.
- v2 known limits documented, shell_start permission first among them.
- dev:install for testing a checkout; smoke covers full screen, plugin
  failures and (AGENT=1) a real agent turn.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- log: the size and directory were checked once per process, so a long
  debug session grew the file without bound, and a cache cleared under a
  running OpenCode stopped the log until restart. Rechecked every 256 lines,
  and after a failed write.
- doctor: OpenCode 1 never reads cli.json, so panels configured only there
  are a missing half; OpenCode 2 loads the interface from opencode.json too,
  so the bundle there and a bay in cli.json is the bay loaded twice. Entries
  in a file the installed OpenCode ignores are marked as such.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Codestz
Codestz merged commit 8ed950b into main Sep 24, 2026
2 checks passed
@Codestz
Codestz deleted the feat/opencode-v2 branch September 24, 2026 17:32
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.

1 participant