feat(opencode): opencode 2.x support + generation-aware installer #2

Merged
arka-admin merged 1 commits from feat/opencode-2x-provider into main 2026-10-27 14:48:02 +03:00
Owner

What

opencode 2.x changed the plugin API — a plugin must export default { id, setup }. The existing 1.x plugin (plugins/arka-ai.ts) therefore fails to load on 2.x (failed to load plugin … Plugin must export a default definition with an id and an effect or setup function), so the Arka-AI provider disappears. Confirmed on a 2.1.4 install.

Change

Both installers (install-arka-provider.sh, .ps1) now detect the generation and install the right mechanism:

opencode detected as provider
1.x opencode --version → 1.x.y plugin plugins/arka-ai.ts (dynamic catalog) — unchanged
2.x → opencode v2.x.y static providers["Arka-AI"] in opencode.jsonc (package @opencode/ai/providers/openai-compatible, settings.baseURL, settings.apiKey, models from catalog.json)
  • Override --gen 1|2 / -Gen 1|2 / OPENCODE_GEN.
  • On 2.x a stale 1.x plugin is disabled (arka-ai.ts → .disabled).
  • --refresh / -Refresh: 2.x regenerates the model list (infers gen 2 from the config); 1.x clears the cache.
  • Merge is non-destructive. README + SKILL.md updated.

Verified (POSIX, isolated HOME)

  • detection (opencode v2.1.4→2, 1.19.0→1);
  • 1.x → plugin; 2.x → providers["Arka-AI"] with 117 models + baseURL + apiKey;
  • merge preserves unrelated keys; stale plugin disabled; --refresh keeps the key.

Notes

  • 2.x model list is static (refresh via --refresh): opencode 2.x exposes no documented plugin hook to inject providers dynamically (ctx.provider.transform gives only internal provider class instances).
  • Windows .ps1 mirrors the logic (not executed here).
## What opencode **2.x** changed the plugin API — a plugin must `export default { id, setup }`. The existing 1.x plugin (`plugins/arka-ai.ts`) therefore **fails to load** on 2.x (`failed to load plugin … Plugin must export a default definition with an id and an effect or setup function`), so the **Arka-AI provider disappears**. Confirmed on a 2.1.4 install. ## Change Both installers (`install-arka-provider.sh`, `.ps1`) now detect the generation and install the right mechanism: | opencode | detected as | provider | |---|---|---| | 1.x | `opencode --version` → `1.x.y` | plugin `plugins/arka-ai.ts` (dynamic catalog) — unchanged | | 2.x | → `opencode v2.x.y` | static `providers["Arka-AI"]` in `opencode.jsonc` (`package @opencode/ai/providers/openai-compatible`, `settings.baseURL`, `settings.apiKey`, `models` from `catalog.json`) | - Override `--gen 1|2` / `-Gen 1|2` / `OPENCODE_GEN`. - On 2.x a stale 1.x plugin is disabled (`arka-ai.ts` → `.disabled`). - `--refresh` / `-Refresh`: 2.x regenerates the model list (infers gen 2 from the config); 1.x clears the cache. - Merge is non-destructive. README + SKILL.md updated. ## Verified (POSIX, isolated HOME) - detection (`opencode v2.1.4`→2, `1.19.0`→1); - 1.x → plugin; 2.x → `providers["Arka-AI"]` with **117** models + baseURL + apiKey; - merge preserves unrelated keys; stale plugin disabled; `--refresh` keeps the key. ## Notes - 2.x model list is **static** (refresh via `--refresh`): opencode 2.x exposes no documented plugin hook to inject providers dynamically (`ctx.provider.transform` gives only internal provider class instances). - Windows `.ps1` mirrors the logic (not executed here).
arka-admin added 1 commit 2026-10-27 12:21:22 +03:00
opencode 2.x changed the plugin API (a plugin must export { id, setup }), so
the 1.x plugin (plugins/arka-ai.ts) no longer loads there and the Arka-AI
provider disappeared ('failed to load plugin').

- install-arka-provider.sh / .ps1 now detect the generation (opencode --version:
  '1.x.y' vs 'opencode v2.x.y'; --gen / -Gen override):
    * 1.x -> install the plugin (dynamic catalog), as before;
    * 2.x -> write a static providers["Arka-AI"] block
      (package @opencode/ai/providers/openai-compatible, settings.baseURL,
      settings.apiKey, models from catalog.json) and disable any stale 1.x plugin.
- --refresh / -Refresh regenerates the 2.x model list (infers generation 2 from
  the installed config); 1.x still clears the cache.
- README + companion skill updated with the 1.x/2.x table, detection, and the
  providers schema.

Verified: gen detection, gen1 plugin write, gen2 providers write (117 models),
merge preserves unrelated keys, stale plugin disabled, refresh keeps the key.
arka-admin merged commit 38edeef6c9 into main 2026-10-27 14:48:02 +03:00
arka-admin deleted branch feat/opencode-2x-provider 2026-10-27 14:48:02 +03:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: arka/public#2