@aiwayds/dsh-model-sync 0.1.5 → 0.2.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/README.md +23 -5
- package/README.zh-CN.md +22 -5
- package/lib/index.js +20 -8
- package/lib/index.js.map +1 -1
- package/lib/translate.d.ts +8 -0
- package/lib/translate.js +48 -5
- package/lib/translate.js.map +1 -1
- package/lib/writer.d.ts +14 -5
- package/lib/writer.js +36 -47
- package/lib/writer.js.map +1 -1
- package/package.json +9 -14
- package/src/index.ts +26 -8
- package/src/translate.ts +54 -4
- package/src/writer.ts +49 -49
package/README.md
CHANGED
|
@@ -23,13 +23,14 @@ Model lists drift: providers ship new models, retire old ones, and adjust capabi
|
|
|
23
23
|
- **pi.dev gateway sync.** Fetches each managed route's model list from `https://pi.dev/api/models/providers/<route>` with ETag/304 revalidation and a persistent per-provider cache under `~/.dsh/models-store.json` (`remote-catalog.ts`). Transient failures and aborts keep the last-good cache; a 404/501 treats the route as absent for the round.
|
|
24
24
|
- **Default routes.** When `managedRoutes` is empty, these pi.dev routes are synced: `opencode-go`, `zai-coding-cn`, `minimax-cn`, `xiaomi-token-plan-cn` (`DEFAULT_ROUTES` in `src/index.ts`).
|
|
25
25
|
- **Two write modes** (`writeMode`):
|
|
26
|
-
- `settings` — the zero-patch pipeline: fetch → translate → `settings.mutate`. Self-contained; never touches `settings.yaml` directly, only via the official settings API.
|
|
27
|
-
- `overlay` (
|
|
26
|
+
- `settings` (default) — the zero-patch pipeline: fetch → translate → `settings.mutate`. Self-contained; never touches `settings.yaml` directly, only via the official settings API.
|
|
27
|
+
- `overlay` (legacy) — delegates to the patched `dsh-llm-pi-ai` adapter's `piAiCatalog.refresh()` and merges pi.dev entries in memory (requires the optional patch).
|
|
28
28
|
- **Scheduled refresh.** `intervalMinutes` auto rounds (default 240 / 4h) plus a `startupDelaySeconds` initial delay (default 5); each round logs the same report a manual refresh produces. `0` disarms the interval (startup-only). The interval re-arms live when the config changes (`src/index.ts`).
|
|
29
29
|
- **Change reporting / diff.** Every round reports added/removed model ids (`diffModelIds`), and in `settings` mode added/removed/changed entries against the current raw settings (`diffEntries`, `diff.ts`). Dropped and degraded entries are reported with their reasons.
|
|
30
30
|
- **`modelSync` service.** Exposes a `modelSync` service (`syncNow()`) that a UI can call to force one refresh round and read the report.
|
|
31
31
|
- **`/model-sync` command.** The plugin registers a `/model-sync` slash command itself through the shared dsh command registry (`@deepseek-ai/dsh-commands`), so every interactive UI lists it automatically — no UI-side wiring. Running it forces one sync round on the spot and prints the same report the scheduled rounds log; the sync scope is decided by `managedRoutes` (arguments are ignored). The registry is an optional peer: hosts without a command registry still get the scheduled rounds and the `modelSync` service.
|
|
32
|
-
- **Translation rules.** pi.dev entries are translated into settings-writable model profiles (`translate.ts`): base-matching vs base-less classification, `reasoningEfforts` derivation (S2 gate), `compat` gating to `openai-completions` (S5 gate), `maxTokens` handling, and drop logic for mixed-protocol routes.
|
|
32
|
+
- **Translation rules.** pi.dev entries are translated into settings-writable model profiles (`translate.ts`): base-matching vs base-less classification, `reasoningEfforts` derivation (S2 gate), `compat` gating to `openai-completions` (S5 gate), `maxTokens` handling, and drop logic for mixed-protocol routes. Capacity values get a sanity gate: a `contextWindow` that is not a positive integer, or a `maxTokens` that is not a positive integer strictly below the context window (listings sometimes echo the context window into `maxTokens`), is skipped with a degrade warning instead of written.
|
|
33
|
+
- **Your overrides are durable.** `modelOverrides` is your own per-model channel (think levels, narrowed context windows); the sync never consumes or deletes it. Override fields win over the synced values per model and keep winning on every future round.
|
|
33
34
|
- **Safe-by-default options:**
|
|
34
35
|
- `keepBuiltinOnly: true` — keep built-in catalog models that are not (yet) on pi.dev, so adopting the sync doesn't delete models you already use.
|
|
35
36
|
- `dropUnserviceable: true` — drop unserviceable entries and continue; set to `false` to abort the whole route instead of writing a partial list.
|
|
@@ -47,7 +48,7 @@ dsh plugin add @aiwayds/dsh-model-sync
|
|
|
47
48
|
|
|
48
49
|
The package ships `cordis.patch.yml` (wired as `dsh.bundle.patch`), which mounts the plugin into the profile's assembly tree under the stable plugin id `dsh-model-sync` and registers the `model-sync` settings namespace.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
This plugin ships standalone — install it explicitly with `dsh plugin add @aiwayds/dsh-model-sync` when you want it.
|
|
51
52
|
|
|
52
53
|
## Usage
|
|
53
54
|
|
|
@@ -55,13 +56,14 @@ Configure the plugin under the `model-sync` namespace in `settings.yaml` — eve
|
|
|
55
56
|
|
|
56
57
|
| Key | Default | Description |
|
|
57
58
|
|---|---|---|
|
|
58
|
-
| `writeMode` | `'
|
|
59
|
+
| `writeMode` | `'settings'` | Zero-patch pipeline; `'overlay'` for the legacy patched-adapter mode |
|
|
59
60
|
| `intervalMinutes` | `240 (4h)` | Auto-refresh interval in minutes; `0` = startup-only |
|
|
60
61
|
| `startupDelaySeconds` | `5` | Delay before the first auto refresh, so the llm adapter is ready |
|
|
61
62
|
| `refreshTimeoutMs` | `120000` | Abort budget for one refresh round's network request (min `1000`) |
|
|
62
63
|
| `managedRoutes` | `[]` | Routes to sync; empty = the default pi.dev routes |
|
|
63
64
|
| `keepBuiltinOnly` | `true` | Keep built-in-only models not present on pi.dev (smooth migration) |
|
|
64
65
|
| `dropUnserviceable` | `true` | Drop unserviceable entries; `false` aborts the route instead |
|
|
66
|
+
| `syncNotify` | `false` | Notify on changes (logger + `/model-sync` report) |
|
|
65
67
|
| `forceMaxReasoningEffort` | `false` | Force max reasoning effort on models with a non-empty `thinkingFormat` |
|
|
66
68
|
|
|
67
69
|
Example:
|
|
@@ -77,6 +79,22 @@ model-sync:
|
|
|
77
79
|
|
|
78
80
|
The plugin writes to the `llm-pi-ai` namespace (`providers.<route>.models`) — the same document the adapter consumes — and only for the routes it manages. During migration, `keepBuiltinOnly` preserves models that exist in your installed built-in catalog but aren't on pi.dev yet.
|
|
79
81
|
|
|
82
|
+
### Capacity values are upper limits, not your runtime settings
|
|
83
|
+
|
|
84
|
+
Synced `contextWindow` / `maxTokens` describe what the **model** accepts at most, as advertised by the gateway listing — not what your deployment is configured for. dsh resolves the settings-written value over the installed catalog, and a written `maxTokens` becomes the request-level default. Pointing a route at a local or proxied endpoint that serves a smaller context (vLLM / Ollama and friends) while carrying catalog-sized capacities is a known recipe for the "output token limit reached" family of failures.
|
|
85
|
+
|
|
86
|
+
If you need a model to run under a smaller budget, set it in `modelOverrides` under the same route — override fields win over the synced values, and the sync preserves your overrides across rounds:
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
providers:
|
|
90
|
+
zai-coding-cn:
|
|
91
|
+
modelOverrides:
|
|
92
|
+
glm-5.3:
|
|
93
|
+
contextWindow: 32768
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Note that listing data itself can be noisy: values are sanity-gated (positive integers; `maxTokens` strictly below `contextWindow`), and stripped values show up in the sync report as `DEGRADED` lines with reasons.
|
|
97
|
+
|
|
80
98
|
### Manual refresh: the `/model-sync` command
|
|
81
99
|
|
|
82
100
|
Type `/model-sync` in any interactive UI to force one sync round on the spot. The plugin registers the command in the shared command registry (`@deepseek-ai/dsh-commands`), and UIs discover it automatically. It returns the same report the scheduled rounds log. The sync scope is decided by `managedRoutes`; any arguments typed after the command are ignored. Hosts without a command registry degrade gracefully — the scheduled rounds and the `modelSync` service keep working.
|
package/README.zh-CN.md
CHANGED
|
@@ -23,13 +23,14 @@ https://github.com/user-attachments/assets/c3f9c8b1-ea5e-470c-b8a8-60a81fc5c20a
|
|
|
23
23
|
- **pi.dev 网关同步。** 从 `https://pi.dev/api/models/providers/<route>` 拉取每条受管路由的模型列表,带 ETag/304 revalidation,并在 `~/.dsh/models-store.json` 维护按 provider 持久化的缓存(`remote-catalog.ts`)。瞬时故障与中断保留上次成功的缓存(last-good);404/501 视为该路由本轮不存在。
|
|
24
24
|
- **默认路由。** `managedRoutes` 为空时,同步以下 pi.dev 路由:`opencode-go`、`zai-coding-cn`、`minimax-cn`、`xiaomi-token-plan-cn`(`src/index.ts` 的 `DEFAULT_ROUTES`)。
|
|
25
25
|
- **两种写模式**(`writeMode`):
|
|
26
|
-
- `settings
|
|
27
|
-
- `overlay
|
|
26
|
+
- `settings`(默认)——零补丁流水线:fetch → translate → `settings.mutate`。自包含,从不直接改写 `settings.yaml`,只经官方 settings API 落盘。
|
|
27
|
+
- `overlay`(旧方案)——委托打了补丁的 `dsh-llm-pi-ai` 适配器的 `piAiCatalog.refresh()`,把 pi.dev 条目合并进内存(需要可选补丁)。
|
|
28
28
|
- **定时刷新。** `intervalMinutes` 周期轮(默认 240,即 4 小时)加 `startupDelaySeconds` 启动延迟(默认 5 秒);每轮自动刷新输出的报告与手动刷新完全相同。`0` 表示关闭周期(仅启动时刷一次)。配置变更时周期会实时重新挂载(`src/index.ts`)。
|
|
29
29
|
- **变更报告 / diff。** 每轮报告新增/移除的模型 id(`diffModelIds`);`settings` 模式下还会对照当前原始 settings 报告新增/移除/变更的条目(`diffEntries`,`diff.ts`)。被丢弃(dropped)与降级(degraded)的条目连同原因一并报告。
|
|
30
30
|
- **`modelSync` 服务。** 对外暴露 `modelSync` 服务(`syncNow()`),UI 调用它即可强制跑一轮刷新并读取报告。
|
|
31
31
|
- **`/model-sync` 命令。** 插件自行通过共享的 dsh 命令注册表(`@deepseek-ai/dsh-commands`)注册 `/model-sync` 斜杠命令,所有交互式 UI 自动发现并列出——UI 侧零配合。执行它当场强制跑一轮刷新,输出的报告与定时轮完全相同;同步范围由 `managedRoutes` 决定(参数会被忽略)。命令注册表是可选 peer:没有命令注册服务的宿主照常降级,定时刷新与 `modelSync` 服务不受影响。
|
|
32
|
-
- **翻译规则。** pi.dev 条目被翻译成 settings 可写的模型 profile(`translate.ts`):base-matching 与 base-less 分类、`reasoningEfforts` 推导(S2 gate)、`compat` 门控到 `openai-completions`(S5 gate)、`maxTokens`
|
|
32
|
+
- **翻译规则。** pi.dev 条目被翻译成 settings 可写的模型 profile(`translate.ts`):base-matching 与 base-less 分类、`reasoningEfforts` 推导(S2 gate)、`compat` 门控到 `openai-completions`(S5 gate)、`maxTokens` 处理,以及混合协议路由的丢弃逻辑。容量值另有卫生门:非正整数的 `contextWindow`,或不是「严格小于 contextWindow 的正整数」的 `maxTokens`(有的列表会把 context window 回声填进 maxTokens),一律跳过不写,并在报告中以降级警告说明。
|
|
33
|
+
- **你的覆盖不会被吃掉。** `modelOverrides` 是你自己的按模型调整通道(think level、收窄 context window 等);同步永不消费或删除它。覆盖字段按模型逐字段压过同步值,且此后每一轮都保持生效。
|
|
33
34
|
- **默认安全的开关:**
|
|
34
35
|
- `keepBuiltinOnly: true`——保留内置目录里有、但 pi.dev 上(还)没有的模型,启用同步不会删掉你正在用的模型。
|
|
35
36
|
- `dropUnserviceable: true`——丢弃不可服务的条目并继续;设为 `false` 则改为中止整条路由,而不是写入残缺列表。
|
|
@@ -47,7 +48,7 @@ dsh plugin add @aiwayds/dsh-model-sync
|
|
|
47
48
|
|
|
48
49
|
包内附带 `cordis.patch.yml`(经 `dsh.bundle.patch` 接线),它把插件挂载进 profile 的装配树(稳定的插件 id `dsh-model-sync`),并注册 `model-sync` settings 命名空间。
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
本插件独立分发——需要时用 `dsh plugin add @aiwayds/dsh-model-sync` 显式安装即可。
|
|
51
52
|
|
|
52
53
|
## 用法
|
|
53
54
|
|
|
@@ -55,7 +56,7 @@ dsh plugin add @aiwayds/dsh-model-sync
|
|
|
55
56
|
|
|
56
57
|
| 键 | 默认值 | 说明 |
|
|
57
58
|
|---|---|---|
|
|
58
|
-
| `writeMode` | `'
|
|
59
|
+
| `writeMode` | `'settings'` | 零补丁流水线;`'overlay'` 走旧的补丁适配器模式 |
|
|
59
60
|
| `intervalMinutes` | `240 (4h)` | 自动刷新间隔(分钟);`0` = 仅启动时刷新 |
|
|
60
61
|
| `startupDelaySeconds` | `5` | 首次自动刷新前的延迟,等 llm 适配器就绪 |
|
|
61
62
|
| `refreshTimeoutMs` | `120000` | 单轮刷新网络请求的中断预算(最小 `1000`) |
|
|
@@ -78,6 +79,22 @@ model-sync:
|
|
|
78
79
|
|
|
79
80
|
插件写入的是 `llm-pi-ai` 命名空间(`providers.<route>.models`)——与适配器消费的是同一份文档——并且只写它管理的路由。迁移期间,`keepBuiltinOnly` 会保留已安装内置目录中存在、但 pi.dev 上还没有的模型。
|
|
80
81
|
|
|
82
|
+
### 容量值是模型上限,不是你的运行时实配
|
|
83
|
+
|
|
84
|
+
同步进来的 `contextWindow` / `maxTokens` 描述的是**模型**在网关列表里宣称的上限,不是你的部署实际配置的值。dsh 解析时 settings 写入的值会压过内置目录,且写入的 `maxTokens` 会成为请求级默认值。如果某条路由实际指向一个上下文更小的本地/代理端点(vLLM / Ollama 之类),却带着目录级的容量值,正是 "Output token limit reached" 一族故障的常见配方(参见上游 #1166)。
|
|
85
|
+
|
|
86
|
+
需要某个模型在更小的预算下运行时,把它写进同路由的 `modelOverrides`——覆盖字段按模型压过同步值,且同步会跨轮保留你的覆盖:
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
providers:
|
|
90
|
+
zai-coding-cn:
|
|
91
|
+
modelOverrides:
|
|
92
|
+
glm-5.3:
|
|
93
|
+
contextWindow: 32768
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
另外列表数据本身可能有噪声:容量值有卫生门(正整数;`maxTokens` 必须严格小于 `contextWindow`),被剥离的值会在同步报告里以 `DEGRADED` 行连同原因出现。
|
|
97
|
+
|
|
81
98
|
### 手动刷新:`/model-sync` 命令
|
|
82
99
|
|
|
83
100
|
在任意交互式 UI 里输入 `/model-sync` 即可当场强制跑一轮同步。命令由插件自己注册进共享命令注册表(`@deepseek-ai/dsh-commands`),UI 自动发现。它返回与定时轮相同的报告;同步范围由 `managedRoutes` 决定,命令后面的参数一律忽略。没有命令注册服务的宿主会平滑降级——定时刷新与 `modelSync` 服务照常工作。
|
package/lib/index.js
CHANGED
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* what changed.
|
|
5
5
|
*
|
|
6
6
|
* Supports two write modes:
|
|
7
|
-
* - '
|
|
8
|
-
*
|
|
9
|
-
* - '
|
|
10
|
-
*
|
|
7
|
+
* - 'settings' (default): self-contained fetch → translate → settings.mutate
|
|
8
|
+
* pipeline that writes directly to settings.yaml (zero patch required)
|
|
9
|
+
* - 'overlay' (legacy): uses the patched dsh-llm-pi-ai's piAiCatalog.refresh()
|
|
10
|
+
* to overlay pi.dev entries in memory (requires patch)
|
|
11
11
|
*
|
|
12
12
|
* @module dsh-model-sync
|
|
13
13
|
*/
|
|
14
14
|
import z from '@deepseek-ai/schemastery';
|
|
15
|
-
import { settingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
16
15
|
import { diffModelIds, diffEntries } from "./diff.js";
|
|
17
16
|
import { fetchRemoteCatalog, loadModelsStore, } from "./remote-catalog.js";
|
|
18
17
|
import { translateEntries, } from "./translate.js";
|
|
@@ -21,11 +20,19 @@ import { BUILTIN_CATALOG_SNAPSHOT } from "./builtin-catalog-snapshot.js";
|
|
|
21
20
|
export const name = 'dsh-model-sync';
|
|
22
21
|
/** The settings seam this plugin consumes (its own config namespace). */
|
|
23
22
|
export const inject = ['settings'];
|
|
24
|
-
|
|
23
|
+
// dsh-settings 0.1.2-alpha.3 removed the runtime settingsNamespace() helper:
|
|
24
|
+
// register() now brand-checks the namespace at the type level
|
|
25
|
+
// (SettingsNamespaceInput) and validates the same pattern at runtime. A plain
|
|
26
|
+
// literal is the supported spelling.
|
|
27
|
+
const OWN_NS = 'model-sync';
|
|
25
28
|
/** The `model-sync` settings namespace: user-editable in settings.yaml. */
|
|
26
29
|
const ModelSyncConfig = z.object({
|
|
27
|
-
/**
|
|
28
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Write mode: 'settings' (default, zero-patch settings.mutate pipeline) or
|
|
32
|
+
* 'overlay' (legacy, delegates to the patched adapter's piAiCatalog.refresh
|
|
33
|
+
* and requires the optional patch).
|
|
34
|
+
*/
|
|
35
|
+
writeMode: z.union(['settings', 'overlay']).default('settings'),
|
|
29
36
|
/** Minutes between auto refreshes (default 240 = 4 hours); 0 = startup-only. */
|
|
30
37
|
intervalMinutes: z.number().step(1).min(0).default(240),
|
|
31
38
|
/** Delay before the first auto refresh, so the llm adapter is ready. */
|
|
@@ -71,6 +78,11 @@ export function apply(ctx) {
|
|
|
71
78
|
const syncOverlay = async (config, llm, force) => {
|
|
72
79
|
const catalog = ctx.get('piAiCatalog');
|
|
73
80
|
if (catalog?.refresh === undefined) {
|
|
81
|
+
// Degradation path (never throws): the overlay needs a hand-patched
|
|
82
|
+
// dsh-llm-pi-ai exposing piAiCatalog.refresh(). Since dsh 0.1.2-alpha.3
|
|
83
|
+
// the patch cannot even apply (it shims settingsNamespace and
|
|
84
|
+
// installSettingsSection, both removed from dsh-settings), so hosts on
|
|
85
|
+
// the alpha line always land here unless they run the settings mode.
|
|
74
86
|
return 'catalog refresh is unavailable — the dsh-llm-pi-ai remote-catalog patch is not applied; the model list is the static catalog only.';
|
|
75
87
|
}
|
|
76
88
|
let providers;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE;;;;;;;;;;;GAWG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAI7D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,gBAAgB,GAIjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,cAAc,GAIf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAA;AAEpC,yEAAyE;AACzE,MAAM,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AAE,EAAE;QACX,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,CAAC,MAAM,CAAa;KAC5B,CAAC,CAAC,CAAA;AACP,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAC/B,IAAoC,EACpC,KAAa;IAEb,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACxC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,SAAgD,CAAA;IAC7E,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC7C,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAwC,CAAA;IACzE,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC7C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAA;IAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IAC5C,OAAO,MAAgC,CAAA;AACzC,CAAC"}
|
package/lib/translate.d.ts
CHANGED
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
* - drop logic for mixed-protocol routes (§3.3 rule 13)
|
|
10
10
|
* - keepBuiltinOnly behavior (§5.2)
|
|
11
11
|
*
|
|
12
|
+
* Deviation from design doc §3.3 (rules 3/5), added 2026-08-31: capacity
|
|
13
|
+
* sanity guards. Settings-written capacities override the installed catalog
|
|
14
|
+
* (`entry.contextWindow ?? base?.contextWindow` in llm-pi-ai's catalog merge)
|
|
15
|
+
* and a written maxTokens becomes the request-level defaultMaxTokens — so a
|
|
16
|
+
* garbage listing value (non-integer, or a maxTokens that merely echoes the
|
|
17
|
+
* context window) would trip the "output token limit" family (#1166). Such
|
|
18
|
+
* values are now skipped with a degrade warning instead of written.
|
|
19
|
+
*
|
|
12
20
|
* @module dsh-model-sync/translate
|
|
13
21
|
*/
|
|
14
22
|
import type { RemoteCatalogEntry } from './remote-catalog.ts';
|
package/lib/translate.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// ---------------------------------------------------------------------------
|
|
3
3
|
// THINKING_LEVELS whitelist (§3.5)
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
|
+
/** A positive integer, the only usable shape for a capacity value. */
|
|
6
|
+
function isPositiveInt(value) {
|
|
7
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0;
|
|
8
|
+
}
|
|
5
9
|
/** Allowed thinking level keys and their valid wire-spelling constraints. */
|
|
6
10
|
const THINKING_LEVELS = new Set([
|
|
7
11
|
'off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max',
|
|
@@ -60,16 +64,55 @@ export function translateEntries(entries, builtinIds, builtinData, route, option
|
|
|
60
64
|
// Rule 2: name
|
|
61
65
|
if (entry.name !== undefined)
|
|
62
66
|
profile.name = entry.name;
|
|
63
|
-
// Rule 3: contextWindow
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
// Rule 3: contextWindow — only a positive integer is a usable capacity.
|
|
68
|
+
// A written value overrides the installed catalog at resolution time, so
|
|
69
|
+
// garbage from the listing is skipped (installed value / route default
|
|
70
|
+
// then applies) instead of propagated.
|
|
71
|
+
if (entry.contextWindow !== undefined) {
|
|
72
|
+
if (isPositiveInt(entry.contextWindow)) {
|
|
73
|
+
profile.contextWindow = entry.contextWindow;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
warnings.push({
|
|
77
|
+
id: entry.id,
|
|
78
|
+
route,
|
|
79
|
+
reason: `contextWindow ${entry.contextWindow} from the listing is not a positive integer — skipped; installed value or route default applies`,
|
|
80
|
+
severity: 'degrade',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
66
84
|
// Rule 4: input (modalities)
|
|
67
85
|
if (entry.input !== undefined && entry.input.length > 0) {
|
|
68
86
|
profile.input = [...entry.input];
|
|
69
87
|
}
|
|
70
|
-
// Rule 5: maxTokens — base-matching: strip; base-less: keep
|
|
88
|
+
// Rule 5: maxTokens — base-matching: strip; base-less: keep only when
|
|
89
|
+
// sane. base-matching strips because pi-ai falls back to the catalog
|
|
90
|
+
// value. base-less keeps the value, but only if it is a plausible output
|
|
91
|
+
// cap: a positive integer strictly below the context window. Listings
|
|
92
|
+
// sometimes echo the context window into maxTokens (e.g. grok-4.6
|
|
93
|
+
// 500000/500000); written through, it becomes the request-level
|
|
94
|
+
// defaultMaxTokens and trips the "output token limit" family — strip it
|
|
95
|
+
// with a degrade warning instead.
|
|
71
96
|
if (!isBaseMatching && entry.maxTokens !== undefined) {
|
|
72
|
-
|
|
97
|
+
if (!isPositiveInt(entry.maxTokens)) {
|
|
98
|
+
warnings.push({
|
|
99
|
+
id: entry.id,
|
|
100
|
+
route,
|
|
101
|
+
reason: `maxTokens ${entry.maxTokens} from the listing is not a positive integer — skipped; route default applies`,
|
|
102
|
+
severity: 'degrade',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else if (profile.contextWindow !== undefined && entry.maxTokens >= profile.contextWindow) {
|
|
106
|
+
warnings.push({
|
|
107
|
+
id: entry.id,
|
|
108
|
+
route,
|
|
109
|
+
reason: `maxTokens ${entry.maxTokens} >= contextWindow ${profile.contextWindow} — looks like a listing echo, skipped; route default applies`,
|
|
110
|
+
severity: 'degrade',
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
profile.maxTokens = entry.maxTokens;
|
|
115
|
+
}
|
|
73
116
|
}
|
|
74
117
|
// base-matching: don't write maxTokens (pi-ai falls back to catalog value)
|
|
75
118
|
// Rule 6: reasoning (boolean) — never write
|
package/lib/translate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translate.js","sourceRoot":"","sources":["../src/translate.ts"],"names":[],"mappings":"AAAA,oFAAoF;
|
|
1
|
+
{"version":3,"file":"translate.js","sourceRoot":"","sources":["../src/translate.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAwFpF,8EAA8E;AAC9E,mCAAmC;AACnC,8EAA8E;AAE9E,sEAA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;IACjB,CAAC;IACD,8CAA8C;IAC9C,MAAM,IAAI,GAAkC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACxE,IAAI,KAAK;QAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAA;IAC3B,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/lib/writer.d.ts
CHANGED
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
* Write translated model profiles to dsh settings via the settings.mutate API.
|
|
3
3
|
*
|
|
4
4
|
* Key behaviors (design doc §4):
|
|
5
|
-
* - Change-only writes: compare
|
|
6
|
-
* resolved values (which have
|
|
5
|
+
* - Change-only writes: compare the merged target (target ⊕ modelOverrides)
|
|
6
|
+
* against the raw user segment (desc.user), not resolved values (which have
|
|
7
|
+
* schema defaults applied)
|
|
8
|
+
* - modelOverrides are the user's own per-model channel (think levels,
|
|
9
|
+
* narrowed context windows). They are preserved forever: the synced models
|
|
10
|
+
* list is written with override fields folded in, and the overrides key is
|
|
11
|
+
* never unset or edited. (Earlier versions unset the key to "migrate" the
|
|
12
|
+
* values into models, which silently wiped them on the next round once the
|
|
13
|
+
* target was regenerated from pi.dev.)
|
|
7
14
|
* - Revision conflict retry: catch SETTINGS_CONFLICT, re-read, re-translate,
|
|
8
15
|
* re-write once
|
|
9
16
|
* - Never touches ~/.dsh/settings.yaml directly — only through settings.mutate
|
|
@@ -51,9 +58,11 @@ export declare function profilesEqual(current: SettingsModelProfile[], target: S
|
|
|
51
58
|
*
|
|
52
59
|
* Implements the full §4 protocol:
|
|
53
60
|
* 1. Get revision from describe()
|
|
54
|
-
* 2.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
61
|
+
* 2. Merge modelOverrides into the target (override wins per field); the
|
|
62
|
+
* overrides key itself is never written or deleted
|
|
63
|
+
* 3. Change-only write: skip when the raw user-segment models already equal
|
|
64
|
+
* the merged target
|
|
65
|
+
* 4. Call mutate with expectedRevision (single set op on the models path)
|
|
57
66
|
* 5. On SETTINGS_CONFLICT: re-read, re-translate (caller's job), re-write once
|
|
58
67
|
*
|
|
59
68
|
* @param settings The settings service (injected, not imported)
|
package/lib/writer.js
CHANGED
|
@@ -83,6 +83,25 @@ function getRawUserModelOverrides(desc, route) {
|
|
|
83
83
|
return overrides;
|
|
84
84
|
}
|
|
85
85
|
// ---------------------------------------------------------------------------
|
|
86
|
+
// Override merge
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
/**
|
|
89
|
+
* Fold the user's modelOverrides into the synced target; the override wins
|
|
90
|
+
* per field. Overrides whose id is not in the target are user data for other
|
|
91
|
+
* models — they stay in the overrides key untouched, never folded, never
|
|
92
|
+
* dropped.
|
|
93
|
+
*/
|
|
94
|
+
function mergeOverrides(target, overrides) {
|
|
95
|
+
if (overrides === undefined)
|
|
96
|
+
return target;
|
|
97
|
+
return target.map((entry) => {
|
|
98
|
+
const override = overrides[entry.id];
|
|
99
|
+
if (override === undefined)
|
|
100
|
+
return entry;
|
|
101
|
+
return { ...entry, ...override };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
86
105
|
// syncToSettings (§4)
|
|
87
106
|
// ---------------------------------------------------------------------------
|
|
88
107
|
/**
|
|
@@ -90,9 +109,11 @@ function getRawUserModelOverrides(desc, route) {
|
|
|
90
109
|
*
|
|
91
110
|
* Implements the full §4 protocol:
|
|
92
111
|
* 1. Get revision from describe()
|
|
93
|
-
* 2.
|
|
94
|
-
*
|
|
95
|
-
*
|
|
112
|
+
* 2. Merge modelOverrides into the target (override wins per field); the
|
|
113
|
+
* overrides key itself is never written or deleted
|
|
114
|
+
* 3. Change-only write: skip when the raw user-segment models already equal
|
|
115
|
+
* the merged target
|
|
116
|
+
* 4. Call mutate with expectedRevision (single set op on the models path)
|
|
96
117
|
* 5. On SETTINGS_CONFLICT: re-read, re-translate (caller's job), re-write once
|
|
97
118
|
*
|
|
98
119
|
* @param settings The settings service (injected, not imported)
|
|
@@ -112,44 +133,22 @@ export async function syncToSettings(settings, route, target, logger, retranslat
|
|
|
112
133
|
logger.debug('llm-pi-ai namespace not registered; skip write for route %s', route);
|
|
113
134
|
return { wrote: false, reason: 'skipped' };
|
|
114
135
|
}
|
|
115
|
-
const revision = desc.revision;
|
|
116
136
|
const rawModels = getRawUserModels(desc, route);
|
|
117
137
|
const rawOverrides = getRawUserModelOverrides(desc, route);
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
138
|
+
const mergedTarget = mergeOverrides(target, rawOverrides);
|
|
139
|
+
// Change-only write (§4.4): skip when the stored models already reflect
|
|
140
|
+
// target ⊕ overrides. Because the overrides key is preserved, this stays
|
|
141
|
+
// stable across rounds: once written, the merged view is re-derived
|
|
142
|
+
// identically every round until pi.dev actually changes.
|
|
143
|
+
if (rawModels !== undefined && profilesEqual(rawModels, mergedTarget)) {
|
|
122
144
|
logger.debug('no change for route %s; skip write', route);
|
|
123
145
|
return { wrote: false, reason: 'no-change' };
|
|
124
146
|
}
|
|
125
|
-
// Merge modelOverrides into target when present.
|
|
126
|
-
// Each override key is a model id; shallow-merge its fields into the matching
|
|
127
|
-
// target entry. Skip overrides for ids not in target (log a warning).
|
|
128
|
-
let mergedTarget = target;
|
|
129
|
-
if (rawOverrides !== undefined) {
|
|
130
|
-
mergedTarget = target.map((entry) => {
|
|
131
|
-
const override = rawOverrides[entry.id];
|
|
132
|
-
if (override === undefined)
|
|
133
|
-
return entry;
|
|
134
|
-
return { ...entry, ...override };
|
|
135
|
-
});
|
|
136
|
-
// Warn about overrides that reference missing target ids
|
|
137
|
-
const targetIds = new Set(target.map((e) => e.id));
|
|
138
|
-
for (const overrideId of Object.keys(rawOverrides)) {
|
|
139
|
-
if (!targetIds.has(overrideId)) {
|
|
140
|
-
logger.warn('modelOverrides contains id "%s" not in target for route %s; skipping', overrideId, route);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
// Build ops: set models + unset overrides when overrides exist
|
|
145
147
|
const ops = [
|
|
146
148
|
{ op: 'set', path: ['providers', route, 'models'], value: mergedTarget },
|
|
147
149
|
];
|
|
148
|
-
if (rawOverrides !== undefined) {
|
|
149
|
-
ops.push({ op: 'unset', path: ['providers', route, 'modelOverrides'] });
|
|
150
|
-
}
|
|
151
150
|
try {
|
|
152
|
-
await settings.mutate('llm-pi-ai', ops, revision);
|
|
151
|
+
await settings.mutate('llm-pi-ai', ops, desc.revision);
|
|
153
152
|
return { wrote: true, reason: 'wrote' };
|
|
154
153
|
}
|
|
155
154
|
catch (err) {
|
|
@@ -173,23 +172,13 @@ export async function syncToSettings(settings, route, target, logger, retranslat
|
|
|
173
172
|
return { wrote: false, reason: 'conflict-retry-failed' };
|
|
174
173
|
}
|
|
175
174
|
const newTarget = await retranslate(newDesc.revision);
|
|
176
|
-
// Rebuild ops for retry (overrides may have changed)
|
|
177
|
-
const newOverrides = getRawUserModelOverrides(newDesc, route);
|
|
178
|
-
let retryTarget = newTarget;
|
|
179
|
-
if (newOverrides !== undefined) {
|
|
180
|
-
retryTarget = newTarget.map((entry) => {
|
|
181
|
-
const override = newOverrides[entry.id];
|
|
182
|
-
if (override === undefined)
|
|
183
|
-
return entry;
|
|
184
|
-
return { ...entry, ...override };
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
175
|
const retryOps = [
|
|
188
|
-
{
|
|
176
|
+
{
|
|
177
|
+
op: 'set',
|
|
178
|
+
path: ['providers', route, 'models'],
|
|
179
|
+
value: mergeOverrides(newTarget, getRawUserModelOverrides(newDesc, route)),
|
|
180
|
+
},
|
|
189
181
|
];
|
|
190
|
-
if (newOverrides !== undefined) {
|
|
191
|
-
retryOps.push({ op: 'unset', path: ['providers', route, 'modelOverrides'] });
|
|
192
|
-
}
|
|
193
182
|
await settings.mutate('llm-pi-ai', retryOps, newDesc.revision);
|
|
194
183
|
return { wrote: true, reason: 'conflict-retry-ok' };
|
|
195
184
|
}
|
package/lib/writer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAAA,sFAAsF;
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAAA,sFAAsF;AA+DtF,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,2DAA2D;AAC3D,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AAE7C,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,OAA+B,EAC/B,MAA8B;IAE9B,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;IACrD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,SAAS,CAAC,CAAU,EAAE,CAAU;IACvC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAC1C,IAAI,OAAO,CAAC,KAAK,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACvC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAEvC,MAAM,IAAI,GAAG,CAA4B,CAAA;IACzC,MAAM,IAAI,GAAG,CAA4B,CAAA;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IACtC,MAAM,KAAK,GAAG,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AAS,EAAE,wBAAwB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;iBAC3E;aACF,CAAA;YAED,MAAM,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;YAC9D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAA;QACrD,CAAC;QAAC,OAAO,QAAiB,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CACT,wCAAwC,EACxC,KAAK,EACL,QAAQ,YAAY,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAChE,CAAA;YACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAA;QAC1D,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwayds/dsh-model-sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "dsh plugin: keep llm-pi-ai provider routes' model lists in step with the pi.dev gateway, written through the official settings seam",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -35,11 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@deepseek-ai/cordis": "4.0.
|
|
39
|
-
"@deepseek-ai/dsh-commands": "0.1.
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
41
|
-
"@deepseek-ai/
|
|
42
|
-
"@deepseek-ai/schemastery": "3.18.1"
|
|
38
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
39
|
+
"@deepseek-ai/dsh-commands": ">=0.1.2-alpha.3",
|
|
40
|
+
"@deepseek-ai/dsh-settings": ">=0.1.2-alpha.3",
|
|
41
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
43
42
|
},
|
|
44
43
|
"peerDependenciesMeta": {
|
|
45
44
|
"@deepseek-ai/cordis": {
|
|
@@ -48,9 +47,6 @@
|
|
|
48
47
|
"@deepseek-ai/dsh-commands": {
|
|
49
48
|
"optional": true
|
|
50
49
|
},
|
|
51
|
-
"@deepseek-ai/dsh-credentials": {
|
|
52
|
-
"optional": true
|
|
53
|
-
},
|
|
54
50
|
"@deepseek-ai/dsh-settings": {
|
|
55
51
|
"optional": true
|
|
56
52
|
},
|
|
@@ -60,11 +56,10 @@
|
|
|
60
56
|
},
|
|
61
57
|
"devDependencies": {
|
|
62
58
|
"@types/node": "^24.0.0",
|
|
63
|
-
"@deepseek-ai/cordis": "4.0.
|
|
64
|
-
"@deepseek-ai/dsh-commands": "0.1.
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
"@deepseek-ai/
|
|
67
|
-
"@deepseek-ai/schemastery": "3.18.1",
|
|
59
|
+
"@deepseek-ai/cordis": "4.0.2",
|
|
60
|
+
"@deepseek-ai/dsh-commands": "0.1.2-alpha.3",
|
|
61
|
+
"@deepseek-ai/dsh-settings": "0.1.2-alpha.3",
|
|
62
|
+
"@deepseek-ai/schemastery": "3.18.2",
|
|
68
63
|
"typescript": "^5.9.0"
|
|
69
64
|
},
|
|
70
65
|
"dsh": {
|
package/src/index.ts
CHANGED
|
@@ -5,17 +5,22 @@
|
|
|
5
5
|
* what changed.
|
|
6
6
|
*
|
|
7
7
|
* Supports two write modes:
|
|
8
|
-
* - '
|
|
9
|
-
*
|
|
10
|
-
* - '
|
|
11
|
-
*
|
|
8
|
+
* - 'settings' (default): self-contained fetch → translate → settings.mutate
|
|
9
|
+
* pipeline that writes directly to settings.yaml (zero patch required)
|
|
10
|
+
* - 'overlay' (legacy): uses the patched dsh-llm-pi-ai's piAiCatalog.refresh()
|
|
11
|
+
* to overlay pi.dev entries in memory (requires patch)
|
|
12
12
|
*
|
|
13
13
|
* @module dsh-model-sync
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import z from '@deepseek-ai/schemastery'
|
|
17
17
|
import type { Context } from '@deepseek-ai/cordis'
|
|
18
|
-
|
|
18
|
+
// Type-only side-effect import: loads dsh-settings' `declare module
|
|
19
|
+
// '@deepseek-ai/cordis'` augmentation, which is what puts `ctx.settings` on
|
|
20
|
+
// the Context type. There is no runtime import — the host provides the
|
|
21
|
+
// settings service; alpha.3 removed the settingsNamespace() helper this file
|
|
22
|
+
// used to import.
|
|
23
|
+
import type {} from '@deepseek-ai/dsh-settings'
|
|
19
24
|
// Types only (erased at emit); dsh-commands is an optional peer, so hosts
|
|
20
25
|
// without it still load this plugin — see the guarded registration below.
|
|
21
26
|
import type { CommandDefinition, CommandResult } from '@deepseek-ai/dsh-commands'
|
|
@@ -44,12 +49,20 @@ export const name = 'dsh-model-sync'
|
|
|
44
49
|
/** The settings seam this plugin consumes (its own config namespace). */
|
|
45
50
|
export const inject = ['settings']
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
// dsh-settings 0.1.2-alpha.3 removed the runtime settingsNamespace() helper:
|
|
53
|
+
// register() now brand-checks the namespace at the type level
|
|
54
|
+
// (SettingsNamespaceInput) and validates the same pattern at runtime. A plain
|
|
55
|
+
// literal is the supported spelling.
|
|
56
|
+
const OWN_NS = 'model-sync'
|
|
48
57
|
|
|
49
58
|
/** The `model-sync` settings namespace: user-editable in settings.yaml. */
|
|
50
59
|
const ModelSyncConfig = z.object({
|
|
51
|
-
/**
|
|
52
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Write mode: 'settings' (default, zero-patch settings.mutate pipeline) or
|
|
62
|
+
* 'overlay' (legacy, delegates to the patched adapter's piAiCatalog.refresh
|
|
63
|
+
* and requires the optional patch).
|
|
64
|
+
*/
|
|
65
|
+
writeMode: z.union(['settings', 'overlay']).default('settings'),
|
|
53
66
|
/** Minutes between auto refreshes (default 240 = 4 hours); 0 = startup-only. */
|
|
54
67
|
intervalMinutes: z.number().step(1).min(0).default(240),
|
|
55
68
|
/** Delay before the first auto refresh, so the llm adapter is ready. */
|
|
@@ -131,6 +144,11 @@ export function apply(ctx: Context): void {
|
|
|
131
144
|
): Promise<string> => {
|
|
132
145
|
const catalog = ctx.get('piAiCatalog') as CatalogSeam | undefined
|
|
133
146
|
if (catalog?.refresh === undefined) {
|
|
147
|
+
// Degradation path (never throws): the overlay needs a hand-patched
|
|
148
|
+
// dsh-llm-pi-ai exposing piAiCatalog.refresh(). Since dsh 0.1.2-alpha.3
|
|
149
|
+
// the patch cannot even apply (it shims settingsNamespace and
|
|
150
|
+
// installSettingsSection, both removed from dsh-settings), so hosts on
|
|
151
|
+
// the alpha line always land here unless they run the settings mode.
|
|
134
152
|
return 'catalog refresh is unavailable — the dsh-llm-pi-ai remote-catalog patch is not applied; the model list is the static catalog only.'
|
|
135
153
|
}
|
|
136
154
|
let providers: readonly { id: string }[]
|
package/src/translate.ts
CHANGED
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
* - drop logic for mixed-protocol routes (§3.3 rule 13)
|
|
12
12
|
* - keepBuiltinOnly behavior (§5.2)
|
|
13
13
|
*
|
|
14
|
+
* Deviation from design doc §3.3 (rules 3/5), added 2026-08-31: capacity
|
|
15
|
+
* sanity guards. Settings-written capacities override the installed catalog
|
|
16
|
+
* (`entry.contextWindow ?? base?.contextWindow` in llm-pi-ai's catalog merge)
|
|
17
|
+
* and a written maxTokens becomes the request-level defaultMaxTokens — so a
|
|
18
|
+
* garbage listing value (non-integer, or a maxTokens that merely echoes the
|
|
19
|
+
* context window) would trip the "output token limit" family (#1166). Such
|
|
20
|
+
* values are now skipped with a degrade warning instead of written.
|
|
21
|
+
*
|
|
14
22
|
* @module dsh-model-sync/translate
|
|
15
23
|
*/
|
|
16
24
|
|
|
@@ -82,6 +90,11 @@ export interface TranslateResult {
|
|
|
82
90
|
// THINKING_LEVELS whitelist (§3.5)
|
|
83
91
|
// ---------------------------------------------------------------------------
|
|
84
92
|
|
|
93
|
+
/** A positive integer, the only usable shape for a capacity value. */
|
|
94
|
+
function isPositiveInt(value: unknown): value is number {
|
|
95
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
/** Allowed thinking level keys and their valid wire-spelling constraints. */
|
|
86
99
|
const THINKING_LEVELS = new Set([
|
|
87
100
|
'off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max',
|
|
@@ -166,17 +179,54 @@ export function translateEntries(
|
|
|
166
179
|
// Rule 2: name
|
|
167
180
|
if (entry.name !== undefined) profile.name = entry.name
|
|
168
181
|
|
|
169
|
-
// Rule 3: contextWindow
|
|
170
|
-
|
|
182
|
+
// Rule 3: contextWindow — only a positive integer is a usable capacity.
|
|
183
|
+
// A written value overrides the installed catalog at resolution time, so
|
|
184
|
+
// garbage from the listing is skipped (installed value / route default
|
|
185
|
+
// then applies) instead of propagated.
|
|
186
|
+
if (entry.contextWindow !== undefined) {
|
|
187
|
+
if (isPositiveInt(entry.contextWindow)) {
|
|
188
|
+
profile.contextWindow = entry.contextWindow
|
|
189
|
+
} else {
|
|
190
|
+
warnings.push({
|
|
191
|
+
id: entry.id,
|
|
192
|
+
route,
|
|
193
|
+
reason: `contextWindow ${entry.contextWindow} from the listing is not a positive integer — skipped; installed value or route default applies`,
|
|
194
|
+
severity: 'degrade',
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
}
|
|
171
198
|
|
|
172
199
|
// Rule 4: input (modalities)
|
|
173
200
|
if (entry.input !== undefined && entry.input.length > 0) {
|
|
174
201
|
profile.input = [...entry.input]
|
|
175
202
|
}
|
|
176
203
|
|
|
177
|
-
// Rule 5: maxTokens — base-matching: strip; base-less: keep
|
|
204
|
+
// Rule 5: maxTokens — base-matching: strip; base-less: keep only when
|
|
205
|
+
// sane. base-matching strips because pi-ai falls back to the catalog
|
|
206
|
+
// value. base-less keeps the value, but only if it is a plausible output
|
|
207
|
+
// cap: a positive integer strictly below the context window. Listings
|
|
208
|
+
// sometimes echo the context window into maxTokens (e.g. grok-4.6
|
|
209
|
+
// 500000/500000); written through, it becomes the request-level
|
|
210
|
+
// defaultMaxTokens and trips the "output token limit" family — strip it
|
|
211
|
+
// with a degrade warning instead.
|
|
178
212
|
if (!isBaseMatching && entry.maxTokens !== undefined) {
|
|
179
|
-
|
|
213
|
+
if (!isPositiveInt(entry.maxTokens)) {
|
|
214
|
+
warnings.push({
|
|
215
|
+
id: entry.id,
|
|
216
|
+
route,
|
|
217
|
+
reason: `maxTokens ${entry.maxTokens} from the listing is not a positive integer — skipped; route default applies`,
|
|
218
|
+
severity: 'degrade',
|
|
219
|
+
})
|
|
220
|
+
} else if (profile.contextWindow !== undefined && entry.maxTokens >= profile.contextWindow) {
|
|
221
|
+
warnings.push({
|
|
222
|
+
id: entry.id,
|
|
223
|
+
route,
|
|
224
|
+
reason: `maxTokens ${entry.maxTokens} >= contextWindow ${profile.contextWindow} — looks like a listing echo, skipped; route default applies`,
|
|
225
|
+
severity: 'degrade',
|
|
226
|
+
})
|
|
227
|
+
} else {
|
|
228
|
+
profile.maxTokens = entry.maxTokens
|
|
229
|
+
}
|
|
180
230
|
}
|
|
181
231
|
// base-matching: don't write maxTokens (pi-ai falls back to catalog value)
|
|
182
232
|
|
package/src/writer.ts
CHANGED
|
@@ -4,8 +4,15 @@
|
|
|
4
4
|
* Write translated model profiles to dsh settings via the settings.mutate API.
|
|
5
5
|
*
|
|
6
6
|
* Key behaviors (design doc §4):
|
|
7
|
-
* - Change-only writes: compare
|
|
8
|
-
* resolved values (which have
|
|
7
|
+
* - Change-only writes: compare the merged target (target ⊕ modelOverrides)
|
|
8
|
+
* against the raw user segment (desc.user), not resolved values (which have
|
|
9
|
+
* schema defaults applied)
|
|
10
|
+
* - modelOverrides are the user's own per-model channel (think levels,
|
|
11
|
+
* narrowed context windows). They are preserved forever: the synced models
|
|
12
|
+
* list is written with override fields folded in, and the overrides key is
|
|
13
|
+
* never unset or edited. (Earlier versions unset the key to "migrate" the
|
|
14
|
+
* values into models, which silently wiped them on the next round once the
|
|
15
|
+
* target was regenerated from pi.dev.)
|
|
9
16
|
* - Revision conflict retry: catch SETTINGS_CONFLICT, re-read, re-translate,
|
|
10
17
|
* re-write once
|
|
11
18
|
* - Never touches ~/.dsh/settings.yaml directly — only through settings.mutate
|
|
@@ -139,6 +146,28 @@ function getRawUserModelOverrides(
|
|
|
139
146
|
return overrides as Record<string, Record<string, unknown>>
|
|
140
147
|
}
|
|
141
148
|
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
// Override merge
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Fold the user's modelOverrides into the synced target; the override wins
|
|
155
|
+
* per field. Overrides whose id is not in the target are user data for other
|
|
156
|
+
* models — they stay in the overrides key untouched, never folded, never
|
|
157
|
+
* dropped.
|
|
158
|
+
*/
|
|
159
|
+
function mergeOverrides(
|
|
160
|
+
target: SettingsModelProfile[],
|
|
161
|
+
overrides: Record<string, Record<string, unknown>> | undefined,
|
|
162
|
+
): SettingsModelProfile[] {
|
|
163
|
+
if (overrides === undefined) return target
|
|
164
|
+
return target.map((entry) => {
|
|
165
|
+
const override = overrides[entry.id]
|
|
166
|
+
if (override === undefined) return entry
|
|
167
|
+
return { ...entry, ...override } as SettingsModelProfile
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
142
171
|
// ---------------------------------------------------------------------------
|
|
143
172
|
// syncToSettings (§4)
|
|
144
173
|
// ---------------------------------------------------------------------------
|
|
@@ -148,9 +177,11 @@ function getRawUserModelOverrides(
|
|
|
148
177
|
*
|
|
149
178
|
* Implements the full §4 protocol:
|
|
150
179
|
* 1. Get revision from describe()
|
|
151
|
-
* 2.
|
|
152
|
-
*
|
|
153
|
-
*
|
|
180
|
+
* 2. Merge modelOverrides into the target (override wins per field); the
|
|
181
|
+
* overrides key itself is never written or deleted
|
|
182
|
+
* 3. Change-only write: skip when the raw user-segment models already equal
|
|
183
|
+
* the merged target
|
|
184
|
+
* 4. Call mutate with expectedRevision (single set op on the models path)
|
|
154
185
|
* 5. On SETTINGS_CONFLICT: re-read, re-translate (caller's job), re-write once
|
|
155
186
|
*
|
|
156
187
|
* @param settings The settings service (injected, not imported)
|
|
@@ -178,47 +209,26 @@ export async function syncToSettings(
|
|
|
178
209
|
return { wrote: false, reason: 'skipped' }
|
|
179
210
|
}
|
|
180
211
|
|
|
181
|
-
const revision = desc.revision
|
|
182
212
|
const rawModels = getRawUserModels(desc, route)
|
|
183
213
|
const rawOverrides = getRawUserModelOverrides(desc, route)
|
|
184
214
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
215
|
+
const mergedTarget = mergeOverrides(target, rawOverrides)
|
|
216
|
+
|
|
217
|
+
// Change-only write (§4.4): skip when the stored models already reflect
|
|
218
|
+
// target ⊕ overrides. Because the overrides key is preserved, this stays
|
|
219
|
+
// stable across rounds: once written, the merged view is re-derived
|
|
220
|
+
// identically every round until pi.dev actually changes.
|
|
221
|
+
if (rawModels !== undefined && profilesEqual(rawModels, mergedTarget)) {
|
|
189
222
|
logger.debug('no change for route %s; skip write', route)
|
|
190
223
|
return { wrote: false, reason: 'no-change' }
|
|
191
224
|
}
|
|
192
225
|
|
|
193
|
-
// Merge modelOverrides into target when present.
|
|
194
|
-
// Each override key is a model id; shallow-merge its fields into the matching
|
|
195
|
-
// target entry. Skip overrides for ids not in target (log a warning).
|
|
196
|
-
let mergedTarget = target
|
|
197
|
-
if (rawOverrides !== undefined) {
|
|
198
|
-
mergedTarget = target.map((entry) => {
|
|
199
|
-
const override = rawOverrides[entry.id]
|
|
200
|
-
if (override === undefined) return entry
|
|
201
|
-
return { ...entry, ...override } as SettingsModelProfile
|
|
202
|
-
})
|
|
203
|
-
// Warn about overrides that reference missing target ids
|
|
204
|
-
const targetIds = new Set(target.map((e) => e.id))
|
|
205
|
-
for (const overrideId of Object.keys(rawOverrides)) {
|
|
206
|
-
if (!targetIds.has(overrideId)) {
|
|
207
|
-
logger.warn('modelOverrides contains id "%s" not in target for route %s; skipping', overrideId, route)
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// Build ops: set models + unset overrides when overrides exist
|
|
213
226
|
const ops: SettingsMutationOp[] = [
|
|
214
227
|
{ op: 'set', path: ['providers', route, 'models'], value: mergedTarget },
|
|
215
228
|
]
|
|
216
|
-
if (rawOverrides !== undefined) {
|
|
217
|
-
ops.push({ op: 'unset', path: ['providers', route, 'modelOverrides'] })
|
|
218
|
-
}
|
|
219
229
|
|
|
220
230
|
try {
|
|
221
|
-
await settings.mutate('llm-pi-ai', ops, revision)
|
|
231
|
+
await settings.mutate('llm-pi-ai', ops, desc.revision)
|
|
222
232
|
return { wrote: true, reason: 'wrote' }
|
|
223
233
|
} catch (err: unknown) {
|
|
224
234
|
// Check for SETTINGS_CONFLICT
|
|
@@ -245,23 +255,13 @@ export async function syncToSettings(
|
|
|
245
255
|
}
|
|
246
256
|
|
|
247
257
|
const newTarget = await retranslate(newDesc.revision)
|
|
248
|
-
|
|
249
|
-
// Rebuild ops for retry (overrides may have changed)
|
|
250
|
-
const newOverrides = getRawUserModelOverrides(newDesc, route)
|
|
251
|
-
let retryTarget = newTarget
|
|
252
|
-
if (newOverrides !== undefined) {
|
|
253
|
-
retryTarget = newTarget.map((entry) => {
|
|
254
|
-
const override = newOverrides[entry.id]
|
|
255
|
-
if (override === undefined) return entry
|
|
256
|
-
return { ...entry, ...override } as SettingsModelProfile
|
|
257
|
-
})
|
|
258
|
-
}
|
|
259
258
|
const retryOps: SettingsMutationOp[] = [
|
|
260
|
-
{
|
|
259
|
+
{
|
|
260
|
+
op: 'set',
|
|
261
|
+
path: ['providers', route, 'models'],
|
|
262
|
+
value: mergeOverrides(newTarget, getRawUserModelOverrides(newDesc, route)),
|
|
263
|
+
},
|
|
261
264
|
]
|
|
262
|
-
if (newOverrides !== undefined) {
|
|
263
|
-
retryOps.push({ op: 'unset', path: ['providers', route, 'modelOverrides'] })
|
|
264
|
-
}
|
|
265
265
|
|
|
266
266
|
await settings.mutate('llm-pi-ai', retryOps, newDesc.revision)
|
|
267
267
|
return { wrote: true, reason: 'conflict-retry-ok' }
|