@dsh-plus/subagent-model 0.3.24 → 0.3.26
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/client.js +79 -69
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -5
- package/package.json +2 -2
- package/src/client/api.ts +1 -1
- package/src/client/card.tsx +1 -1
- package/src/client/client.ts +2 -2
- package/src/config.ts +6 -7
- package/src/delegation.ts +2 -2
- package/src/index.ts +1 -1
- package/src/ns.ts +1 -2
- package/src/service.ts +2 -2
package/lib/client.js
CHANGED
|
@@ -7,6 +7,75 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
//#region ../shared/src/client/fields.tsx
|
|
11
|
+
/** 卡片按钮(与 CardChrome 页脚同一套类名与视觉)。 */
|
|
12
|
+
function Button(props) {
|
|
13
|
+
const p = props.prefix ?? "dshp";
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
15
|
+
type: "button",
|
|
16
|
+
className: `${p}-btn ${props.variant === "primary" ? `${p}-btnPrimary` : `${p}-btnGhost`}`,
|
|
17
|
+
disabled: props.disabled === true,
|
|
18
|
+
onClick: props.onClick,
|
|
19
|
+
children: props.label
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 勾选行:自绘圆角扁平开关(switch),对齐官方 WebUI 无原生 checkbox 的
|
|
24
|
+
* 设计语言(官方选择类控件全走胶囊/菜单,见 cardCss 的 -switch 规则)。
|
|
25
|
+
* 语义保持 checkbox(无障碍树与表单语义不变),视觉自绘。
|
|
26
|
+
*/
|
|
27
|
+
function CheckRow(props) {
|
|
28
|
+
const p = props.prefix ?? "dshp";
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
30
|
+
className: `${p}-checkRow`,
|
|
31
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
32
|
+
id: props.id,
|
|
33
|
+
type: "checkbox",
|
|
34
|
+
role: "switch",
|
|
35
|
+
"aria-checked": props.checked,
|
|
36
|
+
checked: props.checked,
|
|
37
|
+
disabled: props.disabled === true,
|
|
38
|
+
onChange: (event) => props.onEdit(event.target.checked)
|
|
39
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
40
|
+
htmlFor: props.id,
|
|
41
|
+
children: props.label
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function SelectField(props) {
|
|
46
|
+
const p = props.prefix ?? "dshp";
|
|
47
|
+
const invalid = props.invalid === true;
|
|
48
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
49
|
+
className: `${p}-field`,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
52
|
+
className: `${p}-head`,
|
|
53
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
54
|
+
className: `${p}-label`,
|
|
55
|
+
htmlFor: props.id,
|
|
56
|
+
children: props.label
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
60
|
+
id: props.id,
|
|
61
|
+
className: `${p}-select${invalid ? ` ${p}-inputInvalid` : ""}`,
|
|
62
|
+
"aria-invalid": invalid || void 0,
|
|
63
|
+
value: props.value,
|
|
64
|
+
disabled: props.disabled === true,
|
|
65
|
+
onChange: (event) => props.onEdit(event.target.value),
|
|
66
|
+
children: props.options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
67
|
+
value: option.value,
|
|
68
|
+
children: option.label
|
|
69
|
+
}, option.value))
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
72
|
+
className: invalid ? `${p}-invalid` : `${p}-hint`,
|
|
73
|
+
children: invalid ? props.invalidLabel ?? "" : props.hint ?? ""
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
10
79
|
//#region ../shared/src/client/card.tsx
|
|
11
80
|
const IDLE_STATUS = {
|
|
12
81
|
kind: "idle",
|
|
@@ -55,12 +124,12 @@ window.__ModuleLoader__.load({
|
|
|
55
124
|
className: `${p}-status${props.status.kind === "error" ? ` ${p}-statusError` : ""}`,
|
|
56
125
|
role: "status",
|
|
57
126
|
children: props.status.text
|
|
58
|
-
}) : null, props.actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
127
|
+
}) : null, props.actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
128
|
+
prefix: p,
|
|
129
|
+
label: action.label,
|
|
130
|
+
variant: action.variant,
|
|
131
|
+
disabled: action.disabled,
|
|
132
|
+
onClick: action.onClick
|
|
64
133
|
}, action.key))]
|
|
65
134
|
})
|
|
66
135
|
]
|
|
@@ -115,64 +184,6 @@ window.__ModuleLoader__.load({
|
|
|
115
184
|
* @module @dsh-plus/shared/client/draft
|
|
116
185
|
*/
|
|
117
186
|
//#endregion
|
|
118
|
-
//#region ../shared/src/client/fields.tsx
|
|
119
|
-
/**
|
|
120
|
-
* 勾选行:自绘圆角扁平开关(switch),对齐官方 WebUI 无原生 checkbox 的
|
|
121
|
-
* 设计语言(官方选择类控件全走胶囊/菜单,见 cardCss 的 -switch 规则)。
|
|
122
|
-
* 语义保持 checkbox(无障碍树与表单语义不变),视觉自绘。
|
|
123
|
-
*/
|
|
124
|
-
function CheckRow(props) {
|
|
125
|
-
const p = props.prefix ?? "dshp";
|
|
126
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
127
|
-
className: `${p}-checkRow`,
|
|
128
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
129
|
-
id: props.id,
|
|
130
|
-
type: "checkbox",
|
|
131
|
-
role: "switch",
|
|
132
|
-
"aria-checked": props.checked,
|
|
133
|
-
checked: props.checked,
|
|
134
|
-
disabled: props.disabled === true,
|
|
135
|
-
onChange: (event) => props.onEdit(event.target.checked)
|
|
136
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
137
|
-
htmlFor: props.id,
|
|
138
|
-
children: props.label
|
|
139
|
-
})]
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
function SelectField(props) {
|
|
143
|
-
const p = props.prefix ?? "dshp";
|
|
144
|
-
const invalid = props.invalid === true;
|
|
145
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
146
|
-
className: `${p}-field`,
|
|
147
|
-
children: [
|
|
148
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
149
|
-
className: `${p}-head`,
|
|
150
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
151
|
-
className: `${p}-label`,
|
|
152
|
-
htmlFor: props.id,
|
|
153
|
-
children: props.label
|
|
154
|
-
})
|
|
155
|
-
}),
|
|
156
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
157
|
-
id: props.id,
|
|
158
|
-
className: `${p}-select${invalid ? ` ${p}-inputInvalid` : ""}`,
|
|
159
|
-
"aria-invalid": invalid || void 0,
|
|
160
|
-
value: props.value,
|
|
161
|
-
disabled: props.disabled === true,
|
|
162
|
-
onChange: (event) => props.onEdit(event.target.value),
|
|
163
|
-
children: props.options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
164
|
-
value: option.value,
|
|
165
|
-
children: option.label
|
|
166
|
-
}, option.value))
|
|
167
|
-
}),
|
|
168
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
169
|
-
className: invalid ? `${p}-invalid` : `${p}-hint`,
|
|
170
|
-
children: invalid ? props.invalidLabel ?? "" : props.hint ?? ""
|
|
171
|
-
})
|
|
172
|
-
]
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
//#endregion
|
|
176
187
|
//#region ../shared/src/client/i18n.ts
|
|
177
188
|
/** 卡片通用文案(save/discard/unsaved/loading 等四插件共有键)。 */
|
|
178
189
|
const commonZh = {
|
|
@@ -182,7 +193,7 @@ window.__ModuleLoader__.load({
|
|
|
182
193
|
unsaved: "未保存",
|
|
183
194
|
loading: "加载中…",
|
|
184
195
|
unavailable: "配置服务不可用。",
|
|
185
|
-
readOnly: "当前部署无 settings provider
|
|
196
|
+
readOnly: "当前部署无 settings provider,配置为只读;请在 profile 的 cordis.patch.yml 行级配置。",
|
|
186
197
|
invalidNumber: "请输入正整数。",
|
|
187
198
|
collapse: "收起",
|
|
188
199
|
expand: "展开",
|
|
@@ -199,7 +210,7 @@ window.__ModuleLoader__.load({
|
|
|
199
210
|
unsaved: "Unsaved",
|
|
200
211
|
loading: "Loading…",
|
|
201
212
|
unavailable: "Settings service unavailable.",
|
|
202
|
-
readOnly: "No settings provider in this deployment; config is read-only.
|
|
213
|
+
readOnly: "No settings provider in this deployment; config is read-only. Configure it at the profile row in cordis.patch.yml.",
|
|
203
214
|
invalidNumber: "Enter a positive integer.",
|
|
204
215
|
collapse: "Collapse",
|
|
205
216
|
expand: "Expand",
|
|
@@ -405,8 +416,7 @@ ${extra}
|
|
|
405
416
|
//#endregion
|
|
406
417
|
//#region src/ns.ts
|
|
407
418
|
/**
|
|
408
|
-
* settings
|
|
409
|
-
* 已存在于生产 settings.yaml 的旧配置可直接续用。
|
|
419
|
+
* settings 命名空间字面量(纯常量,零依赖)。
|
|
410
420
|
* @module @dsh-plus/subagent-model/ns
|
|
411
421
|
*/
|
|
412
422
|
const SETTINGS_NS = "dsh-plus-subagent-model";
|
|
@@ -467,7 +477,7 @@ ${extra}
|
|
|
467
477
|
* 「子代理模型配置」配置卡片:经 injectPluginConfigCard 注册(插件页 plugins.row.config /
|
|
468
478
|
* plugins.bundle.config,view 分发 summary/page)。
|
|
469
479
|
* 外壳与基础控件走 @dsh-plus/shared/client 套件(CardChrome/CheckRow/SelectField)。
|
|
470
|
-
* 配置读写经共享层 ctx.remote.settings 直连(
|
|
480
|
+
* 配置读写经共享层 ctx.remote.settings 直连(settingsScope 已由 configForms
|
|
471
481
|
* 取代):value 为 schema 解析后的命名空间值
|
|
472
482
|
* (enabled + entries),行集合 = 目录返回的已注册子代理 provider
|
|
473
483
|
* ∪ 已配置条目,保存时全量写回 entries(未配置的新 provider 行以默认空值
|
package/lib/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ interface SubagentModelConfigInput {
|
|
|
24
24
|
reasoningEffort?: string | null;
|
|
25
25
|
}> | null;
|
|
26
26
|
}
|
|
27
|
-
/** 活动字段形态(
|
|
27
|
+
/** 活动字段形态(loader 解析产物:volatile 字段为活动引用)。 */
|
|
28
28
|
type SubagentModelConfigFields = VolatileFields<SubagentModelConfig>;
|
|
29
29
|
declare const Config: z<SubagentModelConfigInput, SubagentModelConfigFields>;
|
|
30
30
|
/** 注入子代理 AgentOptions 的结果对象:只含需要覆盖的字段。 */
|
package/lib/index.js
CHANGED
|
@@ -4,15 +4,14 @@ import z from "@deepseek-ai/schemastery";
|
|
|
4
4
|
//#region src/config.ts
|
|
5
5
|
/**
|
|
6
6
|
* 配置单一事实源:cordis 行级 Config(组合默认值)与 settings namespace
|
|
7
|
-
*
|
|
7
|
+
* (用户层=profile 行级覆盖层 cordis.patch.yml,热生效)共用同一
|
|
8
8
|
* schemastery schema。条目按【子代理 provider 名】键控(standard preset
|
|
9
9
|
* 事实映射:subagent↔spawn、subagent_fork↔fork),特殊键 `default` 作为
|
|
10
10
|
* 未命中具体 provider 时的兜底(spawn/fork 共享同一路由的便捷写法)。
|
|
11
11
|
*
|
|
12
|
-
* 运行时语义(详见 delegation.ts):provider/model/reasoningEffort
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* (含冷恢复 descriptor),不再需要旧版 effort 瀑布的私有字段搬运。
|
|
12
|
+
* 运行时语义(详见 delegation.ts):provider/model/reasoningEffort 显式时注入
|
|
13
|
+
* 子代理 `request.agentOptions`——平台的 resolveChildAgentOptions 原生读取这三个
|
|
14
|
+
* 字段(含冷恢复 descriptor),本插件无需搬运任何私有字段。
|
|
16
15
|
*
|
|
17
16
|
* 与官方 subagent-model-selection 的关系:官方机制是"主代理模型可选白名单",
|
|
18
17
|
* 不强制任何模型(未显式选择时子代理继承主代理路由);本插件补的是
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plus/subagent-model",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.26",
|
|
4
4
|
"description": "dsh-plus service+ui plugin: 为 subagent/subagent_fork 等子代理按提供商配置模型与思考程度(或继承主代理)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dsh-plus/shared": "0.1.
|
|
22
|
+
"@dsh-plus/shared": "0.1.36"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@deepseek-ai/cordis": "^4.0.5-alpha.1",
|
package/src/client/api.ts
CHANGED
package/src/client/card.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 「子代理模型配置」配置卡片:经 injectPluginConfigCard 注册(插件页 plugins.row.config /
|
|
3
3
|
* plugins.bundle.config,view 分发 summary/page)。
|
|
4
4
|
* 外壳与基础控件走 @dsh-plus/shared/client 套件(CardChrome/CheckRow/SelectField)。
|
|
5
|
-
* 配置读写经共享层 ctx.remote.settings 直连(
|
|
5
|
+
* 配置读写经共享层 ctx.remote.settings 直连(settingsScope 已由 configForms
|
|
6
6
|
* 取代):value 为 schema 解析后的命名空间值
|
|
7
7
|
* (enabled + entries),行集合 = 目录返回的已注册子代理 provider
|
|
8
8
|
* ∪ 已配置条目,保存时全量写回 entries(未配置的新 provider 行以默认空值
|
package/src/client/client.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* 类型说明:浏览器半只用到 slots/locale/remote 的很窄一面,
|
|
9
9
|
* scope 与基础控件走 @dsh-plus/shared/client 套件(收编自本插件原实现)。
|
|
10
|
-
*
|
|
11
|
-
* (connection.api.settings RPC 面已移除;
|
|
10
|
+
* 配置读写统一走 ctx.remote.settings 直连
|
|
11
|
+
* (connection.api.settings RPC 面已移除; settingsScope 服务亦删除——
|
|
12
12
|
* configForms 取代,插件卡片自始直连 remote.settings);自定义端点仅剩「模型目录」(api.ts)。
|
|
13
13
|
* 卡片 key/rowId 约定见 @dsh-plus/shared/client/config-slots。
|
|
14
14
|
* @module @dsh-plus/subagent-model/client
|
package/src/config.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 配置单一事实源:cordis 行级 Config(组合默认值)与 settings namespace
|
|
3
|
-
*
|
|
3
|
+
* (用户层=profile 行级覆盖层 cordis.patch.yml,热生效)共用同一
|
|
4
4
|
* schemastery schema。条目按【子代理 provider 名】键控(standard preset
|
|
5
5
|
* 事实映射:subagent↔spawn、subagent_fork↔fork),特殊键 `default` 作为
|
|
6
6
|
* 未命中具体 provider 时的兜底(spawn/fork 共享同一路由的便捷写法)。
|
|
7
7
|
*
|
|
8
|
-
* 运行时语义(详见 delegation.ts):provider/model/reasoningEffort
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* (含冷恢复 descriptor),不再需要旧版 effort 瀑布的私有字段搬运。
|
|
8
|
+
* 运行时语义(详见 delegation.ts):provider/model/reasoningEffort 显式时注入
|
|
9
|
+
* 子代理 `request.agentOptions`——平台的 resolveChildAgentOptions 原生读取这三个
|
|
10
|
+
* 字段(含冷恢复 descriptor),本插件无需搬运任何私有字段。
|
|
12
11
|
*
|
|
13
12
|
* 与官方 subagent-model-selection 的关系:官方机制是"主代理模型可选白名单",
|
|
14
13
|
* 不强制任何模型(未显式选择时子代理继承主代理路由);本插件补的是
|
|
@@ -71,10 +70,10 @@ const EntrySchema = z.object({
|
|
|
71
70
|
.default(EFFORT_INHERIT),
|
|
72
71
|
})
|
|
73
72
|
|
|
74
|
-
//
|
|
73
|
+
// 全字段 `.volatile()`——条目进入 settings describe 视图(卡片可读写),
|
|
75
74
|
// loader 原位提交活动引用;输出面标注活动字段声明面(结构兼容 volatile 引用),
|
|
76
75
|
// 平面消费契约保持 SubagentModelConfig 接口不变。
|
|
77
|
-
/** 活动字段形态(
|
|
76
|
+
/** 活动字段形态(loader 解析产物:volatile 字段为活动引用)。 */
|
|
78
77
|
export type SubagentModelConfigFields = VolatileFields<SubagentModelConfig>
|
|
79
78
|
|
|
80
79
|
export const Config: z<SubagentModelConfigInput, SubagentModelConfigFields> = z.object({
|
package/src/delegation.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 运行时挂钩:子代理模型路由的注入点。
|
|
3
3
|
*
|
|
4
|
-
* 机制依据(官方 dsh-subagent
|
|
4
|
+
* 机制依据(官方 dsh-subagent):子代理的模型由【创建时】的
|
|
5
5
|
* AgentOptions 决定——`resolveChildAgentOptions(parent, request.agentOptions,
|
|
6
6
|
* childDepth)` = 父 options 快照 + 显式 agentOptions(后者胜出),且原生读取
|
|
7
7
|
* provider/model/reasoningEffort 三个字段(materialize → agents.create/resume
|
|
8
8
|
* → agentLoop.options),冷恢复(continuable resume)经 descriptor 持久化保持。
|
|
9
9
|
* 因此只需在 `request.agentOptions` 注入 provider/model/reasoningEffort,
|
|
10
|
-
*
|
|
10
|
+
* 路由即命中,无需搬运任何私有字段。
|
|
11
11
|
*
|
|
12
12
|
* 两个挂钩均幂等(Symbol 标记 + dispose 恢复),HMR 重载安全。
|
|
13
13
|
* @module @dsh-plus/subagent-model/delegation
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 或选择从主代理继承;`default` 条目可让 spawn/fork 共享同一路由。
|
|
5
5
|
* 主代理显式选择的路由(官方 subagent-model-selection 的 model 字段)优先,
|
|
6
6
|
* 本插件只补"未选择时的强制默认"。
|
|
7
|
-
* 配置经 settings
|
|
7
|
+
* 配置经 settings 用户层(profile 行级覆盖层 cordis.patch.yml)持久化并热生效;
|
|
8
8
|
* 配置 UI 位于 webui 侧边栏「插件」页的 bundle 行配置页(plugins.row.config /
|
|
9
9
|
* plugins.bundle.config 两槽位,见 @dsh-plus/shared/client/config-slots);
|
|
10
10
|
* 模型目录经 host webServer 同源端点下发。
|
package/src/ns.ts
CHANGED
package/src/service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SubagentModelService:子代理模型配置中枢(host 半)。
|
|
3
|
-
* - 配置:
|
|
3
|
+
* - 配置:volatile 活动引用(loader 解析层并入用户层,GUI 写入原位提交
|
|
4
4
|
* 热生效);写入经 internal/config waterfall 校验(validateEntries 规则
|
|
5
5
|
* (model 不能脱离 provider 等),非法即拒、不落盘)。
|
|
6
6
|
* - 委托挂钩:包装 ctx.subagents.start/startContinuable,按 provider 名
|
|
@@ -39,7 +39,7 @@ export class SubagentModelService extends Service {
|
|
|
39
39
|
|
|
40
40
|
constructor(ctx: Context, config: SubagentModelConfig | SubagentModelConfigFields) {
|
|
41
41
|
super(ctx, 'subagentModel')
|
|
42
|
-
//
|
|
42
|
+
// 替代 installSection/setSource:活动引用原位提交——委托挂钩
|
|
43
43
|
// 永远现取最新配置,热生效无竞态。
|
|
44
44
|
this.current = () => unwrapVolatile(config)
|
|
45
45
|
// 写入校验(原 installSection validate;官方 llm-pi-ai 同款 waterfall):
|