@deepseek-ai/dsh-subagent-spawn-in-process 0.2.2-rc.1 → 0.2.2-rc.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 +6 -6
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/package.json +20 -17
- package/src/index.ts +59 -0
package/README.i18n.yaml
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
en: c949befcfe1e376c
|
|
10
10
|
zh: 13c78d0fbbd323ae
|
|
11
11
|
/deepseek-ai-dsh-subagent-spawn-in-process/summary:
|
|
12
|
-
en:
|
|
13
|
-
zh:
|
|
12
|
+
en: 36ecbffd1d9ac412
|
|
13
|
+
zh: 609a2d30499785fc
|
|
14
14
|
/deepseek-ai-dsh-subagent-spawn-in-process/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
en: 3f53b0d5f4037171
|
|
25
25
|
zh: e0f2ac931cfbef95
|
|
26
26
|
/deepseek-ai-dsh-subagent-spawn-in-process/use-this-package/what-a-delegation-does:
|
|
27
|
-
en:
|
|
28
|
-
zh:
|
|
27
|
+
en: 3990b19cb5c58c39
|
|
28
|
+
zh: 3c974311a437a84f
|
|
29
29
|
/deepseek-ai-dsh-subagent-spawn-in-process/understand-the-implementation:
|
|
30
30
|
en: 7f34637751939818
|
|
31
31
|
zh: 2937553168e1aee5
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
en: 75d061c2151624a7
|
|
64
64
|
zh: 71e58e020b60ff90
|
|
65
65
|
/deepseek-ai-dsh-subagent-spawn-in-process/model-experience/parent-tool-result-indirectly/what-the-model-sees:
|
|
66
|
-
en:
|
|
67
|
-
zh:
|
|
66
|
+
en: b540f44830cec85f
|
|
67
|
+
zh: 7a02564ac5fbc9cf
|
|
68
68
|
/deepseek-ai-dsh-subagent-spawn-in-process/model-experience/parent-tool-result-indirectly/token-effect:
|
|
69
69
|
en: ff8045aa0f466c2a
|
|
70
70
|
zh: e38fc5c6af2ce076
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
`dsh-subagent-spawn-in-process` is an in-process subagent backend: it runs each delegated task in a fresh child agent that shares this process and its agent factory, LLM, and tool services. The child starts with an empty conversation, so a task prompt must stand alone; it inherits the parent's working directory, session lineage, provider, model, reasoning effort, and output-token limit unless `
|
|
12
|
+
`dsh-subagent-spawn-in-process` is an in-process subagent backend: it runs each delegated task in a fresh child agent that shares this process and its agent factory, LLM, and tool services. The child starts with an empty conversation, so a task prompt must stand alone; it inherits the parent's working directory, session lineage, provider, model, reasoning effort, and output-token limit unless `agentOptions` overrides them. A delegation tool or API call reaches it under the `spawn` provider name. Choose it for the cheapest delegation transport; choose the fork backend when the child must build on the parent's completed conversation turns.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -51,7 +51,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
|
|
|
51
51
|
|
|
52
52
|
### What a delegation does
|
|
53
53
|
|
|
54
|
-
One tool call creates a background child and returns its
|
|
54
|
+
One tool call creates a background child and returns its name 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.
|
|
55
55
|
|
|
56
56
|
An explicit `agentPreset` selects the currently registered preset independently; omission joins the parent's active revision. Only spawn supports this choice. Persona and tools belong in the [preset definition](../../preset/agent-preset-registry/README.md). Cold resume follows the shared [child composition rules](../subagent/README.md#restoring-child-composition).
|
|
57
57
|
|
|
@@ -120,7 +120,7 @@ The child's request cache is independent of the parent's. Child history grows ap
|
|
|
120
120
|
|
|
121
121
|
#### What the model sees
|
|
122
122
|
|
|
123
|
-
Through `dsh-tool-subagent`, the parent first receives the child
|
|
123
|
+
Through `dsh-tool-subagent`, the parent first receives the child's name, then a completion notice with its final answer. Child-authored messages arrive through `send_message`. Internal child tool calls remain in the child session.
|
|
124
124
|
|
|
125
125
|
#### Token effect
|
|
126
126
|
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
`dsh-subagent-spawn-in-process` 是一个进程内 subagent 后端:它在当前进程中运行每个委派任务,子 agent(智能体)是一个全新子 `Agent`,复用宿主的 agent 工厂及 LLM(大语言模型)/工具服务。子 agent 以空对话开始,因此任务提示词必须自足;除非 `
|
|
12
|
+
`dsh-subagent-spawn-in-process` 是一个进程内 subagent 后端:它在当前进程中运行每个委派任务,子 agent(智能体)是一个全新子 `Agent`,复用宿主的 agent 工厂及 LLM(大语言模型)/工具服务。子 agent 以空对话开始,因此任务提示词必须自足;除非 `agentOptions` 覆盖,否则它继承父 agent 的工作目录、会话谱系、提供方、模型、推理强度与输出 token 上限。委派工具或 API 调用以 `spawn` 提供方名称找到它。需要成本最低的委派传输时选择它;需要子 agent 建立在父级已完成对话轮次之上时,请选择 fork 后端。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -51,7 +51,7 @@ kind: "package-reference"
|
|
|
51
51
|
|
|
52
52
|
### 一次委派会做什么
|
|
53
53
|
|
|
54
|
-
一次工具调用创建后台子 agent
|
|
54
|
+
一次工具调用创建后台子 agent 并立即返回其名称。子级在自己的会话中工作,父级通过完成通知收到其最终答案。子级也可以通过 `send_message` 发送消息。被拒绝的启动不会留下已发布的子 agent;工作流等程序调用方可以直接等待 activation 的结果。
|
|
55
55
|
|
|
56
56
|
显式 `agentPreset` 独立选择当前注册的 preset;省略时加入父方的活跃代际。只有 spawn 支持此选择。persona 与工具放在 [preset 定义](../../preset/agent-preset-registry/README.zh.md)中。冷恢复遵守共享的[子级组装规则](../subagent/README.zh.md#restoring-child-composition)。
|
|
57
57
|
|
|
@@ -120,7 +120,7 @@ kind: "package-reference"
|
|
|
120
120
|
|
|
121
121
|
#### 模型看到什么
|
|
122
122
|
|
|
123
|
-
通过 `dsh-tool-subagent
|
|
123
|
+
通过 `dsh-tool-subagent`,父级先收到子级名称,随后收到包含最终答案的完成通知。子级自行编写的消息通过 `send_message` 到达。子级内部工具调用保留在子会话中。
|
|
124
124
|
|
|
125
125
|
#### Token 影响
|
|
126
126
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAOxC,eAAO,MAAM,IAAI,8BAA8B,CAAA;AAG/C,eAAO,MAAM,MAAM,UAAgB,CAAA;AAEnC,gEAAgE;AAChE,MAAM,WAAW,MAAM;IACrB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAE3B,CAAA;AA2BF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAExD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAOxC,MAAM,CAAC,MAAM,IAAI,GAAG,2BAA2B,CAAA;AAC/C,4FAA4F;AAC5F,8EAA8E;AAC9E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,WAAW,CAAC,CAAA;AAQnC,MAAM,CAAC,MAAM,MAAM,GAAc,CAAC,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;CAC1C,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,sBAAsB;IAUL;IATZ,YAAY,GAAyB;QAC5C,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;KACjB,CAAA;IACD,0FAA0F;IACjF,qBAAqB,GAAG,KAAK,CAAA;IAEtC,YAAqB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAErC,kBAAkB;QAChB,4EAA4E;QAC5E,4CAA4C;QAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC5B,CAAC;CACF;AAED,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,MAAc;IAChD,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,sBAAsB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAA;AACjF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-subagent-spawn-in-process",
|
|
3
3
|
"description": "In-process spawn subagent backend: runs a fresh child agent on ctx.agents",
|
|
4
|
-
"version": "0.2.2-rc.
|
|
4
|
+
"version": "0.2.2-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"locale/*.json",
|
|
27
27
|
"lib/index.js",
|
|
28
|
-
"lib/types/**/*.d.ts"
|
|
28
|
+
"lib/types/**/*.d.ts",
|
|
29
|
+
"lib/types/**/*.d.ts.map",
|
|
30
|
+
"lib/**/*.js.map",
|
|
31
|
+
"src"
|
|
29
32
|
],
|
|
30
33
|
"license": "MIT",
|
|
31
34
|
"peerDependencies": {
|
|
32
|
-
"@deepseek-ai/dsh-subagent": "0.2.2-rc.
|
|
35
|
+
"@deepseek-ai/dsh-subagent": "0.2.2-rc.2",
|
|
33
36
|
"@deepseek-ai/cordis": "~4.1.0"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
@@ -37,20 +40,20 @@
|
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
42
|
"@deepseek-ai/cordis-plugin-loader": "~1.1.0",
|
|
40
|
-
"@deepseek-ai/dsh-agent": "0.2.2-rc.
|
|
41
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.2-rc.
|
|
42
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-rc.
|
|
43
|
-
"@deepseek-ai/dsh-bash-local": "0.2.2-rc.
|
|
44
|
-
"@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.
|
|
45
|
-
"@deepseek-ai/dsh-llm": "0.2.2-rc.
|
|
46
|
-
"@deepseek-ai/dsh-llm-deepseek": "0.2.2-rc.
|
|
47
|
-
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.2-rc.
|
|
48
|
-
"@deepseek-ai/dsh-session": "0.2.2-rc.
|
|
49
|
-
"@deepseek-ai/dsh-subagent": "0.2.2-rc.
|
|
50
|
-
"@deepseek-ai/dsh-tool-bash": "0.2.2-rc.
|
|
51
|
-
"@deepseek-ai/dsh-tool-subagent": "0.2.2-rc.
|
|
43
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-bash-local": "0.2.2-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.2.2-rc.2",
|
|
50
|
+
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.2-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.2",
|
|
52
|
+
"@deepseek-ai/dsh-subagent": "0.2.2-rc.2",
|
|
53
|
+
"@deepseek-ai/dsh-tool-bash": "0.2.2-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-tool-subagent": "0.2.2-rc.2",
|
|
52
55
|
"@deepseek-ai/cordis": "~4.1.0",
|
|
53
|
-
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.
|
|
54
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-rc.
|
|
56
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-rc.2"
|
|
55
58
|
}
|
|
56
59
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
|
|
9
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
10
|
+
import z from '@deepseek-ai/schemastery'
|
|
11
|
+
import type {
|
|
12
|
+
ContinuableCreateSpec,
|
|
13
|
+
SubagentCapabilities,
|
|
14
|
+
SubagentProvider,
|
|
15
|
+
} from '@deepseek-ai/dsh-subagent'
|
|
16
|
+
|
|
17
|
+
export const name = 'subagent-spawn-in-process'
|
|
18
|
+
// `tools` is deliberately not injected: the child factory already provides it during setup,
|
|
19
|
+
// and adding it here would unnecessarily change this provider's apply timing.
|
|
20
|
+
export const inject = ['subagents']
|
|
21
|
+
|
|
22
|
+
/** Config: the registry name to register the provider under. */
|
|
23
|
+
export interface Config {
|
|
24
|
+
/** Provider name on `ctx.subagents` (default `spawn`). */
|
|
25
|
+
providerName: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Config: z<Config> = z.object({
|
|
29
|
+
providerName: z.string().default('spawn'),
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The spawn provider. Supports every start-time capability: `depthLimit` (it
|
|
34
|
+
* constructs the child, so it can enforce a recursion cap), `outputSchema`
|
|
35
|
+
* (the scoped structured runtime), `agentOptions` (merged over the parent
|
|
36
|
+
* route). The selected preset owns persona and tool composition.
|
|
37
|
+
*/
|
|
38
|
+
class SpawnInProcessProvider implements SubagentProvider {
|
|
39
|
+
readonly capabilities: SubagentCapabilities = {
|
|
40
|
+
agentOptions: true,
|
|
41
|
+
agentPreset: true,
|
|
42
|
+
outputSchema: true,
|
|
43
|
+
depthLimit: true,
|
|
44
|
+
}
|
|
45
|
+
// Context contract: a spawned child starts fresh — it never sees the parent conversation.
|
|
46
|
+
readonly inheritsParentContext = false
|
|
47
|
+
|
|
48
|
+
constructor(readonly name: string) {}
|
|
49
|
+
|
|
50
|
+
prepareContinuable(): Promise<ContinuableCreateSpec> {
|
|
51
|
+
// A spawned child starts fresh, so it contributes no seed; the continuation
|
|
52
|
+
// manager owns every later operation on it.
|
|
53
|
+
return Promise.resolve({})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function apply(ctx: Context, config: Config): void {
|
|
58
|
+
ctx.subagents.registerProvider(new SpawnInProcessProvider(config.providerName))
|
|
59
|
+
}
|