@deepseek-ai/dsh-tool-subagent 0.2.1-rc.3 → 0.2.2-alpha.2
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/README.i18n.yaml +24 -24
- package/README.md +17 -14
- package/README.zh.md +17 -14
- package/lib/index.js +212 -303
- package/lib/model-selection-settings.js +55 -2
- package/lib/types/index.d.ts +13 -7
- package/lib/types/list-models.d.ts +6 -5
- package/lib/types/model-selection-settings.d.ts +8 -6
- package/lib/types/model-selection-state.d.ts +12 -22
- package/lib/types/model-selection.d.ts +2 -2
- package/lib/types/preset-selection.d.ts +2 -9
- package/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/model-selection-settings/de.json +5 -0
- package/locale/model-selection-settings/es.json +5 -0
- package/locale/model-selection-settings/fr.json +5 -0
- package/locale/model-selection-settings/ja.json +5 -0
- package/locale/model-selection-settings/pt.json +5 -0
- package/locale/model-selection-settings/ru.json +5 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +26 -26
package/README.i18n.yaml
CHANGED
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
en: 93f1701f5209ecb5
|
|
19
19
|
zh: 6310fd012400aead
|
|
20
20
|
/deepseek-ai-dsh-tool-subagent/use-this-package/minimal-configuration:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
21
|
+
en: 1a23808ca32b8f2d
|
|
22
|
+
zh: e637a35220da0564
|
|
23
23
|
/deepseek-ai-dsh-tool-subagent/use-this-package/managed-delegation:
|
|
24
24
|
en: bb715d037cde14bd
|
|
25
25
|
zh: a88e98c07115fbd1
|
|
26
26
|
/deepseek-ai-dsh-tool-subagent/use-this-package/selecting-a-child-preset:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
27
|
+
en: e28a206c65151ec0
|
|
28
|
+
zh: 1372242076549ca4
|
|
29
29
|
/deepseek-ai-dsh-tool-subagent/use-this-package/selecting-a-child-llm:
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
30
|
+
en: 5cf892e4acab3f38
|
|
31
|
+
zh: c282b79620bc3de5
|
|
32
32
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation:
|
|
33
33
|
en: 6ce5f749256a7e6c
|
|
34
34
|
zh: a4f2adb04a70d9cf
|
|
35
35
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/design-concept:
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
36
|
+
en: 373abf7c7aa3e4f1
|
|
37
|
+
zh: be0b4d4a7371d360
|
|
38
38
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/activation-ownership:
|
|
39
39
|
en: ef692c4d17290920
|
|
40
40
|
zh: b1d0d3dab011e2cd
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
en: 1733728ac5aa6bb0
|
|
46
46
|
zh: 341ffc6e21a289af
|
|
47
47
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/source-map:
|
|
48
|
-
en:
|
|
49
|
-
zh:
|
|
48
|
+
en: 181b32db8839119a
|
|
49
|
+
zh: a9e8625b236d6fc4
|
|
50
50
|
/deepseek-ai-dsh-tool-subagent/further-exploration:
|
|
51
51
|
en: fa3c9a967b636afb
|
|
52
52
|
zh: a9ce930a9766d5cb
|
|
@@ -57,23 +57,23 @@
|
|
|
57
57
|
en: e4c7376d4f29dbd5
|
|
58
58
|
zh: 6b7a9eaf69c9ea53
|
|
59
59
|
/deepseek-ai-dsh-tool-subagent/model-experience/tool-schema/what-the-model-sees:
|
|
60
|
-
en:
|
|
61
|
-
zh:
|
|
60
|
+
en: 2e7844a04f0456ea
|
|
61
|
+
zh: 7aaaa033b700aa3d
|
|
62
62
|
/deepseek-ai-dsh-tool-subagent/model-experience/tool-schema/token-effect:
|
|
63
|
-
en:
|
|
64
|
-
zh:
|
|
63
|
+
en: c04242443b8fbdb0
|
|
64
|
+
zh: 8779ef72c4eaee35
|
|
65
65
|
/deepseek-ai-dsh-tool-subagent/model-experience/tool-schema/kv-cache-effect:
|
|
66
|
-
en:
|
|
67
|
-
zh:
|
|
66
|
+
en: 5697c49cb84fb2a4
|
|
67
|
+
zh: b2b8464d3cbabfa5
|
|
68
68
|
/deepseek-ai-dsh-tool-subagent/model-experience/model-selection-and-discovery:
|
|
69
69
|
en: a4ca31b9cbacda6b
|
|
70
70
|
zh: 91ac3e0784a14697
|
|
71
71
|
/deepseek-ai-dsh-tool-subagent/model-experience/model-selection-and-discovery/what-the-model-sees:
|
|
72
|
-
en:
|
|
73
|
-
zh:
|
|
72
|
+
en: 8e6d560368799559
|
|
73
|
+
zh: c379e1693f0ce891
|
|
74
74
|
/deepseek-ai-dsh-tool-subagent/model-experience/model-selection-and-discovery/token-effect:
|
|
75
|
-
en:
|
|
76
|
-
zh:
|
|
75
|
+
en: 3a55d6616c00746b
|
|
76
|
+
zh: 4b0ef3dbff2c67ce
|
|
77
77
|
/deepseek-ai-dsh-tool-subagent/model-experience/model-selection-and-discovery/kv-cache-effect:
|
|
78
78
|
en: 7dc47a34d5574fbd
|
|
79
79
|
zh: bd7bd2a4da2f8ae2
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
en: cf78b9dd5596495f
|
|
82
82
|
zh: bd44560f8c2435e8
|
|
83
83
|
/deepseek-ai-dsh-tool-subagent/model-experience/system-prompt/what-the-model-sees:
|
|
84
|
-
en:
|
|
85
|
-
zh:
|
|
84
|
+
en: 571d1dcec395c549
|
|
85
|
+
zh: 6e9b6bf1cfa7e915
|
|
86
86
|
/deepseek-ai-dsh-tool-subagent/model-experience/system-prompt/what-the-model-sees/tool-guidance-section:
|
|
87
87
|
en: 82b3cd08b3961c98
|
|
88
88
|
zh: bdc2a34bcea16cac
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
en: f5d5f97a153f7c70
|
|
133
133
|
zh: 3d6bc05b9eadfbc2
|
|
134
134
|
/deepseek-ai-dsh-tool-subagent/known-limitations-and-deferred-work:
|
|
135
|
-
en:
|
|
136
|
-
zh:
|
|
135
|
+
en: d2daad284c68bc25
|
|
136
|
+
zh: 2f10007341188c10
|
|
137
137
|
/deepseek-ai-dsh-tool-subagent/known-limitations-and-deferred-work/dev-note:
|
|
138
138
|
en: e67f633dc6fe7773
|
|
139
139
|
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -46,7 +46,8 @@ Load the subagent service, an in-process or remote backend, and this tool; then
|
|
|
46
46
|
|---|---|---|
|
|
47
47
|
| `provider` | required | Provider name on `ctx.subagents` (e.g. `spawn`, `fork`, `acp`) |
|
|
48
48
|
| `toolName` | `subagent` | Model-facing tool name; distinct for every loaded instance |
|
|
49
|
-
| `
|
|
49
|
+
| `modelSelection` | `false` | Expose optional child route fields; requires provider `agentOptions` support |
|
|
50
|
+
| `modelDiscovery` | `false` | Register `list_subagent_models`; enable on one instance per tool scope |
|
|
50
51
|
| `agentOptions` | — | Configured child `provider`, `model`, adapter-owned `reasoningEffort`, and positive `maxTokens` defaults; requires provider `agentOptions` support and overlays any provider-owned route defaults |
|
|
51
52
|
| `agentPreset` | — | Default independent child preset id; requires in-process spawn |
|
|
52
53
|
| `allowedAgentPresets` | — | Non-empty preset-id allowlist exposed as the model's optional `agent_preset` enum; must include `agentPreset` when both are set |
|
|
@@ -67,13 +68,13 @@ Every backend’s completion notice carries its final answer. Local Spawn and Fo
|
|
|
67
68
|
|
|
68
69
|
Set `agentPreset` to give every child an independent preset by default. Set `allowedAgentPresets` to let the model choose an id through `agent_preset`; without this allowlist, the model cannot override the configured choice. Only in-process spawn supports these options; fork and external backends reject them.
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
Duplicate or empty preset ids fail at load. The selected preset is resolved when a call starts the child; an unknown or unloadable preset returns an errored tool result without starting a child. Creating a parent Agent or switching its preset does not resolve child references. Without either selection field, the tool does not require the preset service. An omitted model choice uses the configured `agentPreset`, or joins the parent's current preset revision when no default is configured. Any explicit id mounts the currently available revision, even when it matches the parent's id.
|
|
71
72
|
|
|
72
73
|
Compose persona and tools in the [preset plugin list](../../preset/agent-preset-registry/README.md). Tool configuration containing `persona` or `toolFilter` fails at load with a migration error. Local children use the shared [preset restoration rules](../subagent/README.md#restoring-child-composition).
|
|
73
74
|
|
|
74
75
|
### Selecting a child LLM
|
|
75
76
|
|
|
76
|
-
Set `
|
|
77
|
+
Set `modelSelection: true` to expose optional `provider`, `model`, and `reasoning_effort` fields; instances without it reject selection fields. Set `modelDiscovery: true` on one instance per tool scope to register `list_subagent_models`; it defaults off independently of `modelSelection`. A second discovery owner in the same scope fails to register. Discovery follows its owning plugin instance, remains available when its delegation provider is absent, and is removed when that instance unloads. Web and Desktop presets enable discovery and route fields on spawn and leave both disabled on fork. The Host’s `/model-selection-settings` service samples the user preference during Agent creation, independently of tool installation. Its creation listener subscribes before projection registration completes and awaits the handle; registration failure or owner disposal rejects Agent publication. When enabled, its exact route list is recorded in each fresh top-level Session, inherited by child Sessions, and preserved on restore; later settings edits affect only new Sessions. Without a recorded Session policy, discovery and explicit selection permit only the parent Agent’s current effective provider/model and its supported efforts. Route fields require a backend that advertises `agentOptions`; in-process Spawn and Fork and DSH SDK qualify, while ACP, Codex, and Claude Code fail the mount.
|
|
77
78
|
|
|
78
79
|
A call supplies `provider` and `model` together, or supplies only an effort when configured, parent, or provider-owned defaults provide the route. Static `provider.agentRouteDefaults`, when present, form the provider/model baseline; tool configuration and model fields overlay it before route-aware effort merging and exact-route preflight. Providers without these defaults use compatible values from the parent's latest logged request, then the parent's creation options before its first request, while retaining the configured `maxTokens`. Changing the route without an explicit effort clears the inherited route-owned effort, so the selected model resolves its default. The live LLM adapter validates the effective route before child creation. Catalog membership remains advisory, so a model can use an unlisted id when its adapter accepts it.
|
|
79
80
|
|
|
@@ -89,7 +90,7 @@ This section explains how the tool mirrors provider lifecycle and settles runs;
|
|
|
89
90
|
|
|
90
91
|
### Design concept
|
|
91
92
|
|
|
92
|
-
One instance is one provider plus one tool name. The plugin
|
|
93
|
+
One instance is one provider plus one tool name. The plugin registers its definition in the owning composition while the provider is present and disposes it when the provider leaves. Each preset revision owns one shared registration, including tools with preset selection. Agents inherit its definitions; switching presets changes scope ancestry without reinstalling tools. Discovery belongs to the instance configured with `modelDiscovery` and reads the same durable Session policy as the delegation executor. A numeric `maxDepth` or configured LLM selection unsupported by the provider fails the mount. Multiple distinctly named delegation tools may expose model selection in one scope.
|
|
93
94
|
|
|
94
95
|
### Activation ownership
|
|
95
96
|
|
|
@@ -108,7 +109,7 @@ The tool's description derives from `provider.inheritsParentContext`: a fresh ch
|
|
|
108
109
|
| File | Role |
|
|
109
110
|
|---|---|
|
|
110
111
|
| [`src/index.ts`](src/index.ts) | Tool registration, provider lifecycle mirroring, activation requests |
|
|
111
|
-
| [`src/preset-selection.ts`](src/preset-selection.ts) |
|
|
112
|
+
| [`src/preset-selection.ts`](src/preset-selection.ts) | Preset defaults, model allowlist, and selection guidance |
|
|
112
113
|
| [`src/model-selection.ts`](src/model-selection.ts) | Request/config merge and live LLM route preflight |
|
|
113
114
|
| [`src/model-selection-settings.ts`](src/model-selection-settings.ts) | Host-owned opt-in setting sampled for new Sessions |
|
|
114
115
|
| [`src/model-selection-state.ts`](src/model-selection-state.ts) | Session event that records and inherits the sampled decision |
|
|
@@ -138,25 +139,25 @@ Read these pages when the package-level contract is not enough; they move from t
|
|
|
138
139
|
|
|
139
140
|
#### What the model sees
|
|
140
141
|
|
|
141
|
-
The generated default [`subagent` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent) appears under the configured tool name while its provider exists. An
|
|
142
|
+
The generated default [`subagent` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent) appears under the configured tool name while its provider exists. An instance with `modelSelection` adds `provider`, `model`, and `reasoning_effort` plus route guidance in every Session. `allowedAgentPresets` adds the `agent_preset` enum and guidance for the default or inherited selection. Context inheritance and continuation support determine task and follow-up descriptions. Agent restrictions apply to inherited preset delegation tools in schemas, execution, and guidance, including when historical `toolFilter` overrides are restored; sibling Agents remain unaffected. Preset-selection guidance depends only on the tool configuration, so it does not depend on other presets’ declaration order.
|
|
142
143
|
|
|
143
144
|
#### Token effect
|
|
144
145
|
|
|
145
|
-
Fixed schema cost per parent request;
|
|
146
|
+
Fixed schema cost per parent request; `modelSelection` adds three optional route fields, while preset selection adds one enum parameter and default guidance. Each tool instance adds one schema; visible delegation tools share one short system-prompt section.
|
|
146
147
|
|
|
147
148
|
#### KV Cache effect
|
|
148
149
|
|
|
149
|
-
Prefix-stable while provider instances and their configuration are unchanged. Adapter catalog changes do not alter the definition
|
|
150
|
+
Prefix-stable while provider instances and their configuration are unchanged. Adapter catalog changes do not alter the definition. Shipped fork tools omit model-selection fields to preserve reuse of the inherited parent prefix. A custom fork tool may enable selection; changing its route can prevent prefix reuse.
|
|
150
151
|
|
|
151
152
|
### Model selection and discovery
|
|
152
153
|
|
|
153
154
|
#### What the model sees
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
The optional `list_subagent_models` definition reads the calling Session’s route policy, falling back to the current parent route when no policy is recorded. Calls reject while the optional `ctx.llm` service is unavailable. With a recorded policy, provider model lists intersect the advertised catalog with the Session’s authorized routes. Without one, they resolve only the current parent model, even if the catalog omits it. The discovery tool’s own description instructs the model to query options before selecting a child route; omitting or filtering out discovery removes that guidance. Exact-model queries accept authorized ids absent from the catalog; unauthorized provider/model lookups fail before adapter access. Catalog or exact-model lookup failures and cancellation reject the call. Execution independently enforces the same policy.
|
|
156
157
|
|
|
157
158
|
#### Token effect
|
|
158
159
|
|
|
159
|
-
One fixed discovery schema is present
|
|
160
|
+
One fixed discovery schema is present wherever `modelDiscovery` is enabled, regardless of the Session’s preference or the owning instance’s `modelSelection` option; the shipped Web and Desktop presets include it, while headless, SDK, and ACP profiles do not. Route metadata enters the transcript only when the model calls the tool.
|
|
160
161
|
|
|
161
162
|
#### KV Cache effect
|
|
162
163
|
|
|
@@ -166,12 +167,12 @@ The schema is prefix-stable across adapter registration and catalog changes. Eac
|
|
|
166
167
|
|
|
167
168
|
#### What the model sees
|
|
168
169
|
|
|
169
|
-
Visible delegation tools share one guidance paragraph, listing tools in name order and instructing the model to start independent delegations together and keep working while they run, and to end its turn instead of sleeping or polling when only waiting for their results remains. Hidden or unavailable tools are omitted; no guidance appears when none are visible. With both `subagent` and `subagent_fork` visible, the text is:
|
|
170
|
+
Visible delegation tools share one guidance paragraph, listing tools in name order and instructing the model to start independent delegations together and keep working while they run, and to end its turn instead of sleeping or polling when only waiting for their results remains. Ending the turn works because a settled child notifies its parent and a notice that reaches an idle parent starts one independent model request; hosts that keep children progressing alternate `agent.whenIdle()` and `waitForChildren(agent)` ([`dsh-subagent`](../subagent/README.md), [`session.ts`](../../acp/acp/src/session.ts)). Hidden or unavailable tools are omitted; no guidance appears when none are visible. With both `subagent` and `subagent_fork` visible, the text is:
|
|
170
171
|
|
|
171
172
|
##### Tool-guidance section
|
|
172
173
|
|
|
173
174
|
```markdown
|
|
174
|
-
Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run.
|
|
175
|
+
Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run. When only waiting for their results remains, end your turn instead of sleeping or polling; the next result starts a new turn.
|
|
175
176
|
```
|
|
176
177
|
|
|
177
178
|
#### Token effect
|
|
@@ -238,8 +239,10 @@ Append-only; newly visible content follows the reusable request prefix and does
|
|
|
238
239
|
These limits define what this tool does not return or enforce; they are current package constraints.
|
|
239
240
|
|
|
240
241
|
- **This tool does not wait for results** — use the completion notice or child messages. Programmatic result waiting belongs to the subagent service.
|
|
241
|
-
- **
|
|
242
|
-
- **
|
|
242
|
+
- **Preset choices omit descriptions** — `agent_preset` exposes ids and default or inheritance guidance only. The schema does not read candidate preset documents, so registration is independent of their declaration order. Use ids that convey each candidate's purpose.
|
|
243
|
+
- **Preset references are checked on delegation** — Host-mounted and preset-mounted tools both resolve the target when starting a child. A target can be declared or replaced after tool registration, so loading the tool cannot establish its availability for a later call. Misspelled or unavailable ids remain undetected until selected; that call returns an error.
|
|
244
|
+
- **Shipped fork tools omit model selection** — their configuration leaves `modelSelection` disabled to preserve inherited-prefix reuse. Custom fork tools may enable it under the same Session authorization and adapter validation as other delegation tools.
|
|
245
|
+
- **Depth caps are fixed per instance** — another cap requires another distinctly named tool. Child personas and tools belong to the selected Agent Preset. Explicit LLM selection requires `modelSelection` and is restricted to the Session’s authorized routes, or the current parent route without an enabled policy.
|
|
243
246
|
|
|
244
247
|
<a id="dev-note"></a>
|
|
245
248
|
### Dev Note
|
package/README.zh.md
CHANGED
|
@@ -46,7 +46,8 @@ kind: "package-reference"
|
|
|
46
46
|
|---|---|---|
|
|
47
47
|
| `provider` | 必填 | `ctx.subagents` 上的提供方名称(如 `spawn`、`fork`、`acp`) |
|
|
48
48
|
| `toolName` | `subagent` | 面向模型的工具名称;每个已加载实例必须不同 |
|
|
49
|
-
| `
|
|
49
|
+
| `modelSelection` | `false` | 公开可选子级路由字段;要求提供方支持 `agentOptions` |
|
|
50
|
+
| `modelDiscovery` | `false` | 注册 `list_subagent_models`;每个工具作用域仅在一个实例上启用 |
|
|
50
51
|
| `agentOptions` | — | 配置的子级 `provider`、`model`、适配器所有的 `reasoningEffort` 与正整数 `maxTokens` 默认值;要求提供方支持 `agentOptions`,并会覆盖提供方持有的路由默认值 |
|
|
51
52
|
| `agentPreset` | — | 独立子级 preset 的默认 id;要求进程内 spawn |
|
|
52
53
|
| `allowedAgentPresets` | — | 非空 preset-id 白名单,作为模型可选的 `agent_preset` 枚举;与 `agentPreset` 同时配置时必须包含后者 |
|
|
@@ -67,13 +68,13 @@ kind: "package-reference"
|
|
|
67
68
|
|
|
68
69
|
设置 `agentPreset`,为每个子级指定默认的独立 preset。设置 `allowedAgentPresets`,允许模型通过 `agent_preset` 选择 id;没有此白名单时,模型不能覆盖配置中的选择。只有进程内 spawn 支持这些选项;fork 与外部后端会拒绝它们。
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
重复或空 preset id 在加载时被拒绝。调用启动子级时解析选中的 preset;未知或无法加载的 preset 返回出错的工具结果,不会启动子级。创建父 Agent 或切换其 preset 时不解析子级引用。两个选择字段都省略时,工具不要求 preset 服务。模型省略选择时使用配置的 `agentPreset`;若也没有默认值,则加入父方当前 preset 代际。任何显式 id 都挂载当前可用代际,即使与父方 id 相同。
|
|
71
72
|
|
|
72
73
|
在 [preset 插件列表](../../preset/agent-preset-registry/README.zh.md)中配置 persona 与工具。包含 `persona` 或 `toolFilter` 的工具配置在加载时会报迁移错误。本地子级采用共享的 [preset 恢复规则](../subagent/README.zh.md#restoring-child-composition)。
|
|
73
74
|
|
|
74
75
|
### 选择子级 LLM
|
|
75
76
|
|
|
76
|
-
设置 `
|
|
77
|
+
设置 `modelSelection: true` 后,该实例公开可选的 `provider`、`model` 和 `reasoning_effort` 字段;未设置的实例拒绝选择字段。在每个工具作用域的一个实例上设置 `modelDiscovery: true`,以注册 `list_subagent_models`;该选项独立于 `modelSelection`,默认关闭。同一作用域的第二个发现工具所有者会注册失败。发现工具随其所属插件实例存续,在委派提供方缺席时仍然可用,并在该实例卸载时移除。Web 与 Desktop preset 为 spawn 启用发现和路由字段,为 fork 保持两者关闭。Host 的 `/model-selection-settings` 服务在 Agent 创建时读取用户偏好,与工具安装无关。创建监听器在投影注册完成前订阅并等待句柄;注册失败或所属插件卸载会使 Agent 发布失败。启用时,精确路由列表记录在每个新顶层 Session 中,由子 Session 继承,并在恢复时保留;之后的设置编辑只影响新 Session。没有已记录 Session 策略时,发现和显式选择只允许父 Agent 当前生效的 provider/model 及其支持的强度。路由字段要求后端公布 `agentOptions`;进程内 Spawn、Fork 和 DSH SDK 满足条件,ACP、Codex 和 Claude Code 会使挂载失败。
|
|
77
78
|
|
|
78
79
|
一次调用需同时提供 `provider` 与 `model`;当配置值、父 agent 值或提供方持有的默认值能提供路由时,也可只提供推理等级。静态的 `provider.agentRouteDefaults` 在存在时构成提供方/模型基线;工具配置与模型字段会在路由相关强度合并和确切路由预检前覆盖它。没有这些默认值的提供方会使用父 agent 最新已记录请求中的兼容值,再使用父级首次请求前的创建选项,并保留配置的 `maxTokens`。更改路由但未显式提供推理等级时,会清除继承的路由自有等级,使所选模型解析自己的默认值。实时 LLM 适配器在创建子 agent 前校验有效路由。目录成员资格只提供建议,因此适配器接受时,模型可以使用未列出的 id。
|
|
79
80
|
|
|
@@ -89,7 +90,7 @@ kind: "package-reference"
|
|
|
89
90
|
|
|
90
91
|
### 设计理念
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
一个实例对应一个提供方和一个工具名。插件在提供方存在时向所属组合注册定义,并在提供方离开时释放它。每个 preset 代际拥有一份共享注册,配置了 preset 选择的工具也相同。Agent 继承其定义;切换 preset 只改变作用域的继承关系,不重新安装工具。发现工具属于配置了 `modelDiscovery` 的实例,与委派执行器读取同一份持久 Session 策略。提供方不支持的数字 `maxDepth` 或配置的 LLM 选择会使挂载失败。同一作用域中可以有多个名称不同的委派工具公开模型选择。
|
|
93
94
|
|
|
94
95
|
### Activation 所有权
|
|
95
96
|
|
|
@@ -108,7 +109,7 @@ kind: "package-reference"
|
|
|
108
109
|
| 文件 | 职责 |
|
|
109
110
|
|---|---|
|
|
110
111
|
| [`src/index.ts`](src/index.ts) | 工具注册、提供方生命周期镜像、activation 请求 |
|
|
111
|
-
| [`src/preset-selection.ts`](src/preset-selection.ts) |
|
|
112
|
+
| [`src/preset-selection.ts`](src/preset-selection.ts) | preset 默认值、模型白名单与选择引导 |
|
|
112
113
|
| [`src/model-selection.ts`](src/model-selection.ts) | 请求/配置合并与实时 LLM 路由预检 |
|
|
113
114
|
| [`src/model-selection-settings.ts`](src/model-selection-settings.ts) | 为新 Session 读取的宿主所有 opt-in 设置 |
|
|
114
115
|
| [`src/model-selection-state.ts`](src/model-selection-state.ts) | 记录并继承已读取决定的 Session 事件 |
|
|
@@ -138,25 +139,25 @@ kind: "package-reference"
|
|
|
138
139
|
|
|
139
140
|
#### 模型看到什么
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
生成的默认 [`subagent` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-subagent) 在提供方存在时以配置的工具名公开。设置了 `modelSelection` 的实例在每个 Session 中都会增加 `provider`、`model`、`reasoning_effort` 及路由指导。`allowedAgentPresets` 增加 `agent_preset` 枚举及默认或继承选择的引导。上下文继承和继续执行能力决定任务与后续工作描述。Agent 限制同时作用于继承自 preset 的委派工具的 schema、执行入口和指导文本,恢复历史 `toolFilter` 覆盖时也相同;同级 Agent 不受影响。preset 选择提示仅依赖工具配置,因此不依赖其他 preset 的声明顺序。
|
|
142
143
|
|
|
143
144
|
#### Token 影响
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
每次父级请求承担固定 schema 成本;`modelSelection` 会增加三个可选路由字段,preset 选择则增加一个枚举参数及默认值引导。每个工具实例增加一份 schema;可见委派工具共享一个简短系统提示词段。
|
|
146
147
|
|
|
147
148
|
#### KV Cache 影响
|
|
148
149
|
|
|
149
|
-
|
|
150
|
+
只要提供方实例及其配置不变,前缀就保持稳定。适配器目录变化不会改变定义。随附 fork 工具省略模型选择字段,以保留对继承的父级前缀的复用。自定义 fork 工具可以启用选择;更改其路由可能使前缀无法复用。
|
|
150
151
|
|
|
151
152
|
### 模型选择与发现
|
|
152
153
|
|
|
153
154
|
#### 模型看到什么
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
可选的 `list_subagent_models` 定义读取调用 Session 的路由策略,没有已记录策略时使用当前父级路由。可选的 `ctx.llm` 服务不可用时,调用会被拒绝。有已记录策略时,提供方模型列表取公布目录与 Session 授权路由的交集。没有策略时,只解析当前父级模型,即使目录未列出它。发现工具自身的描述要求模型在选择子级路由前查询选项;未挂载或过滤掉发现工具时,这段指导也不会出现。精确模型查询允许已授权但目录未列出的 ID;未授权的提供方/模型查询会在访问适配器前失败。目录或精确模型查询失败以及取消都会使调用被拒绝。执行过程独立强制同一策略。
|
|
156
157
|
|
|
157
158
|
#### Token 影响
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
启用 `modelDiscovery` 的组合中存在一份固定发现 schema,不受 Session 偏好或所属实例的 `modelSelection` 选项影响;随附 Web 与 Desktop preset 包含它,headless、SDK 和 ACP profile 不包含。只有模型调用工具时,路由元数据才进入 transcript。
|
|
160
161
|
|
|
161
162
|
#### KV Cache 影响
|
|
162
163
|
|
|
@@ -166,12 +167,12 @@ Session 携带策略的 settings 控制实例会公开子级 LLM 选择字段与
|
|
|
166
167
|
|
|
167
168
|
#### 模型看到什么
|
|
168
169
|
|
|
169
|
-
|
|
170
|
+
可见的委派工具共享一段指导,列出按名称排序的工具,指示模型一起启动相互独立的委派,并在它们运行时继续工作;当只剩等待它们的结果时,结束本轮,而不是休眠或轮询。结束本轮之所以可行,是因为子代理结束后会通知父级,而通知到达空闲父级会起一次独立的模型请求;在子代理继续推进期间,宿主交替等待 `agent.whenIdle()` 与 `waitForChildren(agent)`([`dsh-subagent`](../subagent/README.zh.md)、[`session.ts`](../../acp/acp/src/session.ts))。隐藏或不可用的工具不列入其中;没有可见工具时,不输出指导。`subagent` 和 `subagent_fork` 都可见时,文本为:
|
|
170
171
|
|
|
171
172
|
##### 工具指导 section
|
|
172
173
|
|
|
173
174
|
```markdown
|
|
174
|
-
Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run.
|
|
175
|
+
Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run. When only waiting for their results remains, end your turn instead of sleeping or polling; the next result starts a new turn.
|
|
175
176
|
```
|
|
176
177
|
|
|
177
178
|
#### Token 影响
|
|
@@ -238,8 +239,10 @@ Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do no
|
|
|
238
239
|
这些限制说明本工具不返回或不强制执行什么;它们是当前包约束。
|
|
239
240
|
|
|
240
241
|
- **本工具不等待结果**——使用完成通知或子任务消息。程序化结果等待由 subagent 服务提供。
|
|
241
|
-
-
|
|
242
|
-
-
|
|
242
|
+
- **预设选项不含描述**——`agent_preset` 只公开 id 及默认或继承提示。schema 不读取候选预设文档,因此注册不依赖它们的声明顺序。请使用能够表达各候选用途的 id。
|
|
243
|
+
- **预设引用在委派时检查**——Host 挂载和预设内挂载的工具都在启动子级时解析目标。目标可以在工具注册后声明或替换,因此加载工具无法确定后续调用时目标是否可用。拼错或不可用的 id 在被选中前不会被发现;选中它的调用会返回错误。
|
|
244
|
+
- **随附 fork 工具省略模型选择**:其配置保持 `modelSelection` 关闭,以保留对继承前缀的复用。自定义 fork 工具可以启用它,并接受与其他委派工具相同的 Session 授权和适配器校验。
|
|
245
|
+
- **深度上限按实例固定** — 更换上限需要另一个不同名称的工具。子级角色和工具由所选 Agent Preset 配置。显式 LLM 选择需要 `modelSelection`,并受 Session 授权路由限制,没有启用策略时只允许当前父级路由。
|
|
243
246
|
|
|
244
247
|
<a id="dev-note"></a>
|
|
245
248
|
### 开发备注
|