@zhushanwen/subagent-engine-sdk 0.6.1 → 0.7.1

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 (38) hide show
  1. package/dist/best-effort.d.cts +1 -1
  2. package/dist/best-effort.d.ts +1 -1
  3. package/dist/{chunk-W3BKI2BP.js → chunk-3WC36CHI.js} +1 -1
  4. package/dist/{chunk-CNQTJJF5.js → chunk-HERD6RIR.js} +12 -1
  5. package/dist/{chunk-QOEXD2FT.js → chunk-RCT7L777.js} +36 -1
  6. package/dist/{chunk-WMDMXP2F.js → chunk-SFNTX7Q3.js} +0 -4
  7. package/dist/{chunk-AIG5LSGK.js → chunk-SGAIDL63.js} +5 -0
  8. package/dist/{chunk-63ZNJHM5.js → chunk-W23PAAGX.js} +3 -1
  9. package/dist/{contract-types-DaULkdpG.d.cts → contract-types-DiWyGRXr.d.cts} +78 -13
  10. package/dist/{contract-types-DaULkdpG.d.ts → contract-types-DiWyGRXr.d.ts} +78 -13
  11. package/dist/index.cjs +89 -8
  12. package/dist/index.d.cts +39 -5
  13. package/dist/index.d.ts +39 -5
  14. package/dist/index.js +45 -10
  15. package/dist/journal-io.d.cts +1 -1
  16. package/dist/journal-io.d.ts +1 -1
  17. package/dist/journal-replay.cjs +5 -0
  18. package/dist/journal-replay.d.cts +1 -1
  19. package/dist/journal-replay.d.ts +1 -1
  20. package/dist/journal-replay.js +1 -1
  21. package/dist/kill-chain.cjs +38 -2
  22. package/dist/kill-chain.d.cts +38 -3
  23. package/dist/kill-chain.d.ts +38 -3
  24. package/dist/kill-chain.js +8 -5
  25. package/dist/node-executor.js +2 -2
  26. package/dist/port-contract.d.cts +9 -4
  27. package/dist/port-contract.d.ts +9 -4
  28. package/dist/protocol/index.cjs +3 -7
  29. package/dist/protocol/index.d.cts +132 -12
  30. package/dist/protocol/index.d.ts +132 -12
  31. package/dist/protocol/index.js +2 -6
  32. package/dist/spawn.cjs +81 -5
  33. package/dist/spawn.d.cts +13 -2
  34. package/dist/spawn.d.ts +13 -2
  35. package/dist/spawn.js +6 -1
  36. package/package.json +1 -1
  37. package/dist/error-codes-C9BOUI5H.d.ts +0 -118
  38. package/dist/error-codes-CFTOAxva.d.cts +0 -118
@@ -1,118 +0,0 @@
1
- import { b as AgentEvent, E as EngineCapabilities } from './contract-types-DaULkdpG.cjs';
2
-
3
- /** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
4
- interface ProtocolError {
5
- /** 错误码(error-codes.ts 词表 + 其余 engine_* 引擎自报透传)。 */
6
- code: string;
7
- /** 人类可读详情。 */
8
- message: string;
9
- /** 恢复指引:指向具体下一步(命令 / 配置路径 / 升级动作),非安慰性文案。 */
10
- recovery: string;
11
- /** 结构化附参(如 engine_protocol_mismatch 的双方版本)。 */
12
- data?: Record<string, unknown>;
13
- }
14
- interface RequestFrame {
15
- id: number;
16
- method: string;
17
- params: unknown;
18
- }
19
- interface SuccessResponseFrame {
20
- id: number | string;
21
- result: unknown;
22
- }
23
- interface ErrorResponseFrame {
24
- id: number | string;
25
- error: ProtocolError;
26
- }
27
- type ResponseFrame = SuccessResponseFrame | ErrorResponseFrame;
28
- /** event 通知载荷:runId 关联在途 run;seq 单调递增(基线①结构等价断言对象)。 */
29
- interface EventNotificationParams {
30
- runId: string;
31
- seq: number;
32
- event: AgentEvent;
33
- }
34
- interface NotificationFrame {
35
- method: "event";
36
- params: EventNotificationParams;
37
- }
38
- interface ReverseRequestFrame {
39
- id: string;
40
- method: string;
41
- params: unknown;
42
- }
43
- /** 反向请求的应答(core → 引擎,沿 ResponseFrame 通道回传;id = 反向请求 id 原样)。 */
44
- type ReverseResponseResult =
45
- /** 数据面类:处理确认。 */
46
- {
47
- ok: true;
48
- }
49
- /** 人机交互类(askUser)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
50
- | {
51
- ack: true;
52
- }
53
- /** 未实现或宿主未知的通道(宽容语义③:由 askUser 语境泛化到全通道——宿主对未知 host/* 通道回 unsupported,引擎自行降级)。 */
54
- | {
55
- unsupported: true;
56
- };
57
- /** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
58
- declare function isRequestFrame(frame: unknown): frame is RequestFrame;
59
- /** ② 应答:有 id(number|string)且 result/error 二选一。 */
60
- declare function isResponseFrame(frame: unknown): frame is ResponseFrame;
61
- /** ③ 通知:无 id,method === "event",params 含 runId/seq/event。 */
62
- declare function isNotificationFrame(frame: unknown): frame is NotificationFrame;
63
- /** ④ 反向请求:有字符串 id + host/* method + params(与①的区别 = id 形态与 method 前缀)。 */
64
- declare function isReverseRequestFrame(frame: unknown): frame is ReverseRequestFrame;
65
-
66
- /** 协议核心错误码(引擎 error 帧 + core 同步拦截共用的固定词表)。 */
67
- declare const ENGINE_PROTOCOL_ERROR_CODES: readonly ["engine_not_found", "engine_protocol_mismatch", "engine_capability_unsupported", "engine_capability_mismatch", "engine_model_unknown", "engine_model_mismatch", "engine_handshake_timeout", "engine_crashed", "engine_probe_failed"];
68
- type EngineProtocolErrorCode = (typeof ENGINE_PROTOCOL_ERROR_CODES)[number];
69
- /** unknown → 协议错误码收窄(外部输入携带错误码时的运行时 guard;其余 engine_* 走透传)。 */
70
- declare function isEngineProtocolErrorCode(value: unknown): value is EngineProtocolErrorCode;
71
- /** 其余引擎自报错误码的前缀契约(透传面;core 不解释文案)。 */
72
- declare const ENGINE_ERROR_CODE_PREFIX = "engine_";
73
- declare function isEngineErrorPassthroughCode(value: string): boolean;
74
-
75
- /**
76
- * 结构化引擎错误(message 恒为 `<code>: <detail>` 前缀格式——AgentOutcome.error 与
77
- * 协议 error 帧共用的错误码前缀约定);recovery 指向恢复动作。
78
- * toStructured() 产出即协议 ProtocolError 形态(error 帧载荷直用)。
79
- */
80
- declare class EngineSdkError extends Error {
81
- readonly code: string;
82
- readonly recovery: string;
83
- readonly data?: Record<string, unknown>;
84
- constructor(code: string, detail: string, recovery: string, data?: Record<string, unknown>);
85
- /** 协议 error 帧载荷投影。 */
86
- toStructured(): ProtocolError;
87
- }
88
- declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
89
- /**
90
- * 引擎 conversation 位拒绝的具名错误([modeless 波2] 语义:无 resume 续聊通道的
91
- * 引擎,message 续聊资格被拒——manifest conversation 能力轴消费;[modeless 波5
92
- * 收尾] core capability-gate 的显式参数分支随派发参数删除退役,本构造器消费方 =
93
- * 引擎侧 resume gate(assertChatConversationSupported)与 message 资格门)。
94
- * 文案契约:错误码 engine_capability_unsupported + 「换引擎续聊 / 修 manifest /
95
- * 升级引擎包」恢复指引,两侧一致防漂移。
96
- */
97
- declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
98
- /**
99
- * resume 会话形态(run.params.resume——唯一会话形态键)派发前的同步 gate:
100
- * manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError
101
- * ——进程/record 创建前同步拒(A6 方向防御:manifest/实装漂移时引擎侧自拒,
102
- * 与 core capability-gate 同一能力位,防两侧判据漂移)。[modeless 波2] 协议
103
- * task 的 conversation 键已删,本 gate 只对 resume 形态键生效。
104
- */
105
- declare function assertChatConversationSupported(engineId: string, capabilities: Pick<EngineCapabilities, "conversation">): void;
106
- /** stdout 尾部回显上限(engine_timeout / engine_run_failed 的错误规格载体系数)。 */
107
- declare const STDOUT_TAIL_ECHO_CHARS = 2000;
108
- /** engine_timeout 的恢复指引(kill-chain 超时杀链收尾文案)。 */
109
- declare const ENGINE_TIMEOUT_RECOVERY: string;
110
- /**
111
- * engine_timeout 的 outcome.error 文案:含 stdout 尾部 2000 字 + 恢复指引
112
- * (kill-chain synthesizeTimeoutOutcome 消费;与 core errors.ts engineTimeoutDetail 逐字等价)。
113
- */
114
- declare function engineTimeoutDetail(stdoutTail: string): string;
115
- /** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
116
- declare function schemaEmulationFailedDetail(error: string, tail: string): string;
117
-
118
- export { ENGINE_ERROR_CODE_PREFIX as E, type NotificationFrame as N, type ProtocolError as P, type RequestFrame as R, STDOUT_TAIL_ECHO_CHARS as S, ENGINE_PROTOCOL_ERROR_CODES as a, ENGINE_TIMEOUT_RECOVERY as b, type EngineProtocolErrorCode as c, EngineSdkError as d, type ErrorResponseFrame as e, type EventNotificationParams as f, type ResponseFrame as g, type ReverseRequestFrame as h, type ReverseResponseResult as i, type SuccessResponseFrame as j, assertChatConversationSupported as k, engineConversationUnsupportedError as l, engineProtocolMismatchError as m, engineTimeoutDetail as n, isEngineErrorPassthroughCode as o, isEngineProtocolErrorCode as p, isNotificationFrame as q, isRequestFrame as r, isResponseFrame as s, isReverseRequestFrame as t, schemaEmulationFailedDetail as u };