@zhushanwen/subagent-engine-sdk 0.2.1 → 0.3.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-A75XDJIC.js → chunk-AIG5LSGK.js} +3 -0
- package/dist/{chunk-ZXEAW25V.js → chunk-BBVZK5DL.js} +1 -4
- package/dist/chunk-EUSM6ZX4.js +10 -0
- package/dist/{chunk-LEOBWKRM.js → chunk-FJT23P7T.js} +1 -1
- package/dist/{chunk-N3RL6OVM.js → chunk-J4G2MXDS.js} +3 -1
- package/dist/{chunk-ZOFFJNJD.js → chunk-LKPVN3N6.js} +1 -1
- package/dist/{chunk-RULLX6C6.js → chunk-LQR73V67.js} +2 -0
- package/dist/{chunk-YFSN3D5N.js → chunk-TGDMOLZU.js} +25 -17
- package/dist/{chunk-PPEPBVCC.js → chunk-WS4WAZVR.js} +1 -1
- package/dist/cli-entry.cjs +3 -1
- package/dist/cli-entry.js +1 -1
- package/dist/{contract-types-sSlgppBC.d.cts → contract-types-ByIFoLrY.d.cts} +18 -34
- package/dist/{contract-types-sSlgppBC.d.ts → contract-types-ByIFoLrY.d.ts} +18 -34
- package/dist/env.cjs +1 -4
- package/dist/env.d.cts +4 -1
- package/dist/env.d.ts +4 -1
- package/dist/env.js +1 -1
- package/dist/{error-codes-Dhss2Kmk.d.ts → error-codes-BUx92qYi.d.ts} +5 -4
- package/dist/{error-codes-DHco5-i_.d.cts → error-codes-DCiilt_8.d.cts} +5 -4
- package/dist/index.cjs +45 -23
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +16 -11
- package/dist/journal-io.d.cts +1 -1
- package/dist/journal-io.d.ts +1 -1
- package/dist/journal-replay.cjs +3 -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.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.cjs +3 -0
- package/dist/port-contract.d.cts +41 -8
- package/dist/port-contract.d.ts +41 -8
- package/dist/port-contract.js +3 -1
- package/dist/protocol/index.cjs +26 -18
- package/dist/protocol/index.d.cts +95 -96
- package/dist/protocol/index.d.ts +95 -96
- package/dist/protocol/index.js +4 -4
- package/dist/ui-types.cjs +16 -0
- package/dist/ui-types.d.cts +13 -6
- package/dist/ui-types.d.ts +13 -6
- package/dist/ui-types.js +7 -1
- package/package.json +1 -1
- package/src/cli-entry.ts +6 -1
- package/src/data-dir.ts +3 -2
- package/src/env.ts +4 -4
- package/src/journal-replay.ts +4 -0
- package/src/port-contract.ts +40 -8
- package/src/protocol/contract-types.ts +20 -23
- package/src/protocol/engine-protocol.ts +19 -9
- package/src/protocol/error-codes.ts +7 -6
- package/src/protocol/methods.ts +38 -28
- package/src/protocol/reverse-channels.ts +15 -103
- package/src/protocol/schema.ts +36 -0
- package/src/ui-types.ts +22 -5
- package/dist/chunk-2DIMPZCQ.js +0 -0
|
@@ -164,6 +164,9 @@ function updateFromEvent(record, event) {
|
|
|
164
164
|
// ── compaction:不产生数据(不变)──
|
|
165
165
|
case "compaction":
|
|
166
166
|
return;
|
|
167
|
+
// ── activity:纯活性信号,reducer no-op(协议语义见 contract-types)──
|
|
168
|
+
case "activity":
|
|
169
|
+
return;
|
|
167
170
|
default: {
|
|
168
171
|
const _exhaustive = event;
|
|
169
172
|
return _exhaustive;
|
|
@@ -14,10 +14,7 @@ var ENGINE_ENV_DENY_LIST = [
|
|
|
14
14
|
"XYZ_RUNTIME_TOKEN",
|
|
15
15
|
"XYZ_AGENT_API_KEY",
|
|
16
16
|
"XYZ_SUBAGENT_RELAY_SESSION_ID",
|
|
17
|
-
"XYZ_SUBAGENT_RELAY_RECORD_ID"
|
|
18
|
-
"XYZ_SUBAGENT_RELAY_STDIN",
|
|
19
|
-
"XYZ_SUBAGENT_RELAY_STDOUT",
|
|
20
|
-
"XYZ_SUBAGENT_RELAY_STDERR"
|
|
17
|
+
"XYZ_SUBAGENT_RELAY_RECORD_ID"
|
|
21
18
|
];
|
|
22
19
|
var ENGINE_ENV_L0_INFRA_KEYS = [
|
|
23
20
|
"XYZ_AGENT_DATA_DIR",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/ui-types.ts
|
|
2
|
+
function isUiResponse(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null) return false;
|
|
4
|
+
const v = value;
|
|
5
|
+
return typeof v.value === "string" || typeof v.confirmed === "boolean" || v.cancelled === true || v.ack === true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
isUiResponse
|
|
10
|
+
};
|
|
@@ -11,8 +11,10 @@ function runEngineCliEntry(opts) {
|
|
|
11
11
|
const server = opts.server;
|
|
12
12
|
configureLoggerSink({
|
|
13
13
|
log(level, component, message, data) {
|
|
14
|
-
|
|
14
|
+
if (level !== "debug") {
|
|
15
|
+
process.stderr.write(`[${level}] [${component}] ${message}${data !== void 0 ? ` ${JSON.stringify(data)}` : ""}
|
|
15
16
|
`);
|
|
17
|
+
}
|
|
16
18
|
void server.reverseRequest("host/log", { level, component, message }).catch(() => void 0);
|
|
17
19
|
}
|
|
18
20
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/port-contract.ts
|
|
2
|
+
var SHARED_POOL_KEY = "shared";
|
|
2
3
|
function parseCtxModel(ref) {
|
|
3
4
|
if (ref === void 0 || ref.trim() === "") return void 0;
|
|
4
5
|
const slash = ref.indexOf("/");
|
|
@@ -7,5 +8,6 @@ function parseCtxModel(ref) {
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export {
|
|
11
|
+
SHARED_POOL_KEY,
|
|
10
12
|
parseCtxModel
|
|
11
13
|
};
|
|
@@ -26,7 +26,6 @@ var PROTOCOL_METHODS = [
|
|
|
26
26
|
"probe",
|
|
27
27
|
"run",
|
|
28
28
|
"cancel",
|
|
29
|
-
"interact",
|
|
30
29
|
"read",
|
|
31
30
|
"listModels",
|
|
32
31
|
"validateModel",
|
|
@@ -43,8 +42,7 @@ var REVERSE_CHANNELS = [
|
|
|
43
42
|
"host/poolResolved",
|
|
44
43
|
"host/handleReady",
|
|
45
44
|
"host/childSpawned",
|
|
46
|
-
"host/childStateChanged"
|
|
47
|
-
"host/roundLifecycle"
|
|
45
|
+
"host/childStateChanged"
|
|
48
46
|
];
|
|
49
47
|
var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
50
48
|
"host/log": "data-plane",
|
|
@@ -53,7 +51,6 @@ var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
|
53
51
|
"host/handleReady": "data-plane",
|
|
54
52
|
"host/childSpawned": "data-plane",
|
|
55
53
|
"host/childStateChanged": "data-plane",
|
|
56
|
-
"host/roundLifecycle": "data-plane",
|
|
57
54
|
"host/askUser": "interaction",
|
|
58
55
|
"host/permission": "interaction"
|
|
59
56
|
};
|
|
@@ -65,17 +62,6 @@ function isHostStreamDeltaParams(value) {
|
|
|
65
62
|
if (hasRunId === hasRecordId) return false;
|
|
66
63
|
return typeof v.delta === "string";
|
|
67
64
|
}
|
|
68
|
-
function isHostRoundLifecycleParams(value) {
|
|
69
|
-
if (typeof value !== "object" || value === null) return false;
|
|
70
|
-
const v = value;
|
|
71
|
-
const hasRunId = typeof v.runId === "string";
|
|
72
|
-
const hasRecordId = typeof v.recordId === "string";
|
|
73
|
-
if (hasRunId === hasRecordId) return false;
|
|
74
|
-
if (v.phase === "settled" || v.phase === "idle") return true;
|
|
75
|
-
if (v.phase !== "failed") return false;
|
|
76
|
-
const err = v.error;
|
|
77
|
-
return typeof err === "object" && err !== null && typeof err.code === "string" && typeof err.message === "string";
|
|
78
|
-
}
|
|
79
65
|
|
|
80
66
|
// src/protocol/schema.ts
|
|
81
67
|
var ANY_JSON = {};
|
|
@@ -155,6 +141,7 @@ var notificationFrameSchema = {
|
|
|
155
141
|
"turn_end",
|
|
156
142
|
"message_end",
|
|
157
143
|
"compaction",
|
|
144
|
+
"activity",
|
|
158
145
|
"error"
|
|
159
146
|
]
|
|
160
147
|
}
|
|
@@ -193,6 +180,27 @@ var FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS = [
|
|
|
193
180
|
"secret"
|
|
194
181
|
];
|
|
195
182
|
var REVERSE_CHANNEL_NAMES = REVERSE_CHANNELS;
|
|
183
|
+
var runSessionParamsSchema = {
|
|
184
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
185
|
+
title: "EngineRunSessionParams",
|
|
186
|
+
type: "object",
|
|
187
|
+
additionalProperties: false,
|
|
188
|
+
required: ["recordId"],
|
|
189
|
+
properties: {
|
|
190
|
+
recordId: { type: "string" },
|
|
191
|
+
resume: {
|
|
192
|
+
type: "object",
|
|
193
|
+
additionalProperties: false,
|
|
194
|
+
required: ["sessionRef", "poolKey"],
|
|
195
|
+
properties: {
|
|
196
|
+
// ResumeAnchor.sessionRef = Record<string, string>(引擎定位键值对)
|
|
197
|
+
sessionRef: { type: "object", additionalProperties: { type: "string" } },
|
|
198
|
+
poolKey: { type: "string" },
|
|
199
|
+
journalPath: { type: "string" }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
196
204
|
|
|
197
205
|
export {
|
|
198
206
|
isRequestFrame,
|
|
@@ -203,7 +211,6 @@ export {
|
|
|
203
211
|
REVERSE_CHANNELS,
|
|
204
212
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
205
213
|
isHostStreamDeltaParams,
|
|
206
|
-
isHostRoundLifecycleParams,
|
|
207
214
|
protocolErrorSchema,
|
|
208
215
|
requestFrameSchema,
|
|
209
216
|
successResponseFrameSchema,
|
|
@@ -212,5 +219,6 @@ export {
|
|
|
212
219
|
reverseRequestFrameSchema,
|
|
213
220
|
ENGINE_PROTOCOL_SCHEMAS,
|
|
214
221
|
FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
|
|
215
|
-
REVERSE_CHANNEL_NAMES
|
|
222
|
+
REVERSE_CHANNEL_NAMES,
|
|
223
|
+
runSessionParamsSchema
|
|
216
224
|
};
|
|
@@ -70,7 +70,7 @@ function engineProtocolMismatchError(engineVersion) {
|
|
|
70
70
|
function engineConversationUnsupportedError(engineId) {
|
|
71
71
|
return new EngineSdkError(
|
|
72
72
|
"engine_capability_unsupported",
|
|
73
|
-
`engine '${engineId}' \u4E0D\u652F\u6301
|
|
73
|
+
`engine '${engineId}' \u4E0D\u652F\u6301 resume \u7EED\u804A\uFF08capabilities.conversation = 'unsupported'\uFF0Cmanifest \u65E0 conversation gate \u4F4D\uFF09`,
|
|
74
74
|
`\u53BB\u6389 conversation \u53C2\u6570\uFF08\u4E00\u6B21\u6027\u4EFB\u52A1\u9ED8\u8BA4\u5F62\u6001\uFF09\uFF0C\u6216\u4FEE manifest capabilities / \u5347\u7EA7\u5F15\u64CE\u5305\uFF08\u82E5\u5F15\u64CE\u5B9E\u9645\u652F\u6301\u8BE5\u80FD\u529B\uFF09`,
|
|
75
75
|
{ engineId, capability: "conversation", declared: "unsupported" }
|
|
76
76
|
);
|
package/dist/cli-entry.cjs
CHANGED
|
@@ -92,8 +92,10 @@ function runEngineCliEntry(opts) {
|
|
|
92
92
|
const server = opts.server;
|
|
93
93
|
configureLoggerSink({
|
|
94
94
|
log(level, component, message, data) {
|
|
95
|
-
|
|
95
|
+
if (level !== "debug") {
|
|
96
|
+
process.stderr.write(`[${level}] [${component}] ${message}${data !== void 0 ? ` ${JSON.stringify(data)}` : ""}
|
|
96
97
|
`);
|
|
98
|
+
}
|
|
97
99
|
void server.reverseRequest("host/log", { level, component, message }).catch(() => void 0);
|
|
98
100
|
}
|
|
99
101
|
});
|
package/dist/cli-entry.js
CHANGED
|
@@ -56,8 +56,12 @@ interface Turn {
|
|
|
56
56
|
closedTs?: number;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* 引擎事件(
|
|
59
|
+
* 引擎事件(9 种,协议 event.params.event 逐字序列化——「事件与 handle 序列化逐字
|
|
60
60
|
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/types.ts 注释)。
|
|
61
|
+
*
|
|
62
|
+
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
63
|
+
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
64
|
+
* 无进展守护刷新判活(长工具执行期)。节流属生产者实现细节,不进协议承诺。
|
|
61
65
|
*/
|
|
62
66
|
type AgentEvent = {
|
|
63
67
|
type: "tool_start";
|
|
@@ -84,12 +88,14 @@ type AgentEvent = {
|
|
|
84
88
|
error?: string;
|
|
85
89
|
} | {
|
|
86
90
|
type: "compaction";
|
|
91
|
+
} | {
|
|
92
|
+
type: "activity";
|
|
87
93
|
} | {
|
|
88
94
|
type: "error";
|
|
89
95
|
message: string;
|
|
90
96
|
};
|
|
91
97
|
/**
|
|
92
|
-
* EngineHandle 的持久化形态(JSON v1)。协议 run 终态应答 /
|
|
98
|
+
* EngineHandle 的持久化形态(JSON v1)。协议 run 终态应答 / read 的
|
|
93
99
|
* handle 载荷(引擎不持有宿主运行时引用,data 即全部)。
|
|
94
100
|
*/
|
|
95
101
|
interface EngineHandleData {
|
|
@@ -109,11 +115,10 @@ interface EngineHandleData {
|
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
117
|
* [v1.x] 冷续 resume 锚点——EngineHandleData 定位键的投影子集(诊断字段
|
|
112
|
-
* v/engineVersion/adapterVersion
|
|
113
|
-
* - run.params.
|
|
114
|
-
* sessionRef.sessionFile —— 对照 core SpawnResumeOpts.sessionFile
|
|
115
|
-
*
|
|
116
|
-
* 宿主据此刷新冷续依据——pi 定位键形态同 EngineHandleData.sessionRef 注释)。
|
|
118
|
+
* v/engineVersion/adapterVersion 不属锚点语义,不随锚点走)。消费点:
|
|
119
|
+
* - run.params.resume(宿主 → 引擎:冷续重开已 idle 的 session,pi 消费
|
|
120
|
+
* sessionRef.sessionFile —— 对照 core SpawnResumeOpts.sessionFile 的锚点面)。
|
|
121
|
+
* [H1 U6 已切换] 键切换单批完成(读写端同批),锚点仅经 resume 键携带。
|
|
117
122
|
* 类型层与 EngineHandleData 定位形态的对照由测试断言(Pick 可赋值闭包)锁定。
|
|
118
123
|
*/
|
|
119
124
|
interface ResumeAnchor {
|
|
@@ -155,7 +160,11 @@ interface EngineCapabilities {
|
|
|
155
160
|
schemaEnforcement: "native" | "emulated";
|
|
156
161
|
/** 注意区分「引擎 RPC 层有此能力」与「subagent 链路已接通」。 */
|
|
157
162
|
steer: "native" | "emulated" | "unsupported";
|
|
158
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* [H1 D5 语义收窄] resume 能力位(chat 续聊 = 新 run + resume 锚点的承载前提;
|
|
165
|
+
* 原名字沿用——conversation 位保留、语义从「interact 长驻控制面」收窄为
|
|
166
|
+
* 「resume 续聊能力」,gate 判据与消费方不变)。
|
|
167
|
+
*/
|
|
159
168
|
conversation: "native" | "unsupported";
|
|
160
169
|
/** 决定 persona 路由策略(file/flag/prompt 通道)。 */
|
|
161
170
|
personaInjection: "file" | "flag" | "prompt";
|
|
@@ -190,31 +199,6 @@ interface ProbeReport {
|
|
|
190
199
|
recovery: string;
|
|
191
200
|
};
|
|
192
201
|
}
|
|
193
|
-
/**
|
|
194
|
-
* interact 的 action(交互控制面)。interrupt: true = steer(抢占)/ false|缺省 =
|
|
195
|
-
* followUp(排队);不支持抢占的引擎忽略。
|
|
196
|
-
*/
|
|
197
|
-
type InteractAction = {
|
|
198
|
-
kind: "message";
|
|
199
|
-
payload: string;
|
|
200
|
-
interrupt?: boolean;
|
|
201
|
-
} | {
|
|
202
|
-
kind: "close";
|
|
203
|
-
payload?: {
|
|
204
|
-
force: boolean;
|
|
205
|
-
};
|
|
206
|
-
} | {
|
|
207
|
-
kind: "cancel";
|
|
208
|
-
};
|
|
209
|
-
/** interact 的结果(失败码 = engine_session_not_resumable / engine_capability_unsupported 等)。 */
|
|
210
|
-
type InteractResult = {
|
|
211
|
-
ok: true;
|
|
212
|
-
delivered: true;
|
|
213
|
-
} | {
|
|
214
|
-
ok: false;
|
|
215
|
-
code: string;
|
|
216
|
-
message: string;
|
|
217
|
-
};
|
|
218
202
|
/** 失败分诊结构化标签。unknown(含缺省)= 可重试(语义守恒)。 */
|
|
219
203
|
type AgentFailureKind = "stale_context" | "schema_deterministic" | "unknown";
|
|
220
204
|
/**
|
|
@@ -349,4 +333,4 @@ interface AgentCallOpts {
|
|
|
349
333
|
permissionMode?: string;
|
|
350
334
|
}
|
|
351
335
|
|
|
352
|
-
export type { AgentCallOpts as A, EngineCapabilities as E,
|
|
336
|
+
export type { AgentCallOpts as A, EngineCapabilities as E, InternalToolCall as I, ModelCatalogEntry as M, ProbeReport as P, ReplayedTurn as R, SessionView as S, ToolCall as T, WorktreeHandle as W, AgentEvent as a, AgentFailureKind as b, AgentOutcome as c, AgentOutcomeUsage as d, AgentUsage as e, AgentUsageTotal as f, AssertMutuallyAssignable as g, EngineHandleData as h, ResumeAnchor as i, ToolCallEntry as j, ToolCallResult as k, Turn as l };
|
|
@@ -56,8 +56,12 @@ interface Turn {
|
|
|
56
56
|
closedTs?: number;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* 引擎事件(
|
|
59
|
+
* 引擎事件(9 种,协议 event.params.event 逐字序列化——「事件与 handle 序列化逐字
|
|
60
60
|
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/types.ts 注释)。
|
|
61
|
+
*
|
|
62
|
+
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
63
|
+
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
64
|
+
* 无进展守护刷新判活(长工具执行期)。节流属生产者实现细节,不进协议承诺。
|
|
61
65
|
*/
|
|
62
66
|
type AgentEvent = {
|
|
63
67
|
type: "tool_start";
|
|
@@ -84,12 +88,14 @@ type AgentEvent = {
|
|
|
84
88
|
error?: string;
|
|
85
89
|
} | {
|
|
86
90
|
type: "compaction";
|
|
91
|
+
} | {
|
|
92
|
+
type: "activity";
|
|
87
93
|
} | {
|
|
88
94
|
type: "error";
|
|
89
95
|
message: string;
|
|
90
96
|
};
|
|
91
97
|
/**
|
|
92
|
-
* EngineHandle 的持久化形态(JSON v1)。协议 run 终态应答 /
|
|
98
|
+
* EngineHandle 的持久化形态(JSON v1)。协议 run 终态应答 / read 的
|
|
93
99
|
* handle 载荷(引擎不持有宿主运行时引用,data 即全部)。
|
|
94
100
|
*/
|
|
95
101
|
interface EngineHandleData {
|
|
@@ -109,11 +115,10 @@ interface EngineHandleData {
|
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
117
|
* [v1.x] 冷续 resume 锚点——EngineHandleData 定位键的投影子集(诊断字段
|
|
112
|
-
* v/engineVersion/adapterVersion
|
|
113
|
-
* - run.params.
|
|
114
|
-
* sessionRef.sessionFile —— 对照 core SpawnResumeOpts.sessionFile
|
|
115
|
-
*
|
|
116
|
-
* 宿主据此刷新冷续依据——pi 定位键形态同 EngineHandleData.sessionRef 注释)。
|
|
118
|
+
* v/engineVersion/adapterVersion 不属锚点语义,不随锚点走)。消费点:
|
|
119
|
+
* - run.params.resume(宿主 → 引擎:冷续重开已 idle 的 session,pi 消费
|
|
120
|
+
* sessionRef.sessionFile —— 对照 core SpawnResumeOpts.sessionFile 的锚点面)。
|
|
121
|
+
* [H1 U6 已切换] 键切换单批完成(读写端同批),锚点仅经 resume 键携带。
|
|
117
122
|
* 类型层与 EngineHandleData 定位形态的对照由测试断言(Pick 可赋值闭包)锁定。
|
|
118
123
|
*/
|
|
119
124
|
interface ResumeAnchor {
|
|
@@ -155,7 +160,11 @@ interface EngineCapabilities {
|
|
|
155
160
|
schemaEnforcement: "native" | "emulated";
|
|
156
161
|
/** 注意区分「引擎 RPC 层有此能力」与「subagent 链路已接通」。 */
|
|
157
162
|
steer: "native" | "emulated" | "unsupported";
|
|
158
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* [H1 D5 语义收窄] resume 能力位(chat 续聊 = 新 run + resume 锚点的承载前提;
|
|
165
|
+
* 原名字沿用——conversation 位保留、语义从「interact 长驻控制面」收窄为
|
|
166
|
+
* 「resume 续聊能力」,gate 判据与消费方不变)。
|
|
167
|
+
*/
|
|
159
168
|
conversation: "native" | "unsupported";
|
|
160
169
|
/** 决定 persona 路由策略(file/flag/prompt 通道)。 */
|
|
161
170
|
personaInjection: "file" | "flag" | "prompt";
|
|
@@ -190,31 +199,6 @@ interface ProbeReport {
|
|
|
190
199
|
recovery: string;
|
|
191
200
|
};
|
|
192
201
|
}
|
|
193
|
-
/**
|
|
194
|
-
* interact 的 action(交互控制面)。interrupt: true = steer(抢占)/ false|缺省 =
|
|
195
|
-
* followUp(排队);不支持抢占的引擎忽略。
|
|
196
|
-
*/
|
|
197
|
-
type InteractAction = {
|
|
198
|
-
kind: "message";
|
|
199
|
-
payload: string;
|
|
200
|
-
interrupt?: boolean;
|
|
201
|
-
} | {
|
|
202
|
-
kind: "close";
|
|
203
|
-
payload?: {
|
|
204
|
-
force: boolean;
|
|
205
|
-
};
|
|
206
|
-
} | {
|
|
207
|
-
kind: "cancel";
|
|
208
|
-
};
|
|
209
|
-
/** interact 的结果(失败码 = engine_session_not_resumable / engine_capability_unsupported 等)。 */
|
|
210
|
-
type InteractResult = {
|
|
211
|
-
ok: true;
|
|
212
|
-
delivered: true;
|
|
213
|
-
} | {
|
|
214
|
-
ok: false;
|
|
215
|
-
code: string;
|
|
216
|
-
message: string;
|
|
217
|
-
};
|
|
218
202
|
/** 失败分诊结构化标签。unknown(含缺省)= 可重试(语义守恒)。 */
|
|
219
203
|
type AgentFailureKind = "stale_context" | "schema_deterministic" | "unknown";
|
|
220
204
|
/**
|
|
@@ -349,4 +333,4 @@ interface AgentCallOpts {
|
|
|
349
333
|
permissionMode?: string;
|
|
350
334
|
}
|
|
351
335
|
|
|
352
|
-
export type { AgentCallOpts as A, EngineCapabilities as E,
|
|
336
|
+
export type { AgentCallOpts as A, EngineCapabilities as E, InternalToolCall as I, ModelCatalogEntry as M, ProbeReport as P, ReplayedTurn as R, SessionView as S, ToolCall as T, WorktreeHandle as W, AgentEvent as a, AgentFailureKind as b, AgentOutcome as c, AgentOutcomeUsage as d, AgentUsage as e, AgentUsageTotal as f, AssertMutuallyAssignable as g, EngineHandleData as h, ResumeAnchor as i, ToolCallEntry as j, ToolCallResult as k, Turn as l };
|
package/dist/env.cjs
CHANGED
|
@@ -87,10 +87,7 @@ var ENGINE_ENV_DENY_LIST = [
|
|
|
87
87
|
"XYZ_RUNTIME_TOKEN",
|
|
88
88
|
"XYZ_AGENT_API_KEY",
|
|
89
89
|
"XYZ_SUBAGENT_RELAY_SESSION_ID",
|
|
90
|
-
"XYZ_SUBAGENT_RELAY_RECORD_ID"
|
|
91
|
-
"XYZ_SUBAGENT_RELAY_STDIN",
|
|
92
|
-
"XYZ_SUBAGENT_RELAY_STDOUT",
|
|
93
|
-
"XYZ_SUBAGENT_RELAY_STDERR"
|
|
90
|
+
"XYZ_SUBAGENT_RELAY_RECORD_ID"
|
|
94
91
|
];
|
|
95
92
|
var ENGINE_ENV_L0_INFRA_KEYS = [
|
|
96
93
|
"XYZ_AGENT_DATA_DIR",
|
package/dist/env.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/** L2 manifest 放行的保留前缀拒绝表(镜像 shared SSOT,勿单独改动)。 */
|
|
2
2
|
declare const ENGINE_ENV_PREFIXES: readonly string[];
|
|
3
|
-
/** L1 deny + 显式剥除键集(镜像 shared SSOT,勿单独改动)。
|
|
3
|
+
/** L1 deny + 显式剥除键集(镜像 shared SSOT,勿单独改动)。
|
|
4
|
+
* 互引(场景域分化,勿互混):dev 装配器(apps/electron/scripts/dev-instance-lib.mjs
|
|
5
|
+
* `LEAK_ENV_KEYS`)仍剥 RELAY_STD* 三键——dev 宿主进程环境防泄漏口径独立于引擎
|
|
6
|
+
* spawn 面;本清单(引擎侧)已退役同名三键,写入方已清零。 */
|
|
4
7
|
declare const ENGINE_ENV_DENY_LIST: readonly string[];
|
|
5
8
|
/** L0 注入的全部基础设施键(守卫断言:与 ENGINE_ENV_DENY_LIST 交集 = ∅)。 */
|
|
6
9
|
declare const ENGINE_ENV_L0_INFRA_KEYS: readonly string[];
|
package/dist/env.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/** L2 manifest 放行的保留前缀拒绝表(镜像 shared SSOT,勿单独改动)。 */
|
|
2
2
|
declare const ENGINE_ENV_PREFIXES: readonly string[];
|
|
3
|
-
/** L1 deny + 显式剥除键集(镜像 shared SSOT,勿单独改动)。
|
|
3
|
+
/** L1 deny + 显式剥除键集(镜像 shared SSOT,勿单独改动)。
|
|
4
|
+
* 互引(场景域分化,勿互混):dev 装配器(apps/electron/scripts/dev-instance-lib.mjs
|
|
5
|
+
* `LEAK_ENV_KEYS`)仍剥 RELAY_STD* 三键——dev 宿主进程环境防泄漏口径独立于引擎
|
|
6
|
+
* spawn 面;本清单(引擎侧)已退役同名三键,写入方已清零。 */
|
|
4
7
|
declare const ENGINE_ENV_DENY_LIST: readonly string[];
|
|
5
8
|
/** L0 注入的全部基础设施键(守卫断言:与 ENGINE_ENV_DENY_LIST 交集 = ∅)。 */
|
|
6
9
|
declare const ENGINE_ENV_L0_INFRA_KEYS: readonly string[];
|
package/dist/env.js
CHANGED
|
@@ -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-ByIFoLrY.js';
|
|
2
2
|
|
|
3
3
|
/** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
|
|
4
4
|
interface ProtocolError {
|
|
@@ -88,15 +88,16 @@ declare class EngineSdkError extends Error {
|
|
|
88
88
|
}
|
|
89
89
|
declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
|
|
90
90
|
/**
|
|
91
|
-
* [v1.x]
|
|
92
|
-
* 验收 A6:manifest 无 conversation gate 位的引擎收到
|
|
91
|
+
* [v1.x] resume 会话形态(run.params.resume)的 gate 拒绝具名错误(chat-domain
|
|
92
|
+
* 设计 §3.2 D1-A + 验收 A6:manifest 无 conversation gate 位的引擎收到
|
|
93
|
+
* conversation 请求 → 同步拒;[H1] 文案随 D5 语义收窄——续聊 = resume 续聊)。
|
|
93
94
|
* 文案契约对齐 core capability-gate.ts conversation 分支(错误码
|
|
94
95
|
* engine_capability_unsupported + 「去掉参数 / 修 manifest / 升级引擎包」恢复指引)
|
|
95
96
|
* ——W3 chat 路由切协议客户端时以本构造器替换 core 内联文案,保持两侧一致。
|
|
96
97
|
*/
|
|
97
98
|
declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
|
|
98
99
|
/**
|
|
99
|
-
* [v1.x]
|
|
100
|
+
* [v1.x] resume 会话形态(run.params.resume / task.conversation=true)派发前的同步 gate:
|
|
100
101
|
* manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError——
|
|
101
102
|
* 进程/record 创建前同步拒(A6:run 域不受影响,仅 chat 面被拦)。
|
|
102
103
|
* 判据单源:core 侧 capability-gate.assertTaskShapeSupported 的 conversation 分支
|
|
@@ -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-ByIFoLrY.cjs';
|
|
2
2
|
|
|
3
3
|
/** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
|
|
4
4
|
interface ProtocolError {
|
|
@@ -88,15 +88,16 @@ declare class EngineSdkError extends Error {
|
|
|
88
88
|
}
|
|
89
89
|
declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
|
|
90
90
|
/**
|
|
91
|
-
* [v1.x]
|
|
92
|
-
* 验收 A6:manifest 无 conversation gate 位的引擎收到
|
|
91
|
+
* [v1.x] resume 会话形态(run.params.resume)的 gate 拒绝具名错误(chat-domain
|
|
92
|
+
* 设计 §3.2 D1-A + 验收 A6:manifest 无 conversation gate 位的引擎收到
|
|
93
|
+
* conversation 请求 → 同步拒;[H1] 文案随 D5 语义收窄——续聊 = resume 续聊)。
|
|
93
94
|
* 文案契约对齐 core capability-gate.ts conversation 分支(错误码
|
|
94
95
|
* engine_capability_unsupported + 「去掉参数 / 修 manifest / 升级引擎包」恢复指引)
|
|
95
96
|
* ——W3 chat 路由切协议客户端时以本构造器替换 core 内联文案,保持两侧一致。
|
|
96
97
|
*/
|
|
97
98
|
declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
|
|
98
99
|
/**
|
|
99
|
-
* [v1.x]
|
|
100
|
+
* [v1.x] resume 会话形态(run.params.resume / task.conversation=true)派发前的同步 gate:
|
|
100
101
|
* manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError——
|
|
101
102
|
* 进程/record 创建前同步拒(A6:run 域不受影响,仅 chat 面被拦)。
|
|
102
103
|
* 判据单源:core 侧 capability-gate.assertTaskShapeSupported 的 conversation 分支
|