@zhushanwen/subagent-engine-sdk 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/best-effort.cjs +9 -1
- package/dist/best-effort.js +2 -2
- package/dist/{chunk-X24IVQKJ.js → chunk-3FVBDH3X.js} +3 -2
- package/dist/{chunk-YL5W5EMV.js → chunk-AF2ETADP.js} +1 -1
- package/dist/chunk-D36ZIQQK.js +28 -0
- package/dist/{chunk-W23PAAGX.js → chunk-DIIYVO4O.js} +1 -27
- package/dist/{chunk-RCT7L777.js → chunk-F7VDVSBZ.js} +1 -1
- package/dist/{chunk-HERD6RIR.js → chunk-MQPASWMA.js} +2 -2
- package/dist/{chunk-75QEMUGV.js → chunk-NXNNXGTY.js} +10 -1
- package/dist/{chunk-EJMF63R5.js → chunk-QMEHSKNR.js} +1 -1
- package/dist/{chunk-J4G2MXDS.js → chunk-VE3NVT7K.js} +1 -1
- package/dist/cli-entry.cjs +9 -1
- package/dist/cli-entry.js +2 -2
- package/dist/{contract-types-DiWyGRXr.d.cts → contract-types-DqOD58r-.d.cts} +7 -12
- package/dist/{contract-types-DiWyGRXr.d.ts → contract-types-DqOD58r-.d.ts} +7 -12
- package/dist/data-dir.cjs +10 -2
- package/dist/data-dir.js +2 -2
- package/dist/env.cjs +9 -1
- package/dist/env.d.cts +6 -6
- package/dist/env.d.ts +6 -6
- package/dist/env.js +2 -2
- package/dist/error-codes-C3oVToMr.d.cts +311 -0
- package/dist/error-codes-CiDwaODz.d.ts +311 -0
- package/dist/index.cjs +41 -3
- package/dist/index.d.cts +31 -3
- package/dist/index.d.ts +31 -3
- package/dist/index.js +62 -31
- 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.cjs +9 -1
- package/dist/kill-chain.d.cts +1 -1
- package/dist/kill-chain.d.ts +1 -1
- package/dist/kill-chain.js +2 -2
- package/dist/logger.cjs +11 -1
- package/dist/logger.js +1 -1
- package/dist/port-contract.d.cts +12 -6
- package/dist/port-contract.d.ts +12 -6
- package/dist/protocol/index.cjs +1 -1
- package/dist/protocol/index.d.cts +4 -296
- package/dist/protocol/index.d.ts +4 -296
- package/dist/protocol/index.js +7 -5
- package/dist/server/index.cjs +217 -0
- package/dist/server/index.d.cts +146 -0
- package/dist/server/index.d.ts +146 -0
- package/dist/server/index.js +143 -0
- package/dist/spawn.cjs +9 -1
- package/dist/spawn.js +3 -3
- package/package.json +12 -1
package/dist/best-effort.cjs
CHANGED
|
@@ -24,8 +24,16 @@ __export(best_effort_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(best_effort_exports);
|
|
26
26
|
|
|
27
|
+
// src/global-slots.ts
|
|
28
|
+
var ENGINE_SDK_SLOT_KEYS = {
|
|
29
|
+
/** dataDir 缺省告警一次性标记(data-dir.ts)。 */
|
|
30
|
+
dataDirWarned: "@zhushanwen/subagent-engine-sdk.data-dir-warned",
|
|
31
|
+
/** logger sink 进程级单例(logger.ts)。 */
|
|
32
|
+
loggerSink: "@zhushanwen/subagent-engine-sdk.logger-sink"
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
// src/logger.ts
|
|
28
|
-
var SINK_SLOT_KEY =
|
|
36
|
+
var SINK_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.loggerSink);
|
|
29
37
|
function getSinkSlot() {
|
|
30
38
|
let slot = Reflect.get(globalThis, SINK_SLOT_KEY);
|
|
31
39
|
if (!slot) {
|
package/dist/best-effort.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ENGINE_SDK_SLOT_KEYS,
|
|
2
3
|
getLogger
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NXNNXGTY.js";
|
|
4
5
|
|
|
5
6
|
// src/data-dir.ts
|
|
6
7
|
var logger = getLogger("subagents");
|
|
7
8
|
var TAIJI_DATA_DIR_ENV = "TAIJI_AGENT_DATA_DIR";
|
|
8
|
-
var WARNED_SLOT_KEY =
|
|
9
|
+
var WARNED_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.dataDirWarned);
|
|
9
10
|
function getWarnedSlot() {
|
|
10
11
|
let slot = Reflect.get(globalThis, WARNED_SLOT_KEY);
|
|
11
12
|
if (!slot) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/protocol/frames.ts
|
|
2
|
+
function isRecord(v) {
|
|
3
|
+
return typeof v === "object" && v !== null;
|
|
4
|
+
}
|
|
5
|
+
function isRequestFrame(frame) {
|
|
6
|
+
return isRecord(frame) && typeof frame.id === "number" && typeof frame.method === "string" && "params" in frame && !("result" in frame) && !("error" in frame);
|
|
7
|
+
}
|
|
8
|
+
function isResponseFrame(frame) {
|
|
9
|
+
if (!isRecord(frame) || !("id" in frame)) return false;
|
|
10
|
+
const idOk = typeof frame.id === "number" || typeof frame.id === "string";
|
|
11
|
+
if (!idOk) return false;
|
|
12
|
+
const hasResult = "result" in frame;
|
|
13
|
+
const hasError = "error" in frame;
|
|
14
|
+
return hasResult !== hasError;
|
|
15
|
+
}
|
|
16
|
+
function isNotificationFrame(frame) {
|
|
17
|
+
return isRecord(frame) && !("id" in frame) && frame.method === "event" && isRecord(frame.params) && typeof frame.params.runId === "string" && typeof frame.params.seq === "number" && isRecord(frame.params.event) && typeof frame.params.event.type === "string";
|
|
18
|
+
}
|
|
19
|
+
function isReverseRequestFrame(frame) {
|
|
20
|
+
return isRecord(frame) && typeof frame.id === "string" && typeof frame.method === "string" && frame.method.startsWith("host/") && "params" in frame;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
isRequestFrame,
|
|
25
|
+
isResponseFrame,
|
|
26
|
+
isNotificationFrame,
|
|
27
|
+
isReverseRequestFrame
|
|
28
|
+
};
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
// src/protocol/frames.ts
|
|
2
|
-
function isRecord(v) {
|
|
3
|
-
return typeof v === "object" && v !== null;
|
|
4
|
-
}
|
|
5
|
-
function isRequestFrame(frame) {
|
|
6
|
-
return isRecord(frame) && typeof frame.id === "number" && typeof frame.method === "string" && "params" in frame && !("result" in frame) && !("error" in frame);
|
|
7
|
-
}
|
|
8
|
-
function isResponseFrame(frame) {
|
|
9
|
-
if (!isRecord(frame) || !("id" in frame)) return false;
|
|
10
|
-
const idOk = typeof frame.id === "number" || typeof frame.id === "string";
|
|
11
|
-
if (!idOk) return false;
|
|
12
|
-
const hasResult = "result" in frame;
|
|
13
|
-
const hasError = "error" in frame;
|
|
14
|
-
return hasResult !== hasError;
|
|
15
|
-
}
|
|
16
|
-
function isNotificationFrame(frame) {
|
|
17
|
-
return isRecord(frame) && !("id" in frame) && frame.method === "event" && isRecord(frame.params) && typeof frame.params.runId === "string" && typeof frame.params.seq === "number" && isRecord(frame.params.event) && typeof frame.params.event.type === "string";
|
|
18
|
-
}
|
|
19
|
-
function isReverseRequestFrame(frame) {
|
|
20
|
-
return isRecord(frame) && typeof frame.id === "string" && typeof frame.method === "string" && frame.method.startsWith("host/") && "params" in frame;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
1
|
// src/protocol/methods.ts
|
|
24
2
|
var PROTOCOL_METHODS = [
|
|
25
3
|
"initialize",
|
|
@@ -198,17 +176,13 @@ var runSessionParamsSchema = {
|
|
|
198
176
|
properties: {
|
|
199
177
|
// ResumeAnchor.sessionRef = Record<string, string>(引擎定位键值对)
|
|
200
178
|
sessionRef: { type: "object", additionalProperties: { type: "string" } },
|
|
201
|
-
|
|
179
|
+
eventsPath: { type: "string" }
|
|
202
180
|
}
|
|
203
181
|
}
|
|
204
182
|
}
|
|
205
183
|
};
|
|
206
184
|
|
|
207
185
|
export {
|
|
208
|
-
isRequestFrame,
|
|
209
|
-
isResponseFrame,
|
|
210
|
-
isNotificationFrame,
|
|
211
|
-
isReverseRequestFrame,
|
|
212
186
|
PROTOCOL_METHODS,
|
|
213
187
|
REVERSE_CHANNELS,
|
|
214
188
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
// src/global-slots.ts
|
|
2
|
+
var ENGINE_SDK_SLOT_KEYS = {
|
|
3
|
+
/** dataDir 缺省告警一次性标记(data-dir.ts)。 */
|
|
4
|
+
dataDirWarned: "@zhushanwen/subagent-engine-sdk.data-dir-warned",
|
|
5
|
+
/** logger sink 进程级单例(logger.ts)。 */
|
|
6
|
+
loggerSink: "@zhushanwen/subagent-engine-sdk.logger-sink"
|
|
7
|
+
};
|
|
8
|
+
|
|
1
9
|
// src/logger.ts
|
|
2
|
-
var SINK_SLOT_KEY =
|
|
10
|
+
var SINK_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.loggerSink);
|
|
3
11
|
function getSinkSlot() {
|
|
4
12
|
let slot = Reflect.get(globalThis, SINK_SLOT_KEY);
|
|
5
13
|
if (!slot) {
|
|
@@ -52,6 +60,7 @@ function getLogger(component) {
|
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
export {
|
|
63
|
+
ENGINE_SDK_SLOT_KEYS,
|
|
55
64
|
configureLoggerSink,
|
|
56
65
|
resetLoggerSinkForTests,
|
|
57
66
|
getLogger
|
package/dist/cli-entry.cjs
CHANGED
|
@@ -35,8 +35,16 @@ __export(cli_entry_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(cli_entry_exports);
|
|
36
36
|
var readline = __toESM(require("readline"), 1);
|
|
37
37
|
|
|
38
|
+
// src/global-slots.ts
|
|
39
|
+
var ENGINE_SDK_SLOT_KEYS = {
|
|
40
|
+
/** dataDir 缺省告警一次性标记(data-dir.ts)。 */
|
|
41
|
+
dataDirWarned: "@zhushanwen/subagent-engine-sdk.data-dir-warned",
|
|
42
|
+
/** logger sink 进程级单例(logger.ts)。 */
|
|
43
|
+
loggerSink: "@zhushanwen/subagent-engine-sdk.logger-sink"
|
|
44
|
+
};
|
|
45
|
+
|
|
38
46
|
// src/logger.ts
|
|
39
|
-
var SINK_SLOT_KEY =
|
|
47
|
+
var SINK_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.loggerSink);
|
|
40
48
|
function getSinkSlot() {
|
|
41
49
|
let slot = Reflect.get(globalThis, SINK_SLOT_KEY);
|
|
42
50
|
if (!slot) {
|
package/dist/cli-entry.js
CHANGED
|
@@ -60,7 +60,7 @@ interface Turn {
|
|
|
60
60
|
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/assembly/types.ts 注释)。
|
|
61
61
|
*
|
|
62
62
|
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
63
|
-
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
63
|
+
* (core event-journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
64
64
|
* 无进展守护刷新判活(长工具执行期)。节流属生产者实现细节,不进协议承诺。
|
|
65
65
|
*
|
|
66
66
|
* armed = [D3 协议版 P6] schema 强制武装确认回执:引擎在启动期武装断言通过 +
|
|
@@ -153,7 +153,7 @@ interface EngineHandleData {
|
|
|
153
153
|
* [池抽象降级 2026-09-13] 原 poolKey 字段已删除——两引擎 poolKey 恒 'shared'
|
|
154
154
|
* (SDK SHARED_POOL_KEY),journal 固定落 engines/<engineId>/shared/,字段零信息量。
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
eventsPath?: string;
|
|
157
157
|
/** probe 实测版本(漂移排查锚点)。 */
|
|
158
158
|
engineVersion?: string;
|
|
159
159
|
/** 适配器版本(golden 样本对齐排查)。 */
|
|
@@ -171,7 +171,7 @@ interface ResumeAnchor {
|
|
|
171
171
|
/** 引擎定位键(pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath })。 */
|
|
172
172
|
sessionRef: Record<string, string>;
|
|
173
173
|
/** journal 绝对路径(read 降级链第②级数据源;无 journal 缺省)。 */
|
|
174
|
-
|
|
174
|
+
eventsPath?: string;
|
|
175
175
|
}
|
|
176
176
|
/** Turn → ReplayedTurn:剥离内部态(closed 恒 true——重放物无进行时语义)。 */
|
|
177
177
|
interface ReplayedTurn {
|
|
@@ -296,7 +296,7 @@ interface WorktreeHandle {
|
|
|
296
296
|
}
|
|
297
297
|
/**
|
|
298
298
|
* 一次引擎执行的终态(协议 run 终态应答的 outcome 载荷)。锚定 core
|
|
299
|
-
* orchestration AgentResult 并追加引擎层字段(engineId /
|
|
299
|
+
* orchestration AgentResult 并追加引擎层字段(engineId / exitCode)。
|
|
300
300
|
*/
|
|
301
301
|
interface AgentOutcome {
|
|
302
302
|
content: string;
|
|
@@ -314,13 +314,8 @@ interface AgentOutcome {
|
|
|
314
314
|
/** 仅诊断——目录可能已被 finalize 清理,不得作为 cwd 复用。 */
|
|
315
315
|
worktreePath?: string;
|
|
316
316
|
toolCalls?: ToolCallEntry[];
|
|
317
|
-
/**
|
|
317
|
+
/** 实际执行引擎。 */
|
|
318
318
|
engineId: string;
|
|
319
|
-
/** fallback 留痕(record 同步投影,GUI 警告条数据源)。 */
|
|
320
|
-
engineFallback?: {
|
|
321
|
-
from: string;
|
|
322
|
-
reason: string;
|
|
323
|
-
};
|
|
324
319
|
/** null = 被信号杀死(杀链/abort 合成终态的判据)。 */
|
|
325
320
|
exitCode?: number | null;
|
|
326
321
|
/**
|
|
@@ -381,7 +376,7 @@ interface ModelCatalogEntry {
|
|
|
381
376
|
* - 判据② task(隔离与权限随任务声明):worktree / fork / forkSource /
|
|
382
377
|
* denyTools / permissionMode;
|
|
383
378
|
* - 判据② task(诊断元数据):description;
|
|
384
|
-
* - 判据③ ctx(环境值,引擎自推导与宿主不恒等):model / cwd
|
|
379
|
+
* - 判据③ ctx(环境值,引擎自推导与宿主不恒等):model / cwd
|
|
385
380
|
* (对照 core orchestration/models/types.ts AgentCallOpts,协议层单列);
|
|
386
381
|
* - 判据① 宿主自持不上协议:engine(路由决策已完成,收到的引擎即选中值)、
|
|
387
382
|
* timeoutMs(宿主超时链 mergeTimeoutSignal → cancel 帧,非引擎参数)、
|
|
@@ -434,4 +429,4 @@ interface AgentCallOpts {
|
|
|
434
429
|
permissionMode?: string;
|
|
435
430
|
}
|
|
436
431
|
|
|
437
|
-
export {
|
|
432
|
+
export { type AgentEvent as A, type EngineHandleData as E, type InternalToolCall as I, type ModelCatalogEntry as M, type ProbeReport as P, type ReplayedTurn as R, type SessionView as S, type Turn as T, type WorktreeHandle as W, type AgentUsageTotal as a, type AgentCallOpts as b, type AgentOutcome as c, type EngineCapabilities as d, type ResumeAnchor as e, AGENT_EVENT_TYPE_NAMES as f, type AgentEventTypeName as g, type AgentFailureKind as h, type AgentOutcomeUsage as i, type AgentUsage as j, type AssertMutuallyAssignable as k, type EngineProcessModel as l, type ToolCall as m, type ToolCallEntry as n, type ToolCallResult as o };
|
|
@@ -60,7 +60,7 @@ interface Turn {
|
|
|
60
60
|
* 兼容」不变量 3 的类型面)。语义锚点 = pi(ACP 词汇对照见 core execution/assembly/types.ts 注释)。
|
|
61
61
|
*
|
|
62
62
|
* activity = 纯活性信号:双侧 reducer no-op、不开 turn、不写状态、不落 journal
|
|
63
|
-
* (core journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
63
|
+
* (core event-journal-wiring 对其豁免 append),只承诺「引擎活跃时周期性出现」——供宿主
|
|
64
64
|
* 无进展守护刷新判活(长工具执行期)。节流属生产者实现细节,不进协议承诺。
|
|
65
65
|
*
|
|
66
66
|
* armed = [D3 协议版 P6] schema 强制武装确认回执:引擎在启动期武装断言通过 +
|
|
@@ -153,7 +153,7 @@ interface EngineHandleData {
|
|
|
153
153
|
* [池抽象降级 2026-09-13] 原 poolKey 字段已删除——两引擎 poolKey 恒 'shared'
|
|
154
154
|
* (SDK SHARED_POOL_KEY),journal 固定落 engines/<engineId>/shared/,字段零信息量。
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
eventsPath?: string;
|
|
157
157
|
/** probe 实测版本(漂移排查锚点)。 */
|
|
158
158
|
engineVersion?: string;
|
|
159
159
|
/** 适配器版本(golden 样本对齐排查)。 */
|
|
@@ -171,7 +171,7 @@ interface ResumeAnchor {
|
|
|
171
171
|
/** 引擎定位键(pi = { recordId?, sessionFile? };zcode = { sessionId, dbPath })。 */
|
|
172
172
|
sessionRef: Record<string, string>;
|
|
173
173
|
/** journal 绝对路径(read 降级链第②级数据源;无 journal 缺省)。 */
|
|
174
|
-
|
|
174
|
+
eventsPath?: string;
|
|
175
175
|
}
|
|
176
176
|
/** Turn → ReplayedTurn:剥离内部态(closed 恒 true——重放物无进行时语义)。 */
|
|
177
177
|
interface ReplayedTurn {
|
|
@@ -296,7 +296,7 @@ interface WorktreeHandle {
|
|
|
296
296
|
}
|
|
297
297
|
/**
|
|
298
298
|
* 一次引擎执行的终态(协议 run 终态应答的 outcome 载荷)。锚定 core
|
|
299
|
-
* orchestration AgentResult 并追加引擎层字段(engineId /
|
|
299
|
+
* orchestration AgentResult 并追加引擎层字段(engineId / exitCode)。
|
|
300
300
|
*/
|
|
301
301
|
interface AgentOutcome {
|
|
302
302
|
content: string;
|
|
@@ -314,13 +314,8 @@ interface AgentOutcome {
|
|
|
314
314
|
/** 仅诊断——目录可能已被 finalize 清理,不得作为 cwd 复用。 */
|
|
315
315
|
worktreePath?: string;
|
|
316
316
|
toolCalls?: ToolCallEntry[];
|
|
317
|
-
/**
|
|
317
|
+
/** 实际执行引擎。 */
|
|
318
318
|
engineId: string;
|
|
319
|
-
/** fallback 留痕(record 同步投影,GUI 警告条数据源)。 */
|
|
320
|
-
engineFallback?: {
|
|
321
|
-
from: string;
|
|
322
|
-
reason: string;
|
|
323
|
-
};
|
|
324
319
|
/** null = 被信号杀死(杀链/abort 合成终态的判据)。 */
|
|
325
320
|
exitCode?: number | null;
|
|
326
321
|
/**
|
|
@@ -381,7 +376,7 @@ interface ModelCatalogEntry {
|
|
|
381
376
|
* - 判据② task(隔离与权限随任务声明):worktree / fork / forkSource /
|
|
382
377
|
* denyTools / permissionMode;
|
|
383
378
|
* - 判据② task(诊断元数据):description;
|
|
384
|
-
* - 判据③ ctx(环境值,引擎自推导与宿主不恒等):model / cwd
|
|
379
|
+
* - 判据③ ctx(环境值,引擎自推导与宿主不恒等):model / cwd
|
|
385
380
|
* (对照 core orchestration/models/types.ts AgentCallOpts,协议层单列);
|
|
386
381
|
* - 判据① 宿主自持不上协议:engine(路由决策已完成,收到的引擎即选中值)、
|
|
387
382
|
* timeoutMs(宿主超时链 mergeTimeoutSignal → cancel 帧,非引擎参数)、
|
|
@@ -434,4 +429,4 @@ interface AgentCallOpts {
|
|
|
434
429
|
permissionMode?: string;
|
|
435
430
|
}
|
|
436
431
|
|
|
437
|
-
export {
|
|
432
|
+
export { type AgentEvent as A, type EngineHandleData as E, type InternalToolCall as I, type ModelCatalogEntry as M, type ProbeReport as P, type ReplayedTurn as R, type SessionView as S, type Turn as T, type WorktreeHandle as W, type AgentUsageTotal as a, type AgentCallOpts as b, type AgentOutcome as c, type EngineCapabilities as d, type ResumeAnchor as e, AGENT_EVENT_TYPE_NAMES as f, type AgentEventTypeName as g, type AgentFailureKind as h, type AgentOutcomeUsage as i, type AgentUsage as j, type AssertMutuallyAssignable as k, type EngineProcessModel as l, type ToolCall as m, type ToolCallEntry as n, type ToolCallResult as o };
|
package/dist/data-dir.cjs
CHANGED
|
@@ -26,8 +26,16 @@ __export(data_dir_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(data_dir_exports);
|
|
28
28
|
|
|
29
|
+
// src/global-slots.ts
|
|
30
|
+
var ENGINE_SDK_SLOT_KEYS = {
|
|
31
|
+
/** dataDir 缺省告警一次性标记(data-dir.ts)。 */
|
|
32
|
+
dataDirWarned: "@zhushanwen/subagent-engine-sdk.data-dir-warned",
|
|
33
|
+
/** logger sink 进程级单例(logger.ts)。 */
|
|
34
|
+
loggerSink: "@zhushanwen/subagent-engine-sdk.logger-sink"
|
|
35
|
+
};
|
|
36
|
+
|
|
29
37
|
// src/logger.ts
|
|
30
|
-
var SINK_SLOT_KEY =
|
|
38
|
+
var SINK_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.loggerSink);
|
|
31
39
|
function getSinkSlot() {
|
|
32
40
|
let slot = Reflect.get(globalThis, SINK_SLOT_KEY);
|
|
33
41
|
if (!slot) {
|
|
@@ -76,7 +84,7 @@ function getLogger(component) {
|
|
|
76
84
|
// src/data-dir.ts
|
|
77
85
|
var logger = getLogger("subagents");
|
|
78
86
|
var TAIJI_DATA_DIR_ENV = "TAIJI_AGENT_DATA_DIR";
|
|
79
|
-
var WARNED_SLOT_KEY =
|
|
87
|
+
var WARNED_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.dataDirWarned);
|
|
80
88
|
function getWarnedSlot() {
|
|
81
89
|
let slot = Reflect.get(globalThis, WARNED_SLOT_KEY);
|
|
82
90
|
if (!slot) {
|
package/dist/data-dir.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
TAIJI_DATA_DIR_ENV,
|
|
3
3
|
resetDataDirWarnForTests,
|
|
4
4
|
resolveEngineDataDir
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-3FVBDH3X.js";
|
|
6
|
+
import "./chunk-NXNNXGTY.js";
|
|
7
7
|
import "./chunk-JSBRDJBE.js";
|
|
8
8
|
export {
|
|
9
9
|
TAIJI_DATA_DIR_ENV,
|
package/dist/env.cjs
CHANGED
|
@@ -28,8 +28,16 @@ __export(env_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(env_exports);
|
|
30
30
|
|
|
31
|
+
// src/global-slots.ts
|
|
32
|
+
var ENGINE_SDK_SLOT_KEYS = {
|
|
33
|
+
/** dataDir 缺省告警一次性标记(data-dir.ts)。 */
|
|
34
|
+
dataDirWarned: "@zhushanwen/subagent-engine-sdk.data-dir-warned",
|
|
35
|
+
/** logger sink 进程级单例(logger.ts)。 */
|
|
36
|
+
loggerSink: "@zhushanwen/subagent-engine-sdk.logger-sink"
|
|
37
|
+
};
|
|
38
|
+
|
|
31
39
|
// src/logger.ts
|
|
32
|
-
var SINK_SLOT_KEY =
|
|
40
|
+
var SINK_SLOT_KEY = Symbol.for(ENGINE_SDK_SLOT_KEYS.loggerSink);
|
|
33
41
|
function getSinkSlot() {
|
|
34
42
|
let slot = Reflect.get(globalThis, SINK_SLOT_KEY);
|
|
35
43
|
if (!slot) {
|
package/dist/env.d.cts
CHANGED
|
@@ -24,12 +24,12 @@ interface EngineChildEnvOptions {
|
|
|
24
24
|
/** L0:relay 三键(宿主 relay 激活时传;三键必经 L0——L1 拒绝 TAIJI_SUBAGENT_ 前缀、L2 是 manifest 面,两层都到不了) */
|
|
25
25
|
relay?: EngineRelayEnv;
|
|
26
26
|
/**
|
|
27
|
-
* L0
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* L0:引擎宿主(engine-host)进程的 env 透传通道。**注意它不是子代理身份通道**:
|
|
28
|
+
* 引擎宿主是长驻进程(每窗口一个),而子代理身份(recordId / depth 等)是 per-run 的
|
|
29
|
+
* ——宿主级钉值只能得到进程级粗粒度值。2026-09-30 §2.7 裁决(路 A)后,身份改由引擎在
|
|
30
|
+
* spawn 子 pi 时按 run 写回子进程 env,键表单源 = `src/identity-env.ts`,写入方 =
|
|
31
|
+
* pi 引擎 `spawn-runner.ts` 的 `applyIdentityEnvToChildEnv`;本通道保留给宿主级
|
|
32
|
+
* 基础设施键(历史用途见 docs/architecture/ext-simplify-17-shared-extraction.md §3.1 D4)。
|
|
33
33
|
*/
|
|
34
34
|
identityEnv?: Record<string, string | undefined>;
|
|
35
35
|
/** L2:manifest 声明的 envPrefixes 放行清单(保留前缀拒绝 + 形态校验) */
|
package/dist/env.d.ts
CHANGED
|
@@ -24,12 +24,12 @@ interface EngineChildEnvOptions {
|
|
|
24
24
|
/** L0:relay 三键(宿主 relay 激活时传;三键必经 L0——L1 拒绝 TAIJI_SUBAGENT_ 前缀、L2 是 manifest 面,两层都到不了) */
|
|
25
25
|
relay?: EngineRelayEnv;
|
|
26
26
|
/**
|
|
27
|
-
* L0
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* L0:引擎宿主(engine-host)进程的 env 透传通道。**注意它不是子代理身份通道**:
|
|
28
|
+
* 引擎宿主是长驻进程(每窗口一个),而子代理身份(recordId / depth 等)是 per-run 的
|
|
29
|
+
* ——宿主级钉值只能得到进程级粗粒度值。2026-09-30 §2.7 裁决(路 A)后,身份改由引擎在
|
|
30
|
+
* spawn 子 pi 时按 run 写回子进程 env,键表单源 = `src/identity-env.ts`,写入方 =
|
|
31
|
+
* pi 引擎 `spawn-runner.ts` 的 `applyIdentityEnvToChildEnv`;本通道保留给宿主级
|
|
32
|
+
* 基础设施键(历史用途见 docs/architecture/ext-simplify-17-shared-extraction.md §3.1 D4)。
|
|
33
33
|
*/
|
|
34
34
|
identityEnv?: Record<string, string | undefined>;
|
|
35
35
|
/** L2:manifest 声明的 envPrefixes 放行清单(保留前缀拒绝 + 形态校验) */
|
package/dist/env.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
ENGINE_ENV_PREFIXES,
|
|
5
5
|
buildEngineChildEnv,
|
|
6
6
|
buildOutboundChildEnv
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-AF2ETADP.js";
|
|
8
|
+
import "./chunk-NXNNXGTY.js";
|
|
9
9
|
import "./chunk-JSBRDJBE.js";
|
|
10
10
|
export {
|
|
11
11
|
ENGINE_ENV_DENY_LIST,
|