dsh-plugin-model-tuning 3.0.0 → 3.0.2
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 +2 -0
- package/client.js +15 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
> **v3 边界收缩(2026-10,基线 dsh 0.2.1-rc.1)**:v2 合并进来的「标题生成路由」交还官方 `session-title-llm` 行,「模型参数」页交还官方 Models 页。官方已经能做的,本插件不再复制;官方没有的,见下面两节。重叠盘点记录见 [docs/PLUGIN-SCOPE-dsh-0.2.1-rc.1.md](../docs/PLUGIN-SCOPE-dsh-0.2.1-rc.1.md)。
|
|
9
9
|
|
|
10
|
+
> 兼容性:`engines.dsh` = `>=0.2.0-rc.2 <0.3.0-0`,已在 dsh 0.2.1-rc.3 上实测运行。
|
|
11
|
+
|
|
10
12
|
## 1. 兼容与推理(官方 Models 页扩展)
|
|
11
13
|
|
|
12
14
|
通过官方为仓库外插件留的 `settings.models.provider-card` 席位,在每张 pi-ai provider 卡片里追加一节「兼容与推理(插件补充)」。**这些控件官方 Models 页没有**:
|
package/client.js
CHANGED
|
@@ -1004,7 +1004,6 @@ window.__ModuleLoader__.load({
|
|
|
1004
1004
|
async function saveCompat(providerId, modelId, kind, value) {
|
|
1005
1005
|
const snapshot = await compatSnapshot(providerId);
|
|
1006
1006
|
const entry = snapshot.entry;
|
|
1007
|
-
const nsView = snapshot.nsView;
|
|
1008
1007
|
if (kind === "imageLink") {
|
|
1009
1008
|
// The drawing list lives in this plugin's own namespace; re-read it
|
|
1010
1009
|
// right before writing so the plan and its revision come from one
|
|
@@ -1024,24 +1023,35 @@ window.__ModuleLoader__.load({
|
|
|
1024
1023
|
if (!response.ok) throw new Error(response.error && response.error.message ? response.error.message : "保存失败");
|
|
1025
1024
|
return;
|
|
1026
1025
|
}
|
|
1026
|
+
// Re-read the provider namespace right before writing: the plan and the
|
|
1027
|
+
// revision it is applied against must come from the same document, or a
|
|
1028
|
+
// concurrent write is either refused as stale or silently overwritten
|
|
1029
|
+
// (the same discipline the drawing page's commit() uses).
|
|
1030
|
+
const freshSettings = unwrap(await remote.settings.describe());
|
|
1031
|
+
const freshNamespaces = Array.isArray(freshSettings.namespaces) ? freshSettings.namespaces : [];
|
|
1032
|
+
const freshNs = freshNamespaces.find((item) => item && item.ns === entry.settingsNs);
|
|
1033
|
+
if (!freshNs) throw new Error("该 provider 的设置命名空间未激活,无法保存");
|
|
1027
1034
|
let write;
|
|
1028
1035
|
if (kind === "supportsDeveloperRole" || kind === "adaptiveThinking") {
|
|
1029
1036
|
if (value !== null && typeof value !== "boolean") throw new Error("取值必须是布尔值");
|
|
1030
1037
|
const compatKey = kind === "supportsDeveloperRole" ? "supportsDeveloperRole" : snapshot.adaptiveKey;
|
|
1031
1038
|
if (compatKey === null || compatKey === undefined) throw new Error("该路由不是 anthropic-messages,不能设置思考格式");
|
|
1032
|
-
write = computeCompatWriteOps(entry,
|
|
1039
|
+
write = computeCompatWriteOps(entry, freshNs, modelId, compatKey, value);
|
|
1033
1040
|
} else if (kind === "reasoningLevels") {
|
|
1034
1041
|
const levels = Array.isArray(value) ? value : [];
|
|
1035
1042
|
for (const level of levels) {
|
|
1036
1043
|
if (REASONING_LEVELS.indexOf(level) < 0) throw new Error("未知的推理档位:" + level);
|
|
1037
1044
|
}
|
|
1038
|
-
const payload = reasoningEffortsPayload(levels, storedReasoningEfforts(entry,
|
|
1039
|
-
write = computeWriteOps(entry,
|
|
1045
|
+
const payload = reasoningEffortsPayload(levels, storedReasoningEfforts(entry, freshNs, modelId));
|
|
1046
|
+
write = computeWriteOps(entry, freshNs, modelId, "reasoningEfforts", payload);
|
|
1040
1047
|
} else {
|
|
1041
1048
|
throw new Error("未知的修改类型");
|
|
1042
1049
|
}
|
|
1043
1050
|
if (!write) throw new Error("该 provider 不接受这个字段");
|
|
1044
|
-
|
|
1051
|
+
// settings/mutate declares three parameters (ns, ops, expectedRevision);
|
|
1052
|
+
// the client bridge refuses a two-argument call outright, and the
|
|
1053
|
+
// revision is what makes a stale editor fail instead of overwriting.
|
|
1054
|
+
const response = await remote.settings.mutate(write.ns, write.ops, freshNs.revision);
|
|
1045
1055
|
if (!response.ok) throw new Error(response.error && response.error.message ? response.error.message : "保存失败");
|
|
1046
1056
|
}
|
|
1047
1057
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-model-tuning",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"engines": { "dsh": ">=0.2.0-rc.2 <0.3.0-0" },
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"keywords": ["dsh-plugin", "deepseek-harness", "dsh", "model", "settings", "reasoning", "compat", "image-generation"],
|
|
6
7
|
"publishConfig": { "registry": "https://registry.npmjs.org" },
|