Skip to content

feat(plugin): support OpenCode V1 and V2 hosts - #6

Open
sepiabrown wants to merge 1 commit into
rmk40:mainfrom
sepiabrown:dual-host-support
Open

sepiabrown wants to merge 1 commit into
rmk40:mainfrom
sepiabrown:dual-host-support

Conversation

@sepiabrown

Copy link
Copy Markdown

Summary

  • Support OpenCode V1 and V2 from a single default export, with lazy server() and setup() adapters around the shared retrieval/indexing engine.
  • Register native V2 tools, outgoing context/compaction hooks, lifecycle cleanup, and public-client history pagination/normalization.
  • Discover an existing matching-version/channel V2 service lazily (including source-development channels), or use an explicit endpoint; never start or replace a managed service.
  • Preserve V1 supplied transport/authentication, hooks, primary-tools opt-out, and cleanup. Keep default V1/V2 derived caches separate.
  • Include the local-directory server.js bridge, packaging changes, migration documentation, and regression tests.

Compatibility and caveats

  • The combined entrypoint requires OpenCode V1 >=1.18.29; tested with V1 1.18.35 and V2 2.0.26. Older V1 loaders are not supported by this entrypoint.
  • V1 uses plugin; V2 uses plugins. The adapters read their own host's history and do not merge databases.
  • V2 hosts whose Bun directory loader aborts on missing optional entrypoints need a separate host-side fix. That OpenCode change is deliberately not included here.
  • No live service restart or global configuration change was made during validation.

Validation

  • Full Vitest suite: 611 passed, 7 skipped.
  • ESLint, test TypeScript checks, and compile/declaration generation passed.
  • Built package dry run includes both lazy host adapters and the directory bridge.
  • V1 real directory-loader/in-process API smoke test passed in ephemeral and persistent modes (scripts/test-v1-host.mjs).
  • Two isolated V2 host HTTP-server integration tests passed in a separate OpenCode checkout with the host loader fix; those host tests are not part of this repository.
  • Staged whitespace check and formatting checks on changed files passed.

Existing full-check blocker

npm run check stops at repository-wide Prettier issues in this Windows checkout (75 files, predominantly line endings). With line endings tolerated, the remaining formatting issues are two unchanged documentation files. Unrelated repository-wide reformatting was intentionally avoided. The autoformatting commit/push hooks were bypassed after running the functional checks explicitly.

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