dsh-subagent-default-model 2.0.2 → 2.0.8

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/lib/index.js CHANGED
@@ -52,20 +52,43 @@ export const name = "dsh-subagent-default-model";
52
52
  // namespace from the configForms mirror instead of guessing it.
53
53
 
54
54
  /**
55
- * Mark a schema's field as volatile on the DSH lines that support it.
55
+ * Mark a schema's field as volatile, on every schemastery build.
56
56
  *
57
- * `volatile()` exists from schemastery 3.18.4 (the DSH 0.1.7 line, which is the
58
- * only line whose settings write gate reads the marker). On a host without the
59
- * method the schema stays byte-identical to the unmarked original (identity
60
- * no-op), so the plugin still loads — the field simply loses hot-reload
61
- * semantics rather than breaking the whole plugin at module-eval time.
57
+ * The marker is NOT optional decoration: `@deepseek-ai/dsh-settings` derives the
58
+ * settings surface from it in two places, and BOTH fail silently without it.
59
+ *
60
+ * - `volatileForm(schema)` (dsh-settings `lib/index.js`) returns `undefined`
61
+ * when no field carries the marker, and `describe()` then DROPS the entry
62
+ * from the namespace directory (`if (form === void 0) return []`). The
63
+ * entry never reaches the client's describe mirror, so the settings card's
64
+ * forwarding scope never binds and every Save reports
65
+ * `notApplied:unavailable:writable=false` — a "the Host serves no settings
66
+ * store for this plugin" error for a plugin the Host is serving perfectly.
67
+ * - `isVolatilePath(schema, path)` refuses every edit whose path is not under
68
+ * a marked node, with `Config field "…" is not volatile`.
69
+ *
70
+ * `volatile()` is sugar introduced in schemastery 3.18.4 — upstream it is
71
+ * literally `extra("volatile", true)` behind a double-marking guard. A stale or
72
+ * hoisted 3.18.1 install is entirely reachable (observed: the vendored copy was
73
+ * 3.18.1, so `volatile()` was absent and the marker was never applied — the
74
+ * plugin loaded, the card rendered, and every Save failed with the message
75
+ * above). `extra()` exists in both builds, so falling back to it keeps the exact
76
+ * 3.18.4 semantics and also works where `volatile()` is missing; the declared
77
+ * dependency floor is therefore 3.18.1. A schema offering neither method is
78
+ * returned unchanged rather than breaking the plugin at module-eval time.
62
79
  *
63
80
  * @template T
64
81
  * @param {object} schema - a schemastery field.
65
- * @returns {object} the field, marked volatile when supported.
82
+ * @returns {object} the field, marked volatile whenever the build allows it.
66
83
  */
67
84
  export function volatileField(schema) {
68
- return typeof schema?.volatile === "function" ? schema.volatile() : schema;
85
+ if (typeof schema?.volatile === "function") return schema.volatile();
86
+ // Pre-3.18.4 fallback: identical marker, no double-marking guard needed
87
+ // because `extra` is a plain assignment of the same meta key.
88
+ if (typeof schema?.extra === "function" && schema.meta?.volatile !== true) {
89
+ return schema.extra("volatile", true);
90
+ }
91
+ return schema;
69
92
  }
70
93
 
71
94
  /** One model entry: a bare model id (uses the section `provider`) or an explicit `{provider, model}` pair. */
@@ -78,9 +101,25 @@ const MODEL_ENTRY = z.union([
78
101
  })
79
102
  ]);
80
103
  /** Schema of the `subagent-default-model` settings section; an absent section keeps inheriting the parent route. */
104
+ // EVERY field MUST carry a `.default(...)`, including the string ones that
105
+ // would naturally be "absent when unset". The settings surface is built by
106
+ // `projectForm()` (`@deepseek-ai/dsh-settings`), which walks the form schema and
107
+ // DROPS any field whose resolved value is `undefined`:
108
+ //
109
+ // return field === void 0 ? [] : [[key, projectForm(child, field)]];
110
+ //
111
+ // A bare `z.string()` with no default resolves to `undefined`, so such a field
112
+ // is absent from the descriptor the settings card reads AND writes against. The
113
+ // card then compares its draft (`provider: "workbuddy"`) to a descriptor that
114
+ // never mentions `provider`, and reports the misleading
115
+ // `notApplied:ready:writable=true`: the scope is ready and writable, and the
116
+ // field it wrote is simply not one this form can see. Declaring `""` as the
117
+ // default keeps the field present-and-empty, which is exactly the "inherit the
118
+ // parent route" state the rest of this plugin already treats as unset
119
+ // (`defaultModel()` tests `section.model.length > 0`).
81
120
  const SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA = z.object({
82
- provider: volatileField(z.string().description("Default provider for subagent runs without an explicit agentOptions")),
83
- model: volatileField(z.string().description("Default model id; the single-model form, backward compatible")),
121
+ provider: volatileField(z.string().default("").description("Default provider for subagent runs without an explicit agentOptions")),
122
+ model: volatileField(z.string().default("").description("Default model id; the single-model form, backward compatible")),
84
123
  models: volatileField(z.array(MODEL_ENTRY).default([]).description("Multi-model list; picked per strategy on every delegation")),
85
124
  strategy: volatileField(z.union([z.const("round-robin"), z.const("random")]).default("round-robin").description("How to pick from `models`")),
86
125
  failoverEnabled: volatileField(z.boolean().default(true).description("Retry a subagent request on another pool model after a connection failure")),
@@ -90,7 +129,7 @@ const SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA = z.object({
90
129
  // writes this key as part of EVERY save, so omitting it made every save
91
130
  // fail — not just the reasoning-effort field. It also carries the
92
131
  // single-model form's effort, which `defaultModel()` reads back.
93
- reasoningEffort: volatileField(z.string().description("Reasoning effort for the single-model form (`model`)"))
132
+ reasoningEffort: volatileField(z.string().default("").description("Reasoning effort for the single-model form (`model`)"))
94
133
  }).default({});
95
134
 
96
135
  /** The plugin's Cordis Config — on DSH 0.1.7+ this IS the settings section. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-subagent-default-model",
3
- "version": "2.0.2",
4
- "description": "Configure default model routes for DeepSeek Harness subagents, with single-model, round-robin, random, and per-route reasoning-effort options.",
3
+ "version": "2.0.8",
4
+ "description": "为 DeepSeek Harness 子代理配置默认模型路由:支持单模型、轮询、随机,以及按路由设置推理强度(reasoning effort)。",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "dsh",
@@ -44,7 +44,7 @@
44
44
  "CHANGELOG.md"
45
45
  ],
46
46
  "scripts": {
47
- "test": "node --test test/*.test.mjs",
47
+ "test": "node --test",
48
48
  "mock": "node scripts/mock-llm-server.mjs",
49
49
  "simulate": "node scripts/simulate-retry.mjs"
50
50
  },
@@ -65,17 +65,17 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@deepseek-ai/schemastery": ">=3.18.4 <4.0.0"
68
+ "@deepseek-ai/schemastery": ">=3.18.1 <4.0.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@deepseek-ai/dsh-settings": ">=0.1.7-rc.1 <0.2.0",
72
- "@deepseek-ai/dsh-subagent": ">=0.1.7-rc.1 <0.2.0",
73
- "@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.2.0",
74
- "@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.2.0",
75
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.2.0",
76
- "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.2.0",
77
- "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.7-rc.1 <0.2.0",
78
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.2.0"
71
+ "@deepseek-ai/dsh-settings": ">=0.1.7-rc.1 <0.3.0-0",
72
+ "@deepseek-ai/dsh-subagent": ">=0.1.7-rc.1 <0.3.0-0",
73
+ "@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.3.0-0",
74
+ "@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.3.0-0",
75
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.3.0-0",
76
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.3.0-0",
77
+ "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.7-rc.1 <0.3.0-0",
78
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.3.0-0"
79
79
  },
80
80
  "peerDependenciesMeta": {
81
81
  "@deepseek-ai/dsh-client-connection": {