@deepseek-ai/dsh-subagent-fork-in-process 0.1.1-rc.2 → 0.1.2-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 +2 -2
- package/README.md +112 -16
- package/README.zh.md +119 -23
- package/lib/index.js +4 -2
- package/package.json +20 -19
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/subagent/subagent-fork-in-process/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 408d5efbd0426297eb02c44babf91d7fd2a271ff
|
|
6
|
+
README.zh.md: d1e0c2e034556d8dde5bff12bb09c4ec0ae0d678
|
package/README.md
CHANGED
|
@@ -1,45 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "In-process fork subagent backend for users and maintainers choosing, configuring, or debugging children seeded with the parent's completed turns."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# @deepseek-ai/dsh-subagent-fork-in-process
|
|
2
7
|
|
|
3
8
|
English | [中文](README.zh.md)
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-subagent-fork-in-process` is an in-process subagent backend that seeds each child with the parent's completed conversation turns: the child sees every finished turn and none of the in-flight one, so follow-up work builds on the conversation without duplicating it. A delegation tool reaches it under the `fork` provider name, and its behavior matches the spawn backend except for the session seed. Choose it when a subtask continues this conversation; choose spawn when the child must stand alone. The seed is a one-time snapshot taken at fork time: later parent turns never reach the child.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Mount this backend when delegated work must build on the parent's conversation. The common path mirrors spawn: load the subagent service and this backend, then point a delegation tool such as `dsh-tool-subagent` at the `fork` provider.
|
|
29
|
+
|
|
30
|
+
### When to choose it
|
|
31
|
+
|
|
32
|
+
Choose fork when the child needs the conversation's completed turns — a follow-up analysis, a review, a continuation. Choose spawn when the child should start clean, or an out-of-process backend when the child must not share this process. The seed carries conversation history only: the child still gets a fresh tool scope and none of the parent's authority.
|
|
33
|
+
|
|
34
|
+
### Seed boundary
|
|
35
|
+
|
|
36
|
+
The seed ends at the parent's last completed turn. A parent's current tool-calling turn is still open when a subagent starts, so that in-flight turn is never included; before the first completed turn the seed is empty and the child behaves like a fresh spawn.
|
|
37
|
+
|
|
38
|
+
### Minimal configuration
|
|
39
|
+
|
|
40
|
+
Load the subagent service and this backend, then configure a delegation tool. This composition exposes a `subagent` tool backed by fork:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
- name: '@deepseek-ai/dsh-subagent'
|
|
44
|
+
- name: '@deepseek-ai/dsh-subagent-fork-in-process'
|
|
45
|
+
- name: '@deepseek-ai/dsh-tool-subagent'
|
|
46
|
+
config:
|
|
47
|
+
provider: fork
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Field | Default | Meaning |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `providerName` | `fork` | Provider name registered on `ctx.subagents` |
|
|
53
|
+
|
|
54
|
+
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-subagent-fork-in-process) is the exhaustive source for every accepted field and its JSDoc.
|
|
55
|
+
|
|
56
|
+
### What a fork delegation does
|
|
6
57
|
|
|
7
|
-
|
|
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.
|
|
8
59
|
|
|
9
|
-
|
|
60
|
+
-----
|
|
10
61
|
|
|
11
|
-
|
|
62
|
+
<a id="understand-the-implementation"></a>
|
|
63
|
+
## Understand the implementation
|
|
12
64
|
|
|
13
|
-
|
|
65
|
+
<details>
|
|
66
|
+
<summary>Implementation internals — click to expand</summary>
|
|
14
67
|
|
|
15
|
-
|
|
68
|
+
This section explains the design decisions behind the backend and where the behavior in [Use this package](#use-this-package) comes from.
|
|
16
69
|
|
|
17
|
-
|
|
70
|
+
### Design concept
|
|
18
71
|
|
|
19
|
-
|
|
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.
|
|
20
73
|
|
|
21
|
-
|
|
74
|
+
### Source map
|
|
22
75
|
|
|
23
|
-
|
|
|
76
|
+
| File | Role |
|
|
24
77
|
|---|---|
|
|
25
|
-
| `
|
|
26
|
-
|
|
78
|
+
| [`src/index.ts`](src/index.ts) | Provider registration: prefix computation, `Config` schema, capability declaration |
|
|
79
|
+
| [`src/invariant.ts`](src/invariant.ts) | Invariant companion |
|
|
27
80
|
|
|
81
|
+
### Run flow
|
|
82
|
+
|
|
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.
|
|
84
|
+
|
|
85
|
+
### One-shot binding
|
|
86
|
+
|
|
87
|
+
The base bundle and ACP/headless examples bind this provider to `backgroundMode: one-shot`: a continuable fork child carries the child-scoped `report` tool and its prompt section before the inherited history, defeating byte-identical prefix reuse. The CLI presets retain `continuable` fork and accept that prefix loss ([cache-preserving fork Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md)).
|
|
88
|
+
|
|
89
|
+
</details>
|
|
90
|
+
|
|
91
|
+
-----
|
|
92
|
+
|
|
93
|
+
<a id="further-exploration"></a>
|
|
94
|
+
## Further Exploration
|
|
95
|
+
|
|
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.
|
|
97
|
+
|
|
98
|
+
- [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
|
+
- [dsh-subagent-spawn-in-process](../subagent-spawn-in-process/README.md) — the fresh-child sibling backend.
|
|
101
|
+
- [dsh-tool-subagent](../tool-subagent/README.md) — the model-facing delegation tool that reaches this provider.
|
|
102
|
+
- [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.
|
|
104
|
+
|
|
105
|
+
-----
|
|
106
|
+
|
|
107
|
+
<a id="model-experience"></a>
|
|
28
108
|
## Model Experience
|
|
29
109
|
|
|
30
110
|
### Child-agent history and envelope
|
|
31
111
|
|
|
32
112
|
#### What the model sees
|
|
33
113
|
|
|
34
|
-
The child receives the parent's balanced completed-turn
|
|
114
|
+
The child receives the parent's balanced completed-turn prefix, then the new task content verbatim. A configured persona shadows prompt text in the child's fresh scope; a tool restriction filters its global wire schemas, executable lookup, and PTC mode SDK bindings but not standalone guidance. The parent's tool view and authority are not inherited; an optional structured-output request adds a child-only contract; the parent's current in-flight turn is excluded.
|
|
35
115
|
|
|
36
116
|
#### Token effect
|
|
37
117
|
|
|
38
|
-
Forking duplicates retained completed history into
|
|
118
|
+
Forking duplicates retained completed history into the child's request, which then accumulates its own tokens independently. A persona changes repeated prompt cost; filtering changes schema or generated SDK cost; a first-turn fork has no inherited history.
|
|
39
119
|
|
|
40
120
|
#### KV Cache effect
|
|
41
121
|
|
|
42
|
-
The child may reuse the inherited byte-identical prefix under the same provider and model. Persona, tool-filter, generated-SDK, or route changes may invalidate reuse before inherited history; later child history is append-only.
|
|
122
|
+
The child may reuse the inherited byte-identical prefix under the same provider and model. Persona, tool-filter, generated-SDK, or route changes may invalidate reuse before inherited history; later child history is append-only. The base bundle and ACP/headless examples use one-shot fork to preserve this prefix. The CLI presets retain continuable fork and accept that the child-scoped `report` tool and its prompt section invalidate it ([cache-preserving fork Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md)).
|
|
43
123
|
|
|
44
124
|
### Parent tool result, indirectly
|
|
45
125
|
|
|
@@ -57,5 +137,21 @@ Append-only; newly visible content follows the reusable request prefix and does
|
|
|
57
137
|
|
|
58
138
|
## Known Limitations and Deferred Work
|
|
59
139
|
|
|
140
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
These limits define when the backend is the wrong choice; they are current package constraints.
|
|
144
|
+
|
|
60
145
|
- **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.
|
|
61
|
-
- **
|
|
146
|
+
- **Fork lifecycle policy differs by composition** — the base bundle and ACP/headless examples use one-shot fork to preserve prefix reuse, while the CLI presets use continuable fork and accept the child-scoped [`report` return channel](../tool-subagent-report/README.md) invalidating that prefix. Making continuable fork cache-preserving requires the child system prompt and tool schemas to match the parent's byte for byte. Rationale and the reintroduction condition: 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.
|
|
148
|
+
|
|
149
|
+
<a id="dev-note"></a>
|
|
150
|
+
### Dev Note
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
154
|
+
|
|
155
|
+
None.
|
|
156
|
+
|
|
157
|
+
</details>
|
package/README.zh.md
CHANGED
|
@@ -1,61 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "面向用户与维护者的进程内 fork subagent 后端说明,用于选择、配置或排查以父级已完成轮次作初始内容的子 agent。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# @deepseek-ai/dsh-subagent-fork-in-process
|
|
2
7
|
|
|
3
8
|
[English](README.md) | 中文
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-subagent-fork-in-process` 是一个进程内 subagent 后端:它以父级已完成的对话轮次作为每个子 agent(智能体)的初始内容——子 agent 能看到所有已完成轮次,但看不到进行中的轮次,因此后续工作可以在对话基础上继续,而无需复制对话。委派工具以 `fork` 提供方名称找到它,其行为与 spawn 后端一致,唯一差异是会话初始内容。当子任务延续当前对话时选择它;当子 agent 必须独立运行时选择 spawn。初始内容是 fork 时的一次性快照:此后父级记录的任何内容都不会到达子 agent。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
当委派的工作必须建立在父级对话之上时,挂载此后端。常用路径与 spawn 相同:加载 subagent 服务与本后端,再把 `dsh-tool-subagent` 之类的委派工具指向 `fork` 提供方。
|
|
29
|
+
|
|
30
|
+
### 何时选择
|
|
31
|
+
|
|
32
|
+
当子 agent 需要对话的已完成轮次时——后续分析、审查、延续——选择 fork。当子 agent 应全新开始时选择 spawn;当子 agent 不能共享本进程时选择进程外后端。初始内容只传递对话历史:子 agent 仍获得全新的工具作用域,且不继承父级的任何权限。
|
|
33
|
+
|
|
34
|
+
### 初始内容边界
|
|
35
|
+
|
|
36
|
+
初始内容止于父级最后一个已完成的轮次。subagent 启动时,父级当前的工具调用轮次仍在进行,因此该进行中的轮次绝不会被包含;在第一个已完成轮次之前,初始内容为空,子 agent 的行为与全新 spawn 相同。
|
|
37
|
+
|
|
38
|
+
### 最小配置
|
|
39
|
+
|
|
40
|
+
先加载 subagent 服务与本后端,再配置一个委派工具。此组合暴露由 fork 支撑的 `subagent` 工具:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
- name: '@deepseek-ai/dsh-subagent'
|
|
44
|
+
- name: '@deepseek-ai/dsh-subagent-fork-in-process'
|
|
45
|
+
- name: '@deepseek-ai/dsh-tool-subagent'
|
|
46
|
+
config:
|
|
47
|
+
provider: fork
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| 字段 | 默认值 | 含义 |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `providerName` | `fork` | 注册到 `ctx.subagents` 的提供方名称 |
|
|
53
|
+
|
|
54
|
+
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-subagent-fork-in-process)是每个受支持字段及其 JSDoc 的穷尽式真源。
|
|
55
|
+
|
|
56
|
+
### 一次 fork 委派会做什么
|
|
6
57
|
|
|
7
|
-
|
|
58
|
+
一次工具调用启动一个以已完成轮次为初始内容的子 agent,并等待其结果:子 agent 能看到截至父级最后一个已完成轮次的对话,在自有会话中工作,父级只接收其最终输出——取消、拒绝、token 上限截断或启动被拒时则收到出错的工具结果。初始内容在启动时只捕获一次;此后的父级轮次绝不会到达子 agent。
|
|
8
59
|
|
|
9
|
-
|
|
60
|
+
-----
|
|
10
61
|
|
|
11
|
-
|
|
62
|
+
<a id="understand-the-implementation"></a>
|
|
63
|
+
## 理解实现
|
|
12
64
|
|
|
13
|
-
|
|
65
|
+
<details>
|
|
66
|
+
<summary>实现细节——点击展开</summary>
|
|
14
67
|
|
|
15
|
-
|
|
68
|
+
本节解释后端背后的设计决策,以及[使用本包](#use-this-package)中行为的来源。
|
|
16
69
|
|
|
17
|
-
|
|
70
|
+
### 设计理念
|
|
18
71
|
|
|
19
|
-
|
|
72
|
+
与 spawn 的差异只有一处,且以数据表达:后端计算父级日志的已配平已完成轮次前缀,并把它作为子 agent 的会话初始内容交给共享进程内驱动器。由于实时序号等于数组下标,前缀始终是自序号零开始的合法初始内容;驱动器记录其长度,使结果读取器不会把作为初始内容的父级消息误认为子 agent 输出。
|
|
20
73
|
|
|
21
|
-
|
|
74
|
+
### 源码地图
|
|
22
75
|
|
|
23
|
-
|
|
|
76
|
+
| 文件 | 职责 |
|
|
24
77
|
|---|---|
|
|
25
|
-
| `
|
|
26
|
-
|
|
78
|
+
| [`src/index.ts`](src/index.ts) | 提供方注册:前缀计算、`Config` schema、能力声明 |
|
|
79
|
+
| [`src/invariant.ts`](src/invariant.ts) | 不变式伴生插件 |
|
|
27
80
|
|
|
81
|
+
### 运行流程
|
|
82
|
+
|
|
83
|
+
`start` 时,从父级事件日志中截取截至最后一个 `turn/end` 的前缀;共享驱动器随后以该初始内容创建子 agent,应用相同的 persona、工具过滤器与结构化输出设置,驱动一项任务,读取子 agent 自身的最终输出,并完全停稳地 dispose。该提供方声明 `agentOptions`,以及与 spawn 相同的输出、深度、过滤与 persona 能力。`prepareContinuable` 在创建时只捕获一次前缀,因为它会成为子 agent 自身持久 transcript(文本记录)的一部分。
|
|
84
|
+
|
|
85
|
+
### 一次性绑定
|
|
86
|
+
|
|
87
|
+
base bundle 与 ACP/headless 示例在委派工具上把本提供方绑定为 `backgroundMode: one-shot`:可继续 fork 子 agent 会在继承历史之前携带子级作用域的 `report` 工具及其提示词 section,从而破坏逐字节前缀复用。CLI preset 保留可继续 fork,并接受该前缀损失(见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md))。
|
|
88
|
+
|
|
89
|
+
</details>
|
|
90
|
+
|
|
91
|
+
-----
|
|
92
|
+
|
|
93
|
+
<a id="further-exploration"></a>
|
|
94
|
+
## 进一步探索
|
|
95
|
+
|
|
96
|
+
当包级约定不够用时阅读以下页面;它们从共享 subagent 模型进入兄弟后端,以及一次性绑定的设计证据。
|
|
97
|
+
|
|
98
|
+
- [Subagent 子系统](../../../docs/subsystems/subagent.zh.md)——启动请求、结果、提供方约定与进程内深度和初始内容。
|
|
99
|
+
- [dsh-subagent-in-process-driver](../subagent-in-process-driver/README.zh.md)——本后端调用的共享运行驱动器。
|
|
100
|
+
- [dsh-subagent-spawn-in-process](../subagent-spawn-in-process/README.zh.md)——全新子级的兄弟后端。
|
|
101
|
+
- [dsh-tool-subagent](../tool-subagent/README.zh.md)——指向该提供方的面向模型委派工具。
|
|
102
|
+
- [生成配置目录](../../../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。
|
|
104
|
+
|
|
105
|
+
-----
|
|
106
|
+
|
|
107
|
+
<a id="model-experience"></a>
|
|
28
108
|
## 模型体验
|
|
29
109
|
|
|
30
110
|
### 子 agent 历史与包络
|
|
31
111
|
|
|
32
|
-
####
|
|
112
|
+
#### 模型看到什么
|
|
33
113
|
|
|
34
|
-
子 agent
|
|
114
|
+
子 agent 先接收由父级已配平的已完成轮次构成的前缀,再逐字接收新的任务内容。配置的 persona 会在子 agent 的全新作用域中遮蔽提示词文本;工具限制会过滤其全局协议 schema、可执行工具查找与 PTC mode SDK 绑定,但不影响独立指导内容。父级的工具视图与权限不会被继承;可选的结构化输出请求会添加仅属于子 agent 的约定;父级当前进行中的轮次会被排除。
|
|
35
115
|
|
|
36
116
|
#### Token 影响
|
|
37
117
|
|
|
38
|
-
fork
|
|
118
|
+
fork 会把保留的已完成历史复制到子 agent 的请求中,子 agent 随后独立累积自己的 token。persona 会改变重复提示词的成本;过滤会改变 schema 或生成 SDK 的成本;首轮 fork 没有继承历史。
|
|
39
119
|
|
|
40
120
|
#### KV Cache 影响
|
|
41
121
|
|
|
42
|
-
|
|
122
|
+
在提供方与模型相同的前提下,子 agent 可以复用继承的逐字节相同前缀。persona、工具过滤、生成 SDK 或路由变化可能在继承历史之前使复用失效;后续子 agent 历史仅追加。base bundle 与 ACP/headless 示例使用一次性 fork 来保留此前缀。CLI preset 保留可继续 fork,并接受子级作用域的 `report` 工具及其提示词 section 使此前缀失效(见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md))。
|
|
43
123
|
|
|
44
|
-
###
|
|
124
|
+
### 父级工具结果(间接)
|
|
45
125
|
|
|
46
|
-
####
|
|
126
|
+
#### 模型看到什么
|
|
47
127
|
|
|
48
|
-
|
|
128
|
+
父级只通过 `dsh-tool-subagent` 接收子 agent 自身的最终输出,不接收继承的前缀或中间工作。
|
|
49
129
|
|
|
50
130
|
#### Token 影响
|
|
51
131
|
|
|
52
|
-
|
|
132
|
+
父级输入增加一个取决于数据的最终结果,并保留到上下文压缩(context compaction)为止。
|
|
53
133
|
|
|
54
134
|
#### KV Cache 影响
|
|
55
135
|
|
|
56
136
|
仅追加;新增可见内容位于可复用请求前缀之后,不会使现有 KV Cache 条目失效。
|
|
57
137
|
|
|
58
|
-
##
|
|
138
|
+
## 已知限制与延期工作
|
|
139
|
+
|
|
140
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
这些限制说明何时选择该后端是错误的;它们是当前包约束。
|
|
144
|
+
|
|
145
|
+
- **初始内容是一次性快照**——子 agent 只能看到 fork 时父级已完成的轮次,看不到父级此后记录的任何内容;不会实时共享上下文。
|
|
146
|
+
- **fork 生命周期策略因组合而异**——base bundle 与 ACP/headless 示例使用一次性 fork 来保留前缀复用;CLI preset 使用可继续 fork,并接受子级作用域的 [`report` 返回通道](../tool-subagent-report/README.zh.md)使此前缀失效。要让可继续 fork 保留缓存,子 agent 的系统提示词与工具 schema 必须和父级逐字节一致。理由与重新开放条件见[保持 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)说明这项限制。
|
|
148
|
+
|
|
149
|
+
<a id="dev-note"></a>
|
|
150
|
+
### 开发备注
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
154
|
+
|
|
155
|
+
无。
|
|
59
156
|
|
|
60
|
-
|
|
61
|
-
- **没有任何随附组合会创建可继续的 fork 子 agent**:`prepareContinuable` 仍然实现完好,seam 也接受它,但每份随附的 `cordis.yml` 都在 fork 委派工具上设置 `backgroundMode: one-shot`,因此该提供方的可继续路径没有生产调用方。重新开放它需要子 agent 的系统提示词与工具 schema 与父 agent 逐字节一致,而这一点目前被 [`report` 返回通道](../tool-subagent-report/README.zh.md)阻止。理由与重新开放条件见 [fork 保持 one-shot 的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md)。
|
|
157
|
+
</details>
|
package/lib/index.js
CHANGED
|
@@ -28,12 +28,14 @@ function completedTurnPrefix(parent) {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* The fork provider. Supports `depthLimit` and `outputSchema` (via the shared
|
|
31
|
-
* in-process structured runtime),
|
|
32
|
-
* restrict() and a scoped shadowing
|
|
31
|
+
* in-process structured runtime), `agentOptions` (merged over the parent
|
|
32
|
+
* route), and `toolFilter`/`persona` (scoped restrict() and a scoped shadowing
|
|
33
|
+
* persona section).
|
|
33
34
|
*/
|
|
34
35
|
var ForkInProcessProvider = class {
|
|
35
36
|
name;
|
|
36
37
|
capabilities = {
|
|
38
|
+
agentOptions: true,
|
|
37
39
|
outputSchema: true,
|
|
38
40
|
depthLimit: true,
|
|
39
41
|
toolFilter: true,
|
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.1.
|
|
4
|
+
"version": "0.1.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,27 +32,28 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
37
|
-
"@deepseek-ai/dsh-
|
|
38
|
-
"@deepseek-ai/dsh-subagent": "^0.1.
|
|
39
|
-
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.
|
|
40
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
35
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.3",
|
|
38
|
+
"@deepseek-ai/dsh-subagent": "^0.1.2-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.2-alpha.3",
|
|
40
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
43
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@deepseek-ai/cordis-plugin-loader": "^1.0.
|
|
47
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
48
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.
|
|
49
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.
|
|
54
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "^0.1.
|
|
55
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
47
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.3",
|
|
48
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.3",
|
|
49
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.2-alpha.3",
|
|
50
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
51
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.3",
|
|
52
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
|
|
53
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.2-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "^0.1.2-alpha.3",
|
|
55
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
56
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.3",
|
|
57
|
+
"@deepseek-ai/dsh-subagent": "^0.1.2-alpha.3"
|
|
57
58
|
}
|
|
58
59
|
}
|