@zhushanwen/subagent-engine-sdk 0.7.1 → 0.9.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.
Files changed (53) hide show
  1. package/dist/best-effort.cjs +9 -1
  2. package/dist/best-effort.js +2 -2
  3. package/dist/{chunk-X24IVQKJ.js → chunk-3FVBDH3X.js} +3 -2
  4. package/dist/{chunk-HERD6RIR.js → chunk-6QE3OODO.js} +2 -2
  5. package/dist/{chunk-YL5W5EMV.js → chunk-AF2ETADP.js} +1 -1
  6. package/dist/chunk-D36ZIQQK.js +28 -0
  7. package/dist/{chunk-W23PAAGX.js → chunk-DIIYVO4O.js} +1 -27
  8. package/dist/{chunk-RCT7L777.js → chunk-EF2F5YOM.js} +2 -2
  9. package/dist/{chunk-3WC36CHI.js → chunk-KADRNFG2.js} +1 -1
  10. package/dist/{chunk-75QEMUGV.js → chunk-NXNNXGTY.js} +10 -1
  11. package/dist/{chunk-EJMF63R5.js → chunk-QMEHSKNR.js} +1 -1
  12. package/dist/{chunk-SFNTX7Q3.js → chunk-VDKR7MLG.js} +0 -11
  13. package/dist/{chunk-J4G2MXDS.js → chunk-VE3NVT7K.js} +1 -1
  14. package/dist/cli-entry.cjs +9 -1
  15. package/dist/cli-entry.js +2 -2
  16. package/dist/{contract-types-DiWyGRXr.d.cts → contract-types-DqOD58r-.d.cts} +7 -12
  17. package/dist/{contract-types-DiWyGRXr.d.ts → contract-types-DqOD58r-.d.ts} +7 -12
  18. package/dist/data-dir.cjs +10 -2
  19. package/dist/data-dir.js +2 -2
  20. package/dist/env.cjs +9 -1
  21. package/dist/env.d.cts +6 -6
  22. package/dist/env.d.ts +6 -6
  23. package/dist/env.js +2 -2
  24. package/dist/error-codes-C3oVToMr.d.cts +311 -0
  25. package/dist/error-codes-CiDwaODz.d.ts +311 -0
  26. package/dist/index.cjs +41 -16
  27. package/dist/index.d.cts +31 -3
  28. package/dist/index.d.ts +31 -3
  29. package/dist/index.js +64 -37
  30. package/dist/journal-io.d.cts +1 -1
  31. package/dist/journal-io.d.ts +1 -1
  32. package/dist/journal-replay.d.cts +1 -1
  33. package/dist/journal-replay.d.ts +1 -1
  34. package/dist/kill-chain.cjs +9 -1
  35. package/dist/kill-chain.d.cts +1 -1
  36. package/dist/kill-chain.d.ts +1 -1
  37. package/dist/kill-chain.js +3 -3
  38. package/dist/logger.cjs +11 -1
  39. package/dist/logger.js +1 -1
  40. package/dist/node-executor.js +2 -2
  41. package/dist/port-contract.d.cts +12 -6
  42. package/dist/port-contract.d.ts +12 -6
  43. package/dist/protocol/index.cjs +1 -14
  44. package/dist/protocol/index.d.cts +4 -299
  45. package/dist/protocol/index.d.ts +4 -299
  46. package/dist/protocol/index.js +8 -10
  47. package/dist/server/index.cjs +217 -0
  48. package/dist/server/index.d.cts +146 -0
  49. package/dist/server/index.d.ts +146 -0
  50. package/dist/server/index.js +143 -0
  51. package/dist/spawn.cjs +9 -1
  52. package/dist/spawn.js +4 -4
  53. package/package.json +12 -1
@@ -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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.logger-sink");
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) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  bestEffort
3
- } from "./chunk-EJMF63R5.js";
4
- import "./chunk-75QEMUGV.js";
3
+ } from "./chunk-QMEHSKNR.js";
4
+ import "./chunk-NXNNXGTY.js";
5
5
  import "./chunk-JSBRDJBE.js";
6
6
  export {
7
7
  bestEffort
@@ -1,11 +1,12 @@
1
1
  import {
2
+ ENGINE_SDK_SLOT_KEYS,
2
3
  getLogger
3
- } from "./chunk-75QEMUGV.js";
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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.data-dir-warned");
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) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  killChain,
3
3
  safeKill
4
- } from "./chunk-RCT7L777.js";
4
+ } from "./chunk-EF2F5YOM.js";
5
5
  import {
6
6
  getLogger
7
- } from "./chunk-75QEMUGV.js";
7
+ } from "./chunk-NXNNXGTY.js";
8
8
 
9
9
  // src/spawn.ts
10
10
  import { spawn } from "child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getLogger
3
- } from "./chunk-75QEMUGV.js";
3
+ } from "./chunk-NXNNXGTY.js";
4
4
 
5
5
  // src/env.ts
6
6
  var logger = getLogger("engine-sdk/env");
@@ -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
- journalPath: { type: "string" }
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,
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-PYO3YR7W.js";
4
4
  import {
5
5
  engineTimeoutDetail
6
- } from "./chunk-SFNTX7Q3.js";
6
+ } from "./chunk-VDKR7MLG.js";
7
7
  import {
8
8
  getLogger
9
- } from "./chunk-75QEMUGV.js";
9
+ } from "./chunk-NXNNXGTY.js";
10
10
 
11
11
  // src/kill-chain.ts
12
12
  var logger = getLogger("subagents");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EngineSdkError
3
- } from "./chunk-SFNTX7Q3.js";
3
+ } from "./chunk-VDKR7MLG.js";
4
4
 
5
5
  // src/node-executor.ts
6
6
  import { spawn } from "child_process";
@@ -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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.logger-sink");
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getLogger
3
- } from "./chunk-75QEMUGV.js";
3
+ } from "./chunk-NXNNXGTY.js";
4
4
 
5
5
  // src/best-effort.ts
6
6
  var logger = getLogger("subagents");
@@ -7,15 +7,6 @@ function isProtocolVersionCompatible(version) {
7
7
  var REVERSE_REQUEST_TIMEOUT_MS = 1e4;
8
8
  var HANDSHAKE_TIMEOUT_MS = 1e4;
9
9
  var CANCEL_SETTLE_GRACE_MS = 3e3;
10
- var CRASH_REBUILD_MAX_ATTEMPTS = 3;
11
- var CRASH_REBUILD_BACKOFF_STEP_1_MS = 1e3;
12
- var CRASH_REBUILD_BACKOFF_STEP_2_MS = 2e3;
13
- var CRASH_REBUILD_BACKOFF_STEP_3_MS = 4e3;
14
- var CRASH_REBUILD_BACKOFF_MS = [
15
- CRASH_REBUILD_BACKOFF_STEP_1_MS,
16
- CRASH_REBUILD_BACKOFF_STEP_2_MS,
17
- CRASH_REBUILD_BACKOFF_STEP_3_MS
18
- ];
19
10
  var STDERR_TAIL_CHARS = 400;
20
11
 
21
12
  // src/protocol/error-codes.ts
@@ -98,8 +89,6 @@ export {
98
89
  REVERSE_REQUEST_TIMEOUT_MS,
99
90
  HANDSHAKE_TIMEOUT_MS,
100
91
  CANCEL_SETTLE_GRACE_MS,
101
- CRASH_REBUILD_MAX_ATTEMPTS,
102
- CRASH_REBUILD_BACKOFF_MS,
103
92
  STDERR_TAIL_CHARS,
104
93
  ENGINE_PROTOCOL_ERROR_CODES,
105
94
  isEngineProtocolErrorCode,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  configureLoggerSink,
3
3
  getLogger
4
- } from "./chunk-75QEMUGV.js";
4
+ } from "./chunk-NXNNXGTY.js";
5
5
 
6
6
  // src/cli-entry.ts
7
7
  import * as readline from "readline";
@@ -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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.logger-sink");
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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runEngineCliEntry
3
- } from "./chunk-J4G2MXDS.js";
4
- import "./chunk-75QEMUGV.js";
3
+ } from "./chunk-VE3NVT7K.js";
4
+ import "./chunk-NXNNXGTY.js";
5
5
  import "./chunk-JSBRDJBE.js";
6
6
  export {
7
7
  runEngineCliEntry
@@ -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
- journalPath?: string;
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
- journalPath?: string;
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 / engineFallback / exitCode)。
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
- /** 实际执行引擎(fallback 后可能 ≠ 请求值)。 */
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 / engineFallback
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 { AGENT_EVENT_TYPE_NAMES as A, type EngineCapabilities as E, type InternalToolCall as I, type ModelCatalogEntry as M, type ProbeReport as P, type ReplayedTurn as R, type SessionView as S, type ToolCall as T, type WorktreeHandle as W, type AgentCallOpts as a, type AgentEvent as b, type AgentEventTypeName as c, type AgentFailureKind as d, type AgentOutcome as e, type AgentOutcomeUsage as f, type AgentUsage as g, type AgentUsageTotal as h, type AssertMutuallyAssignable as i, type EngineHandleData as j, type EngineProcessModel as k, type ResumeAnchor as l, type ToolCallEntry as m, type ToolCallResult as n, type Turn as o };
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
- journalPath?: string;
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
- journalPath?: string;
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 / engineFallback / exitCode)。
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
- /** 实际执行引擎(fallback 后可能 ≠ 请求值)。 */
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 / engineFallback
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 { AGENT_EVENT_TYPE_NAMES as A, type EngineCapabilities as E, type InternalToolCall as I, type ModelCatalogEntry as M, type ProbeReport as P, type ReplayedTurn as R, type SessionView as S, type ToolCall as T, type WorktreeHandle as W, type AgentCallOpts as a, type AgentEvent as b, type AgentEventTypeName as c, type AgentFailureKind as d, type AgentOutcome as e, type AgentOutcomeUsage as f, type AgentUsage as g, type AgentUsageTotal as h, type AssertMutuallyAssignable as i, type EngineHandleData as j, type EngineProcessModel as k, type ResumeAnchor as l, type ToolCallEntry as m, type ToolCallResult as n, type Turn as o };
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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.logger-sink");
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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.data-dir-warned");
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-X24IVQKJ.js";
6
- import "./chunk-75QEMUGV.js";
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 = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.logger-sink");
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:引擎侧身份 env 透传通道(identityEnv)。现行事实(ext-simplify-17 D4,
28
- * 20260914 真机探针证实):PI_SUBAGENT_ROOT_SESSION_ID / PI_SUBAGENT_SELF_RECORD_ID
29
- * 两键已无写入方(本通道现无人传值),引擎链统一 subagent 标记 = TAIJI_AGENT_SUBAGENT=1
30
- * (见 injectL0InfraKeys 恒注入),base-tool-enhance 判据已重锚新标记。通道保留待
31
- * 另行裁决,读者见 docs/architecture/ext-simplify-17-shared-extraction.md §3.1 D4
32
- * 与探针报告 .tmp/dev-flow/ext-simplify-17-d4-probe.md。
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:引擎侧身份 env 透传通道(identityEnv)。现行事实(ext-simplify-17 D4,
28
- * 20260914 真机探针证实):PI_SUBAGENT_ROOT_SESSION_ID / PI_SUBAGENT_SELF_RECORD_ID
29
- * 两键已无写入方(本通道现无人传值),引擎链统一 subagent 标记 = TAIJI_AGENT_SUBAGENT=1
30
- * (见 injectL0InfraKeys 恒注入),base-tool-enhance 判据已重锚新标记。通道保留待
31
- * 另行裁决,读者见 docs/architecture/ext-simplify-17-shared-extraction.md §3.1 D4
32
- * 与探针报告 .tmp/dev-flow/ext-simplify-17-d4-probe.md。
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-YL5W5EMV.js";
8
- import "./chunk-75QEMUGV.js";
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,