@deepseek-ai/dsh-subagent-claude-code 0.2.1-alpha.1 → 0.2.1-alpha.3

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 CHANGED
@@ -15,20 +15,20 @@
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-subagent-claude-code/use-this-package:
18
- en: e46eb1b8f7054196
19
- zh: fcba0b3fb2b5da93
18
+ en: 8e614ec7785cbaae
19
+ zh: dd5b2ffff8d513c7
20
20
  /deepseek-ai-dsh-subagent-claude-code/use-this-package/installing-the-bundle:
21
- en: 10c373b4768ba361
22
- zh: a5de572bafb2f886
21
+ en: cf4a7e48ca796066
22
+ zh: d9140d0fda7b7029
23
23
  /deepseek-ai-dsh-subagent-claude-code/use-this-package/configuration:
24
- en: 6c61e906830ab904
25
- zh: 8464a1514cdc5a30
24
+ en: fbee5e4ab396c184
25
+ zh: dcf94832918d5010
26
26
  /deepseek-ai-dsh-subagent-claude-code/use-this-package/exposing-the-tool:
27
- en: b433b186c4e62396
28
- zh: 6cbb85855238272c
27
+ en: ebf6ba7fef393ebb
28
+ zh: fad30b829e2e4188
29
29
  /deepseek-ai-dsh-subagent-claude-code/use-this-package/what-you-get:
30
- en: 564a27820070ab0e
31
- zh: 6ace69f237ac98aa
30
+ en: a731eabea54893d5
31
+ zh: e370dba101b3a7e8
32
32
  /deepseek-ai-dsh-subagent-claude-code/use-this-package/failure-and-recovery:
33
33
  en: 3cfe78175e68269e
34
34
  zh: 478666ce1fcb4e59
@@ -39,11 +39,11 @@
39
39
  en: c01f4a013f7f1a2f
40
40
  zh: 92221e45d438334d
41
41
  /deepseek-ai-dsh-subagent-claude-code/understand-the-implementation/source-map:
42
- en: 86286514b713e50c
43
- zh: 5e29ecd8d15c0c50
42
+ en: 4826e5016f7d9655
43
+ zh: 9b80696313be1816
44
44
  /deepseek-ai-dsh-subagent-claude-code/understand-the-implementation/run-flow:
45
45
  en: 4dd16da30209644e
46
- zh: 0679197e8b6d0a67
46
+ zh: 7ea63e1bf4cee29d
47
47
  /deepseek-ai-dsh-subagent-claude-code/further-exploration:
48
48
  en: 6d2c64f8f7ebab4c
49
49
  zh: a892c363cd3982e5
@@ -54,8 +54,8 @@
54
54
  en: 1796fa78833bfc2b
55
55
  zh: d925d4c0d6c46552
56
56
  /deepseek-ai-dsh-subagent-claude-code/model-experience/child-request/what-the-model-sees:
57
- en: 35de120a073a2b78
58
- zh: 74ca577fb19027a8
57
+ en: 3edc725966ed48c2
58
+ zh: 2ec900cc7a4ae459
59
59
  /deepseek-ai-dsh-subagent-claude-code/model-experience/child-request/token-effect:
60
60
  en: 631f762d31c31a3d
61
61
  zh: f32ad086756bf33d
@@ -66,17 +66,17 @@
66
66
  en: 4c391bb16e3cd380
67
67
  zh: ab3847efe35fa6dc
68
68
  /deepseek-ai-dsh-subagent-claude-code/model-experience/parent-scheduling-and-results-indirectly/what-the-model-sees:
69
- en: a36839fc8f15c2f3
70
- zh: 2a7755a8d90fb5bc
69
+ en: fd177d7a8aa80ff0
70
+ zh: aa04468315ed2e0b
71
71
  /deepseek-ai-dsh-subagent-claude-code/model-experience/parent-scheduling-and-results-indirectly/token-effect:
72
- en: 0bf99fe5b871cb64
73
- zh: 6bb608e9b39ffb5b
72
+ en: 0c436fb0897a6eca
73
+ zh: 7ec0a953d0232af2
74
74
  /deepseek-ai-dsh-subagent-claude-code/model-experience/parent-scheduling-and-results-indirectly/kv-cache-effect:
75
- en: fdbb7dcbf8b37f2b
76
- zh: c7bcbf1e91ffe1d4
75
+ en: 19f1316ea4bb1bb9
76
+ zh: 181231ddffdc8494
77
77
  /deepseek-ai-dsh-subagent-claude-code/known-limitations-and-deferred-work:
78
- en: 9fbe41d8185bc0bf
79
- zh: 67435a4e57191729
78
+ en: 421cfbcfb55c7e2b
79
+ zh: df54ab7743cf6e33
80
80
  /deepseek-ai-dsh-subagent-claude-code/known-limitations-and-deferred-work/dev-note:
81
81
  en: 185beb4ff55f0946
82
82
  zh: 068ca7c57137eb33
package/README.md CHANGED
@@ -25,19 +25,15 @@ Install this Profile Bundle when a delegated task should run as a fresh, unatten
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
- Mount this provider when a delegation should run as a real Claude Code session in the parent's workspace. The common path is explicit: install the Bundle into a Profile, optionally configure the provider row, and expose it to the model through a delegation tool row.
28
+ Enable **Claude Code subagent** in the Web or Desktop Plugins page when a task needs a fresh native Claude Code session in the parent workspace.
29
29
 
30
30
  ### Installing the Bundle
31
31
 
32
- Install the package into the target Profile, then restart that Profile. The installation brings the pinned Agent SDK and one compatible platform CLI payload into the Profile; the declared patch layer registers only the dormant provider and starts no Claude process.
32
+ The Official entry is visible offline. Enabling it installs the [target for the running DSH installation](../../boot/plugin-manager/README.md#use-this-package) through the ordinary bundle installer and selects its profile layer. The layer registers the provider and adds `subagent_claude_code` to every Agent as a global tool; it starts no native process until delegation. Restart when the installer reports that one is required.
33
33
 
34
- ```sh
35
- dsh plugin --profile <name> add @deepseek-ai/dsh-subagent-claude-code
36
- dsh plugin --profile <name> remove @deepseek-ai/dsh-subagent-claude-code
37
- dsh --profile <name>
38
- ```
34
+ Switching Off deselects the layer and leaves the package installed. Remove is a separate package operation. Enabling or switching Off registers or removes the global tool in the running Host, so live Agents see the change on their next request.
39
35
 
40
- Removing the package withdraws the provider and its private runtime closure on the next Profile start. Installation controls Host availability, not model permission: the model can only reach the provider through a delegation tool row you compose.
36
+ The layer inserts Host rows only, so any profile can select it, including the shipped headless, SDK, and ACP profiles. Existing provider-only consumers follow the [upgrade guide](../../../docs/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.md).
41
37
 
42
38
  ### Configuration
43
39
 
@@ -57,31 +53,30 @@ Removing the package withdraws the provider and its private runtime closure on t
57
53
  | `plan` | Run in native planning mode, deny execution approval, and return the completed plan as the final answer |
58
54
  | `bypassPermissions` | Explicitly set the SDK's dangerous confirmation and bypass permission checks |
59
55
 
60
- The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-subagent-claude-code) is the exhaustive source for every accepted field and its JSDoc. A configured `model` passes unchanged to every query from that provider instance; omission leaves native model selection in force. Credential-shaped ambient variables are removed before the explicit `env` overlay, so an API key intended for the child must be supplied there. The provider omits the SDK `settingSources` option, so Claude Code reads the host's normal user, project, and local settings relative to the parent Session cwd. It does not copy or filter those files, create or modify login state, inspect `PATH`, or fall back to a host `claude` executable.
56
+ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-subagent-claude-code) is the exhaustive source for every accepted field and its JSDoc. A configured `model` passes unchanged to every query from that provider instance; omission leaves native model selection in force. Credential-shaped ambient variables are removed before the explicit `env` overlay, so an API key intended for the child must be supplied there. The provider omits the SDK `settingSources` option, so Claude Code reads the host's normal user, project, and local settings relative to the selected child working directory. It does not copy or filter those files, create or modify login state, inspect `PATH`, or fall back to a host `claude` executable.
61
57
 
58
+ <a id="exposing-the-tool"></a>
62
59
  ### Exposing the tool
63
60
 
64
- Each delegation tool row names one provider and needs its own `toolName`, so the model sees static tools rather than a dynamic provider selector. Full Agent Presets carry a matching default tool row with `disabled: true`; copy a preset and remove that field to expose `subagent_claude_code` only to agents composed from the copy.
61
+ The bundle inserts `tool-subagent-claude-code` as a Host row, so `subagent_claude_code` is a global tool visible to every preset, including minimal. Later user patches can configure or disable that row by id. A preset that registers its own tool with the same name shadows the global tool for its Agents. To mount the provider and tool without selecting the bundle layer, insert the same rows in `cordis.patch.yml`:
65
62
 
66
63
  ```yaml
67
- - id: jobs
68
- name: '@deepseek-ai/dsh-jobs-local'
69
- - id: tool-jobs
70
- name: '@deepseek-ai/dsh-tool-jobs'
71
- - id: tool-subagent-claude
72
- name: '@deepseek-ai/dsh-tool-subagent'
73
- config:
74
- provider: claude-code
75
- toolName: subagent_claude_code
76
- backgroundMode: one-shot
77
- maxDepth: provider-managed
64
+ - insert:
65
+ - id: subagent-claude-code
66
+ name: '@deepseek-ai/dsh-subagent-claude-code'
67
+ - id: tool-subagent-claude-code
68
+ name: '@deepseek-ai/dsh-tool-subagent'
69
+ config:
70
+ provider: claude-code
71
+ toolName: subagent_claude_code
72
+ maxDepth: provider-managed
78
73
  ```
79
74
 
80
- The `one-shot` policy keeps omitted or `false` `run_in_background` calls in the foreground, while explicit `true` returns a parent-owned job id for `job_output` or `job_kill`; the base host and full presets already provide the generic Job registry and controls.
75
+ The tool returns a child id after accepting the task and sends its result to the parent Agent on completion. Each external activation executes once and accepts no follow-up input or resume.
81
76
 
82
77
  ### What you get
83
78
 
84
- A foreground call gives the model the strict final Claude Code answer, or an error with the stop reason and optional safe diagnostic for a failed run. A background call first returns a job id; the generic job controls later deliver a completion notice and expose the same final answer or failed status through `job_output`. Claude Code reasoning, tool activity, intermediate messages, stderr, and workspace diffs never enter the parent session.
79
+ The completion notice contains the final Claude Code answer, or the stop reason and optional safe diagnostic. The parent Session also retains the external task identity and complete terminal result independently of the notice; no local child Session is created. Product reasoning, tool activity, raw stderr, and workspace diffs do not enter the parent Session.
85
80
 
86
81
  ### Failure and recovery
87
82
 
@@ -110,7 +105,7 @@ This section explains how the provider drives a real Claude Code CLI and where t
110
105
  | [`src/index.ts`](src/index.ts) | Plugin entry: config schema, provider registration |
111
106
  | [`src/run.ts`](src/run.ts) | The SDK query lifecycle, result acceptance, and permission handling |
112
107
  | [`src/process.ts`](src/process.ts) | Managed-range termination escalation on disposal |
113
- | [`cordis.patch.yml`](cordis.patch.yml) | The Profile patch layer that registers the dormant provider |
108
+ | [`cordis.patch.yml`](cordis.patch.yml) | The Profile layer that registers the provider and contributes preset delegation tools |
114
109
 
115
110
  ### Run flow
116
111
 
@@ -140,7 +135,7 @@ Read these pages when the package-level contract is not enough. They move from t
140
135
 
141
136
  #### What the model sees
142
137
 
143
- The Claude Code child receives the standalone text task as one fresh SDK query. Its workspace is the parent Session cwd; the selected provider instance fixes the query's configured model, environment, and non-interactive permission mode, while an omitted model and every other product setting come from native Claude configuration. The executable version comes from the Bundle's pinned SDK platform payload.
138
+ The Claude Code child receives the standalone text task as one fresh SDK query. Its workspace is the selected child working directory; the selected provider instance fixes the query's configured model, environment, and non-interactive permission mode, while an omitted model and every other product setting come from native Claude configuration. The executable version comes from the Bundle's pinned SDK platform payload.
144
139
 
145
140
  #### Token effect
146
141
 
@@ -154,15 +149,15 @@ Independent of the parent request cache. Reuse depends only on Claude Code's own
154
149
 
155
150
  #### What the model sees
156
151
 
157
- Through `dsh-tool-subagent`, a foreground call gives the parent the strict final Claude Code answer or an error containing the stop reason and optional safe diagnostic for a non-completed result. That diagnostic can distinguish a coarse action category, lifecycle stage, and observed process outcome without copying raw product text or version-specific subtype names. A background call first returns a Job id; the generic job controls later deliver a completion notice, expose the same final answer or failed status detail through `job_output`, and let `job_kill` request cancellation. Claude Code reasoning, tool activity, intermediate messages, stderr, workspace diffs, usage, product ids, tool inputs, and raw protocol payloads are not copied into the parent Session.
152
+ Through `dsh-tool-subagent`, the parent model first receives a child id, then the final Claude Code answer or a failure notice with its stop reason and safe diagnostic. Diagnostics contain only fixed stage, category, and observed protocol or process facts. Product reasoning, intermediate messages, tool activity, stderr, usage, product identifiers, commands, paths, and raw protocol payloads are not copied into the parent Session.
158
153
 
159
154
  #### Token effect
160
155
 
161
- Foreground input grows by the retained final answer or error. Background input also includes the start acknowledgement, completion notice, and any `job_output`, `job_kill`, or later status results; child tokens still do not enter the parent context. This provider adds no parent tool schema by itself.
156
+ Parent input grows by the start acknowledgement and completion notice, including the final answer or failure detail. Child tokens do not enter the parent context. This provider adds no parent tool schema by itself.
162
157
 
163
158
  #### KV Cache effect
164
159
 
165
- Append-only: foreground adds one result after the reusable parent prefix, while background appends the Job acknowledgement, notice, and later control or collection results. Background scheduling can add a notice-driven turn, but none of these messages rewrites the earlier prefix.
160
+ Start acknowledgements and completion notices append after the reusable parent request prefix. A notice may wake another turn without rewriting the existing prefix.
166
161
 
167
162
  ## Known Limitations and Deferred Work
168
163
 
@@ -177,8 +172,8 @@ These limits define when this provider is a poor fit or needs special operationa
177
172
  - **Authentication and account state remain native** — the Bundle supplies the CLI but does not create an account, log in, or rewrite Claude settings; configuration and authentication failures surface with their lifecycle stage and the safe `unknown` fallback rather than a separate public classification.
178
173
  - **The SDK platform payload is required at delegation time** — installs that omit optional dependencies, unsupported platforms, and missing or damaged payloads fail at the first query; there is no host-CLI fallback.
179
174
  - **No human interaction path** — `AskUserQuestion` is disabled, permission prompts are denied, MCP elicitation is declined, and blocking dialogs fail closed instead of suspending.
180
- - **Assistant payload is final text only** — reasoning, intermediate messages, tool traffic, usage, stderr, and workspace diffs remain product-local.
181
- - **No optional shared capabilities** — `agentOptions`, output schemas, child personas, tool filtering, and harness depth enforcement are rejected by the shared service for this provider.
175
+ - **Assistant payload is final text only** — failed runs can also expose a separate safe diagnostic; reasoning, intermediate messages, tool traffic, usage, stderr, and workspace diffs remain outside the parent Session. Task identity and terminal results are retained in the parent log.
176
+ - **No optional shared capabilities** — `agentPreset`, `agentOptions`, output schemas, and harness depth enforcement are rejected by the shared service for this provider.
182
177
  - **No wall-clock timeout or side-effect rollback** — the caller cancels long work, and files or external systems changed before cancellation are not restored.
183
178
 
184
179
  <a id="dev-note"></a>
package/README.zh.md CHANGED
@@ -25,19 +25,15 @@ kind: "package-bundle"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
- 当委派应以父级工作区中的真实 Claude Code 会话运行时,挂载本提供方。常用路径是显式的:把 Bundle 安装进 Profile,可选地配置提供方行,并通过委派工具行把它暴露给模型。
28
+ 当任务需要在父工作区中运行全新的原生 Claude Code 会话时,在 Web 或 Desktop 插件页启用 **Claude Code 子智能体**。
29
29
 
30
30
  ### 安装 Bundle
31
31
 
32
- 把包安装进目标 Profile,然后重启该 Profile。安装会把锁定的 Agent SDK 与一个兼容的平台 CLI 载荷带入 Profile;声明的 patch 层只注册休眠的提供方,不启动任何 Claude 进程。
32
+ 官方条目可离线显示。启用时,普通 bundle 安装器会安装[当前 DSH 安装对应的目标](../../boot/plugin-manager/README.zh.md#use-this-package)并选择其配置层。此层注册提供方,并为所有智能体添加全局工具 `subagent_claude_code`;实际委派前不会启动原生进程。安装器提示需要重启时,请重启应用。
33
33
 
34
- ```sh
35
- dsh plugin --profile <name> add @deepseek-ai/dsh-subagent-claude-code
36
- dsh plugin --profile <name> remove @deepseek-ai/dsh-subagent-claude-code
37
- dsh --profile <name>
38
- ```
34
+ 关闭只会取消选择配置层,保留已安装的包。移除是独立的包操作。启用或关闭会在运行中的 Host 注册或移除该全局工具,正在运行的智能体会在下一次请求时看到变化。
39
35
 
40
- 移除包后,下一次 Profile 启动会撤回提供方及其私有运行时闭包。安装决定 Host 可用性,而不是模型权限:模型只能通过你组合的委派工具行触达提供方。
36
+ 此层只插入 Host 条目,因此任何配置(包括随附的 headless、SDK 和 ACP)都可以选择它。原有仅提供方用法请遵循[升级指南](../../../docs/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.zh.md)。
41
37
 
42
38
  ### 配置
43
39
 
@@ -57,31 +53,30 @@ dsh --profile <name>
57
53
  | `plan` | 使用原生规划模式,拒绝执行审批,并把完整计划作为最终答案返回 |
58
54
  | `bypassPermissions` | 显式设置 SDK 的危险确认并跳过权限检查 |
59
55
 
60
- 生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-subagent-claude-code)是每个受支持字段及其 JSDoc 的穷尽式真源。已配置的 `model` 会原样传给该提供方实例的每次 query;省略时保留原生模型选择。具有凭证特征的环境变量会在显式 `env` 覆盖生效前被移除,因此供子进程使用的 API 密钥必须在该配置中显式提供。提供方省略 SDK 的 `settingSources` 选项,因此 Claude Code 会相对于父会话 cwd 读取宿主机常规的用户、项目与本地设置。它不会复制或过滤这些文件、创建或修改登录状态、检查 `PATH`,也不会回退到宿主 `claude` 可执行文件。
56
+ 生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-subagent-claude-code)是每个受支持字段及其 JSDoc 的穷尽式真源。已配置的 `model` 会原样传给该提供方实例的每次 query;省略时保留原生模型选择。具有凭证特征的环境变量会在显式 `env` 覆盖生效前被移除,因此供子进程使用的 API 密钥必须在该配置中显式提供。提供方省略 SDK 的 `settingSources` 选项,因此 Claude Code 会相对于所选子级工作目录 读取宿主机常规的用户、项目与本地设置。它不会复制或过滤这些文件、创建或修改登录状态、检查 `PATH`,也不会回退到宿主 `claude` 可执行文件。
61
57
 
58
+ <a id="exposing-the-tool"></a>
62
59
  ### 暴露工具
63
60
 
64
- 每个委派工具行指名一个提供方,并需要独立的 `toolName`,因此模型看到的是静态工具,而不是动态提供方选择器。完整 Agent Preset 携带对应的默认工具行并设置 `disabled: true`;复制一个 preset 后删除该字段,即可只向由该副本组装的 agent(智能体)暴露 `subagent_claude_code`。
61
+ Bundle 将 `tool-subagent-claude-code` 作为 Host 条目插入,因此 `subagent_claude_code` 是所有预设(包括 minimal)都可见的全局工具。后续用户补丁可以按 id 配置或禁用该行。预设自行注册的同名工具会为其智能体遮蔽该全局工具。若要不选择 bundle 层而挂载提供方和工具,在 `cordis.patch.yml` 中插入相同的条目:
65
62
 
66
63
  ```yaml
67
- - id: jobs
68
- name: '@deepseek-ai/dsh-jobs-local'
69
- - id: tool-jobs
70
- name: '@deepseek-ai/dsh-tool-jobs'
71
- - id: tool-subagent-claude
72
- name: '@deepseek-ai/dsh-tool-subagent'
73
- config:
74
- provider: claude-code
75
- toolName: subagent_claude_code
76
- backgroundMode: one-shot
77
- maxDepth: provider-managed
64
+ - insert:
65
+ - id: subagent-claude-code
66
+ name: '@deepseek-ai/dsh-subagent-claude-code'
67
+ - id: tool-subagent-claude-code
68
+ name: '@deepseek-ai/dsh-tool-subagent'
69
+ config:
70
+ provider: claude-code
71
+ toolName: subagent_claude_code
72
+ maxDepth: provider-managed
78
73
  ```
79
74
 
80
- `one-shot` 策略会让省略 `run_in_background` 或传入 `false` 的调用继续在前台等待,而显式传入 `true` 会返回由父 agent 拥有的 job id,供 `job_output` 或 `job_kill` 使用;base host(基础宿主)与完整 preset 已提供通用作业注册表和控制工具。
75
+ 工具接受任务后返回 child id;任务完成后向父 agent 发送结果通知。外部 activation 只执行一次,不支持追加输入或恢复对话。
81
76
 
82
77
  ### 你会得到什么
83
78
 
84
- 前台调用会把严格的最终 Claude Code 答案交给模型;运行失败时则返回带停止原因与可选安全诊断的错误。后台调用先返回 job id;随后通用作业控制面会送达完成通知,并通过 `job_output` 公开同一最终答案或失败状态。Claude Code 的推理、工具活动、中间消息、stderr 与工作区差异绝不会进入父级会话。
79
+ 完成通知包含 Claude Code 的最终答案,或停止原因与可选的安全诊断。父会话还独立保存外部任务的身份和完整终态结果;无需创建本地子 Session。产品推理、工具活动、原始 stderr 与工作区差异不会进入父会话。
85
80
 
86
81
  ### 失败与恢复
87
82
 
@@ -110,11 +105,11 @@ dsh --profile <name>
110
105
  | [`src/index.ts`](src/index.ts) | 插件入口:配置 schema、提供方注册 |
111
106
  | [`src/run.ts`](src/run.ts) | SDK query 生命周期、结果接受与权限处理 |
112
107
  | [`src/process.ts`](src/process.ts) | dispose(资源释放)时的 managed-range 逐级终止 |
113
- | [`cordis.patch.yml`](cordis.patch.yml) | 注册休眠提供方的 Profile patch 层 |
108
+ | [`cordis.patch.yml`](cordis.patch.yml) | 注册提供方并添加预设委派工具的 Profile 配置层 |
114
109
 
115
110
  ### 运行流程
116
111
 
117
- 一次启动只接受非空的文本块序列,并根据父会话确定子级 cwd。它创建私有 `AbortController`,用精确拼接的任务调用官方 SDK `query()`,并仅在 SDK 的 custom-spawn 钩子已经提供由子进程 seam 管理的活动 CLI 句柄后发布运行。提供方完整迭代消息流,只接受满足 `subtype: "success"`、`is_error: false` 且 `result` 非空白、随后迭代器正常结束的 `result` 消息。其余一切结果都映射为带固定类别的 `error` 诊断,命名生命周期阶段与已观测进程结果——类别集合见 [`src/run.ts`](src/run.ts)。本地取消会在结果竞态中胜出并映射为 `aborted`,且不附带失败诊断。
112
+ 一次启动只接受非空的文本块序列,并使用子代理服务选择的子级 cwd。它创建私有 `AbortController`,用精确拼接的任务调用官方 SDK `query()`,并仅在 SDK 的 custom-spawn 钩子已经提供由子进程 seam 管理的活动 CLI 句柄后发布运行。提供方完整迭代消息流,只接受满足 `subtype: "success"`、`is_error: false` 且 `result` 非空白、随后迭代器正常结束的 `result` 消息。其余一切结果都映射为带固定类别的 `error` 诊断,命名生命周期阶段与已观测进程结果——类别集合见 [`src/run.ts`](src/run.ts)。本地取消会在结果竞态中胜出并映射为 `aborted`,且不附带失败诊断。
118
113
 
119
114
  </details>
120
115
 
@@ -140,7 +135,7 @@ dsh --profile <name>
140
135
 
141
136
  #### 模型看到什么
142
137
 
143
- Claude Code 子级会在一个全新的 SDK query 中接收独立文本任务。它的工作区是父会话 cwd;所选提供方实例会固定已配置的模型、环境与非交互权限模式,而省略的模型及其余产品设置来自 Claude 原生配置。可执行版本来自 Bundle 锁定的 SDK 平台载荷。
138
+ Claude Code 子级会在一个全新的 SDK query 中接收独立文本任务。它的工作区是所选子级工作目录;所选提供方实例会固定已配置的模型、环境与非交互权限模式,而省略的模型及其余产品设置来自 Claude 原生配置。可执行版本来自 Bundle 锁定的 SDK 平台载荷。
144
139
 
145
140
  #### Token 影响
146
141
 
@@ -154,15 +149,15 @@ Claude Code 子级会在一个全新的 SDK query 中接收独立文本任务。
154
149
 
155
150
  #### 模型看到什么
156
151
 
157
- 通过 `dsh-tool-subagent`,前台调用会让父级模型看到符合严格成功条件的 Claude Code 最终答案;若结果未完成,错误中会包含终止原因和可选的安全诊断。该诊断可以区分粗粒度行动类别、生命周期阶段和已观测的进程结果,而不复制原始产品文本或版本专属 subtype 名称。后台调用会先返回 job id;随后通用作业控制面会送达完成通知,通过 `job_output` 公开同一最终答案或失败状态详情,并允许 `job_kill` 请求取消。Claude Code 的推理、工具活动、中间消息、stderr、工作区差异、用量信息、产品标识符、工具输入和原始协议载荷均不会复制到父会话。
152
+ 通过 `dsh-tool-subagent`,父模型先收到 child id,随后收到 Claude Code 最终答案或带停止原因与安全诊断的失败通知。诊断只包含固定的阶段、类别和已观测的协议或进程事实。产品推理、中间消息、工具活动、stderr、用量、产品标识符、命令、路径与原始协议载荷不会复制到父 Session。
158
153
 
159
154
  #### Token 影响
160
155
 
161
- 前台输入会增加工具结果中保留的最终答案或错误内容。后台输入还会包含启动确认、完成通知,以及 `job_output`、`job_kill` 或后续状态结果;子任务 token 仍不会进入父级上下文。本提供方自身不添加父级工具 schema。
156
+ 父级输入会增加启动确认与完成通知,包括最终答案或失败信息。子任务 token 不进入父级上下文。本提供方自身不添加父级工具 schema。
162
157
 
163
158
  #### KV Cache 影响
164
159
 
165
- 仅追加:前台会在可复用的父请求前缀后增加一个结果,后台则会继续追加 Job 启动确认、通知以及后续控制或收集结果。后台调度可能增加一个由通知唤醒的轮次,但这些消息都不会改写更早的前缀。
160
+ 启动确认与完成通知仅追加到可复用的父请求前缀之后。通知可能唤醒新轮次,不会改写已有前缀。
166
161
 
167
162
  ## 已知限制与延期工作
168
163
 
@@ -177,8 +172,8 @@ Claude Code 子级会在一个全新的 SDK query 中接收独立文本任务。
177
172
  - **身份验证与账户状态仍由原生机制管理**——Bundle 会提供 CLI,但不会创建账户、登录或改写 Claude 设置;配置与身份验证失败会公开其生命周期阶段与安全的 `unknown` 回退,而不会增加单独的公开分类。
178
173
  - **委派时必须存在 SDK 平台载荷**——省略 optional dependencies 的安装、不受支持的平台以及缺失或损坏的载荷都会在第一次 query 时失败;不会回退到宿主 CLI。
179
174
  - **没有人工交互路径**——`AskUserQuestion` 被禁用,权限提示会被拒绝,MCP elicitation 会被拒绝,阻塞对话会以拒绝方式失败而不会挂起。
180
- - **assistant 载荷仅包含最终文本**——失败运行可以额外公开独立的安全诊断;推理、中间消息、工具通信、用量信息、stderr 和工作区差异仍只保留在产品内部,通用 Job id、通知与状态来自共享作业运行时。
181
- - **没有可选的共享能力**——对于本提供方,共享服务会拒绝 `agentOptions`、输出 schema、子任务角色设定、工具筛选和 harness 深度强制约束。
175
+ - **assistant 载荷仅包含最终文本**——失败运行还可公开独立的安全诊断;推理、中间消息、工具通信、用量、stderr 与工作区差异不会进入父 Session。任务身份与终态结果保存在父日志中。
176
+ - **没有可选的共享能力**——对于本提供方,共享服务会拒绝 `agentPreset`、`agentOptions`、输出 schema 和 harness 深度强制约束。
182
177
  - **没有按实际经过时间触发的超时或副作用回滚**——长时间运行的工作由调用方取消,且取消前已更改的文件或外部系统不会恢复原状。
183
178
 
184
179
  <a id="dev-note"></a>
package/cordis.patch.yml CHANGED
@@ -1,6 +1,9 @@
1
- # This optional Profile layer registers the dormant Claude Code provider. Agent
2
- # presets separately decide whether one session receives its delegation tool.
3
-
4
1
  - insert:
5
2
  - id: subagent-claude-code
6
3
  name: '@deepseek-ai/dsh-subagent-claude-code'
4
+ - id: tool-subagent-claude-code
5
+ name: '@deepseek-ai/dsh-tool-subagent'
6
+ config:
7
+ provider: claude-code
8
+ toolName: subagent_claude_code
9
+ maxDepth: provider-managed
package/icon.svg ADDED
@@ -0,0 +1 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="14.9893" y="15.1877" width="12.2365" height="12.2365" rx="2" fill="url(#dsh_plugin_art_R0a)" fill-opacity="0.8"></rect><rect x="8.87109" y="9.0697" width="12.2365" height="12.2365" rx="2" fill="url(#dsh_plugin_art_R0b)" fill-opacity="0.8"></rect><defs><linearGradient id="dsh_plugin_art_R0a" x1="21.1075" y1="15.1877" x2="21.1075" y2="27.4243" gradientUnits="userSpaceOnUse"><stop stop-color="#45E7A4"></stop><stop offset="1" stop-color="#05909D"></stop></linearGradient><linearGradient id="dsh_plugin_art_R0b" x1="14.9894" y1="9.0697" x2="14.9894" y2="21.3063" gradientUnits="userSpaceOnUse"><stop stop-color="#69B9FF"></stop><stop offset="1" stop-color="#324DE2"></stop></linearGradient></defs></svg>
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
2
  import { MAX_TIMER_DELAY_MS } from "@deepseek-ai/dsh-timeout";
3
- import { NO_START_CAPABILITIES, assertPositiveFinite, resolveChildCwd, settleRunResult, subprocessRunHandle } from "@deepseek-ai/dsh-subagent";
3
+ import { NO_START_CAPABILITIES, assertPositiveFinite, assertUsableCwd, settleRunResult, subprocessRunHandle } from "@deepseek-ai/dsh-subagent";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { query } from "@anthropic-ai/claude-agent-sdk";
6
6
  import { brandString } from "@deepseek-ai/dsh-brand";
@@ -511,11 +511,9 @@ var ClaudeCodeProvider = class {
511
511
  this.config = config;
512
512
  }
513
513
  async start(request) {
514
- const parentCwd = request.parent.session.header.cwd;
515
- if (parentCwd === void 0) throw new Error("subagent-claude-code: no working directory for the child — delegate from a parent session that has one");
516
514
  let cwd;
517
515
  try {
518
- cwd = resolveChildCwd("subagent-claude-code", void 0, parentCwd);
516
+ cwd = assertUsableCwd("subagent-claude-code", "child cwd", request.cwd);
519
517
  } catch (error) {
520
518
  if (request.signal.aborted) throw new Error("subagent-claude-code: request was aborted before SDK startup");
521
519
  const failure = claudeCodeStartupFailure(error);
@@ -26,7 +26,7 @@ export declare const DEFAULT_CLAUDE_CODE_PERMISSION_MODE: ClaudeCodePermissionMo
26
26
  export declare function claudeCodeStartupFailure(cause: unknown): Error;
27
27
  /** Fully resolved inputs for one official Claude Agent SDK query. */
28
28
  export interface ClaudeCodeRunSpec {
29
- /** Parent Session workspace supplied to the SDK and real CLI. */
29
+ /** Selected child working directory supplied to the SDK and real CLI. */
30
30
  readonly cwd: string;
31
31
  /** Profile-selected native model; omitted to preserve Claude settings. */
32
32
  readonly model?: string;
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Claude Code subagent",
4
+ "description": "Delegate one task to Claude Code using its native authentication and settings."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Claude Code 子智能体",
4
+ "description": "使用 Claude Code 原生认证和设置委派单个任务。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-subagent-claude-code",
3
3
  "description": "One-shot Claude Code subagent provider over the official Agent SDK",
4
- "version": "0.2.1-alpha.1",
4
+ "version": "0.2.1-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -19,9 +19,13 @@
19
19
  "default": "./lib/index.js"
20
20
  },
21
21
  "./src/*": "./src/*",
22
- "./package.json": "./package.json"
22
+ "./package.json": "./package.json",
23
+ "./locale/*.json": "./locale/*.json",
24
+ "./cordis.patch.yml": "./cordis.patch.yml"
23
25
  },
24
26
  "files": [
27
+ "icon.svg",
28
+ "locale/*.json",
25
29
  "lib/index.js",
26
30
  "cordis.patch.yml",
27
31
  "lib/types/**/*.d.ts"
@@ -33,38 +37,40 @@
33
37
  }
34
38
  },
35
39
  "peerDependencies": {
36
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
37
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
38
- "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
39
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.1",
40
- "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.1",
41
- "@deepseek-ai/dsh-timeout": "0.2.1-alpha.1"
40
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
41
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
42
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
43
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.3",
44
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.3",
45
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.3"
42
46
  },
43
47
  "dependencies": {
44
48
  "@anthropic-ai/claude-agent-sdk": "0.3.263",
45
49
  "@anthropic-ai/sdk": "0.93.0",
46
- "@modelcontextprotocol/sdk": "^1.29.0",
47
- "zod": "^4.4.3",
48
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
49
- "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
50
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.3",
51
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.2",
52
+ "@modelcontextprotocol/sdk": "^1.31.0",
53
+ "zod": "4.4.3",
54
+ "@deepseek-ai/dsh-tool-subagent": "0.2.1-alpha.3"
50
55
  },
51
56
  "devDependencies": {
52
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
53
- "@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
54
- "@deepseek-ai/dsh-app-boot": "0.2.1-alpha.1",
55
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
56
- "@deepseek-ai/dsh-loader-smoke": "0.2.1-alpha.1",
57
- "@deepseek-ai/dsh-session-checkpoint-policy": "0.2.1-alpha.1",
58
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.1",
59
- "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.1",
60
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.1",
61
- "@deepseek-ai/dsh-subagent-codex": "0.2.1-alpha.1",
62
- "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.1",
63
- "@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.1",
64
- "@deepseek-ai/dsh-timeout": "0.2.1-alpha.1",
65
- "@deepseek-ai/dsh-tool-jobs": "0.2.1-alpha.1",
66
- "@deepseek-ai/dsh-tool-subagent": "0.2.1-alpha.1",
67
- "@deepseek-ai/dsh-tools": "0.2.1-alpha.1",
68
- "@deepseek-ai/dsh-session": "0.2.1-alpha.1"
69
- }
57
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
58
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
59
+ "@deepseek-ai/dsh-app-boot": "0.2.1-alpha.3",
60
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
61
+ "@deepseek-ai/dsh-loader-smoke": "0.2.1-alpha.3",
62
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
63
+ "@deepseek-ai/dsh-session-checkpoint-policy": "0.2.1-alpha.3",
64
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.3",
65
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
66
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.3",
67
+ "@deepseek-ai/dsh-subagent-codex": "0.2.1-alpha.3",
68
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.3",
69
+ "@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.3",
70
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.3",
71
+ "@deepseek-ai/dsh-tool-jobs": "0.2.1-alpha.3",
72
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
73
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.3"
74
+ },
75
+ "icon": "./icon.svg"
70
76
  }