@dsh-plus/subagent-model 0.3.12 → 0.3.14
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 +3 -2
- package/lib/index.d.ts +7 -4
- package/lib/index.js +11 -18
- package/package.json +14 -14
- package/src/client/api.ts +2 -2
- package/src/client/card.tsx +2 -1
- package/src/client/client.ts +2 -2
- package/src/config.ts +14 -3
- package/src/index.ts +4 -3
- package/src/service.ts +25 -19
package/lib/client.js
CHANGED
|
@@ -42,7 +42,7 @@ window.__ModuleLoader__.load({
|
|
|
42
42
|
className: `${p}-pending`,
|
|
43
43
|
children: props.dirtyLabel
|
|
44
44
|
}) : null,
|
|
45
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.
|
|
45
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: `${p}-chevron${props.open ? ` ${p}-chevronOpen` : ""}` })
|
|
46
46
|
]
|
|
47
47
|
}), props.open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
48
48
|
className: `${p}-body`,
|
|
@@ -458,7 +458,8 @@ ${extra}
|
|
|
458
458
|
* 「子代理模型配置」配置卡片:经 injectPluginConfigCard 注册(legacy settings.plugin.item
|
|
459
459
|
* 与 0.1.6-alpha.2 插件页 plugins.row.config / plugins.bundle.config,view 分发 summary/page)。
|
|
460
460
|
* 外壳与基础控件走 @dsh-plus/shared/client 套件(CardChrome/CheckRow/SelectField)。
|
|
461
|
-
*
|
|
461
|
+
* 配置读写经共享层 ctx.remote.settings 直连(0.1.7 起 settingsScope 已由 configForms
|
|
462
|
+
* 取代):value 为 schema 解析后的命名空间值
|
|
462
463
|
* (enabled + entries),行集合 = 目录返回的已注册子代理 provider
|
|
463
464
|
* ∪ 已配置条目,保存时全量写回 entries(未配置的新 provider 行以默认空值
|
|
464
465
|
* 落盘,自文档化);「模型目录」为唯一保留的自定义端点。
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import z from "@deepseek-ai/schemastery";
|
|
2
1
|
import { Context, Service } from "@deepseek-ai/cordis";
|
|
2
|
+
import { VolatileFields } from "@dsh-plus/shared";
|
|
3
|
+
import z from "@deepseek-ai/schemastery";
|
|
3
4
|
//#region src/config.d.ts
|
|
4
5
|
/** 一条条目的规范输出形态。 */
|
|
5
6
|
interface EntryConfig {
|
|
@@ -23,7 +24,9 @@ interface SubagentModelConfigInput {
|
|
|
23
24
|
reasoningEffort?: string | null;
|
|
24
25
|
}> | null;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
/** 活动字段形态(0.1.7 loader 解析产物:volatile 字段为活动引用)。 */
|
|
28
|
+
type SubagentModelConfigFields = VolatileFields<SubagentModelConfig>;
|
|
29
|
+
declare const Config: z<SubagentModelConfigInput, SubagentModelConfigFields>;
|
|
27
30
|
/** 注入子代理 AgentOptions 的结果对象:只含需要覆盖的字段。 */
|
|
28
31
|
interface InjectedOptions {
|
|
29
32
|
provider?: string;
|
|
@@ -40,7 +43,7 @@ declare module '@deepseek-ai/cordis' {
|
|
|
40
43
|
declare class SubagentModelService extends Service {
|
|
41
44
|
static inject: string[];
|
|
42
45
|
private current;
|
|
43
|
-
constructor(ctx: Context, config: SubagentModelConfig);
|
|
46
|
+
constructor(ctx: Context, config: SubagentModelConfig | SubagentModelConfigFields);
|
|
44
47
|
/** 当前生效配置(settings 用户层解析结果或 cordis 行级 config)。 */
|
|
45
48
|
currentConfig(): SubagentModelConfig;
|
|
46
49
|
}
|
|
@@ -48,6 +51,6 @@ declare class SubagentModelService extends Service {
|
|
|
48
51
|
//#region src/index.d.ts
|
|
49
52
|
declare const name = "dsh-plus-subagent-model";
|
|
50
53
|
declare const inject: readonly ['subagents', 'llm'];
|
|
51
|
-
declare function apply(ctx: Context, config: SubagentModelConfig): void;
|
|
54
|
+
declare function apply(ctx: Context, config: SubagentModelConfig | SubagentModelConfigFields): void;
|
|
52
55
|
//#endregion
|
|
53
56
|
export { Config, type EntryConfig, type InjectedOptions, type SubagentModelConfig, SubagentModelService, apply, inject, name };
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import z from "@deepseek-ai/schemastery";
|
|
2
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
3
|
-
|
|
2
|
+
import { unwrapVolatile } from "@dsh-plus/shared";
|
|
3
|
+
import z from "@deepseek-ai/schemastery";
|
|
4
4
|
//#region src/config.ts
|
|
5
5
|
/**
|
|
6
6
|
* 配置单一事实源:cordis 行级 Config(组合默认值)与 settings namespace
|
|
@@ -19,8 +19,6 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
19
19
|
* "管理端强制默认路由"——主代理未显式选择时才注入,显式选择仍优先。
|
|
20
20
|
* @module @dsh-plus/subagent-model/config
|
|
21
21
|
*/
|
|
22
|
-
/** settings 命名空间(字面量即合法命名空间;webui 配置卡片与插件运行期读取同一份)。 */
|
|
23
|
-
const SETTINGS_NS = "dsh-plus-subagent-model";
|
|
24
22
|
/** 思考程度哨兵值:继承主代理(不注入 effort 字段)。 */
|
|
25
23
|
const EFFORT_INHERIT = "inherit";
|
|
26
24
|
/** 思考程度哨兵值:跟随模型默认(显式剥离任何继承/推导出的 effort)。 */
|
|
@@ -34,8 +32,8 @@ const EntrySchema = z.object({
|
|
|
34
32
|
reasoningEffort: z.string().description(`思考程度:${EFFORT_INHERIT}(继承主代理)/ ${EFFORT_DEFAULT}(跟随模型默认)/ 提供商目录档位 id`).default(EFFORT_INHERIT)
|
|
35
33
|
});
|
|
36
34
|
const Config = z.object({
|
|
37
|
-
enabled: z.boolean().description("总开关").default(false),
|
|
38
|
-
entries: z.dict(EntrySchema).description("按子代理 provider 名(spawn/fork/…)配置").default({})
|
|
35
|
+
enabled: z.boolean().description("总开关").default(false).volatile(),
|
|
36
|
+
entries: z.dict(EntrySchema).description("按子代理 provider 名(spawn/fork/…)配置").default({}).volatile()
|
|
39
37
|
});
|
|
40
38
|
/**
|
|
41
39
|
* 解析一条条目为要注入的 agentOptions 片段。
|
|
@@ -244,18 +242,13 @@ var SubagentModelService = class extends Service {
|
|
|
244
242
|
current;
|
|
245
243
|
constructor(ctx, config) {
|
|
246
244
|
super(ctx, "subagentModel");
|
|
247
|
-
this.current = () => config;
|
|
248
|
-
ctx.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
setSource: (source) => {
|
|
255
|
-
this.current = source;
|
|
256
|
-
},
|
|
257
|
-
onChange: () => {}
|
|
258
|
-
});
|
|
245
|
+
this.current = () => unwrapVolatile(config);
|
|
246
|
+
ctx.on("internal/config", function(_raw, next) {
|
|
247
|
+
const candidate = next();
|
|
248
|
+
if (this !== ctx.fiber) return candidate;
|
|
249
|
+
const error = validateEntries(unwrapVolatile(Config(candidate)).entries);
|
|
250
|
+
if (error !== null) throw new Error(`subagent-model: ${error}`);
|
|
251
|
+
return candidate;
|
|
259
252
|
});
|
|
260
253
|
installDelegationHook(ctx, () => this.current());
|
|
261
254
|
ctx.inject(["webServer"], (webCtx) => {
|
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.14",
|
|
4
4
|
"description": "dsh-plus service+ui plugin: 为 subagent/subagent_fork 等子代理按提供商配置模型与思考程度(或继承主代理)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dsh-plus/shared": "0.1.
|
|
22
|
+
"@dsh-plus/shared": "0.1.23"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
26
|
-
"@deepseek-ai/dsh-host-webserver": "^0.1.
|
|
27
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
28
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
29
|
-
"@deepseek-ai/dsh-subagent": "^0.1.
|
|
30
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
25
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
26
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.7-rc.1",
|
|
27
|
+
"@deepseek-ai/dsh-llm": "^0.1.7-rc.1",
|
|
28
|
+
"@deepseek-ai/dsh-settings": "^0.1.7-rc.1",
|
|
29
|
+
"@deepseek-ai/dsh-subagent": "^0.1.7-rc.1",
|
|
30
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@deepseek-ai/cordis": "4.0.
|
|
34
|
-
"@deepseek-ai/dsh-host-webserver": "0.1.
|
|
35
|
-
"@deepseek-ai/dsh-llm": "0.1.
|
|
36
|
-
"@deepseek-ai/dsh-settings": "0.1.
|
|
37
|
-
"@deepseek-ai/dsh-subagent": "0.1.
|
|
38
|
-
"@deepseek-ai/schemastery": "3.18.
|
|
33
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
34
|
+
"@deepseek-ai/dsh-host-webserver": "0.1.7-rc.1",
|
|
35
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.1",
|
|
36
|
+
"@deepseek-ai/dsh-settings": "0.1.7-rc.1",
|
|
37
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-rc.1",
|
|
38
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
39
39
|
"@types/node": "26.4.0",
|
|
40
40
|
"@types/react": "~18.3.31",
|
|
41
41
|
"react": "^18.2.0"
|
package/src/client/api.ts
CHANGED
package/src/client/card.tsx
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* 「子代理模型配置」配置卡片:经 injectPluginConfigCard 注册(legacy settings.plugin.item
|
|
3
3
|
* 与 0.1.6-alpha.2 插件页 plugins.row.config / plugins.bundle.config,view 分发 summary/page)。
|
|
4
4
|
* 外壳与基础控件走 @dsh-plus/shared/client 套件(CardChrome/CheckRow/SelectField)。
|
|
5
|
-
*
|
|
5
|
+
* 配置读写经共享层 ctx.remote.settings 直连(0.1.7 起 settingsScope 已由 configForms
|
|
6
|
+
* 取代):value 为 schema 解析后的命名空间值
|
|
6
7
|
* (enabled + entries),行集合 = 目录返回的已注册子代理 provider
|
|
7
8
|
* ∪ 已配置条目,保存时全量写回 entries(未配置的新 provider 行以默认空值
|
|
8
9
|
* 落盘,自文档化);「模型目录」为唯一保留的自定义端点。
|
package/src/client/client.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* 类型说明:浏览器半只用到 slots/locale/remote 的很窄一面,
|
|
9
9
|
* scope 与基础控件走 @dsh-plus/shared/client 套件(收编自本插件原实现)。
|
|
10
10
|
* 0.1.2-alpha.1 起配置读写统一走 ctx.remote.settings 直连
|
|
11
|
-
* (connection.api.settings RPC
|
|
12
|
-
*
|
|
11
|
+
* (connection.api.settings RPC 面已移除;0.1.7 起 settingsScope 服务亦删除——
|
|
12
|
+
* configForms 取代,插件卡片自始直连 remote.settings);自定义端点仅剩「模型目录」(api.ts)。
|
|
13
13
|
* 卡片 key/rowId 约定见 @dsh-plus/shared/client/config-slots。
|
|
14
14
|
* @module @dsh-plus/subagent-model/client
|
|
15
15
|
*/
|
package/src/config.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import z from '@deepseek-ai/schemastery'
|
|
20
|
+
import type { VolatileFields } from '@dsh-plus/shared'
|
|
20
21
|
|
|
21
22
|
import { SETTINGS_NS as NS_LITERAL } from './ns.ts'
|
|
22
23
|
|
|
@@ -70,9 +71,19 @@ const EntrySchema = z.object({
|
|
|
70
71
|
.default(EFFORT_INHERIT),
|
|
71
72
|
})
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
// 0.1.7:全字段 `.volatile()`——条目进入 settings describe 视图(卡片可读写),
|
|
75
|
+
// loader 原位提交活动引用;输出面标注活动字段声明面(结构兼容 volatile 引用),
|
|
76
|
+
// 平面消费契约保持 SubagentModelConfig 接口不变。
|
|
77
|
+
/** 活动字段形态(0.1.7 loader 解析产物:volatile 字段为活动引用)。 */
|
|
78
|
+
export type SubagentModelConfigFields = VolatileFields<SubagentModelConfig>
|
|
79
|
+
|
|
80
|
+
export const Config: z<SubagentModelConfigInput, SubagentModelConfigFields> = z.object({
|
|
81
|
+
enabled: z.boolean().description('总开关').default(false).volatile(),
|
|
82
|
+
entries: z
|
|
83
|
+
.dict(EntrySchema)
|
|
84
|
+
.description('按子代理 provider 名(spawn/fork/…)配置')
|
|
85
|
+
.default({})
|
|
86
|
+
.volatile(),
|
|
76
87
|
})
|
|
77
88
|
|
|
78
89
|
/** 注入子代理 AgentOptions 的结果对象:只含需要覆盖的字段。 */
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { Context } from '@deepseek-ai/cordis'
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import type { SubagentModelConfig, SubagentModelConfigFields } from './config.ts'
|
|
16
16
|
import { SubagentModelService } from './service.ts'
|
|
17
17
|
|
|
18
18
|
export const name = 'dsh-plus-subagent-model'
|
|
@@ -24,9 +24,10 @@ export type {
|
|
|
24
24
|
InjectedOptions,
|
|
25
25
|
SubagentModelConfig,
|
|
26
26
|
} from './config.ts'
|
|
27
|
+
export { Config } from './config.ts'
|
|
27
28
|
export { SubagentModelService } from './service.ts'
|
|
28
|
-
export { Config }
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
// config 运行期为 loader 解析的 volatile 活动字段(测试可直接传平面值)。
|
|
31
|
+
export function apply(ctx: Context, config: SubagentModelConfig | SubagentModelConfigFields): void {
|
|
31
32
|
ctx.plugin(SubagentModelService, config)
|
|
32
33
|
}
|
package/src/service.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SubagentModelService:子代理模型配置中枢(host 半)。
|
|
3
|
-
* - 配置:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* - 配置:0.1.7 volatile 活动引用(loader 解析层并入用户层,GUI 写入原位提交
|
|
4
|
+
* 热生效);写入经 internal/config waterfall 校验(validateEntries 规则
|
|
5
|
+
* (model 不能脱离 provider 等),非法即拒、不落盘)。
|
|
6
6
|
* - 委托挂钩:包装 ctx.subagents.start/startContinuable,按 provider 名
|
|
7
7
|
* (未命中回落 default 条目)注入 agentOptions(provider/model/effort)。
|
|
8
8
|
* - 自定义端点:ctx.webServer 仅注册模型目录路由(配置读写已走官方
|
|
@@ -12,8 +12,15 @@
|
|
|
12
12
|
import type { Context } from '@deepseek-ai/cordis'
|
|
13
13
|
import { Service } from '@deepseek-ai/cordis'
|
|
14
14
|
import type {} from '@deepseek-ai/dsh-settings'
|
|
15
|
+
import { unwrapVolatile } from '@dsh-plus/shared'
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
Config,
|
|
19
|
+
type SubagentModelConfig,
|
|
20
|
+
type SubagentModelConfigFields,
|
|
21
|
+
type SubagentModelConfigInput,
|
|
22
|
+
validateEntries,
|
|
23
|
+
} from './config.ts'
|
|
17
24
|
import { registerCatalogApi } from './config-api.ts'
|
|
18
25
|
import { installDelegationHook } from './delegation.ts'
|
|
19
26
|
|
|
@@ -30,22 +37,21 @@ export class SubagentModelService extends Service {
|
|
|
30
37
|
|
|
31
38
|
private current: () => SubagentModelConfig
|
|
32
39
|
|
|
33
|
-
constructor(ctx: Context, config: SubagentModelConfig) {
|
|
40
|
+
constructor(ctx: Context, config: SubagentModelConfig | SubagentModelConfigFields) {
|
|
34
41
|
super(ctx, 'subagentModel')
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
42
|
+
// 0.1.7 替代 installSection/setSource:活动引用原位提交——委托挂钩
|
|
43
|
+
// 永远现取最新配置,热生效无竞态。
|
|
44
|
+
this.current = () => unwrapVolatile(config)
|
|
45
|
+
// 写入校验(原 installSection validate;官方 llm-pi-ai 同款 waterfall):
|
|
46
|
+
// configEditor.edit 落盘前先跑 internal/config,handler throw 即拒绝整笔写入。
|
|
47
|
+
ctx.on('internal/config', function (_raw: unknown, next: () => unknown) {
|
|
48
|
+
const candidate = next()
|
|
49
|
+
if (this !== ctx.fiber) return candidate
|
|
50
|
+
const error = validateEntries(
|
|
51
|
+
unwrapVolatile(Config(candidate as SubagentModelConfigInput)).entries,
|
|
52
|
+
)
|
|
53
|
+
if (error !== null) throw new Error(`subagent-model: ${error}`)
|
|
54
|
+
return candidate
|
|
49
55
|
})
|
|
50
56
|
installDelegationHook(ctx, () => this.current())
|
|
51
57
|
// 模型目录端点(卡片下拉数据源;仅监听 dsh web 同源)。
|