Skip to content

fix: register V2 provider through provider.transform - #6

Merged
algonacci merged 1 commit into
grikomsn:mainfrom
algonacci:fix/opencode-v2-provider-transform
Oct 3, 2026
Merged

algonacci merged 1 commit into
grikomsn:mainfrom
algonacci:fix/opencode-v2-provider-transform

Conversation

@algonacci

Copy link
Copy Markdown
Collaborator

Summary

The OpenCode 2.x entrypoint no longer loads on current OpenCode. @opencode/plugin 2.0.4 (2026-09-16) removed ctx.catalog, so setup throws:

failed to load plugin  plugin.id=orvix  cause="TypeError: undefined is not an object (evaluating 'ctx.catalog.transform')"

After that error every orvix/* model reports Model unavailable. The V2 support from #4 targeted 2.0.2, which still had catalog.

This PR makes two changes:

  • Register through ctx.provider.transform. If the provider does not exist yet, the plugin calls add({ info, models }). If the user already configured it, the plugin fills in missing provider fields with update and appends its models with models.set. User-configured provider fields and models are still never overwritten. Each model record now carries id (the OpenCode key), modelID (the exact upstream id, so managed orvix/* and BYOK ids still go upstream verbatim), and providerID.
  • Put reasoning variants in body. Variants stored reasoning_effort under settings, which configures the provider package and is never sent in the request. Selecting orvix/muse-spark-1.3#high therefore sent no reasoning_effort. Variants now use body.

The test fakes now mirror the provider editor. AGENTS.md and the README no longer mention the catalog API. A patch changeset is included.

Verification

  • npm run check: typecheck clean, 58/58 tests pass.
  • npm run package: passes.
  • End-to-end on OpenCode 2.0.21 (opencode run --standalone, isolated XDG dirs) against a local mock OpenAI-compatible server, with providers.orvix.settings.baseURL pointing at the mock:
    • Before: the plugin fails to load and orvix/glm-5.3-flash is unavailable.
    • After: the plugin loads, and requests reach /v1/chat/completions with model: "orvix/muse-spark-1.3" / "orvix/glm-5.3-flash" and a bearer key. The user's baseURL override is respected.
    • -m orvix/muse-spark-1.3#high now sends reasoning_effort: "high". Models without variants send none.
  • Not tested against the live Orvix API.

Checklist

  • The change is focused and contains no unrelated churn.
  • Tests pass with npm run check.
  • Packaging passes with npm run package.
  • User-visible changes include a Changeset; otherwise, this is not applicable.
  • Relevant documentation is updated; otherwise, this is not applicable.

🤖 Generated with Claude Code

@opencode/plugin 2.0.4 removed ctx.catalog, so the V2 entrypoint failed to
load with "ctx.catalog.transform" undefined and every orvix/* model was
unavailable. Register the provider and models through ctx.provider.transform
instead, keeping user-configured provider fields and models untouched.

Reasoning variants now put reasoning_effort in the variant body. As settings
it configured the provider package and never reached the request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@algonacci
algonacci merged commit b2c2d75 into grikomsn:main Oct 3, 2026
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