Skip to content

Support OpenCode V2 while preserving V1 compatibility - #43

Merged
alex-w-99 merged 4 commits into
mainfrom
feature/opencode-v2-compatibility
Oct 14, 2026
Merged

alex-w-99 merged 4 commits into
mainfrom
feature/opencode-v2-compatibility

Conversation

@alex-w-99

@alex-w-99 alex-w-99 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Executive Summary

Add OpenCode V2 support while preserving the existing V1 integration.

  • Keep the V1 entrypoint and add a dedicated /v2 entrypoint for tools and gateway sessions.
  • Update installation, diagnostics, documentation, and compatibility checks for both host versions.
  • Bump the plugin to 0.2.18 and update source-map-js to the patched 1.2.2 release.

Description

Adds a V2 host adapter, tool registration, native approval integration, session handling, and shared-service lifecycle support. The installer selects the appropriate entrypoint, backs up recognized generated wrappers, and preserves custom wrappers for manual migration. Setup guidance and bundled skills cover both versions.

Adds packed-package V2 checks alongside the V1 checks. The dependency lockfile also upgrades the development dependency source-map-js from 1.2.1 to 1.2.2 to address the open Dependabot advisory.

Reason

OpenCode V2 changed its plugin and server APIs, preventing the existing plugin from loading. Users need a migration path that preserves V1 compatibility and their configuration.

Decisions

  • Entrypoints: Keep the callable V1 default export and use /v2 because a combined object export would exclude older supported V1 releases.
  • Runtime: Retain Node 20 support for V1; require Node 22 or newer for the V2 gateway because of the V2 client runtime.
  • Configuration: Automatically migrate only recognized generated wrappers; preserve custom wrappers and provide migration guidance.
  • Dependencies: Refresh the compatible transitive dependency in the lockfile without introducing an override.

Testing

  • npm test: 1,306 passed; one pre-existing skip.
  • npm run typecheck, npm run build, and npm run lint: passed; lint retains existing warnings.
  • npm audit: zero vulnerabilities; npm ls source-map-js resolves 1.2.2.
  • scripts/smoke-loader.sh: packed-plugin checks passed on OpenCode 1.15.0, 1.18.35, and 1.19.0, including tools, sessions, approvals, and cancellation.
  • scripts/smoke-v2.mjs: packed-plugin checks passed on OpenCode 2.0.26, including gateway conversations, approvals, timeout/cancel cleanup, agent selection, compaction, service recovery, and plugin reload.
  • Latest V1 SDK/plugin typecheck and 24 contract tests passed; V1 tool loading also passed on Node 20.20.2.
  • install.sh --no-setup exercised against a temporary configuration directory: generated the V2 wrapper without changing the active installation. Wrapper tests cover upgrades, downgrades, and preservation of custom content.
  • Reviewer checks: use the README's V1 and V2 wrapper examples, then run inkbox-opencode doctor; expect the matching entrypoint and host configuration to be recognized. With configured test credentials, confirm a gateway conversation completes and native permission rules are honored. Live external messaging was not exercised.

Related PRs

None.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Comment on lines +53 to +65
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- run: bash tests/ci/npm_with_retry.sh ci
- run: bash tests/ci/npm_with_retry.sh install -g @opencode/cli@latest
- run: npm run build
- run: |
ARCHIVE=$(npm pack --silent | tail -1)
node scripts/smoke-v2.mjs "$ARCHIVE"
Comment on lines +78 to +95
runs-on: blacksmith-2vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
version: ["2.0.26", "latest"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- run: bash tests/ci/npm_with_retry.sh ci
- run: bash tests/ci/npm_with_retry.sh install -g @opencode/cli@${{ matrix.version }}
- run: npm run build
- name: Packed V2 host contract
run: |
ARCHIVE=$(npm pack --silent | tail -1)
node scripts/smoke-v2.mjs "$ARCHIVE"
@alex-w-99
alex-w-99 marked this pull request as ready for review October 14, 2026 20:02
@alex-w-99
alex-w-99 merged commit cf312e3 into main Oct 14, 2026
18 checks passed
@alex-w-99
alex-w-99 deleted the feature/opencode-v2-compatibility branch October 14, 2026 20:02
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