cvc-catalog-sync-plugin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mikel38487
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,284 @@
1
+ # CVC catalog sync
2
+
3
+ [![CI](https://github.com/mikel38487/cvc-catalog-sync-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/mikel38487/cvc-catalog-sync-plugin/actions/workflows/ci.yml)
4
+ [![CodeQL](https://github.com/mikel38487/cvc-catalog-sync-plugin/actions/workflows/codeql.yml/badge.svg)](https://github.com/mikel38487/cvc-catalog-sync-plugin/actions/workflows/codeql.yml)
5
+ [![npm](https://img.shields.io/npm/v/cvc-catalog-sync-plugin.svg)](https://www.npmjs.com/package/cvc-catalog-sync-plugin)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ Keeps the CheapVibeCode route's model list in the DSH profile patch in sync with
9
+ the provider catalog and with the reasoning levels published by the official
10
+ CheapVibeCode installer.
11
+
12
+ ## Install
13
+
14
+ Requires DSH `>=0.2.2-rc.3 <0.4.0`, a `cheapvibecode` route in `llm-pi-ai` with
15
+ its credential named by `apiKeyEnv` (default `CVC_DEEPSEEK_API_KEY`), and Node.js
16
+ 20 or newer.
17
+
18
+ Ask the DSH agent to install the bundle from npm:
19
+
20
+ ```text
21
+ install the npm bundle cvc-catalog-sync-plugin
22
+ ```
23
+
24
+ By hand: add `"cvc-catalog-sync-plugin": "^1.0.0"` to the dependencies of
25
+ `~/.dsh/profiles/<profile>/package.json` and the package name to
26
+ `dsh.profile.bundles`, then let the profile install it. For a local checkout use
27
+ `"cvc-catalog-sync-plugin": "link:<absolute path>"` instead.
28
+
29
+ After activation the settings appear in **Settings → CVC catalog** and on the
30
+ plugin's own page in **Plugins**, between the description and the component rows.
31
+
32
+ ## Why it exists
33
+
34
+ The CVC catalog (`GET /v1/models`) changes often, and it does **not** carry
35
+ reasoning levels: only a boolean `supports_reasoning`. The levels live as a
36
+ `const reasoningLevels = {...}` literal inside the official installers
37
+ (`/idhw` for PowerShell, `/idhl` for bash). DSH's built-in "get models" action
38
+ neither saves anything nor returns levels, so a catalog refresh otherwise means
39
+ hand-editing `~/.dsh/profiles/<profile>/cordis.patch.yml`.
40
+
41
+ ## What it does
42
+
43
+ 1. On activation (after a short delay) and every `intervalHours`, it fetches
44
+ `{baseURL}/models` with the route's credential and the installer's
45
+ `reasoningLevels` map.
46
+ 2. It builds `llm-pi-ai.providers.<provider>.models` with the installer's own
47
+ rules: `name` is `display_name` after ` · `, `contextWindow` is
48
+ `context_window`, `maxTokens` is `min(max_output_tokens, contextWindow)`,
49
+ `input` gains `image` when the model accepts it, `none` becomes
50
+ `off: none`, and `gpt-image*` / non-text-output models are skipped.
51
+ 3. It writes the result through `ctx.configEditor.edit()`, which preserves the
52
+ rest of the patch file, its comments and other plugins' rows, and applies the
53
+ change through `dsh-hmr` without restarting DSH.
54
+ 4. When `syncAllowlist` is on, the `subagent-model-selection-settings` list is
55
+ pruned and extended to the same model ids, leaving other providers' entries
56
+ untouched.
57
+
58
+ It writes only when the catalog or the subagent allowlist actually changed. A
59
+ response below `minModelRatio` of the current model count is refused, so a
60
+ partial or empty catalog cannot wipe a working list.
61
+
62
+ ## Tool
63
+
64
+ `cvc_catalog` — the manual entry point:
65
+
66
+ | Action | Effect |
67
+ |---|---|
68
+ | `status` | Last run in this process; no network |
69
+ | `plan` | Fetch, build, return the diff, write nothing |
70
+ | `apply` | Fetch and write (refused by the size guard unless `force: true`) |
71
+
72
+ ## Settings page
73
+
74
+ The plugin puts the same settings form in two places:
75
+
76
+ - **Settings → CVC catalog** — a section in the settings navigation with its own
77
+ icon (`settings.section` + `settings.section.icon`);
78
+ - **Plugins → CVC catalog sync → bundle page** — a configuration block between
79
+ the bundle description and its component rows (`plugins.bundle.config`, keyed
80
+ by the package name), the same seat `dshmarket` and `dsh-free-search` use.
81
+
82
+ Both edit every option from the configuration block below, read the current
83
+ values back from the profile patch, and offer three actions:
84
+
85
+ | Action | Effect |
86
+ |---|---|
87
+ | **Save** | Validates the form and writes the row config into the profile patch through `configEditor.edit()`. Values equal to the bundle defaults remove the override, so the patch keeps only real changes. |
88
+ | **Check catalog** | Fetches the catalog and the reasoning-level map, shows the diff, writes nothing. |
89
+ | **Apply catalog** | Same fetch, then writes the models and the subagent allowlist. Asks for confirmation first. |
90
+
91
+ The page also shows the last run: catalog / current / next model counts, the
92
+ level source, added / removed / changed models, allowlist changes, warnings and
93
+ the patch path. Check and apply use the **saved** settings, so press Save first;
94
+ the page marks unsaved changes.
95
+
96
+ The page talks to the host through `/cvc-catalog-sync` (`state`, `config`, `run`)
97
+ on the DSH web server. The browser never receives the API key: the host resolves
98
+ the credential by name. Writes require `application/json` and reject cross-site
99
+ requests.
100
+
101
+ ## Configuration
102
+
103
+ Override the row in the profile patch by id `cvc-catalog-sync` — or use the
104
+ settings page, which writes the same row:
105
+
106
+ ```yaml
107
+ - id: cvc-catalog-sync
108
+ name: 'cvc-catalog-sync-plugin'
109
+ config:
110
+ entryId: llm-pi-ai # profile patch row that owns the routes
111
+ provider: cheapvibecode # route key inside llm-pi-ai.providers
112
+ apiKeyEnv: CVC_DEEPSEEK_API_KEY # credential reference, never the value
113
+ baseURL: https://ru.cheapvibecode.ru/v1
114
+ installerUrls: # reasoning-level maps, first reachable wins
115
+ - https://ru.cheapvibecode.ru/idhw
116
+ - https://ru.cheapvibecode.ru/idhl
117
+ autoSync: true # startup + interval runs
118
+ intervalHours: 24 # 0 disables the timer; below 1 minute it is raised
119
+ startupDelayMs: 5000
120
+ minModelRatio: 0.8 # refuse a smaller catalog
121
+ keepModels: [] # ids to keep even when the catalog drops them
122
+ syncAllowlist: true
123
+ allowlistEntryId: subagent-model-selection-settings
124
+ levelsCacheMinutes: 360
125
+ timeoutMs: 30000
126
+ ```
127
+
128
+ A route configured with `modelOverrides` is refused with an explicit error: DSH
129
+ does not accept `modelOverrides` beside a `models` list, so such a route must be
130
+ converted to an explicit list first.
131
+
132
+ Because a local bundle is linked by directory rather than copied, editing its
133
+ files does not load new code by itself: DSH picks the new module up after a
134
+ profile reconcile (any patch-file change) or an application restart.
135
+
136
+ ## Limits
137
+
138
+ - Levels are scraped from the installer, not from an API. If both installer URLs
139
+ are unreachable, existing levels are preserved and only new models fall back to
140
+ the full `supports_reasoning` row; the run reports `levelsSource: none`.
141
+ - The CVC catalog is not filtered by key: `/v1/models` lists every model, while
142
+ availability is decided per request (`403 This model is not enabled for the
143
+ API key`). The plugin therefore cannot hide models your key cannot call.
144
+ - The DSH schema constrains the **keys** of `reasoningEfforts`
145
+ (`off/minimal/low/medium/high/xhigh/max`); values are arbitrary wire
146
+ spellings. That is why the installer's `thinking` level travels as
147
+ `high: thinking`, and the plugin reproduces it.
148
+ - A model whose catalog entry declares no modalities keeps the current entry's
149
+ `input`; a declared `supports_vision: false` drops `image`.
150
+
151
+ ## Verify and roll back
152
+
153
+ ```powershell
154
+ # plan without writing
155
+ cvc_catalog action=plan
156
+ # copy the patch before the first apply
157
+ Copy-Item ~\.dsh\profiles\desktop\cordis.patch.yml ~\.dsh\profiles\desktop\cordis.patch.yml.bak-manual
158
+ cvc_catalog action=apply
159
+ ```
160
+
161
+ `git` is not used for the profile; a file copy is the rollback.
162
+
163
+ ## Tests
164
+
165
+ ```powershell
166
+ node --test test/self-test.mjs test/integration.mjs test/settings-api.mjs test/client-render.mjs
167
+ ```
168
+
169
+ - `self-test.mjs` — pure functions: catalog parsing, level mapping, model build, diff.
170
+ - `integration.mjs` — the tool against a fake `ctx` with the real `configEditor`
171
+ contract: apply, guard, allowlist repair, edits made under the lock.
172
+ - `settings-api.mjs` — the HTTP settings route: state, validation, save, run,
173
+ cross-site refusal.
174
+ - `client-render.mjs` — renders the settings page with a fake React, so a render
175
+ error fails here instead of leaving an empty settings slot.
176
+
177
+ ## Security
178
+
179
+ See [SECURITY.md](SECURITY.md). Zero runtime dependencies; the plugin contacts
180
+ only the configured `baseURL` and installer URLs; the API key never reaches the
181
+ browser; npm releases carry provenance from GitHub Actions.
182
+
183
+ ## License
184
+
185
+ MIT © 2026 mikel38487
186
+
187
+ ---
188
+
189
+ # Синхронизация каталога CVC
190
+
191
+ Держит список моделей маршрута CheapVibeCode в профильном патче DSH в
192
+ соответствии с каталогом провайдера и с уровнями мышления из официального
193
+ установщика CheapVibeCode.
194
+
195
+ ## Зачем
196
+
197
+ Каталог CVC (`GET /v1/models`) меняется часто и **не содержит** уровней
198
+ мышления — только булев `supports_reasoning`. Уровни лежат литералом
199
+ `const reasoningLevels = {...}` внутри установщиков (`/idhw` для PowerShell,
200
+ `/idhl` для bash). Штатное действие DSH «получить список моделей» ничего не
201
+ сохраняет и уровней не возвращает, поэтому обновление каталога иначе — ручная
202
+ правка `~/.dsh/profiles/<профиль>/cordis.patch.yml`.
203
+
204
+ ## Что делает
205
+
206
+ 1. При активации (после короткой задержки) и каждые `intervalHours` забирает
207
+ `{baseURL}/models` ключом маршрута и карту `reasoningLevels` установщика.
208
+ 2. Собирает `llm-pi-ai.providers.<provider>.models` по правилам самого
209
+ установщика: `name` — хвост `display_name` после ` · `, `contextWindow` —
210
+ `context_window`, `maxTokens` — `min(max_output_tokens, contextWindow)`,
211
+ `input` получает `image`, если модель его принимает, `none` превращается в
212
+ `off: none`, а `gpt-image*` и модели без текстового вывода пропускаются.
213
+ 3. Пишет результат через `ctx.configEditor.edit()`: сохраняются остальные
214
+ строки патча, комментарии и чужие плагины, а изменение применяется через
215
+ `dsh-hmr` без перезапуска DSH.
216
+ 4. При включённом `syncAllowlist` список `subagent-model-selection-settings`
217
+ приводится к тем же id моделей; записи других провайдеров не трогаются.
218
+
219
+ Запись выполняется только при реальном изменении каталога или списка
220
+ `allowedModels`. Ответ меньше `minModelRatio` от текущего числа моделей
221
+ отклоняется: частичный или пустой каталог не должен стирать рабочий список.
222
+
223
+ ## Инструмент
224
+
225
+ `cvc_catalog` — ручная точка входа:
226
+
227
+ | Действие | Что делает |
228
+ |---|---|
229
+ | `status` | Последний прогон в этом процессе; без сети |
230
+ | `plan` | Забрать, собрать, показать разницу, ничего не записывать |
231
+ | `apply` | Забрать и записать (защита от усыхания каталога, обходится `force: true`) |
232
+
233
+ ## Настройка
234
+
235
+ Страница **Настройки → Каталог CVC** редактирует все параметры из блока ниже;
236
+ та же форма открывается на странице плагина в **«Плагины»** — блоком между
237
+ описанием и списком компонентов. Кнопки: **Сохранить** (проверяет
238
+ форму и пишет строку в патч; значения, равные умолчаниям бандла, убирают
239
+ переопределение), **Проверить каталог** (дифф без записи) и **Применить каталог**
240
+ (запись моделей и списка сабагентов, с подтверждением). Там же — итог последнего
241
+ прогона: счётчики, источник уровней, добавленные/удалённые/изменённые модели,
242
+ правки списка, предупреждения и путь патча.
243
+
244
+ Проверка и применение используют **сохранённые** настройки — сначала
245
+ «Сохранить»; несохранённые изменения страница помечает.
246
+
247
+ Страница общается с хостом через `/cvc-catalog-sync` (`state`, `config`, `run`)
248
+ на веб-сервере DSH. Ключ в браузер не попадает: хост сам разрешает его по имени.
249
+ Запись требует `application/json`, межсайтовые запросы отклоняются.
250
+
251
+ Переопределение строки в профильном патче по id `cvc-catalog-sync` делает то же
252
+ самое руками — блок конфигурации в примере выше. Маршрут, настроенный через
253
+ `modelOverrides`, плагин отклоняет с понятной ошибкой: DSH не принимает
254
+ `modelOverrides` рядом с `models`, такой маршрут нужно сначала перевести на явный
255
+ список.
256
+
257
+ Локальный бандл подключён ссылкой на каталог, а не копией: правка файлов сама
258
+ новый код не поднимает — DSH подхватит модуль после реконсиляции профиля
259
+ (любое изменение патча) или перезапуска приложения.
260
+
261
+ ## Ограничения
262
+
263
+ - Уровни вытаскиваются из установщика, а не из API. Если оба URL недоступны,
264
+ текущие уровни сохраняются, а новые модели получают полный ряд по
265
+ `supports_reasoning`; прогон сообщает `levelsSource: none`.
266
+ - Каталог CVC не фильтруется по ключу: `/v1/models` показывает всё, а
267
+ доступность решается конкретным запросом (`403 This model is not enabled for
268
+ the API key`). Скрыть модели, которые ключ не обслуживает, плагин не может.
269
+ - Схема DSH ограничивает **ключи** `reasoningEfforts`
270
+ (`off/minimal/low/medium/high/xhigh/max`), а значения — произвольное проводное
271
+ написание. Поэтому уровень `thinking` из установщика едет как `high: thinking`,
272
+ и плагин повторяет это правило.
273
+ - Модель, у которой каталог не объявил модальности, сохраняет текущий `input`;
274
+ явный `supports_vision: false` убирает `image`.
275
+
276
+ ## Проверка и откат
277
+
278
+ ```powershell
279
+ cvc_catalog action=plan
280
+ Copy-Item ~\.dsh\profiles\desktop\cordis.patch.yml ~\.dsh\profiles\desktop\cordis.patch.yml.bak-manual
281
+ cvc_catalog action=apply
282
+ ```
283
+
284
+ Профиль не под git; откат — копия файла.
package/SECURITY.md ADDED
@@ -0,0 +1,118 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ | Version | DSH | Support |
6
+ | --- | --- | --- |
7
+ | 1.x | `>=0.2.2-rc.3 <0.4.0` | security fixes |
8
+
9
+ ## Reporting a vulnerability
10
+
11
+ Please do not open a public issue for a security problem.
12
+
13
+ 1. Use **Security → Report a vulnerability** on this repository (GitHub private
14
+ vulnerability reporting).
15
+ 2. Include the plugin version, the DSH version, the steps to reproduce, and the
16
+ impact you expect.
17
+
18
+ You can expect an initial answer within 7 days and a fix or a mitigation plan
19
+ within 30 days for confirmed reports.
20
+
21
+ ## Scope
22
+
23
+ The plugin makes network requests only to addresses from its own configuration:
24
+
25
+ - `GET {baseURL}/models` with the credential that DSH resolves by name
26
+ (`apiKeyEnv`);
27
+ - `GET` to each configured installer URL (default
28
+ `https://ru.cheapvibecode.ru/idhw` and `/idhl`);
29
+ - the settings page talks only to the plugin's own `/cvc-catalog-sync` routes on
30
+ the same origin.
31
+
32
+ There is no telemetry, no analytics, and no other outbound host. The package has
33
+ zero runtime dependencies.
34
+
35
+ The plugin writes two configuration rows of the DSH profile patch
36
+ (`llm-pi-ai` models and `subagent-model-selection-settings.allowedModels`) and
37
+ never puts the API key value into logs, responses, or the browser.
38
+
39
+ Out of scope: vulnerabilities in DSH itself, in the CheapVibeCode API, or in the
40
+ models the catalog describes — report those to their maintainers.
41
+
42
+ ## Hardening in this repository
43
+
44
+ - Dependabot alerts, security updates, and weekly version updates for npm and
45
+ GitHub Actions.
46
+ - CodeQL code scanning (`security-and-quality`) on every push and pull request.
47
+ - GitHub secret scanning with push protection.
48
+ - OpenSSF Scorecard results published to the code-scanning dashboard.
49
+ - Third-party actions pinned to commit SHAs.
50
+ - npm releases with provenance through npm Trusted Publishing from GitHub
51
+ Actions.
52
+
53
+ ## Accepted findings
54
+
55
+ OpenSSF Scorecard reports posture items that a single-maintainer plugin cannot
56
+ satisfy by design; they are accepted, not ignored:
57
+
58
+ | Check | Why it stays |
59
+ | --- | --- |
60
+ | Code-Review | one maintainer; there is no second reviewer |
61
+ | Branch-Protection | `main` blocks deletion and force-push; required reviews or status checks would lock out direct maintenance |
62
+ | Maintained | young repository |
63
+ | CII-Best-Practices | no OpenSSF badge application yet |
64
+ | Fuzzing | no fuzz target; robustness is covered by edge-case tests |
65
+
66
+ Everything actionable is enabled: Dependabot, CodeQL, secret scanning with push
67
+ protection, pinned actions, and provenance on npm releases.
68
+
69
+ ---
70
+
71
+ # Политика безопасности
72
+
73
+ ## Поддерживаемые версии
74
+
75
+ | Версия | DSH | Поддержка |
76
+ | --- | --- | --- |
77
+ | 1.x | `>=0.2.2-rc.3 <0.4.0` | исправления безопасности |
78
+
79
+ ## Как сообщить об уязвимости
80
+
81
+ Не открывайте публичный issue для проблемы безопасности.
82
+
83
+ 1. Используйте **Security → Report a vulnerability** в этом репозитории
84
+ (приватный advisory GitHub).
85
+ 2. Укажите версию плагина, версию DSH, шаги воспроизведения и ожидаемое
86
+ влияние.
87
+
88
+ Первый ответ — в течение 7 дней, исправление или план смягчения для
89
+ подтверждённой проблемы — в течение 30 дней.
90
+
91
+ ## Область
92
+
93
+ Плагин делает сетевые запросы только по адресам из своей конфигурации:
94
+
95
+ - `GET {baseURL}/models` с ключом, который DSH разрешает по имени (`apiKeyEnv`);
96
+ - `GET` по каждому настроенному адресу установщика (по умолчанию
97
+ `https://ru.cheapvibecode.ru/idhw` и `/idhl`);
98
+ - страница настроек ходит только в собственные маршруты `/cvc-catalog-sync` на
99
+ том же origin.
100
+
101
+ Телеметрии и аналитики нет, других внешних адресов тоже. Зависимостей ноль.
102
+
103
+ Плагин пишет две строки профильного патча DSH (`llm-pi-ai` и
104
+ `subagent-model-selection-settings.allowedModels`) и не выводит значение ключа
105
+ в логи, ответы или браузер.
106
+
107
+ Вне области: уязвимости самого DSH, API CheapVibeCode и описанных в каталоге
108
+ моделей — о них сообщайте их авторам.
109
+
110
+ ## Что включено в репозитории
111
+
112
+ - Dependabot: оповещения, security updates и еженедельные обновления npm и
113
+ GitHub Actions.
114
+ - CodeQL (`security-and-quality`) на каждый push и pull request.
115
+ - Secret scanning с push protection.
116
+ - OpenSSF Scorecard с публикацией в code scanning.
117
+ - Сторонние actions закреплены по SHA коммита.
118
+ - Публикация в npm с provenance через Trusted Publishing из GitHub Actions.