feat(opencode): support opencode 2.x + generation-aware installer
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.
This commit is contained in:
1 parent
1d3b2499cc
commit
ed34998cb7
4 files changed
+490
-228
No files matched your search
+26
-5
@@ -6,7 +6,18 @@ Arka AI — OpenAI-совместимый API (`https://api.arka-ai.ru/v1`). В
|
||||
|
||||
Нужен [API-ключ Arka AI](https://arka-ai.ru/docs/account/api-keys). Секрет ключа показывается **один раз** при создании.
|
||||
|
||||
Плагин один и тот же для **терминала (CLI)** и **OpenCode Desktop** (окно + тот же sidecar). Меняется только способ запуска установщика и то, как в процесс попадает ключ.
|
||||
Один установщик работает для **терминала (CLI)** и **OpenCode Desktop** (окно + тот же sidecar). Меняется только способ запуска установщика и то, как в процесс попадает ключ.
|
||||
|
||||
## Поколения OpenCode (1.x и 2.x)
|
||||
|
||||
OpenCode 2.x сменил API плагинов: старый плагин провайдера в 2.x **не загружается**. Поэтому установщик сам определяет поколение (`opencode --version`) и ставит нужный механизм:
|
||||
|
||||
| OpenCode | Где живёт провайдер | Список моделей |
|
||||
|---|---|---|
|
||||
| **1.x** | плагин `plugins/arka-ai.ts` (инжектит провайдера через `config`-хук) | динамический (публичный каталог, кэш 24 ч) |
|
||||
| **2.x** | статический блок `providers["Arka-AI"]` в `opencode.jsonc` | статический (обновляется `--refresh`) |
|
||||
|
||||
Определить вручную: `opencode --version` печатает `1.x.y` на 1.x и `opencode v2.x.y` на 2.x. Принудительно: `--gen 1` / `--gen 2` (или `OPENCODE_GEN=1|2`). Если `opencode` ещё не установлен — по умолчанию ставится вариант для 2.x.
|
||||
|
||||
---
|
||||
|
||||
@@ -127,7 +138,8 @@ powershell -ExecutionPolicy Bypass -Command "iwr -useb https://git.arka-ai.ru/ar
|
||||
|
||||
| Куда | Что |
|
||||
|------|-----|
|
||||
| `~/.config/opencode/plugins/arka-ai.ts` (Windows: `%USERPROFILE%\.config\opencode\plugins\arka-ai.ts`) | Плагин провайдера **Arka-AI** |
|
||||
| `~/.config/opencode/plugins/arka-ai.ts` (Windows: `%USERPROFILE%\.config\opencode\plugins\arka-ai.ts`) | Плагин провайдера **Arka-AI** — **только OpenCode 1.x** |
|
||||
| `~/.config/opencode/opencode.jsonc` → `providers["Arka-AI"]` | Провайдер **Arka-AI** — **OpenCode 2.x** (статические модели + `baseURL` + ключ; плагин не нужен) |
|
||||
| `…/skills/arka-provider/SKILL.md` | Skill: как обновить каталог и сменить модель |
|
||||
| `…/.arka-api-key` | Ключ для CLI и Desktop (GUI без login-shell) |
|
||||
| `~/.bashrc` / `.zshrc` / `.profile` | `export ARKA_API_KEY=…` (только POSIX-установщик) |
|
||||
@@ -162,6 +174,14 @@ powershell -ExecutionPolicy Bypass -Command "iwr -useb https://git.arka-ai.ru/ar
|
||||
|
||||
## Обновить каталог
|
||||
|
||||
**OpenCode 2.x** (статический список): перегенерировать модели из каталога, ничего больше не трогая:
|
||||
|
||||
```bash
|
||||
bash install-arka-provider.sh --refresh
|
||||
```
|
||||
|
||||
**OpenCode 1.x** (динамический каталог): сбросить кэш —
|
||||
|
||||
macOS / Linux:
|
||||
|
||||
```bash
|
||||
@@ -196,6 +216,7 @@ curl -sS https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.jso
|
||||
| Модели есть, запросы 401 | Файл `.arka-api-key`; на Windows — User env и трей; Desktop не читает bashrc |
|
||||
| Каталог не меняется | Удалить кэш `arka-ai-models.json` и рестарт |
|
||||
| Ошибка импорта плагина | Снова запустить установщик |
|
||||
| В логе `failed to load plugin … arka-ai.ts` (OpenCode 2.x) | Плагин 1.x несовместим с 2.x; запустить установщик ещё раз (на 2.x он отключит плагин и запишет `providers["Arka-AI"]`) |
|
||||
| `curl` / `irm` отдаёт HTML | Нужен путь `/raw/branch/main/…`, не страница репозитория |
|
||||
| Поставили в WSL, Desktop пустой | Native Windows Desktop смотрит в `%USERPROFILE%\.config\opencode`, не в home WSL — ставьте `.ps1` |
|
||||
| Плагин в `%APPDATA%\opencode`, эффекта нет | Нужен `%USERPROFILE%\.config\opencode` |
|
||||
@@ -206,9 +227,9 @@ curl -sS https://git.arka-ai.ru/arka/public/raw/branch/main/opencode/catalog.jso
|
||||
|
||||
| Файл | Назначение |
|
||||
|------|------------|
|
||||
| `install-arka-provider.sh` | Установщик для macOS, Linux, WSL, Git Bash |
|
||||
| `install-arka-provider.ps1` | Установщик для Windows (CLI и Desktop) |
|
||||
| `plugins/arka-ai.ts` | Исходник плагина (встроен в оба установщика) |
|
||||
| `install-arka-provider.sh` | Установщик для macOS, Linux, WSL, Git Bash (определяет поколение opencode) |
|
||||
| `install-arka-provider.ps1` | Установщик для Windows (CLI и Desktop; определяет поколение) |
|
||||
| `plugins/arka-ai.ts` | Исходник плагина провайдера — **OpenCode 1.x** (встроен в установщики) |
|
||||
| `skills/arka-provider/SKILL.md` | Исходник skill (встроен в оба установщика) |
|
||||
| `catalog.json` | Каталог чат-моделей, обновляется ежедневно в 05:00 по Москве |
|
||||
| `README.md` | Эта страница — можно копировать в раздел «агентные помощники» на arka-ai.ru |
|
||||
|
||||
Reference in new issue
Block a user