@deepseek-ai/dsh-subagent-fork-in-process 0.2.0-rc.2 → 0.2.1-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 CHANGED
@@ -27,26 +27,26 @@
27
27
  en: d6058c358890c64c
28
28
  zh: 93f8cc2b60975d42
29
29
  /deepseek-ai-dsh-subagent-fork-in-process/use-this-package/what-a-fork-delegation-does:
30
- en: 221626f65c2faf04
31
- zh: dfa8200b5349340f
30
+ en: 461063deda821a1b
31
+ zh: 18d2d41d64884f22
32
32
  /deepseek-ai-dsh-subagent-fork-in-process/understand-the-implementation:
33
33
  en: 6a0fe4b9cc780aaa
34
34
  zh: 50cd69ceb8296827
35
35
  /deepseek-ai-dsh-subagent-fork-in-process/understand-the-implementation/design-concept:
36
- en: 3917de9c152828e0
37
- zh: 4c48bb580510ef0e
36
+ en: 49c8725fee5330ed
37
+ zh: 9050680f2011820a
38
38
  /deepseek-ai-dsh-subagent-fork-in-process/understand-the-implementation/source-map:
39
- en: b629a79a8b4de729
40
- zh: 3b3019101cf70c54
39
+ en: f1f45255fd9f71c1
40
+ zh: 9a3f016b8fe9754a
41
41
  /deepseek-ai-dsh-subagent-fork-in-process/understand-the-implementation/run-flow:
42
- en: 59b82d0f46c21967
43
- zh: aacc5455eaabc8f7
42
+ en: ef063b5c5542e129
43
+ zh: ba564c6b92453b44
44
44
  /deepseek-ai-dsh-subagent-fork-in-process/understand-the-implementation/lifecycle-binding:
45
- en: 8f9a94404f719707
46
- zh: 60d2318aad2c2935
45
+ en: 8dad0155ed1b32d2
46
+ zh: f4d82d5ede03c4d7
47
47
  /deepseek-ai-dsh-subagent-fork-in-process/further-exploration:
48
- en: 40cb89910f190f45
49
- zh: ab9728a53d4b6123
48
+ en: 29ea6e0669b665a8
49
+ zh: 46d435e79d356898
50
50
  /deepseek-ai-dsh-subagent-fork-in-process/model-experience:
51
51
  en: 215e7ba838619b7b
52
52
  zh: a311da3843709f90
@@ -66,8 +66,8 @@
66
66
  en: 75d061c2151624a7
67
67
  zh: 71e58e020b60ff90
68
68
  /deepseek-ai-dsh-subagent-fork-in-process/model-experience/parent-tool-result-indirectly/what-the-model-sees:
69
- en: 0521a7cac72c880d
70
- zh: 6ac7c5f25c7d55f6
69
+ en: 54d10ba4da6cdece
70
+ zh: bb9cb4d685098483
71
71
  /deepseek-ai-dsh-subagent-fork-in-process/model-experience/parent-tool-result-indirectly/token-effect:
72
72
  en: 8c81bab3c5d6a38a
73
73
  zh: 44c798432a4bfdfb
@@ -75,8 +75,8 @@
75
75
  en: f5d5f97a153f7c70
76
76
  zh: 3d6bc05b9eadfbc2
77
77
  /deepseek-ai-dsh-subagent-fork-in-process/known-limitations-and-deferred-work:
78
- en: fb435c0512f2c2ee
79
- zh: d325c13bf8a2afc7
78
+ en: 6b8bc8825865e662
79
+ zh: 02e075e302d02fb6
80
80
  /deepseek-ai-dsh-subagent-fork-in-process/known-limitations-and-deferred-work/dev-note:
81
81
  en: e67f633dc6fe7773
82
82
  zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -55,7 +55,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
55
55
 
56
56
  ### What a fork delegation does
57
57
 
58
- One tool call starts one child seeded with the completed turns and waits for its result: the child sees the conversation up to the parent's last completed turn, works in its own session, and the parent receives only its final output — or an errored tool result for cancellation, refusal, token-limit truncation, or startup rejection. The seed is captured once at start; later parent turns never reach the child.
58
+ One tool call creates a background child and returns its session id immediately. The child works in its own session; the parent receives its final answer in a completion notice. The child can also send messages through `send_message`. A rejected start leaves no published child. Programmatic callers such as workflows can await the activation result directly.
59
59
 
60
60
  -----
61
61
 
@@ -69,22 +69,21 @@ This section explains the design decisions behind the backend and where the beha
69
69
 
70
70
  ### Design concept
71
71
 
72
- One difference from spawn, expressed as data: the backend computes the balanced completed-turn prefix of the parent's log and hands it to the shared in-process driver as the child's session seed. Because live sequence numbers equal array indexes, the prefix stays a valid seed beginning at sequence zero, and the driver records its length so the result reader never mistakes a seeded parent message for child output.
72
+ This backend supplies the balanced completed-turn prefix of the parent log as the child session seed. The subagent service records the inherited range so results contain only the child’s own output.
73
73
 
74
74
  ### Source map
75
75
 
76
76
  | File | Role |
77
77
  |---|---|
78
78
  | [`src/index.ts`](src/index.ts) | Provider registration: prefix computation, `Config` schema, capability declaration |
79
- | — | No runtime invariant companion is published; this package exposes no independent event sequence or mutable data relation beyond contracts enforced at its owning seam. |
80
79
 
81
80
  ### Run flow
82
81
 
83
- On `start`, the prefix is sliced from the parent's event log up to and including the last `turn/end`; the shared driver then creates the child with that seed, applies the same persona, tool-filter, and structured-output setup, drives one task, reads the child's own final output, and disposes quiescently. The provider advertises `agentOptions` plus the same output, depth, filter, and persona capabilities as spawn. `prepareContinuable` captures the prefix once, at creation, because it becomes part of the child's own durable transcript.
82
+ `prepareContinuable()` captures the parent’s completed-turn prefix once at creation. `startActivation()` creates the child with that seed, and the subagent service applies persona, tool filtering, and structured output for this activation. The provider advertises the same agent options, output, depth, filter, and persona capabilities as spawn.
84
83
 
85
84
  ### Lifecycle binding
86
85
 
87
- The base bundle and ACP/headless examples bind this provider to `backgroundMode: one-shot`, while the CLI presets select `continuable`. Both preserve the inherited request prefix: parent and child receive the same messaging tool definition and ordering, and the continuable child's parent id and return guidance live in its initial user task after inherited history ([cache-preserving fork Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md)).
86
+ The delegation tool creates a background activation and returns a stable child session id. Parent and child share the same messaging tool definitions and ordering; the parent id and return guidance follow inherited history in the initial task. Workflows await results with caller delivery and send no completion notice to the parent.
88
87
 
89
88
  </details>
90
89
 
@@ -93,14 +92,13 @@ The base bundle and ACP/headless examples bind this provider to `backgroundMode:
93
92
  <a id="further-exploration"></a>
94
93
  ## Further Exploration
95
94
 
96
- Read these pages when the package-level contract is not enough; they move from the shared subagent model to the sibling backends and the design evidence for the one-shot binding.
95
+ Read these pages when the package-level contract is not enough; they move from the shared subagent model to the sibling backends and the design evidence for preserving the inherited request prefix.
97
96
 
98
97
  - [Subagent subsystem](../../../docs/subsystems/subagent.md) — start requests, results, provider contract, and in-process depth and seed.
99
- - [dsh-subagent-in-process-driver](../subagent-in-process-driver/README.md) — the shared run driver this backend calls.
100
98
  - [dsh-subagent-spawn-in-process](../subagent-spawn-in-process/README.md) — the fresh-child sibling backend.
101
99
  - [dsh-tool-subagent](../tool-subagent/README.md) — the model-facing delegation tool that reaches this provider.
102
100
  - [Generated configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-subagent-fork-in-process) — every accepted config field and its source declaration.
103
- - [Fork children stay one-shot](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md) — why shipped compositions bind fork to one-shot.
101
+ - [Forked children preserve the parent request prefix](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md) — why continuable fork preserves the inherited request prefix.
104
102
 
105
103
  -----
106
104
 
@@ -125,7 +123,7 @@ The child may reuse the inherited byte-identical prefix under the same provider
125
123
 
126
124
  #### What the model sees
127
125
 
128
- The parent receives only the child's own final output through `dsh-tool-subagent`, not the inherited prefix or intermediate work.
126
+ Through `dsh-tool-subagent`, the parent first receives the child session id, then a completion notice with its final answer. Child-authored messages arrive through `send_message`; the inherited prefix and internal work remain in the child session.
129
127
 
130
128
  #### Token effect
131
129
 
@@ -143,8 +141,8 @@ Append-only; newly visible content follows the reusable request prefix and does
143
141
  These limits define when the backend is the wrong choice; they are current package constraints.
144
142
 
145
143
  - **The seed is a one-time snapshot** — the child sees the parent's completed turns as of the fork and nothing the parent logs afterwards; there is no live context sharing.
146
- - **Fork lifecycle policy differs by composition** — the base bundle and ACP/headless examples use one-shot fork, while the CLI presets use continuable fork. Both keep the inherited prefix eligible for reuse because parent and child messaging definitions match byte for byte; explicit persona, tool filtering, generated-SDK, or route changes can still break equality. Rationale: the [cache-preserving fork Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md).
147
- - **Shipped fork tools do not expose child LLM route selection** — they inherit the parent's provider and model so the copied history remains eligible for KV Cache reuse. Route selection stays disabled until a change can preserve reuse or expose a bounded recomputation cost; the [model-selected route Agent Note](../../../.agents/notes/implemented/feature/2026-08-18-model-selected-subagent-routes.md) owns that restriction.
144
+ - **Prefix reuse depends on matching request inputs** — parent and child messaging definitions match byte for byte; explicit persona, tool filtering, generated-SDK, or route changes can still break equality. Rationale: the [cache-preserving fork Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md).
145
+ - **Shipped fork tools do not expose child LLM route selection** — they inherit the parent's provider and model so the copied history remains eligible for KV Cache reuse. Route selection stays disabled until a change can preserve reuse or expose a bounded recomputation cost.
148
146
 
149
147
  <a id="dev-note"></a>
150
148
  ### Dev Note
package/README.zh.md CHANGED
@@ -55,7 +55,7 @@ kind: "package-reference"
55
55
 
56
56
  ### 一次 fork 委派会做什么
57
57
 
58
- 一次工具调用启动一个以已完成轮次为初始内容的子 agent,并等待其结果:子 agent 能看到截至父级最后一个已完成轮次的对话,在自有会话中工作,父级只接收其最终输出——取消、拒绝、token 上限截断或启动被拒时则收到出错的工具结果。初始内容在启动时只捕获一次;此后的父级轮次绝不会到达子 agent。
58
+ 一次工具调用创建后台子 agent 并立即返回子会话 ID。子级在自己的会话中工作,父级通过完成通知收到其最终答案。子级也可以通过 `send_message` 发送消息。被拒绝的启动不会留下已发布的子 agent;工作流等程序调用方可以直接等待 activation 的结果。
59
59
 
60
60
  -----
61
61
 
@@ -69,22 +69,21 @@ kind: "package-reference"
69
69
 
70
70
  ### 设计理念
71
71
 
72
- 与 spawn 的差异只有一处,且以数据表达:后端计算父级日志的已配平已完成轮次前缀,并把它作为子 agent 的会话初始内容交给共享进程内驱动器。由于实际序号等于数组下标,前缀始终是自序号零开始的合法初始内容;驱动器记录其长度,使结果读取器不会把作为初始内容的父级消息误认为子 agent 输出。
72
+ 本后端把父级日志中已配平的已完成轮次前缀作为子会话初始内容。subagent 服务记录继承范围,因此结果只包含子级自己的输出。
73
73
 
74
74
  ### 源码地图
75
75
 
76
76
  | 文件 | 职责 |
77
77
  |---|---|
78
78
  | [`src/index.ts`](src/index.ts) | 提供方注册:前缀计算、`Config` schema、能力声明 |
79
- | — | 不发布运行时不变式伴生入口;本包没有独立事件序列或可变数据关系,相关约定在所属 seam 强制执行。 |
80
79
 
81
80
  ### 运行流程
82
81
 
83
- `start` 时,从父级事件日志中截取截至最后一个 `turn/end` 的前缀;共享驱动器随后以该初始内容创建子 agent,应用相同的 persona、工具过滤器与结构化输出设置,驱动一项任务,读取子 agent 自身的最终输出,并执行 dispose(资源释放)以等待所有工作完全停稳。该提供方声明 `agentOptions`,以及与 spawn 相同的输出、深度、过滤与 persona 能力。`prepareContinuable` 在创建时只捕获一次前缀,因为该前缀会成为子 agent 自身持久保存的 transcript(文本记录)的一部分。
82
+ `prepareContinuable()` 在创建时捕获一次父级已完成轮次前缀。`startActivation()` 以此创建子 agent,并由 subagent 服务应用 persona、工具过滤与本次 activation 的结构化输出设置。提供方声明与 spawn 相同的 `agentOptions`、输出、深度、过滤及 persona 能力。
84
83
 
85
84
  ### 生命周期绑定
86
85
 
87
- base 组合包与 ACP(Agent Client Protocol)/headless 示例在委派工具上把本提供方绑定为 `backgroundMode: one-shot`,CLI(命令行界面)预设则选择 `continuable`。两者都保留继承的请求前缀:父级与子级获得定义和顺序相同的消息工具,可继续子级的父级 ID 与返回指导位于继承历史之后的初始用户任务中(见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md))。
86
+ 委派工具以后台 activation 创建子级,并返回稳定的子会话 ID。父级与子级共享相同的消息工具定义及顺序;父级 ID 与返回指导位于继承历史之后的初始任务中。工作流以调用方收集模式等待结果,不向父级发送完成通知。
88
87
 
89
88
  </details>
90
89
 
@@ -93,14 +92,13 @@ base 组合包与 ACP(Agent Client Protocol)/headless 示例在委派工具
93
92
  <a id="further-exploration"></a>
94
93
  ## 进一步探索
95
94
 
96
- 当包级约定不够用时阅读以下页面;它们从共享 subagent 模型进入兄弟后端,以及一次性绑定的设计证据。
95
+ 当包级约定不够用时阅读以下页面;它们从共享 subagent 模型进入兄弟后端,以及保留继承请求前缀的设计证据。
97
96
 
98
97
  - [Subagent 子系统](../../../docs/subsystems/subagent.zh.md)——启动请求、结果、提供方约定与进程内深度和初始内容。
99
- - [dsh-subagent-in-process-driver](../subagent-in-process-driver/README.zh.md)——本后端调用的共享运行驱动器。
100
98
  - [dsh-subagent-spawn-in-process](../subagent-spawn-in-process/README.zh.md)——全新子级的兄弟后端。
101
99
  - [dsh-tool-subagent](../tool-subagent/README.zh.md)——指向该提供方的面向模型委派工具。
102
100
  - [生成配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-subagent-fork-in-process)——每个受支持配置字段及其源声明。
103
- - [fork 保持 one-shot](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md)——随附组合为何把 fork 绑定为 one-shot。
101
+ - [Fork child 保留 parent 请求前缀](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md)——可继续 fork 为何保留继承的请求前缀。
104
102
 
105
103
  -----
106
104
 
@@ -125,7 +123,7 @@ fork 会把保留的已完成历史复制到子 agent 的请求中,子 agent
125
123
 
126
124
  #### 模型看到什么
127
125
 
128
- 父级只通过 `dsh-tool-subagent` 接收子 agent 自身的最终输出,不接收继承的前缀或中间工作。
126
+ 父级通过 `dsh-tool-subagent` 先收到子会话 ID,随后收到包含最终答案的完成通知。子级自行编写的消息通过 `send_message` 到达;继承的前缀与内部工作保留在子会话中。
129
127
 
130
128
  #### Token 影响
131
129
 
@@ -143,8 +141,8 @@ fork 会把保留的已完成历史复制到子 agent 的请求中,子 agent
143
141
  这些限制说明何时选择该后端是错误的;它们是当前包约束。
144
142
 
145
143
  - **初始内容是一次性快照**——子 agent 只能看到 fork 时父级已完成的轮次,看不到父级此后记录的任何内容;不会实时共享上下文。
146
- - **fork 生命周期策略因组合而异**——base 组合包与 ACP/headless 示例使用一次性 fork,CLI 预设使用可继续 fork。两者都因父级与子级的消息定义逐字节相同而让继承前缀保持可复用;显式 persona、工具过滤、生成 SDK 或路由变化仍可破坏相等性。理由见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md)。
147
- - **随附 fork 工具不公开子级 LLM(大语言模型)路由选择**——它们继承父级提供方与模型,使复制的历史仍有资格复用 KV Cache。在某项改动能保留复用或公开有界重算成本前,路由选择保持禁用;[模型选择路由 Agent Note](../../../.agents/notes/implemented/feature/2026-08-18-model-selected-subagent-routes.zh.md)说明这项限制。
144
+ - **前缀复用取决于请求输入是否匹配**——父级与子级的消息定义都逐字节相同;显式 persona、工具过滤、生成 SDK 或路由变化仍可破坏相等性。理由见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md)。
145
+ - **随附 fork 工具不公开子级 LLM(大语言模型)路由选择**——它们继承父级提供方与模型,使复制的历史仍有资格复用 KV Cache。在某项改动能保留复用或公开有界重算成本前,路由选择保持禁用。
148
146
 
149
147
  <a id="dev-note"></a>
150
148
  ### 开发备注
package/lib/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
- import { startInProcessRun } from "@deepseek-ai/dsh-subagent-in-process-driver";
3
2
  //#region lib/types/index.js
4
3
  /**
5
4
  * The in-process FORK subagent backend: registers a {@link SubagentProvider} on
@@ -45,10 +44,6 @@ var ForkInProcessProvider = class {
45
44
  constructor(name) {
46
45
  this.name = name;
47
46
  }
48
- start(request) {
49
- const seed = completedTurnPrefix(request.parent);
50
- return startInProcessRun(request, { ...seed.length > 0 ? { seed } : {} });
51
- }
52
47
  prepareContinuable(request) {
53
48
  const seed = completedTurnPrefix(request.parent);
54
49
  return Promise.resolve(seed.length > 0 ? { seed } : {});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-subagent-fork-in-process",
3
3
  "description": "In-process fork subagent backend: runs a child agent seeded with a prefix of the parent's log",
4
- "version": "0.2.0-rc.2",
4
+ "version": "0.2.1-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,27 +27,24 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
31
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
32
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.2",
33
- "@deepseek-ai/dsh-subagent-in-process-driver": "0.2.0-rc.2",
34
- "@deepseek-ai/cordis": "~4.0.4"
30
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
31
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
32
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.2",
33
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1"
35
34
  },
36
35
  "dependencies": {
37
- "@deepseek-ai/schemastery": "~3.18.4"
36
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
38
37
  },
39
38
  "devDependencies": {
40
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
41
- "@deepseek-ai/dsh-agent-loop": "0.2.0-rc.2",
42
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
43
- "@deepseek-ai/cordis-plugin-loader": "~1.0.5",
44
- "@deepseek-ai/dsh-agent-loop-testkit": "0.2.0-rc.2",
45
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
46
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
47
- "@deepseek-ai/dsh-subagent-in-process-driver": "0.2.0-rc.2",
48
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.0-rc.2",
49
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.2",
50
- "@deepseek-ai/cordis": "~4.0.4",
51
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.2"
39
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.1",
40
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
41
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.2",
42
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.2",
43
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
44
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
45
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.2",
46
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-alpha.2",
47
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
48
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2"
52
49
  }
53
50
  }