@qilin-agent/subagent-acp 3.1.3 → 3.1.5

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 CHANGED
@@ -5,81 +5,81 @@
5
5
  /:
6
6
  en: 86941ae0e2ae97a3
7
7
  zh: ca2acb7bff6d53ab
8
- /qilin-subagent-acp:
9
- en: 0e6df5b89556a857
10
- zh: 8cc05e065cf5b743
11
- /qilin-subagent-acp/summary:
8
+ /qilin-agent-subagent-acp:
9
+ en: 829b529e2d7f34fd
10
+ zh: ba0aa818af78175c
11
+ /qilin-agent-subagent-acp/summary:
12
12
  en: 39559d1c5892fed9
13
13
  zh: efd0fc17460a0b14
14
- /qilin-subagent-acp/table-of-contents:
14
+ /qilin-agent-subagent-acp/table-of-contents:
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
- /qilin-subagent-acp/use-this-package:
17
+ /qilin-agent-subagent-acp/use-this-package:
18
18
  en: 78623be74507229d
19
19
  zh: b0ed9c9d0c6eb040
20
- /qilin-subagent-acp/use-this-package/when-to-choose-it:
20
+ /qilin-agent-subagent-acp/use-this-package/when-to-choose-it:
21
21
  en: 56946ab7637bb8f9
22
22
  zh: c54c4da98092dd9c
23
- /qilin-subagent-acp/use-this-package/configuration:
24
- en: 59a13b84e3d719ec
25
- zh: 5fe144d3fc1814f4
26
- /qilin-subagent-acp/use-this-package/what-you-get:
23
+ /qilin-agent-subagent-acp/use-this-package/configuration:
24
+ en: d3da0cefb05f7507
25
+ zh: 581a700e4098c438
26
+ /qilin-agent-subagent-acp/use-this-package/what-you-get:
27
27
  en: 0a809bd7b8cebddc
28
28
  zh: e2c1edf8f485e8f8
29
- /qilin-subagent-acp/use-this-package/failure-and-recovery:
29
+ /qilin-agent-subagent-acp/use-this-package/failure-and-recovery:
30
30
  en: 312094fb2d293247
31
31
  zh: c9b48a6127532308
32
- /qilin-subagent-acp/use-this-package/safe-diagnostics:
32
+ /qilin-agent-subagent-acp/use-this-package/safe-diagnostics:
33
33
  en: 11a38ce5f9a97e1f
34
34
  zh: 617ad40f3e37f742
35
- /qilin-subagent-acp/understand-the-implementation:
35
+ /qilin-agent-subagent-acp/understand-the-implementation:
36
36
  en: 663322a5de5a2112
37
37
  zh: 37d0602bb7e58c0e
38
- /qilin-subagent-acp/understand-the-implementation/design-concept:
38
+ /qilin-agent-subagent-acp/understand-the-implementation/design-concept:
39
39
  en: c98e6bcd784bbf8a
40
40
  zh: b96218f6e639755c
41
- /qilin-subagent-acp/understand-the-implementation/start-and-ownership-flow:
42
- en: c0f7f78468f84c3b
43
- zh: c9cb417d84d868ce
44
- /qilin-subagent-acp/understand-the-implementation/stop-reason-mapping:
41
+ /qilin-agent-subagent-acp/understand-the-implementation/start-and-ownership-flow:
42
+ en: 739de98dc990a602
43
+ zh: 3eaa126d0cad8506
44
+ /qilin-agent-subagent-acp/understand-the-implementation/stop-reason-mapping:
45
45
  en: 88bb2b62c6e2f114
46
46
  zh: f6b720ca8ce90343
47
- /qilin-subagent-acp/understand-the-implementation/process-boundary:
47
+ /qilin-agent-subagent-acp/understand-the-implementation/process-boundary:
48
48
  en: 7217618a1d396333
49
49
  zh: c8f47e31c815bec8
50
- /qilin-subagent-acp/further-exploration:
51
- en: 5f8bb88ba6e3dc1a
52
- zh: 56bf6417caa81b1e
53
- /qilin-subagent-acp/model-experience:
50
+ /qilin-agent-subagent-acp/further-exploration:
51
+ en: 30ab65adceff9633
52
+ zh: 7b45c0dfe7215e5f
53
+ /qilin-agent-subagent-acp/model-experience:
54
54
  en: 215e7ba838619b7b
55
55
  zh: a311da3843709f90
56
- /qilin-subagent-acp/model-experience/child-agent-request:
56
+ /qilin-agent-subagent-acp/model-experience/child-agent-request:
57
57
  en: 05e6180f1498fdf9
58
58
  zh: 2b05d2b97bfa67da
59
- /qilin-subagent-acp/model-experience/child-agent-request/what-the-model-sees:
59
+ /qilin-agent-subagent-acp/model-experience/child-agent-request/what-the-model-sees:
60
60
  en: f7f619ca78d74c6f
61
61
  zh: f642dc7b4ff69a10
62
- /qilin-subagent-acp/model-experience/child-agent-request/token-effect:
62
+ /qilin-agent-subagent-acp/model-experience/child-agent-request/token-effect:
63
63
  en: c0b78d334d5d0a9c
64
64
  zh: d54bf504933e132d
65
- /qilin-subagent-acp/model-experience/child-agent-request/kv-cache-effect:
65
+ /qilin-agent-subagent-acp/model-experience/child-agent-request/kv-cache-effect:
66
66
  en: e9423135f647a086
67
67
  zh: 6b50cc215a8b4403
68
- /qilin-subagent-acp/model-experience/parent-tool-result-indirectly:
68
+ /qilin-agent-subagent-acp/model-experience/parent-tool-result-indirectly:
69
69
  en: 75d061c2151624a7
70
70
  zh: 71e58e020b60ff90
71
- /qilin-subagent-acp/model-experience/parent-tool-result-indirectly/what-the-model-sees:
71
+ /qilin-agent-subagent-acp/model-experience/parent-tool-result-indirectly/what-the-model-sees:
72
72
  en: e9288ecec3f2e2c7
73
73
  zh: ab7e02a64421bb14
74
- /qilin-subagent-acp/model-experience/parent-tool-result-indirectly/token-effect:
74
+ /qilin-agent-subagent-acp/model-experience/parent-tool-result-indirectly/token-effect:
75
75
  en: 600ac97cdd163650
76
76
  zh: cd26bb541f56699b
77
- /qilin-subagent-acp/model-experience/parent-tool-result-indirectly/kv-cache-effect:
77
+ /qilin-agent-subagent-acp/model-experience/parent-tool-result-indirectly/kv-cache-effect:
78
78
  en: f5d5f97a153f7c70
79
79
  zh: 3d6bc05b9eadfbc2
80
- /qilin-subagent-acp/known-limitations-and-deferred-work:
80
+ /qilin-agent-subagent-acp/known-limitations-and-deferred-work:
81
81
  en: 53a0e7fb49fe6e23
82
82
  zh: 51096d4eb51fb4ba
83
- /qilin-subagent-acp/known-limitations-and-deferred-work/dev-note:
83
+ /qilin-agent-subagent-acp/known-limitations-and-deferred-work/dev-note:
84
84
  en: d8323b3200db6ac9
85
85
  zh: f8a5273b887b9552
package/README.md CHANGED
@@ -38,7 +38,6 @@ Choose this backend when the child must run with its own runtime, model, and too
38
38
  | `providerName` | `acp` | Registry name on `ctx.subagents` |
39
39
  | `command` | required | Executable spawned for each run (the child ACP agent) |
40
40
  | `args` | `[]` | Command arguments |
41
- | `cwd` | parent session cwd | Working-directory override for the child process and its ACP session |
42
41
  | `permission` | `reject` | Auto-answer permission requests by rejecting, or choosing the first `allow_once` or `allow_always` option (`allow`) |
43
42
  | `env` | `{}` | Explicit child environment layered over the credential-scrubbed parent environment |
44
43
  | `disposeEofGraceMs` | `6000` | Grace after stdin EOF before platform termination |
@@ -91,7 +90,7 @@ This section explains how the backend drives a child over ACP and where the obse
91
90
 
92
91
  ### Start and ownership flow
93
92
 
94
- A start resolves the child's working directory (the configured `cwd` override, else the parent session's cwd), spawns the command through the subprocess seam, performs the ACP `initialize` and `newSession` handshake, and only then publishes the run. Fulfillment means a remote session is ready and ownership has transferred to the caller. Disposal is idempotent: it closes stdin and waits a configured grace for cooperative quiescence, then escalates through SIGTERM to SIGKILL and awaits whole-range exit. Cleanup failures remain observable as ordered safe facts and never claim quiescence.
93
+ A start resolves the child's working directory (the request override, else the parent's current effective directory), spawns the command through the subprocess seam, performs the ACP `initialize` and `newSession` handshake, and only then publishes the run. Fulfillment means a remote session is ready and ownership has transferred to the caller. Disposal is idempotent: it closes stdin and waits a configured grace for cooperative quiescence, then escalates through SIGTERM to SIGKILL and awaits whole-range exit. Cleanup failures remain observable as ordered safe facts and never claim quiescence.
95
94
 
96
95
  ### Stop-reason mapping
97
96
 
package/README.zh.md CHANGED
@@ -38,7 +38,6 @@ kind: "package-reference"
38
38
  | `providerName` | `acp` | `ctx.subagents` 上的注册表名称 |
39
39
  | `command` | 必填 | 每次运行时 spawn 的可执行文件(子 ACP agent) |
40
40
  | `args` | `[]` | 命令参数 |
41
- | `cwd` | 父会话 cwd | 子进程及其 ACP 会话的工作目录覆盖值 |
42
41
  | `permission` | `reject` | 自动应答权限请求:拒绝,或选择第一个 `allow_once` 或 `allow_always` 选项(`allow`) |
43
42
  | `env` | `{}` | 叠加在已清理凭据的父环境之上的显式子环境 |
44
43
  | `disposeEofGraceMs` | `6000` | stdin EOF 之后、平台终止之前的宽限 |
@@ -91,7 +90,7 @@ spawn、初始化或新建会话失败会在发布前拒绝,通常先证明 ma
91
90
 
92
91
  ### 启动与所有权流程
93
92
 
94
- 一次启动先解析子 agent 的工作目录(配置的 `cwd` 覆盖值,否则取父会话 cwd),经子进程 seam spawn 命令,完成 ACP `initialize` 与 `newSession` 握手,然后才发布运行。兑现意味着远程会话已就绪、所有权已转移给调用方。dispose(资源释放)是幂等的:先关闭 stdin 并按配置的宽限等待协作式完全停稳,再经 SIGTERM 升级到 SIGKILL,并等待整个 managed range 退出。清理失败会作为有序的安全事实保持可观察,且绝不声称已经完全停稳。
93
+ 一次启动先解析子 agent 的工作目录(请求覆盖值,否则取父级当前有效目录),经子进程 seam spawn 命令,完成 ACP `initialize` 与 `newSession` 握手,然后才发布运行。兑现意味着远程会话已就绪、所有权已转移给调用方。dispose(资源释放)是幂等的:先关闭 stdin 并按配置的宽限等待协作式完全停稳,再经 SIGTERM 升级到 SIGKILL,并等待整个 managed range 退出。清理失败会作为有序的安全事实保持可观察,且绝不声称已经完全停稳。
95
94
 
96
95
  ### 停止原因映射
97
96
 
package/lib/index.js CHANGED
@@ -1,12 +1,10 @@
1
- import { accessSync, constants, statSync } from "node:fs";
2
- import { isAbsolute, resolve } from "node:path";
3
1
  import z from "@qilin-agent/schemastery";
2
+ import { AssistantOutputFold, assertUsableCwd, settleRunResult, subprocessRunHandle } from "@qilin-agent/subagent";
4
3
  import { MAX_TIMER_DELAY_MS } from "@qilin-agent/timeout";
5
4
  import { randomUUID } from "node:crypto";
6
5
  import { Readable, Writable } from "node:stream";
7
6
  import { PROTOCOL_VERSION, client, methods, ndJsonStream } from "@agentclientprotocol/sdk";
8
7
  import { brandString } from "@qilin-agent/brand";
9
- import { AssistantOutputFold, settleRunResult, subprocessRunHandle } from "@qilin-agent/subagent";
10
8
  //#region lib/types/run.js
11
9
  /**
12
10
  * Fresh-process ACP subagent client. Drives one child session and owns cancellation and
@@ -374,6 +372,7 @@ async function startAcpRun(request, spec) {
374
372
  let diagnostic;
375
373
  return subprocessRunHandle({
376
374
  id,
375
+ localAgent: void 0,
377
376
  result: settleRunResult({
378
377
  attempt: async () => {
379
378
  try {
@@ -434,8 +433,8 @@ async function startAcpRun(request, spec) {
434
433
  /**
435
434
  * Out-of-process ACP subagent backend. Each child has its own process, session, model, and
436
435
  * tools, so it shares no Cordis context and advertises no parent-enforced start capabilities;
437
- * the ONE thing it reads off `request.parent` is the session's workspace cwd (see
438
- * {@link resolveCwd}). This plugin uses named exports only; a default would hide its
436
+ * the subagent service supplies the captured child working directory. This plugin uses
437
+ * named exports only; a default would hide its
439
438
  * loader metadata (see `docs/postmortem/0001-acp-default-export-drops-inject.md`).
440
439
  * @module @qilin-agent/subagent-acp
441
440
  */
@@ -445,7 +444,6 @@ const Config = z.object({
445
444
  providerName: z.string().default("acp"),
446
445
  command: z.string().required(),
447
446
  args: z.array(z.string()).default([]),
448
- cwd: z.string(),
449
447
  permission: z.union(["allow", "reject"]).default("reject"),
450
448
  env: z.dict(z.string()).default({}),
451
449
  disposeEofGraceMs: z.number().default(DEFAULT_DISPOSE_EOF_GRACE_MS),
@@ -456,48 +454,6 @@ function assertPositiveFinite(name, value) {
456
454
  if (!Number.isFinite(value) || value <= 0 || value > MAX_TIMER_DELAY_MS) throw new Error(`subagent-acp: ${name} must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`);
457
455
  }
458
456
  /**
459
- * Whether `path` names an existing directory the harness can ENTER. The
460
- * search-permission probe matters: `statSync().isDirectory()` is true for a
461
- * mode-600 directory, but a subprocess cwd needs `X_OK` or spawn fails EACCES.
462
- */
463
- function isDirectory(path) {
464
- try {
465
- if (!statSync(path).isDirectory()) return false;
466
- accessSync(path, constants.X_OK);
467
- return true;
468
- } catch {
469
- return false;
470
- }
471
- }
472
- /**
473
- * Assert `cwd` can actually host the child: absolute (it doubles as the ACP
474
- * session workspace, and a relative path would be re-anchored to the server
475
- * process's launch directory) and an existing directory (fail here, before the
476
- * process boundary, instead of as an ambiguous spawn ENOENT).
477
- * @param label - which source supplied the value, for the diagnostic.
478
- * @param cwd - the candidate working directory.
479
- * @returns `cwd`, validated.
480
- */
481
- function assertUsableCwd(label, cwd) {
482
- if (!isAbsolute(cwd)) throw new Error(`subagent-acp: ${label} must be an absolute path: ${cwd}`);
483
- if (!isDirectory(cwd)) throw new Error(`subagent-acp: ${label} is not an accessible directory: ${cwd}`);
484
- return cwd;
485
- }
486
- /**
487
- * Resolve the child's working directory: the deployment `cwd` override when
488
- * configured (already validated at load), else the parent session's workspace
489
- * cwd (validated here, its earliest resolvable point). Fails loud when neither
490
- * exists — falling back to the harness process cwd would silently bind the
491
- * child to the server's launch directory instead of the delegating session's
492
- * workspace (one server process serves many sessions, each with its own cwd).
493
- */
494
- function resolveCwd(configured, request) {
495
- if (configured !== void 0) return configured;
496
- const parentCwd = request.parent.session.header.cwd;
497
- if (parentCwd === void 0) throw new Error("subagent-acp: no working directory for the child — configure `cwd` or delegate from a parent session that has one");
498
- return assertUsableCwd("parent session cwd", parentCwd);
499
- }
500
- /**
501
457
  * The ACP provider. Advertises NO start-time capabilities: an out-of-process
502
458
  * child cannot honor `agentOptions`/`outputSchema`/`maxDepth`/`toolFilter`/
503
459
  * `persona` (the service rejects a request needing any before `start` runs).
@@ -523,7 +479,7 @@ var AcpProvider = class {
523
479
  if (request.signal.aborted) throw new Error("subagent request was aborted before the ACP child started");
524
480
  let cwd;
525
481
  try {
526
- cwd = resolveCwd(this.config.cwd, request);
482
+ cwd = assertUsableCwd("subagent-acp", "child cwd", request.cwd);
527
483
  } catch (error) {
528
484
  const failure = acpConfigurationFailure(error);
529
485
  this.ctx.logger.warn(`subagent-acp "${this.name}": child start failed: %o`, error);
@@ -548,12 +504,7 @@ function apply(ctx, config) {
548
504
  const resolved = config;
549
505
  assertPositiveFinite("disposeEofGraceMs", resolved.disposeEofGraceMs);
550
506
  assertPositiveFinite("disposeGraceMs", resolved.disposeGraceMs);
551
- if (resolved.cwd === "") throw new Error("subagent-acp: config cwd must not be empty — omit the key to inherit the parent session cwd");
552
- const validated = resolved.cwd === void 0 ? resolved : {
553
- ...resolved,
554
- cwd: assertUsableCwd("config cwd", resolve(resolved.cwd))
555
- };
556
- ctx.subagents.registerProvider(new AcpProvider(validated.providerName, ctx, validated));
507
+ ctx.subagents.registerProvider(new AcpProvider(resolved.providerName, ctx, resolved));
557
508
  }
558
509
  //#endregion
559
510
  export { Config, apply, inject, name };
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Out-of-process ACP subagent backend. Each child has its own process, session, model, and
3
3
  * tools, so it shares no Cordis context and advertises no parent-enforced start capabilities;
4
- * the ONE thing it reads off `request.parent` is the session's workspace cwd (see
5
- * {@link resolveCwd}). This plugin uses named exports only; a default would hide its
4
+ * the subagent service supplies the captured child working directory. This plugin uses
5
+ * named exports only; a default would hide its
6
6
  * loader metadata (see `docs/postmortem/0001-acp-default-export-drops-inject.md`).
7
7
  * @module @qilin-agent/subagent-acp
8
8
  */
@@ -19,14 +19,6 @@ export interface Config {
19
19
  command: string;
20
20
  /** Arguments passed to {@link command}. */
21
21
  args: string[];
22
- /**
23
- * Working directory override for the child process and its ACP session.
24
- * Must be non-empty; a relative path resolves against the harness launch
25
- * directory at load, and the result must be an existing directory. When
26
- * omitted, each child inherits its delegating parent session's cwd — and
27
- * starting one from a parent session that has no cwd fails.
28
- */
29
- cwd?: string;
30
22
  /**
31
23
  * How to auto-answer the child's `session/request_permission` prompts:
32
24
  * `reject` (default — decline every prompt) or `allow` (approve via the first
@@ -18,8 +18,7 @@ export interface AcpRunSpec {
18
18
  args: string[];
19
19
  /**
20
20
  * Absolute working directory for the child process AND its ACP session
21
- * `cwd`. The provider resolves it before this spec exists: config override,
22
- * else the delegating parent session's workspace.
21
+ * `cwd`, selected before provider startup.
23
22
  */
24
23
  cwd: string;
25
24
  /** How to auto-answer the child's permission prompts. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/subagent-acp",
3
3
  "description": "Out-of-process ACP subagent backend: drives a child agent in a spawned subprocess over the Agent Client Protocol",
4
- "version": "3.1.3",
4
+ "version": "3.1.5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,33 +31,33 @@
31
31
  "license": "MIT",
32
32
  "peerDependencies": {
33
33
  "@qilin-agent/kylin": "~4.0.3",
34
- "@qilin-agent/agent": "3.1.3",
35
- "@qilin-agent/session": "3.1.3",
36
- "@qilin-agent/llm": "3.1.3",
37
- "@qilin-agent/timeout": "3.1.3",
38
- "@qilin-agent/subagent": "3.1.3",
39
- "@qilin-agent/subprocess": "3.1.3"
34
+ "@qilin-agent/session": "3.1.5",
35
+ "@qilin-agent/agent": "3.1.5",
36
+ "@qilin-agent/llm": "3.1.5",
37
+ "@qilin-agent/subagent": "3.1.5",
38
+ "@qilin-agent/timeout": "3.1.5",
39
+ "@qilin-agent/subprocess": "3.1.5"
40
40
  },
41
41
  "dependencies": {
42
42
  "@agentclientprotocol/sdk": "1.4.0",
43
- "@qilin-agent/schemastery": "~3.18.3",
44
- "@qilin-agent/brand": "3.1.3"
43
+ "@qilin-agent/brand": "3.1.5",
44
+ "@qilin-agent/schemastery": "~3.18.3"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@qilin-agent/kylin": "~4.0.3",
48
- "@qilin-agent/agent": "3.1.3",
49
- "@qilin-agent/app-boot": "3.1.3",
50
48
  "@qilin-agent/kylin-plugin-loader": "~1.0.4",
51
- "@qilin-agent/llm": "3.1.3",
52
- "@qilin-agent/loader-smoke": "3.1.3",
53
- "@qilin-agent/session": "3.1.3",
54
- "@qilin-agent/session-checkpoint-policy": "3.1.3",
55
- "@qilin-agent/subagent": "3.1.3",
56
- "@qilin-agent/session-persistence-jsonl": "3.1.3",
57
- "@qilin-agent/subprocess": "3.1.3",
58
- "@qilin-agent/subprocess-local": "3.1.3",
59
- "@qilin-agent/timeout": "3.1.3",
60
- "@qilin-agent/tool-subagent": "3.1.3",
61
- "@qilin-agent/session-projection": "3.1.3"
49
+ "@qilin-agent/agent": "3.1.5",
50
+ "@qilin-agent/app-boot": "3.1.5",
51
+ "@qilin-agent/llm": "3.1.5",
52
+ "@qilin-agent/loader-smoke": "3.1.5",
53
+ "@qilin-agent/session": "3.1.5",
54
+ "@qilin-agent/session-projection": "3.1.5",
55
+ "@qilin-agent/subprocess-local": "3.1.5",
56
+ "@qilin-agent/session-checkpoint-policy": "3.1.5",
57
+ "@qilin-agent/subagent": "3.1.5",
58
+ "@qilin-agent/subprocess": "3.1.5",
59
+ "@qilin-agent/timeout": "3.1.5",
60
+ "@qilin-agent/session-persistence-jsonl": "3.1.5",
61
+ "@qilin-agent/tool-subagent": "3.1.5"
62
62
  }
63
63
  }