Skip to content

feat: official OpenCode compatibility (sidebar, hooks, AGENTS.md, orchestration)#17

Merged
amirlehmam merged 12 commits into
masterfrom
feat/opencode-compat
Jun 1, 2026
Merged

feat: official OpenCode compatibility (sidebar, hooks, AGENTS.md, orchestration)#17
amirlehmam merged 12 commits into
masterfrom
feat/opencode-compat

Conversation

@amirlehmam

Copy link
Copy Markdown
Owner

Summary

Brings wmux to full feature parity with OpenCode (SST opencode, v1.2.6+), matching the existing Claude Code integration, via OpenCode's official plugin API rather than TUI scraping.

  • Live activity sidebar — a bundled OpenCode plugin (resources/opencode-plugin/wmux.js, auto-installed to ~/.config/opencode/plugin/wmux.js) translates OpenCode hooks/events into wmux CLI calls. A new agent-agnostic agent.activity pipe method + applyExternalActivity() feed the same sidebar store/IPC Claude uses, so the UI is unchanged.
  • Tool/hook trackingtool.execute.afterwmux hook (parity with Claude PostToolUse).
  • Instruction injectionensureOpencodeContext() writes the wmux CLI usage block into ~/.config/opencode/AGENTS.md (marker-delimited, never clobbers user content, idempotent).
  • Orchestrationlaunch-agent.js honors WMUX_AGENT_CMD=opencode to spawn opencode run workers in panes.
  • CLI — new wmux agent-activity verb (defaults surface to $WMUX_SURFACE_ID).

Design + plan: docs/superpowers/specs/2026-06-01-opencode-compatibility-design.md, docs/superpowers/plans/2026-06-01-opencode-compatibility.md.

Verification

  • OpenCode 1.2.6 loads the plugin with zero errors (confirmed via opencode run --print-logs); plugin dir is plugin/ (singular) — verified against the binary; docs saying plugins/ are wrong for this build.
  • AGENTS.md injection + plugin install are idempotent (regression-tested; a trailing-newline accumulation bug was found live and fixed).
  • New unit tests green (11): tests/unit/agent-activity.test.ts, tests/unit/opencode-context.test.ts.
  • Whole-branch code review: approved, no Critical/Important issues.
  • Plugin no-ops entirely when WMUX !== '1'; all shell-outs use execFile (no shell, no injection surface) and are fire-and-forget (can't crash OpenCode).

Test Plan

  • In an updated wmux, run opencode in a pane → sidebar shows tool activity and flips to idle on session.idle
  • grep wmux:start ~/.config/opencode/AGENTS.md and ls ~/.config/opencode/plugin/wmux.js present after launch
  • /wmux:orchestrate with WMUX_AGENT_CMD=opencode spawns an opencode run worker in a new pane

Note: 5 pre-existing pty-manager test failures are environmental (node-pty/conpty) and unrelated to this branch.

🤖 Generated with Claude Code

amirlehmam and others added 12 commits June 1, 2026 12:06
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
injectWmuxBlock duplicated the source's trailing newline on every run,
growing AGENTS.md by a blank line each wmux launch. Normalize the block's
trailing whitespace; add regression tests for newline-terminated sources.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- pluginNeedsUpdate fails safe (reinstall) when source lacks a version marker
- throttle message.part.updated active pings to avoid per-token CLI spawns
- omit empty tool name; coerce '' to undefined so it doesn't clobber lastTool
- bump plugin to v2 so installs refresh

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@amirlehmam amirlehmam merged commit 30e73d7 into master Jun 1, 2026
@amirlehmam amirlehmam deleted the feat/opencode-compat branch June 1, 2026 11:35
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