@zhushanwen/subagent-engine-sdk 0.8.0 → 0.10.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 (38) hide show
  1. package/dist/{chunk-F7VDVSBZ.js → chunk-CNCFMPEH.js} +1 -1
  2. package/dist/{chunk-MQPASWMA.js → chunk-HSNDUHFH.js} +1 -1
  3. package/dist/{chunk-SFNTX7Q3.js → chunk-JZN76I3S.js} +31 -12
  4. package/dist/{chunk-DIIYVO4O.js → chunk-LM7P7OTA.js} +2 -1
  5. package/dist/{chunk-3WC36CHI.js → chunk-NTOLHLCL.js} +1 -1
  6. package/dist/{contract-types-DqOD58r-.d.cts → contract-types-jSa1g28F.d.cts} +37 -2
  7. package/dist/{contract-types-DqOD58r-.d.ts → contract-types-jSa1g28F.d.ts} +37 -2
  8. package/dist/error-codes-DnFru4L4.d.ts +150 -0
  9. package/dist/error-codes-f-UO4a8D.d.cts +150 -0
  10. package/dist/index.cjs +38 -15
  11. package/dist/index.d.cts +4 -3
  12. package/dist/index.d.ts +4 -3
  13. package/dist/index.js +15 -9
  14. package/dist/journal-io.d.cts +1 -1
  15. package/dist/journal-io.d.ts +1 -1
  16. package/dist/journal-replay.d.cts +1 -1
  17. package/dist/journal-replay.d.ts +1 -1
  18. package/dist/kill-chain.cjs +26 -0
  19. package/dist/kill-chain.d.cts +1 -1
  20. package/dist/kill-chain.d.ts +1 -1
  21. package/dist/kill-chain.js +2 -2
  22. package/dist/{error-codes-CiDwaODz.d.ts → methods-BLxg4ZFr.d.cts} +46 -120
  23. package/dist/{error-codes-C3oVToMr.d.cts → methods-C2zvZqhP.d.ts} +46 -120
  24. package/dist/node-executor.cjs +26 -0
  25. package/dist/node-executor.js +2 -2
  26. package/dist/port-contract.d.cts +11 -1
  27. package/dist/port-contract.d.ts +11 -1
  28. package/dist/protocol/index.cjs +38 -15
  29. package/dist/protocol/index.d.cts +20 -8
  30. package/dist/protocol/index.d.ts +20 -8
  31. package/dist/protocol/index.js +12 -6
  32. package/dist/server/index.cjs +26 -0
  33. package/dist/server/index.d.cts +4 -3
  34. package/dist/server/index.d.ts +4 -3
  35. package/dist/server/index.js +1 -1
  36. package/dist/spawn.cjs +28 -0
  37. package/dist/spawn.js +3 -3
  38. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
- import { b as AgentCallOpts, A as AgentEvent } from '../contract-types-DqOD58r-.cjs';
2
- import { I as InitializeResult, R as RunContextParams, a as InitializeParams, E as EngineSdkError } from '../error-codes-C3oVToMr.cjs';
1
+ import { b as AgentCallOpts, A as AgentEvent } from '../contract-types-jSa1g28F.cjs';
2
+ import { E as EngineSdkError } from '../error-codes-f-UO4a8D.cjs';
3
+ import { I as InitializeResult, R as RunContextParams, b as InitializeParams } from '../methods-BLxg4ZFr.cjs';
3
4
  import { ReverseRequestClock } from '../spawn.cjs';
4
5
  import 'node:child_process';
5
6
  import '../env.cjs';
@@ -83,7 +84,7 @@ interface FrameLoopContext {
83
84
  result?: unknown;
84
85
  error?: unknown;
85
86
  }): void;
86
- /** 正向请求分发(9 方法表;抛出的错误经 `toError` 转错误帧)。 */
87
+ /** 正向请求分发(引擎装配表;抛出的错误经 `toError` 转错误帧)。 */
87
88
  dispatch(id: number, method: string, params: unknown): unknown;
88
89
  /** 错误 → 错误帧载荷(各引擎的恢复指引文案不同,故由引擎注入)。 */
89
90
  toError(err: unknown): ProtocolErrorPayload;
@@ -1,5 +1,6 @@
1
- import { b as AgentCallOpts, A as AgentEvent } from '../contract-types-DqOD58r-.js';
2
- import { I as InitializeResult, R as RunContextParams, a as InitializeParams, E as EngineSdkError } from '../error-codes-CiDwaODz.js';
1
+ import { b as AgentCallOpts, A as AgentEvent } from '../contract-types-jSa1g28F.js';
2
+ import { E as EngineSdkError } from '../error-codes-DnFru4L4.js';
3
+ import { I as InitializeResult, R as RunContextParams, b as InitializeParams } from '../methods-C2zvZqhP.js';
3
4
  import { ReverseRequestClock } from '../spawn.js';
4
5
  import 'node:child_process';
5
6
  import '../env.js';
@@ -83,7 +84,7 @@ interface FrameLoopContext {
83
84
  result?: unknown;
84
85
  error?: unknown;
85
86
  }): void;
86
- /** 正向请求分发(9 方法表;抛出的错误经 `toError` 转错误帧)。 */
87
+ /** 正向请求分发(引擎装配表;抛出的错误经 `toError` 转错误帧)。 */
87
88
  dispatch(id: number, method: string, params: unknown): unknown;
88
89
  /** 错误 → 错误帧载荷(各引擎的恢复指引文案不同,故由引擎注入)。 */
89
90
  toError(err: unknown): ProtocolErrorPayload;
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  ENGINE_PROTOCOL_VERSION,
10
10
  EngineSdkError
11
- } from "../chunk-SFNTX7Q3.js";
11
+ } from "../chunk-JZN76I3S.js";
12
12
  import "../chunk-JSBRDJBE.js";
13
13
 
14
14
  // src/server/index.ts
package/dist/spawn.cjs CHANGED
@@ -98,6 +98,34 @@ function toErrorMessage(e) {
98
98
  return String(e);
99
99
  }
100
100
 
101
+ // src/protocol/error-codes.ts
102
+ var SET_MODEL_ERROR_CODES = [
103
+ /** 目标模型不在当前进程快照(子进程模型快照冻结于 spawn 时刻——模型本身有效,
104
+ * 下一轮 spawn 现取目录即可用;宿主按「写覆盖意图」处置,设计 §7.2 快照型失败行)。 */
105
+ "engine_model_not_in_snapshot",
106
+ /** 凭据校验失败(子进程 set_model checkAuth 抛错——宿主预检通过后 registry 态漂移
107
+ * 的权威兜底;宿主按校验型失败处置,设计 §7.5 凭据行)。 */
108
+ "engine_credential_missing",
109
+ /** 命令已发出(set_model 可能已执行)但读应答 / get_state 回读无回执、生效值未知
110
+ * (非进程退出情形——退出归无活进程路径;宿主按「写覆盖意图 + 错误应答」处置,
111
+ * 设计 §7.5 回读失败行)。 */
112
+ "engine_state_readback_failed"
113
+ ];
114
+ var SET_MODEL_NOT_ACTIVE_CODE = "engine_run_not_active";
115
+ var ENGINE_PROTOCOL_ERROR_CODES = [
116
+ "engine_not_found",
117
+ "engine_protocol_mismatch",
118
+ "engine_capability_unsupported",
119
+ "engine_capability_mismatch",
120
+ "engine_model_unknown",
121
+ "engine_model_mismatch",
122
+ "engine_handshake_timeout",
123
+ "engine_crashed",
124
+ "engine_probe_failed",
125
+ ...SET_MODEL_ERROR_CODES,
126
+ SET_MODEL_NOT_ACTIVE_CODE
127
+ ];
128
+
101
129
  // src/kill-chain.ts
102
130
  var logger = getLogger("subagents");
103
131
  var MS_PER_SECOND = 1e3;
package/dist/spawn.js CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  armEngineSelfDestruct,
6
6
  pumpNdjsonLines,
7
7
  spawnEngineChild
8
- } from "./chunk-MQPASWMA.js";
9
- import "./chunk-F7VDVSBZ.js";
8
+ } from "./chunk-HSNDUHFH.js";
9
+ import "./chunk-CNCFMPEH.js";
10
10
  import "./chunk-PYO3YR7W.js";
11
- import "./chunk-SFNTX7Q3.js";
11
+ import "./chunk-JZN76I3S.js";
12
12
  import "./chunk-NXNNXGTY.js";
13
13
  import "./chunk-JSBRDJBE.js";
14
14
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhushanwen/subagent-engine-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
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",