dsh-subagent-default-model 2.0.0 → 2.0.1
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 +16 -0
- package/lib/client.js +84 -29
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.1 (2026-09-25)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **设置卡的「保存」按钮永久灰着、点不动(P0):命名空间在 `apply` 期只探测一次,落空后永不重探**。`lib/client.js` 原本写作 `subagentScope = forms.get(subagentEntryIdOf(forms))` —— 一次性的 `get()`。但 `configForms` 的 describe mirror 是**异步加载**的(`mirror.ensure()`),`apply` 跑的时候 `view` 往往还不存在;此时 `subagentEntryIdOf` 看不到任何命名空间,只能回落到**声明条目 id** `dsh-subagent-default-model`,而桌面宿主实际服务的是 **`include:dsh-subagent-default-model`**。
|
|
8
|
+
绑定错命名空间后,宿主的 `ConfigFormController.derive()` 找不到对应 `view`,把表单停在 `status: 'unavailable'`(**静默,不报错**),而 `derive()` 只在 mirror 变化时重跑——**而作用域早已被捕获,于是永远停在 unavailable**。卡片的 `saveDisabled` 含 `snap.status !== "ready"`,因此保存按钮**永久禁用**;同时因 `value` 为 undefined,卡片还会退化成「尚未指定默认模型」的空态。
|
|
9
|
+
已改为 0.1.7 的官方范式 **`configForms.whileServed([...], (served) => …)`**:命名空间**进入 mirror 时**才注册贡献,并把宿主实际服务的命名空间集合交给回调,据此解析并绑定;命名空间消失时自动卸载贡献。`subagentEntryIdOf(forms, servedNamespaces)` 现优先使用该集合(它正是判定「该注册了」的依据,mirror 可能仍在折叠中),mirror 快照退居其次。
|
|
10
|
+
这是 `remote.session` 那条的**同类第三次**:**「取一次就捕获」在异步就绪的服务上必然出错**。
|
|
11
|
+
诊断与验证(不依赖 Electron):以宿主 `derive()` 的真实语义构造两类作用域,渲染同一张卡片并触发改动 —— 正确绑定(`ready`)→ `Save disabled = false`(可保存);错误绑定(`unavailable`)→ `Save disabled = true`(永久禁用)。修复前用一次性 `get()` 恰是后者。
|
|
12
|
+
|
|
13
|
+
### Testing
|
|
14
|
+
|
|
15
|
+
- 新增 1 个 **行为级**用例 `cards bind to the namespace the host actually serves when the mirror is late`:mirror 为空时 `apply` 必须**不**绑定任何命名空间、**不**注册卡片;待宿主服务的命名空间出现后,绑定必须落在 `include:<条目 id>` 上并注册两个放置点。
|
|
16
|
+
- 改写 `resolves the served settings namespace instead of assuming the bare id`,使其断言 `whileServed` 契约(含 `servedNamespaces.has` 优先与逐次绑定),而不再固定旧的一次性 `get()` 形状。
|
|
17
|
+
- 两者均**变异验证**过:把实现改回「`apply` 期一次性探测」后立刻变红,还原即全绿。全量 **86 项通过**。
|
|
18
|
+
|
|
3
19
|
## 2.0.0 (2026-09-25)
|
|
4
20
|
|
|
5
21
|
### Breaking
|
package/lib/client.js
CHANGED
|
@@ -126,20 +126,33 @@ window.__ModuleLoader__.load({
|
|
|
126
126
|
* while the mirror is not ready.
|
|
127
127
|
*
|
|
128
128
|
* @param {object} forms - the `configForms` client service.
|
|
129
|
+
* @param {Set<string>} [servedNamespaces] - authoritative served-namespace set
|
|
130
|
+
* handed over by `configForms.whileServed(...)`. When present it is preferred
|
|
131
|
+
* over the mirror snapshot, because it is the very set that decided the
|
|
132
|
+
* registration was due — the mirror may still be mid-fold.
|
|
129
133
|
* @returns {string} the namespace to pass to `forms.get()`.
|
|
130
134
|
*/
|
|
131
|
-
function subagentEntryIdOf(forms) {
|
|
135
|
+
function subagentEntryIdOf(forms, servedNamespaces) {
|
|
136
|
+
var pick = function (names) {
|
|
137
|
+
return names.find(function (ns) {
|
|
138
|
+
return ns === SUBAGENT_MODEL_SETTINGS_NS;
|
|
139
|
+
}) ?? names.find(function (ns) {
|
|
140
|
+
return ns === "include:" + SUBAGENT_MODEL_SETTINGS_NS;
|
|
141
|
+
}) ?? names.find(function (ns) {
|
|
142
|
+
return /subagent-default-model/i.test(ns || "");
|
|
143
|
+
});
|
|
144
|
+
};
|
|
132
145
|
try {
|
|
146
|
+
if (servedNamespaces && typeof servedNamespaces.has === "function") {
|
|
147
|
+
var fromServed = pick(Array.from(servedNamespaces));
|
|
148
|
+
if (typeof fromServed === "string" && fromServed !== "") return fromServed;
|
|
149
|
+
}
|
|
133
150
|
var view = forms.describe().getSnapshot().view;
|
|
134
|
-
var namespaces = (view && view.namespaces) || []
|
|
135
|
-
|
|
136
|
-
return entry.ns === SUBAGENT_MODEL_SETTINGS_NS;
|
|
137
|
-
}) ?? namespaces.find(function (entry) {
|
|
138
|
-
return entry.ns === "include:" + SUBAGENT_MODEL_SETTINGS_NS;
|
|
139
|
-
}) ?? namespaces.find(function (entry) {
|
|
140
|
-
return /subagent-default-model/i.test((entry && entry.ns) || "");
|
|
151
|
+
var namespaces = ((view && view.namespaces) || []).map(function (entry) {
|
|
152
|
+
return entry && entry.ns;
|
|
141
153
|
});
|
|
142
|
-
|
|
154
|
+
var served = pick(namespaces);
|
|
155
|
+
if (typeof served === "string" && served !== "") return served;
|
|
143
156
|
} catch (_e) { /* mirror not ready: the declared id is still the right guess */ }
|
|
144
157
|
return SUBAGENT_MODEL_SETTINGS_NS;
|
|
145
158
|
}
|
|
@@ -734,30 +747,72 @@ window.__ModuleLoader__.load({
|
|
|
734
747
|
|
|
735
748
|
// `configForms` is the 0.1.7 client settings surface; soft-inject it so the
|
|
736
749
|
// card simply stays absent when the service is unavailable, instead of
|
|
737
|
-
// blocking the whole client plugin.
|
|
738
|
-
//
|
|
750
|
+
// blocking the whole client plugin.
|
|
751
|
+
//
|
|
752
|
+
// Register through `whileServed`, NOT a one-shot `forms.get(...)`.
|
|
753
|
+
// The describe mirror loads ASYNCHRONOUSLY (`mirror.ensure()`), so a probe
|
|
754
|
+
// run during `apply` can execute before `view` exists. `subagentEntryIdOf`
|
|
755
|
+
// then sees zero namespaces and falls back to the declared entry id
|
|
756
|
+
// (`dsh-subagent-default-model`) while the Desktop host actually serves
|
|
757
|
+
// `include:dsh-subagent-default-model`. The mismatch makes the host's
|
|
758
|
+
// `ConfigFormController.derive()` park the form at `status: 'unavailable'`
|
|
759
|
+
// — silently, with no error — and `derive()` only re-runs on a mirror
|
|
760
|
+
// change. Because the scope was already captured, the card stayed
|
|
761
|
+
// unavailable FOREVER and its Save button was permanently disabled
|
|
762
|
+
// (`saveDisabled` includes `snap.status !== 'ready'`).
|
|
763
|
+
//
|
|
764
|
+
// `whileServed` re-invokes the registration each time one of the watched
|
|
765
|
+
// namespaces enters the mirror, and hands it the served set — so the
|
|
766
|
+
// namespace is resolved from the authoritative directory at the moment it
|
|
767
|
+
// actually exists. It also disposes the contribution when the namespace
|
|
768
|
+
// goes away. Every official consumer registers this way.
|
|
739
769
|
ctx.inject(["configForms"], function (formsCtx) {
|
|
740
770
|
var forms = formsCtx.configForms;
|
|
741
|
-
subagentScope = forms.get(subagentEntryIdOf(forms));
|
|
742
771
|
|
|
743
|
-
var
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
772
|
+
var registerCards = function (namespace) {
|
|
773
|
+
subagentScope = forms.get(namespace);
|
|
774
|
+
var disposers = [];
|
|
775
|
+
var registerCard = function (slotName, key) {
|
|
776
|
+
try {
|
|
777
|
+
disposers.push(ctx.slots.inject(slotName, function () {
|
|
778
|
+
return ctx.slots.register({
|
|
779
|
+
name: slotName,
|
|
780
|
+
key: key,
|
|
781
|
+
locale: SUBAGENT_ROW_LOCALE,
|
|
782
|
+
inject: subagentRowInjected
|
|
783
|
+
}, SubagentModelCard);
|
|
784
|
+
}));
|
|
785
|
+
} catch (error) {
|
|
786
|
+
console.error('[dsh-subagent-default-model] settings card slot "' + slotName + '" failed to register (host provider unaffected):', error);
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
// 0.1.7 placement: register under Plugins config surfaces (the old
|
|
790
|
+
// `settings.plugin.item` slot was removed in 0.1.7).
|
|
791
|
+
registerCard("plugins.bundle.config", "dsh-subagent-default-model");
|
|
792
|
+
registerCard("plugins.row.config", "dsh-subagent-default-model#dsh-subagent-default-model");
|
|
793
|
+
return function () {
|
|
794
|
+
while (disposers.length) {
|
|
795
|
+
var off = disposers.pop();
|
|
796
|
+
if (typeof off === "function") off();
|
|
797
|
+
}
|
|
798
|
+
subagentScope = null;
|
|
799
|
+
};
|
|
756
800
|
};
|
|
757
|
-
|
|
758
|
-
// `
|
|
759
|
-
|
|
760
|
-
|
|
801
|
+
|
|
802
|
+
// `whileServed` is the 0.1.7 contract. Fall back to a direct registration
|
|
803
|
+
// only if a host somehow lacks it, so the card still appears.
|
|
804
|
+
if (typeof forms.whileServed === "function") {
|
|
805
|
+
ctx.effect(function () {
|
|
806
|
+
return forms.whileServed(
|
|
807
|
+
[SUBAGENT_MODEL_SETTINGS_NS, "include:" + SUBAGENT_MODEL_SETTINGS_NS],
|
|
808
|
+
function (served) {
|
|
809
|
+
return registerCards(subagentEntryIdOf(forms, served));
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
}, "dsh-subagent-default-model: settings cards follow the served namespace");
|
|
813
|
+
} else {
|
|
814
|
+
registerCards(subagentEntryIdOf(forms));
|
|
815
|
+
}
|
|
761
816
|
});
|
|
762
817
|
}
|
|
763
818
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-subagent-default-model",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Configure default model routes for DeepSeek Harness subagents, with single-model, round-robin, random, and per-route reasoning-effort options.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|