@zhushanwen/subagent-engine-sdk 0.6.1 → 0.7.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.
- package/dist/best-effort.d.cts +1 -1
- package/dist/best-effort.d.ts +1 -1
- package/dist/{chunk-W3BKI2BP.js → chunk-3WC36CHI.js} +1 -1
- package/dist/{chunk-CNQTJJF5.js → chunk-HERD6RIR.js} +12 -1
- package/dist/{chunk-QOEXD2FT.js → chunk-RCT7L777.js} +36 -1
- package/dist/{chunk-WMDMXP2F.js → chunk-SFNTX7Q3.js} +0 -4
- package/dist/{chunk-AIG5LSGK.js → chunk-SGAIDL63.js} +5 -0
- package/dist/{chunk-63ZNJHM5.js → chunk-W23PAAGX.js} +3 -1
- package/dist/{contract-types-DaULkdpG.d.cts → contract-types-DiWyGRXr.d.cts} +78 -13
- package/dist/{contract-types-DaULkdpG.d.ts → contract-types-DiWyGRXr.d.ts} +78 -13
- package/dist/index.cjs +89 -8
- package/dist/index.d.cts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +45 -10
- package/dist/journal-io.d.cts +1 -1
- package/dist/journal-io.d.ts +1 -1
- package/dist/journal-replay.cjs +5 -0
- package/dist/journal-replay.d.cts +1 -1
- package/dist/journal-replay.d.ts +1 -1
- package/dist/journal-replay.js +1 -1
- package/dist/kill-chain.cjs +38 -2
- package/dist/kill-chain.d.cts +38 -3
- package/dist/kill-chain.d.ts +38 -3
- package/dist/kill-chain.js +8 -5
- package/dist/node-executor.js +2 -2
- package/dist/port-contract.d.cts +9 -4
- package/dist/port-contract.d.ts +9 -4
- package/dist/protocol/index.cjs +3 -7
- package/dist/protocol/index.d.cts +132 -12
- package/dist/protocol/index.d.ts +132 -12
- package/dist/protocol/index.js +2 -6
- package/dist/spawn.cjs +81 -5
- package/dist/spawn.d.cts +13 -2
- package/dist/spawn.d.ts +13 -2
- package/dist/spawn.js +6 -1
- package/package.json +1 -1
- package/dist/error-codes-C9BOUI5H.d.ts +0 -118
- package/dist/error-codes-CFTOAxva.d.cts +0 -118
package/dist/protocol/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { A as AGENT_EVENT_TYPE_NAMES, b as AgentEvent, c as AgentEventTypeName, d as AgentFailureKind, f as AgentOutcomeUsage, g as AgentUsage, h as AgentUsageTotal, i as AssertMutuallyAssignable, I as InternalToolCall, R as ReplayedTurn, T as ToolCall, l as ToolCallEntry, m as ToolCallResult, n as Turn, W as WorktreeHandle } from '../contract-types-DaULkdpG.js';
|
|
1
|
+
import { b as AgentEvent, E as EngineCapabilities, M as ModelCatalogEntry, a as AgentCallOpts, l as ResumeAnchor, j as EngineHandleData, P as ProbeReport, e as AgentOutcome, S as SessionView } from '../contract-types-DiWyGRXr.js';
|
|
2
|
+
export { A as AGENT_EVENT_TYPE_NAMES, c as AgentEventTypeName, d as AgentFailureKind, f as AgentOutcomeUsage, g as AgentUsage, h as AgentUsageTotal, i as AssertMutuallyAssignable, k as EngineProcessModel, I as InternalToolCall, R as ReplayedTurn, T as ToolCall, m as ToolCallEntry, n as ToolCallResult, o as Turn, W as WorktreeHandle } from '../contract-types-DiWyGRXr.js';
|
|
4
3
|
import { UiRequest, UiResponse } from '../ui-types.js';
|
|
5
4
|
|
|
6
5
|
/** 协议版本(引擎包 manifest `taiji.subagentEngine.protocol` 与 initialize 应答同值)。 */
|
|
@@ -26,9 +25,6 @@ declare const CRASH_REBUILD_MAX_ATTEMPTS = 3;
|
|
|
26
25
|
declare const CRASH_REBUILD_BACKOFF_MS: readonly [1000, 2000, 4000];
|
|
27
26
|
/** stderr 内存环形缓冲保留的尾部字符数(engine_crashed 帧携带崩溃现场)。 */
|
|
28
27
|
declare const STDERR_TAIL_CHARS = 400;
|
|
29
|
-
/** 事件合并开关 env 名(设计级默认关闭 = 值 "0";A1 要求事件逐字段等价,合并不可开)。 */
|
|
30
|
-
declare const ENGINE_EVENT_COALESCE_ENV = "TAIJI_ENGINE_EVENT_COALESCE";
|
|
31
|
-
declare const ENGINE_EVENT_COALESCE_DEFAULT = "0";
|
|
32
28
|
/**
|
|
33
29
|
* 反向请求超时二分(帧④注释,R9-2):
|
|
34
30
|
* - 数据面类(host/log / host/streamDelta / host/handleReady /
|
|
@@ -38,6 +34,69 @@ declare const ENGINE_EVENT_COALESCE_DEFAULT = "0";
|
|
|
38
34
|
*/
|
|
39
35
|
type ReverseRequestTimeoutClass = "data-plane" | "interaction";
|
|
40
36
|
|
|
37
|
+
/** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
|
|
38
|
+
interface ProtocolError {
|
|
39
|
+
/** 错误码(error-codes.ts 词表 + 其余 engine_* 引擎自报透传)。 */
|
|
40
|
+
code: string;
|
|
41
|
+
/** 人类可读详情。 */
|
|
42
|
+
message: string;
|
|
43
|
+
/** 恢复指引:指向具体下一步(命令 / 配置路径 / 升级动作),非安慰性文案。 */
|
|
44
|
+
recovery: string;
|
|
45
|
+
/** 结构化附参(如 engine_protocol_mismatch 的双方版本)。 */
|
|
46
|
+
data?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
interface RequestFrame {
|
|
49
|
+
id: number;
|
|
50
|
+
method: string;
|
|
51
|
+
params: unknown;
|
|
52
|
+
}
|
|
53
|
+
interface SuccessResponseFrame {
|
|
54
|
+
id: number | string;
|
|
55
|
+
result: unknown;
|
|
56
|
+
}
|
|
57
|
+
interface ErrorResponseFrame {
|
|
58
|
+
id: number | string;
|
|
59
|
+
error: ProtocolError;
|
|
60
|
+
}
|
|
61
|
+
type ResponseFrame = SuccessResponseFrame | ErrorResponseFrame;
|
|
62
|
+
/** event 通知载荷:runId 关联在途 run;seq 单调递增(基线①结构等价断言对象)。 */
|
|
63
|
+
interface EventNotificationParams {
|
|
64
|
+
runId: string;
|
|
65
|
+
seq: number;
|
|
66
|
+
event: AgentEvent;
|
|
67
|
+
}
|
|
68
|
+
interface NotificationFrame {
|
|
69
|
+
method: "event";
|
|
70
|
+
params: EventNotificationParams;
|
|
71
|
+
}
|
|
72
|
+
interface ReverseRequestFrame {
|
|
73
|
+
id: string;
|
|
74
|
+
method: string;
|
|
75
|
+
params: unknown;
|
|
76
|
+
}
|
|
77
|
+
/** 反向请求的应答(core → 引擎,沿 ResponseFrame 通道回传;id = 反向请求 id 原样)。 */
|
|
78
|
+
type ReverseResponseResult =
|
|
79
|
+
/** 数据面类:处理确认。 */
|
|
80
|
+
{
|
|
81
|
+
ok: true;
|
|
82
|
+
}
|
|
83
|
+
/** 人机交互类(askUser)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
|
|
84
|
+
| {
|
|
85
|
+
ack: true;
|
|
86
|
+
}
|
|
87
|
+
/** 未实现或宿主未知的通道(宽容语义③:由 askUser 语境泛化到全通道——宿主对未知 host/* 通道回 unsupported,引擎自行降级)。 */
|
|
88
|
+
| {
|
|
89
|
+
unsupported: true;
|
|
90
|
+
};
|
|
91
|
+
/** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
|
|
92
|
+
declare function isRequestFrame(frame: unknown): frame is RequestFrame;
|
|
93
|
+
/** ② 应答:有 id(number|string)且 result/error 二选一。 */
|
|
94
|
+
declare function isResponseFrame(frame: unknown): frame is ResponseFrame;
|
|
95
|
+
/** ③ 通知:无 id,method === "event",params 含 runId/seq/event。 */
|
|
96
|
+
declare function isNotificationFrame(frame: unknown): frame is NotificationFrame;
|
|
97
|
+
/** ④ 反向请求:有字符串 id + host/* method + params(与①的区别 = id 形态与 method 前缀)。 */
|
|
98
|
+
declare function isReverseRequestFrame(frame: unknown): frame is ReverseRequestFrame;
|
|
99
|
+
|
|
41
100
|
/**
|
|
42
101
|
* 正向方法名联合(恰好 9 个;PROTOCOL_METHODS 常量数组与之同源互证)。
|
|
43
102
|
* [H1] `interact` 成员已随 chat-run 统一退役(docs/architecture/subagent-chat-run-unification.md
|
|
@@ -55,8 +114,6 @@ interface RunContextParams {
|
|
|
55
114
|
cwd?: string;
|
|
56
115
|
/** 请求模型 ref(未传 = 引擎缺省模型)。 */
|
|
57
116
|
model?: string;
|
|
58
|
-
/** 结构化输出 schema 的 env 注入形态(schemaEnv 降级通道)。 */
|
|
59
|
-
schemaEnv?: string;
|
|
60
117
|
/** 上下文模型 ref(与 run 模型分离的 ctx 模型)。 */
|
|
61
118
|
ctxModel?: string;
|
|
62
119
|
/** fallback 留痕(引擎回填 outcome.engineFallback 的种子)。 */
|
|
@@ -80,6 +137,14 @@ interface RunContextParams {
|
|
|
80
137
|
* 未知字段,undefined 不上 wire。
|
|
81
138
|
*/
|
|
82
139
|
sessionDir?: string;
|
|
140
|
+
/**
|
|
141
|
+
* [D2 扩展加载显式化] 孙进程显式加载的扩展路径集(pi 引擎侧逐项拼
|
|
142
|
+
* `--extension` argv)。per-host 常量而非 per-run 变量,故落 ctx。宿主侧来源
|
|
143
|
+
* 双形态:taiji 宿主 = extension-service 下发的白名单收窄集(经 pi-host 注入);
|
|
144
|
+
* 独立 pi = subagent-workflow 自身 optional peerDep 解析回退。additive 可选:
|
|
145
|
+
* 旧引擎忽略未知字段,undefined 不上 wire。
|
|
146
|
+
*/
|
|
147
|
+
extensionPaths?: string[];
|
|
83
148
|
}
|
|
84
149
|
/**
|
|
85
150
|
* [H1] run 的 resume 会话形态参数(设计 docs/architecture/subagent-chat-run-unification.md
|
|
@@ -150,7 +215,10 @@ interface CancelResult {
|
|
|
150
215
|
}
|
|
151
216
|
interface ReadParams {
|
|
152
217
|
handle: EngineHandleData;
|
|
153
|
-
/**
|
|
218
|
+
/** 数据根(core 每次 read 都发送——remote-engine 构造注入的数据目录)。两引擎
|
|
219
|
+
* server 现行均不消费该字段:定位走 handle.data(journalPath 等)或引擎自身
|
|
220
|
+
* 数据目录。保留为协议帧字段(历史:存量池时代引擎自算池/journal 相对 dbPath
|
|
221
|
+
* 的定位需要它)。 */
|
|
154
222
|
dataDir: string;
|
|
155
223
|
}
|
|
156
224
|
interface ListModelsParams {
|
|
@@ -277,6 +345,58 @@ interface HostChildStateChangedParams {
|
|
|
277
345
|
signal?: string;
|
|
278
346
|
}
|
|
279
347
|
|
|
348
|
+
/** 协议核心错误码(引擎 error 帧 + core 同步拦截共用的固定词表)。 */
|
|
349
|
+
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"];
|
|
350
|
+
type EngineProtocolErrorCode = (typeof ENGINE_PROTOCOL_ERROR_CODES)[number];
|
|
351
|
+
/** unknown → 协议错误码收窄(外部输入携带错误码时的运行时 guard;其余 engine_* 走透传)。 */
|
|
352
|
+
declare function isEngineProtocolErrorCode(value: unknown): value is EngineProtocolErrorCode;
|
|
353
|
+
/** 其余引擎自报错误码的前缀契约(透传面;core 不解释文案)。 */
|
|
354
|
+
declare const ENGINE_ERROR_CODE_PREFIX = "engine_";
|
|
355
|
+
declare function isEngineErrorPassthroughCode(value: string): boolean;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* 结构化引擎错误(message 恒为 `<code>: <detail>` 前缀格式——AgentOutcome.error 与
|
|
359
|
+
* 协议 error 帧共用的错误码前缀约定);recovery 指向恢复动作。
|
|
360
|
+
* toStructured() 产出即协议 ProtocolError 形态(error 帧载荷直用)。
|
|
361
|
+
*/
|
|
362
|
+
declare class EngineSdkError extends Error {
|
|
363
|
+
readonly code: string;
|
|
364
|
+
readonly recovery: string;
|
|
365
|
+
readonly data?: Record<string, unknown>;
|
|
366
|
+
constructor(code: string, detail: string, recovery: string, data?: Record<string, unknown>);
|
|
367
|
+
/** 协议 error 帧载荷投影。 */
|
|
368
|
+
toStructured(): ProtocolError;
|
|
369
|
+
}
|
|
370
|
+
declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
|
|
371
|
+
/**
|
|
372
|
+
* 引擎 conversation 位拒绝的具名错误([modeless 波2] 语义:无 resume 续聊通道的
|
|
373
|
+
* 引擎,message 续聊资格被拒——manifest conversation 能力轴消费;[modeless 波5
|
|
374
|
+
* 收尾] core capability-gate 的显式参数分支随派发参数删除退役,本构造器消费方 =
|
|
375
|
+
* 引擎侧 resume gate(assertChatConversationSupported)与 message 资格门)。
|
|
376
|
+
* 文案契约:错误码 engine_capability_unsupported + 「换引擎续聊 / 修 manifest /
|
|
377
|
+
* 升级引擎包」恢复指引,两侧一致防漂移。
|
|
378
|
+
*/
|
|
379
|
+
declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
|
|
380
|
+
/**
|
|
381
|
+
* resume 会话形态(run.params.resume——唯一会话形态键)派发前的同步 gate:
|
|
382
|
+
* manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError
|
|
383
|
+
* ——进程/record 创建前同步拒(A6 方向防御:manifest/实装漂移时引擎侧自拒,
|
|
384
|
+
* 与 core capability-gate 同一能力位,防两侧判据漂移)。[modeless 波2] 协议
|
|
385
|
+
* task 的 conversation 键已删,本 gate 只对 resume 形态键生效。
|
|
386
|
+
*/
|
|
387
|
+
declare function assertChatConversationSupported(engineId: string, capabilities: Pick<EngineCapabilities, "conversation">): void;
|
|
388
|
+
/** stdout 尾部回显上限(engine_timeout / engine_run_failed 的错误规格载体系数)。 */
|
|
389
|
+
declare const STDOUT_TAIL_ECHO_CHARS = 2000;
|
|
390
|
+
/** engine_timeout 的恢复指引(kill-chain 超时杀链收尾文案)。 */
|
|
391
|
+
declare const ENGINE_TIMEOUT_RECOVERY: string;
|
|
392
|
+
/**
|
|
393
|
+
* engine_timeout 的 outcome.error 文案:含 stdout 尾部 2000 字 + 恢复指引
|
|
394
|
+
* (kill-chain synthesizeTimeoutOutcome 消费;与 core errors.ts engineTimeoutDetail 逐字等价)。
|
|
395
|
+
*/
|
|
396
|
+
declare function engineTimeoutDetail(stdoutTail: string): string;
|
|
397
|
+
/** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
|
|
398
|
+
declare function schemaEmulationFailedDetail(error: string, tail: string): string;
|
|
399
|
+
|
|
280
400
|
/** 协议错误对象 schema。 */
|
|
281
401
|
declare const protocolErrorSchema: {
|
|
282
402
|
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
@@ -395,7 +515,7 @@ declare const notificationFrameSchema: {
|
|
|
395
515
|
readonly properties: {
|
|
396
516
|
readonly type: {
|
|
397
517
|
readonly type: "string";
|
|
398
|
-
readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error"];
|
|
518
|
+
readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed"];
|
|
399
519
|
};
|
|
400
520
|
};
|
|
401
521
|
};
|
|
@@ -515,7 +635,7 @@ declare const ENGINE_PROTOCOL_SCHEMAS: {
|
|
|
515
635
|
readonly properties: {
|
|
516
636
|
readonly type: {
|
|
517
637
|
readonly type: "string";
|
|
518
|
-
readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error"];
|
|
638
|
+
readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed"];
|
|
519
639
|
};
|
|
520
640
|
};
|
|
521
641
|
};
|
|
@@ -606,4 +726,4 @@ declare const runSessionParamsSchema: {
|
|
|
606
726
|
};
|
|
607
727
|
};
|
|
608
728
|
|
|
609
|
-
export { AgentCallOpts, AgentOutcome, CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, type CancelParams, type CancelResult, type DisposeParams, type DisposeResult,
|
|
729
|
+
export { AgentCallOpts, AgentEvent, AgentOutcome, CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, type CancelParams, type CancelResult, type DisposeParams, type DisposeResult, ENGINE_ERROR_CODE_PREFIX, ENGINE_PROTOCOL_ERROR_CODES, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, ENGINE_TIMEOUT_RECOVERY, EngineCapabilities, EngineHandleData, type EngineProtocolErrorCode, EngineSdkError, type ErrorResponseFrame, type EventNotificationParams, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, type HostAskUserParams, type HostAskUserResult, type HostChildSpawnedParams, type HostChildStateChangedParams, type HostHandleReadyParams, type HostLogParams, type HostStreamDeltaParams, type InitializeParams, type InitializeResult, type ListModelsParams, type ListModelsResult, ModelCatalogEntry, type NotificationFrame, PROTOCOL_METHODS, type PingParams, type PingResult, type ProbeParams, ProbeReport, type ProtocolError, type ProtocolMethod, type ProtocolParamsMap, type ProtocolResultMap, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, type ReadParams, type RequestFrame, type ResponseFrame, ResumeAnchor, type ReverseChannel, type ReverseRequestFrame, type ReverseRequestTimeoutClass, type ReverseResponseResult, type RunContextParams, type RunParams, type RunResult, type RunResumeParams, STDERR_TAIL_CHARS, STDOUT_TAIL_ECHO_CHARS, SUPPORTED_PROTOCOL_RANGE, SessionView, type SuccessResponseFrame, type ValidateModelParams, type ValidateModelResult, assertChatConversationSupported, engineConversationUnsupportedError, engineProtocolMismatchError, engineTimeoutDetail, errorResponseFrameSchema, isEngineErrorPassthroughCode, isEngineProtocolErrorCode, isNotificationFrame, isProtocolVersionCompatible, isRequestFrame, isResponseFrame, isReverseRequestFrame, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, schemaEmulationFailedDetail, successResponseFrameSchema };
|
package/dist/protocol/index.js
CHANGED
|
@@ -16,14 +16,12 @@ import {
|
|
|
16
16
|
reverseRequestFrameSchema,
|
|
17
17
|
runSessionParamsSchema,
|
|
18
18
|
successResponseFrameSchema
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-W23PAAGX.js";
|
|
20
20
|
import {
|
|
21
21
|
CANCEL_SETTLE_GRACE_MS,
|
|
22
22
|
CRASH_REBUILD_BACKOFF_MS,
|
|
23
23
|
CRASH_REBUILD_MAX_ATTEMPTS,
|
|
24
24
|
ENGINE_ERROR_CODE_PREFIX,
|
|
25
|
-
ENGINE_EVENT_COALESCE_DEFAULT,
|
|
26
|
-
ENGINE_EVENT_COALESCE_ENV,
|
|
27
25
|
ENGINE_PROTOCOL_ERROR_CODES,
|
|
28
26
|
ENGINE_PROTOCOL_VERSION,
|
|
29
27
|
ENGINE_TIMEOUT_RECOVERY,
|
|
@@ -41,7 +39,7 @@ import {
|
|
|
41
39
|
isEngineProtocolErrorCode,
|
|
42
40
|
isProtocolVersionCompatible,
|
|
43
41
|
schemaEmulationFailedDetail
|
|
44
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-SFNTX7Q3.js";
|
|
45
43
|
import "../chunk-JSBRDJBE.js";
|
|
46
44
|
export {
|
|
47
45
|
AGENT_EVENT_TYPE_NAMES,
|
|
@@ -49,8 +47,6 @@ export {
|
|
|
49
47
|
CRASH_REBUILD_BACKOFF_MS,
|
|
50
48
|
CRASH_REBUILD_MAX_ATTEMPTS,
|
|
51
49
|
ENGINE_ERROR_CODE_PREFIX,
|
|
52
|
-
ENGINE_EVENT_COALESCE_DEFAULT,
|
|
53
|
-
ENGINE_EVENT_COALESCE_ENV,
|
|
54
50
|
ENGINE_PROTOCOL_ERROR_CODES,
|
|
55
51
|
ENGINE_PROTOCOL_SCHEMAS,
|
|
56
52
|
ENGINE_PROTOCOL_VERSION,
|
package/dist/spawn.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var spawn_exports = {};
|
|
22
22
|
__export(spawn_exports, {
|
|
23
23
|
DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS: () => DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS,
|
|
24
|
+
ENGINE_ABORT_KILL_GRACE_MS: () => ENGINE_ABORT_KILL_GRACE_MS,
|
|
24
25
|
ENGINE_HOST_REQUEST_TIMEOUT_ENV: () => ENGINE_HOST_REQUEST_TIMEOUT_ENV,
|
|
25
26
|
armEngineSelfDestruct: () => armEngineSelfDestruct,
|
|
26
27
|
pumpNdjsonLines: () => pumpNdjsonLines,
|
|
@@ -76,8 +77,77 @@ function getLogger(component) {
|
|
|
76
77
|
return facade;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
// src/error-message.ts
|
|
81
|
+
function toErrorMessage(e) {
|
|
82
|
+
if (e instanceof Error) return e.message;
|
|
83
|
+
if (typeof e === "object" && e !== null) {
|
|
84
|
+
try {
|
|
85
|
+
return JSON.stringify(e);
|
|
86
|
+
} catch {
|
|
87
|
+
return String(e);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return String(e);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/kill-chain.ts
|
|
94
|
+
var logger = getLogger("subagents");
|
|
95
|
+
var MS_PER_SECOND = 1e3;
|
|
96
|
+
var SIGKILL_REAP_TIMEOUT_MS = 1e4;
|
|
97
|
+
async function killChain(child, opts) {
|
|
98
|
+
if (child.exitCode !== null || child.signalCode !== null) return "terminated";
|
|
99
|
+
const exited = waitForExit(child);
|
|
100
|
+
safeKill(child, "SIGTERM");
|
|
101
|
+
const graceful = await raceTimeout(exited, opts.graceMs, opts.unrefTimers === true);
|
|
102
|
+
if (graceful === "settled") return "terminated";
|
|
103
|
+
if (child.exitCode !== null || child.signalCode !== null) return "terminated";
|
|
104
|
+
if (opts.escalationNote !== void 0) {
|
|
105
|
+
logger.warn(
|
|
106
|
+
`[kill-chain] ${opts.escalationNote} still alive ${opts.graceMs / MS_PER_SECOND}s after SIGTERM, escalating to SIGKILL`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
safeKill(child, "SIGKILL");
|
|
110
|
+
await raceTimeout(exited, SIGKILL_REAP_TIMEOUT_MS, opts.unrefTimers === true);
|
|
111
|
+
return "killed";
|
|
112
|
+
}
|
|
113
|
+
function safeKill(child, signal) {
|
|
114
|
+
try {
|
|
115
|
+
child.kill(signal);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
logger.debug(
|
|
118
|
+
`[kill-chain] ${signal} on exited process: ${toErrorMessage(err)}`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function waitForExit(child) {
|
|
123
|
+
return new Promise((resolve) => {
|
|
124
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
125
|
+
resolve();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
child.once("exit", () => resolve());
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function raceTimeout(p, ms, unref = false) {
|
|
132
|
+
return new Promise((resolve) => {
|
|
133
|
+
const timer = setTimeout(() => resolve("timeout"), ms);
|
|
134
|
+
if (unref) timer.unref();
|
|
135
|
+
p.then(
|
|
136
|
+
() => {
|
|
137
|
+
clearTimeout(timer);
|
|
138
|
+
resolve("settled");
|
|
139
|
+
},
|
|
140
|
+
() => {
|
|
141
|
+
clearTimeout(timer);
|
|
142
|
+
resolve("settled");
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
79
148
|
// src/spawn.ts
|
|
80
|
-
var
|
|
149
|
+
var logger2 = getLogger("engine-sdk/spawn");
|
|
150
|
+
var ENGINE_ABORT_KILL_GRACE_MS = 3e4;
|
|
81
151
|
var FORBIDDEN_OPTION_KEYS = ["detached", "stdio", "stdin", "windowsHide"];
|
|
82
152
|
function spawnEngineChild(opts) {
|
|
83
153
|
for (const key of FORBIDDEN_OPTION_KEYS) {
|
|
@@ -98,7 +168,12 @@ function spawnEngineChild(opts) {
|
|
|
98
168
|
opts.signal.addEventListener(
|
|
99
169
|
"abort",
|
|
100
170
|
() => {
|
|
101
|
-
child
|
|
171
|
+
safeKill(child, "SIGCONT");
|
|
172
|
+
void killChain(child, {
|
|
173
|
+
graceMs: ENGINE_ABORT_KILL_GRACE_MS,
|
|
174
|
+
unrefTimers: true,
|
|
175
|
+
escalationNote: `engine child (pid ${child.pid ?? "unknown"}) abort`
|
|
176
|
+
});
|
|
102
177
|
},
|
|
103
178
|
{ once: true }
|
|
104
179
|
);
|
|
@@ -114,7 +189,7 @@ function resolveHostRequestTimeoutMs(opts) {
|
|
|
114
189
|
if (raw === void 0 || raw === "") return DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS;
|
|
115
190
|
const parsed = Number(raw);
|
|
116
191
|
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
117
|
-
|
|
192
|
+
logger2.warn(
|
|
118
193
|
`invalid ${ENGINE_HOST_REQUEST_TIMEOUT_ENV}=${JSON.stringify(raw)}, falling back to ${DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS}ms`
|
|
119
194
|
);
|
|
120
195
|
return DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS;
|
|
@@ -126,7 +201,7 @@ function killOwnProcessGroup() {
|
|
|
126
201
|
try {
|
|
127
202
|
process.kill(-pid, "SIGKILL");
|
|
128
203
|
} catch (err) {
|
|
129
|
-
|
|
204
|
+
logger2.warn(`process-group kill failed (${String(err)}), falling back to self kill`);
|
|
130
205
|
process.kill(pid, "SIGKILL");
|
|
131
206
|
}
|
|
132
207
|
}
|
|
@@ -141,7 +216,7 @@ function armEngineSelfDestruct(opts) {
|
|
|
141
216
|
clearInterval(timer);
|
|
142
217
|
opts.stdin.removeAllListeners?.("end");
|
|
143
218
|
opts.stdin.removeAllListeners?.("close");
|
|
144
|
-
|
|
219
|
+
logger2.warn(`engine self-destruct: ${reason}`);
|
|
145
220
|
killSelf();
|
|
146
221
|
};
|
|
147
222
|
opts.stdin.once("end", () => destroy("host stdin EOF (end)"));
|
|
@@ -193,6 +268,7 @@ function pumpNdjsonLines(stream, onLine) {
|
|
|
193
268
|
// Annotate the CommonJS export names for ESM import in node:
|
|
194
269
|
0 && (module.exports = {
|
|
195
270
|
DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS,
|
|
271
|
+
ENGINE_ABORT_KILL_GRACE_MS,
|
|
196
272
|
ENGINE_HOST_REQUEST_TIMEOUT_ENV,
|
|
197
273
|
armEngineSelfDestruct,
|
|
198
274
|
pumpNdjsonLines,
|
package/dist/spawn.d.cts
CHANGED
|
@@ -13,9 +13,20 @@ interface SpawnEngineChildOptions {
|
|
|
13
13
|
/** 子进程 stdout/stderr 形态;缺省 'pipe'(协议帧走 stdout,stderr 走日志/轮转) */
|
|
14
14
|
stdout?: "pipe" | "ignore" | "inherit";
|
|
15
15
|
stderr?: "pipe" | "ignore" | "inherit";
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* AbortSignal 触发即杀子(缺省无)。杀链 = SIGCONT 前置 + SIGTERM →
|
|
18
|
+
* ENGINE_ABORT_KILL_GRACE_MS grace → SIGKILL 完整阶梯(killChain 单源)——
|
|
19
|
+
* 裸 SIGTERM 单发对忽略/冻结/卡死的子进程永不收敛,run 悬挂至宿主回收层兜底。
|
|
20
|
+
*/
|
|
17
21
|
signal?: AbortSignal;
|
|
18
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* abort 杀链的 SIGTERM 优雅窗口(ms)。量级对齐 pi 引擎 PI_KILL_GRACE_MS 现状
|
|
25
|
+
* 校准值 30s(pi 子进程 trap SIGTERM 后 graceful shutdown 的实测量级,race-F4);
|
|
26
|
+
* zcode abort 路径由「裸 SIGTERM 单发、永不升级」升级为同窗有界兜底(任务级正常
|
|
27
|
+
* 路径不加墙钟、回收层统一有界兜底口径)。
|
|
28
|
+
*/
|
|
29
|
+
declare const ENGINE_ABORT_KILL_GRACE_MS = 30000;
|
|
19
30
|
/**
|
|
20
31
|
* 引擎任务子进程唯一 spawn 入口。
|
|
21
32
|
*
|
|
@@ -77,4 +88,4 @@ declare function armEngineSelfDestruct(opts: EngineSelfDestructOptions): Reverse
|
|
|
77
88
|
*/
|
|
78
89
|
declare function pumpNdjsonLines(stream: NodeJS.ReadableStream | null | undefined, onLine: (line: string) => void): void;
|
|
79
90
|
|
|
80
|
-
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, type EngineChildEnv, type EngineSelfDestructOptions, type ReverseRequestClock, type SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild };
|
|
91
|
+
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_ABORT_KILL_GRACE_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, type EngineChildEnv, type EngineSelfDestructOptions, type ReverseRequestClock, type SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild };
|
package/dist/spawn.d.ts
CHANGED
|
@@ -13,9 +13,20 @@ interface SpawnEngineChildOptions {
|
|
|
13
13
|
/** 子进程 stdout/stderr 形态;缺省 'pipe'(协议帧走 stdout,stderr 走日志/轮转) */
|
|
14
14
|
stdout?: "pipe" | "ignore" | "inherit";
|
|
15
15
|
stderr?: "pipe" | "ignore" | "inherit";
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* AbortSignal 触发即杀子(缺省无)。杀链 = SIGCONT 前置 + SIGTERM →
|
|
18
|
+
* ENGINE_ABORT_KILL_GRACE_MS grace → SIGKILL 完整阶梯(killChain 单源)——
|
|
19
|
+
* 裸 SIGTERM 单发对忽略/冻结/卡死的子进程永不收敛,run 悬挂至宿主回收层兜底。
|
|
20
|
+
*/
|
|
17
21
|
signal?: AbortSignal;
|
|
18
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* abort 杀链的 SIGTERM 优雅窗口(ms)。量级对齐 pi 引擎 PI_KILL_GRACE_MS 现状
|
|
25
|
+
* 校准值 30s(pi 子进程 trap SIGTERM 后 graceful shutdown 的实测量级,race-F4);
|
|
26
|
+
* zcode abort 路径由「裸 SIGTERM 单发、永不升级」升级为同窗有界兜底(任务级正常
|
|
27
|
+
* 路径不加墙钟、回收层统一有界兜底口径)。
|
|
28
|
+
*/
|
|
29
|
+
declare const ENGINE_ABORT_KILL_GRACE_MS = 30000;
|
|
19
30
|
/**
|
|
20
31
|
* 引擎任务子进程唯一 spawn 入口。
|
|
21
32
|
*
|
|
@@ -77,4 +88,4 @@ declare function armEngineSelfDestruct(opts: EngineSelfDestructOptions): Reverse
|
|
|
77
88
|
*/
|
|
78
89
|
declare function pumpNdjsonLines(stream: NodeJS.ReadableStream | null | undefined, onLine: (line: string) => void): void;
|
|
79
90
|
|
|
80
|
-
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, type EngineChildEnv, type EngineSelfDestructOptions, type ReverseRequestClock, type SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild };
|
|
91
|
+
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_ABORT_KILL_GRACE_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, type EngineChildEnv, type EngineSelfDestructOptions, type ReverseRequestClock, type SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild };
|
package/dist/spawn.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS,
|
|
3
|
+
ENGINE_ABORT_KILL_GRACE_MS,
|
|
3
4
|
ENGINE_HOST_REQUEST_TIMEOUT_ENV,
|
|
4
5
|
armEngineSelfDestruct,
|
|
5
6
|
pumpNdjsonLines,
|
|
6
7
|
spawnEngineChild
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HERD6RIR.js";
|
|
9
|
+
import "./chunk-RCT7L777.js";
|
|
10
|
+
import "./chunk-PYO3YR7W.js";
|
|
11
|
+
import "./chunk-SFNTX7Q3.js";
|
|
8
12
|
import "./chunk-75QEMUGV.js";
|
|
9
13
|
import "./chunk-JSBRDJBE.js";
|
|
10
14
|
export {
|
|
11
15
|
DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS,
|
|
16
|
+
ENGINE_ABORT_KILL_GRACE_MS,
|
|
12
17
|
ENGINE_HOST_REQUEST_TIMEOUT_ENV,
|
|
13
18
|
armEngineSelfDestruct,
|
|
14
19
|
pumpNdjsonLines,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/subagent-engine-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Engine-side SDK for the subagent engine protocol: NDJSON stdio contract types, engine primitives (schema emulation, nesting guard, kill chain, journal replay projection, data-dir/paths resolution) — the shared contract root between subagent-core and engine CLI packages (engines import SDK only, never core)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { b as AgentEvent, E as EngineCapabilities } from './contract-types-DaULkdpG.js';
|
|
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 };
|