@deepseek-ai/dsh-subagent-spawn-in-process 0.0.1-rc.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/LICENSE +28 -0
- package/README.i18n.yaml +6 -0
- package/README.md +55 -0
- package/README.zh.md +55 -0
- package/lib/index.js +44 -0
- package/lib/invariant.js +23 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, DeepSeek
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/subagent/subagent-spawn-in-process/README.md
|
|
5
|
+
README.md: f1fb96f2230359cb3ff55c630f29fd34345dbed7
|
|
6
|
+
README.zh.md: 940701d6fac78ce75fda24519fa22b268085ea1a
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-subagent-spawn-in-process
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
The spawn provider creates a fresh child `Agent` in the current process. The child has its own session, sees no parent conversation history, and reuses the host's agent factory and LLM/tool services.
|
|
6
|
+
|
|
7
|
+
## Behavior
|
|
8
|
+
|
|
9
|
+
`start(request)` delegates to [`startInProcessRun`](../subagent-in-process-driver/README.md) with no seed and awaits publication before returning. The child receives parent working-directory/session lineage and inherits the parent model unless overridden, but starts with an empty conversation.
|
|
10
|
+
|
|
11
|
+
The shared driver owns depth checking, persona and tool-filter setup, structured output, required-signal cancellation, one-shot execution, result reading, and quiescent disposal. A startup rejection leaves no published child; provider unload after fulfillment does not revoke the holder-owned run.
|
|
12
|
+
|
|
13
|
+
## Capabilities
|
|
14
|
+
|
|
15
|
+
Spawn advertises `{ outputSchema: true, depthLimit: true, toolFilter: true, persona: true }` because it controls the child's creation window and can enforce all four features.
|
|
16
|
+
|
|
17
|
+
## Config
|
|
18
|
+
|
|
19
|
+
| Key | Meaning |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `providerName` | Registry name on `ctx.subagents` (default `spawn`). |
|
|
22
|
+
|
|
23
|
+
## Model Experience
|
|
24
|
+
|
|
25
|
+
### Child-agent request
|
|
26
|
+
|
|
27
|
+
#### What the model sees
|
|
28
|
+
|
|
29
|
+
The fresh child receives the standalone task content verbatim, inherits the parent model and workspace by default, and sees the global prompt with any configured child-scoped persona shadow. A tool filter removes global wire schemas, executable lookup, and Code Mode SDK bindings for that child but leaves independently registered guidance. It receives zero parent conversation messages; the filter is visibility/composition, not an authority grant inherited from the parent.
|
|
30
|
+
|
|
31
|
+
#### Token effect
|
|
32
|
+
|
|
33
|
+
The child pays for a new independent context and history; no parent-history tokens are duplicated. Persona changes this child's repeated prompt cost, while filtering changes its schema or generated SDK cost.
|
|
34
|
+
|
|
35
|
+
#### KV Cache effect
|
|
36
|
+
|
|
37
|
+
Independent of the parent request cache. Child history grows append-only, while persona, tool-filter, generated-SDK, provider, or model changes establish a different child prefix.
|
|
38
|
+
|
|
39
|
+
### Parent tool result, indirectly
|
|
40
|
+
|
|
41
|
+
#### What the model sees
|
|
42
|
+
|
|
43
|
+
Through `dsh-tool-subagent`, the parent receives only the child's final output or stop-reason error.
|
|
44
|
+
|
|
45
|
+
#### Token effect
|
|
46
|
+
|
|
47
|
+
Parent input grows by one data-dependent result retained until compaction.
|
|
48
|
+
|
|
49
|
+
#### KV Cache effect
|
|
50
|
+
|
|
51
|
+
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
|
|
52
|
+
|
|
53
|
+
## Known Limitations and Deferred Work
|
|
54
|
+
|
|
55
|
+
- **Fresh means no parent transcript** — the child inherits cwd, lineage, model, and explicitly configured persona/tool restrictions, but none of the parent's conversation; use the fork provider when completed-turn context is required.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @deepseek-ai/dsh-subagent-spawn-in-process
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
spawn 提供方会在当前进程中创建一个全新的子 `Agent`。子 agent(智能体)有自己的会话,看不到父 agent 的对话历史,并复用宿主的 agent 工厂及 LLM(大语言模型)/工具服务。
|
|
6
|
+
|
|
7
|
+
## 行为
|
|
8
|
+
|
|
9
|
+
`start(request)` 不传入 seed,直接委托给 [`startInProcessRun`](../subagent-in-process-driver/README.md),并在子 agent 发布后才返回。子 agent 获得父 agent 的工作目录/会话谱系,并默认继承父 agent 模型(除非覆盖),但以空对话开始运行。
|
|
10
|
+
|
|
11
|
+
共享驱动器负责深度检查、persona 与工具过滤器设置、结构化输出、通过必需的信号执行取消、单次执行、结果读取和完全停稳后的 dispose(资源释放)。启动遭拒不会留下已发布的子 agent;启动调用兑现后卸载提供方,也不会撤销由持有方拥有的运行。
|
|
12
|
+
|
|
13
|
+
## 能力
|
|
14
|
+
|
|
15
|
+
spawn 声明 `{ outputSchema: true, depthLimit: true, toolFilter: true, persona: true }`,因为它控制子 agent 的创建窗口,能够强制执行全部四项功能。
|
|
16
|
+
|
|
17
|
+
## 配置
|
|
18
|
+
|
|
19
|
+
| 键 | 含义 |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `providerName` | `ctx.subagents` 上的注册表名称(默认 `spawn`)。 |
|
|
22
|
+
|
|
23
|
+
## 模型体验
|
|
24
|
+
|
|
25
|
+
### 子 agent 请求
|
|
26
|
+
|
|
27
|
+
#### 模型看到的内容
|
|
28
|
+
|
|
29
|
+
全新的子 agent 逐字接收独立任务内容,默认继承父 agent 的模型和工作区,并看到带有已配置子 agent 作用域 persona 遮蔽的全局提示词。工具过滤器会为该子 agent 移除全局协议 schema、可执行工具查找和 Code Mode SDK 绑定,但保留独立注册的指导内容。它不接收任何父 agent 对话消息;过滤控制的是可见性与组合,并非从父 agent 继承的权限授予。
|
|
30
|
+
|
|
31
|
+
#### Token 影响
|
|
32
|
+
|
|
33
|
+
子 agent 会为全新的独立上下文和历史消耗 token;不会复制父 agent 历史的 token。persona 会改变该子 agent 反复使用的提示词成本,过滤则会改变其 schema 或生成 SDK 的成本。
|
|
34
|
+
|
|
35
|
+
#### KV Cache 影响
|
|
36
|
+
|
|
37
|
+
与父 agent 请求缓存相互独立。子 agent 历史仅追加;persona、工具过滤、生成 SDK、提供方或模型变化会建立不同的子 agent 前缀。
|
|
38
|
+
|
|
39
|
+
### 父 agent 工具结果(间接)
|
|
40
|
+
|
|
41
|
+
#### 模型看到的内容
|
|
42
|
+
|
|
43
|
+
通过 `dsh-tool-subagent`,父 agent 只接收子 agent 的最终输出或结束原因错误。
|
|
44
|
+
|
|
45
|
+
#### Token 影响
|
|
46
|
+
|
|
47
|
+
父 agent 输入会增加一个取决于数据的结果,并保留到压缩(compaction)为止。
|
|
48
|
+
|
|
49
|
+
#### KV Cache 影响
|
|
50
|
+
|
|
51
|
+
仅追加;新增可见内容位于可复用请求前缀之后,不会使现有 KV Cache 条目失效。
|
|
52
|
+
|
|
53
|
+
## 已知限制与暂缓事项
|
|
54
|
+
|
|
55
|
+
- **全新表示不含父 agent transcript(文本记录)**:子 agent 会继承 cwd、谱系、模型及显式配置的 persona/工具限制,但不继承父 agent 的任何对话;需要已完成轮次上下文时,请使用 fork 提供方。
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { startInProcessRun } from "@deepseek-ai/dsh-subagent-in-process-driver";
|
|
3
|
+
//#region lib/types/index.js
|
|
4
|
+
/**
|
|
5
|
+
* The in-process SPAWN subagent backend: registers a {@link SubagentProvider} on
|
|
6
|
+
* `ctx.subagents` that runs each child as a fresh child {@link Agent} on the same cordis
|
|
7
|
+
* context (its own session, own system prompt, zero parent context). The cheapest transport,
|
|
8
|
+
* reusing the agent factory's quiescent teardown.
|
|
9
|
+
* @module @deepseek-ai/dsh-subagent-spawn-in-process
|
|
10
|
+
*/
|
|
11
|
+
const name = "subagent-spawn-in-process";
|
|
12
|
+
const inject = ["subagents"];
|
|
13
|
+
const Config = z.object({ providerName: z.string().default("spawn") });
|
|
14
|
+
/**
|
|
15
|
+
* The spawn provider. Supports every start-time capability: `depthLimit` (it
|
|
16
|
+
* constructs the child, so it can enforce a recursion cap), `outputSchema`
|
|
17
|
+
* (the scoped structured runtime), and `toolFilter`/`persona` (scoped
|
|
18
|
+
* `restrict()` and a scoped shadowing persona section, applied in the child's
|
|
19
|
+
* creation window).
|
|
20
|
+
*/
|
|
21
|
+
var SpawnInProcessProvider = class {
|
|
22
|
+
name;
|
|
23
|
+
capabilities = {
|
|
24
|
+
outputSchema: true,
|
|
25
|
+
depthLimit: true,
|
|
26
|
+
toolFilter: true,
|
|
27
|
+
persona: true
|
|
28
|
+
};
|
|
29
|
+
inheritsParentContext = false;
|
|
30
|
+
constructor(name) {
|
|
31
|
+
this.name = name;
|
|
32
|
+
}
|
|
33
|
+
start(request) {
|
|
34
|
+
return startInProcessRun(request, {});
|
|
35
|
+
}
|
|
36
|
+
prepareContinuable() {
|
|
37
|
+
return Promise.resolve({});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function apply(ctx, config) {
|
|
41
|
+
ctx.subagents.registerProvider(new SpawnInProcessProvider(config.providerName));
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Config, apply, inject, name };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-subagent-spawn-in-process`.
|
|
4
|
+
* @module @deepseek-ai/dsh-subagent-spawn-in-process/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-subagent-spawn-in-process";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "subagent-spawn-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 };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-process SPAWN subagent backend: registers a {@link SubagentProvider} on
|
|
3
|
+
* `ctx.subagents` that runs each child as a fresh child {@link Agent} on the same cordis
|
|
4
|
+
* context (its own session, own system prompt, zero parent context). The cheapest transport,
|
|
5
|
+
* reusing the agent factory's quiescent teardown.
|
|
6
|
+
* @module @deepseek-ai/dsh-subagent-spawn-in-process
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
+
import z from '@deepseek-ai/schemastery';
|
|
10
|
+
export declare const name = "subagent-spawn-in-process";
|
|
11
|
+
export declare const inject: string[];
|
|
12
|
+
/** Config: the registry name to register the provider under. */
|
|
13
|
+
export interface Config {
|
|
14
|
+
/** Provider name on `ctx.subagents` (default `spawn`). */
|
|
15
|
+
providerName: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const Config: z<Config>;
|
|
18
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-subagent-spawn-in-process`.
|
|
3
|
+
* @module @deepseek-ai/dsh-subagent-spawn-in-process/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "subagent-spawn-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
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-subagent-spawn-in-process",
|
|
3
|
+
"description": "In-process spawn subagent backend: runs a fresh child agent on ctx.agents",
|
|
4
|
+
"version": "0.0.1-rc.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "restricted"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/subagent/subagent-spawn-in-process"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./src/*": "./src/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/index.js",
|
|
30
|
+
"lib/invariant.js",
|
|
31
|
+
"lib/types/**/*.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"license": "BSD-3-Clause",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@deepseek-ai/dsh-subagent": "^0.0.1-rc.3",
|
|
36
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
|
|
37
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.0.1-rc.3",
|
|
38
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@deepseek-ai/schemastery": "^3.18.1-rc.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.1-rc.1",
|
|
45
|
+
"@deepseek-ai/dsh-agent": "^0.0.1-rc.3",
|
|
46
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.0.1-rc.3",
|
|
47
|
+
"@deepseek-ai/dsh-bash-local": "^0.0.1-rc.3",
|
|
48
|
+
"@deepseek-ai/dsh-agent-loop": "^0.0.1-rc.3",
|
|
49
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
|
|
50
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.0.1-rc.3",
|
|
51
|
+
"@deepseek-ai/dsh-llm-deepseek": "^0.0.1-rc.3",
|
|
52
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-subagent": "^0.0.1-rc.3",
|
|
54
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "^0.0.1-rc.3",
|
|
55
|
+
"@deepseek-ai/dsh-tool-bash": "^0.0.1-rc.3",
|
|
56
|
+
"@deepseek-ai/dsh-llm": "^0.0.1-rc.3",
|
|
57
|
+
"@deepseek-ai/dsh-tool-subagent": "^0.0.1-rc.3",
|
|
58
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
59
|
+
}
|
|
60
|
+
}
|