@dsh-plus/subagent-model 0.3.32 → 0.3.34
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 +852 -134
- package/lib/index.d.ts +0 -2
- package/lib/index.js +2 -5
- package/package.json +14 -14
- package/src/client/card.tsx +4 -17
- package/src/client/draft.ts +2 -4
- package/src/client/i18n.ts +0 -2
- package/src/config.ts +1 -4
package/lib/index.d.ts
CHANGED
|
@@ -11,12 +11,10 @@ interface EntryConfig {
|
|
|
11
11
|
}
|
|
12
12
|
/** 配置的规范输出形态。 */
|
|
13
13
|
interface SubagentModelConfig {
|
|
14
|
-
enabled: boolean;
|
|
15
14
|
entries: Record<string, EntryConfig>;
|
|
16
15
|
}
|
|
17
16
|
/** 配置的宽松输入形态(schema 校验前的用户数据)。 */
|
|
18
17
|
interface SubagentModelConfigInput {
|
|
19
|
-
enabled?: boolean | null;
|
|
20
18
|
entries?: Record<string, {
|
|
21
19
|
enabled?: boolean | null;
|
|
22
20
|
provider?: string | null;
|
package/lib/index.js
CHANGED
|
@@ -30,10 +30,7 @@ const EntrySchema = z.object({
|
|
|
30
30
|
model: z.string().description("模型 id;留空 = 继承主代理").default(""),
|
|
31
31
|
reasoningEffort: z.string().description(`思考程度:${EFFORT_INHERIT}(继承主代理)/ ${EFFORT_DEFAULT}(跟随模型默认)/ 提供商目录档位 id`).default(EFFORT_INHERIT)
|
|
32
32
|
});
|
|
33
|
-
const Config = z.object({
|
|
34
|
-
enabled: z.boolean().description("总开关").default(false).volatile(),
|
|
35
|
-
entries: z.dict(EntrySchema).description("按子代理 provider 名(spawn/fork/…)配置").default({}).volatile()
|
|
36
|
-
});
|
|
33
|
+
const Config = z.object({ entries: z.dict(EntrySchema).description("按子代理 provider 名(spawn/fork/…)配置").default({}).volatile() });
|
|
37
34
|
/**
|
|
38
35
|
* 解析一条条目为要注入的 agentOptions 片段。
|
|
39
36
|
* 未启用或全继承时返回 undefined(完全保持 dsh 原生行为)。
|
|
@@ -48,7 +45,7 @@ function resolveEntry(entry) {
|
|
|
48
45
|
}
|
|
49
46
|
/** 按 provider 名解析条目,未命中时回落 default 兜底条目。 */
|
|
50
47
|
function entryFor(current, name) {
|
|
51
|
-
if (name === void 0
|
|
48
|
+
if (name === void 0) return void 0;
|
|
52
49
|
const entries = current().entries;
|
|
53
50
|
const direct = entries[name];
|
|
54
51
|
if (direct !== void 0) return resolveEntry(direct);
|
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.34",
|
|
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.44"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@deepseek-ai/cordis": "^4.0.5
|
|
26
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.1-
|
|
27
|
-
"@deepseek-ai/dsh-llm": "^0.2.1-
|
|
28
|
-
"@deepseek-ai/dsh-settings": "^0.2.1-
|
|
29
|
-
"@deepseek-ai/dsh-subagent": "^0.2.1-
|
|
30
|
-
"@deepseek-ai/schemastery": "^3.18.5
|
|
25
|
+
"@deepseek-ai/cordis": "^4.0.5",
|
|
26
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.2",
|
|
27
|
+
"@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
|
|
28
|
+
"@deepseek-ai/dsh-settings": "^0.2.1-rc.2",
|
|
29
|
+
"@deepseek-ai/dsh-subagent": "^0.2.1-rc.2",
|
|
30
|
+
"@deepseek-ai/schemastery": "^3.18.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@deepseek-ai/cordis": "4.0.5
|
|
34
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.1-
|
|
35
|
-
"@deepseek-ai/dsh-llm": "0.2.1-
|
|
36
|
-
"@deepseek-ai/dsh-settings": "0.2.1-
|
|
37
|
-
"@deepseek-ai/dsh-subagent": "0.2.1-
|
|
38
|
-
"@deepseek-ai/schemastery": "3.18.5
|
|
33
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
34
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-settings": "0.2.1-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
|
|
38
|
+
"@deepseek-ai/schemastery": "3.18.5",
|
|
39
39
|
"@types/node": "26.4.0",
|
|
40
40
|
"@types/react": "~18.3.31",
|
|
41
41
|
"react": "^18.2.0"
|
package/src/client/card.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 「子代理模型配置」配置卡片:经 injectPluginConfigCard 注册(插件页 plugins.row.config /
|
|
3
3
|
* plugins.bundle.config,view 分发 summary/page)。
|
|
4
|
-
* 外壳与基础控件走 @dsh-plus/shared/client 套件(
|
|
4
|
+
* 外壳与基础控件走 @dsh-plus/shared/client 套件(ConfigShell/CheckRow/SelectField)。
|
|
5
5
|
* 配置读写经共享层 ctx.remote.settings 直连(settingsScope 已由 configForms
|
|
6
6
|
* 取代):value 为 schema 解析后的命名空间值
|
|
7
7
|
* (enabled + entries),行集合 = 目录返回的已注册子代理 provider
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
type CardAction,
|
|
15
|
-
CardChrome,
|
|
16
15
|
CardLoading,
|
|
17
16
|
type CardStatusState,
|
|
18
17
|
CheckRow,
|
|
18
|
+
ConfigShell,
|
|
19
19
|
IDLE_STATUS,
|
|
20
20
|
type NamespaceSettingsApi,
|
|
21
21
|
type PluginConfigViewProps,
|
|
@@ -298,10 +298,6 @@ export function SubagentModelCard(props: CardProps): ReactElement | string | nul
|
|
|
298
298
|
if (value === undefined || draft === null) {
|
|
299
299
|
return <CardLoading prefix="dsm" text={t('loading')} />
|
|
300
300
|
}
|
|
301
|
-
const edit = <K extends keyof Draft>(key: K, editValue: Draft[K]): void => {
|
|
302
|
-
setDraft({ ...draft, [key]: editValue })
|
|
303
|
-
setStatus(IDLE_STATUS)
|
|
304
|
-
}
|
|
305
301
|
const editRow = (name: string, row: DraftRow): void => {
|
|
306
302
|
setDraft({ ...draft, rows: { ...draft.rows, [name]: row } })
|
|
307
303
|
setStatus(IDLE_STATUS)
|
|
@@ -330,11 +326,10 @@ export function SubagentModelCard(props: CardProps): ReactElement | string | nul
|
|
|
330
326
|
const rowNames = Object.keys(draft.rows).sort()
|
|
331
327
|
const providerCount = (catalog?.providers ?? []).length
|
|
332
328
|
return (
|
|
333
|
-
<
|
|
329
|
+
<ConfigShell
|
|
334
330
|
prefix="dsm"
|
|
335
331
|
title={t('title')}
|
|
336
332
|
description={t('description')}
|
|
337
|
-
statusBadge={{ text: t(draft.enabled ? 'enabledOn' : 'enabledOff'), on: draft.enabled }}
|
|
338
333
|
dirty={dirty}
|
|
339
334
|
dirtyLabel={t('unsaved')}
|
|
340
335
|
readOnlyNotice={disabled ? t('readOnly') : undefined}
|
|
@@ -352,14 +347,6 @@ export function SubagentModelCard(props: CardProps): ReactElement | string | nul
|
|
|
352
347
|
onSave,
|
|
353
348
|
})}
|
|
354
349
|
>
|
|
355
|
-
<CheckRow
|
|
356
|
-
prefix="dsm"
|
|
357
|
-
id="dsm-enabled"
|
|
358
|
-
label={t('enabled')}
|
|
359
|
-
checked={draft.enabled}
|
|
360
|
-
disabled={disabled}
|
|
361
|
-
onEdit={(v) => edit('enabled', v)}
|
|
362
|
-
/>
|
|
363
350
|
<CatalogStatus
|
|
364
351
|
t={t}
|
|
365
352
|
catalog={catalog}
|
|
@@ -379,7 +366,7 @@ export function SubagentModelCard(props: CardProps): ReactElement | string | nul
|
|
|
379
366
|
/>
|
|
380
367
|
))}
|
|
381
368
|
<p className="dsm-hint dsm-rowHint">{providerCount > 0 ? t('rowDesc') : ''}</p>
|
|
382
|
-
</
|
|
369
|
+
</ConfigShell>
|
|
383
370
|
)
|
|
384
371
|
}
|
|
385
372
|
|
package/src/client/draft.ts
CHANGED
|
@@ -8,7 +8,6 @@ import type { ModelCatalog } from './api.ts'
|
|
|
8
8
|
|
|
9
9
|
/** settings 命名空间的解析值(无 secret 字段)。 */
|
|
10
10
|
export interface ConfigValue {
|
|
11
|
-
enabled: boolean
|
|
12
11
|
entries: Record<string, WireEntry>
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -27,7 +26,6 @@ export interface DraftRow {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
export interface Draft {
|
|
30
|
-
enabled: boolean
|
|
31
29
|
rows: Record<string, DraftRow>
|
|
32
30
|
}
|
|
33
31
|
|
|
@@ -56,7 +54,7 @@ export function draftFrom(value: ConfigValue, catalog: ModelCatalog | null): Dra
|
|
|
56
54
|
reasoningEffort: entry.reasoningEffort,
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
|
-
return {
|
|
57
|
+
return { rows }
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
export function toPatch(draft: Draft): Record<string, unknown> {
|
|
@@ -69,5 +67,5 @@ export function toPatch(draft: Draft): Record<string, unknown> {
|
|
|
69
67
|
if (row === undefined) continue
|
|
70
68
|
entries[name] = row
|
|
71
69
|
}
|
|
72
|
-
return {
|
|
70
|
+
return { entries }
|
|
73
71
|
}
|
package/src/client/i18n.ts
CHANGED
|
@@ -11,7 +11,6 @@ const ownZh = {
|
|
|
11
11
|
title: '子代理模型配置',
|
|
12
12
|
description: '为 subagent / subagent_fork 等子代理单独指定提供商、模型与思考程度,或继承主代理。',
|
|
13
13
|
summaryLine: '为子代理单独指定提供商、模型与思考程度,或继承主代理。',
|
|
14
|
-
enabled: '启用插件',
|
|
15
14
|
rowEnabled: '启用该行',
|
|
16
15
|
provider: '提供商',
|
|
17
16
|
model: '模型',
|
|
@@ -39,7 +38,6 @@ const ownEn = {
|
|
|
39
38
|
description:
|
|
40
39
|
'Pick a provider, model, and thinking effort for subagent / subagent_fork children, or inherit from the main agent.',
|
|
41
40
|
summaryLine: 'Pick a provider, model, and thinking effort for subagent children, or inherit.',
|
|
42
|
-
enabled: 'Enable plugin',
|
|
43
41
|
rowEnabled: 'Enable row',
|
|
44
42
|
provider: 'Provider',
|
|
45
43
|
model: 'Model',
|
package/src/config.ts
CHANGED
|
@@ -40,13 +40,11 @@ export interface EntryConfig {
|
|
|
40
40
|
|
|
41
41
|
/** 配置的规范输出形态。 */
|
|
42
42
|
export interface SubagentModelConfig {
|
|
43
|
-
enabled: boolean
|
|
44
43
|
entries: Record<string, EntryConfig>
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/** 配置的宽松输入形态(schema 校验前的用户数据)。 */
|
|
48
47
|
export interface SubagentModelConfigInput {
|
|
49
|
-
enabled?: boolean | null
|
|
50
48
|
entries?: Record<
|
|
51
49
|
string,
|
|
52
50
|
{
|
|
@@ -77,7 +75,6 @@ const EntrySchema = z.object({
|
|
|
77
75
|
export type SubagentModelConfigFields = VolatileFields<SubagentModelConfig>
|
|
78
76
|
|
|
79
77
|
export const Config: z<SubagentModelConfigInput, SubagentModelConfigFields> = z.object({
|
|
80
|
-
enabled: z.boolean().description('总开关').default(false).volatile(),
|
|
81
78
|
entries: z
|
|
82
79
|
.dict(EntrySchema)
|
|
83
80
|
.description('按子代理 provider 名(spawn/fork/…)配置')
|
|
@@ -112,7 +109,7 @@ export function entryFor(
|
|
|
112
109
|
current: () => SubagentModelConfig,
|
|
113
110
|
name: string | undefined,
|
|
114
111
|
): InjectedOptions | undefined {
|
|
115
|
-
if (name === undefined
|
|
112
|
+
if (name === undefined) return undefined
|
|
116
113
|
const entries = current().entries
|
|
117
114
|
const direct = entries[name]
|
|
118
115
|
if (direct !== undefined) return resolveEntry(direct)
|