@qilin-agent/subagent-spawn-in-process 0.0.0-stage → 3.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kkutysllb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,79 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
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
+ /:
6
+ en: d510765ec1bebc28
7
+ zh: 35efb9f71f05f326
8
+ /qilin-subagent-spawn-in-process:
9
+ en: 2be56cde0ecc8599
10
+ zh: 143c8e42cb2e8e42
11
+ /qilin-subagent-spawn-in-process/summary:
12
+ en: 77354bfb7bbb447c
13
+ zh: 250fde8a163145ac
14
+ /qilin-subagent-spawn-in-process/table-of-contents:
15
+ en: d152484eb41ac6b4
16
+ zh: 09388d293f9be9cb
17
+ /qilin-subagent-spawn-in-process/use-this-package:
18
+ en: 8a75ad01cfe60938
19
+ zh: b63a8302502d289a
20
+ /qilin-subagent-spawn-in-process/use-this-package/when-to-choose-it:
21
+ en: 5f14443940e59bb5
22
+ zh: 3e8610aec21c55e8
23
+ /qilin-subagent-spawn-in-process/use-this-package/minimal-configuration:
24
+ en: 47275ac3ef383518
25
+ zh: fae5495b7c86194a
26
+ /qilin-subagent-spawn-in-process/use-this-package/what-a-delegation-does:
27
+ en: 9f4e6f31ad4d86d1
28
+ zh: 4ad77e0b80c6efcc
29
+ /qilin-subagent-spawn-in-process/understand-the-implementation:
30
+ en: 9e00b9dc2f9cf38c
31
+ zh: 60ce00ce6c3b5564
32
+ /qilin-subagent-spawn-in-process/understand-the-implementation/design-concept:
33
+ en: 695d892574059848
34
+ zh: b3acbd068cd48ffb
35
+ /qilin-subagent-spawn-in-process/understand-the-implementation/source-map:
36
+ en: f23771c3d213ffb1
37
+ zh: c0b16b102dc26345
38
+ /qilin-subagent-spawn-in-process/understand-the-implementation/run-flow:
39
+ en: 7b55a5649bc38155
40
+ zh: 51fe220c84ca759a
41
+ /qilin-subagent-spawn-in-process/understand-the-implementation/ownership-and-scope:
42
+ en: 8af949dc29cb4a5c
43
+ zh: f4e4f9f9f4a4b7c9
44
+ /qilin-subagent-spawn-in-process/further-exploration:
45
+ en: 023e2a87c9472ff5
46
+ zh: da2a0d50eec1a8f6
47
+ /qilin-subagent-spawn-in-process/model-experience:
48
+ en: 215e7ba838619b7b
49
+ zh: a311da3843709f90
50
+ /qilin-subagent-spawn-in-process/model-experience/child-agent-request:
51
+ en: 05e6180f1498fdf9
52
+ zh: 2b05d2b97bfa67da
53
+ /qilin-subagent-spawn-in-process/model-experience/child-agent-request/what-the-model-sees:
54
+ en: 2035bdd8640e5a8a
55
+ zh: 5afa645d7dbe31a5
56
+ /qilin-subagent-spawn-in-process/model-experience/child-agent-request/token-effect:
57
+ en: e74d21e38e4a53a9
58
+ zh: 6a5e3ef5fe0f4f14
59
+ /qilin-subagent-spawn-in-process/model-experience/child-agent-request/kv-cache-effect:
60
+ en: 78d800b26fb3b0af
61
+ zh: 313169b62c29af1d
62
+ /qilin-subagent-spawn-in-process/model-experience/parent-tool-result-indirectly:
63
+ en: 75d061c2151624a7
64
+ zh: 71e58e020b60ff90
65
+ /qilin-subagent-spawn-in-process/model-experience/parent-tool-result-indirectly/what-the-model-sees:
66
+ en: e13dd20fc123c970
67
+ zh: 031673267b742df6
68
+ /qilin-subagent-spawn-in-process/model-experience/parent-tool-result-indirectly/token-effect:
69
+ en: ff8045aa0f466c2a
70
+ zh: e38fc5c6af2ce076
71
+ /qilin-subagent-spawn-in-process/model-experience/parent-tool-result-indirectly/kv-cache-effect:
72
+ en: f5d5f97a153f7c70
73
+ zh: 3d6bc05b9eadfbc2
74
+ /qilin-subagent-spawn-in-process/known-limitations-and-deferred-work:
75
+ en: 68720f2a663a4aad
76
+ zh: a472436c5cc2b801
77
+ /qilin-subagent-spawn-in-process/known-limitations-and-deferred-work/dev-note:
78
+ en: e67f633dc6fe7773
79
+ zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -1,3 +1,149 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "In-process spawn subagent backend for users and maintainers choosing, configuring, or debugging fresh-child delegation."
3
+ kind: "package-reference"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @qilin-agent/subagent-spawn-in-process
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ `qilin-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 `request.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
+
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 in a composition that delegates work to fresh in-process children. The common path is explicit: load the subagent service and this backend, then point a delegation tool such as `qilin-tool-subagent` at the `spawn` provider.
29
+
30
+ ### When to choose it
31
+
32
+ Choose the spawn backend when the child needs no parent conversation and running in this process is acceptable. Avoid it when the child must build on completed parent turns — the fork backend seeds that history — or when the child must run outside this process, which the out-of-process backends provide. Because the child inherits the parent's working directory and LLM selection by default, a self-contained prompt behaves exactly as written.
33
+
34
+ ### Minimal configuration
35
+
36
+ Load the subagent service and this backend, then configure one delegation tool per target. This is the smallest composition that exposes a `subagent` tool backed by spawn:
37
+
38
+ ```yaml
39
+ - name: '@qilin-agent/subagent'
40
+ - name: '@qilin-agent/subagent-spawn-in-process'
41
+ - name: '@qilin-agent/tool-subagent'
42
+ config:
43
+ provider: spawn
44
+ ```
45
+
46
+ | Field | Default | Meaning |
47
+ |---|---|---|
48
+ | `providerName` | `spawn` | Provider name registered on `ctx.subagents` |
49
+
50
+ The generated [configuration catalog](../../../docs/config-catalog.md#qilin-agentsubagent-spawn-in-process) is the exhaustive source for every accepted field and its JSDoc.
51
+
52
+ ### What a delegation does
53
+
54
+ One tool call starts one child and waits for its result: the child works in its own session and the parent receives only its final output, or an errored tool result when the run is cancelled, refused, truncated by its token limit, or rejected at startup. A rejected start leaves no published child; a completed run is disposed after its result is collected.
55
+
56
+ -----
57
+
58
+ <a id="understand-the-implementation"></a>
59
+ ## Understand the implementation
60
+
61
+ <details>
62
+ <summary>Implementation internals — click to expand</summary>
63
+
64
+ This section explains how the backend is built and where the behavior in [Use this package](#use-this-package) comes from; the shared mechanics belong to the in-process driver.
65
+
66
+ ### Design concept
67
+
68
+ One separation: this backend contributes only the provider registration and the decision to start fresh, while every run mechanic — depth checking, child creation, per-child customization, structured output, cancellation, result reading, and disposal — lives in `qilin-subagent-in-process-driver`. The agent factory's creation transaction owns the unpublished setup window and its rollback; after publication the caller owns the run.
69
+
70
+ ### Source map
71
+
72
+ | File | Role |
73
+ |---|---|
74
+ | [`src/index.ts`](src/index.ts) | Provider registration: `Config` schema, capability declaration, `start()` |
75
+
76
+ ### Run flow
77
+
78
+ A start request resolves through the subagent service, then the shared driver validates depth, mints a child session id, creates the child through the host agent factory with the caller's signal, applies persona, tool filter, and structured output inside the creation window, publishes the child, drives one task, reads the child's own final output, and disposes the handle quiescently.
79
+
80
+ ### Ownership and scope
81
+
82
+ The child gets a fresh flat registration scope: parent tool restrictions and authority are never imported, and the filter the tool applies is composition, not a parent-derived grant. The backend advertises all five start-time capabilities, including `agentOptions`, because it controls the child's creation window and can enforce each one.
83
+
84
+ </details>
85
+
86
+ -----
87
+
88
+ <a id="further-exploration"></a>
89
+ ## Further Exploration
90
+
91
+ Read these pages when the package-level contract is not enough; they move from the shared subagent model to the sibling backends and exhaustive configuration.
92
+
93
+ - [Subagent subsystem](../../../docs/subsystems/subagent.md) — start requests, results, live runs, and the provider contract.
94
+ - [qilin-subagent-in-process-driver](../subagent-in-process-driver/README.md) — the shared run driver this backend calls.
95
+ - [qilin-subagent-fork-in-process](../subagent-fork-in-process/README.md) — the sibling backend that seeds completed parent turns.
96
+ - [qilin-tool-subagent](../tool-subagent/README.md) — the model-facing delegation tool that reaches this provider.
97
+ - [Generated configuration catalog](../../../docs/config-catalog.md#qilin-agentsubagent-spawn-in-process) — every accepted config field and its source declaration.
98
+
99
+ -----
100
+
101
+ <a id="model-experience"></a>
102
+ ## Model Experience
103
+
104
+ ### Child-agent request
105
+
106
+ #### What the model sees
107
+
108
+ The fresh child receives the task content verbatim as its only user message in a new empty conversation, with the parent provider, model, reasoning effort, output-token limit, and working directory by default. A configured persona shadows global prompt text in the child's scope; a tool filter removes named global tools from its schemas, executable lookup, and PTC mode SDK bindings while leaving independently registered guidance. No parent conversation message is included; the filter is composition, not an inherited authority grant.
109
+
110
+ #### Token effect
111
+
112
+ The child pays for a new independent context and history, and no parent-history token is duplicated. A persona changes the child's repeated prompt cost; a tool filter changes its schema or generated SDK cost.
113
+
114
+ #### KV Cache effect
115
+
116
+ The child's request cache is independent of the parent's. Child history grows append-only, while persona, tool-filter, generated-SDK, provider, or model changes establish a different child prefix.
117
+
118
+ ### Parent tool result, indirectly
119
+
120
+ #### What the model sees
121
+
122
+ Through `qilin-tool-subagent`, the parent receives only the child's final output or an errored result for a non-completed stop reason; intermediate child work never reaches it.
123
+
124
+ #### Token effect
125
+
126
+ Parent input grows by one data-dependent result, retained until compaction.
127
+
128
+ #### KV Cache effect
129
+
130
+ Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
131
+
132
+ ## Known Limitations and Deferred Work
133
+
134
+ <a id="known-limitations-and-deferred-work"></a>
135
+
136
+
137
+ These limits define when the backend is the wrong choice; they are current package constraints.
138
+
139
+ - **Fresh means no parent transcript** — the child inherits cwd, lineage, provider, model, reasoning effort, output-token limit, and explicitly configured persona or tool restrictions, but none of the parent's conversation; use the fork backend when completed-turn context is required.
140
+
141
+ <a id="dev-note"></a>
142
+ ### Dev Note
143
+
144
+ <details>
145
+ <summary>Working context for maintainers — click to expand</summary>
146
+
147
+ None.
148
+
149
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,149 @@
1
+ ---
2
+ description: "面向用户与维护者的进程内 spawn subagent 后端说明,用于选择、配置或排查全新子级委派。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @qilin-agent/subagent-spawn-in-process
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ `qilin-subagent-spawn-in-process` 是一个进程内 subagent 后端:它在当前进程中运行每个委派任务,子 agent(智能体)是一个全新子 `Agent`,复用宿主的 agent 工厂及 LLM(大语言模型)/工具服务。子 agent 以空对话开始,因此任务提示词必须自足;除非 `request.agentOptions` 覆盖,否则它继承父 agent 的工作目录、会话谱系、提供方、模型、推理强度与输出 token 上限。委派工具或 API 调用以 `spawn` 提供方名称找到它。需要成本最低的委派传输时选择它;需要子 agent 建立在父级已完成对话轮次之上时,请选择 fork 后端。
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
+ 在需要把工作委派给全新进程内子 agent 的组合中挂载此后端。常用配置路径很明确:加载 subagent 服务与本后端,再把 `qilin-tool-subagent` 之类的委派工具指向 `spawn` 提供方。
29
+
30
+ ### 何时选择
31
+
32
+ 当子 agent 不需要父级对话、且可以接受在本进程内运行时,选择 spawn 后端。当子 agent 必须建立在已完成父级轮次之上时——fork 后端会提供这些历史——或必须在本进程之外运行时(进程外后端提供此能力),请避免使用它。由于子 agent 默认继承父级的工作目录与 LLM 选择,自足的提示词会按原样生效。
33
+
34
+ ### 最小配置
35
+
36
+ 先加载 subagent 服务与本后端,再为每个目标配置一个委派工具。这是暴露由 spawn 支撑的 `subagent` 工具的最小组合:
37
+
38
+ ```yaml
39
+ - name: '@qilin-agent/subagent'
40
+ - name: '@qilin-agent/subagent-spawn-in-process'
41
+ - name: '@qilin-agent/tool-subagent'
42
+ config:
43
+ provider: spawn
44
+ ```
45
+
46
+ | 字段 | 默认值 | 含义 |
47
+ |---|---|---|
48
+ | `providerName` | `spawn` | 注册到 `ctx.subagents` 的提供方名称 |
49
+
50
+ 生成的[配置目录](../../../docs/config-catalog.zh.md#qilin-agentsubagent-spawn-in-process)是每个受支持字段及其 JSDoc 的穷尽式真源。
51
+
52
+ ### 一次委派会做什么
53
+
54
+ 一次工具调用启动一个子 agent 并等待其结果:子 agent 在自有会话中工作,父级只接收其最终输出;若运行被取消、拒绝、被 token 上限截断或在启动时被拒,则收到出错的工具结果。被拒绝的启动不会留下已发布的子 agent;完成的运行在结果收集后即被 dispose(资源释放)。
55
+
56
+ -----
57
+
58
+ <a id="understand-the-implementation"></a>
59
+ ## 理解实现
60
+
61
+ <details>
62
+ <summary>实现细节——点击展开</summary>
63
+
64
+ 本节解释后端的构建方式以及[使用本包](#use-this-package)中行为的来源;共享机制属于进程内驱动器。
65
+
66
+ ### 设计理念
67
+
68
+ 职责划分如下:本后端只贡献提供方注册与「全新开始」的决定,其余全部运行机制——深度检查、子 agent 创建、按子 agent 定制、结构化输出、取消、结果读取与 dispose——都在 `qilin-subagent-in-process-driver` 中。agent 工厂的创建事务拥有未发布设置窗口及其回滚;发布之后,调用方拥有该运行。
69
+
70
+ ### 源码地图
71
+
72
+ | 文件 | 职责 |
73
+ |---|---|
74
+ | [`src/index.ts`](src/index.ts) | 提供方注册:`Config` schema、能力声明、`start()` |
75
+
76
+ ### 运行流程
77
+
78
+ 启动请求先由 subagent 服务解析,然后共享驱动器校验深度、生成子会话 id、通过宿主 agent 工厂以调用方信号创建子 agent、在创建窗口内应用 persona、工具过滤器与结构化输出、发布子 agent、驱动一项任务、读取子 agent 自身的最终输出,最后完全停稳地 dispose 句柄。
79
+
80
+ ### 所有权与作用域
81
+
82
+ 子 agent 获得全新的扁平注册作用域:父级工具限制与权限绝不会被导入,工具所施加的过滤属于组合而非父级派生授权。后端声明包括 `agentOptions` 在内的全部五项启动时能力,因为它控制子 agent 的创建窗口,可以逐一强制执行。
83
+
84
+ </details>
85
+
86
+ -----
87
+
88
+ <a id="further-exploration"></a>
89
+ ## 进一步探索
90
+
91
+ 当包级约定不够用时阅读以下页面;它们从共享 subagent 模型进入兄弟后端与穷尽式配置。
92
+
93
+ - [Subagent 子系统](../../../docs/subsystems/subagent.zh.md)——启动请求、结果、实时运行与提供方约定。
94
+ - [qilin-subagent-in-process-driver](../subagent-in-process-driver/README.zh.md)——本后端调用的共享运行驱动器。
95
+ - [qilin-subagent-fork-in-process](../subagent-fork-in-process/README.zh.md)——以已完成父级轮次作初始内容的兄弟后端。
96
+ - [qilin-tool-subagent](../tool-subagent/README.zh.md)——指向该提供方的面向模型委派工具。
97
+ - [生成配置目录](../../../docs/config-catalog.zh.md#qilin-agentsubagent-spawn-in-process)——每个受支持配置字段及其源声明。
98
+
99
+ -----
100
+
101
+ <a id="model-experience"></a>
102
+ ## 模型体验
103
+
104
+ ### 子 agent 请求
105
+
106
+ #### 模型看到什么
107
+
108
+ 全新子 agent 逐字接收任务内容,作为新空对话中的唯一用户消息,默认使用父级提供方、模型、推理强度、输出 token 上限与工作目录。配置的 persona 会在子 agent 作用域中遮蔽全局提示词文本;工具过滤器会从其 schema、可执行工具查找与 PTC mode SDK 绑定中移除指定的全局工具,但保留独立注册的指导内容。不包含任何父级对话消息;过滤属于组合,而非继承的权限授予。
109
+
110
+ #### Token 影响
111
+
112
+ 子 agent 会为全新的独立上下文与历史消耗 token,不复制任何父级历史 token。persona 会改变该子 agent 反复使用的提示词成本;工具过滤器会改变其 schema 或生成 SDK 的成本。
113
+
114
+ #### KV Cache 影响
115
+
116
+ 子 agent 的请求缓存与父级相互独立。子 agent 历史仅追加;persona、工具过滤、生成 SDK、提供方或模型变化会建立不同的子 agent 前缀。
117
+
118
+ ### 父级工具结果(间接)
119
+
120
+ #### 模型看到什么
121
+
122
+ 通过 `qilin-tool-subagent`,父级只接收子 agent 的最终输出,或非完成终止原因对应的出错结果;子 agent 的中间工作绝不会到达父级。
123
+
124
+ #### Token 影响
125
+
126
+ 父级输入增加一个取决于数据的结果,并保留到上下文压缩(context compaction)为止。
127
+
128
+ #### KV Cache 影响
129
+
130
+ 仅追加;新增可见内容位于可复用请求前缀之后,不会使现有 KV Cache 条目失效。
131
+
132
+ ## 已知限制与延期工作
133
+
134
+ <a id="known-limitations-and-deferred-work"></a>
135
+
136
+
137
+ 这些限制说明何时选择该后端是错误的;它们是当前包约束。
138
+
139
+ - **全新表示不含父级 transcript(文本记录)**——子 agent 继承 cwd、谱系、提供方、模型、推理强度、输出 token 上限及显式配置的 persona/工具限制,但不继承父级的任何对话;需要已完成轮次上下文时,请使用 fork 后端。
140
+
141
+ <a id="dev-note"></a>
142
+ ### 开发备注
143
+
144
+ <details>
145
+ <summary>维护者的工作上下文——点击展开</summary>
146
+
147
+ 无。
148
+
149
+ </details>
package/lib/index.js ADDED
@@ -0,0 +1,45 @@
1
+ import z from "@qilin-agent/schemastery";
2
+ import { startInProcessRun } from "@qilin-agent/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 @qilin-agent/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), `agentOptions` (merged over the parent
18
+ * route), and `toolFilter`/`persona` (scoped `restrict()` and a scoped
19
+ * shadowing persona section, applied in the child's creation window).
20
+ */
21
+ var SpawnInProcessProvider = class {
22
+ name;
23
+ capabilities = {
24
+ agentOptions: true,
25
+ outputSchema: true,
26
+ depthLimit: true,
27
+ toolFilter: true,
28
+ persona: true
29
+ };
30
+ inheritsParentContext = false;
31
+ constructor(name) {
32
+ this.name = name;
33
+ }
34
+ start(request) {
35
+ return startInProcessRun(request, {});
36
+ }
37
+ prepareContinuable() {
38
+ return Promise.resolve({});
39
+ }
40
+ };
41
+ function apply(ctx, config) {
42
+ ctx.subagents.registerProvider(new SpawnInProcessProvider(config.providerName));
43
+ }
44
+ //#endregion
45
+ export { Config, 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 @qilin-agent/subagent-spawn-in-process
7
+ */
8
+ import type { Context } from '@qilin-agent/kylin';
9
+ import z from '@qilin-agent/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
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@qilin-agent/subagent-spawn-in-process",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "In-process spawn subagent backend: runs a fresh child agent on ctx.agents",
4
+ "version": "3.1.3",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kkutysllb/QiLin.git",
11
+ "directory": "packages/subagent/subagent-spawn-in-process"
12
+ },
13
+ "engines": {
14
+ "node": "^22.19.0 || >=24.0.0"
15
+ },
16
+ "type": "module",
17
+ "main": "lib/index.js",
18
+ "types": "lib/types/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./lib/types/index.d.ts",
22
+ "default": "./lib/index.js"
23
+ },
24
+ "./src/*": "./src/*",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "lib/index.js",
29
+ "lib/types/**/*.d.ts"
30
+ ],
31
+ "license": "MIT",
32
+ "peerDependencies": {
33
+ "@qilin-agent/subagent": "3.1.3",
34
+ "@qilin-agent/subagent-in-process-driver": "3.1.3",
35
+ "@qilin-agent/kylin": "~4.0.3"
36
+ },
37
+ "dependencies": {
38
+ "@qilin-agent/schemastery": "~3.18.3"
39
+ },
40
+ "devDependencies": {
41
+ "@qilin-agent/kylin-plugin-loader": "~1.0.4",
42
+ "@qilin-agent/agent-loop": "3.1.3",
43
+ "@qilin-agent/bash-local": "3.1.3",
44
+ "@qilin-agent/agent-loop-testkit": "3.1.3",
45
+ "@qilin-agent/agent": "3.1.3",
46
+ "@qilin-agent/subprocess-local": "3.1.3",
47
+ "@qilin-agent/llm": "3.1.3",
48
+ "@qilin-agent/llm-deepseek-api-key": "3.1.3",
49
+ "@qilin-agent/subagent": "3.1.3",
50
+ "@qilin-agent/session": "3.1.3",
51
+ "@qilin-agent/subagent-in-process-driver": "3.1.3",
52
+ "@qilin-agent/tool-bash": "3.1.3",
53
+ "@qilin-agent/tool-subagent": "3.1.3",
54
+ "@qilin-agent/llm-deepseek": "3.1.3",
55
+ "@qilin-agent/kylin": "~4.0.3",
56
+ "@qilin-agent/session-projection": "3.1.3"
57
+ }
6
58
  }