@zhushanwen/subagent-engine-sdk 0.3.0 → 0.5.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/{chunk-LKPVN3N6.js → chunk-3IBT7MTB.js} +1 -1
- package/dist/{chunk-WS4WAZVR.js → chunk-F5JZMK74.js} +1 -1
- package/dist/{chunk-TGDMOLZU.js → chunk-TW2FAMAJ.js} +2 -18
- package/dist/{chunk-FJT23P7T.js → chunk-WORT4PG7.js} +1 -1
- package/dist/{contract-types-ByIFoLrY.d.cts → contract-types-Dsvy79r3.d.cts} +18 -15
- package/dist/{contract-types-ByIFoLrY.d.ts → contract-types-Dsvy79r3.d.ts} +18 -15
- package/dist/env.d.cts +8 -1
- package/dist/env.d.ts +8 -1
- package/dist/{error-codes-BUx92qYi.d.ts → error-codes-OvQlqiQw.d.ts} +13 -15
- package/dist/{error-codes-DCiilt_8.d.cts → error-codes-SA5fGtx_.d.cts} +13 -15
- package/dist/index.cjs +3 -21
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -8
- package/dist/journal-io.d.cts +1 -1
- package/dist/journal-io.d.ts +1 -1
- package/dist/journal-replay.d.cts +1 -1
- package/dist/journal-replay.d.ts +1 -1
- package/dist/kill-chain.d.cts +2 -2
- package/dist/kill-chain.d.ts +2 -2
- package/dist/kill-chain.js +2 -2
- package/dist/node-executor.js +2 -2
- package/dist/port-contract.d.cts +11 -10
- package/dist/port-contract.d.ts +11 -10
- package/dist/protocol/index.cjs +3 -21
- package/dist/protocol/index.d.cts +19 -95
- package/dist/protocol/index.d.ts +19 -95
- package/dist/protocol/index.js +2 -6
- package/package.json +1 -1
- package/src/env.ts +8 -1
- package/src/nesting-guard.ts +1 -1
- package/src/paths.ts +1 -1
- package/src/port-contract.ts +10 -9
- package/src/protocol/contract-types.ts +22 -19
- package/src/protocol/engine-protocol.ts +9 -8
- package/src/protocol/error-codes.ts +12 -13
- package/src/protocol/frames.ts +1 -3
- package/src/protocol/methods.ts +3 -5
- package/src/protocol/reverse-channels.ts +13 -76
- package/src/protocol/schema.ts +2 -7
package/dist/protocol/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { E as EngineCapabilities, M as ModelCatalogEntry, A as AgentCallOpts, i as ResumeAnchor, h as EngineHandleData, P as ProbeReport, c as AgentOutcome, S as SessionView } from '../contract-types-
|
|
3
|
-
export { a as AgentEvent, b as AgentFailureKind, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, I as InternalToolCall, R as ReplayedTurn, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from '../contract-types-
|
|
1
|
+
export { E as ENGINE_ERROR_CODE_PREFIX, a as ENGINE_PROTOCOL_ERROR_CODES, b as ENGINE_TIMEOUT_RECOVERY, c as EngineProtocolErrorCode, d as EngineSdkError, e as ErrorResponseFrame, f as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, g as ResponseFrame, h as ReverseRequestFrame, i as ReverseResponseResult, S as STDOUT_TAIL_ECHO_CHARS, j as SuccessResponseFrame, k as assertChatConversationSupported, l as engineConversationUnsupportedError, m as engineProtocolMismatchError, n as engineTimeoutDetail, o as isEngineErrorPassthroughCode, p as isEngineProtocolErrorCode, q as isNotificationFrame, r as isRequestFrame, s as isResponseFrame, t as isReverseRequestFrame, u as schemaEmulationFailedDetail } from '../error-codes-OvQlqiQw.js';
|
|
2
|
+
import { E as EngineCapabilities, M as ModelCatalogEntry, A as AgentCallOpts, i as ResumeAnchor, h as EngineHandleData, P as ProbeReport, c as AgentOutcome, S as SessionView } from '../contract-types-Dsvy79r3.js';
|
|
3
|
+
export { a as AgentEvent, b as AgentFailureKind, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, I as InternalToolCall, R as ReplayedTurn, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from '../contract-types-Dsvy79r3.js';
|
|
4
4
|
import { UiRequest, UiResponse } from '../ui-types.js';
|
|
5
5
|
|
|
6
6
|
/** 协议版本(引擎包 manifest `xyz-agent.subagentEngine.protocol` 与 initialize 应答同值)。 */
|
|
@@ -31,16 +31,16 @@ declare const ENGINE_EVENT_COALESCE_ENV = "XYZ_ENGINE_EVENT_COALESCE";
|
|
|
31
31
|
declare const ENGINE_EVENT_COALESCE_DEFAULT = "0";
|
|
32
32
|
/**
|
|
33
33
|
* 反向请求超时二分(帧④注释,R9-2):
|
|
34
|
-
* - 数据面类(host/log / host/streamDelta / host/
|
|
34
|
+
* - 数据面类(host/log / host/streamDelta / host/handleReady /
|
|
35
35
|
* host/childSpawned / host/childStateChanged):10s 未答 = 引擎故障;
|
|
36
|
-
* - 人机交互类(host/askUser
|
|
36
|
+
* - 人机交互类(host/askUser):不设统一超时——core 先回 {ack:true},
|
|
37
37
|
* 结果异步到达;按 ADR-0047「静默 ≠ 卡死」用无进展检测/用户取消,不据此判引擎故障。
|
|
38
38
|
*/
|
|
39
39
|
type ReverseRequestTimeoutClass = "data-plane" | "interaction";
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* 正向方法名联合(恰好 9 个;PROTOCOL_METHODS 常量数组与之同源互证)。
|
|
43
|
-
* [H1] `interact` 成员已随 chat-run 统一退役(docs/
|
|
43
|
+
* [H1] `interact` 成员已随 chat-run 统一退役(docs/architecture/subagent-chat-run-unification.md
|
|
44
44
|
* §3.3 D5:续聊轮统一为「新 run + resume 锚点」,U5 删除)。
|
|
45
45
|
*/
|
|
46
46
|
type ProtocolMethod = "initialize" | "probe" | "run" | "cancel" | "read" | "listModels" | "validateModel" | "dispose" | "ping";
|
|
@@ -50,8 +50,6 @@ declare const PROTOCOL_METHODS: readonly ["initialize", "probe", "run", "cancel"
|
|
|
50
50
|
* run 上下文(RunContext 字段映射的协议承载,设计 §3.3 RunContext 映射表)。
|
|
51
51
|
*/
|
|
52
52
|
interface RunContextParams {
|
|
53
|
-
/** 隔离池归属(journal 归属错 = 缺失后果)。 */
|
|
54
|
-
poolKey: string;
|
|
55
53
|
/** 任务工作目录(worktree 隔离时 = worktree 路径)。 */
|
|
56
54
|
cwd: string;
|
|
57
55
|
/** 请求模型 ref(未传 = 引擎缺省模型)。 */
|
|
@@ -83,7 +81,7 @@ interface RunContextParams {
|
|
|
83
81
|
sessionDir?: string;
|
|
84
82
|
}
|
|
85
83
|
/**
|
|
86
|
-
* [H1] run 的 resume 会话形态参数(设计 docs/
|
|
84
|
+
* [H1] run 的 resume 会话形态参数(设计 docs/architecture/subagent-chat-run-unification.md
|
|
87
85
|
* §3.3 D3 + §5 U1/U6 行):原 RunChatParams(v1.x chat 会话形态参数)的泛化改名终态,
|
|
88
86
|
* 载荷同形(recordId + resume 锚点,ResumeAnchor 不变),仅键名从「chat 会话形态」
|
|
89
87
|
* 泛化为「resume 续聊」。
|
|
@@ -208,13 +206,13 @@ interface ProtocolResultMap {
|
|
|
208
206
|
}
|
|
209
207
|
|
|
210
208
|
/**
|
|
211
|
-
* 反向通道名联合(恰好
|
|
209
|
+
* 反向通道名联合(恰好 6 个;REVERSE_CHANNELS 常量数组与之同源互证)。
|
|
212
210
|
*/
|
|
213
|
-
type ReverseChannel = "host/log" | "host/askUser" | "host/
|
|
211
|
+
type ReverseChannel = "host/log" | "host/askUser" | "host/streamDelta" | "host/handleReady" | "host/childSpawned" | "host/childStateChanged";
|
|
214
212
|
/**
|
|
215
213
|
* 通道名全集(运行时顺序化枚举;与 ReverseChannel 的同源关系由测试断言)。
|
|
216
214
|
*/
|
|
217
|
-
declare const REVERSE_CHANNELS: readonly ["host/log", "host/askUser", "host/
|
|
215
|
+
declare const REVERSE_CHANNELS: readonly ["host/log", "host/askUser", "host/streamDelta", "host/handleReady", "host/childSpawned", "host/childStateChanged"];
|
|
218
216
|
/**
|
|
219
217
|
* 超时二分归属(10s 数据面 / 不设统一超时的人机交互面)。实现归 W2 EngineClient;
|
|
220
218
|
* 引擎侧自灭计时(W12)复用同表——已 ack 的 askUser 等待不计入 in-flight(R9-2)。
|
|
@@ -235,59 +233,24 @@ interface HostAskUserParams {
|
|
|
235
233
|
}
|
|
236
234
|
/** host/askUser 的最终结果(ack 两阶段第二阶段,异步应答帧②的 result)。 */
|
|
237
235
|
type HostAskUserResult = UiResponse;
|
|
238
|
-
/**
|
|
239
|
-
* host/permission:权限询问(引擎请求宿主裁决工具执行)。
|
|
240
|
-
* v1 骨架字段(设计未钉死载荷细节,细化归各引擎提取设计;W2 实装 core 应答端时
|
|
241
|
-
* 若需扩展走 additive 演进)。
|
|
242
|
-
*/
|
|
243
|
-
interface HostPermissionParams {
|
|
244
|
-
runId: string;
|
|
245
|
-
toolName: string;
|
|
246
|
-
args?: unknown;
|
|
247
|
-
/** 请求方向引擎给出的原因/说明(展示用)。 */
|
|
248
|
-
reason?: string;
|
|
249
|
-
}
|
|
250
|
-
/** host/permission 两阶段结果。 */
|
|
251
|
-
type HostPermissionResult = {
|
|
252
|
-
approved: boolean;
|
|
253
|
-
} | {
|
|
254
|
-
unsupported: true;
|
|
255
|
-
};
|
|
256
236
|
/**
|
|
257
237
|
* host/streamDelta:UI 实时通道(双通道之一;与 event 通知并行的渲染加速面)。
|
|
258
238
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
* v1.x 旧引擎的兼容载荷形态(存量兼容读,现行引擎不写)。
|
|
262
|
-
* 两键互斥(undefined 孪生位防双填),消费侧经 isHostStreamDeltaParams 收窄。
|
|
239
|
+
* 关联键恒为 runId(runId 由 core 在 run 帧分配);[H1] chat 续聊轮经 resume run
|
|
240
|
+
* 复用 runId 关联(原 recordId 关联键随 interact 面退役删除)。
|
|
263
241
|
*/
|
|
264
|
-
|
|
242
|
+
interface HostStreamDeltaParams {
|
|
265
243
|
runId: string;
|
|
266
|
-
recordId?: undefined;
|
|
267
244
|
delta: string;
|
|
268
|
-
} | {
|
|
269
|
-
recordId: string;
|
|
270
|
-
runId?: undefined;
|
|
271
|
-
delta: string;
|
|
272
|
-
};
|
|
273
|
-
/** streamDelta 载荷结构判定(关联键互斥 + delta 形状;消费侧共用,防双侧各写一份)。 */
|
|
274
|
-
declare function isHostStreamDeltaParams(value: unknown): value is HostStreamDeltaParams;
|
|
275
|
-
/**
|
|
276
|
-
* host/poolResolved:journal 落盘路径单一权威(契约:必须在首个事件 emit 前调用——
|
|
277
|
-
* 否则 journal 归属错)。载荷 = core onPoolResolved(poolKey) 的 runId 关联形态。
|
|
278
|
-
*/
|
|
279
|
-
interface HostPoolResolvedParams {
|
|
280
|
-
runId: string;
|
|
281
|
-
poolKey: string;
|
|
282
245
|
}
|
|
283
246
|
/**
|
|
284
247
|
* host/handleReady:运行中句柄回填(core onHandleReady 语义:session/create 应答后、
|
|
285
248
|
* 早于 run resolve;AGENTS.md 关键规则 9「重开 session 仍可见」的前提)。
|
|
249
|
+
* [池抽象降级 2026-09-13] 原 poolKey 字段已随协议面 poolKey 退役删除。
|
|
286
250
|
*/
|
|
287
251
|
interface HostHandleReadyParams {
|
|
288
252
|
runId: string;
|
|
289
253
|
sessionRef: Record<string, string>;
|
|
290
|
-
poolKey: string;
|
|
291
254
|
}
|
|
292
255
|
/**
|
|
293
256
|
* host/childSpawned:引擎内一次性子进程 pid 上报。
|
|
@@ -312,40 +275,6 @@ interface HostChildStateChangedParams {
|
|
|
312
275
|
exitCode?: number;
|
|
313
276
|
signal?: string;
|
|
314
277
|
}
|
|
315
|
-
/** 通道 → 载荷类型映射。 */
|
|
316
|
-
interface ReverseChannelParamsMap {
|
|
317
|
-
"host/log": HostLogParams;
|
|
318
|
-
"host/askUser": HostAskUserParams;
|
|
319
|
-
"host/permission": HostPermissionParams;
|
|
320
|
-
"host/streamDelta": HostStreamDeltaParams;
|
|
321
|
-
"host/poolResolved": HostPoolResolvedParams;
|
|
322
|
-
"host/handleReady": HostHandleReadyParams;
|
|
323
|
-
"host/childSpawned": HostChildSpawnedParams;
|
|
324
|
-
"host/childStateChanged": HostChildStateChangedParams;
|
|
325
|
-
}
|
|
326
|
-
/** 通道 → 异步/同步结果类型映射(ack 两阶段通道的第二阶段 result)。 */
|
|
327
|
-
interface ReverseChannelResultMap {
|
|
328
|
-
"host/log": {
|
|
329
|
-
ok: true;
|
|
330
|
-
};
|
|
331
|
-
"host/askUser": HostAskUserResult;
|
|
332
|
-
"host/permission": HostPermissionResult;
|
|
333
|
-
"host/streamDelta": {
|
|
334
|
-
ok: true;
|
|
335
|
-
};
|
|
336
|
-
"host/poolResolved": {
|
|
337
|
-
ok: true;
|
|
338
|
-
};
|
|
339
|
-
"host/handleReady": {
|
|
340
|
-
ok: true;
|
|
341
|
-
};
|
|
342
|
-
"host/childSpawned": {
|
|
343
|
-
ok: true;
|
|
344
|
-
};
|
|
345
|
-
"host/childStateChanged": {
|
|
346
|
-
ok: true;
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
278
|
|
|
350
279
|
/** 协议错误对象 schema。 */
|
|
351
280
|
declare const protocolErrorSchema: {
|
|
@@ -486,7 +415,7 @@ declare const reverseRequestFrameSchema: {
|
|
|
486
415
|
};
|
|
487
416
|
readonly method: {
|
|
488
417
|
readonly type: "string";
|
|
489
|
-
readonly enum: readonly ["host/log", "host/askUser", "host/
|
|
418
|
+
readonly enum: readonly ["host/log", "host/askUser", "host/streamDelta", "host/handleReady", "host/childSpawned", "host/childStateChanged"];
|
|
490
419
|
};
|
|
491
420
|
readonly params: {};
|
|
492
421
|
};
|
|
@@ -605,7 +534,7 @@ declare const ENGINE_PROTOCOL_SCHEMAS: {
|
|
|
605
534
|
};
|
|
606
535
|
readonly method: {
|
|
607
536
|
readonly type: "string";
|
|
608
|
-
readonly enum: readonly ["host/log", "host/askUser", "host/
|
|
537
|
+
readonly enum: readonly ["host/log", "host/askUser", "host/streamDelta", "host/handleReady", "host/childSpawned", "host/childStateChanged"];
|
|
609
538
|
};
|
|
610
539
|
readonly params: {};
|
|
611
540
|
};
|
|
@@ -638,11 +567,9 @@ declare const ENGINE_PROTOCOL_SCHEMAS: {
|
|
|
638
567
|
* 不得出现。词表覆盖常见拼写(子串匹配,非精确枚举)。
|
|
639
568
|
*/
|
|
640
569
|
declare const FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS: readonly ["apikey", "api_key", "token", "credential", "password", "secret"];
|
|
641
|
-
/** 反向通道名词表导出(schema enum 与 W2 路由同源)。 */
|
|
642
|
-
declare const REVERSE_CHANNEL_NAMES: readonly ReverseChannel[];
|
|
643
570
|
/**
|
|
644
571
|
* run.params 的会话形态参数载荷 schema(draft-07 深载荷片段)。设计权威源:
|
|
645
|
-
* docs/
|
|
572
|
+
* docs/architecture/subagent-chat-run-unification.md §3.3 D3 + §5 U1/U6 行。
|
|
646
573
|
*
|
|
647
574
|
* [H1 U6 已切换] 键切换单批完成后本 schema 面向唯一键 `resume`(RunResumeParams:
|
|
648
575
|
* recordId + 可选 ResumeAnchor),形状不变。帧级 schema(requestFrameSchema.params)
|
|
@@ -662,7 +589,7 @@ declare const runSessionParamsSchema: {
|
|
|
662
589
|
readonly resume: {
|
|
663
590
|
readonly type: "object";
|
|
664
591
|
readonly additionalProperties: false;
|
|
665
|
-
readonly required: readonly ["sessionRef"
|
|
592
|
+
readonly required: readonly ["sessionRef"];
|
|
666
593
|
readonly properties: {
|
|
667
594
|
readonly sessionRef: {
|
|
668
595
|
readonly type: "object";
|
|
@@ -670,9 +597,6 @@ declare const runSessionParamsSchema: {
|
|
|
670
597
|
readonly type: "string";
|
|
671
598
|
};
|
|
672
599
|
};
|
|
673
|
-
readonly poolKey: {
|
|
674
|
-
readonly type: "string";
|
|
675
|
-
};
|
|
676
600
|
readonly journalPath: {
|
|
677
601
|
readonly type: "string";
|
|
678
602
|
};
|
|
@@ -681,4 +605,4 @@ declare const runSessionParamsSchema: {
|
|
|
681
605
|
};
|
|
682
606
|
};
|
|
683
607
|
|
|
684
|
-
export { AgentCallOpts, AgentOutcome, CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, type CancelParams, type CancelResult, type DisposeParams, type DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, EngineCapabilities, EngineHandleData, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, type HostAskUserParams, type HostAskUserResult, type HostChildSpawnedParams, type HostChildStateChangedParams, type HostHandleReadyParams, type HostLogParams, type
|
|
608
|
+
export { AgentCallOpts, AgentOutcome, CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, type CancelParams, type CancelResult, type DisposeParams, type DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, EngineCapabilities, EngineHandleData, 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, PROTOCOL_METHODS, type PingParams, type PingResult, type ProbeParams, ProbeReport, type ProtocolMethod, type ProtocolParamsMap, type ProtocolResultMap, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, type ReadParams, ResumeAnchor, type ReverseChannel, type ReverseRequestTimeoutClass, type RunContextParams, type RunParams, type RunResult, type RunResumeParams, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, SessionView, type ValidateModelParams, type ValidateModelResult, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema };
|
package/dist/protocol/index.js
CHANGED
|
@@ -3,10 +3,8 @@ import {
|
|
|
3
3
|
FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
|
|
4
4
|
PROTOCOL_METHODS,
|
|
5
5
|
REVERSE_CHANNELS,
|
|
6
|
-
REVERSE_CHANNEL_NAMES,
|
|
7
6
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
8
7
|
errorResponseFrameSchema,
|
|
9
|
-
isHostStreamDeltaParams,
|
|
10
8
|
isNotificationFrame,
|
|
11
9
|
isRequestFrame,
|
|
12
10
|
isResponseFrame,
|
|
@@ -17,7 +15,7 @@ import {
|
|
|
17
15
|
reverseRequestFrameSchema,
|
|
18
16
|
runSessionParamsSchema,
|
|
19
17
|
successResponseFrameSchema
|
|
20
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-TW2FAMAJ.js";
|
|
21
19
|
import {
|
|
22
20
|
CANCEL_SETTLE_GRACE_MS,
|
|
23
21
|
CRASH_REBUILD_BACKOFF_MS,
|
|
@@ -42,7 +40,7 @@ import {
|
|
|
42
40
|
isEngineProtocolErrorCode,
|
|
43
41
|
isProtocolVersionCompatible,
|
|
44
42
|
schemaEmulationFailedDetail
|
|
45
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-F5JZMK74.js";
|
|
46
44
|
import "../chunk-JSBRDJBE.js";
|
|
47
45
|
export {
|
|
48
46
|
CANCEL_SETTLE_GRACE_MS,
|
|
@@ -60,7 +58,6 @@ export {
|
|
|
60
58
|
HANDSHAKE_TIMEOUT_MS,
|
|
61
59
|
PROTOCOL_METHODS,
|
|
62
60
|
REVERSE_CHANNELS,
|
|
63
|
-
REVERSE_CHANNEL_NAMES,
|
|
64
61
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
65
62
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
66
63
|
STDERR_TAIL_CHARS,
|
|
@@ -73,7 +70,6 @@ export {
|
|
|
73
70
|
errorResponseFrameSchema,
|
|
74
71
|
isEngineErrorPassthroughCode,
|
|
75
72
|
isEngineProtocolErrorCode,
|
|
76
|
-
isHostStreamDeltaParams,
|
|
77
73
|
isNotificationFrame,
|
|
78
74
|
isProtocolVersionCompatible,
|
|
79
75
|
isRequestFrame,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/subagent-engine-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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",
|
package/src/env.ts
CHANGED
|
@@ -67,7 +67,14 @@ export interface EngineChildEnvOptions {
|
|
|
67
67
|
electronRunAsNode?: boolean;
|
|
68
68
|
/** L0:relay 三键(宿主 relay 激活时传;三键必经 L0——L1 拒绝 XYZ_SUBAGENT_ 前缀、L2 是 manifest 面,两层都到不了) */
|
|
69
69
|
relay?: EngineRelayEnv;
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* L0:引擎侧身份 env 透传通道(identityEnv)。现行事实(ext-simplify-17 D4,
|
|
72
|
+
* 20260914 真机探针证实):PI_SUBAGENT_ROOT_SESSION_ID / PI_SUBAGENT_SELF_RECORD_ID
|
|
73
|
+
* 两键已无写入方(本通道现无人传值),引擎链统一 subagent 标记 = XYZ_AGENT_SUBAGENT=1
|
|
74
|
+
* (见 injectL0InfraKeys 恒注入),base-tool-enhance 判据已重锚新标记。通道保留待
|
|
75
|
+
* 另行裁决,读者见 docs/architecture/ext-simplify-17-shared-extraction.md §3.1 D4
|
|
76
|
+
* 与探针报告 .tmp/dev-flow/ext-simplify-17-d4-probe.md。
|
|
77
|
+
*/
|
|
71
78
|
identityEnv?: Record<string, string | undefined>;
|
|
72
79
|
/** L2:manifest 声明的 envPrefixes 放行清单(保留前缀拒绝 + 形态校验) */
|
|
73
80
|
envPrefixes?: readonly string[];
|
package/src/nesting-guard.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
//
|
|
18
18
|
// [D3-⑤ 嵌套防护合一] 进程内执行嵌套上下文(原 SubagentService.execCtxAls,pi 路径
|
|
19
19
|
// 私有)并入本文件——「嵌套防护」的两层机制(跨进程 env 标记 / 进程内 ALS 深度计数)
|
|
20
|
-
// 单点于公共层。设计权威源:docs/design/
|
|
20
|
+
// 单点于公共层。设计权威源:docs/design/dual-track(已删 git 可追溯)§3.3 D3-⑤
|
|
21
21
|
// + 双轨清单 #10。
|
|
22
22
|
|
|
23
23
|
import { AsyncLocalStorage } from "node:async_hooks";
|
package/src/paths.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { join } from 'node:path';
|
|
|
7
7
|
* 自算池/journal 路径);core 侧引用切换已完成(core execution/engine/paths.ts 为
|
|
8
8
|
* re-export shim,子入口 ./engine/paths 解析路径不变)。
|
|
9
9
|
*
|
|
10
|
-
* 设计权威源:subagent-engine-abstraction.md D5/D6
|
|
10
|
+
* 设计权威源:constraints.json C-ext-15(原 subagent-engine-abstraction.md D5/D6,已删,git 可追溯)。
|
|
11
11
|
*
|
|
12
12
|
* 为什么独立成模块:extension 写侧(journal 落盘 / preparer 池目录)与
|
|
13
13
|
* runtime 校验侧(subagent-extractor 前缀白名单)必须同源推导——
|
package/src/port-contract.ts
CHANGED
|
@@ -63,19 +63,21 @@ export interface EngineStream {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
66
|
+
* journal 固定分组 key(值锚定,**只承载、不透传**):journal 落盘路径
|
|
67
|
+
* `<dataDir>/engines/<engineId>/<本值>/journal-<taskId>.jsonl` 的第二段,两引擎恒
|
|
68
|
+
* 本值(pi / zcode 均无池化实现——pi = PI_CODING_AGENT_DIR 全局一份,zcode = 共享
|
|
69
|
+
* 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议面(RunContext/run.params.ctx/
|
|
70
|
+
* host/poolResolved 通道/EngineHandleData)已整体退役,本常量不再跨进程透传,仅
|
|
71
|
+
* 三类消费:① journal 落盘路径构造(core journal-wiring);② 存量 record 兼容
|
|
72
|
+
* (zcode read 旧相对 dbPath 的锚定分支 + 持久化 engineHandle.poolKey 字段——
|
|
73
|
+
* record-store 读侧守卫要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
|
|
74
|
+
* 的签名参数。**值逐字不变**(存量 journal 落盘路径与记录含该值分段,改名不改值)。
|
|
72
75
|
*/
|
|
73
76
|
export const SHARED_POOL_KEY = "shared";
|
|
74
77
|
|
|
75
78
|
/** run 的运行期上下文(core RunContext 结构等价镜像;resume? = 会话形态参数,缺省一次性任务)。 */
|
|
76
79
|
export interface RunContext {
|
|
77
80
|
taskId: string;
|
|
78
|
-
poolKey: string;
|
|
79
81
|
signal?: AbortSignal;
|
|
80
82
|
onEvent?: (event: AgentEvent) => void;
|
|
81
83
|
ctxModel?: EngineCtxModel;
|
|
@@ -94,8 +96,7 @@ export interface RunContext {
|
|
|
94
96
|
* [LEGACY] fallback(独立运行/测试形态)。
|
|
95
97
|
*/
|
|
96
98
|
sessionDir?: string;
|
|
97
|
-
|
|
98
|
-
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef" | "poolKey">) => void;
|
|
99
|
+
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef">) => void;
|
|
99
100
|
/** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议面)。 */
|
|
100
101
|
onChildSpawned?: (child: { pid: number | undefined; killed: boolean }) => void;
|
|
101
102
|
/**
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// src/protocol/contract-types.ts
|
|
2
2
|
//
|
|
3
3
|
// 引擎面契约类型 SSOT(协议两侧不许各写一份;core 反向 re-export 保上层消费面)。
|
|
4
|
-
// 设计权威源:docs/
|
|
4
|
+
// 设计权威源:docs/architecture/subagent-engine-protocolization.md §3.5.1 D7 类型闭包表 +
|
|
5
5
|
// impl-plan §2.1「类型闭包处置」。
|
|
6
6
|
//
|
|
7
7
|
// 搬运口径(逐字对照,结构等价、零 core import):
|
|
8
8
|
// - AgentEvent / AgentUsage / AgentUsageTotal / ToolCallResult / ToolCall /
|
|
9
|
-
// InternalToolCall / Turn ← core execution/types.ts(2026-09-09 实测 :164-:313)
|
|
9
|
+
// InternalToolCall / Turn ← core execution/assembly/types.ts(2026-09-09 实测 :164-:313)
|
|
10
10
|
// - ReplayedTurn / SessionView / EngineHandleData / EngineCapabilities / ProbeReport /
|
|
11
11
|
// AgentOutcome ← core execution/engine/types.ts
|
|
12
12
|
// - AgentFailureKind / AgentOutcomeUsage(core 名 AgentUsage,orchestration 版)/
|
|
13
13
|
// ToolCallEntry / AgentCallOpts 子集 ← core orchestration/models/types.ts
|
|
14
|
-
// - WorktreeHandle ← core execution/types.ts:349(SDK 结构等价副本——设计 §3.5.1
|
|
14
|
+
// - WorktreeHandle ← core execution/assembly/types.ts:349(SDK 结构等价副本——设计 §3.5.1
|
|
15
15
|
// 点名「AgentCallOpts.worktree 的 WorktreeHandle 即这类副本」)
|
|
16
16
|
//
|
|
17
17
|
// [H1] InteractAction / InteractResult 已随 chat-run 统一退役(U5 删除;
|
|
18
|
-
// docs/
|
|
18
|
+
// docs/architecture/subagent-chat-run-unification.md §3.3 D5——续聊统一为新 run + resume)。
|
|
19
19
|
//
|
|
20
20
|
// core 域类型(ExecutionRecord / Turn 的宿主内部态消费)留 core;SDK 侧一切类型为
|
|
21
21
|
// 结构等价形态,漂移由双向可赋值断言(AssertMutuallyAssignable)在 typecheck 期抓出
|
|
@@ -44,7 +44,7 @@ export type AssertMutuallyAssignable<A, B> = [A] extends [B]
|
|
|
44
44
|
// 事件面(AgentEvent 及其字段型)
|
|
45
45
|
// ============================================================
|
|
46
46
|
|
|
47
|
-
/** token 用量(message_end 单条消息增量)。← core execution/types.ts AgentUsage。 */
|
|
47
|
+
/** token 用量(message_end 单条消息增量)。← core execution/assembly/types.ts AgentUsage。 */
|
|
48
48
|
export interface AgentUsage {
|
|
49
49
|
input: number;
|
|
50
50
|
output: number;
|
|
@@ -100,7 +100,7 @@ export interface Turn {
|
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* 引擎事件(9 种,协议 event.params.event 逐字序列化——「事件与 handle 序列化逐字
|
|
103
|
-
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/types.ts 注释)。
|
|
103
|
+
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/assembly/types.ts 注释)。
|
|
104
104
|
*
|
|
105
105
|
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
106
106
|
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
@@ -131,9 +131,11 @@ export interface EngineHandleData {
|
|
|
131
131
|
engineId: string;
|
|
132
132
|
/** 引擎自定义定位键值。pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath }。 */
|
|
133
133
|
sessionRef: Record<string, string>;
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
/**
|
|
135
|
+
* journal 绝对路径(read 第②级数据源;宿主读前校验前缀白名单)。缺省 = 无 journal。
|
|
136
|
+
* [池抽象降级 2026-09-13] 原 poolKey 字段已删除——两引擎 poolKey 恒 'shared'
|
|
137
|
+
* (SDK SHARED_POOL_KEY),journal 固定落 engines/<engineId>/shared/,字段零信息量。
|
|
138
|
+
*/
|
|
137
139
|
journalPath?: string;
|
|
138
140
|
/** probe 实测版本(漂移排查锚点)。 */
|
|
139
141
|
engineVersion?: string;
|
|
@@ -152,8 +154,6 @@ export interface EngineHandleData {
|
|
|
152
154
|
export interface ResumeAnchor {
|
|
153
155
|
/** 引擎定位键(pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath })。 */
|
|
154
156
|
sessionRef: Record<string, string>;
|
|
155
|
-
/** 隔离池定位(锚点补全 handle 重建所需;pi 无池化恒 'shared')。 */
|
|
156
|
-
poolKey: string;
|
|
157
157
|
/** journal 绝对路径(read 降级链第②级数据源;无 journal 缺省)。 */
|
|
158
158
|
journalPath?: string;
|
|
159
159
|
}
|
|
@@ -196,11 +196,16 @@ export interface EngineCapabilities {
|
|
|
196
196
|
/** 注意区分「引擎 RPC 层有此能力」与「subagent 链路已接通」。 */
|
|
197
197
|
steer: "native" | "emulated" | "unsupported";
|
|
198
198
|
/**
|
|
199
|
-
* [H1 D5 语义收窄
|
|
199
|
+
* [H1 D5 语义收窄 + modeless] 「怎么续」形态轴兼 message 资格轴:
|
|
200
|
+
* 位非 'unsupported' = 引擎可续聊(core capability-gate 的 message 资格门消费),
|
|
201
|
+
* 值区分续聊形态——native(原地续写)/ cold(冷恢复重建 + 新 run + resume 锚点)。
|
|
200
202
|
* 原名字沿用——conversation 位保留、语义从「interact 长驻控制面」收窄为
|
|
201
|
-
* 「resume
|
|
203
|
+
* 「resume 续聊能力」。[modeless 波2] 会话形态键只剩 run.params.resume(协议
|
|
204
|
+
* task.conversation 已删),本轴不再是 per-run 模式开关——描述各引擎的真实
|
|
205
|
+
* 续聊差异(gate 判据仍是 `=== "unsupported"` 拒绝,"cold" 与 "native" 等价
|
|
206
|
+
* 放行)。
|
|
202
207
|
*/
|
|
203
|
-
conversation: "native" | "unsupported";
|
|
208
|
+
conversation: "native" | "cold" | "unsupported";
|
|
204
209
|
/** 决定 persona 路由策略(file/flag/prompt 通道)。 */
|
|
205
210
|
personaInjection: "file" | "flag" | "prompt";
|
|
206
211
|
/** 粗粒度引擎:GUI 显示降级为阶段态。 */
|
|
@@ -258,7 +263,7 @@ export interface ToolCallEntry {
|
|
|
258
263
|
input: string;
|
|
259
264
|
}
|
|
260
265
|
|
|
261
|
-
/** worktree 句柄(结构等价副本;core 权威定义在 execution/types.ts:349)。 */
|
|
266
|
+
/** worktree 句柄(结构等价副本;core 权威定义在 execution/assembly/types.ts:349)。 */
|
|
262
267
|
export interface WorktreeHandle {
|
|
263
268
|
/** checkout 目录(子 agent 工作目录)。 */
|
|
264
269
|
readonly path: string;
|
|
@@ -317,7 +322,7 @@ export interface ModelCatalogEntry {
|
|
|
317
322
|
*
|
|
318
323
|
* 字段裁决(对照 core orchestration/models/types.ts AgentCallOpts,2026-09-09):
|
|
319
324
|
* - 入选 = 引擎消费面:任务语义(prompt/schema/thinkingLevel/skill/skillPath/agent/persona 注入)、
|
|
320
|
-
* 轮次预算(maxTurns/graceTurns/
|
|
325
|
+
* 轮次预算(maxTurns/graceTurns/idleTimeoutMs)、隔离与权限(worktree/
|
|
321
326
|
* fork/forkSource/denyTools/permissionMode)、诊断(description/scene);
|
|
322
327
|
* - 排除并改挂 run.params.ctx(协议层已单列,task 内双写会分叉):model(→ctx.model)、
|
|
323
328
|
* schemaEnv(→ctx.schemaEnv)、cwd(→ctx.cwd)、engineFallback(→ctx.engineFallback);
|
|
@@ -364,9 +369,7 @@ export interface AgentCallOpts {
|
|
|
364
369
|
forkSource?: string;
|
|
365
370
|
/** Filesystem isolation: 新建 worktree | 复用外部已创建 worktree | 不隔离。 */
|
|
366
371
|
worktree?: boolean | WorktreeHandle;
|
|
367
|
-
/**
|
|
368
|
-
conversation?: boolean;
|
|
369
|
-
/** 空闲超时毫秒数(仅 conversation 模式有意义)。显式 0/负 = 禁用 idle GC。 */
|
|
372
|
+
/** 空闲超时毫秒数([modeless] 全体 record 的 idle 回收节奏;显式 0/负 = 禁用 idle GC)。 */
|
|
370
373
|
idleTimeoutMs?: number;
|
|
371
374
|
/** 工具 denylist(各引擎做语法映射)。 */
|
|
372
375
|
denyTools?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/protocol/engine-protocol.ts
|
|
2
2
|
//
|
|
3
3
|
// 引擎协议 v1 版本常量与协商(W1 契约根)。设计权威源:
|
|
4
|
-
// docs/
|
|
4
|
+
// docs/architecture/subagent-engine-protocolization.md §3.3 + impl-plan §2.1。
|
|
5
5
|
//
|
|
6
6
|
// 传输 = stdio NDJSON(每行一个 JSON 对象)。stdout 独占协议帧;stderr 常驻排空
|
|
7
7
|
// (内存环形缓冲尾 400 字符,崩溃现场由 engine_crashed 携带,宿主侧不落盘)。
|
|
@@ -11,17 +11,18 @@
|
|
|
11
11
|
// 不影响其他引擎与宿主。
|
|
12
12
|
//
|
|
13
13
|
// [v1.x 增量语义(chat-domain 设计 §3.2 D1-A/§3.3)][H1 后历史叙述——run.params.chat
|
|
14
|
-
// 已随 U6 删除,现唯一会话形态键 = run.params.resume]
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
14
|
+
// 已随 U6 删除,现唯一会话形态键 = run.params.resume;[modeless 波2] 协议 task 的
|
|
15
|
+
// conversation 键已删(core 侧 deprecated 参数不再上 wire,resume 键携带全部会话
|
|
16
|
+
// 形态)]:chat 域增量曾以**可选载荷/可选参数**形态向后兼容,major 不 bump、不引入
|
|
17
|
+
// minor 协商位:
|
|
18
|
+
// - 新 core × 旧引擎:会话形态请求(resume 续聊)被 conversation gate
|
|
18
19
|
// 同步拒(manifest 无 gate 位,
|
|
19
20
|
// A6 方向——engine_capability_unsupported + 升级引擎包指引);run 域零影响;
|
|
20
21
|
// 事件变体增量同政策(例:activity 活性信号变体):新变体以可选载荷形态进
|
|
21
22
|
// union,旧宿主 runtime 对其 no-op(reducer default 分支安全落空 / journal
|
|
22
23
|
// 豁免面不感知),协议版本维持 1、不 bump。
|
|
23
24
|
//
|
|
24
|
-
// [H1 双键过渡(chat-run 统一,docs/
|
|
25
|
+
// [H1 双键过渡(chat-run 统一,docs/architecture/subagent-chat-run-unification.md §3.3
|
|
25
26
|
// D3 + §5 U1 行)][H1 U6 已切换]:run.params.resume 曾与原 run.params.chat 载荷
|
|
26
27
|
// 同形并存(additive 可选,协议版本维持 1);U1 只加键——U2-U5 过渡期 core 恒
|
|
27
28
|
// 构造旧 `chat` 键、pi 引擎恒读 `ctx.chat`。U6 已单批同时切换写端(core 构造
|
|
@@ -83,9 +84,9 @@ export const ENGINE_EVENT_COALESCE_DEFAULT = "0";
|
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* 反向请求超时二分(帧④注释,R9-2):
|
|
86
|
-
* - 数据面类(host/log / host/streamDelta / host/
|
|
87
|
+
* - 数据面类(host/log / host/streamDelta / host/handleReady /
|
|
87
88
|
* host/childSpawned / host/childStateChanged):10s 未答 = 引擎故障;
|
|
88
|
-
* - 人机交互类(host/askUser
|
|
89
|
+
* - 人机交互类(host/askUser):不设统一超时——core 先回 {ack:true},
|
|
89
90
|
* 结果异步到达;按 ADR-0047「静默 ≠ 卡死」用无进展检测/用户取消,不据此判引擎故障。
|
|
90
91
|
*/
|
|
91
92
|
export type ReverseRequestTimeoutClass = "data-plane" | "interaction";
|
|
@@ -101,33 +101,32 @@ export function engineProtocolMismatchError(engineVersion: number): EngineSdkErr
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// ============================================================
|
|
104
|
-
//
|
|
104
|
+
// conversation gate 位负向:manifest 能力轴(message 资格 / 「怎么续」形态轴)
|
|
105
105
|
// ============================================================
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
* [
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* ——W3 chat 路由切协议客户端时以本构造器替换 core 内联文案,保持两侧一致。
|
|
108
|
+
* 引擎 conversation 位拒绝的具名错误([modeless 波2] 语义:无 resume 续聊通道的
|
|
109
|
+
* 引擎,message 续聊资格被拒——manifest conversation 能力轴消费,core
|
|
110
|
+
* capability-gate 的 conversation 分支与 message 资格门双写点共用本构造器)。
|
|
111
|
+
* 文案契约:错误码 engine_capability_unsupported + 「去掉参数 / 修 manifest /
|
|
112
|
+
* 升级引擎包」恢复指引,两侧一致防漂移。
|
|
114
113
|
*/
|
|
115
114
|
export function engineConversationUnsupportedError(engineId: string): EngineSdkError {
|
|
116
115
|
return new EngineSdkError(
|
|
117
116
|
"engine_capability_unsupported",
|
|
118
117
|
`engine '${engineId}' 不支持 resume 续聊(capabilities.conversation = 'unsupported',` +
|
|
119
118
|
`manifest 无 conversation gate 位)`,
|
|
120
|
-
`去掉 conversation
|
|
119
|
+
`去掉 conversation 参数(modeless 下无行为效果),或修 manifest capabilities / 升级引擎包(若引擎实际支持该能力)`,
|
|
121
120
|
{ engineId, capability: "conversation", declared: "unsupported" },
|
|
122
121
|
);
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
/**
|
|
126
|
-
*
|
|
127
|
-
* manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
125
|
+
* resume 会话形态(run.params.resume——唯一会话形态键)派发前的同步 gate:
|
|
126
|
+
* manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError
|
|
127
|
+
* ——进程/record 创建前同步拒(A6 方向防御:manifest/实装漂移时引擎侧自拒,
|
|
128
|
+
* 与 core capability-gate 同一能力位,防两侧判据漂移)。[modeless 波2] 协议
|
|
129
|
+
* task 的 conversation 键已删,本 gate 只对 resume 形态键生效。
|
|
131
130
|
*/
|
|
132
131
|
export function assertChatConversationSupported(
|
|
133
132
|
engineId: string,
|
package/src/protocol/frames.ts
CHANGED
|
@@ -82,13 +82,11 @@ export interface ReverseRequestFrame {
|
|
|
82
82
|
export type ReverseResponseResult =
|
|
83
83
|
/** 数据面类:处理确认。 */
|
|
84
84
|
| { ok: true }
|
|
85
|
-
/** 人机交互类(askUser
|
|
85
|
+
/** 人机交互类(askUser)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
|
|
86
86
|
| { ack: true }
|
|
87
87
|
/** 未实现的交互能力(设计:未实现回 unsupported,引擎自行降级)。 */
|
|
88
88
|
| { unsupported: true };
|
|
89
89
|
|
|
90
|
-
export type AnyFrame = RequestFrame | ResponseFrame | NotificationFrame | ReverseRequestFrame;
|
|
91
|
-
|
|
92
90
|
// ============================================================
|
|
93
91
|
// 判别守卫(W2 行解析器消费;结构判定,不抛错)
|
|
94
92
|
// ============================================================
|
package/src/protocol/methods.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// [v1.x 增量(chat-domain 设计 §3.2 D1-A)]:增量以可选参数形态落在 run.params.chat
|
|
7
7
|
// (会话形态参数 + 冷续 resume 锚点),major 不 bump。[H1] chat-run 统一后续聊 =
|
|
8
|
-
// 新 run + resume 锚点(docs/
|
|
8
|
+
// 新 run + resume 锚点(docs/architecture/subagent-chat-run-unification.md §3.3 D5/D7),
|
|
9
9
|
// 既有 interact 方法已随 U5 删除,方法集收敛为 9 个。
|
|
10
10
|
//
|
|
11
11
|
// 应答面补充约定(设计 §3.3):initialize 应答仅诊断(与 manifest 不一致 → warn 留痕,
|
|
@@ -26,7 +26,7 @@ import type {
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* 正向方法名联合(恰好 9 个;PROTOCOL_METHODS 常量数组与之同源互证)。
|
|
29
|
-
* [H1] `interact` 成员已随 chat-run 统一退役(docs/
|
|
29
|
+
* [H1] `interact` 成员已随 chat-run 统一退役(docs/architecture/subagent-chat-run-unification.md
|
|
30
30
|
* §3.3 D5:续聊轮统一为「新 run + resume 锚点」,U5 删除)。
|
|
31
31
|
*/
|
|
32
32
|
export type ProtocolMethod =
|
|
@@ -61,8 +61,6 @@ export const PROTOCOL_METHODS = [
|
|
|
61
61
|
* run 上下文(RunContext 字段映射的协议承载,设计 §3.3 RunContext 映射表)。
|
|
62
62
|
*/
|
|
63
63
|
export interface RunContextParams {
|
|
64
|
-
/** 隔离池归属(journal 归属错 = 缺失后果)。 */
|
|
65
|
-
poolKey: string;
|
|
66
64
|
/** 任务工作目录(worktree 隔离时 = worktree 路径)。 */
|
|
67
65
|
cwd: string;
|
|
68
66
|
/** 请求模型 ref(未传 = 引擎缺省模型)。 */
|
|
@@ -96,7 +94,7 @@ export interface RunContextParams {
|
|
|
96
94
|
// ============================================================
|
|
97
95
|
|
|
98
96
|
/**
|
|
99
|
-
* [H1] run 的 resume 会话形态参数(设计 docs/
|
|
97
|
+
* [H1] run 的 resume 会话形态参数(设计 docs/architecture/subagent-chat-run-unification.md
|
|
100
98
|
* §3.3 D3 + §5 U1/U6 行):原 RunChatParams(v1.x chat 会话形态参数)的泛化改名终态,
|
|
101
99
|
* 载荷同形(recordId + resume 锚点,ResumeAnchor 不变),仅键名从「chat 会话形态」
|
|
102
100
|
* 泛化为「resume 续聊」。
|