@deepseek-ai/dsh-subagent-fork-in-process 0.1.2-alpha.3 → 0.1.2-alpha.4
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 +5 -5
- package/README.zh.md +5 -5
- package/lib/index.js +1 -1
- package/package.json +16 -22
- package/lib/invariant.js +0 -23
- package/lib/types/invariant.d.ts +0 -16
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: 0c8ff5372717b26a4e5ee556655094a74c9d6dda
|
|
6
|
+
README.zh.md: 113b0ef9657173c7da8bf89d1a2f27d05f81ff3d
|
package/README.md
CHANGED
|
@@ -76,15 +76,15 @@ One difference from spawn, expressed as data: the backend computes the balanced
|
|
|
76
76
|
| File | Role |
|
|
77
77
|
|---|---|
|
|
78
78
|
| [`src/index.ts`](src/index.ts) | Provider registration: prefix computation, `Config` schema, capability declaration |
|
|
79
|
-
|
|
|
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
80
|
|
|
81
81
|
### Run flow
|
|
82
82
|
|
|
83
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
84
|
|
|
85
|
-
###
|
|
85
|
+
### Lifecycle binding
|
|
86
86
|
|
|
87
|
-
The base bundle and ACP/headless examples bind this provider to `backgroundMode: one-shot
|
|
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)).
|
|
88
88
|
|
|
89
89
|
</details>
|
|
90
90
|
|
|
@@ -119,7 +119,7 @@ Forking duplicates retained completed history into the child's request, which th
|
|
|
119
119
|
|
|
120
120
|
#### KV Cache effect
|
|
121
121
|
|
|
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.
|
|
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. Continuable messaging adds no child-only system-prompt section or tool schema; the parent id and return guidance follow inherited history in the initial user task ([cache-preserving fork Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.md)).
|
|
123
123
|
|
|
124
124
|
### Parent tool result, indirectly
|
|
125
125
|
|
|
@@ -143,7 +143,7 @@ Append-only; newly visible content follows the reusable request prefix and does
|
|
|
143
143
|
These limits define when the backend is the wrong choice; they are current package constraints.
|
|
144
144
|
|
|
145
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.
|
|
146
|
-
- **Fork lifecycle policy differs by composition** — the base bundle and ACP/headless examples use one-shot fork
|
|
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
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
148
|
|
|
149
149
|
<a id="dev-note"></a>
|
package/README.zh.md
CHANGED
|
@@ -76,15 +76,15 @@ kind: "package-reference"
|
|
|
76
76
|
| 文件 | 职责 |
|
|
77
77
|
|---|---|
|
|
78
78
|
| [`src/index.ts`](src/index.ts) | 提供方注册:前缀计算、`Config` schema、能力声明 |
|
|
79
|
-
|
|
|
79
|
+
| — | 不发布运行时不变式伴生入口;本包没有独立事件序列或可变数据关系,相关约定在所属 seam 强制执行。 |
|
|
80
80
|
|
|
81
81
|
### 运行流程
|
|
82
82
|
|
|
83
83
|
`start` 时,从父级事件日志中截取截至最后一个 `turn/end` 的前缀;共享驱动器随后以该初始内容创建子 agent,应用相同的 persona、工具过滤器与结构化输出设置,驱动一项任务,读取子 agent 自身的最终输出,并完全停稳地 dispose。该提供方声明 `agentOptions`,以及与 spawn 相同的输出、深度、过滤与 persona 能力。`prepareContinuable` 在创建时只捕获一次前缀,因为它会成为子 agent 自身持久 transcript(文本记录)的一部分。
|
|
84
84
|
|
|
85
|
-
###
|
|
85
|
+
### 生命周期绑定
|
|
86
86
|
|
|
87
|
-
base bundle 与 ACP/headless 示例在委派工具上把本提供方绑定为 `backgroundMode: one-shot
|
|
87
|
+
base bundle 与 ACP/headless 示例在委派工具上把本提供方绑定为 `backgroundMode: one-shot`,CLI preset 则选择 `continuable`。两者都保留继承的请求前缀:parent 与 child 获得定义和顺序相同的消息工具,可继续 child 的 parent id 与返回指导位于继承历史之后的初始用户任务中(见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md))。
|
|
88
88
|
|
|
89
89
|
</details>
|
|
90
90
|
|
|
@@ -119,7 +119,7 @@ fork 会把保留的已完成历史复制到子 agent 的请求中,子 agent
|
|
|
119
119
|
|
|
120
120
|
#### KV Cache 影响
|
|
121
121
|
|
|
122
|
-
在提供方与模型相同的前提下,子 agent 可以复用继承的逐字节相同前缀。persona、工具过滤、生成 SDK 或路由变化可能在继承历史之前使复用失效;后续子 agent
|
|
122
|
+
在提供方与模型相同的前提下,子 agent 可以复用继承的逐字节相同前缀。persona、工具过滤、生成 SDK 或路由变化可能在继承历史之前使复用失效;后续子 agent 历史仅追加。可继续消息不增加 child 专属系统提示词 section 或工具 schema;parent id 与返回指导在初始用户任务中位于继承历史之后(见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md))。
|
|
123
123
|
|
|
124
124
|
### 父级工具结果(间接)
|
|
125
125
|
|
|
@@ -143,7 +143,7 @@ fork 会把保留的已完成历史复制到子 agent 的请求中,子 agent
|
|
|
143
143
|
这些限制说明何时选择该后端是错误的;它们是当前包约束。
|
|
144
144
|
|
|
145
145
|
- **初始内容是一次性快照**——子 agent 只能看到 fork 时父级已完成的轮次,看不到父级此后记录的任何内容;不会实时共享上下文。
|
|
146
|
-
- **fork 生命周期策略因组合而异**——base bundle 与 ACP/headless 示例使用一次性 fork
|
|
146
|
+
- **fork 生命周期策略因组合而异**——base bundle 与 ACP/headless 示例使用一次性 fork,CLI preset 使用可继续 fork。两者都因 parent 与 child 消息定义逐字节相同而让继承前缀保持可复用;显式 persona、工具过滤、生成 SDK 或路由变化仍可破坏相等性。理由见[保持 fork 缓存的 Agent Note](../../../.agents/notes/implemented/architecture/2026-08-10-fork-children-stay-one-shot.zh.md)。
|
|
147
147
|
- **随附 fork 工具不公开子级 LLM 路由选择**——它们继承父级提供方与模型,使复制的历史仍有资格复用 KV Cache。在某项改动能保留复用或公开有界重算成本前,路由选择保持禁用;[模型选择路由 Agent Note](../../../.agents/notes/implemented/feature/2026-08-18-model-selected-subagent-routes.zh.md)说明这项限制。
|
|
148
148
|
|
|
149
149
|
<a id="dev-note"></a>
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const Config = z.object({ providerName: z.string().default("fork") });
|
|
|
21
21
|
* @returns the seed events, contiguous from seq 0; empty when no turn has completed.
|
|
22
22
|
*/
|
|
23
23
|
function completedTurnPrefix(parent) {
|
|
24
|
-
const events = parent.session.
|
|
24
|
+
const events = parent.session.snapshotEvents();
|
|
25
25
|
const lastEnd = events.findLast((e) => e.type === "turn/end");
|
|
26
26
|
if (lastEnd === void 0) return [];
|
|
27
27
|
return events.slice(0, lastEnd.seq + 1);
|
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.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,42 +18,36 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./src/*": "./src/*",
|
|
26
22
|
"./package.json": "./package.json"
|
|
27
23
|
},
|
|
28
24
|
"files": [
|
|
29
25
|
"lib/index.js",
|
|
30
|
-
"lib/invariant.js",
|
|
31
26
|
"lib/types/**/*.d.ts"
|
|
32
27
|
],
|
|
33
28
|
"license": "MIT",
|
|
34
29
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.
|
|
38
|
-
"@deepseek-ai/
|
|
39
|
-
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.2-alpha.
|
|
40
|
-
"@deepseek-ai/cordis": "^4.0.2"
|
|
30
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
|
|
31
|
+
"@deepseek-ai/dsh-subagent": "^0.1.2-alpha.4",
|
|
32
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.4",
|
|
33
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
34
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.2-alpha.4"
|
|
41
35
|
},
|
|
42
36
|
"dependencies": {
|
|
43
37
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
44
38
|
},
|
|
45
39
|
"devDependencies": {
|
|
40
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.4",
|
|
41
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.4",
|
|
42
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.2-alpha.4",
|
|
43
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.4",
|
|
44
|
+
"@deepseek-ai/dsh-subagent": "^0.1.2-alpha.4",
|
|
45
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.1.2-alpha.4",
|
|
46
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
|
|
47
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.4",
|
|
48
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "^0.1.2-alpha.4",
|
|
46
49
|
"@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
50
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
56
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.
|
|
57
|
-
"@deepseek-ai/dsh-subagent": "^0.1.2-alpha.3"
|
|
51
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.4"
|
|
58
52
|
}
|
|
59
53
|
}
|
package/lib/invariant.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//#region lib/types/invariant.js
|
|
2
|
-
/**
|
|
3
|
-
* Package-owned invariant companion for `@deepseek-ai/dsh-subagent-fork-in-process`.
|
|
4
|
-
* @module @deepseek-ai/dsh-subagent-fork-in-process/invariant
|
|
5
|
-
*/
|
|
6
|
-
const PACKAGE_NAME = "@deepseek-ai/dsh-subagent-fork-in-process";
|
|
7
|
-
/** Cordis companion plugin name. */
|
|
8
|
-
const name = "subagent-fork-in-process-invariant";
|
|
9
|
-
/** Service required before the companion can reserve package ownership. */
|
|
10
|
-
const inject = ["invariants"];
|
|
11
|
-
/**
|
|
12
|
-
* No runtime invariant: this package exposes no independent event sequence or mutable data relation
|
|
13
|
-
* beyond contracts enforced at its owning seam.
|
|
14
|
-
*/
|
|
15
|
-
const install = () => {};
|
|
16
|
-
/**
|
|
17
|
-
* Register this package's invariant companion.
|
|
18
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
19
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
20
|
-
*/
|
|
21
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
22
|
-
//#endregion
|
|
23
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package-owned invariant companion for `@deepseek-ai/dsh-subagent-fork-in-process`.
|
|
3
|
-
* @module @deepseek-ai/dsh-subagent-fork-in-process/invariant
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
-
/** Cordis companion plugin name. */
|
|
7
|
-
export declare const name = "subagent-fork-in-process-invariant";
|
|
8
|
-
/** Service required before the companion can reserve package ownership. */
|
|
9
|
-
export declare const inject: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Register this package's invariant companion.
|
|
12
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
-
*/
|
|
15
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
-
//# sourceMappingURL=invariant.d.ts.map
|