@dsh-plus/subagent-model 0.3.26 → 0.3.28

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 CHANGED
@@ -154,7 +154,7 @@ window.__ModuleLoader__.load({
154
154
  const DSH_PLUS_BUNDLE = "@dsh-plus/bundle-main";
155
155
  /**
156
156
  * 把一张配置卡片注册进插件页的两个配置槽位。
157
- * 两个槽位都由 0.2.1-alpha.1 的插件页声明,任一缺席即报错——不做版本探测。
157
+ * 两个槽位都由 0.2.1-alpha.2 的插件页声明,任一缺席即报错——不做版本探测。
158
158
  */
159
159
  function injectPluginConfigCard(slots, reg) {
160
160
  const base = {
@@ -323,7 +323,7 @@ window.__ModuleLoader__.load({
323
323
  /**
324
324
  * 配置分节样式工厂(各插件 client 的公共收编版)。
325
325
  *
326
- * 目标宿主 dsh 0.2.1-alpha.1:插件页把配置视图放进已有页面级内边距的容器里
326
+ * 目标宿主 dsh 0.2.1-alpha.2:插件页把配置视图放进已有页面级内边距的容器里
327
327
  * (`div.detailSections[data-plugin-config]` 或 `section.detailSection[data-plugin-config]`),
328
328
  * 外层无边框——故这里输出的是**无边框分节**(小节标题 13px/600、字段 12px 0、
329
329
  * 横向零内边距、页脚非 sticky),度量对齐官方设置页
package/lib/index.js CHANGED
@@ -189,10 +189,10 @@ function registerCatalogApi(ctx) {
189
189
  //#region src/delegation.ts
190
190
  const WRAPPED = Symbol("dsh-plus-subagent-model.wrapped");
191
191
  /**
192
- * 包装 `ctx.subagents.start` / `startContinuable`:按 provider 名命中配置条目
193
- * (未命中回落 default 条目),向委托请求注入 agentOptions——调用方显式携带
194
- * 的 agentOptions(工具行配置 / 主代理显式选择)优先,插件只补空缺。
195
- * 未命中条目时完全直通(原生继承主代理行为)。
192
+ * 包装 `ctx.subagents.startActivation`:按 provider 名命中配置条目(未命中回落
193
+ * default 条目),向委托请求注入 agentOptions——调用方显式携带的 agentOptions
194
+ * (工具行配置 / 主代理显式选择)优先,插件只补空缺。未命中条目时完全直通
195
+ * (原生继承主代理行为)。
196
196
  * 返回注销函数(恢复原方法),随调用方 fiber 释放。
197
197
  */
198
198
  function installDelegationHook(ctx, current) {
@@ -206,20 +206,11 @@ function installDelegationHook(ctx, current) {
206
206
  ctx.logger("subagent-model").warn("subagents 服务已被本插件包装,跳过重复挂钩");
207
207
  return () => {};
208
208
  }
209
- const originalStart = subagents.start.bind(subagents);
210
- const originalContinuable = subagents.startContinuable.bind(subagents);
211
- subagents.start = async (name, request) => {
212
- const injected = entryFor(current, name);
213
- if (injected === void 0) return originalStart(name, request);
214
- return originalStart(name, {
215
- ...request,
216
- agentOptions: mergeAgentOptions(injected, request.agentOptions)
217
- });
218
- };
219
- subagents.startContinuable = async (spec) => {
209
+ const originalStart = subagents.startActivation.bind(subagents);
210
+ subagents.startActivation = async (spec) => {
220
211
  const injected = entryFor(current, spec.provider);
221
- if (injected === void 0) return originalContinuable(spec);
222
- return originalContinuable({
212
+ if (injected === void 0) return originalStart(spec);
213
+ return originalStart({
223
214
  ...spec,
224
215
  request: {
225
216
  ...spec.request,
@@ -229,8 +220,7 @@ function installDelegationHook(ctx, current) {
229
220
  };
230
221
  marked[WRAPPED] = true;
231
222
  return ctx.effect(() => () => {
232
- subagents.start = originalStart;
233
- subagents.startContinuable = originalContinuable;
223
+ subagents.startActivation = originalStart;
234
224
  delete marked[WRAPPED];
235
225
  }, "subagent-model: delegation hook");
236
226
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/subagent-model",
3
- "version": "0.3.26",
3
+ "version": "0.3.28",
4
4
  "description": "dsh-plus service+ui plugin: 为 subagent/subagent_fork 等子代理按提供商配置模型与思考程度(或继承主代理)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -19,22 +19,22 @@
19
19
  "src"
20
20
  ],
21
21
  "dependencies": {
22
- "@dsh-plus/shared": "0.1.36"
22
+ "@dsh-plus/shared": "0.1.38"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@deepseek-ai/cordis": "^4.0.5-alpha.1",
26
- "@deepseek-ai/dsh-host-webserver": "^0.2.1-alpha.1",
27
- "@deepseek-ai/dsh-llm": "^0.2.1-alpha.1",
28
- "@deepseek-ai/dsh-settings": "^0.2.1-alpha.1",
29
- "@deepseek-ai/dsh-subagent": "^0.2.1-alpha.1",
26
+ "@deepseek-ai/dsh-host-webserver": "^0.2.1-alpha.2",
27
+ "@deepseek-ai/dsh-llm": "^0.2.1-alpha.2",
28
+ "@deepseek-ai/dsh-settings": "^0.2.1-alpha.2",
29
+ "@deepseek-ai/dsh-subagent": "^0.2.1-alpha.2",
30
30
  "@deepseek-ai/schemastery": "^3.18.5-alpha.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@deepseek-ai/cordis": "4.0.5-alpha.1",
34
- "@deepseek-ai/dsh-host-webserver": "0.2.1-alpha.1",
35
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
36
- "@deepseek-ai/dsh-settings": "0.2.1-alpha.1",
37
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.1",
34
+ "@deepseek-ai/dsh-host-webserver": "0.2.1-alpha.2",
35
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
36
+ "@deepseek-ai/dsh-settings": "0.2.1-alpha.2",
37
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.2",
38
38
  "@deepseek-ai/schemastery": "3.18.5-alpha.1",
39
39
  "@types/node": "26.4.0",
40
40
  "@types/react": "~18.3.31",
package/src/delegation.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  /**
2
2
  * 运行时挂钩:子代理模型路由的注入点。
3
3
  *
4
- * 机制依据(官方 dsh-subagent):子代理的模型由【创建时】的
4
+ * 机制依据(官方 dsh-subagent 0.2.1-alpha.2):子代理的模型由【创建时】的
5
5
  * AgentOptions 决定——`resolveChildAgentOptions(parent, request.agentOptions,
6
6
  * childDepth)` = 父 options 快照 + 显式 agentOptions(后者胜出),且原生读取
7
7
  * provider/model/reasoningEffort 三个字段(materialize → agents.create/resume
8
- * → agentLoop.options),冷恢复(continuable resume)经 descriptor 持久化保持。
9
- * 因此只需在 `request.agentOptions` 注入 provider/model/reasoningEffort,
10
- * 路由即命中,无需搬运任何私有字段。
8
+ * → agentLoop.options),冷恢复经 descriptor 持久化保持。因此只需在
9
+ * `spec.request.agentOptions` 注入 provider/model/reasoningEffort 即可命中路由,
10
+ * 无需搬运任何私有字段。
11
11
  *
12
- * 两个挂钩均幂等(Symbol 标记 + dispose 恢复),HMR 重载安全。
12
+ * 挂钩面:官方把"一次性执行"与"可继续子代理"统一收进
13
+ * `SubagentRuntime.startActivation(spec)`(旧版 `start` / `startContinuable` 已
14
+ * 移除),spec 以 `provider` 选后端、`request` 携带委托请求,故单点包装即可覆盖
15
+ * 全部委托路径。挂钩幂等(Symbol 标记 + dispose 恢复),HMR 重载安全。
13
16
  * @module @dsh-plus/subagent-model/delegation
14
17
  */
15
18
  import type { Context } from '@deepseek-ai/cordis'
@@ -23,10 +26,9 @@ import {
23
26
 
24
27
  const WRAPPED = Symbol('dsh-plus-subagent-model.wrapped')
25
28
 
26
- /** 子代理服务的最小运行期面(仅包装用到的两个入口)。 */
29
+ /** 子代理服务的最小运行期面(仅包装用到的唯一创建入口)。 */
27
30
  export interface SubagentsLike {
28
- start(name: string, request: SubagentStartRequest): Promise<unknown>
29
- startContinuable(spec: ContinuableStartSpec): Promise<unknown>
31
+ startActivation(spec: SubagentActivationSpec): Promise<unknown>
30
32
  }
31
33
 
32
34
  /** 子代理创建请求的窄面(只读 agentOptions)。 */
@@ -34,17 +36,17 @@ export interface SubagentStartRequest {
34
36
  agentOptions?: InjectedOptions
35
37
  }
36
38
 
37
- /** 可继续子代理启动规范的窄面。 */
38
- export interface ContinuableStartSpec {
39
+ /** 委托激活规范的窄面:后端名 + 创建请求。 */
40
+ export interface SubagentActivationSpec {
39
41
  provider: string
40
42
  request: SubagentStartRequest
41
43
  }
42
44
 
43
45
  /**
44
- * 包装 `ctx.subagents.start` / `startContinuable`:按 provider 名命中配置条目
45
- * (未命中回落 default 条目),向委托请求注入 agentOptions——调用方显式携带
46
- * 的 agentOptions(工具行配置 / 主代理显式选择)优先,插件只补空缺。
47
- * 未命中条目时完全直通(原生继承主代理行为)。
46
+ * 包装 `ctx.subagents.startActivation`:按 provider 名命中配置条目(未命中回落
47
+ * default 条目),向委托请求注入 agentOptions——调用方显式携带的 agentOptions
48
+ * (工具行配置 / 主代理显式选择)优先,插件只补空缺。未命中条目时完全直通
49
+ * (原生继承主代理行为)。
48
50
  * 返回注销函数(恢复原方法),随调用方 fiber 释放。
49
51
  */
50
52
  export function installDelegationHook(
@@ -61,20 +63,11 @@ export function installDelegationHook(
61
63
  ctx.logger('subagent-model').warn('subagents 服务已被本插件包装,跳过重复挂钩')
62
64
  return () => {}
63
65
  }
64
- const originalStart = subagents.start.bind(subagents)
65
- const originalContinuable = subagents.startContinuable.bind(subagents)
66
- subagents.start = async (name, request) => {
67
- const injected = entryFor(current, name)
68
- if (injected === undefined) return originalStart(name, request)
69
- return originalStart(name, {
70
- ...request,
71
- agentOptions: mergeAgentOptions(injected, request.agentOptions),
72
- })
73
- }
74
- subagents.startContinuable = async (spec) => {
66
+ const originalStart = subagents.startActivation.bind(subagents)
67
+ subagents.startActivation = async (spec) => {
75
68
  const injected = entryFor(current, spec.provider)
76
- if (injected === undefined) return originalContinuable(spec)
77
- return originalContinuable({
69
+ if (injected === undefined) return originalStart(spec)
70
+ return originalStart({
78
71
  ...spec,
79
72
  request: {
80
73
  ...spec.request,
@@ -85,8 +78,7 @@ export function installDelegationHook(
85
78
  marked[WRAPPED] = true
86
79
  return ctx.effect(
87
80
  () => () => {
88
- subagents.start = originalStart
89
- subagents.startContinuable = originalContinuable
81
+ subagents.startActivation = originalStart
90
82
  delete marked[WRAPPED]
91
83
  },
92
84
  'subagent-model: delegation hook',
package/src/service.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * - 配置:volatile 活动引用(loader 解析层并入用户层,GUI 写入原位提交
4
4
  * 热生效);写入经 internal/config waterfall 校验(validateEntries 规则
5
5
  * (model 不能脱离 provider 等),非法即拒、不落盘)。
6
- * - 委托挂钩:包装 ctx.subagents.start/startContinuable,按 provider 名
6
+ * - 委托挂钩:包装 ctx.subagents.startActivation,按 provider 名
7
7
  * (未命中回落 default 条目)注入 agentOptions(provider/model/effort)。
8
8
  * - 自定义端点:ctx.webServer 仅注册模型目录路由(配置读写已走官方
9
9
  * remote.settings 直连,配置卡片(两槽位注册)见 client 半)。