@zhushanwen/subagent-engine-sdk 0.3.0 → 0.4.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-TGDMOLZU.js → chunk-TW2FAMAJ.js} +2 -18
- package/dist/{contract-types-ByIFoLrY.d.cts → contract-types-C71Sqq8d.d.cts} +13 -9
- package/dist/{contract-types-ByIFoLrY.d.ts → contract-types-C71Sqq8d.d.ts} +13 -9
- package/dist/{error-codes-BUx92qYi.d.ts → error-codes-CiOO3PMg.d.cts} +3 -4
- package/dist/{error-codes-DCiilt_8.d.cts → error-codes-D5YlWaBx.d.ts} +3 -4
- package/dist/index.cjs +2 -20
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -5
- 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/port-contract.d.cts +11 -10
- package/dist/port-contract.d.ts +11 -10
- package/dist/protocol/index.cjs +2 -20
- package/dist/protocol/index.d.cts +19 -95
- package/dist/protocol/index.d.ts +19 -95
- package/dist/protocol/index.js +1 -5
- package/package.json +1 -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 +17 -13
- package/src/protocol/engine-protocol.ts +4 -4
- 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
|
@@ -37,9 +37,7 @@ var PROTOCOL_METHODS = [
|
|
|
37
37
|
var REVERSE_CHANNELS = [
|
|
38
38
|
"host/log",
|
|
39
39
|
"host/askUser",
|
|
40
|
-
"host/permission",
|
|
41
40
|
"host/streamDelta",
|
|
42
|
-
"host/poolResolved",
|
|
43
41
|
"host/handleReady",
|
|
44
42
|
"host/childSpawned",
|
|
45
43
|
"host/childStateChanged"
|
|
@@ -47,21 +45,11 @@ var REVERSE_CHANNELS = [
|
|
|
47
45
|
var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
48
46
|
"host/log": "data-plane",
|
|
49
47
|
"host/streamDelta": "data-plane",
|
|
50
|
-
"host/poolResolved": "data-plane",
|
|
51
48
|
"host/handleReady": "data-plane",
|
|
52
49
|
"host/childSpawned": "data-plane",
|
|
53
50
|
"host/childStateChanged": "data-plane",
|
|
54
|
-
"host/askUser": "interaction"
|
|
55
|
-
"host/permission": "interaction"
|
|
51
|
+
"host/askUser": "interaction"
|
|
56
52
|
};
|
|
57
|
-
function isHostStreamDeltaParams(value) {
|
|
58
|
-
if (typeof value !== "object" || value === null) return false;
|
|
59
|
-
const v = value;
|
|
60
|
-
const hasRunId = typeof v.runId === "string";
|
|
61
|
-
const hasRecordId = typeof v.recordId === "string";
|
|
62
|
-
if (hasRunId === hasRecordId) return false;
|
|
63
|
-
return typeof v.delta === "string";
|
|
64
|
-
}
|
|
65
53
|
|
|
66
54
|
// src/protocol/schema.ts
|
|
67
55
|
var ANY_JSON = {};
|
|
@@ -179,7 +167,6 @@ var FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS = [
|
|
|
179
167
|
"password",
|
|
180
168
|
"secret"
|
|
181
169
|
];
|
|
182
|
-
var REVERSE_CHANNEL_NAMES = REVERSE_CHANNELS;
|
|
183
170
|
var runSessionParamsSchema = {
|
|
184
171
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
185
172
|
title: "EngineRunSessionParams",
|
|
@@ -191,11 +178,10 @@ var runSessionParamsSchema = {
|
|
|
191
178
|
resume: {
|
|
192
179
|
type: "object",
|
|
193
180
|
additionalProperties: false,
|
|
194
|
-
required: ["sessionRef"
|
|
181
|
+
required: ["sessionRef"],
|
|
195
182
|
properties: {
|
|
196
183
|
// ResumeAnchor.sessionRef = Record<string, string>(引擎定位键值对)
|
|
197
184
|
sessionRef: { type: "object", additionalProperties: { type: "string" } },
|
|
198
|
-
poolKey: { type: "string" },
|
|
199
185
|
journalPath: { type: "string" }
|
|
200
186
|
}
|
|
201
187
|
}
|
|
@@ -210,7 +196,6 @@ export {
|
|
|
210
196
|
PROTOCOL_METHODS,
|
|
211
197
|
REVERSE_CHANNELS,
|
|
212
198
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
213
|
-
isHostStreamDeltaParams,
|
|
214
199
|
protocolErrorSchema,
|
|
215
200
|
requestFrameSchema,
|
|
216
201
|
successResponseFrameSchema,
|
|
@@ -219,6 +204,5 @@ export {
|
|
|
219
204
|
reverseRequestFrameSchema,
|
|
220
205
|
ENGINE_PROTOCOL_SCHEMAS,
|
|
221
206
|
FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
|
|
222
|
-
REVERSE_CHANNEL_NAMES,
|
|
223
207
|
runSessionParamsSchema
|
|
224
208
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* const _assert: _CoreSdkAgentEvent = true;
|
|
8
8
|
*/
|
|
9
9
|
type AssertMutuallyAssignable<A, B> = [A] extends [B] ? [B] extends [A] ? true : never : never;
|
|
10
|
-
/** token 用量(message_end 单条消息增量)。← core execution/types.ts AgentUsage。 */
|
|
10
|
+
/** token 用量(message_end 单条消息增量)。← core execution/assembly/types.ts AgentUsage。 */
|
|
11
11
|
interface AgentUsage {
|
|
12
12
|
input: number;
|
|
13
13
|
output: number;
|
|
@@ -57,7 +57,7 @@ interface Turn {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 引擎事件(9 种,协议 event.params.event 逐字序列化——「事件与 handle 序列化逐字
|
|
60
|
-
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/types.ts 注释)。
|
|
60
|
+
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/assembly/types.ts 注释)。
|
|
61
61
|
*
|
|
62
62
|
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
63
63
|
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
@@ -104,9 +104,11 @@ interface EngineHandleData {
|
|
|
104
104
|
engineId: string;
|
|
105
105
|
/** 引擎自定义定位键值。pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath }。 */
|
|
106
106
|
sessionRef: Record<string, string>;
|
|
107
|
-
/**
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
/**
|
|
108
|
+
* journal 绝对路径(read 第②级数据源;宿主读前校验前缀白名单)。缺省 = 无 journal。
|
|
109
|
+
* [池抽象降级 2026-09-13] 原 poolKey 字段已删除——两引擎 poolKey 恒 'shared'
|
|
110
|
+
* (SDK SHARED_POOL_KEY),journal 固定落 engines/<engineId>/shared/,字段零信息量。
|
|
111
|
+
*/
|
|
110
112
|
journalPath?: string;
|
|
111
113
|
/** probe 实测版本(漂移排查锚点)。 */
|
|
112
114
|
engineVersion?: string;
|
|
@@ -124,8 +126,6 @@ interface EngineHandleData {
|
|
|
124
126
|
interface ResumeAnchor {
|
|
125
127
|
/** 引擎定位键(pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath })。 */
|
|
126
128
|
sessionRef: Record<string, string>;
|
|
127
|
-
/** 隔离池定位(锚点补全 handle 重建所需;pi 无池化恒 'shared')。 */
|
|
128
|
-
poolKey: string;
|
|
129
129
|
/** journal 绝对路径(read 降级链第②级数据源;无 journal 缺省)。 */
|
|
130
130
|
journalPath?: string;
|
|
131
131
|
}
|
|
@@ -164,8 +164,12 @@ interface EngineCapabilities {
|
|
|
164
164
|
* [H1 D5 语义收窄] resume 能力位(chat 续聊 = 新 run + resume 锚点的承载前提;
|
|
165
165
|
* 原名字沿用——conversation 位保留、语义从「interact 长驻控制面」收窄为
|
|
166
166
|
* 「resume 续聊能力」,gate 判据与消费方不变)。
|
|
167
|
+
* [U6 / 永久会话模型 §3.2.6 要点 4] 新值 "cold" = 冷恢复会话:resume 读通道取
|
|
168
|
+
* 结构化历史 + 新 session 注入(无热 steering)。gate 判据仍是 `=== "unsupported"`
|
|
169
|
+
* 拒绝——"cold" 在 gate 面与 "native" 等价放行,差异只在续聊形态(新 session
|
|
170
|
+
* 注入 vs 原地续写)。
|
|
167
171
|
*/
|
|
168
|
-
conversation: "native" | "unsupported";
|
|
172
|
+
conversation: "native" | "cold" | "unsupported";
|
|
169
173
|
/** 决定 persona 路由策略(file/flag/prompt 通道)。 */
|
|
170
174
|
personaInjection: "file" | "flag" | "prompt";
|
|
171
175
|
/** 粗粒度引擎:GUI 显示降级为阶段态。 */
|
|
@@ -221,7 +225,7 @@ interface ToolCallEntry {
|
|
|
221
225
|
/** Args preview string. */
|
|
222
226
|
input: string;
|
|
223
227
|
}
|
|
224
|
-
/** worktree 句柄(结构等价副本;core 权威定义在 execution/types.ts:349)。 */
|
|
228
|
+
/** worktree 句柄(结构等价副本;core 权威定义在 execution/assembly/types.ts:349)。 */
|
|
225
229
|
interface WorktreeHandle {
|
|
226
230
|
/** checkout 目录(子 agent 工作目录)。 */
|
|
227
231
|
readonly path: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* const _assert: _CoreSdkAgentEvent = true;
|
|
8
8
|
*/
|
|
9
9
|
type AssertMutuallyAssignable<A, B> = [A] extends [B] ? [B] extends [A] ? true : never : never;
|
|
10
|
-
/** token 用量(message_end 单条消息增量)。← core execution/types.ts AgentUsage。 */
|
|
10
|
+
/** token 用量(message_end 单条消息增量)。← core execution/assembly/types.ts AgentUsage。 */
|
|
11
11
|
interface AgentUsage {
|
|
12
12
|
input: number;
|
|
13
13
|
output: number;
|
|
@@ -57,7 +57,7 @@ interface Turn {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 引擎事件(9 种,协议 event.params.event 逐字序列化——「事件与 handle 序列化逐字
|
|
60
|
-
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/types.ts 注释)。
|
|
60
|
+
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/assembly/types.ts 注释)。
|
|
61
61
|
*
|
|
62
62
|
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
63
63
|
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
@@ -104,9 +104,11 @@ interface EngineHandleData {
|
|
|
104
104
|
engineId: string;
|
|
105
105
|
/** 引擎自定义定位键值。pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath }。 */
|
|
106
106
|
sessionRef: Record<string, string>;
|
|
107
|
-
/**
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
/**
|
|
108
|
+
* journal 绝对路径(read 第②级数据源;宿主读前校验前缀白名单)。缺省 = 无 journal。
|
|
109
|
+
* [池抽象降级 2026-09-13] 原 poolKey 字段已删除——两引擎 poolKey 恒 'shared'
|
|
110
|
+
* (SDK SHARED_POOL_KEY),journal 固定落 engines/<engineId>/shared/,字段零信息量。
|
|
111
|
+
*/
|
|
110
112
|
journalPath?: string;
|
|
111
113
|
/** probe 实测版本(漂移排查锚点)。 */
|
|
112
114
|
engineVersion?: string;
|
|
@@ -124,8 +126,6 @@ interface EngineHandleData {
|
|
|
124
126
|
interface ResumeAnchor {
|
|
125
127
|
/** 引擎定位键(pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath })。 */
|
|
126
128
|
sessionRef: Record<string, string>;
|
|
127
|
-
/** 隔离池定位(锚点补全 handle 重建所需;pi 无池化恒 'shared')。 */
|
|
128
|
-
poolKey: string;
|
|
129
129
|
/** journal 绝对路径(read 降级链第②级数据源;无 journal 缺省)。 */
|
|
130
130
|
journalPath?: string;
|
|
131
131
|
}
|
|
@@ -164,8 +164,12 @@ interface EngineCapabilities {
|
|
|
164
164
|
* [H1 D5 语义收窄] resume 能力位(chat 续聊 = 新 run + resume 锚点的承载前提;
|
|
165
165
|
* 原名字沿用——conversation 位保留、语义从「interact 长驻控制面」收窄为
|
|
166
166
|
* 「resume 续聊能力」,gate 判据与消费方不变)。
|
|
167
|
+
* [U6 / 永久会话模型 §3.2.6 要点 4] 新值 "cold" = 冷恢复会话:resume 读通道取
|
|
168
|
+
* 结构化历史 + 新 session 注入(无热 steering)。gate 判据仍是 `=== "unsupported"`
|
|
169
|
+
* 拒绝——"cold" 在 gate 面与 "native" 等价放行,差异只在续聊形态(新 session
|
|
170
|
+
* 注入 vs 原地续写)。
|
|
167
171
|
*/
|
|
168
|
-
conversation: "native" | "unsupported";
|
|
172
|
+
conversation: "native" | "cold" | "unsupported";
|
|
169
173
|
/** 决定 persona 路由策略(file/flag/prompt 通道)。 */
|
|
170
174
|
personaInjection: "file" | "flag" | "prompt";
|
|
171
175
|
/** 粗粒度引擎:GUI 显示降级为阶段态。 */
|
|
@@ -221,7 +225,7 @@ interface ToolCallEntry {
|
|
|
221
225
|
/** Args preview string. */
|
|
222
226
|
input: string;
|
|
223
227
|
}
|
|
224
|
-
/** worktree 句柄(结构等价副本;core 权威定义在 execution/types.ts:349)。 */
|
|
228
|
+
/** worktree 句柄(结构等价副本;core 权威定义在 execution/assembly/types.ts:349)。 */
|
|
225
229
|
interface WorktreeHandle {
|
|
226
230
|
/** checkout 目录(子 agent 工作目录)。 */
|
|
227
231
|
readonly path: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AgentEvent, E as EngineCapabilities } from './contract-types-
|
|
1
|
+
import { a as AgentEvent, E as EngineCapabilities } from './contract-types-C71Sqq8d.cjs';
|
|
2
2
|
|
|
3
3
|
/** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
|
|
4
4
|
interface ProtocolError {
|
|
@@ -46,7 +46,7 @@ type ReverseResponseResult =
|
|
|
46
46
|
{
|
|
47
47
|
ok: true;
|
|
48
48
|
}
|
|
49
|
-
/** 人机交互类(askUser
|
|
49
|
+
/** 人机交互类(askUser)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
|
|
50
50
|
| {
|
|
51
51
|
ack: true;
|
|
52
52
|
}
|
|
@@ -54,7 +54,6 @@ type ReverseResponseResult =
|
|
|
54
54
|
| {
|
|
55
55
|
unsupported: true;
|
|
56
56
|
};
|
|
57
|
-
type AnyFrame = RequestFrame | ResponseFrame | NotificationFrame | ReverseRequestFrame;
|
|
58
57
|
/** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
|
|
59
58
|
declare function isRequestFrame(frame: unknown): frame is RequestFrame;
|
|
60
59
|
/** ② 应答:有 id(number|string)且 result/error 二选一。 */
|
|
@@ -116,4 +115,4 @@ declare function engineTimeoutDetail(stdoutTail: string): string;
|
|
|
116
115
|
/** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
|
|
117
116
|
declare function schemaEmulationFailedDetail(error: string, tail: string): string;
|
|
118
117
|
|
|
119
|
-
export {
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AgentEvent, E as EngineCapabilities } from './contract-types-
|
|
1
|
+
import { a as AgentEvent, E as EngineCapabilities } from './contract-types-C71Sqq8d.js';
|
|
2
2
|
|
|
3
3
|
/** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
|
|
4
4
|
interface ProtocolError {
|
|
@@ -46,7 +46,7 @@ type ReverseResponseResult =
|
|
|
46
46
|
{
|
|
47
47
|
ok: true;
|
|
48
48
|
}
|
|
49
|
-
/** 人机交互类(askUser
|
|
49
|
+
/** 人机交互类(askUser)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
|
|
50
50
|
| {
|
|
51
51
|
ack: true;
|
|
52
52
|
}
|
|
@@ -54,7 +54,6 @@ type ReverseResponseResult =
|
|
|
54
54
|
| {
|
|
55
55
|
unsupported: true;
|
|
56
56
|
};
|
|
57
|
-
type AnyFrame = RequestFrame | ResponseFrame | NotificationFrame | ReverseRequestFrame;
|
|
58
57
|
/** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
|
|
59
58
|
declare function isRequestFrame(frame: unknown): frame is RequestFrame;
|
|
60
59
|
/** ② 应答:有 id(number|string)且 result/error 二选一。 */
|
|
@@ -116,4 +115,4 @@ declare function engineTimeoutDetail(stdoutTail: string): string;
|
|
|
116
115
|
/** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
|
|
117
116
|
declare function schemaEmulationFailedDetail(error: string, tail: string): string;
|
|
118
117
|
|
|
119
|
-
export {
|
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -6608,7 +6608,6 @@ __export(src_exports, {
|
|
|
6608
6608
|
RELAY_EXIT_CODES: () => RELAY_EXIT_CODES,
|
|
6609
6609
|
RELAY_PROTOCOL_VERSION: () => RELAY_PROTOCOL_VERSION,
|
|
6610
6610
|
REVERSE_CHANNELS: () => REVERSE_CHANNELS,
|
|
6611
|
-
REVERSE_CHANNEL_NAMES: () => REVERSE_CHANNEL_NAMES,
|
|
6612
6611
|
REVERSE_CHANNEL_TIMEOUT_CLASS: () => REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
6613
6612
|
REVERSE_REQUEST_TIMEOUT_MS: () => REVERSE_REQUEST_TIMEOUT_MS,
|
|
6614
6613
|
SCHEMA_EMULATION_TAIL_CHARS: () => SCHEMA_EMULATION_TAIL_CHARS,
|
|
@@ -6642,7 +6641,6 @@ __export(src_exports, {
|
|
|
6642
6641
|
hostKindOf: () => hostKindOf,
|
|
6643
6642
|
isEngineErrorPassthroughCode: () => isEngineErrorPassthroughCode,
|
|
6644
6643
|
isEngineProtocolErrorCode: () => isEngineProtocolErrorCode,
|
|
6645
|
-
isHostStreamDeltaParams: () => isHostStreamDeltaParams,
|
|
6646
6644
|
isNotificationFrame: () => isNotificationFrame,
|
|
6647
6645
|
isPidAlive: () => isPidAlive,
|
|
6648
6646
|
isProtocolVersionCompatible: () => isProtocolVersionCompatible,
|
|
@@ -6750,9 +6748,7 @@ var PROTOCOL_METHODS = [
|
|
|
6750
6748
|
var REVERSE_CHANNELS = [
|
|
6751
6749
|
"host/log",
|
|
6752
6750
|
"host/askUser",
|
|
6753
|
-
"host/permission",
|
|
6754
6751
|
"host/streamDelta",
|
|
6755
|
-
"host/poolResolved",
|
|
6756
6752
|
"host/handleReady",
|
|
6757
6753
|
"host/childSpawned",
|
|
6758
6754
|
"host/childStateChanged"
|
|
@@ -6760,21 +6756,11 @@ var REVERSE_CHANNELS = [
|
|
|
6760
6756
|
var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
6761
6757
|
"host/log": "data-plane",
|
|
6762
6758
|
"host/streamDelta": "data-plane",
|
|
6763
|
-
"host/poolResolved": "data-plane",
|
|
6764
6759
|
"host/handleReady": "data-plane",
|
|
6765
6760
|
"host/childSpawned": "data-plane",
|
|
6766
6761
|
"host/childStateChanged": "data-plane",
|
|
6767
|
-
"host/askUser": "interaction"
|
|
6768
|
-
"host/permission": "interaction"
|
|
6762
|
+
"host/askUser": "interaction"
|
|
6769
6763
|
};
|
|
6770
|
-
function isHostStreamDeltaParams(value) {
|
|
6771
|
-
if (typeof value !== "object" || value === null) return false;
|
|
6772
|
-
const v = value;
|
|
6773
|
-
const hasRunId = typeof v.runId === "string";
|
|
6774
|
-
const hasRecordId = typeof v.recordId === "string";
|
|
6775
|
-
if (hasRunId === hasRecordId) return false;
|
|
6776
|
-
return typeof v.delta === "string";
|
|
6777
|
-
}
|
|
6778
6764
|
|
|
6779
6765
|
// src/protocol/error-codes.ts
|
|
6780
6766
|
var ENGINE_PROTOCOL_ERROR_CODES = [
|
|
@@ -6965,7 +6951,6 @@ var FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS = [
|
|
|
6965
6951
|
"password",
|
|
6966
6952
|
"secret"
|
|
6967
6953
|
];
|
|
6968
|
-
var REVERSE_CHANNEL_NAMES = REVERSE_CHANNELS;
|
|
6969
6954
|
var runSessionParamsSchema = {
|
|
6970
6955
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
6971
6956
|
title: "EngineRunSessionParams",
|
|
@@ -6977,11 +6962,10 @@ var runSessionParamsSchema = {
|
|
|
6977
6962
|
resume: {
|
|
6978
6963
|
type: "object",
|
|
6979
6964
|
additionalProperties: false,
|
|
6980
|
-
required: ["sessionRef"
|
|
6965
|
+
required: ["sessionRef"],
|
|
6981
6966
|
properties: {
|
|
6982
6967
|
// ResumeAnchor.sessionRef = Record<string, string>(引擎定位键值对)
|
|
6983
6968
|
sessionRef: { type: "object", additionalProperties: { type: "string" } },
|
|
6984
|
-
poolKey: { type: "string" },
|
|
6985
6969
|
journalPath: { type: "string" }
|
|
6986
6970
|
}
|
|
6987
6971
|
}
|
|
@@ -8316,7 +8300,6 @@ function runEngineCliEntry(opts) {
|
|
|
8316
8300
|
RELAY_EXIT_CODES,
|
|
8317
8301
|
RELAY_PROTOCOL_VERSION,
|
|
8318
8302
|
REVERSE_CHANNELS,
|
|
8319
|
-
REVERSE_CHANNEL_NAMES,
|
|
8320
8303
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
8321
8304
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
8322
8305
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
@@ -8350,7 +8333,6 @@ function runEngineCliEntry(opts) {
|
|
|
8350
8333
|
hostKindOf,
|
|
8351
8334
|
isEngineErrorPassthroughCode,
|
|
8352
8335
|
isEngineProtocolErrorCode,
|
|
8353
|
-
isHostStreamDeltaParams,
|
|
8354
8336
|
isNotificationFrame,
|
|
8355
8337
|
isPidAlive,
|
|
8356
8338
|
isProtocolVersionCompatible,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams,
|
|
2
|
-
export {
|
|
3
|
-
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as InternalToolCall, M as ModelCatalogEntry, P as ProbeReport, R as ReplayedTurn, i as ResumeAnchor, S as SessionView, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from './contract-types-
|
|
1
|
+
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostStreamDeltaParams, InitializeParams, InitializeResult, ListModelsParams, ListModelsResult, PROTOCOL_METHODS, PingParams, PingResult, ProbeParams, ProtocolMethod, ProtocolParamsMap, ProtocolResultMap, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReadParams, ReverseChannel, ReverseRequestTimeoutClass, RunContextParams, RunParams, RunResult, RunResumeParams, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, ValidateModelParams, ValidateModelResult, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.cjs';
|
|
2
|
+
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-CiOO3PMg.cjs';
|
|
3
|
+
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as InternalToolCall, M as ModelCatalogEntry, P as ProbeReport, R as ReplayedTurn, i as ResumeAnchor, S as SessionView, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from './contract-types-C71Sqq8d.cjs';
|
|
4
4
|
export { SCHEMA_EMULATION_TAIL_CHARS, StructuredOutputResult, buildSchemaEmulationSegment, extractAndValidateStructuredOutput } from './schema-emulation.cjs';
|
|
5
5
|
export { ExecutionNestingContext, ExecutionNestingState, NESTED_SPAWN_ENV, NestedSpawnRejectedError, SpawnEnv, assertNotNestedSpawn, buildNestedSpawnEnv } from './nesting-guard.cjs';
|
|
6
6
|
export { CoreLogger, LogLevel, LoggerSink, configureLoggerSink, getLogger, resetLoggerSinkForTests } from './logger.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams,
|
|
2
|
-
export {
|
|
3
|
-
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as InternalToolCall, M as ModelCatalogEntry, P as ProbeReport, R as ReplayedTurn, i as ResumeAnchor, S as SessionView, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from './contract-types-
|
|
1
|
+
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostStreamDeltaParams, InitializeParams, InitializeResult, ListModelsParams, ListModelsResult, PROTOCOL_METHODS, PingParams, PingResult, ProbeParams, ProtocolMethod, ProtocolParamsMap, ProtocolResultMap, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReadParams, ReverseChannel, ReverseRequestTimeoutClass, RunContextParams, RunParams, RunResult, RunResumeParams, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, ValidateModelParams, ValidateModelResult, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.js';
|
|
2
|
+
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-D5YlWaBx.js';
|
|
3
|
+
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as InternalToolCall, M as ModelCatalogEntry, P as ProbeReport, R as ReplayedTurn, i as ResumeAnchor, S as SessionView, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from './contract-types-C71Sqq8d.js';
|
|
4
4
|
export { SCHEMA_EMULATION_TAIL_CHARS, StructuredOutputResult, buildSchemaEmulationSegment, extractAndValidateStructuredOutput } from './schema-emulation.js';
|
|
5
5
|
export { ExecutionNestingContext, ExecutionNestingState, NESTED_SPAWN_ENV, NestedSpawnRejectedError, SpawnEnv, assertNotNestedSpawn, buildNestedSpawnEnv } from './nesting-guard.js';
|
|
6
6
|
export { CoreLogger, LogLevel, LoggerSink, configureLoggerSink, getLogger, resetLoggerSinkForTests } from './logger.js';
|
package/dist/index.js
CHANGED
|
@@ -73,10 +73,8 @@ import {
|
|
|
73
73
|
FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
|
|
74
74
|
PROTOCOL_METHODS,
|
|
75
75
|
REVERSE_CHANNELS,
|
|
76
|
-
REVERSE_CHANNEL_NAMES,
|
|
77
76
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
78
77
|
errorResponseFrameSchema,
|
|
79
|
-
isHostStreamDeltaParams,
|
|
80
78
|
isNotificationFrame,
|
|
81
79
|
isRequestFrame,
|
|
82
80
|
isResponseFrame,
|
|
@@ -87,7 +85,7 @@ import {
|
|
|
87
85
|
reverseRequestFrameSchema,
|
|
88
86
|
runSessionParamsSchema,
|
|
89
87
|
successResponseFrameSchema
|
|
90
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-TW2FAMAJ.js";
|
|
91
89
|
import {
|
|
92
90
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
93
91
|
buildSchemaEmulationSegment,
|
|
@@ -192,7 +190,6 @@ export {
|
|
|
192
190
|
RELAY_EXIT_CODES,
|
|
193
191
|
RELAY_PROTOCOL_VERSION,
|
|
194
192
|
REVERSE_CHANNELS,
|
|
195
|
-
REVERSE_CHANNEL_NAMES,
|
|
196
193
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
197
194
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
198
195
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
@@ -226,7 +223,6 @@ export {
|
|
|
226
223
|
hostKindOf,
|
|
227
224
|
isEngineErrorPassthroughCode,
|
|
228
225
|
isEngineProtocolErrorCode,
|
|
229
|
-
isHostStreamDeltaParams,
|
|
230
226
|
isNotificationFrame,
|
|
231
227
|
isPidAlive,
|
|
232
228
|
isProtocolVersionCompatible,
|
package/dist/journal-io.d.cts
CHANGED
package/dist/journal-io.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Turn, f as AgentUsageTotal, a as AgentEvent, S as SessionView, h as EngineHandleData, R as ReplayedTurn } from './contract-types-
|
|
1
|
+
import { l as Turn, f as AgentUsageTotal, a as AgentEvent, S as SessionView, h as EngineHandleData, R as ReplayedTurn } from './contract-types-C71Sqq8d.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这四个字段)。
|
package/dist/journal-replay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Turn, f as AgentUsageTotal, a as AgentEvent, S as SessionView, h as EngineHandleData, R as ReplayedTurn } from './contract-types-
|
|
1
|
+
import { l as Turn, f as AgentUsageTotal, a as AgentEvent, S as SessionView, h as EngineHandleData, R as ReplayedTurn } from './contract-types-C71Sqq8d.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这四个字段)。
|
package/dist/kill-chain.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-
|
|
2
|
-
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-
|
|
1
|
+
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-CiOO3PMg.cjs';
|
|
2
|
+
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-C71Sqq8d.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 可杀子进程的结构形状(Node ChildProcess 的结构子集)。
|
package/dist/kill-chain.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-
|
|
2
|
-
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-
|
|
1
|
+
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-D5YlWaBx.js';
|
|
2
|
+
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-C71Sqq8d.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 可杀子进程的结构形状(Node ChildProcess 的结构子集)。
|
package/dist/port-contract.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AgentCallOpts, h as EngineHandleData, E as EngineCapabilities, P as ProbeReport, a as AgentEvent, i as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-
|
|
1
|
+
import { A as AgentCallOpts, h as EngineHandleData, E as EngineCapabilities, P as ProbeReport, a as AgentEvent, i as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-C71Sqq8d.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎面子集 + 协议 ctx 还原字段(model/
|
|
@@ -27,18 +27,20 @@ interface EngineStream {
|
|
|
27
27
|
onDelta(delta: string): void;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
30
|
+
* journal 固定分组 key(值锚定,**只承载、不透传**):journal 落盘路径
|
|
31
|
+
* `<dataDir>/engines/<engineId>/<本值>/journal-<taskId>.jsonl` 的第二段,两引擎恒
|
|
32
|
+
* 本值(pi / zcode 均无池化实现——pi = PI_CODING_AGENT_DIR 全局一份,zcode = 共享
|
|
33
|
+
* 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议面(RunContext/run.params.ctx/
|
|
34
|
+
* host/poolResolved 通道/EngineHandleData)已整体退役,本常量不再跨进程透传,仅
|
|
35
|
+
* 三类消费:① journal 落盘路径构造(core journal-wiring);② 存量 record 兼容
|
|
36
|
+
* (zcode read 旧相对 dbPath 的锚定分支 + 持久化 engineHandle.poolKey 字段——
|
|
37
|
+
* record-store 读侧守卫要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
|
|
38
|
+
* 的签名参数。**值逐字不变**(存量 journal 落盘路径与记录含该值分段,改名不改值)。
|
|
36
39
|
*/
|
|
37
40
|
declare const SHARED_POOL_KEY = "shared";
|
|
38
41
|
/** run 的运行期上下文(core RunContext 结构等价镜像;resume? = 会话形态参数,缺省一次性任务)。 */
|
|
39
42
|
interface RunContext {
|
|
40
43
|
taskId: string;
|
|
41
|
-
poolKey: string;
|
|
42
44
|
signal?: AbortSignal;
|
|
43
45
|
onEvent?: (event: AgentEvent) => void;
|
|
44
46
|
ctxModel?: EngineCtxModel;
|
|
@@ -60,8 +62,7 @@ interface RunContext {
|
|
|
60
62
|
* [LEGACY] fallback(独立运行/测试形态)。
|
|
61
63
|
*/
|
|
62
64
|
sessionDir?: string;
|
|
63
|
-
|
|
64
|
-
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef" | "poolKey">) => void;
|
|
65
|
+
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef">) => void;
|
|
65
66
|
/** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议面)。 */
|
|
66
67
|
onChildSpawned?: (child: {
|
|
67
68
|
pid: number | undefined;
|
package/dist/port-contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AgentCallOpts, h as EngineHandleData, E as EngineCapabilities, P as ProbeReport, a as AgentEvent, i as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-
|
|
1
|
+
import { A as AgentCallOpts, h as EngineHandleData, E as EngineCapabilities, P as ProbeReport, a as AgentEvent, i as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-C71Sqq8d.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎面子集 + 协议 ctx 还原字段(model/
|
|
@@ -27,18 +27,20 @@ interface EngineStream {
|
|
|
27
27
|
onDelta(delta: string): void;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
30
|
+
* journal 固定分组 key(值锚定,**只承载、不透传**):journal 落盘路径
|
|
31
|
+
* `<dataDir>/engines/<engineId>/<本值>/journal-<taskId>.jsonl` 的第二段,两引擎恒
|
|
32
|
+
* 本值(pi / zcode 均无池化实现——pi = PI_CODING_AGENT_DIR 全局一份,zcode = 共享
|
|
33
|
+
* 宿主 HOME)。[池抽象降级 2026-09-13] poolKey 协议面(RunContext/run.params.ctx/
|
|
34
|
+
* host/poolResolved 通道/EngineHandleData)已整体退役,本常量不再跨进程透传,仅
|
|
35
|
+
* 三类消费:① journal 落盘路径构造(core journal-wiring);② 存量 record 兼容
|
|
36
|
+
* (zcode read 旧相对 dbPath 的锚定分支 + 持久化 engineHandle.poolKey 字段——
|
|
37
|
+
* record-store 读侧守卫要求非空,值恒本常量);③ 引擎数据目录布局 SSOT paths.ts
|
|
38
|
+
* 的签名参数。**值逐字不变**(存量 journal 落盘路径与记录含该值分段,改名不改值)。
|
|
36
39
|
*/
|
|
37
40
|
declare const SHARED_POOL_KEY = "shared";
|
|
38
41
|
/** run 的运行期上下文(core RunContext 结构等价镜像;resume? = 会话形态参数,缺省一次性任务)。 */
|
|
39
42
|
interface RunContext {
|
|
40
43
|
taskId: string;
|
|
41
|
-
poolKey: string;
|
|
42
44
|
signal?: AbortSignal;
|
|
43
45
|
onEvent?: (event: AgentEvent) => void;
|
|
44
46
|
ctxModel?: EngineCtxModel;
|
|
@@ -60,8 +62,7 @@ interface RunContext {
|
|
|
60
62
|
* [LEGACY] fallback(独立运行/测试形态)。
|
|
61
63
|
*/
|
|
62
64
|
sessionDir?: string;
|
|
63
|
-
|
|
64
|
-
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef" | "poolKey">) => void;
|
|
65
|
+
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef">) => void;
|
|
65
66
|
/** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议面)。 */
|
|
66
67
|
onChildSpawned?: (child: {
|
|
67
68
|
pid: number | undefined;
|
package/dist/protocol/index.cjs
CHANGED
|
@@ -35,7 +35,6 @@ __export(protocol_exports, {
|
|
|
35
35
|
HANDSHAKE_TIMEOUT_MS: () => HANDSHAKE_TIMEOUT_MS,
|
|
36
36
|
PROTOCOL_METHODS: () => PROTOCOL_METHODS,
|
|
37
37
|
REVERSE_CHANNELS: () => REVERSE_CHANNELS,
|
|
38
|
-
REVERSE_CHANNEL_NAMES: () => REVERSE_CHANNEL_NAMES,
|
|
39
38
|
REVERSE_CHANNEL_TIMEOUT_CLASS: () => REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
40
39
|
REVERSE_REQUEST_TIMEOUT_MS: () => REVERSE_REQUEST_TIMEOUT_MS,
|
|
41
40
|
STDERR_TAIL_CHARS: () => STDERR_TAIL_CHARS,
|
|
@@ -48,7 +47,6 @@ __export(protocol_exports, {
|
|
|
48
47
|
errorResponseFrameSchema: () => errorResponseFrameSchema,
|
|
49
48
|
isEngineErrorPassthroughCode: () => isEngineErrorPassthroughCode,
|
|
50
49
|
isEngineProtocolErrorCode: () => isEngineProtocolErrorCode,
|
|
51
|
-
isHostStreamDeltaParams: () => isHostStreamDeltaParams,
|
|
52
50
|
isNotificationFrame: () => isNotificationFrame,
|
|
53
51
|
isProtocolVersionCompatible: () => isProtocolVersionCompatible,
|
|
54
52
|
isRequestFrame: () => isRequestFrame,
|
|
@@ -125,9 +123,7 @@ var PROTOCOL_METHODS = [
|
|
|
125
123
|
var REVERSE_CHANNELS = [
|
|
126
124
|
"host/log",
|
|
127
125
|
"host/askUser",
|
|
128
|
-
"host/permission",
|
|
129
126
|
"host/streamDelta",
|
|
130
|
-
"host/poolResolved",
|
|
131
127
|
"host/handleReady",
|
|
132
128
|
"host/childSpawned",
|
|
133
129
|
"host/childStateChanged"
|
|
@@ -135,21 +131,11 @@ var REVERSE_CHANNELS = [
|
|
|
135
131
|
var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
136
132
|
"host/log": "data-plane",
|
|
137
133
|
"host/streamDelta": "data-plane",
|
|
138
|
-
"host/poolResolved": "data-plane",
|
|
139
134
|
"host/handleReady": "data-plane",
|
|
140
135
|
"host/childSpawned": "data-plane",
|
|
141
136
|
"host/childStateChanged": "data-plane",
|
|
142
|
-
"host/askUser": "interaction"
|
|
143
|
-
"host/permission": "interaction"
|
|
137
|
+
"host/askUser": "interaction"
|
|
144
138
|
};
|
|
145
|
-
function isHostStreamDeltaParams(value) {
|
|
146
|
-
if (typeof value !== "object" || value === null) return false;
|
|
147
|
-
const v = value;
|
|
148
|
-
const hasRunId = typeof v.runId === "string";
|
|
149
|
-
const hasRecordId = typeof v.recordId === "string";
|
|
150
|
-
if (hasRunId === hasRecordId) return false;
|
|
151
|
-
return typeof v.delta === "string";
|
|
152
|
-
}
|
|
153
139
|
|
|
154
140
|
// src/protocol/error-codes.ts
|
|
155
141
|
var ENGINE_PROTOCOL_ERROR_CODES = [
|
|
@@ -340,7 +326,6 @@ var FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS = [
|
|
|
340
326
|
"password",
|
|
341
327
|
"secret"
|
|
342
328
|
];
|
|
343
|
-
var REVERSE_CHANNEL_NAMES = REVERSE_CHANNELS;
|
|
344
329
|
var runSessionParamsSchema = {
|
|
345
330
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
346
331
|
title: "EngineRunSessionParams",
|
|
@@ -352,11 +337,10 @@ var runSessionParamsSchema = {
|
|
|
352
337
|
resume: {
|
|
353
338
|
type: "object",
|
|
354
339
|
additionalProperties: false,
|
|
355
|
-
required: ["sessionRef"
|
|
340
|
+
required: ["sessionRef"],
|
|
356
341
|
properties: {
|
|
357
342
|
// ResumeAnchor.sessionRef = Record<string, string>(引擎定位键值对)
|
|
358
343
|
sessionRef: { type: "object", additionalProperties: { type: "string" } },
|
|
359
|
-
poolKey: { type: "string" },
|
|
360
344
|
journalPath: { type: "string" }
|
|
361
345
|
}
|
|
362
346
|
}
|
|
@@ -379,7 +363,6 @@ var runSessionParamsSchema = {
|
|
|
379
363
|
HANDSHAKE_TIMEOUT_MS,
|
|
380
364
|
PROTOCOL_METHODS,
|
|
381
365
|
REVERSE_CHANNELS,
|
|
382
|
-
REVERSE_CHANNEL_NAMES,
|
|
383
366
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
384
367
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
385
368
|
STDERR_TAIL_CHARS,
|
|
@@ -392,7 +375,6 @@ var runSessionParamsSchema = {
|
|
|
392
375
|
errorResponseFrameSchema,
|
|
393
376
|
isEngineErrorPassthroughCode,
|
|
394
377
|
isEngineProtocolErrorCode,
|
|
395
|
-
isHostStreamDeltaParams,
|
|
396
378
|
isNotificationFrame,
|
|
397
379
|
isProtocolVersionCompatible,
|
|
398
380
|
isRequestFrame,
|