Skip to content

feat: support OpenCode v2 with safe sync tool commands - #84

Merged
iHildy merged 16 commits into
mainfrom
ian/pr81-safe-v2-commands
Sep 23, 2026
Merged

iHildy merged 16 commits into
mainfrom
ian/pr81-safe-v2-commands

Conversation

@iHildy

@iHildy iHildy commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds one package entrypoint for OpenCode v1 and v2. V1 keeps its existing server hooks and /sync-* commands. V2 registers opencode_sync as a tool, uses domain transforms for MCP, agent, model, and provider overrides, and shares the sync service with v1. README and docs/v2.md document the version requirements and remaining parity gaps.

This contains the complete work from PR #81 plus the focused safety fix in the contributor-branch fix PR. PR #81 should be superseded by this PR after review; this PR does not close it automatically.

Safety fix found during live verification

The original v2 /sync-status callback posted its result through session.synthetic. OpenCode treated that text as a new prompt, and the model attempted opencode_sync init. V2 now exposes sync operations through the opencode_sync tool only. The /sync-* commands remain on v1. V2 tool results rewrite v1-only slash-command hints to the equivalent tool arguments.

Verification

  • bun run check and bun run build passed.
  • bun test passed, 202 tests.
  • Packed the branch and loaded it in an isolated OpenCode v2.0.13 profile. plugin list showed opencode-synced; command.list showed no sync-* commands.
  • In a live v2 session, opencode_sync with { "command": "status" } returned visible tool content: opencode-synced is not configured. Run opencode_sync with {"command":"init"} to set it up. No configuration changed.
  • The two-instance v1 model-driven test reached plugin startup but stopped before sync-init: OpenCode's default free model rejected API use, and an OpenAI OAuth retry failed token refresh with 401. The package's v1 entrypoint and hooks passed local tests; full v1 sync behavior remains unverified in this run.

Review notes

  • V2 overrides outside mcp, agent, model, and provider warn and are not applied.
  • V2 has no toast or session-idle API. Turso sync runs without idle gating.
  • V2 override edits require host restart.
  • GitHub's external-contributor approval gate initially held PR #81 CI. Its workflow was approved for execution after a read-only safety review.

@iHildy
iHildy merged commit d549b0f into main Sep 23, 2026
3 checks passed
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.

2 participants