@zhushanwen/subagent-engine-sdk 0.11.0 → 0.12.1

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.
@@ -32,6 +32,10 @@ __export(protocol_exports, {
32
32
  ENGINE_TRANSPORT_ERROR_CODES: () => ENGINE_TRANSPORT_ERROR_CODES,
33
33
  ENGINE_TRANSPORT_ERROR_RECOVERY: () => ENGINE_TRANSPORT_ERROR_RECOVERY,
34
34
  EngineSdkError: () => EngineSdkError,
35
+ FAILURE_CAUSE_CLOSED_KINDS: () => FAILURE_CAUSE_CLOSED_KINDS,
36
+ FAILURE_CAUSE_KINDS_BY_CLASS: () => FAILURE_CAUSE_KINDS_BY_CLASS,
37
+ FAILURE_CAUSE_KINDS_BY_CLASS_LOCK: () => FAILURE_CAUSE_KINDS_BY_CLASS_LOCK,
38
+ FAILURE_CAUSE_KIND_VOCAB_LOCK: () => FAILURE_CAUSE_KIND_VOCAB_LOCK,
35
39
  FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS: () => FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
36
40
  HANDSHAKE_TIMEOUT_MS: () => HANDSHAKE_TIMEOUT_MS,
37
41
  PROTOCOL_METHODS: () => PROTOCOL_METHODS,
@@ -48,6 +52,7 @@ __export(protocol_exports, {
48
52
  SUBAGENT_CONTROL_FRAME_KINDS: () => SUBAGENT_CONTROL_FRAME_KINDS,
49
53
  SUBAGENT_CONTROL_PROTOCOL_VERSION: () => SUBAGENT_CONTROL_PROTOCOL_VERSION,
50
54
  SUPPORTED_PROTOCOL_RANGE: () => SUPPORTED_PROTOCOL_RANGE,
55
+ _EventVocabSyncLock: () => _EventVocabSyncLock,
51
56
  assertChatConversationSupported: () => assertChatConversationSupported,
52
57
  engineConversationUnsupportedError: () => engineConversationUnsupportedError,
53
58
  engineProtocolMismatchError: () => engineProtocolMismatchError,
@@ -307,9 +312,28 @@ var AGENT_EVENT_TYPE_NAMES = [
307
312
  // noop-safe: 纯活性信号,双侧 reducer 恒 no-op(协议语义见 AgentEvent 头注),丢弃零差异
308
313
  "error",
309
314
  // noop-safe: 旧宿主 default 分支零写入——丢弃仅缺 lastError 诊断留痕,已写状态不回滚
310
- "armed"
315
+ "armed",
311
316
  // noop-safe: 旧宿主无武装等待窗消费点(fail-fast 属宿主新增逻辑),丢弃仅缺武装留痕,schema 强制第一道防线(引擎自查断言)不受损
317
+ "auto_retry"
318
+ // noop-safe: 旧宿主 default 分支零写入——丢弃仅缺重试边界留痕(journal 不可查失败尝试轨迹),轮成败判定与 turns/usage 计账不受损(P5 计账锚在引擎侧收尾快照,不依赖宿主消费本帧)
312
319
  ];
320
+ var _EventVocabSyncLock = true;
321
+ var FAILURE_CAUSE_CLOSED_KINDS = [
322
+ "rate_limited",
323
+ "protocol_unsupported",
324
+ "turn_budget_exhausted",
325
+ "timeout",
326
+ "no_deliverable",
327
+ "cancelled"
328
+ ];
329
+ var FAILURE_CAUSE_KIND_VOCAB_LOCK = true;
330
+ var FAILURE_CAUSE_KINDS_BY_CLASS = {
331
+ provider: ["rate_limited", "protocol_unsupported"],
332
+ harness: ["turn_budget_exhausted", "timeout"],
333
+ agent: ["no_deliverable"],
334
+ user: ["cancelled"]
335
+ };
336
+ var FAILURE_CAUSE_KINDS_BY_CLASS_LOCK = true;
313
337
 
314
338
  // src/protocol/schema.ts
315
339
  var ANY_JSON = {};
@@ -453,6 +477,10 @@ var runSessionParamsSchema = {
453
477
  ENGINE_TRANSPORT_ERROR_CODES,
454
478
  ENGINE_TRANSPORT_ERROR_RECOVERY,
455
479
  EngineSdkError,
480
+ FAILURE_CAUSE_CLOSED_KINDS,
481
+ FAILURE_CAUSE_KINDS_BY_CLASS,
482
+ FAILURE_CAUSE_KINDS_BY_CLASS_LOCK,
483
+ FAILURE_CAUSE_KIND_VOCAB_LOCK,
456
484
  FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
457
485
  HANDSHAKE_TIMEOUT_MS,
458
486
  PROTOCOL_METHODS,
@@ -469,6 +497,7 @@ var runSessionParamsSchema = {
469
497
  SUBAGENT_CONTROL_FRAME_KINDS,
470
498
  SUBAGENT_CONTROL_PROTOCOL_VERSION,
471
499
  SUPPORTED_PROTOCOL_RANGE,
500
+ _EventVocabSyncLock,
472
501
  assertChatConversationSupported,
473
502
  engineConversationUnsupportedError,
474
503
  engineProtocolMismatchError,
@@ -1,7 +1,7 @@
1
- export { a as ENGINE_ERROR_CODE_PREFIX, b as ENGINE_PROTOCOL_ERROR_CODES, c as ENGINE_SPAWN_DELIVERY_ERROR_CODES, d as ENGINE_SPAWN_DELIVERY_ERROR_RECOVERY, e as ENGINE_TIMEOUT_RECOVERY, f as ENGINE_TRANSPORT_ERROR_CODES, g as ENGINE_TRANSPORT_ERROR_RECOVERY, h as EngineProtocolErrorCode, E as EngineSdkError, i as EngineSpawnDeliveryErrorCode, j as EngineTransportErrorCode, k as ErrorResponseFrame, l as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, m as ResponseFrame, n as ReverseRequestFrame, o as ReverseResponseResult, S as SET_MODEL_ERROR_CODES, p as SET_MODEL_NOT_ACTIVE_CODE, q as STDOUT_TAIL_ECHO_CHARS, r as SetModelErrorCode, s as SuccessResponseFrame, t as assertChatConversationSupported, u as engineConversationUnsupportedError, v as engineProtocolMismatchError, w as engineSetModelUnsupportedError, x as engineTimeoutDetail, y as isEngineErrorPassthroughCode, z as isEngineProtocolErrorCode, A as isNotificationFrame, B as isRequestFrame, C as isResponseFrame, D as isReverseRequestFrame, F as schemaEmulationFailedDetail } from '../error-codes-D_aPibUt.cjs';
2
- export { C as CancelParams, c as CancelResult, D as DisposeParams, d as DisposeResult, b as InitializeParams, I as InitializeResult, L as ListModelsParams, e as ListModelsResult, P as PROTOCOL_METHODS, f as PingParams, g as PingResult, h as ProbeParams, i as ProtocolMethod, j as ProtocolParamsMap, k as ProtocolResultMap, l as ReadParams, R as RunContextParams, m as RunParams, n as RunResult, o as RunResumeParams, S as SetModelParams, a as SetModelResult, V as ValidateModelParams, p as ValidateModelResult } from '../methods-CHiDwvRK.cjs';
1
+ export { a as ENGINE_ERROR_CODE_PREFIX, b as ENGINE_PROTOCOL_ERROR_CODES, c as ENGINE_SPAWN_DELIVERY_ERROR_CODES, d as ENGINE_SPAWN_DELIVERY_ERROR_RECOVERY, e as ENGINE_TIMEOUT_RECOVERY, f as ENGINE_TRANSPORT_ERROR_CODES, g as ENGINE_TRANSPORT_ERROR_RECOVERY, h as EngineProtocolErrorCode, E as EngineSdkError, i as EngineSpawnDeliveryErrorCode, j as EngineTransportErrorCode, k as ErrorResponseFrame, l as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, m as ResponseFrame, n as ReverseRequestFrame, o as ReverseResponseResult, S as SET_MODEL_ERROR_CODES, p as SET_MODEL_NOT_ACTIVE_CODE, q as STDOUT_TAIL_ECHO_CHARS, r as SetModelErrorCode, s as SuccessResponseFrame, t as assertChatConversationSupported, u as engineConversationUnsupportedError, v as engineProtocolMismatchError, w as engineSetModelUnsupportedError, x as engineTimeoutDetail, y as isEngineErrorPassthroughCode, z as isEngineProtocolErrorCode, A as isNotificationFrame, B as isRequestFrame, C as isResponseFrame, D as isReverseRequestFrame, F as schemaEmulationFailedDetail } from '../error-codes-CgcjlmeD.cjs';
2
+ export { C as CancelParams, c as CancelResult, D as DisposeParams, d as DisposeResult, b as InitializeParams, I as InitializeResult, L as ListModelsParams, e as ListModelsResult, P as PROTOCOL_METHODS, f as PingParams, g as PingResult, h as ProbeParams, i as ProtocolMethod, j as ProtocolParamsMap, k as ProtocolResultMap, l as ReadParams, R as RunContextParams, m as RunParams, n as RunResult, o as RunResumeParams, S as SetModelParams, a as SetModelResult, V as ValidateModelParams, p as ValidateModelResult } from '../methods-BzvzcCrB.cjs';
3
3
  import { UiRequest, UiResponse } from '../ui-types.cjs';
4
- export { g as AGENT_EVENT_TYPE_NAMES, b as AgentCallOpts, A as AgentEvent, h as AgentEventTypeName, i as AgentFailureKind, c as AgentOutcome, j as AgentOutcomeUsage, k as AgentUsage, a as AgentUsageTotal, l as AssertMutuallyAssignable, d as EngineCapabilities, E as EngineHandleData, m as EngineProcessModel, I as InternalToolCall, f as ModelCatalogEntry, M as ModelRef, P as ProbeReport, R as ReplayedTurn, e as ResumeAnchor, S as SessionView, n as ToolCall, o as ToolCallEntry, p as ToolCallResult, T as Turn, W as WorktreeHandle } from '../contract-types-BUHUMF9R.cjs';
4
+ export { h as AGENT_EVENT_TYPE_NAMES, c as AgentCallOpts, A as AgentEvent, i as AgentEventTypeName, j as AgentFailureKind, d as AgentOutcome, k as AgentOutcomeUsage, a as AgentUsage, b as AgentUsageTotal, l as AssertMutuallyAssignable, e as EngineCapabilities, E as EngineHandleData, m as EngineProcessModel, n as EngineStopReason, F as FAILURE_CAUSE_CLOSED_KINDS, o as FAILURE_CAUSE_KINDS_BY_CLASS, p as FAILURE_CAUSE_KINDS_BY_CLASS_LOCK, q as FAILURE_CAUSE_KIND_VOCAB_LOCK, r as FailureCause, s as FailureCauseClass, t as FailureRetryability, I as InternalToolCall, g as ModelCatalogEntry, M as ModelRef, P as ProbeReport, R as ReplayedTurn, f as ResumeAnchor, S as SessionView, u as ToolCall, v as ToolCallEntry, w as ToolCallResult, T as Turn, W as WorktreeHandle, _ as _EventVocabSyncLock } from '../contract-types-C1scOS_M.cjs';
5
5
 
6
6
  /** 协议版本(引擎包 manifest `taiji.subagentEngine.protocol` 与 initialize 应答同值)。 */
7
7
  declare const ENGINE_PROTOCOL_VERSION = 1;
@@ -278,7 +278,7 @@ declare const notificationFrameSchema: {
278
278
  readonly properties: {
279
279
  readonly type: {
280
280
  readonly type: "string";
281
- readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed"];
281
+ readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed", "auto_retry"];
282
282
  };
283
283
  };
284
284
  };
@@ -398,7 +398,7 @@ declare const ENGINE_PROTOCOL_SCHEMAS: {
398
398
  readonly properties: {
399
399
  readonly type: {
400
400
  readonly type: "string";
401
- readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed"];
401
+ readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed", "auto_retry"];
402
402
  };
403
403
  };
404
404
  };
@@ -1,7 +1,7 @@
1
- export { a as ENGINE_ERROR_CODE_PREFIX, b as ENGINE_PROTOCOL_ERROR_CODES, c as ENGINE_SPAWN_DELIVERY_ERROR_CODES, d as ENGINE_SPAWN_DELIVERY_ERROR_RECOVERY, e as ENGINE_TIMEOUT_RECOVERY, f as ENGINE_TRANSPORT_ERROR_CODES, g as ENGINE_TRANSPORT_ERROR_RECOVERY, h as EngineProtocolErrorCode, E as EngineSdkError, i as EngineSpawnDeliveryErrorCode, j as EngineTransportErrorCode, k as ErrorResponseFrame, l as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, m as ResponseFrame, n as ReverseRequestFrame, o as ReverseResponseResult, S as SET_MODEL_ERROR_CODES, p as SET_MODEL_NOT_ACTIVE_CODE, q as STDOUT_TAIL_ECHO_CHARS, r as SetModelErrorCode, s as SuccessResponseFrame, t as assertChatConversationSupported, u as engineConversationUnsupportedError, v as engineProtocolMismatchError, w as engineSetModelUnsupportedError, x as engineTimeoutDetail, y as isEngineErrorPassthroughCode, z as isEngineProtocolErrorCode, A as isNotificationFrame, B as isRequestFrame, C as isResponseFrame, D as isReverseRequestFrame, F as schemaEmulationFailedDetail } from '../error-codes-DrNf0gwT.js';
2
- export { C as CancelParams, c as CancelResult, D as DisposeParams, d as DisposeResult, b as InitializeParams, I as InitializeResult, L as ListModelsParams, e as ListModelsResult, P as PROTOCOL_METHODS, f as PingParams, g as PingResult, h as ProbeParams, i as ProtocolMethod, j as ProtocolParamsMap, k as ProtocolResultMap, l as ReadParams, R as RunContextParams, m as RunParams, n as RunResult, o as RunResumeParams, S as SetModelParams, a as SetModelResult, V as ValidateModelParams, p as ValidateModelResult } from '../methods-BdIH3FwS.js';
1
+ export { a as ENGINE_ERROR_CODE_PREFIX, b as ENGINE_PROTOCOL_ERROR_CODES, c as ENGINE_SPAWN_DELIVERY_ERROR_CODES, d as ENGINE_SPAWN_DELIVERY_ERROR_RECOVERY, e as ENGINE_TIMEOUT_RECOVERY, f as ENGINE_TRANSPORT_ERROR_CODES, g as ENGINE_TRANSPORT_ERROR_RECOVERY, h as EngineProtocolErrorCode, E as EngineSdkError, i as EngineSpawnDeliveryErrorCode, j as EngineTransportErrorCode, k as ErrorResponseFrame, l as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, m as ResponseFrame, n as ReverseRequestFrame, o as ReverseResponseResult, S as SET_MODEL_ERROR_CODES, p as SET_MODEL_NOT_ACTIVE_CODE, q as STDOUT_TAIL_ECHO_CHARS, r as SetModelErrorCode, s as SuccessResponseFrame, t as assertChatConversationSupported, u as engineConversationUnsupportedError, v as engineProtocolMismatchError, w as engineSetModelUnsupportedError, x as engineTimeoutDetail, y as isEngineErrorPassthroughCode, z as isEngineProtocolErrorCode, A as isNotificationFrame, B as isRequestFrame, C as isResponseFrame, D as isReverseRequestFrame, F as schemaEmulationFailedDetail } from '../error-codes-o4rNd1Ee.js';
2
+ export { C as CancelParams, c as CancelResult, D as DisposeParams, d as DisposeResult, b as InitializeParams, I as InitializeResult, L as ListModelsParams, e as ListModelsResult, P as PROTOCOL_METHODS, f as PingParams, g as PingResult, h as ProbeParams, i as ProtocolMethod, j as ProtocolParamsMap, k as ProtocolResultMap, l as ReadParams, R as RunContextParams, m as RunParams, n as RunResult, o as RunResumeParams, S as SetModelParams, a as SetModelResult, V as ValidateModelParams, p as ValidateModelResult } from '../methods-CPMc4cvF.js';
3
3
  import { UiRequest, UiResponse } from '../ui-types.js';
4
- export { g as AGENT_EVENT_TYPE_NAMES, b as AgentCallOpts, A as AgentEvent, h as AgentEventTypeName, i as AgentFailureKind, c as AgentOutcome, j as AgentOutcomeUsage, k as AgentUsage, a as AgentUsageTotal, l as AssertMutuallyAssignable, d as EngineCapabilities, E as EngineHandleData, m as EngineProcessModel, I as InternalToolCall, f as ModelCatalogEntry, M as ModelRef, P as ProbeReport, R as ReplayedTurn, e as ResumeAnchor, S as SessionView, n as ToolCall, o as ToolCallEntry, p as ToolCallResult, T as Turn, W as WorktreeHandle } from '../contract-types-BUHUMF9R.js';
4
+ export { h as AGENT_EVENT_TYPE_NAMES, c as AgentCallOpts, A as AgentEvent, i as AgentEventTypeName, j as AgentFailureKind, d as AgentOutcome, k as AgentOutcomeUsage, a as AgentUsage, b as AgentUsageTotal, l as AssertMutuallyAssignable, e as EngineCapabilities, E as EngineHandleData, m as EngineProcessModel, n as EngineStopReason, F as FAILURE_CAUSE_CLOSED_KINDS, o as FAILURE_CAUSE_KINDS_BY_CLASS, p as FAILURE_CAUSE_KINDS_BY_CLASS_LOCK, q as FAILURE_CAUSE_KIND_VOCAB_LOCK, r as FailureCause, s as FailureCauseClass, t as FailureRetryability, I as InternalToolCall, g as ModelCatalogEntry, M as ModelRef, P as ProbeReport, R as ReplayedTurn, f as ResumeAnchor, S as SessionView, u as ToolCall, v as ToolCallEntry, w as ToolCallResult, T as Turn, W as WorktreeHandle, _ as _EventVocabSyncLock } from '../contract-types-C1scOS_M.js';
5
5
 
6
6
  /** 协议版本(引擎包 manifest `taiji.subagentEngine.protocol` 与 initialize 应答同值)。 */
7
7
  declare const ENGINE_PROTOCOL_VERSION = 1;
@@ -278,7 +278,7 @@ declare const notificationFrameSchema: {
278
278
  readonly properties: {
279
279
  readonly type: {
280
280
  readonly type: "string";
281
- readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed"];
281
+ readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed", "auto_retry"];
282
282
  };
283
283
  };
284
284
  };
@@ -398,7 +398,7 @@ declare const ENGINE_PROTOCOL_SCHEMAS: {
398
398
  readonly properties: {
399
399
  readonly type: {
400
400
  readonly type: "string";
401
- readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed"];
401
+ readonly enum: readonly ["tool_start", "tool_end", "text_delta", "thinking_delta", "turn_end", "message_end", "compaction", "activity", "error", "armed", "auto_retry"];
402
402
  };
403
403
  };
404
404
  };
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  AGENT_EVENT_TYPE_NAMES,
3
3
  ENGINE_PROTOCOL_SCHEMAS,
4
+ FAILURE_CAUSE_CLOSED_KINDS,
5
+ FAILURE_CAUSE_KINDS_BY_CLASS,
6
+ FAILURE_CAUSE_KINDS_BY_CLASS_LOCK,
7
+ FAILURE_CAUSE_KIND_VOCAB_LOCK,
4
8
  FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
5
9
  PROTOCOL_METHODS,
6
10
  REVERSE_CHANNELS,
@@ -8,6 +12,7 @@ import {
8
12
  SUBAGENT_CONTROL_CLOSED_REASONS,
9
13
  SUBAGENT_CONTROL_FRAME_KINDS,
10
14
  SUBAGENT_CONTROL_PROTOCOL_VERSION,
15
+ _EventVocabSyncLock,
11
16
  errorResponseFrameSchema,
12
17
  isSubagentControlClosedReason,
13
18
  isSubagentControlFrameKind,
@@ -17,7 +22,7 @@ import {
17
22
  reverseRequestFrameSchema,
18
23
  runSessionParamsSchema,
19
24
  successResponseFrameSchema
20
- } from "../chunk-QBXDEF4N.js";
25
+ } from "../chunk-7R6HYT2A.js";
21
26
  import {
22
27
  isNotificationFrame,
23
28
  isRequestFrame,
@@ -68,6 +73,10 @@ export {
68
73
  ENGINE_TRANSPORT_ERROR_CODES,
69
74
  ENGINE_TRANSPORT_ERROR_RECOVERY,
70
75
  EngineSdkError,
76
+ FAILURE_CAUSE_CLOSED_KINDS,
77
+ FAILURE_CAUSE_KINDS_BY_CLASS,
78
+ FAILURE_CAUSE_KINDS_BY_CLASS_LOCK,
79
+ FAILURE_CAUSE_KIND_VOCAB_LOCK,
71
80
  FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS,
72
81
  HANDSHAKE_TIMEOUT_MS,
73
82
  PROTOCOL_METHODS,
@@ -84,6 +93,7 @@ export {
84
93
  SUBAGENT_CONTROL_FRAME_KINDS,
85
94
  SUBAGENT_CONTROL_PROTOCOL_VERSION,
86
95
  SUPPORTED_PROTOCOL_RANGE,
96
+ _EventVocabSyncLock,
87
97
  assertChatConversationSupported,
88
98
  engineConversationUnsupportedError,
89
99
  engineProtocolMismatchError,
@@ -1,6 +1,6 @@
1
- import { b as AgentCallOpts, A as AgentEvent } from '../contract-types-BUHUMF9R.cjs';
2
- import { E as EngineSdkError } from '../error-codes-D_aPibUt.cjs';
3
- import { I as InitializeResult, R as RunContextParams, b as InitializeParams } from '../methods-CHiDwvRK.cjs';
1
+ import { c as AgentCallOpts, A as AgentEvent } from '../contract-types-C1scOS_M.cjs';
2
+ import { E as EngineSdkError } from '../error-codes-CgcjlmeD.cjs';
3
+ import { I as InitializeResult, R as RunContextParams, b as InitializeParams } from '../methods-BzvzcCrB.cjs';
4
4
  import { ReverseRequestClock } from '../spawn.cjs';
5
5
  import 'node:child_process';
6
6
  import '../env.cjs';
@@ -1,6 +1,6 @@
1
- import { b as AgentCallOpts, A as AgentEvent } from '../contract-types-BUHUMF9R.js';
2
- import { E as EngineSdkError } from '../error-codes-DrNf0gwT.js';
3
- import { I as InitializeResult, R as RunContextParams, b as InitializeParams } from '../methods-BdIH3FwS.js';
1
+ import { c as AgentCallOpts, A as AgentEvent } from '../contract-types-C1scOS_M.js';
2
+ import { E as EngineSdkError } from '../error-codes-o4rNd1Ee.js';
3
+ import { I as InitializeResult, R as RunContextParams, b as InitializeParams } from '../methods-CPMc4cvF.js';
4
4
  import { ReverseRequestClock } from '../spawn.js';
5
5
  import 'node:child_process';
6
6
  import '../env.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhushanwen/subagent-engine-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "Engine-side SDK for the subagent engine protocol: NDJSON stdio contract types, engine primitives (schema emulation, nesting guard, kill chain, journal replay projection, data-dir/paths resolution) — the shared contract root between subagent-core and engine CLI packages (engines import SDK only, never core)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,6 +33,17 @@
33
33
  },
34
34
  "default": "./dist/protocol/index.js"
35
35
  },
36
+ "./journal-replay": {
37
+ "import": {
38
+ "types": "./dist/journal-replay.d.ts",
39
+ "default": "./dist/journal-replay.js"
40
+ },
41
+ "require": {
42
+ "types": "./dist/journal-replay.d.cts",
43
+ "default": "./dist/journal-replay.cjs"
44
+ },
45
+ "default": "./dist/journal-replay.js"
46
+ },
36
47
  "./server": {
37
48
  "import": {
38
49
  "types": "./dist/server/index.d.ts",
@@ -45,7 +56,7 @@
45
56
  "default": "./dist/server/index.js"
46
57
  }
47
58
  },
48
- "$comment": "W1 骨架(docs/design/subagent-engine-protocolization.impl-plan.md §2.1)。双形态同 subagent-core 先例(D4):workspace 消费走 import 条件 -> src;npm 消费走 publishConfig -> dist。exports 面先收窄到 ./ 与 ./protocol(exports = semver 契约,收窄不放宽;引擎包 W5/W7 消费经主 barrel)。协议版本独立于包版本:ENGINE_PROTOCOL_VERSION = 1(src/protocol/engine-protocol.ts)。不变量:本包禁止 import @zhushanwen/subagent-core(检查 .githooks/check-engine-sdk-boundary.mjs)。src/env.ts 与 src/spawn.ts 是 W12 领地(impl-plan §2.12),本单元仅空骨架占位。tsup entry 逐模块具名登记(§2.1 末行),新增模块必须同步登记。files 不含 src/(对齐 subagent-core 2026-09-16 同型收敛):npm 消费方经 publishConfig 整体替换后全指 dist,TS 源仅服务 workspace(node_modules symlink 直读磁盘源文件,不经 tarball);dist 产物无 sourcemap/sourceMappingURL,移除 src 零断链。已知残留:顶层 main(src/index.ts,workspace 形态载体)被 npm files 规则强制隐含打进 tarball,对 npm 消费者不可达,纯体积噪声。",
59
+ "$comment": "W1 骨架(docs/design/subagent-engine-protocolization.impl-plan.md §2.1)。双形态同 subagent-core 先例(D4):workspace 消费走 import 条件 -> src;npm 消费走 publishConfig -> dist。exports 面 = ./ 与 ./protocol、./server、./journal-replay(exports = semver 契约,收窄不放宽;引擎包 W5/W7 消费经主 barrel;./journal-replay 是 reducer 单源的 deep import 通道——core 持久化层经它引用避免拖 barrel 的 spawn/env/child_process 图,见 journal-replay.ts 头注)。协议版本独立于包版本:ENGINE_PROTOCOL_VERSION = 1(src/protocol/engine-protocol.ts)。不变量:本包禁止 import @zhushanwen/subagent-core(检查 .githooks/check-engine-sdk-boundary.mjs)。src/env.ts 与 src/spawn.ts 是 W12 领地(impl-plan §2.12),本单元仅空骨架占位。tsup entry 逐模块具名登记(§2.1 末行),新增模块必须同步登记。files 不含 src/(对齐 subagent-core 2026-09-16 同型收敛):npm 消费方经 publishConfig 整体替换后全指 dist,TS 源仅服务 workspace(node_modules symlink 直读磁盘源文件,不经 tarball);dist 产物无 sourcemap/sourceMappingURL,移除 src 零断链。已知残留:顶层 main(src/index.ts,workspace 形态载体)被 npm files 规则强制隐含打进 tarball,对 npm 消费者不可达,纯体积噪声。",
49
60
  "files": [
50
61
  "dist/"
51
62
  ],
@@ -61,7 +72,7 @@
61
72
  },
62
73
  "scripts": {
63
74
  "build": "tsup",
64
- "test": "vitest run",
75
+ "test": "vitest run --pool=threads",
65
76
  "typecheck": "tsc --noEmit"
66
77
  }
67
78
  }