@zhushanwen/subagent-engine-sdk 0.10.1 → 0.12.0

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.
Files changed (62) hide show
  1. package/dist/{chunk-AF2ETADP.js → chunk-2L3I2TWJ.js} +5 -10
  2. package/dist/{chunk-HSNDUHFH.js → chunk-3MCOZY3Z.js} +32 -4
  3. package/dist/{chunk-LM7P7OTA.js → chunk-7R6HYT2A.js} +60 -4
  4. package/dist/{chunk-JZN76I3S.js → chunk-NVF3PADP.js} +29 -1
  5. package/dist/{chunk-NTOLHLCL.js → chunk-QGXILDWB.js} +1 -1
  6. package/dist/{chunk-CNCFMPEH.js → chunk-TJMS3YOR.js} +1 -1
  7. package/dist/{chunk-SGAIDL63.js → chunk-U5MBAKS5.js} +21 -7
  8. package/dist/cli-entry.d.cts +1 -1
  9. package/dist/cli-entry.d.ts +1 -1
  10. package/dist/{contract-types-jSa1g28F.d.cts → contract-types-C1scOS_M.d.cts} +218 -21
  11. package/dist/{contract-types-jSa1g28F.d.ts → contract-types-C1scOS_M.d.ts} +218 -21
  12. package/dist/env.cjs +5 -10
  13. package/dist/env.d.cts +6 -17
  14. package/dist/env.d.ts +6 -17
  15. package/dist/env.js +1 -1
  16. package/dist/{error-codes-f-UO4a8D.d.cts → error-codes-CgcjlmeD.d.cts} +42 -6
  17. package/dist/{error-codes-DnFru4L4.d.ts → error-codes-o4rNd1Ee.d.ts} +42 -6
  18. package/dist/index.cjs +178 -103
  19. package/dist/index.d.cts +29 -41
  20. package/dist/index.d.ts +29 -41
  21. package/dist/index.js +54 -57
  22. package/dist/journal-io.d.cts +1 -1
  23. package/dist/journal-io.d.ts +1 -1
  24. package/dist/journal-replay.cjs +24 -7
  25. package/dist/journal-replay.d.cts +41 -7
  26. package/dist/journal-replay.d.ts +41 -7
  27. package/dist/journal-replay.js +7 -1
  28. package/dist/kill-chain.d.cts +5 -5
  29. package/dist/kill-chain.d.ts +5 -5
  30. package/dist/kill-chain.js +2 -2
  31. package/dist/logger.d.cts +1 -1
  32. package/dist/logger.d.ts +1 -1
  33. package/dist/logs/stderr-rotation.d.cts +4 -4
  34. package/dist/logs/stderr-rotation.d.ts +4 -4
  35. package/dist/{methods-BLxg4ZFr.d.cts → methods-BzvzcCrB.d.cts} +5 -5
  36. package/dist/{methods-C2zvZqhP.d.ts → methods-CPMc4cvF.d.ts} +5 -5
  37. package/dist/node-executor.cjs +1 -1
  38. package/dist/node-executor.d.cts +4 -4
  39. package/dist/node-executor.d.ts +4 -4
  40. package/dist/node-executor.js +2 -2
  41. package/dist/port-contract.d.cts +9 -9
  42. package/dist/port-contract.d.ts +9 -9
  43. package/dist/protocol/index.cjs +103 -5
  44. package/dist/protocol/index.d.cts +59 -16
  45. package/dist/protocol/index.d.ts +59 -16
  46. package/dist/protocol/index.js +30 -2
  47. package/dist/server/index.cjs +1 -1
  48. package/dist/server/index.d.cts +10 -10
  49. package/dist/server/index.d.ts +10 -10
  50. package/dist/server/index.js +1 -1
  51. package/dist/spawn.cjs +32 -3
  52. package/dist/spawn.d.cts +34 -8
  53. package/dist/spawn.d.ts +34 -8
  54. package/dist/spawn.js +5 -3
  55. package/dist/ui-types.d.cts +2 -2
  56. package/dist/ui-types.d.ts +2 -2
  57. package/package.json +13 -2
  58. package/dist/chunk-GSW3DMN6.js +0 -39
  59. package/dist/relay-env.cjs +0 -71
  60. package/dist/relay-env.d.cts +0 -37
  61. package/dist/relay-env.d.ts +0 -37
  62. package/dist/relay-env.js +0 -23
@@ -1,7 +1,18 @@
1
- import { T as Turn, a as AgentUsageTotal, A as AgentEvent, S as SessionView, E as EngineHandleData, R as ReplayedTurn } from './contract-types-jSa1g28F.js';
1
+ import { T as Turn, a as AgentUsage, b as AgentUsageTotal, A as AgentEvent, S as SessionView, E as EngineHandleData, R as ReplayedTurn } from './contract-types-C1scOS_M.js';
2
2
 
3
3
  /**
4
- * reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这四个字段)。
4
+ * 轮失败事实(subagent-observability §3.3.5:失败事实只追加进 errors 数组,
5
+ * lastError 由「最后一个非空轮失败」派生——数组只追加且空串不入账,
6
+ * 尾项即最后一个非空失败)。事实源记录,append-only,不因后续轮终清除。
7
+ */
8
+ interface ErrorFact {
9
+ /** 错误消息原文(空串 / 缺席不入账——无信息失败事实不占位)。 */
10
+ message: string;
11
+ /** 事实落账墙钟(Date.now(),ms)。 */
12
+ at: number;
13
+ }
14
+ /**
15
+ * reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这五个字段)。
5
16
  * core ExecutionRecord 满足本视图(W2 断言挂靠点);SDK 内自持 createReplayRecord 产出。
6
17
  */
7
18
  interface ReplayRecordView {
@@ -9,19 +20,42 @@ interface ReplayRecordView {
9
20
  turnCount: number;
10
21
  totalTokens: number;
11
22
  lastError: string | undefined;
23
+ /**
24
+ * 轮失败事实只追加数组(§3.3.5)。缺省 undefined 视为空(磁盘重建的旧 record
25
+ * 兼容——reducer 以 `??=` 兜底初始化,不要求构造方预置)。
26
+ */
27
+ errors?: ErrorFact[];
12
28
  }
29
+ /**
30
+ * 累加两个 AgentUsage(field-wise)。prev 为空时返回 next 的拷贝。
31
+ * 供 message_end 把 usage 增量并入 turn.usageDelta。
32
+ */
33
+ declare function addUsage(prev: AgentUsage | undefined, next: AgentUsage): AgentUsage;
34
+ /** 创建一个空 turn(text/thinking 空,无 toolCalls,未结束)。 */
35
+ declare function emptyTurn(): Turn;
13
36
  /** 重放场景的 record 构造(对齐 core eventsToSessionView 内 createRecord 后的 reducer 视图)。 */
14
37
  declare function createReplayRecord(): ReplayRecordView;
15
38
  /**
16
- * 从 AgentEvent 更新 record。所有数据收口进 record.turns[]。
39
+ * [§3.3.5] 轮失败事实入账单点:append ErrorFact + lastError 派生刷新(唯一写点)。
40
+ * 空串 / 缺席不入账(无信息失败事实不占位);`??=` 兜底磁盘重建的旧 record
41
+ * (无 errors 字段,缺省 undefined 视为空)。lastError = 最后追加的非空 message
42
+ * ——数组 append-only 且项非空,尾项即「最后一个非空轮失败」。
43
+ *
44
+ * [subagent-observability u3] 导出给 core 轮终写点(record-store-rounds 失败轮
45
+ * settlement)复用——u2 移交的「markRoundIdle 直写 rec.lastError 绕过 errors 数组」
46
+ * 收编:轮终失败事实与流内 error 事件走同一入账通道,写点单点(双写漂移防线)。
47
+ */
48
+ declare function appendErrorFact(record: ReplayRecordView, message: string | undefined | null): void;
49
+ /**
50
+ * 从 AgentEvent 更新 record。所有数据收敛进 record.turns[]。
17
51
  * - text/thinking:流式累积进 currentTurn()(完整内容,非切片)
18
52
  * - tool_start/end:push 进 currentTurn().toolCalls(含完整 result)
19
53
  * tool_end 跨 turn 扫描找 running 同名 toolCall(兜底滞后事件)
20
- * - turn_end:闭合当前 turn,记 closedTs(真实墙钟,供 getEventLog);
21
- * 正常闭合清 lastError(瞬态 error 恢复后不应误判 success=false)
54
+ * - turn_end:结束当前 turn,记 closedTs(真实墙钟,供 getEventLog);
55
+ * 不再清 lastError(§3.3.5——error → turn_end 序后 lastError 仍可读)
22
56
  * - message_end:usage 增量存进末 turn.usageDelta(直接写末 turn,不开新 turn);
23
57
  * totalTokens 累加
24
- * - error:存 record.lastError(getEventLog 派生 error 条目用)
58
+ * - error:经 appendErrorFact 入账(errors 只追加 + lastError 派生刷新)
25
59
  *
26
60
  * 唯一写点——replay 与 live 共用(重放等价性的实现体)。
27
61
  *
@@ -42,4 +76,4 @@ declare function eventsToSessionView(events: readonly AgentEvent[], engineId: st
42
76
  /** handle.sessionRef 的 sessionId 提取(引擎自定义键,运行时 guard)。 */
43
77
  declare function sessionIdFromHandle(handle: EngineHandleData): string | undefined;
44
78
 
45
- export { type ReplayRecordView, aggregateUsage, createReplayRecord, eventsToSessionView, sessionIdFromHandle, toReplayedTurn, updateFromEvent };
79
+ export { type ErrorFact, type ReplayRecordView, addUsage, aggregateUsage, appendErrorFact, createReplayRecord, emptyTurn, eventsToSessionView, sessionIdFromHandle, toReplayedTurn, updateFromEvent };
@@ -1,15 +1,21 @@
1
1
  import {
2
+ addUsage,
2
3
  aggregateUsage,
4
+ appendErrorFact,
3
5
  createReplayRecord,
6
+ emptyTurn,
4
7
  eventsToSessionView,
5
8
  sessionIdFromHandle,
6
9
  toReplayedTurn,
7
10
  updateFromEvent
8
- } from "./chunk-SGAIDL63.js";
11
+ } from "./chunk-U5MBAKS5.js";
9
12
  import "./chunk-JSBRDJBE.js";
10
13
  export {
14
+ addUsage,
11
15
  aggregateUsage,
16
+ appendErrorFact,
12
17
  createReplayRecord,
18
+ emptyTurn,
13
19
  eventsToSessionView,
14
20
  sessionIdFromHandle,
15
21
  toReplayedTurn,
@@ -1,4 +1,4 @@
1
- import { b as AgentCallOpts, c as AgentOutcome } from './contract-types-jSa1g28F.cjs';
1
+ import { c as AgentCallOpts, d as AgentOutcome } from './contract-types-C1scOS_M.cjs';
2
2
 
3
3
  /**
4
4
  * 可杀子进程的结构形状(Node ChildProcess 的结构子集)。
@@ -49,7 +49,7 @@ declare function killChain(child: KillableChild, opts: KillChainOptions): Promis
49
49
  /**
50
50
  * 发信号兜底包裹:进程恰在退出态检查与 kill 之间自退时,ChildProcess.kill 可能抛
51
51
  * (zsub 实测经验)——幂等吞掉并 debug 留痕,不阻断杀链语义(对已退进程信号本就是
52
- * no-op)。收口自 zcode launcher 的内联实现(对齐点②:单一权威)。
52
+ * no-op)。收敛自 zcode launcher 的内联实现(对齐点②:单一权威)。
53
53
  */
54
54
  declare function safeKill(child: KillableChild, signal: NodeJS.Signals): void;
55
55
  /**
@@ -64,7 +64,7 @@ declare function probePidAlive(pid: number): boolean | undefined;
64
64
  interface PidChainOptions {
65
65
  /**
66
66
  * SIGTERM 优雅窗口(ms)。缺省 DEFAULT_KILL_GRACE_MS。回收场景的调用方通常
67
- * 已先行优雅停止(cancel 帧 SIGTERM),本窗只是宿主侧升级兜底,量级沿用组杀
67
+ * 已先行优雅停止(cancel 帧 SIGTERM),本窗只是宿主侧升级兜底,量级沿用按进程组终止
68
68
  * 收割惯例(5s)。
69
69
  */
70
70
  graceMs?: number;
@@ -73,8 +73,8 @@ interface PidChainOptions {
73
73
  }
74
74
  /**
75
75
  * [D9-2 半径收窄原语] run 级 pid 杀链:SIGTERM → graceMs → 仍存活则 SIGKILL,
76
- * **只打单 pid,绝不组杀**(宿主对引擎孙进程只持镜像 pid、不持 ChildProcess——
77
- * 引擎以 detached:true 自成进程组,孙进程在其组内而非自任组长,负 pid 组杀不可达;
76
+ * **只打单 pid,绝不按进程组终止**(宿主对引擎孙进程只持镜像 pid、不持 ChildProcess——
77
+ * 引擎以 detached:true 自成进程组,孙进程在其组内而非自任组长,负 pid 按进程组终止不可达;
78
78
  * 本原语逐 pid 退化单杀,语义 = 「该 run 的进程拓扑」而非引擎组)。
79
79
  *
80
80
  * fire-and-forget:宿主非进程持有方,无 exit 事件可等(对齐 core reaper 的
@@ -1,4 +1,4 @@
1
- import { b as AgentCallOpts, c as AgentOutcome } from './contract-types-jSa1g28F.js';
1
+ import { c as AgentCallOpts, d as AgentOutcome } from './contract-types-C1scOS_M.js';
2
2
 
3
3
  /**
4
4
  * 可杀子进程的结构形状(Node ChildProcess 的结构子集)。
@@ -49,7 +49,7 @@ declare function killChain(child: KillableChild, opts: KillChainOptions): Promis
49
49
  /**
50
50
  * 发信号兜底包裹:进程恰在退出态检查与 kill 之间自退时,ChildProcess.kill 可能抛
51
51
  * (zsub 实测经验)——幂等吞掉并 debug 留痕,不阻断杀链语义(对已退进程信号本就是
52
- * no-op)。收口自 zcode launcher 的内联实现(对齐点②:单一权威)。
52
+ * no-op)。收敛自 zcode launcher 的内联实现(对齐点②:单一权威)。
53
53
  */
54
54
  declare function safeKill(child: KillableChild, signal: NodeJS.Signals): void;
55
55
  /**
@@ -64,7 +64,7 @@ declare function probePidAlive(pid: number): boolean | undefined;
64
64
  interface PidChainOptions {
65
65
  /**
66
66
  * SIGTERM 优雅窗口(ms)。缺省 DEFAULT_KILL_GRACE_MS。回收场景的调用方通常
67
- * 已先行优雅停止(cancel 帧 SIGTERM),本窗只是宿主侧升级兜底,量级沿用组杀
67
+ * 已先行优雅停止(cancel 帧 SIGTERM),本窗只是宿主侧升级兜底,量级沿用按进程组终止
68
68
  * 收割惯例(5s)。
69
69
  */
70
70
  graceMs?: number;
@@ -73,8 +73,8 @@ interface PidChainOptions {
73
73
  }
74
74
  /**
75
75
  * [D9-2 半径收窄原语] run 级 pid 杀链:SIGTERM → graceMs → 仍存活则 SIGKILL,
76
- * **只打单 pid,绝不组杀**(宿主对引擎孙进程只持镜像 pid、不持 ChildProcess——
77
- * 引擎以 detached:true 自成进程组,孙进程在其组内而非自任组长,负 pid 组杀不可达;
76
+ * **只打单 pid,绝不按进程组终止**(宿主对引擎孙进程只持镜像 pid、不持 ChildProcess——
77
+ * 引擎以 detached:true 自成进程组,孙进程在其组内而非自任组长,负 pid 按进程组终止不可达;
78
78
  * 本原语逐 pid 退化单杀,语义 = 「该 run 的进程拓扑」而非引擎组)。
79
79
  *
80
80
  * fire-and-forget:宿主非进程持有方,无 exit 事件可等(对齐 core reaper 的
@@ -8,9 +8,9 @@ import {
8
8
  probePidAlive,
9
9
  safeKill,
10
10
  synthesizeTimeoutOutcome
11
- } from "./chunk-CNCFMPEH.js";
11
+ } from "./chunk-TJMS3YOR.js";
12
12
  import "./chunk-PYO3YR7W.js";
13
- import "./chunk-JZN76I3S.js";
13
+ import "./chunk-NVF3PADP.js";
14
14
  import "./chunk-NXNNXGTY.js";
15
15
  import "./chunk-JSBRDJBE.js";
16
16
  export {
package/dist/logger.d.cts CHANGED
@@ -6,7 +6,7 @@ interface LoggerSink {
6
6
  }
7
7
  /** 日志级别。对齐 core logger 的 LogLevel(三值,无 info)。 */
8
8
  type LogLevel = "debug" | "warn" | "error";
9
- /** logger 接口。与 core CoreLogger 结构兼容——迁移调用面(方法名/参数序)逐文件等价。 */
9
+ /** logger 接口。与 core CoreLogger 结构兼容——迁移调用范围(方法名/参数序)逐文件等价。 */
10
10
  interface CoreLogger {
11
11
  debug(msg: string, data?: unknown): void;
12
12
  warn(msg: string, data?: unknown): void;
package/dist/logger.d.ts CHANGED
@@ -6,7 +6,7 @@ interface LoggerSink {
6
6
  }
7
7
  /** 日志级别。对齐 core logger 的 LogLevel(三值,无 info)。 */
8
8
  type LogLevel = "debug" | "warn" | "error";
9
- /** logger 接口。与 core CoreLogger 结构兼容——迁移调用面(方法名/参数序)逐文件等价。 */
9
+ /** logger 接口。与 core CoreLogger 结构兼容——迁移调用范围(方法名/参数序)逐文件等价。 */
10
10
  interface CoreLogger {
11
11
  debug(msg: string, data?: unknown): void;
12
12
  warn(msg: string, data?: unknown): void;
@@ -1,12 +1,12 @@
1
1
  declare const DEFAULT_STDERR_MAX_BYTES: number;
2
2
  /** 缺省保留天数(与宿主 logger 同源缺省:7 天)。 */
3
3
  declare const DEFAULT_STDERR_KEEP_DAYS = 7;
4
- /** 轮转参数(env 覆盖面 = 宿主 logger 同款 TAIJI_LOG_* 两键)。 */
4
+ /** 轮转参数(env 覆盖范围 = 宿主 logger 同款 TAIJI_LOG_* 两键)。 */
5
5
  interface StderrRotationParams {
6
6
  maxBytes: number;
7
7
  keepDays: number;
8
8
  }
9
- /** 读 env 解析轮转参数(非法值回缺省——取证面配置不拖垮主通道)。 */
9
+ /** 读 env 解析轮转参数(非法值回缺省——取证侧配置不拖垮主通道)。 */
10
10
  declare function stderrRotationParams(env: NodeJS.ProcessEnv): StderrRotationParams;
11
11
  /** 实例维度 stderr tee 路径:<engineDataDir>/logs/<prefix><pid>.log。 */
12
12
  declare function stderrLogPathFor(engineDataDir: string, pid: number, prefix: string): string;
@@ -17,7 +17,7 @@ declare function isPidAlive(pid: number): boolean;
17
17
  /**
18
18
  * 尺寸轮转:当前文件超过 maxBytes 时 rename 为 `<path>.<时间戳>` 副本并返回
19
19
  * true(调用方懒重开新文件继续 append)。rename 失败返回 false(继续 append 原
20
- * 文件——轮转是取证面优化,不是主通道)。
20
+ * 文件——轮转是取证侧优化,不是主通道)。
21
21
  */
22
22
  declare function rotateStderrLogIfNeeded(path: string, params: StderrRotationParams): boolean;
23
23
  interface CleanupResult {
@@ -28,7 +28,7 @@ interface CleanupResult {
28
28
  }
29
29
  /**
30
30
  * 过期清理:扫描 logsDir 下同前缀文件,三判据同时成立才删。目录缺失/读失败返回
31
- * 零删除(取证面 best-effort)。
31
+ * 零删除(取证侧 best-effort)。
32
32
  */
33
33
  declare function cleanupStaleStderrLogs(logsDir: string, env: NodeJS.ProcessEnv, prefix: string, now?: number): CleanupResult;
34
34
  /** 便捷入口:对 tee 路径所在 logs 目录做过期清理(流打开时机调用,每代一次)。 */
@@ -1,12 +1,12 @@
1
1
  declare const DEFAULT_STDERR_MAX_BYTES: number;
2
2
  /** 缺省保留天数(与宿主 logger 同源缺省:7 天)。 */
3
3
  declare const DEFAULT_STDERR_KEEP_DAYS = 7;
4
- /** 轮转参数(env 覆盖面 = 宿主 logger 同款 TAIJI_LOG_* 两键)。 */
4
+ /** 轮转参数(env 覆盖范围 = 宿主 logger 同款 TAIJI_LOG_* 两键)。 */
5
5
  interface StderrRotationParams {
6
6
  maxBytes: number;
7
7
  keepDays: number;
8
8
  }
9
- /** 读 env 解析轮转参数(非法值回缺省——取证面配置不拖垮主通道)。 */
9
+ /** 读 env 解析轮转参数(非法值回缺省——取证侧配置不拖垮主通道)。 */
10
10
  declare function stderrRotationParams(env: NodeJS.ProcessEnv): StderrRotationParams;
11
11
  /** 实例维度 stderr tee 路径:<engineDataDir>/logs/<prefix><pid>.log。 */
12
12
  declare function stderrLogPathFor(engineDataDir: string, pid: number, prefix: string): string;
@@ -17,7 +17,7 @@ declare function isPidAlive(pid: number): boolean;
17
17
  /**
18
18
  * 尺寸轮转:当前文件超过 maxBytes 时 rename 为 `<path>.<时间戳>` 副本并返回
19
19
  * true(调用方懒重开新文件继续 append)。rename 失败返回 false(继续 append 原
20
- * 文件——轮转是取证面优化,不是主通道)。
20
+ * 文件——轮转是取证侧优化,不是主通道)。
21
21
  */
22
22
  declare function rotateStderrLogIfNeeded(path: string, params: StderrRotationParams): boolean;
23
23
  interface CleanupResult {
@@ -28,7 +28,7 @@ interface CleanupResult {
28
28
  }
29
29
  /**
30
30
  * 过期清理:扫描 logsDir 下同前缀文件,三判据同时成立才删。目录缺失/读失败返回
31
- * 零删除(取证面 best-effort)。
31
+ * 零删除(取证侧 best-effort)。
32
32
  */
33
33
  declare function cleanupStaleStderrLogs(logsDir: string, env: NodeJS.ProcessEnv, prefix: string, now?: number): CleanupResult;
34
34
  /** 便捷入口:对 tee 路径所在 logs 目录做过期清理(流打开时机调用,每代一次)。 */
@@ -1,4 +1,4 @@
1
- import { M as ModelRef, d as EngineCapabilities, f as ModelCatalogEntry, b as AgentCallOpts, e as ResumeAnchor, E as EngineHandleData, P as ProbeReport, c as AgentOutcome, S as SessionView } from './contract-types-jSa1g28F.cjs';
1
+ import { M as ModelRef, e as EngineCapabilities, g as ModelCatalogEntry, c as AgentCallOpts, f as ResumeAnchor, E as EngineHandleData, P as ProbeReport, d as AgentOutcome, S as SessionView } from './contract-types-C1scOS_M.cjs';
2
2
 
3
3
  /**
4
4
  * 正向方法名联合(恰好 10 个;PROTOCOL_METHODS 常量数组与之同源互证)。
@@ -24,7 +24,7 @@ interface RunContextParams {
24
24
  /** 事件粒度请求(引擎按 capabilities.eventGranularity 实际能力执行)。 */
25
25
  streamMode?: "stream" | "coarse";
26
26
  /**
27
- * [F6] 根 session id——pi 引擎 relay 归属键 SESSION_ID 的权威来源(生产三来源
27
+ * [F6] 根 session id——pi 引擎 engine_open 归属键的权威来源(生产三来源
28
28
  * ①本字段 ②宿主 env ③根进程 env 中,宿主派发恒走①)。additive 可选:旧引擎忽略
29
29
  * 未知字段,undefined 不上 wire。
30
30
  */
@@ -94,14 +94,14 @@ interface InitializeParams {
94
94
  };
95
95
  engineConfig: Record<string, string>;
96
96
  }
97
- /** initialize 应答(仅诊断面:capabilities/models 与 manifest 不一致 → warn,不参与判据)。 */
97
+ /** initialize 应答(仅诊断范围:capabilities/models 与 manifest 不一致 → warn,不参与判据)。 */
98
98
  interface InitializeResult {
99
99
  protocolVersion: number;
100
100
  engineId: string;
101
101
  engineVersion: string;
102
102
  adapterVersion: string;
103
103
  capabilities: EngineCapabilities;
104
- /** 模型目录(诊断面;省略/null = 无枚举面语义)。 */
104
+ /** 模型目录(诊断范围;省略/null = 无枚举情形语义)。 */
105
105
  models?: ModelCatalogEntry[] | null;
106
106
  }
107
107
  interface ProbeParams {
@@ -147,7 +147,7 @@ interface ListModelsParams {
147
147
  _placeholder?: never;
148
148
  }
149
149
  interface ListModelsResult {
150
- /** 数组 = 有枚举面;null = 无枚举面(buildCoreAlignedHint 语义,与 manifest 省略对齐)。 */
150
+ /** 数组 = 有枚举;null = 无枚举情形(buildCoreAlignedHint 语义,与 manifest 省略对齐)。 */
151
151
  models: ModelCatalogEntry[] | null;
152
152
  }
153
153
  interface ValidateModelParams {
@@ -1,4 +1,4 @@
1
- import { M as ModelRef, d as EngineCapabilities, f as ModelCatalogEntry, b as AgentCallOpts, e as ResumeAnchor, E as EngineHandleData, P as ProbeReport, c as AgentOutcome, S as SessionView } from './contract-types-jSa1g28F.js';
1
+ import { M as ModelRef, e as EngineCapabilities, g as ModelCatalogEntry, c as AgentCallOpts, f as ResumeAnchor, E as EngineHandleData, P as ProbeReport, d as AgentOutcome, S as SessionView } from './contract-types-C1scOS_M.js';
2
2
 
3
3
  /**
4
4
  * 正向方法名联合(恰好 10 个;PROTOCOL_METHODS 常量数组与之同源互证)。
@@ -24,7 +24,7 @@ interface RunContextParams {
24
24
  /** 事件粒度请求(引擎按 capabilities.eventGranularity 实际能力执行)。 */
25
25
  streamMode?: "stream" | "coarse";
26
26
  /**
27
- * [F6] 根 session id——pi 引擎 relay 归属键 SESSION_ID 的权威来源(生产三来源
27
+ * [F6] 根 session id——pi 引擎 engine_open 归属键的权威来源(生产三来源
28
28
  * ①本字段 ②宿主 env ③根进程 env 中,宿主派发恒走①)。additive 可选:旧引擎忽略
29
29
  * 未知字段,undefined 不上 wire。
30
30
  */
@@ -94,14 +94,14 @@ interface InitializeParams {
94
94
  };
95
95
  engineConfig: Record<string, string>;
96
96
  }
97
- /** initialize 应答(仅诊断面:capabilities/models 与 manifest 不一致 → warn,不参与判据)。 */
97
+ /** initialize 应答(仅诊断范围:capabilities/models 与 manifest 不一致 → warn,不参与判据)。 */
98
98
  interface InitializeResult {
99
99
  protocolVersion: number;
100
100
  engineId: string;
101
101
  engineVersion: string;
102
102
  adapterVersion: string;
103
103
  capabilities: EngineCapabilities;
104
- /** 模型目录(诊断面;省略/null = 无枚举面语义)。 */
104
+ /** 模型目录(诊断范围;省略/null = 无枚举情形语义)。 */
105
105
  models?: ModelCatalogEntry[] | null;
106
106
  }
107
107
  interface ProbeParams {
@@ -147,7 +147,7 @@ interface ListModelsParams {
147
147
  _placeholder?: never;
148
148
  }
149
149
  interface ListModelsResult {
150
- /** 数组 = 有枚举面;null = 无枚举面(buildCoreAlignedHint 语义,与 manifest 省略对齐)。 */
150
+ /** 数组 = 有枚举;null = 无枚举情形(buildCoreAlignedHint 语义,与 manifest 省略对齐)。 */
151
151
  models: ModelCatalogEntry[] | null;
152
152
  }
153
153
  interface ValidateModelParams {
@@ -67,7 +67,7 @@ var EngineSdkError = class extends Error {
67
67
  this.recovery = recovery;
68
68
  this.data = data;
69
69
  }
70
- /** 协议 error 帧载荷投影。 */
70
+ /** 协议 error 帧载荷派生视图。 */
71
71
  toStructured() {
72
72
  return { code: this.code, message: this.message, recovery: this.recovery, data: this.data };
73
73
  }
@@ -1,14 +1,14 @@
1
- /** L0 注入的引擎执行器路径 env(与 relay 的 TAIJI_SUBAGENT_RELAY_NODE 不复用)。 */
1
+ /** L0 注入的引擎执行器路径 env。 */
2
2
  declare const ENGINE_NODE_ENV = "TAIJI_AGENT_ENGINE_NODE";
3
3
  /**
4
- * 探针:验证执行器能以纯 node 语义执行 JS(先例 = runtime relay-env.ts:47-90)。
4
+ * 探针:验证执行器能以纯 node 语义执行 JS。
5
5
  *
6
6
  * 为什么需要:打包态 pi 宿主的候选执行器可能是 Electron 二进制——直接当 node 用会
7
7
  * 拉起 GUI,必须同 env 注入 ELECTRON_RUN_AS_NODE=1 才是纯 node 模式;探针被证伪则
8
8
  * 按矩阵① 报 engine_not_found(带可操作指引),不静默回落 PATH 探测。
9
9
  */
10
10
  declare function probeNodeExecutor(execPath: string, isElectron: boolean): Promise<boolean>;
11
- /** 测试钩子:清探针缓存(生产无调用方;与 relay-env resetRelayNodeProbeCache 同款)。 */
11
+ /** 测试钩子:清探针缓存(生产无调用方)。 */
12
12
  declare function resetEngineNodeProbeCache(): void;
13
13
  /** 宿主形态(矩阵行;EngineClient 的 hostKind 自由字符串经 hostKindOf 归一)。 */
14
14
  type EngineNodeHostKind = "pi-extension" | "runtime-sidecar" | "standalone";
@@ -41,7 +41,7 @@ interface EngineNodeLaunch {
41
41
  * (EngineClient / runtime)持有各自的平台参数(detached / 进程组收割语义)。
42
42
  *
43
43
  * 判定序(与规格逐行对应):
44
- * Windows + entry .cmd → cmd.exe /c 显式形态(禁 shell:true 的注入面);
44
+ * Windows + entry .cmd → cmd.exe /c 显式形态(禁 shell:true 的注入通道);
45
45
  * pi-extension → 注入执行器(env TAIJI_AGENT_ENGINE_NODE),缺失/探针失败 =
46
46
  * engine_not_found + 指引;
47
47
  * runtime-sidecar → process.execPath(Electron 时 electronRunAsNode,探针先行);
@@ -1,14 +1,14 @@
1
- /** L0 注入的引擎执行器路径 env(与 relay 的 TAIJI_SUBAGENT_RELAY_NODE 不复用)。 */
1
+ /** L0 注入的引擎执行器路径 env。 */
2
2
  declare const ENGINE_NODE_ENV = "TAIJI_AGENT_ENGINE_NODE";
3
3
  /**
4
- * 探针:验证执行器能以纯 node 语义执行 JS(先例 = runtime relay-env.ts:47-90)。
4
+ * 探针:验证执行器能以纯 node 语义执行 JS。
5
5
  *
6
6
  * 为什么需要:打包态 pi 宿主的候选执行器可能是 Electron 二进制——直接当 node 用会
7
7
  * 拉起 GUI,必须同 env 注入 ELECTRON_RUN_AS_NODE=1 才是纯 node 模式;探针被证伪则
8
8
  * 按矩阵① 报 engine_not_found(带可操作指引),不静默回落 PATH 探测。
9
9
  */
10
10
  declare function probeNodeExecutor(execPath: string, isElectron: boolean): Promise<boolean>;
11
- /** 测试钩子:清探针缓存(生产无调用方;与 relay-env resetRelayNodeProbeCache 同款)。 */
11
+ /** 测试钩子:清探针缓存(生产无调用方)。 */
12
12
  declare function resetEngineNodeProbeCache(): void;
13
13
  /** 宿主形态(矩阵行;EngineClient 的 hostKind 自由字符串经 hostKindOf 归一)。 */
14
14
  type EngineNodeHostKind = "pi-extension" | "runtime-sidecar" | "standalone";
@@ -41,7 +41,7 @@ interface EngineNodeLaunch {
41
41
  * (EngineClient / runtime)持有各自的平台参数(detached / 进程组收割语义)。
42
42
  *
43
43
  * 判定序(与规格逐行对应):
44
- * Windows + entry .cmd → cmd.exe /c 显式形态(禁 shell:true 的注入面);
44
+ * Windows + entry .cmd → cmd.exe /c 显式形态(禁 shell:true 的注入通道);
45
45
  * pi-extension → 注入执行器(env TAIJI_AGENT_ENGINE_NODE),缺失/探针失败 =
46
46
  * engine_not_found + 指引;
47
47
  * runtime-sidecar → process.execPath(Electron 时 electronRunAsNode,探针先行);
@@ -4,8 +4,8 @@ import {
4
4
  probeNodeExecutor,
5
5
  resetEngineNodeProbeCache,
6
6
  resolveEngineNodeLaunch
7
- } from "./chunk-NTOLHLCL.js";
8
- import "./chunk-JZN76I3S.js";
7
+ } from "./chunk-QGXILDWB.js";
8
+ import "./chunk-NVF3PADP.js";
9
9
  import "./chunk-JSBRDJBE.js";
10
10
  export {
11
11
  ENGINE_NODE_ENV,
@@ -1,8 +1,8 @@
1
- import { b as AgentCallOpts, E as EngineHandleData, d as EngineCapabilities, P as ProbeReport, A as AgentEvent, e as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-jSa1g28F.cjs';
2
- import { S as SetModelParams, a as SetModelResult } from './methods-BLxg4ZFr.cjs';
1
+ import { c as AgentCallOpts, E as EngineHandleData, e as EngineCapabilities, P as ProbeReport, A as AgentEvent, f as ResumeAnchor, d as AgentOutcome, S as SessionView } from './contract-types-C1scOS_M.cjs';
2
+ import { S as SetModelParams, a as SetModelResult } from './methods-BzvzcCrB.cjs';
3
3
 
4
4
  /**
5
- * 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎面子集 + 协议 ctx 还原字段(model/
5
+ * 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎侧子集 + 协议 ctx 还原字段(model/
6
6
  * cwd——SDK 契约把它们从 task 移到 run.params.ctx,进程内接口合回单对象;
7
7
  * server.ts 做 ctx→task 还原,与 core RemoteEngine.toSdkTaskSubset 镜像)。
8
8
  */
@@ -12,7 +12,7 @@ type EngineAgentCallOpts = AgentCallOpts & {
12
12
  };
13
13
  /**
14
14
  * 引擎进程内的 ctxModel 形态(core ModelInfo 的结构等价镜像——仅 id/provider 被引擎
15
- * 消费,name/reasoning 等字段透传保留防测试/未来消费面漂移)。
15
+ * 消费,name/reasoning 等字段透传保留防测试/未来消费方漂移)。
16
16
  */
17
17
  interface EngineCtxModel {
18
18
  id: string;
@@ -30,11 +30,11 @@ interface EngineStream {
30
30
  * journal 固定分组 key(值锚定,**只承载、不透传**):journal 落盘路径
31
31
  * `<dataDir>/engines/<engineId>/<本值>/journal-<taskId>.jsonl` 的第二段,两引擎恒
32
32
  * 本值(pi / zcode 均无池化实现——pi = PI_CODING_AGENT_DIR 全局一份,zcode = 共享
33
- * 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议面(RunContext/run.params.ctx/
33
+ * 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议范围(RunContext/run.params.ctx/
34
34
  * host/poolResolved 通道/EngineHandleData)已整体退役,本常量不再跨进程透传,仅
35
35
  * 三类消费:① journal 落盘路径构造(core event-journal-wiring);② 存量 record 兼容
36
36
  * (zcode read 旧相对 dbPath 的锚定分支 + 持久化 engineHandle.poolKey 字段——
37
- * record-store 读侧守卫要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
37
+ * record-store 读侧检查要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
38
38
  * 的签名参数。**值逐字不变**(存量 journal 落盘路径与记录含该值分段,改名不改值)。
39
39
  */
40
40
  declare const SHARED_POOL_KEY = "shared";
@@ -47,7 +47,7 @@ interface RunContext {
47
47
  stream?: EngineStream;
48
48
  /**
49
49
  * [F6] 根 session id(协议 run.params.ctx.sessionRootId 的进程内还原)——pi 引擎
50
- * relay 归属键 SESSION_ID 的权威来源。additive 可选:宿主缺省不传。
50
+ * engine_open 归属键的权威来源。additive 可选:宿主缺省不传。
51
51
  */
52
52
  sessionRootId?: string;
53
53
  /**
@@ -75,7 +75,7 @@ interface RunContext {
75
75
  mode?: string;
76
76
  };
77
77
  onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef">) => void;
78
- /** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议面)。 */
78
+ /** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议范围)。 */
79
79
  onChildSpawned?: (child: {
80
80
  pid: number | undefined;
81
81
  killed: boolean;
@@ -127,7 +127,7 @@ interface EnginePort {
127
127
  canonicalRef: string;
128
128
  };
129
129
  /**
130
- * [subagent-model-switch §7.3] 可选面:执行中模型热切换(协议 setModel 正向方法的
130
+ * [subagent-model-switch §7.3] 可选能力:执行中模型热切换(协议 setModel 正向方法的
131
131
  * 进程内承载)。实现引擎须 capabilities.setModel = 'native' 同批声明(位与方法
132
132
  * 成对进出——capabilities 注释的消费点登记);server 分发行在位非 native 时回
133
133
  * engineSetModelUnsupportedError 结构化错误(契约行为 = 明确错误而非崩)。
@@ -1,8 +1,8 @@
1
- import { b as AgentCallOpts, E as EngineHandleData, d as EngineCapabilities, P as ProbeReport, A as AgentEvent, e as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-jSa1g28F.js';
2
- import { S as SetModelParams, a as SetModelResult } from './methods-C2zvZqhP.js';
1
+ import { c as AgentCallOpts, E as EngineHandleData, e as EngineCapabilities, P as ProbeReport, A as AgentEvent, f as ResumeAnchor, d as AgentOutcome, S as SessionView } from './contract-types-C1scOS_M.js';
2
+ import { S as SetModelParams, a as SetModelResult } from './methods-CPMc4cvF.js';
3
3
 
4
4
  /**
5
- * 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎面子集 + 协议 ctx 还原字段(model/
5
+ * 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎侧子集 + 协议 ctx 还原字段(model/
6
6
  * cwd——SDK 契约把它们从 task 移到 run.params.ctx,进程内接口合回单对象;
7
7
  * server.ts 做 ctx→task 还原,与 core RemoteEngine.toSdkTaskSubset 镜像)。
8
8
  */
@@ -12,7 +12,7 @@ type EngineAgentCallOpts = AgentCallOpts & {
12
12
  };
13
13
  /**
14
14
  * 引擎进程内的 ctxModel 形态(core ModelInfo 的结构等价镜像——仅 id/provider 被引擎
15
- * 消费,name/reasoning 等字段透传保留防测试/未来消费面漂移)。
15
+ * 消费,name/reasoning 等字段透传保留防测试/未来消费方漂移)。
16
16
  */
17
17
  interface EngineCtxModel {
18
18
  id: string;
@@ -30,11 +30,11 @@ interface EngineStream {
30
30
  * journal 固定分组 key(值锚定,**只承载、不透传**):journal 落盘路径
31
31
  * `<dataDir>/engines/<engineId>/<本值>/journal-<taskId>.jsonl` 的第二段,两引擎恒
32
32
  * 本值(pi / zcode 均无池化实现——pi = PI_CODING_AGENT_DIR 全局一份,zcode = 共享
33
- * 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议面(RunContext/run.params.ctx/
33
+ * 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议范围(RunContext/run.params.ctx/
34
34
  * host/poolResolved 通道/EngineHandleData)已整体退役,本常量不再跨进程透传,仅
35
35
  * 三类消费:① journal 落盘路径构造(core event-journal-wiring);② 存量 record 兼容
36
36
  * (zcode read 旧相对 dbPath 的锚定分支 + 持久化 engineHandle.poolKey 字段——
37
- * record-store 读侧守卫要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
37
+ * record-store 读侧检查要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
38
38
  * 的签名参数。**值逐字不变**(存量 journal 落盘路径与记录含该值分段,改名不改值)。
39
39
  */
40
40
  declare const SHARED_POOL_KEY = "shared";
@@ -47,7 +47,7 @@ interface RunContext {
47
47
  stream?: EngineStream;
48
48
  /**
49
49
  * [F6] 根 session id(协议 run.params.ctx.sessionRootId 的进程内还原)——pi 引擎
50
- * relay 归属键 SESSION_ID 的权威来源。additive 可选:宿主缺省不传。
50
+ * engine_open 归属键的权威来源。additive 可选:宿主缺省不传。
51
51
  */
52
52
  sessionRootId?: string;
53
53
  /**
@@ -75,7 +75,7 @@ interface RunContext {
75
75
  mode?: string;
76
76
  };
77
77
  onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef">) => void;
78
- /** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议面)。 */
78
+ /** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议范围)。 */
79
79
  onChildSpawned?: (child: {
80
80
  pid: number | undefined;
81
81
  killed: boolean;
@@ -127,7 +127,7 @@ interface EnginePort {
127
127
  canonicalRef: string;
128
128
  };
129
129
  /**
130
- * [subagent-model-switch §7.3] 可选面:执行中模型热切换(协议 setModel 正向方法的
130
+ * [subagent-model-switch §7.3] 可选能力:执行中模型热切换(协议 setModel 正向方法的
131
131
  * 进程内承载)。实现引擎须 capabilities.setModel = 'native' 同批声明(位与方法
132
132
  * 成对进出——capabilities 注释的消费点登记);server 分发行在位非 native 时回
133
133
  * engineSetModelUnsupportedError 结构化错误(契约行为 = 明确错误而非崩)。