dsh-model-switch 0.4.57 → 0.4.59
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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/cordis.patch.yml +2 -6
- package/lib/automode-compat.js +54 -3
- package/lib/client.js +29 -2
- package/lib/types/automode-compat.d.ts +23 -0
- package/lib/types/capabilities-rpc.d.ts +2 -0
- package/lib/types/client/main-row-controller.d.ts +14 -0
- package/package.json +1 -1
- package/lib/auto-review-BHMVpmsr.js +0 -1068
- package/lib/auto-review-BbfitRtw.js +0 -1067
- package/lib/auto-review-D0RrXQQb.js +0 -1068
- package/lib/auto-review-QDEFUjT2.js +0 -1067
- package/lib/auto-review-uu9lvAIZ.js +0 -1068
- package/lib/prime-memory-compat-0eGkT2SF.js +0 -652
- package/lib/prime-memory-compat-B7x3nSB2.js +0 -649
- package/lib/prime-memory-compat-C6dvrTgT.js +0 -649
- package/lib/prime-memory-compat-CCKuGrem.js +0 -647
- package/lib/prime-memory-compat-DqmcT12Z.js +0 -645
- package/lib/prime-memory-compat-MlRHdNv4.js +0 -656
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## v0.4.59
|
|
2
|
+
|
|
3
|
+
冻结自动模式支持(按用户 2026-10-31 要求)。
|
|
4
|
+
|
|
5
|
+
- **不再支持 `@log.li/dsh-automode`**。`cordis.patch.yml` 里 `model-switch-automode-compat` 的 insert 行已删除,运行时不再挂载;`src/automode-compat.ts` 标注 `@deprecated`,源码保留一个版本用于回退,下个大版本删除。该第三方插件被禁用/卸载均属预期,本插件不再为其注入审查路由与纯读名单。
|
|
6
|
+
- **背景**:该适配会改写第三方行的内存配置,但 profile 补丁若整键重写 `permission.presets`,bundle 提供的 `auto-mode` 预设会被盖掉而插件仍工作——这类跨插件耦合已判定不再维护。
|
|
7
|
+
- 现有 `auto` 档位不受影响(由 `@deepseek-ai/dsh-experimental-auto-review` 注册,与本插件无关)。
|
|
8
|
+
|
|
9
|
+
## v0.4.58
|
|
10
|
+
|
|
11
|
+
修复两处配置层问题:已删除供应商的配置组现在可以选中并删除;Auto mode 预设缺失时可以在状态和日志里直接看到。
|
|
12
|
+
|
|
13
|
+
- **供应商配置组:已删除供应商的组不再"消失"**。`src/client/main-row-controller.ts` 新增 `groupProviderChoices`,把「实时模型目录」与「仍然存有配置组的供应商」取并集,目录里不存在的标 `unavailable`(下拉中显示 ⚠)。此前下拉只列目录供应商,除当前选中的那一个之外,其它孤儿组永远无法选中,自然也就删不掉——这正是"供应商删了、组还在、清不掉"的成因。删除仍走原有 `saveProviderGroupFenced → withProviderGroup`,没有新增存储路径。
|
|
14
|
+
- **Auto mode 缺失可诊断**。`automode-compat` 读取组合后的 `permission` 行,检查 `config.presets['auto-mode']`,在 `status.automode` 中给出 `preset: present | missing | unknown`;缺失时打一条 warn(每宿主一次),说明 profile 补丁重写了 `permission.presets`、把 bundle 的 auto-mode 预设盖掉了。
|
|
15
|
+
- **文档**:新增 `docs/notes/2026-10-31-patch-layer-overrides.md`,记录 DSH 补丁层是**整键替换**(`target[key] = value`)而非深合并,以及 Auto mode 预设应该写在哪一层。
|
|
16
|
+
|
|
17
|
+
验证(virtual / 零真实额度):DSH 0.2.1-rc.5 lab 中造一个目录里不存在的 `ghost-provider` 组,设置页下拉可选中(带 ⚠),点「删除该组」后组数 4→3,且 profile 补丁里该组已消失;Auto mode 预设的有/无两态也在 lab 复现(删掉 `permission` 行后预设随 bundle 恢复并出现在权限选择器,改默认权限时新行会自动带上 4 个预设)。`pnpm run check` 全绿。
|
|
18
|
+
|
|
1
19
|
## v0.4.57
|
|
2
20
|
|
|
3
21
|
修复可选服务取用方式与记忆路由写入校验:0.4.56 的代理行在真实宿主上都静默停用,记忆蒸馏路由因此没有写进插件。
|
package/README.md
CHANGED
|
@@ -193,7 +193,7 @@ Verified releases: `0.1.7-alpha.2`, `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.2`. Th
|
|
|
193
193
|
|
|
194
194
|
DSH compatibility is declared as an open-ended floor (`dsh.compatibility.dshRuntime: ">=0.2.0-rc.2"`): every runtime at or above it mounts without an unverified warning, a `blocklist` still wins, and loading stays fail-open. The releases in `package.json#dsh.compatibility.dshReleases` are evidence, not an allowlist. Review public API changes and test new Host releases before adding a verification claim.
|
|
195
195
|
|
|
196
|
-
**Third-party auto modes
|
|
196
|
+
**Third-party auto modes (dropped in 0.4.59).** This plugin used to inject its Auto-review route and pure-read list into the in-memory config of [`@log.li/dsh-automode`](https://github.com/log-li/dsh-automode). That adapter is frozen and removed from `cordis.patch.yml`; the source is marked `@deprecated` and will be deleted next major. Disabling or uninstalling that plugin is expected, and no `auto-mode` preset should be written in the profile. The `auto` preset comes from `@deepseek-ai/dsh-experimental-auto-review`, not from this plugin.
|
|
197
197
|
|
|
198
198
|
## Development
|
|
199
199
|
|
package/README.zh.md
CHANGED
|
@@ -191,7 +191,7 @@ DSH Host peer 和开发依赖接受 `>=0.1.7-alpha.2`,包括 rc.1 和后续版
|
|
|
191
191
|
|
|
192
192
|
DSH 兼容按「下界 + 区间」声明(`dsh.compatibility.dshRuntime: ">=0.2.0-rc.2"`):≥ 该下界一律挂载且不再告警,`blocklist` 仍最优先,加载保持 fail-open。`package.json#dsh.compatibility.dshReleases` 里的逐版本记录是证据,不是允许列表。新增验证声明前要审查公开 API 变化并测试新 Host 版本。
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
**第三方自动模式(0.4.59 起不再支持)。** 本插件曾把自动审查路由与纯读名单注入 [`@log.li/dsh-automode`](https://github.com/log-li/dsh-automode) 的内存配置;该适配已冻结并从 `cordis.patch.yml` 移除,源码标注 `@deprecated`,下个大版本删除。该插件被禁用或卸载均属预期,profile 里也不应再出现 `auto-mode` 预设;`auto` 档位由 `@deepseek-ai/dsh-experimental-auto-review` 提供,与本插件无关。
|
|
195
195
|
|
|
196
196
|
## 开发
|
|
197
197
|
|
package/cordis.patch.yml
CHANGED
|
@@ -74,12 +74,8 @@
|
|
|
74
74
|
- id: model-switch-session-title
|
|
75
75
|
name: 'dsh-model-switch/session-title'
|
|
76
76
|
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
# no-op when that plugin is not installed). Kept as its own row so it can be
|
|
80
|
-
# disabled without touching the reviewer gate.
|
|
81
|
-
- id: model-switch-automode-compat
|
|
82
|
-
name: 'dsh-model-switch/automode-compat'
|
|
77
|
+
# 2026-10-31 冻结:automode 适配行已移除,本插件不再支持 @log.li/dsh-automode。
|
|
78
|
+
# 源码保留一个版本(src/automode-compat.ts 标注 deprecated),下个大版本删除。
|
|
83
79
|
|
|
84
80
|
# Fill the third-party dsh-prime-memory row's distillation route from this
|
|
85
81
|
# plugin's provider-group route, in memory only (no profile write, no-op when
|
package/lib/automode-compat.js
CHANGED
|
@@ -24,8 +24,37 @@ const automodeCompatStatus = {
|
|
|
24
24
|
/** Last hot-reload outcome, once a changed route was pushed into the live row. */
|
|
25
25
|
hot: void 0,
|
|
26
26
|
/** Why the last hot reload did not take, when it did not. */
|
|
27
|
-
hotReason: void 0
|
|
27
|
+
hotReason: void 0,
|
|
28
|
+
/**
|
|
29
|
+
* Whether the Host's `permission` row still carries the `auto-mode` preset the
|
|
30
|
+
* third-party bundle patch inserts. A profile patch that restates
|
|
31
|
+
* `permission.presets` replaces that whole config key, so the row keeps working
|
|
32
|
+
* while the preset silently disappears from the permission picker.
|
|
33
|
+
*/
|
|
34
|
+
preset: void 0
|
|
28
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Read the composed `permission` row and look for the `auto-mode` preset.
|
|
38
|
+
*
|
|
39
|
+
* @param loader - the Host loader, when this row can read it.
|
|
40
|
+
* @returns `missing` only when the row's `presets` map is readable and lacks the
|
|
41
|
+
* key; anything this adapter cannot read stays `unknown` instead of guessing.
|
|
42
|
+
*/
|
|
43
|
+
function permissionPresetState(loader) {
|
|
44
|
+
if (loader === void 0 || typeof loader.entries !== "function") return "unknown";
|
|
45
|
+
let row;
|
|
46
|
+
try {
|
|
47
|
+
for (const entry of loader.entries()) if (entry?.options?.id === "permission") {
|
|
48
|
+
row = entry;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
return "unknown";
|
|
53
|
+
}
|
|
54
|
+
const presets = asRecord(asRecord(row?.options?.config)?.presets);
|
|
55
|
+
if (presets === void 0) return "unknown";
|
|
56
|
+
return Object.hasOwn(presets, "auto-mode") ? "present" : "missing";
|
|
57
|
+
}
|
|
29
58
|
/** Plain-object guard: arrays and `null` are not config objects. */
|
|
30
59
|
function asRecord(value) {
|
|
31
60
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -196,7 +225,8 @@ function automodeCompatView() {
|
|
|
196
225
|
added: automodeCompatStatus.added.length,
|
|
197
226
|
skipped: automodeCompatStatus.skipped.length,
|
|
198
227
|
hot: automodeCompatStatus.hot,
|
|
199
|
-
hotReason: automodeCompatStatus.hotReason
|
|
228
|
+
hotReason: automodeCompatStatus.hotReason,
|
|
229
|
+
preset: automodeCompatStatus.preset
|
|
200
230
|
};
|
|
201
231
|
}
|
|
202
232
|
/**
|
|
@@ -220,6 +250,25 @@ function installAutomodeCompat(ctx, loader, settings) {
|
|
|
220
250
|
const adopted = /* @__PURE__ */ new Map();
|
|
221
251
|
/** Entries whose fiber reload is in flight, so one change cannot restart twice. */
|
|
222
252
|
const reloading = /* @__PURE__ */ new Set();
|
|
253
|
+
/** One warning per Host, so a broken preset does not flood the log on every replay. */
|
|
254
|
+
let presetWarned = false;
|
|
255
|
+
/**
|
|
256
|
+
* Refresh the `auto-mode` preset diagnosis the status surface reports.
|
|
257
|
+
*
|
|
258
|
+
* The permission picker renders whatever `permission.presets` the composed tree
|
|
259
|
+
* carries, so this adapter never injects a preset itself — it only reports the
|
|
260
|
+
* gap, because a silently missing "Auto mode" is otherwise indistinguishable
|
|
261
|
+
* from the row not loading at all.
|
|
262
|
+
*
|
|
263
|
+
* @param warn - whether a newly detected gap should also be logged (once).
|
|
264
|
+
*/
|
|
265
|
+
const refreshPreset = (warn) => {
|
|
266
|
+
const state = permissionPresetState(loader);
|
|
267
|
+
automodeCompatStatus.preset = state;
|
|
268
|
+
if (state !== "missing" || presetWarned) return;
|
|
269
|
+
presetWarned = true;
|
|
270
|
+
if (warn) log.warn("model-switch: the dsh-automode row is mounted but the composed permission config has no \"auto-mode\" preset, so the permission picker hides Auto mode — a profile patch that restates permission.presets replaces the whole config key; add the auto-mode preset there or delete that row");
|
|
271
|
+
};
|
|
223
272
|
/**
|
|
224
273
|
* Push a changed route into the row that is already running.
|
|
225
274
|
*
|
|
@@ -267,6 +316,7 @@ function installAutomodeCompat(ctx, loader, settings) {
|
|
|
267
316
|
if (loader !== void 0 && typeof loader.entries === "function") {
|
|
268
317
|
for (const entry of loader.entries()) if (isAutomodeEntry(entry)) applying(entry, false);
|
|
269
318
|
}
|
|
319
|
+
refreshPreset(true);
|
|
270
320
|
const dispose = ctx.on("loader/patch-context", function(first, second) {
|
|
271
321
|
const nextFn = typeof first === "function" ? first : second;
|
|
272
322
|
const candidate = typeof first === "function" ? this : first;
|
|
@@ -276,6 +326,7 @@ function installAutomodeCompat(ctx, loader, settings) {
|
|
|
276
326
|
/** Re-adapt every live row (settings changed under us) and reload the ones whose route moved. */
|
|
277
327
|
const replay = () => {
|
|
278
328
|
let any = false;
|
|
329
|
+
refreshPreset(false);
|
|
279
330
|
for (const entry of loader?.entries?.() ?? []) {
|
|
280
331
|
if (!isAutomodeEntry(entry)) continue;
|
|
281
332
|
any = true;
|
|
@@ -307,4 +358,4 @@ function apply(outer) {
|
|
|
307
358
|
});
|
|
308
359
|
}
|
|
309
360
|
//#endregion
|
|
310
|
-
export { AUTOMODE_PACKAGE, apply, automodeCompatStatus, automodeCompatView, describeAutomodePlan, inject, installAutomodeCompat, isAutomodeEntry, name, planAutomodeCompat };
|
|
361
|
+
export { AUTOMODE_PACKAGE, apply, automodeCompatStatus, automodeCompatView, describeAutomodePlan, inject, installAutomodeCompat, isAutomodeEntry, name, permissionPresetState, planAutomodeCompat };
|
package/lib/client.js
CHANGED
|
@@ -1056,6 +1056,33 @@ window.__ModuleLoader__.load({
|
|
|
1056
1056
|
models
|
|
1057
1057
|
};
|
|
1058
1058
|
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Provider choices for the provider-group editor.
|
|
1061
|
+
*
|
|
1062
|
+
* The live catalog cannot represent a group whose provider was deleted, so a
|
|
1063
|
+
* catalog-only list makes that group unreachable: the row stays stored, no
|
|
1064
|
+
* selection can open it, and nothing can delete it. Union in every configured
|
|
1065
|
+
* group's provider and mark the missing ones unavailable so the editor can still
|
|
1066
|
+
* open and remove them.
|
|
1067
|
+
* @param groups - the live model catalog.
|
|
1068
|
+
* @param configured - provider ids that still have a stored group.
|
|
1069
|
+
* @param current - the group being edited, kept listed even when it is unknown.
|
|
1070
|
+
* @returns catalog choices first (original order), then the missing providers.
|
|
1071
|
+
*/
|
|
1072
|
+
function groupProviderChoices(groups, configured, current) {
|
|
1073
|
+
const choices = deriveRouteChoices(groups, current === void 0 || current.trim() === "" ? void 0 : { provider: current }).providers;
|
|
1074
|
+
const seen = new Set(choices.map((choice) => choice.id));
|
|
1075
|
+
for (const provider of configured) {
|
|
1076
|
+
if (provider.trim() === "" || seen.has(provider)) continue;
|
|
1077
|
+
seen.add(provider);
|
|
1078
|
+
choices.push({
|
|
1079
|
+
id: provider,
|
|
1080
|
+
name: provider,
|
|
1081
|
+
unavailable: true
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
return choices;
|
|
1085
|
+
}
|
|
1059
1086
|
/** Load the model catalog backing every route editor, reloading on provider-order changes. */
|
|
1060
1087
|
function useSettingsCatalog(input) {
|
|
1061
1088
|
const [groups, setGroups] = (0, react.useState)([]);
|
|
@@ -2043,7 +2070,7 @@ window.__ModuleLoader__.load({
|
|
|
2043
2070
|
const titleDisabled = sessionTitle.status !== "ready" || !sessionTitle.writable || titleDraft === void 0 || busy !== void 0 || !titleOn || (titleDraft.provider ?? "").trim() === "" || (titleDraft.model ?? "").trim() === "";
|
|
2044
2071
|
const configuredGroupCount = Object.keys(providerGroups).length;
|
|
2045
2072
|
const groupControlsDisabled = busy !== void 0 || switchSettings.status !== "ready" || !switchSettings.writable;
|
|
2046
|
-
const groupProviderChoices =
|
|
2073
|
+
const groupProviderChoices$1 = groupProviderChoices(groups, Object.keys(providerGroups), groupProvider === "" ? void 0 : groupProvider).map((choice) => groupOf(providerGroups, choice.id) === void 0 ? choice : {
|
|
2047
2074
|
...choice,
|
|
2048
2075
|
name: choice.name + " ✓"
|
|
2049
2076
|
});
|
|
@@ -2963,7 +2990,7 @@ window.__ModuleLoader__.load({
|
|
|
2963
2990
|
label: props.t("provider"),
|
|
2964
2991
|
value: groupProvider,
|
|
2965
2992
|
disabled: groupControlsDisabled,
|
|
2966
|
-
choices: groupProviderChoices,
|
|
2993
|
+
choices: groupProviderChoices$1,
|
|
2967
2994
|
onChange: setGroupProvider
|
|
2968
2995
|
})
|
|
2969
2996
|
}),
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapt the third-party `@log.li/dsh-automode` row to this plugin's routes.
|
|
3
3
|
*
|
|
4
|
+
* @deprecated 2026-10-31 冻结:本插件不再支持 `@log.li/dsh-automode`,
|
|
5
|
+
* `model-switch-automode-compat` 行已从 `cordis.patch.yml` 移除,本模块不再被挂载。
|
|
6
|
+
* 保留源码仅为可回退,下个大版本删除;不再修 bug、不再适配新版本。
|
|
7
|
+
*
|
|
4
8
|
* ## Why this exists
|
|
5
9
|
*
|
|
6
10
|
* `dsh-automode` owns a completely different decision pipeline: its own
|
|
@@ -89,7 +93,24 @@ export declare const automodeCompatStatus: {
|
|
|
89
93
|
hot: "applied" | "restart-required" | undefined;
|
|
90
94
|
/** Why the last hot reload did not take, when it did not. */
|
|
91
95
|
hotReason: string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the Host's `permission` row still carries the `auto-mode` preset the
|
|
98
|
+
* third-party bundle patch inserts. A profile patch that restates
|
|
99
|
+
* `permission.presets` replaces that whole config key, so the row keeps working
|
|
100
|
+
* while the preset silently disappears from the permission picker.
|
|
101
|
+
*/
|
|
102
|
+
preset: AutomodePresetState | undefined;
|
|
92
103
|
};
|
|
104
|
+
/** Where the `auto-mode` permission preset stands in the composed config. */
|
|
105
|
+
export type AutomodePresetState = 'present' | 'missing' | 'unknown';
|
|
106
|
+
/**
|
|
107
|
+
* Read the composed `permission` row and look for the `auto-mode` preset.
|
|
108
|
+
*
|
|
109
|
+
* @param loader - the Host loader, when this row can read it.
|
|
110
|
+
* @returns `missing` only when the row's `presets` map is readable and lacks the
|
|
111
|
+
* key; anything this adapter cannot read stays `unknown` instead of guessing.
|
|
112
|
+
*/
|
|
113
|
+
export declare function permissionPresetState(loader: Loader | undefined): AutomodePresetState;
|
|
93
114
|
/**
|
|
94
115
|
* Whether one loader entry is the third-party auto-mode row.
|
|
95
116
|
* @param entry - anything the loader hands over (an entry, or an event payload).
|
|
@@ -130,6 +151,8 @@ export interface AutomodeCompatView {
|
|
|
130
151
|
readonly hot?: 'applied' | 'restart-required' | undefined;
|
|
131
152
|
/** Why the last hot reload did not take, when it did not. */
|
|
132
153
|
readonly hotReason?: string | undefined;
|
|
154
|
+
/** Whether the composed `permission` config still lists the `auto-mode` preset. */
|
|
155
|
+
readonly preset?: AutomodePresetState | undefined;
|
|
133
156
|
}
|
|
134
157
|
/**
|
|
135
158
|
* Snapshot for the RPC/UI layer.
|
|
@@ -17,6 +17,8 @@ export interface ReviewStatus {
|
|
|
17
17
|
readonly skipped: number;
|
|
18
18
|
readonly hot?: 'applied' | 'restart-required' | undefined;
|
|
19
19
|
readonly hotReason?: string | undefined;
|
|
20
|
+
/** Whether the composed `permission` config still lists the `auto-mode` preset. */
|
|
21
|
+
readonly preset?: 'present' | 'missing' | 'unknown' | undefined;
|
|
20
22
|
} | undefined;
|
|
21
23
|
/** Memory-plugin adapter state: whether our distillation route reached the plugin. */
|
|
22
24
|
readonly primeMemory?: {
|
|
@@ -18,6 +18,20 @@ export declare function deriveRouteChoices(groups: readonly ModelProviderGroup[]
|
|
|
18
18
|
providers: Choice[];
|
|
19
19
|
models: Choice[];
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Provider choices for the provider-group editor.
|
|
23
|
+
*
|
|
24
|
+
* The live catalog cannot represent a group whose provider was deleted, so a
|
|
25
|
+
* catalog-only list makes that group unreachable: the row stays stored, no
|
|
26
|
+
* selection can open it, and nothing can delete it. Union in every configured
|
|
27
|
+
* group's provider and mark the missing ones unavailable so the editor can still
|
|
28
|
+
* open and remove them.
|
|
29
|
+
* @param groups - the live model catalog.
|
|
30
|
+
* @param configured - provider ids that still have a stored group.
|
|
31
|
+
* @param current - the group being edited, kept listed even when it is unknown.
|
|
32
|
+
* @returns catalog choices first (original order), then the missing providers.
|
|
33
|
+
*/
|
|
34
|
+
export declare function groupProviderChoices(groups: readonly ModelProviderGroup[], configured: readonly string[], current: string | undefined): Choice[];
|
|
21
35
|
export interface SettingsCatalogInputs {
|
|
22
36
|
loadCatalog(): Promise<readonly ModelProviderGroup[]>;
|
|
23
37
|
subscribeProviderOrder?: (listener: () => void) => () => void;
|