@zhushanwen/subagent-engine-sdk 0.2.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 (139) hide show
  1. package/dist/best-effort.cjs +88 -0
  2. package/dist/best-effort.d.cts +14 -0
  3. package/dist/best-effort.d.ts +14 -0
  4. package/dist/best-effort.js +8 -0
  5. package/dist/chunk-2DIMPZCQ.js +0 -0
  6. package/dist/chunk-365AUV6N.js +67 -0
  7. package/dist/chunk-3K2P2CM2.js +127 -0
  8. package/dist/chunk-75QEMUGV.js +58 -0
  9. package/dist/chunk-7I4XGL5J.js +95 -0
  10. package/dist/chunk-A75XDJIC.js +227 -0
  11. package/dist/chunk-DSQ7JQKM.js +39 -0
  12. package/dist/chunk-EJMF63R5.js +19 -0
  13. package/dist/chunk-GT6YLLN4.js +46 -0
  14. package/dist/chunk-HYES77BR.js +109 -0
  15. package/dist/chunk-JSBRDJBE.js +30 -0
  16. package/dist/chunk-LEOBWKRM.js +128 -0
  17. package/dist/chunk-N3RL6OVM.js +38 -0
  18. package/dist/chunk-OPMY4G4M.js +27 -0
  19. package/dist/chunk-PPEPBVCC.js +120 -0
  20. package/dist/chunk-PYO3YR7W.js +16 -0
  21. package/dist/chunk-RDH3ZOV6.js +46 -0
  22. package/dist/chunk-RULLX6C6.js +11 -0
  23. package/dist/chunk-X24SFZYW.js +6646 -0
  24. package/dist/chunk-YFSN3D5N.js +216 -0
  25. package/dist/chunk-ZOFFJNJD.js +136 -0
  26. package/dist/chunk-ZXEAW25V.js +132 -0
  27. package/dist/cli-entry.cjs +119 -0
  28. package/dist/cli-entry.d.cts +24 -0
  29. package/dist/cli-entry.d.ts +24 -0
  30. package/dist/cli-entry.js +8 -0
  31. package/dist/contract-types-sSlgppBC.d.cts +352 -0
  32. package/dist/contract-types-sSlgppBC.d.ts +352 -0
  33. package/dist/data-dir.cjs +117 -0
  34. package/dist/data-dir.d.cts +20 -0
  35. package/dist/data-dir.d.ts +20 -0
  36. package/dist/data-dir.js +12 -0
  37. package/dist/env.cjs +205 -0
  38. package/dist/env.d.cts +73 -0
  39. package/dist/env.d.ts +73 -0
  40. package/dist/env.js +16 -0
  41. package/dist/error-codes-DHco5-i_.d.cts +118 -0
  42. package/dist/error-codes-Dhss2Kmk.d.ts +118 -0
  43. package/dist/error-message.cjs +40 -0
  44. package/dist/error-message.d.cts +3 -0
  45. package/dist/error-message.d.ts +3 -0
  46. package/dist/error-message.js +7 -0
  47. package/dist/index.cjs +8375 -0
  48. package/dist/index.d.cts +23 -0
  49. package/dist/index.d.ts +23 -0
  50. package/dist/index.js +268 -0
  51. package/dist/journal-io.cjs +70 -0
  52. package/dist/journal-io.d.cts +12 -0
  53. package/dist/journal-io.d.ts +12 -0
  54. package/dist/journal-io.js +7 -0
  55. package/dist/journal-replay.cjs +256 -0
  56. package/dist/journal-replay.d.cts +45 -0
  57. package/dist/journal-replay.d.ts +45 -0
  58. package/dist/journal-replay.js +17 -0
  59. package/dist/kill-chain.cjs +221 -0
  60. package/dist/kill-chain.d.cts +74 -0
  61. package/dist/kill-chain.d.ts +74 -0
  62. package/dist/kill-chain.js +23 -0
  63. package/dist/logger.cjs +84 -0
  64. package/dist/logger.d.cts +24 -0
  65. package/dist/logger.d.ts +24 -0
  66. package/dist/logger.js +11 -0
  67. package/dist/logs/stderr-rotation.cjs +151 -0
  68. package/dist/logs/stderr-rotation.d.cts +37 -0
  69. package/dist/logs/stderr-rotation.d.ts +37 -0
  70. package/dist/logs/stderr-rotation.js +23 -0
  71. package/dist/nesting-guard.cjs +95 -0
  72. package/dist/nesting-guard.d.cts +65 -0
  73. package/dist/nesting-guard.d.ts +65 -0
  74. package/dist/nesting-guard.js +15 -0
  75. package/dist/node-executor.cjs +180 -0
  76. package/dist/node-executor.d.cts +63 -0
  77. package/dist/node-executor.d.ts +63 -0
  78. package/dist/node-executor.js +16 -0
  79. package/dist/paths.cjs +55 -0
  80. package/dist/paths.d.cts +8 -0
  81. package/dist/paths.d.ts +8 -0
  82. package/dist/paths.js +15 -0
  83. package/dist/port-contract.cjs +35 -0
  84. package/dist/port-contract.d.cts +88 -0
  85. package/dist/port-contract.d.ts +88 -0
  86. package/dist/port-contract.js +7 -0
  87. package/dist/protocol/index.cjs +400 -0
  88. package/dist/protocol/index.d.cts +685 -0
  89. package/dist/protocol/index.d.ts +685 -0
  90. package/dist/protocol/index.js +89 -0
  91. package/dist/relay-env.cjs +71 -0
  92. package/dist/relay-env.d.cts +37 -0
  93. package/dist/relay-env.d.ts +37 -0
  94. package/dist/relay-env.js +23 -0
  95. package/dist/schema-emulation.cjs +6680 -0
  96. package/dist/schema-emulation.d.cts +39 -0
  97. package/dist/schema-emulation.d.ts +39 -0
  98. package/dist/schema-emulation.js +11 -0
  99. package/dist/spawn.cjs +200 -0
  100. package/dist/spawn.d.cts +80 -0
  101. package/dist/spawn.d.ts +80 -0
  102. package/dist/spawn.js +16 -0
  103. package/dist/ui-channels.cjs +120 -0
  104. package/dist/ui-channels.d.cts +60 -0
  105. package/dist/ui-channels.d.ts +60 -0
  106. package/dist/ui-channels.js +9 -0
  107. package/dist/ui-types.cjs +18 -0
  108. package/dist/ui-types.d.cts +62 -0
  109. package/dist/ui-types.d.ts +62 -0
  110. package/dist/ui-types.js +1 -0
  111. package/package.json +58 -0
  112. package/src/best-effort.ts +37 -0
  113. package/src/cli-entry.ts +77 -0
  114. package/src/data-dir.ts +88 -0
  115. package/src/env.ts +265 -0
  116. package/src/error-message.ts +22 -0
  117. package/src/index.ts +63 -0
  118. package/src/journal-io.ts +82 -0
  119. package/src/journal-replay.ts +432 -0
  120. package/src/kill-chain.ts +265 -0
  121. package/src/logger.ts +105 -0
  122. package/src/logs/stderr-rotation.ts +166 -0
  123. package/src/nesting-guard.ts +140 -0
  124. package/src/node-executor.ts +272 -0
  125. package/src/paths.ts +48 -0
  126. package/src/port-contract.ts +117 -0
  127. package/src/protocol/contract-types.ts +378 -0
  128. package/src/protocol/engine-protocol.ts +81 -0
  129. package/src/protocol/error-codes.ts +179 -0
  130. package/src/protocol/frames.ts +145 -0
  131. package/src/protocol/index.ts +12 -0
  132. package/src/protocol/methods.ts +229 -0
  133. package/src/protocol/reverse-channels.ts +274 -0
  134. package/src/protocol/schema.ts +154 -0
  135. package/src/relay-env.ts +60 -0
  136. package/src/schema-emulation.ts +192 -0
  137. package/src/spawn.ts +246 -0
  138. package/src/ui-channels.ts +219 -0
  139. package/src/ui-types.ts +84 -0
package/dist/env.cjs ADDED
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/env.ts
21
+ var env_exports = {};
22
+ __export(env_exports, {
23
+ ENGINE_ENV_DENY_LIST: () => ENGINE_ENV_DENY_LIST,
24
+ ENGINE_ENV_L0_INFRA_KEYS: () => ENGINE_ENV_L0_INFRA_KEYS,
25
+ ENGINE_ENV_PREFIXES: () => ENGINE_ENV_PREFIXES,
26
+ buildEngineChildEnv: () => buildEngineChildEnv,
27
+ buildOutboundChildEnv: () => buildOutboundChildEnv
28
+ });
29
+ module.exports = __toCommonJS(env_exports);
30
+
31
+ // src/logger.ts
32
+ var SINK_SLOT_KEY = /* @__PURE__ */ Symbol.for("@zhushanwen/subagent-engine-sdk.logger-sink");
33
+ function getSinkSlot() {
34
+ let slot = Reflect.get(globalThis, SINK_SLOT_KEY);
35
+ if (!slot) {
36
+ slot = { current: void 0 };
37
+ Reflect.set(globalThis, SINK_SLOT_KEY, slot);
38
+ }
39
+ return slot;
40
+ }
41
+ var CONSOLE_SINK = {
42
+ log(level, component, message, data) {
43
+ const line = `[${component}] ${message}`;
44
+ if (level === "error") {
45
+ if (data === void 0) console.error(line);
46
+ else console.error(line, data);
47
+ return;
48
+ }
49
+ if (level === "warn") {
50
+ if (data === void 0) console.warn(line);
51
+ else console.warn(line, data);
52
+ return;
53
+ }
54
+ }
55
+ };
56
+ function currentSink() {
57
+ return getSinkSlot().current ?? CONSOLE_SINK;
58
+ }
59
+ var facadeCache = /* @__PURE__ */ new Map();
60
+ function getLogger(component) {
61
+ const existing = facadeCache.get(component);
62
+ if (existing) return existing;
63
+ const facade = {
64
+ debug(msg, data) {
65
+ currentSink().log("debug", component, msg, data);
66
+ },
67
+ warn(msg, data) {
68
+ currentSink().log("warn", component, msg, data);
69
+ },
70
+ error(msg, data) {
71
+ currentSink().log("error", component, msg, data);
72
+ }
73
+ };
74
+ facadeCache.set(component, facade);
75
+ return facade;
76
+ }
77
+
78
+ // src/env.ts
79
+ var logger = getLogger("engine-sdk/env");
80
+ var ENGINE_ENV_PREFIXES = [
81
+ "XYZ_",
82
+ "XYZ_AGENT_",
83
+ "XYZ_SUBAGENT_"
84
+ ];
85
+ var ENGINE_ENV_DENY_LIST = [
86
+ "XYZ_AGENT_PACKAGED",
87
+ "XYZ_RUNTIME_TOKEN",
88
+ "XYZ_AGENT_API_KEY",
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"
94
+ ];
95
+ var ENGINE_ENV_L0_INFRA_KEYS = [
96
+ "XYZ_AGENT_DATA_DIR",
97
+ "XYZ_AGENT_ENGINE_NODE",
98
+ "ELECTRON_RUN_AS_NODE",
99
+ "XYZ_AGENT_SUBAGENT",
100
+ "XYZ_SUBAGENT_RELAY_SOCKET",
101
+ "XYZ_SUBAGENT_RELAY_NODE",
102
+ "XYZ_SUBAGENT_RELAY_SCRIPT"
103
+ ];
104
+ var ENV_PREFIX_SHAPE_RE = /^[A-Za-z0-9_]+$/;
105
+ function deleteEnvKeysCaseInsensitive(env, names) {
106
+ const lowered = new Set(names.map((n) => n.toLowerCase()));
107
+ for (const key of Object.keys(env)) {
108
+ if (lowered.has(key.toLowerCase())) delete env[key];
109
+ }
110
+ }
111
+ function compileManifestPrefixes(prefixes) {
112
+ const compiled = [];
113
+ for (const raw of prefixes) {
114
+ if (!ENV_PREFIX_SHAPE_RE.test(raw)) {
115
+ logger.warn(
116
+ `envPrefixes entry dropped (invalid shape, expected ^[A-Za-z0-9_]+$): ${JSON.stringify(raw)}`
117
+ );
118
+ continue;
119
+ }
120
+ const lowered = raw.toLowerCase();
121
+ if (ENGINE_ENV_PREFIXES.some((reserved) => lowered.startsWith(reserved.toLowerCase()))) {
122
+ logger.warn(
123
+ `envPrefixes entry dropped (reserved prefix, infra keys are L0-only): ${JSON.stringify(raw)}`
124
+ );
125
+ continue;
126
+ }
127
+ compiled.push(lowered);
128
+ }
129
+ return compiled.length > 0 ? compiled : null;
130
+ }
131
+ function applyManifestAllowlist(env, opts) {
132
+ if (opts.processEnv !== void 0 && opts.envPrefixes !== void 0) {
133
+ const compiled = compileManifestPrefixes(opts.envPrefixes);
134
+ if (compiled !== null) {
135
+ for (const [key, value] of Object.entries(opts.processEnv)) {
136
+ if (value === void 0) continue;
137
+ const loweredKey = key.toLowerCase();
138
+ if (compiled.some((prefix) => loweredKey.startsWith(prefix))) {
139
+ env[key] = value;
140
+ } else {
141
+ logger.warn(`processEnv key not allowed (no declared envPrefix matches): ${key}`);
142
+ }
143
+ }
144
+ }
145
+ } else if (opts.processEnv !== void 0) {
146
+ for (const key of Object.keys(opts.processEnv)) {
147
+ logger.warn(`processEnv key not allowed (manifest declares no envPrefixes): ${key}`);
148
+ }
149
+ }
150
+ }
151
+ function injectL0InfraKeys(env, opts) {
152
+ env.XYZ_AGENT_DATA_DIR = opts.dataDir;
153
+ if (opts.engineNode !== void 0) env.XYZ_AGENT_ENGINE_NODE = opts.engineNode;
154
+ if (opts.electronRunAsNode === true) env.ELECTRON_RUN_AS_NODE = "1";
155
+ env.XYZ_AGENT_SUBAGENT = "1";
156
+ if (opts.relay !== void 0) {
157
+ env.XYZ_SUBAGENT_RELAY_SOCKET = opts.relay.socket;
158
+ env.XYZ_SUBAGENT_RELAY_NODE = opts.relay.node;
159
+ env.XYZ_SUBAGENT_RELAY_SCRIPT = opts.relay.script;
160
+ }
161
+ if (opts.identityEnv !== void 0) {
162
+ for (const [key, value] of Object.entries(opts.identityEnv)) {
163
+ if (value !== void 0) env[key] = value;
164
+ }
165
+ }
166
+ }
167
+ function buildEngineChildEnv(baseEnv, opts) {
168
+ const env = {};
169
+ for (const [key, value] of Object.entries(baseEnv)) {
170
+ if (value !== void 0) env[key] = value;
171
+ }
172
+ deleteEnvKeysCaseInsensitive(env, ENGINE_ENV_DENY_LIST);
173
+ applyManifestAllowlist(env, opts);
174
+ deleteEnvKeysCaseInsensitive(env, ENGINE_ENV_DENY_LIST);
175
+ injectL0InfraKeys(env, opts);
176
+ return env;
177
+ }
178
+ function buildOutboundChildEnv(opts) {
179
+ const out = {};
180
+ const loweredPrefixes = opts.prefixes !== void 0 ? opts.prefixes.map((p) => p.toLowerCase()) : null;
181
+ for (const [key, value] of Object.entries(opts.parentEnv)) {
182
+ if (value === void 0) continue;
183
+ if (loweredPrefixes !== null) {
184
+ const loweredKey = key.toLowerCase();
185
+ if (!loweredPrefixes.some((prefix) => loweredKey.startsWith(prefix))) continue;
186
+ }
187
+ out[key] = value;
188
+ }
189
+ if (opts.extras !== void 0) {
190
+ for (const [key, value] of Object.entries(opts.extras)) {
191
+ if (value !== void 0) out[key] = value;
192
+ else delete out[key];
193
+ }
194
+ }
195
+ deleteEnvKeysCaseInsensitive(out, ENGINE_ENV_DENY_LIST);
196
+ return out;
197
+ }
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ ENGINE_ENV_DENY_LIST,
201
+ ENGINE_ENV_L0_INFRA_KEYS,
202
+ ENGINE_ENV_PREFIXES,
203
+ buildEngineChildEnv,
204
+ buildOutboundChildEnv
205
+ });
package/dist/env.d.cts ADDED
@@ -0,0 +1,73 @@
1
+ /** L2 manifest 放行的保留前缀拒绝表(镜像 shared SSOT,勿单独改动)。 */
2
+ declare const ENGINE_ENV_PREFIXES: readonly string[];
3
+ /** L1 deny + 显式剥除键集(镜像 shared SSOT,勿单独改动)。 */
4
+ declare const ENGINE_ENV_DENY_LIST: readonly string[];
5
+ /** L0 注入的全部基础设施键(守卫断言:与 ENGINE_ENV_DENY_LIST 交集 = ∅)。 */
6
+ declare const ENGINE_ENV_L0_INFRA_KEYS: readonly string[];
7
+ /** relay 三键形态(宿主 relay 激活时三值同时非空,全有或全无)。 */
8
+ interface EngineRelayEnv {
9
+ socket: string;
10
+ node: string;
11
+ script: string;
12
+ }
13
+ /** buildEngineChildEnv 入参。 */
14
+ interface EngineChildEnvOptions {
15
+ /** L0:引擎数据根(隔离库/池/journal 都相对它推导;缺 env 且无注入引擎侧须显式报错) */
16
+ dataDir: string;
17
+ /** L0:执行器路径(descriptor command 的执行体;Electron 二进制时另置 electronRunAsNode) */
18
+ engineNode?: string;
19
+ /** L0:执行器为 Electron 二进制 → 注入 ELECTRON_RUN_AS_NODE=1 */
20
+ electronRunAsNode?: boolean;
21
+ /** L0:relay 三键(宿主 relay 激活时传;三键必经 L0——L1 拒绝 XYZ_SUBAGENT_ 前缀、L2 是 manifest 面,两层都到不了) */
22
+ relay?: EngineRelayEnv;
23
+ /** L0:引擎侧身份 env(PI_SUBAGENT_ROOT_SESSION_ID 等,base-tool-enhance / 递归可见性消费) */
24
+ identityEnv?: Record<string, string | undefined>;
25
+ /** L2:manifest 声明的 envPrefixes 放行清单(保留前缀拒绝 + 形态校验) */
26
+ envPrefixes?: readonly string[];
27
+ /** L2:引擎私有 env 候选(descriptor processEnv;未声明前缀不放行 + warn) */
28
+ processEnv?: Record<string, string | undefined>;
29
+ }
30
+ /**
31
+ * `buildEngineChildEnv(baseEnv, opts)`:引擎子进程 env 三层契约(高者覆盖低者)。
32
+ *
33
+ * 写死次序 = 先过滤(L1 deny/剥除 → L2 manifest 放行)后 L0 显式注入——
34
+ * 「core 过滤之后显式注入」即此语义:baseEnv 是调用方(core/宿主)已过滤的基座,
35
+ * L0 键在最后写入故不受 L1 剥除影响(交集为 ∅ 由测试断言兜底)。
36
+ *
37
+ * 层规格(impl-plan §2.12 三层表):
38
+ * - L0 基础设施键:XYZ_AGENT_DATA_DIR / XYZ_AGENT_ENGINE_NODE / ELECTRON_RUN_AS_NODE
39
+ * (条件)/ XYZ_AGENT_SUBAGENT=1 / relay 三键 / identityEnv(injectL0InfraKeys);
40
+ * - L1 deny + 显式剥除(恒高于 manifest 放行):ENGINE_ENV_DENY_LIST
41
+ * (deny 两键 + 凭证键 + 父身份键 + 防御性剥除三死名);
42
+ * - L2 manifest 放行:envPrefixes 声明前缀的 processEnv 键(保留前缀拒绝、
43
+ * 形态校验、未声明前缀不放行 + warn)(applyManifestAllowlist)。
44
+ *
45
+ * 红线:纯函数,不读写 process.env 本体,不 mutate 入参。
46
+ */
47
+ declare function buildEngineChildEnv(baseEnv: Record<string, string | undefined>, opts: EngineChildEnvOptions): Record<string, string>;
48
+ /** buildOutboundChildEnv 入参(SDK 版;语义见函数头注释)。 */
49
+ interface BuildOutboundChildEnvOptions {
50
+ /** 父进程 env 快照(调用方显式注入;本函数绝不改写它) */
51
+ parentEnv: Record<string, string | undefined>;
52
+ /** 强制注入/覆盖的键;值为 undefined 时执行删除语义 */
53
+ extras?: Record<string, string | undefined>;
54
+ /** 基座前缀白名单;缺省 = 全量继承父 env(与 shared 版的差异,见函数头注释) */
55
+ prefixes?: readonly string[];
56
+ }
57
+ /**
58
+ * 通用子进程出站 env 构建器(deny 剥离终态),供非引擎 spawn 面(worktree git
59
+ * execFile 等)复用——R3 MF-C:deny 键不进 git 子进程,git hooks 等后代不再可能
60
+ * 消费生命周期标志 / WS 令牌。
61
+ *
62
+ * 与 @xyz-agent/shared 版 buildOutboundChildEnv 的刻意差异:**缺省不做白名单过滤**
63
+ * (prefixes 省略 = 全量继承父 env + deny 剥除)。理由:SDK 消费面(zsw 宿主 /
64
+ * 引擎 CLI)不可 import shared 的 ENV_WHITELIST_PREFIXES;引擎 spawn 的基座由
65
+ * 调用方先经 buildEngineChildEnv 组装(其 baseEnv 已是 core 过滤后的),而
66
+ * ambient 场景(git 需要 GIT_* / proxy / ssh 等)必须保留继承面——deny-by-default
67
+ * 兜底语义与 shared 版一致。需要白名单形态时调用方显式传 prefixes。
68
+ *
69
+ * 红线:纯函数,不读写 process.env 本体,不 mutate 入参。
70
+ */
71
+ declare function buildOutboundChildEnv(opts: BuildOutboundChildEnvOptions): Record<string, string>;
72
+
73
+ export { type BuildOutboundChildEnvOptions, ENGINE_ENV_DENY_LIST, ENGINE_ENV_L0_INFRA_KEYS, ENGINE_ENV_PREFIXES, type EngineChildEnvOptions, type EngineRelayEnv, buildEngineChildEnv, buildOutboundChildEnv };
package/dist/env.d.ts ADDED
@@ -0,0 +1,73 @@
1
+ /** L2 manifest 放行的保留前缀拒绝表(镜像 shared SSOT,勿单独改动)。 */
2
+ declare const ENGINE_ENV_PREFIXES: readonly string[];
3
+ /** L1 deny + 显式剥除键集(镜像 shared SSOT,勿单独改动)。 */
4
+ declare const ENGINE_ENV_DENY_LIST: readonly string[];
5
+ /** L0 注入的全部基础设施键(守卫断言:与 ENGINE_ENV_DENY_LIST 交集 = ∅)。 */
6
+ declare const ENGINE_ENV_L0_INFRA_KEYS: readonly string[];
7
+ /** relay 三键形态(宿主 relay 激活时三值同时非空,全有或全无)。 */
8
+ interface EngineRelayEnv {
9
+ socket: string;
10
+ node: string;
11
+ script: string;
12
+ }
13
+ /** buildEngineChildEnv 入参。 */
14
+ interface EngineChildEnvOptions {
15
+ /** L0:引擎数据根(隔离库/池/journal 都相对它推导;缺 env 且无注入引擎侧须显式报错) */
16
+ dataDir: string;
17
+ /** L0:执行器路径(descriptor command 的执行体;Electron 二进制时另置 electronRunAsNode) */
18
+ engineNode?: string;
19
+ /** L0:执行器为 Electron 二进制 → 注入 ELECTRON_RUN_AS_NODE=1 */
20
+ electronRunAsNode?: boolean;
21
+ /** L0:relay 三键(宿主 relay 激活时传;三键必经 L0——L1 拒绝 XYZ_SUBAGENT_ 前缀、L2 是 manifest 面,两层都到不了) */
22
+ relay?: EngineRelayEnv;
23
+ /** L0:引擎侧身份 env(PI_SUBAGENT_ROOT_SESSION_ID 等,base-tool-enhance / 递归可见性消费) */
24
+ identityEnv?: Record<string, string | undefined>;
25
+ /** L2:manifest 声明的 envPrefixes 放行清单(保留前缀拒绝 + 形态校验) */
26
+ envPrefixes?: readonly string[];
27
+ /** L2:引擎私有 env 候选(descriptor processEnv;未声明前缀不放行 + warn) */
28
+ processEnv?: Record<string, string | undefined>;
29
+ }
30
+ /**
31
+ * `buildEngineChildEnv(baseEnv, opts)`:引擎子进程 env 三层契约(高者覆盖低者)。
32
+ *
33
+ * 写死次序 = 先过滤(L1 deny/剥除 → L2 manifest 放行)后 L0 显式注入——
34
+ * 「core 过滤之后显式注入」即此语义:baseEnv 是调用方(core/宿主)已过滤的基座,
35
+ * L0 键在最后写入故不受 L1 剥除影响(交集为 ∅ 由测试断言兜底)。
36
+ *
37
+ * 层规格(impl-plan §2.12 三层表):
38
+ * - L0 基础设施键:XYZ_AGENT_DATA_DIR / XYZ_AGENT_ENGINE_NODE / ELECTRON_RUN_AS_NODE
39
+ * (条件)/ XYZ_AGENT_SUBAGENT=1 / relay 三键 / identityEnv(injectL0InfraKeys);
40
+ * - L1 deny + 显式剥除(恒高于 manifest 放行):ENGINE_ENV_DENY_LIST
41
+ * (deny 两键 + 凭证键 + 父身份键 + 防御性剥除三死名);
42
+ * - L2 manifest 放行:envPrefixes 声明前缀的 processEnv 键(保留前缀拒绝、
43
+ * 形态校验、未声明前缀不放行 + warn)(applyManifestAllowlist)。
44
+ *
45
+ * 红线:纯函数,不读写 process.env 本体,不 mutate 入参。
46
+ */
47
+ declare function buildEngineChildEnv(baseEnv: Record<string, string | undefined>, opts: EngineChildEnvOptions): Record<string, string>;
48
+ /** buildOutboundChildEnv 入参(SDK 版;语义见函数头注释)。 */
49
+ interface BuildOutboundChildEnvOptions {
50
+ /** 父进程 env 快照(调用方显式注入;本函数绝不改写它) */
51
+ parentEnv: Record<string, string | undefined>;
52
+ /** 强制注入/覆盖的键;值为 undefined 时执行删除语义 */
53
+ extras?: Record<string, string | undefined>;
54
+ /** 基座前缀白名单;缺省 = 全量继承父 env(与 shared 版的差异,见函数头注释) */
55
+ prefixes?: readonly string[];
56
+ }
57
+ /**
58
+ * 通用子进程出站 env 构建器(deny 剥离终态),供非引擎 spawn 面(worktree git
59
+ * execFile 等)复用——R3 MF-C:deny 键不进 git 子进程,git hooks 等后代不再可能
60
+ * 消费生命周期标志 / WS 令牌。
61
+ *
62
+ * 与 @xyz-agent/shared 版 buildOutboundChildEnv 的刻意差异:**缺省不做白名单过滤**
63
+ * (prefixes 省略 = 全量继承父 env + deny 剥除)。理由:SDK 消费面(zsw 宿主 /
64
+ * 引擎 CLI)不可 import shared 的 ENV_WHITELIST_PREFIXES;引擎 spawn 的基座由
65
+ * 调用方先经 buildEngineChildEnv 组装(其 baseEnv 已是 core 过滤后的),而
66
+ * ambient 场景(git 需要 GIT_* / proxy / ssh 等)必须保留继承面——deny-by-default
67
+ * 兜底语义与 shared 版一致。需要白名单形态时调用方显式传 prefixes。
68
+ *
69
+ * 红线:纯函数,不读写 process.env 本体,不 mutate 入参。
70
+ */
71
+ declare function buildOutboundChildEnv(opts: BuildOutboundChildEnvOptions): Record<string, string>;
72
+
73
+ export { type BuildOutboundChildEnvOptions, ENGINE_ENV_DENY_LIST, ENGINE_ENV_L0_INFRA_KEYS, ENGINE_ENV_PREFIXES, type EngineChildEnvOptions, type EngineRelayEnv, buildEngineChildEnv, buildOutboundChildEnv };
package/dist/env.js ADDED
@@ -0,0 +1,16 @@
1
+ import {
2
+ ENGINE_ENV_DENY_LIST,
3
+ ENGINE_ENV_L0_INFRA_KEYS,
4
+ ENGINE_ENV_PREFIXES,
5
+ buildEngineChildEnv,
6
+ buildOutboundChildEnv
7
+ } from "./chunk-ZXEAW25V.js";
8
+ import "./chunk-75QEMUGV.js";
9
+ import "./chunk-JSBRDJBE.js";
10
+ export {
11
+ ENGINE_ENV_DENY_LIST,
12
+ ENGINE_ENV_L0_INFRA_KEYS,
13
+ ENGINE_ENV_PREFIXES,
14
+ buildEngineChildEnv,
15
+ buildOutboundChildEnv
16
+ };
@@ -0,0 +1,118 @@
1
+ import { a as AgentEvent, E as EngineCapabilities } from './contract-types-sSlgppBC.cjs';
2
+
3
+ /** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
4
+ interface ProtocolError {
5
+ /** 错误码(error-codes.ts 词表 + 其余 engine_* 引擎自报透传)。 */
6
+ code: string;
7
+ /** 人类可读详情。 */
8
+ message: string;
9
+ /** 恢复指引:指向具体下一步(命令 / 配置路径 / 升级动作),非安慰性文案。 */
10
+ recovery: string;
11
+ /** 结构化附参(如 engine_protocol_mismatch 的双方版本)。 */
12
+ data?: Record<string, unknown>;
13
+ }
14
+ interface RequestFrame {
15
+ id: number;
16
+ method: string;
17
+ params: unknown;
18
+ }
19
+ interface SuccessResponseFrame {
20
+ id: number | string;
21
+ result: unknown;
22
+ }
23
+ interface ErrorResponseFrame {
24
+ id: number | string;
25
+ error: ProtocolError;
26
+ }
27
+ type ResponseFrame = SuccessResponseFrame | ErrorResponseFrame;
28
+ /** event 通知载荷:runId 关联在途 run;seq 单调递增(基线①结构等价断言对象)。 */
29
+ interface EventNotificationParams {
30
+ runId: string;
31
+ seq: number;
32
+ event: AgentEvent;
33
+ }
34
+ interface NotificationFrame {
35
+ method: "event";
36
+ params: EventNotificationParams;
37
+ }
38
+ interface ReverseRequestFrame {
39
+ id: string;
40
+ method: string;
41
+ params: unknown;
42
+ }
43
+ /** 反向请求的应答(core → 引擎,沿 ResponseFrame 通道回传;id = 反向请求 id 原样)。 */
44
+ type ReverseResponseResult =
45
+ /** 数据面类:处理确认。 */
46
+ {
47
+ ok: true;
48
+ }
49
+ /** 人机交互类(askUser/permission)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
50
+ | {
51
+ ack: true;
52
+ }
53
+ /** 未实现的交互能力(设计:未实现回 unsupported,引擎自行降级)。 */
54
+ | {
55
+ unsupported: true;
56
+ };
57
+ type AnyFrame = RequestFrame | ResponseFrame | NotificationFrame | ReverseRequestFrame;
58
+ /** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
59
+ declare function isRequestFrame(frame: unknown): frame is RequestFrame;
60
+ /** ② 应答:有 id(number|string)且 result/error 二选一。 */
61
+ declare function isResponseFrame(frame: unknown): frame is ResponseFrame;
62
+ /** ③ 通知:无 id,method === "event",params 含 runId/seq/event。 */
63
+ declare function isNotificationFrame(frame: unknown): frame is NotificationFrame;
64
+ /** ④ 反向请求:有字符串 id + host/* method + params(与①的区别 = id 形态与 method 前缀)。 */
65
+ declare function isReverseRequestFrame(frame: unknown): frame is ReverseRequestFrame;
66
+
67
+ /** 协议核心错误码(引擎 error 帧 + core 同步拦截共用的固定词表)。 */
68
+ declare const ENGINE_PROTOCOL_ERROR_CODES: readonly ["engine_not_found", "engine_protocol_mismatch", "engine_capability_unsupported", "engine_capability_mismatch", "engine_model_unknown", "engine_model_mismatch", "engine_handshake_timeout", "engine_crashed", "engine_probe_failed"];
69
+ type EngineProtocolErrorCode = (typeof ENGINE_PROTOCOL_ERROR_CODES)[number];
70
+ /** unknown → 协议错误码收窄(外部输入携带错误码时的运行时 guard;其余 engine_* 走透传)。 */
71
+ declare function isEngineProtocolErrorCode(value: unknown): value is EngineProtocolErrorCode;
72
+ /** 其余引擎自报错误码的前缀契约(透传面;core 不解释文案)。 */
73
+ declare const ENGINE_ERROR_CODE_PREFIX = "engine_";
74
+ declare function isEngineErrorPassthroughCode(value: string): boolean;
75
+
76
+ /**
77
+ * 结构化引擎错误(message 恒为 `<code>: <detail>` 前缀格式——AgentOutcome.error 与
78
+ * 协议 error 帧共用的错误码前缀约定);recovery 指向恢复动作。
79
+ * toStructured() 产出即协议 ProtocolError 形态(error 帧载荷直用)。
80
+ */
81
+ declare class EngineSdkError extends Error {
82
+ readonly code: string;
83
+ readonly recovery: string;
84
+ readonly data?: Record<string, unknown>;
85
+ constructor(code: string, detail: string, recovery: string, data?: Record<string, unknown>);
86
+ /** 协议 error 帧载荷投影。 */
87
+ toStructured(): ProtocolError;
88
+ }
89
+ declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
90
+ /**
91
+ * [v1.x] chat 会话形态的 gate 拒绝具名错误(chat-domain 设计 §3.2 D1-A +
92
+ * 验收 A6:manifest 无 conversation gate 位的引擎收到 chat 请求 → 同步拒)。
93
+ * 文案契约对齐 core capability-gate.ts conversation 分支(错误码
94
+ * engine_capability_unsupported + 「去掉参数 / 修 manifest / 升级引擎包」恢复指引)
95
+ * ——W3 chat 路由切协议客户端时以本构造器替换 core 内联文案,保持两侧一致。
96
+ */
97
+ declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
98
+ /**
99
+ * [v1.x] chat 会话形态(run.params.chat / task.conversation=true)派发前的同步 gate:
100
+ * manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError——
101
+ * 进程/record 创建前同步拒(A6:run 域不受影响,仅 chat 面被拦)。
102
+ * 判据单源:core 侧 capability-gate.assertTaskShapeSupported 的 conversation 分支
103
+ * 覆盖同一能力位,协议客户端路径(W3 接线)消费本函数,防两处判据漂移。
104
+ */
105
+ declare function assertChatConversationSupported(engineId: string, capabilities: Pick<EngineCapabilities, "conversation">): void;
106
+ /** stdout 尾部回显上限(engine_timeout / engine_run_failed 的错误规格载体系数)。 */
107
+ declare const STDOUT_TAIL_ECHO_CHARS = 2000;
108
+ /** engine_timeout 的恢复指引(kill-chain 超时杀链收尾文案)。 */
109
+ declare const ENGINE_TIMEOUT_RECOVERY: string;
110
+ /**
111
+ * engine_timeout 的 outcome.error 文案:含 stdout 尾部 2000 字 + 恢复指引
112
+ * (kill-chain synthesizeTimeoutOutcome 消费;与 core errors.ts engineTimeoutDetail 逐字等价)。
113
+ */
114
+ declare function engineTimeoutDetail(stdoutTail: string): string;
115
+ /** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
116
+ declare function schemaEmulationFailedDetail(error: string, tail: string): string;
117
+
118
+ export { type AnyFrame as A, ENGINE_ERROR_CODE_PREFIX as E, type NotificationFrame as N, type ProtocolError as P, type RequestFrame as R, STDOUT_TAIL_ECHO_CHARS as S, ENGINE_PROTOCOL_ERROR_CODES as a, ENGINE_TIMEOUT_RECOVERY as b, type EngineProtocolErrorCode as c, EngineSdkError as d, type ErrorResponseFrame as e, type EventNotificationParams as f, type ResponseFrame as g, type ReverseRequestFrame as h, type ReverseResponseResult as i, type SuccessResponseFrame as j, assertChatConversationSupported as k, engineConversationUnsupportedError as l, engineProtocolMismatchError as m, engineTimeoutDetail as n, isEngineErrorPassthroughCode as o, isEngineProtocolErrorCode as p, isNotificationFrame as q, isRequestFrame as r, isResponseFrame as s, isReverseRequestFrame as t, schemaEmulationFailedDetail as u };
@@ -0,0 +1,118 @@
1
+ import { a as AgentEvent, E as EngineCapabilities } from './contract-types-sSlgppBC.js';
2
+
3
+ /** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
4
+ interface ProtocolError {
5
+ /** 错误码(error-codes.ts 词表 + 其余 engine_* 引擎自报透传)。 */
6
+ code: string;
7
+ /** 人类可读详情。 */
8
+ message: string;
9
+ /** 恢复指引:指向具体下一步(命令 / 配置路径 / 升级动作),非安慰性文案。 */
10
+ recovery: string;
11
+ /** 结构化附参(如 engine_protocol_mismatch 的双方版本)。 */
12
+ data?: Record<string, unknown>;
13
+ }
14
+ interface RequestFrame {
15
+ id: number;
16
+ method: string;
17
+ params: unknown;
18
+ }
19
+ interface SuccessResponseFrame {
20
+ id: number | string;
21
+ result: unknown;
22
+ }
23
+ interface ErrorResponseFrame {
24
+ id: number | string;
25
+ error: ProtocolError;
26
+ }
27
+ type ResponseFrame = SuccessResponseFrame | ErrorResponseFrame;
28
+ /** event 通知载荷:runId 关联在途 run;seq 单调递增(基线①结构等价断言对象)。 */
29
+ interface EventNotificationParams {
30
+ runId: string;
31
+ seq: number;
32
+ event: AgentEvent;
33
+ }
34
+ interface NotificationFrame {
35
+ method: "event";
36
+ params: EventNotificationParams;
37
+ }
38
+ interface ReverseRequestFrame {
39
+ id: string;
40
+ method: string;
41
+ params: unknown;
42
+ }
43
+ /** 反向请求的应答(core → 引擎,沿 ResponseFrame 通道回传;id = 反向请求 id 原样)。 */
44
+ type ReverseResponseResult =
45
+ /** 数据面类:处理确认。 */
46
+ {
47
+ ok: true;
48
+ }
49
+ /** 人机交互类(askUser/permission)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
50
+ | {
51
+ ack: true;
52
+ }
53
+ /** 未实现的交互能力(设计:未实现回 unsupported,引擎自行降级)。 */
54
+ | {
55
+ unsupported: true;
56
+ };
57
+ type AnyFrame = RequestFrame | ResponseFrame | NotificationFrame | ReverseRequestFrame;
58
+ /** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
59
+ declare function isRequestFrame(frame: unknown): frame is RequestFrame;
60
+ /** ② 应答:有 id(number|string)且 result/error 二选一。 */
61
+ declare function isResponseFrame(frame: unknown): frame is ResponseFrame;
62
+ /** ③ 通知:无 id,method === "event",params 含 runId/seq/event。 */
63
+ declare function isNotificationFrame(frame: unknown): frame is NotificationFrame;
64
+ /** ④ 反向请求:有字符串 id + host/* method + params(与①的区别 = id 形态与 method 前缀)。 */
65
+ declare function isReverseRequestFrame(frame: unknown): frame is ReverseRequestFrame;
66
+
67
+ /** 协议核心错误码(引擎 error 帧 + core 同步拦截共用的固定词表)。 */
68
+ declare const ENGINE_PROTOCOL_ERROR_CODES: readonly ["engine_not_found", "engine_protocol_mismatch", "engine_capability_unsupported", "engine_capability_mismatch", "engine_model_unknown", "engine_model_mismatch", "engine_handshake_timeout", "engine_crashed", "engine_probe_failed"];
69
+ type EngineProtocolErrorCode = (typeof ENGINE_PROTOCOL_ERROR_CODES)[number];
70
+ /** unknown → 协议错误码收窄(外部输入携带错误码时的运行时 guard;其余 engine_* 走透传)。 */
71
+ declare function isEngineProtocolErrorCode(value: unknown): value is EngineProtocolErrorCode;
72
+ /** 其余引擎自报错误码的前缀契约(透传面;core 不解释文案)。 */
73
+ declare const ENGINE_ERROR_CODE_PREFIX = "engine_";
74
+ declare function isEngineErrorPassthroughCode(value: string): boolean;
75
+
76
+ /**
77
+ * 结构化引擎错误(message 恒为 `<code>: <detail>` 前缀格式——AgentOutcome.error 与
78
+ * 协议 error 帧共用的错误码前缀约定);recovery 指向恢复动作。
79
+ * toStructured() 产出即协议 ProtocolError 形态(error 帧载荷直用)。
80
+ */
81
+ declare class EngineSdkError extends Error {
82
+ readonly code: string;
83
+ readonly recovery: string;
84
+ readonly data?: Record<string, unknown>;
85
+ constructor(code: string, detail: string, recovery: string, data?: Record<string, unknown>);
86
+ /** 协议 error 帧载荷投影。 */
87
+ toStructured(): ProtocolError;
88
+ }
89
+ declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
90
+ /**
91
+ * [v1.x] chat 会话形态的 gate 拒绝具名错误(chat-domain 设计 §3.2 D1-A +
92
+ * 验收 A6:manifest 无 conversation gate 位的引擎收到 chat 请求 → 同步拒)。
93
+ * 文案契约对齐 core capability-gate.ts conversation 分支(错误码
94
+ * engine_capability_unsupported + 「去掉参数 / 修 manifest / 升级引擎包」恢复指引)
95
+ * ——W3 chat 路由切协议客户端时以本构造器替换 core 内联文案,保持两侧一致。
96
+ */
97
+ declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
98
+ /**
99
+ * [v1.x] chat 会话形态(run.params.chat / task.conversation=true)派发前的同步 gate:
100
+ * manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError——
101
+ * 进程/record 创建前同步拒(A6:run 域不受影响,仅 chat 面被拦)。
102
+ * 判据单源:core 侧 capability-gate.assertTaskShapeSupported 的 conversation 分支
103
+ * 覆盖同一能力位,协议客户端路径(W3 接线)消费本函数,防两处判据漂移。
104
+ */
105
+ declare function assertChatConversationSupported(engineId: string, capabilities: Pick<EngineCapabilities, "conversation">): void;
106
+ /** stdout 尾部回显上限(engine_timeout / engine_run_failed 的错误规格载体系数)。 */
107
+ declare const STDOUT_TAIL_ECHO_CHARS = 2000;
108
+ /** engine_timeout 的恢复指引(kill-chain 超时杀链收尾文案)。 */
109
+ declare const ENGINE_TIMEOUT_RECOVERY: string;
110
+ /**
111
+ * engine_timeout 的 outcome.error 文案:含 stdout 尾部 2000 字 + 恢复指引
112
+ * (kill-chain synthesizeTimeoutOutcome 消费;与 core errors.ts engineTimeoutDetail 逐字等价)。
113
+ */
114
+ declare function engineTimeoutDetail(stdoutTail: string): string;
115
+ /** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
116
+ declare function schemaEmulationFailedDetail(error: string, tail: string): string;
117
+
118
+ export { type AnyFrame as A, ENGINE_ERROR_CODE_PREFIX as E, type NotificationFrame as N, type ProtocolError as P, type RequestFrame as R, STDOUT_TAIL_ECHO_CHARS as S, ENGINE_PROTOCOL_ERROR_CODES as a, ENGINE_TIMEOUT_RECOVERY as b, type EngineProtocolErrorCode as c, EngineSdkError as d, type ErrorResponseFrame as e, type EventNotificationParams as f, type ResponseFrame as g, type ReverseRequestFrame as h, type ReverseResponseResult as i, type SuccessResponseFrame as j, assertChatConversationSupported as k, engineConversationUnsupportedError as l, engineProtocolMismatchError as m, engineTimeoutDetail as n, isEngineErrorPassthroughCode as o, isEngineProtocolErrorCode as p, isNotificationFrame as q, isRequestFrame as r, isResponseFrame as s, isReverseRequestFrame as t, schemaEmulationFailedDetail as u };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/error-message.ts
21
+ var error_message_exports = {};
22
+ __export(error_message_exports, {
23
+ toErrorMessage: () => toErrorMessage
24
+ });
25
+ module.exports = __toCommonJS(error_message_exports);
26
+ function toErrorMessage(e) {
27
+ if (e instanceof Error) return e.message;
28
+ if (typeof e === "object" && e !== null) {
29
+ try {
30
+ return JSON.stringify(e);
31
+ } catch {
32
+ return String(e);
33
+ }
34
+ }
35
+ return String(e);
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ toErrorMessage
40
+ });
@@ -0,0 +1,3 @@
1
+ declare function toErrorMessage(e: unknown): string;
2
+
3
+ export { toErrorMessage };
@@ -0,0 +1,3 @@
1
+ declare function toErrorMessage(e: unknown): string;
2
+
3
+ export { toErrorMessage };
@@ -0,0 +1,7 @@
1
+ import {
2
+ toErrorMessage
3
+ } from "./chunk-PYO3YR7W.js";
4
+ import "./chunk-JSBRDJBE.js";
5
+ export {
6
+ toErrorMessage
7
+ };