evolcore 0.0.45 → 0.0.46

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 (204) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/bin/ecmsg.js +33 -23
  3. package/dist/ability/application-service.js +1 -2
  4. package/dist/ability/package.js +28 -0
  5. package/dist/agent-template/jobs.js +158 -36
  6. package/dist/agent-template/runtime.js +401 -34
  7. package/dist/agent-template/service.js +764 -369
  8. package/dist/agent-template/tool-runner.js +35 -17
  9. package/dist/agent-template/types.js +7 -4
  10. package/dist/agents/baseagent.js +10 -9
  11. package/dist/agents/claude-runner.js +13 -5
  12. package/dist/agents/codex/app-server-client.js +2 -4
  13. package/dist/agents/codex/diagnostics.js +18 -1
  14. package/dist/agents/codex-runner.js +3 -1
  15. package/dist/agents/ecagent-runner.js +3 -1
  16. package/dist/agents/gemini-runner.js +2 -1
  17. package/dist/aun/menu/client.js +142 -182
  18. package/dist/aun/rpc/client.js +33 -17
  19. package/dist/aun/service-proxy.js +6 -23
  20. package/dist/channels/aun.js +656 -112
  21. package/dist/cli/agent-create.js +37 -10
  22. package/dist/cli/agent-template.js +105 -84
  23. package/dist/cli/agent.js +31 -18
  24. package/dist/cli/daemon-commands.js +15 -17
  25. package/dist/cli/daemon-lifecycle-client.js +40 -18
  26. package/dist/cli/directory.js +12 -4
  27. package/dist/cli/ecmsg-gateway.js +5 -2
  28. package/dist/cli/events-command.js +2 -1
  29. package/dist/cli/init.js +50 -20
  30. package/dist/cli/integrity-command.js +2 -0
  31. package/dist/cli/managed-command-guard.js +20 -1
  32. package/dist/cli/menu-client.js +7 -5
  33. package/dist/cli/restart-monitor.js +33 -20
  34. package/dist/cli/services-command.js +28 -5
  35. package/dist/config/config-field-policy.js +24 -0
  36. package/dist/config/config-manager.js +20 -2
  37. package/dist/config/peer-book-store.js +152 -120
  38. package/dist/config/peer-role-resolver.js +24 -4
  39. package/dist/config/provider-identity-migration.js +1 -1
  40. package/dist/config/provider-identity.js +10 -4
  41. package/dist/config/provider-ipc-service.js +10 -2
  42. package/dist/config/provider-local-sync.js +2 -2
  43. package/dist/config/providers-config.js +95 -10
  44. package/dist/config/providers-import.js +4 -6
  45. package/dist/config/providers.js +14 -3
  46. package/dist/config/role-store.js +1 -1
  47. package/dist/config-store.js +9 -1
  48. package/dist/core/agent-application-service.js +56 -29
  49. package/dist/core/agent-create-status.js +3 -1
  50. package/dist/core/agent-creation-claim.js +1 -0
  51. package/dist/core/agent-ipc-registration.js +2 -2
  52. package/dist/core/agent-reload-coordinator.js +38 -1
  53. package/dist/core/agent-runtime.js +85 -38
  54. package/dist/core/auth/agent-delegation.js +5 -0
  55. package/dist/core/auth/operation-authorizer.js +1 -1
  56. package/dist/core/auth/operation-catalog.js +3 -3
  57. package/dist/core/bootstrap-service.js +3 -0
  58. package/dist/core/capability/capability-manager.js +3 -1
  59. package/dist/core/channel-loader.js +29 -3
  60. package/dist/core/channel-runtime.js +1 -1
  61. package/dist/core/command/agent-control.js +6 -5
  62. package/dist/core/command/agent-template-menu.js +32 -97
  63. package/dist/core/command/eventcenter-menu.js +61 -13
  64. package/dist/core/command/menu-catalog.js +11 -4
  65. package/dist/core/command/menu-handler.js +35 -8
  66. package/dist/core/command/menu-protocol.js +8 -16
  67. package/dist/core/command/skill-slash.js +6 -2
  68. package/dist/core/command/team-workspace-bootstrap.js +1 -2
  69. package/dist/core/command/team-workspace-management-store.js +83 -0
  70. package/dist/core/command/team-workspace-management.js +1 -2
  71. package/dist/core/command/team-workspace-team.js +26 -3
  72. package/dist/core/daemon-control.js +3 -4
  73. package/dist/core/daemon-lifecycle.js +146 -110
  74. package/dist/core/evolagent-registry.js +42 -0
  75. package/dist/core/evolagent.js +2 -1
  76. package/dist/core/file-integrity/read.js +9 -16
  77. package/dist/core/file-integrity/store.js +94 -34
  78. package/dist/core/handoff/dispatcher.js +33 -7
  79. package/dist/core/handoff/runtime.js +8 -0
  80. package/dist/core/inference/text-inference.js +12 -2
  81. package/dist/core/invoke/invoke-service.js +24 -3
  82. package/dist/core/ipc-registration.js +3 -0
  83. package/dist/core/message/aun-ipc-sender.js +109 -7
  84. package/dist/core/message/contact-admission.js +6 -2
  85. package/dist/core/message/message-bridge.js +13 -0
  86. package/dist/core/message/message-queue.js +131 -30
  87. package/dist/core/message/pending-hints.js +8 -0
  88. package/dist/core/message/response-engine.js +48 -2
  89. package/dist/core/message/send-routing.js +3 -12
  90. package/dist/core/model/catalog-service.js +13 -0
  91. package/dist/core/model/model-catalog.js +57 -18
  92. package/dist/core/pack-auth.js +163 -31
  93. package/dist/core/pack-install.js +42 -1
  94. package/dist/{services/ledger.js → core/pack-ledger.js} +17 -6
  95. package/dist/core/permission/ec-command-parser.js +3 -1
  96. package/dist/core/permission/shell-environment.js +23 -0
  97. package/dist/core/rate-window.js +6 -1
  98. package/dist/core/session/session-idle-monitor.js +0 -1
  99. package/dist/core/session/session-manager.js +14 -0
  100. package/dist/core/session/session-title.js +26 -6
  101. package/dist/core/skill/index-generator.js +3 -4
  102. package/dist/core/thread/thread-service.js +0 -1
  103. package/dist/core/thread/topic-id.js +8 -0
  104. package/dist/directory/owner-directory-admission.js +17 -0
  105. package/dist/directory/owner-directory-cache.js +3 -1
  106. package/dist/directory/owner-directory-markdown.js +145 -23
  107. package/dist/directory/owner-directory-policy.js +23 -0
  108. package/dist/directory/owner-directory-query-operation.js +20 -6
  109. package/dist/directory/owner-directory-search.js +47 -0
  110. package/dist/eck/message-renderer.js +171 -32
  111. package/dist/ecweb/basic-settings-service.js +7 -3
  112. package/dist/ecweb/providers-service.js +17 -10
  113. package/dist/ecweb/runtime/lifecycle.js +1 -1
  114. package/dist/ecweb/runtime/supervisor.js +77 -35
  115. package/dist/event-center/admission-materializer.js +1 -1
  116. package/dist/event-center/bus-gate.js +48 -4
  117. package/dist/event-center/bus-host.js +3 -3
  118. package/dist/event-center/center-config.js +57 -28
  119. package/dist/event-center/dispatcher.js +8 -0
  120. package/dist/event-center/event-log.js +69 -27
  121. package/dist/event-center/index-generator.js +6 -1
  122. package/dist/event-center/ipc-operation.js +66 -25
  123. package/dist/event-center/pack-loader.js +12 -55
  124. package/dist/event-center/pack-manager.js +5 -3
  125. package/dist/event-center/registry.js +48 -52
  126. package/dist/event-center/runtime.js +219 -81
  127. package/dist/event-center/script-runner.js +18 -7
  128. package/dist/event-center/types.js +9 -1
  129. package/dist/event-center/validation.js +33 -4
  130. package/dist/index.js +96 -42
  131. package/dist/ipc.js +33 -7
  132. package/dist/product.js +1 -0
  133. package/dist/proxy/manager.js +52 -11
  134. package/dist/proxy/service-supervisor.js +265 -67
  135. package/dist/services/dispatcher.js +26 -3
  136. package/dist/services/idempotency.js +128 -0
  137. package/dist/services/identity.js +3 -27
  138. package/dist/services/index-generator.js +5 -1
  139. package/dist/services/index.js +244 -45
  140. package/dist/services/ipc-operation.js +164 -20
  141. package/dist/services/pack-manager.js +37 -9
  142. package/dist/services/router.js +100 -31
  143. package/dist/services/script-runner.js +15 -4
  144. package/dist/services/service-payload.js +50 -2
  145. package/dist/services/validation.js +107 -3
  146. package/dist/trigger/scheduler.js +14 -4
  147. package/dist/trigger/script-sandbox.js +39 -2
  148. package/dist/utils/cross-platform.js +35 -11
  149. package/dist/utils/error-utils.js +13 -1
  150. package/dist/utils/instance-registry.js +33 -35
  151. package/dist/utils/process-introspect.js +35 -20
  152. package/dist/utils/project-path.js +47 -3
  153. package/dist/utils/windows-shell-trust.js +174 -68
  154. package/kits/docs/context-assembly.md +3 -3
  155. package/kits/docs/evolcore/agent.md +28 -10
  156. package/kits/docs/evolcore/config.md +22 -0
  157. package/kits/docs/evolcore/directory.md +46 -12
  158. package/kits/docs/evolcore/event-center.md +6 -6
  159. package/kits/docs/evolcore/group-collaboration.md +1 -1
  160. package/kits/docs/evolcore/menu-client.md +7 -5
  161. package/kits/docs/evolcore/menu-protocol.md +5 -3
  162. package/kits/docs/evolcore/msg.md +10 -3
  163. package/kits/docs/evolcore/provider.md +7 -3
  164. package/kits/docs/evolcore/services.md +145 -12
  165. package/kits/docs/evolcore/thread-chain.md +17 -9
  166. package/kits/docs/prompt-loading-architecture.md +4 -4
  167. package/kits/eck_message_manifest.json +46 -3
  168. package/kits/rules/04-relation.md +10 -2
  169. package/kits/rules/06-channel.md +2 -1
  170. package/kits/schemas/providers.schema.2.json +1 -0
  171. package/kits/skills/ec-group/SKILL.md +4 -0
  172. package/kits/skills/ec-skill/scripts/cli.mjs +1 -1
  173. package/kits/skills/ec-skill/scripts/skill.mjs +13 -2
  174. package/kits/skills/thread-ops/SKILL.md +8 -5
  175. package/kits/templates/message-fragments/group-batch-item.md +3 -0
  176. package/kits/templates/message-fragments/group-batch.md +1 -0
  177. package/kits/templates/message-fragments/item-group.md +4 -0
  178. package/kits/templates/message-fragments/item-private.md +4 -0
  179. package/kits/templates/message-fragments/thread-context.md +1 -1
  180. package/kits/templates/system-fragments/commands.md +5 -5
  181. package/kits/templates/system-fragments/managed-runtime.md +1 -1
  182. package/kits/templates/system-fragments/relation.md +11 -7
  183. package/package.json +3 -2
  184. package/scripts/agent-template/index.mjs +9 -4
  185. package/scripts/agent-template/inspect.mjs +16 -9
  186. package/scripts/agent-template/shared/plan.mjs +3 -33
  187. package/scripts/agent-template/shared/template-contract.mjs +186 -3
  188. package/scripts/agent-template/shared/template-package.mjs +119 -10
  189. package/scripts/agent-template/shared/template-runtime.mjs +49 -6
  190. package/scripts/agent-template/shared/template.mjs +5 -5
  191. package/scripts/agent-template/team-pack.mjs +245 -0
  192. package/scripts/agent-template/team-preview.mjs +111 -0
  193. package/scripts/aid-batch/identity-batch.mjs +143 -0
  194. package/dist/ability/versions.js +0 -32
  195. package/dist/aun/model-headers.js +0 -17
  196. package/dist/channels/builtin-plugins.js +0 -19
  197. package/dist/core/command/team-workspace-initializer.js +0 -2
  198. package/dist/core/command/team-workspace-job-store.js +0 -88
  199. package/dist/core/command/team-workspace-management-service.js +0 -2
  200. package/dist/core/contact-bind-registry.js +0 -27
  201. package/dist/event-center/ledger.js +0 -52
  202. package/dist/services/reply.js +0 -55
  203. package/kits/templates/message-fragments/item.md +0 -3
  204. package/scripts/agent-template/pack.mjs +0 -169
@@ -183,7 +183,7 @@ join('\n\n') → { body: string, images: ImageData[] }
183
183
  ```
184
184
 
185
185
  对于 `kind: "handoff"` 的消息,普通 private/group section 仍会命中并渲染标准消息信封;
186
- `item.md` 通过 `{{?isHandoff!=true}}` 只在普通消息上输出正文,避免 handoff 当前回复重复。
186
+ `item-private.md` / `item-group.md` 通过 `{{?isHandoff!=true}}` 只在普通消息上输出正文,避免 handoff 当前回复重复。
187
187
  随后按 handoff 类型追加专用上下文 fragment(request、return=none 或 response-to-origin)。
188
188
  因此 handoff 消息与其它私聊、coding、群聊消息共享时间、发送者、角色、群、加密和 @ 等元数据格式,
189
189
  只在其后增加一次性跨会话上下文。
@@ -214,7 +214,7 @@ wrapper 的 {{@loop}} 处字面量填入 renderedParts.join(separator)
214
214
  ```json
215
215
  {
216
216
  "id": "msg-item",
217
- "file": "$KITS_MESSAGE_FRAGMENTS/item.md",
217
+ "file": "$KITS_MESSAGE_FRAGMENTS/item-private.md",
218
218
  "when": "always",
219
219
  "needsInjection": true
220
220
  }
@@ -241,7 +241,7 @@ wrapper 的 {{@loop}} 处字面量填入 renderedParts.join(separator)
241
241
  |------|------|
242
242
  | 静态(进程级) | `PACKAGE_ROOT` `KITS*` `evolcoreMode` `osInfo` `baseAgent` |
243
243
  | 会话稳定 | `selfAid` `sessionId` `sessionKey` `chatType` `channel` `timezone` `tzOffset` `capabilities` `CURRENT_PROJECT` |
244
- | 慢变(配置驱动) | `effectiveModel` `permissionMode` `peerRole` `readonly` `chatMode` `modelFallback*` |
244
+ | 慢变(配置驱动) | `effectiveModel` `permissionMode` `speakerRelation` `readonly` `chatMode` `modelFallback*` |
245
245
  | 新增(日期级) | `localDate`(YYYY-MM-DD)`weekday`(星期四),一天才变一次,缓存暖 ~24h |
246
246
 
247
247
  ### 进消息渲染层(每条独立,进 transcript 永久保真)
@@ -282,7 +282,7 @@ wrapper 的 {{@loop}} 处字面量填入 renderedParts.join(separator)
282
282
  | `kits/eck_manifest.json` | 系统提示词 manifest |
283
283
  | `kits/eck_message_manifest.json` | 消息渲染 manifest |
284
284
  | `kits/templates/system-fragments/session.md` | 含 localDate/weekday |
285
- | `kits/templates/message-fragments/item.md` | 消息渲染紧凑模板 |
285
+ | `kits/templates/message-fragments/item-private.md` / `item-group.md` / `group-batch-item.md` | 消息渲染模板(私聊 / 群聊单条 / 群聊批次逐行) |
286
286
  | `$EVOLCORE_HOME/eck/eck_manifest.json` | 系统提示词 manifest 用户覆盖(可选) |
287
287
  | `$EVOLCORE_HOME/eck/eck_message_manifest.json` | 消息渲染 manifest 用户覆盖(可选) |
288
288
  | `$EVOLCORE_HOME/data/eck-debug/` | 调试输出目录(保留 24h) |
@@ -162,7 +162,7 @@
162
162
  {
163
163
  "id": "msg-private-default",
164
164
  "type": "file",
165
- "file": "$KITS_MESSAGE_FRAGMENTS/item.md",
165
+ "file": "$KITS_MESSAGE_FRAGMENTS/item-private.md",
166
166
  "order": 10,
167
167
  "needsInjection": true,
168
168
  "modeType": "private",
@@ -197,7 +197,7 @@
197
197
  {
198
198
  "id": "msg-group-default",
199
199
  "type": "file",
200
- "file": "$KITS_MESSAGE_FRAGMENTS/item.md",
200
+ "file": "$KITS_MESSAGE_FRAGMENTS/item-group.md",
201
201
  "order": 10,
202
202
  "needsInjection": true,
203
203
  "modeType": "group",
@@ -221,13 +221,56 @@
221
221
  "var": "chatType",
222
222
  "eq": "group"
223
223
  },
224
+ {
225
+ "var": "batchItem",
226
+ "neq": true
227
+ },
228
+ {
229
+ "var": "renderMode_group",
230
+ "eq": "default"
231
+ }
232
+ ]
233
+ },
234
+ "description": "群聊单条消息渲染(完整信封;批次段内单条走这里)"
235
+ },
236
+ {
237
+ "id": "msg-group-batch-item",
238
+ "type": "file",
239
+ "file": "$KITS_MESSAGE_FRAGMENTS/group-batch-item.md",
240
+ "order": 11,
241
+ "needsInjection": true,
242
+ "modeType": "group",
243
+ "modeName": "default",
244
+ "isDefault": true,
245
+ "when": {
246
+ "and": [
247
+ {
248
+ "var": "isOwnerHint",
249
+ "neq": true
250
+ },
251
+ {
252
+ "var": "isThreadContext",
253
+ "neq": true
254
+ },
255
+ {
256
+ "var": "isTriggerMsg",
257
+ "neq": true
258
+ },
259
+ {
260
+ "var": "chatType",
261
+ "eq": "group"
262
+ },
263
+ {
264
+ "var": "batchItem",
265
+ "eq": true
266
+ },
224
267
  {
225
268
  "var": "renderMode_group",
226
269
  "eq": "default"
227
270
  }
228
271
  ]
229
272
  },
230
- "description": "群聊消息渲染(default 模式)"
273
+ "description": "群聊批次逐行渲染(批次头由 group-batch.md 在代码侧拼接)"
231
274
  }
232
275
  ]
233
276
  }
@@ -10,8 +10,16 @@
10
10
 
11
11
  > 为什么用 `peerId` 而非直接用 AID:非 AUN 渠道的对端(飞书群、微信)没有 AID,用 `<channel>#<peerId>` 才能统一覆盖所有渠道的对端。
12
12
 
13
- relation fragment 注入的全部变量:`peerKey`、`peerId`、`peerName`、`peerRole`、`peerType`,
14
- 群聊另有 `groupId`、`groupRulesStatus`、`groupRulesError`。`groupRulesStatus=ignored` 表示本轮由
13
+ relation fragment 注入的全部变量:`peerKey`、`peerId`、`peerName`、`与发言人`、`我的群角色`、`peerType`,
14
+ 群聊另有 `groupId`、`groupRulesStatus`、`groupRulesError`。
15
+
16
+ 群聊里有三个角色,互不替代:
17
+
18
+ - **我的群角色**:我在本群的成员角色(系统段 `我的群角色`);
19
+ - **发言人的群角色**:发言人在本群的成员角色(消息信封 `群角色:`);
20
+ - **发言人与我的关系**:发言人与我的关系角色(系统段与消息信封 `与发言人:`)。
21
+
22
+ 群角色从群成员表取,与发言人从关系记录取。不在联系人里一律 `visitor`,不回落 `member`。`groupRulesStatus=ignored` 表示本轮由
15
23
  本地 `groupRules.mode=ignore` 主动跳过,不是远端缺失、无权限或同步失败。
16
24
 
17
25
  ## 数据位置
@@ -24,7 +24,8 @@
24
24
  - interactive:直接输出即回复
25
25
  - proactive:用 `ecmsg send` 正式回复,见 `[reply]` 段
26
26
  - **发消息只有 `ecmsg` 一个入口**:文字、文件、图片、语音、链接、@某人、加密、联系第三方,全部用 `ecmsg send`。本端恒为当前会话本端,无需指定
27
- - **跨话题发送分两种**:`--thread <话题id>` 是**跨话题委派**,目标是该话题的对端;`--thread <话题id> --to <本端AID>` 是**跨话题自派**,目标是该话题下的本端自己,用于「对端是人、不会自己推进」的分叉场景
27
+ - **消息分三种**:**普通消息**(当前话题的会话对端发来)、**跨话题自派**(本端从另一个话题派给自己)、**跨话题委托**(本端从另一个话题委托给该话题的对端,对方回复后回流)
28
+ - **跨话题发送有两个动作**:`--thread <话题id>` 是**跨话题委托**,目标是该话题的对端;`--thread <话题id> --to <本端AID>` 是**跨话题自派**,目标是该话题下的本端自己,用于「对端是人、不会自己推进」的分叉场景
28
29
 
29
30
  ### 命令返回值
30
31
 
@@ -55,6 +55,7 @@
55
55
  "properties": {
56
56
  "path": { "type": "string" },
57
57
  "style": { "type": "string", "minLength": 1 },
58
+ "modelPolicy": { "type": "string", "enum": ["allowlist", "denylist", "manual"] },
58
59
  "models": {
59
60
  "type": "object",
60
61
  "propertyNames": { "not": { "enum": ["__proto__", "prototype", "constructor"] }, "pattern": "\\S" },
@@ -147,6 +147,10 @@ ec group history <selfAid> <groupId> --limit 50 --format json
147
147
  自己在群里的角色也从 members 里查自己的 AID 得到。`members` 里只有 `last_ack_*` 能反映活跃度,
148
148
  `last_pull_at` 恒为 0、`member_type` 恒为 `human`,两个都不能当判据。
149
149
 
150
+ 消息信封里的 `群角色:` 是发言人本人在群里的角色;`与发言人:` 是发言人与我的关系角色。
151
+ 两者来源不同、互不替代——要判断"我能不能做某件群操作"看 `我的群角色`(系统段),
152
+ 要判断"谁在跟我说话"看信封里的 `与发言人:`。
153
+
150
154
  **群文件**:统一走 `ec fs`,没有 `ec group fs`。
151
155
 
152
156
  ```bash
@@ -107,7 +107,7 @@ async function main() {
107
107
  case 'load': {
108
108
  const withFrontmatter = Boolean(flags['with-frontmatter']);
109
109
  const source = flags.source || null;
110
- emit(S.cmdLoad(positional[0], { source, withFrontmatter, json: asJson }));
110
+ emit(await S.cmdLoad(positional[0], { source, withFrontmatter, json: asJson }));
111
111
  return 0;
112
112
  }
113
113
 
@@ -11,6 +11,7 @@
11
11
  import fs from 'node:fs';
12
12
  import path from 'node:path';
13
13
  import os from 'node:os';
14
+ import { pathToFileURL } from 'node:url';
14
15
  import { evolcoreHome, loadDep } from './deps.mjs';
15
16
  import { readSkillFrontmatter } from './frontmatter.mjs';
16
17
 
@@ -696,7 +697,7 @@ export function cmdPath(name, { json = false } = {}) {
696
697
  return lines.join('\n');
697
698
  }
698
699
 
699
- export function cmdLoad(name, { source = null, withFrontmatter = false, json = false } = {}) {
700
+ export async function cmdLoad(name, { source = null, withFrontmatter = false, json = false } = {}) {
700
701
  if (!name) throw new Error('缺少技能名。用法:ec skill load <name> [--source builtin|local] [--with-frontmatter]');
701
702
  if (source && source !== 'builtin' && source !== 'local') {
702
703
  throw new Error('--source 只能是 builtin 或 local');
@@ -731,7 +732,17 @@ export function cmdLoad(name, { source = null, withFrontmatter = false, json = f
731
732
  throw new Error(`技能未启用: ${name}\n请先执行: ec skill enable ${name}`);
732
733
  }
733
734
 
734
- let content = fs.readFileSync(skillMd, 'utf-8');
735
+ let content;
736
+ if (isInside(skillMd, roots.builtin) && packageRoot().includes('node_modules')) {
737
+ // 安装包复用 Core 的版本基线,不在技能脚本里维护另一份台账逻辑。
738
+ const runtime = pathToFileURL(path.join(packageRoot(), 'dist', 'core', 'file-integrity', 'read.js')).href;
739
+ const { readVerifiedText } = await import(runtime);
740
+ const checked = readVerifiedText(skillMd, { verify: true, tag: 'skill' });
741
+ if (!checked) throw new Error(`SKILL.md 完整性校验失败,已拒绝加载: ${skillMd}`);
742
+ content = checked.text;
743
+ } else {
744
+ content = fs.readFileSync(skillMd, 'utf-8');
745
+ }
735
746
  if (!withFrontmatter) {
736
747
  content = content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '');
737
748
  }
@@ -3,7 +3,7 @@ name: thread-ops
3
3
  description: >-
4
4
  话题链(Thread Chain)与话题总结。
5
5
  **以下两种消息必须先加载本 skill 再处理**:① 消息开头是
6
- 「‹【跨话题上下文】来源话题:…›」(你跨话题发出的消息,对端回复了);
6
+ 「‹提醒:跨话题委托 · 话题:…›」(你跨话题委托出去的消息,对端回复了);
7
7
  ② 消息开头是「‹【跨话题复查】来源话题:…›」(复查通知)。
8
8
  也用于:要联系当前对端/当前群以外的对象("帮我问一下 X"、"转告 Y"、"去查 Z")、
9
9
  处理收到的委托、汇报回来源话题。
@@ -17,11 +17,11 @@ license: MIT
17
17
 
18
18
  ## 一、必须加载的时机
19
19
 
20
- **两种唤醒消息**(开头就是判据,逐字比对):
20
+ **两种唤醒消息**(看首行前缀,不要逐字比对整行——模板会微调):
21
21
 
22
- 1. `‹【跨话题上下文】来源话题:<id> · 对端:<AID> · 发送于:… · 复查:<trig…|无> → self:…›`
23
- ——你此前跨话题发出的消息,对端回复了。**有 ⚠️ 空洞提示就先回查来源话题再转达**。
24
- 2. `‹【跨话题复查】来源话题:<id> · 对端:<AID> · 发送于:… · 复查:<trig…> → self:…›`
22
+ 1. 首行含 `提醒:跨话题委托`(形如 `‹提醒:跨话题委托 · 话题:<id>(对端:<AID>) · 发送于:… · 原消息:<mid> · 来源会话:<sid> · 复查:<trig…> · self:…›`)
23
+ ——你此前跨话题委托出去的消息,对端回复了。**有 ⚠️ 空洞提示就先回查来源话题再转达**。
24
+ 2. 首行含 `【跨话题复查】`(形如 `‹【跨话题复查】来源话题:…›`)
25
25
  ——周期复查到期,你在目标话题里被唤醒。
26
26
 
27
27
  **业务动作**:要联系当前对端/当前群以外的对象;受人所托去问第三方;要汇报回来源话题;并发问多方。
@@ -39,6 +39,9 @@ license: MIT
39
39
 
40
40
  | 概念 | 定义 |
41
41
  |---|---|
42
+ | 普通消息 | 当前话题的会话对端发来 |
43
+ | 跨话题委托 | 本端从另一个话题委托给该话题的对端;对方回复后回流 |
44
+ | 跨话题自派 | 本端从另一个话题把任务派给自己 |
42
45
  | 话题 | agent 与对端之间一条独立的讨论线;消息必须发在某个话题上 |
43
46
  | threadId | 跨端统一标识。话题 `thread-<ms>-<seq4>-<rand4>`;主话题 `main:<aidA>:<aidB>`(两种顺序等价,输出为字典序规范形态) |
44
47
  | 双端结构 | 同一 threadId 在双方各有一个本地会话 |
@@ -0,0 +1,3 @@
1
+ ‹{{shortNow}}{{modePart}}{{topicPart}} · {{fromLabel}}{{groupRolePart}} · {{speakerRelationLabel}}{{mentionPart}} · {{midLabel}}›
2
+ {{?senderCtxLine}}{{senderCtxLine}}
3
+ {{/}}{{content}}
@@ -0,0 +1 @@
1
+ [{{batchTime}} · 群聊] 群:{{groupTag}} · {{selfLabel}} · {{chatLabel}}
@@ -0,0 +1,4 @@
1
+ ‹{{now}} · 群:{{groupTag}}{{modePart}}{{topicPart}} · {{fromLabel}} · {{selfLabel}}{{groupRolePart}} · {{speakerRelationLabel}} · {{chatLabel}}{{mentionPart}} · {{midLabel}}›
2
+ {{?senderCtxLine}}{{senderCtxLine}}
3
+ {{/}}{{?lifecycle=bootstrapping}}(本轮只推进首次设定:按 Owner 这条回复更新名片和头像,然后完成激活;回复里的普通任务记为激活后待办,不在本轮执行。)
4
+ {{/}}{{?isHandoff!=true}}{{content}}{{/}}
@@ -0,0 +1,4 @@
1
+ ‹{{now}}{{modePart}}{{topicPart}} · {{fromLabel}} · {{selfLabel}} · {{speakerRelationLabel}} · {{chatLabel}} · {{midLabel}}›
2
+ {{?senderCtxLine}}{{senderCtxLine}}
3
+ {{/}}{{?lifecycle=bootstrapping}}(本轮只推进首次设定:按 Owner 这条回复更新名片和头像,然后完成激活;回复里的普通任务记为激活后待办,不在本轮执行。)
4
+ {{/}}{{?isHandoff!=true}}{{content}}{{/}}
@@ -1,4 +1,4 @@
1
- ‹【跨话题上下文】来源话题:{{threadContextOriginThreadId}}{{?threadContextOriginPeer}} · 对端:{{threadContextOriginPeer}}{{/}}{{?threadContextTime}} · 发送于:{{threadContextTime}}{{/}} · 复查:{{threadContextTriggerId}} → self:{{selfAid}}›
1
+ ‹提醒:跨话题委托 · 话题:{{threadContextOriginThreadId}}{{?threadContextOriginPeer}}(对端:{{threadContextOriginPeer}}){{/}} · 发送于:{{threadContextTime}} · 原消息:{{threadContextMessageId}} · 来源会话:{{threadContextOriginSessionId}} · 复查:{{threadContextTriggerId}} · {{selfLabel}}›
2
2
  {{?threadContextGapHasNewMessages}}⚠️ 来源话题在发送后已有 {{threadContextGapCount}} 条新消息{{?threadContextGapRange}}({{threadContextGapRange}}){{/}} —— 处理前建议先回查该话题的空洞期消息。
3
3
  {{/}}{{?threadContextGapError}}⚠️ 无法检测来源话题的空洞期消息({{threadContextGapError}})—— 如需确认,请手动执行 ec thread history 回查该话题。
4
4
  {{/}}
@@ -16,15 +16,15 @@ ec events 事件中心运维(status/ledger/tail/doctor/reload/rules/pack/publ
16
16
  ec services 服务路由运维与对端调用(status/types/ledger/tail/doctor/reload/enable/disable;describe/schema/call 调对端服务;服务调用是点对点、要结果、不丢) $KITS_DOCS/evolcore/services.md
17
17
  {{?channel=aun}}
18
18
  {{?chatType=private}}
19
- {{?peerRole=owner}}
19
+ {{?speakerRelation=owner}}
20
20
  ec team 初始化当前 Agent 的 Team Workspace、发布/删除/替换导航入口、管理团队成员 $KITS_DOCS/evolcore/team-workspace.md
21
21
  {{/}}
22
22
  {{/}}
23
23
  {{/}}
24
- {{?peerRole=owner}}
24
+ {{?speakerRelation=owner}}
25
25
  ec task 恢复暂停或异常中断的会话任务(resume <sessionId>;复用原 baseagent 会话,缺失时失败关闭) $KITS_DOCS/evolcore/task.md
26
26
  {{/}}
27
- {{?peerRole=admin}}
27
+ {{?speakerRelation=admin}}
28
28
  ec task 恢复暂停或异常中断的本 Agent 会话任务(resume <sessionId>;复用原 baseagent 会话,缺失时失败关闭) $KITS_DOCS/evolcore/task.md
29
29
  {{/}}
30
30
  ec skill 技能加载与管理(load 加载正文/path 查路径/list 列技能/info 详情/where 根目录/enable/disable/install/remove) $KITS_DOCS/evolcore/skill.md
@@ -39,11 +39,11 @@ ec thread 话题管理与话题链(peers 列对端 / list 列话题 / history
39
39
  {{?selfAid}}
40
40
  ec group 群管理(建群/查群/本地群历史/邀请/踢人/角色/封禁/屏蔽/成员状态/规则;发送群消息用 ecmsg,完整协作使用 ec-group-collaboration 技能) $KITS_DOCS/evolcore/group.md
41
41
  {{/}}
42
- {{?peerRole=owner}}
42
+ {{?speakerRelation=owner}}
43
43
  ec agent EvolAgent 生命周期与主机信息(创建/启停/热重载/改配置/查主机信息;创建流程使用 ec-agent-create 技能)。ec agent reload 仅对配置/soul/memory 生效,改源码无效 $KITS_DOCS/evolcore/agent.md
44
44
  ec peer 对端身份与本地拉黑(查登记/拉黑/解除拉黑;显式 --self) $KITS_DOCS/evolcore/peer.md
45
45
  {{/}}
46
- {{?peerRole=admin}}
46
+ {{?speakerRelation=admin}}
47
47
  ec agent EvolAgent 生命周期与主机信息(创建/启停/热重载/改配置/查主机信息;创建流程使用 ec-agent-create 技能)。ec agent reload 仅对配置/soul/memory 生效,改源码无效 $KITS_DOCS/evolcore/agent.md
48
48
  ec peer 对端身份与本地拉黑(查登记/拉黑/解除拉黑;显式 --self) $KITS_DOCS/evolcore/peer.md
49
49
  {{/}}
@@ -2,7 +2,7 @@
2
2
  sessionOrigin: evolcore-managed # 本会话由 EvolCore 托管,非直连 base agent 终端
3
3
 
4
4
  你处于 EvolCore 托管会话中。上面已按本会话场景选段注入环境信息:身份层(selfAid 等)、
5
- 关系层(peerId/peerRole/peerType/peerKey)、环境层(chatType/channel/permissionMode)、
5
+ 关系层(peerId/与发言人/我的群角色/peerType/peerKey)、环境层(chatType/channel/permissionMode)、
6
6
  渠道层(本渠道可用能力)、会话层(project/sessionId/timezone 等)、命令集能力卡与核心规则。
7
7
 
8
8
  **工作区 `CLAUDE.md` 中"请先读完 `kits/rules/` 这 6 个文件"的指令面向直连场景**(base agent
@@ -2,14 +2,10 @@
2
2
  {{?peerKey}}
3
3
  peerName: {{peerName}}
4
4
  peerId: {{peerId}} # 对端在当前渠道内的原生 ID
5
- peerRole: {{peerRole}} # owner|admin|member|visitor|自定义角色|none
6
- {{?peerType}}
7
- peerType: {{peerType}} # human 或 agent
5
+ {{?chatType=group}}
6
+ {{?myGroupRole}}
7
+ 我的群角色: {{myGroupRole}} # owner|admin|member|自定义角色|none(我在本群的角色)
8
8
  {{/}}
9
- peerKey: {{peerKey}} # 跨渠道唯一标识,格式 channel#urlEncode(peerId)
10
- {{/}}
11
- {{?groupId}}
12
- groupId: {{groupId}}
13
9
  {{?groupRulesStatus}}
14
10
  groupRulesStatus: {{groupRulesStatus}} # ignored/synced/cached/missing/forbidden/invalid_metadata/file_mismatch/too_large/unreadable/error
15
11
  {{/}}
@@ -17,3 +13,11 @@ groupRulesStatus: {{groupRulesStatus}} # ignored/synced/cached/missing/forbidden
17
13
  groupRulesError: {{groupRulesError}}
18
14
  {{/}}
19
15
  {{/}}
16
+ {{?speakerRelation}}
17
+ 与发言人: {{speakerRelation}} # owner|admin|member|visitor|自定义角色|none(发言人与我的关系;非联系人按 visitor)
18
+ {{/}}
19
+ {{?peerType}}
20
+ peerType: {{peerType}} # human 或 agent
21
+ {{/}}
22
+ peerKey: {{peerKey}} # 跨渠道唯一标识,格式 channel#urlEncode(peerId)
23
+ {{/}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evolcore",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "description": "AI Agent gateway connecting Claude, Codex, Gemini, and the bundled ecagent runner to messaging channels with multi-project session management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,6 +23,7 @@
23
23
  "!dist/core/file-integrity/write.js",
24
24
  "bin/",
25
25
  "scripts/agent-template/",
26
+ "scripts/aid-batch/",
26
27
  "!dist/experimental/",
27
28
  "!dist/ability/protocol-v2.js",
28
29
  "!skills/",
@@ -71,7 +72,7 @@
71
72
  "chokidar": "^5.0.0",
72
73
  "cron-parser": "^5.5.0",
73
74
  "dotenv": "^17.4.2",
74
- "ec-web": "0.0.45",
75
+ "ec-web": "0.0.46",
75
76
  "ignore": "7.0.5",
76
77
  "image-type": "^6.0.0",
77
78
  "partial-json": "0.1.7",
@@ -6,7 +6,7 @@ import { parseArgs, readJson } from './shared/common.mjs';
6
6
  export async function cli(argv) {
7
7
  const command = argv[0];
8
8
  if (!command || argv.includes('--help')) {
9
- console.log('Agent template: inspect-agent | pack | inspect-package | overlay --options-file <JSON>');
9
+ console.log('Agent template: inspect | build | read-package | preview | apply-installation | verify-installation | overlay --options-file <JSON>');
10
10
  return 0;
11
11
  }
12
12
  const args = parseArgs(argv.slice(1), { values: ['options-file', 'agent-dir', 'template', 'out', 'aid', 'owner', 'host', 'providers', 'workspace', 'backup'] });
@@ -17,9 +17,14 @@ export async function cli(argv) {
17
17
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
18
18
  options.packageRoot ??= packageRoot;
19
19
  const commands = {
20
- 'inspect-agent': ['./inspect.mjs', 'inspectAgent'],
21
- pack: ['./pack.mjs', 'pack'],
22
- 'inspect-package': ['./inspect.mjs', 'inspectPackage'],
20
+ inspect: ['./team-pack.mjs', 'inspectCollection'],
21
+ build: ['./team-pack.mjs', 'buildCollection'],
22
+ 'validate-selection': ['./team-pack.mjs', 'validateCollectionSelection'],
23
+ 'read-package': ['./team-preview.mjs', 'readPackage'],
24
+ preview: ['./team-preview.mjs', 'previewInstallation'],
25
+ 'apply-installation': ['./team-preview.mjs', 'applyInstallationPlan'],
26
+ 'verify-installation': ['./team-preview.mjs', 'verifyInstallationPlan'],
27
+ capabilities: ['./shared/template-contract.mjs', 'readTemplateCapabilities'],
23
28
  overlay: ['./overlay.mjs', 'overlay'],
24
29
  };
25
30
  const entry = commands[command];
@@ -7,9 +7,9 @@ import { readJson, jsonBytes, assert, sha256, walkFiles, inside, unpack, behavio
7
7
  import { loadTemplate, MANAGED_AGENT_FIELDS, templateDigest } from './shared/template.mjs';
8
8
  import { loadEvolcore } from './shared/evolcore.mjs';
9
9
  import { validateAgainstSchema, buildAgentTriggers, resolveProviderRefs } from './shared/plan.mjs';
10
- import { excluded } from './pack.mjs';
10
+ import { excludedResource as excluded } from './shared/template-package.mjs';
11
11
  import { normalizeTeam } from './shared/template-contract.mjs';
12
- import { renderValue as renderTemplateValue, renderResource, bindTemplateProviders } from './shared/template-runtime.mjs';
12
+ import { renderValue as renderTemplateValue, renderResource, bindTemplateProviders, teamMemberVariables, planMemberConfig } from './shared/template-runtime.mjs';
13
13
 
14
14
  export async function inspectAgent(options) {
15
15
  const config = options.effectiveConfig ?? readJson(path.join(options.agentDir, 'config.json'));
@@ -71,7 +71,7 @@ export async function inspectPackage(options) {
71
71
  || file.startsWith('agents/' + key + '/personal/soul/') && file.endsWith('.md') && !file.endsWith('/00-GUIDE.md')
72
72
  || file === 'agents/' + key + '/personal/welcome.md' || file.startsWith('agents/' + key + '/triggers/')),
73
73
  'INVALID_ARGUMENT', 'Unsupported template resource: ' + file);
74
- const platforms = tpl.team.host?.platform;
74
+ const platforms = tpl.team.host.platform;
75
75
  if (platforms !== undefined) assert(Array.isArray(platforms) && platforms.length
76
76
  && platforms.every(p => ['linux', 'darwin', 'win32'].includes(p)) && platforms.includes(process.platform),
77
77
  'INCOMPATIBLE', 'Template host.platform must support this host');
@@ -87,11 +87,14 @@ export async function inspectPackage(options) {
87
87
  'INVALID_ARGUMENT', 'Members must map to distinct Agents on the same host');
88
88
  assert(Object.keys(options.members ?? {}).every(key => tpl.keys.includes(key)), 'INVALID_ARGUMENT', 'Unknown member selection');
89
89
  const writes = new Map(); const members = []; const plans = [];
90
+ const memberVars = teamMemberVariables(Object.fromEntries(tpl.keys.map(key => [key,
91
+ { aid: options.targets[key].targetAid, projectPath: options.targets[key].projectPath ?? options.targets[key].targetConfig?.projects?.defaultPath }])),
92
+ contexts[0].ownerAid, contexts[0].hostAid);
90
93
  for (const key of tpl.keys) {
91
94
  const selection = options.members?.[key] ?? {};
92
95
  const out = inside(options.out ?? path.dirname(root), 'members/' + key);
93
96
  const data = await inspectMember({ ...options.targets[key], out, packageRoot: options.packageRoot, digest: options.digest,
94
- pullId: options.pullId, selections: selection.providers ?? {}, externalAids: selection.externalAids ?? {} },
97
+ pullId: options.pullId, planMode: options.planMode, memberVars: memberVars[key], selections: selection.providers ?? {}, externalAids: selection.externalAids ?? {} },
95
98
  { pkg, tpl, templateDir, key, files: files.filter(f => !f.startsWith('agents/') && !f.startsWith('workspace/')
96
99
  || f.startsWith('agents/' + key + '/') || f.startsWith('workspace/' + key + '/')) });
97
100
  const plan = readJson(data.planFile);
@@ -118,9 +121,9 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
118
121
  assert(targets?.aid === options.targetAid, 'INVALID_ARGUMENT', 'Target configuration required');
119
122
  const project = options.projectPath ?? targets.projects?.defaultPath;
120
123
  assert(typeof project === 'string' && path.isAbsolute(project), 'INVALID_ARGUMENT', 'Target default project required');
121
- const vars = { 'agent.aid': options.targetAid, 'owner.aid': options.ownerAid, 'host.aid': options.hostAid, 'project.path': project };
124
+ const vars = options.memberVars ?? teamMemberVariables({ [key]: { aid: options.targetAid, projectPath: project } }, options.ownerAid, options.hostAid)[key];
122
125
  const renderValue = value => renderTemplateValue(value, vars, options.externalAids ?? {});
123
- const spec = renderValue(tpl.team.agents.find(agent => agent.key === key));
126
+ const spec = renderValue(tpl.team.agents.find(member => member.key === key));
124
127
  for (const file of files) assert(file === 'team.json' || file === 'team.schema.json'
125
128
  || file.startsWith('.evolcore/skills/') || file.startsWith('workspace/' + key + '/')
126
129
  || file.startsWith('agents/' + key + '/personal/soul/') && file.endsWith('.md') && !file.endsWith('/00-GUIDE.md')
@@ -139,15 +142,19 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
139
142
  try {
140
143
  const { default: semver } = await import('semver');
141
144
  assert(Array.isArray(pkg.compat?.platforms) && pkg.compat.platforms.includes(process.platform)
142
- && semver.validRange(pkg.compat.evolcore) && semver.satisfies(ec.version.replace(/-test\.\d+$/, ''), pkg.compat.evolcore, { includePrerelease: true }),
145
+ && semver.validRange(pkg.compat.evolcore)
146
+ && (semver.satisfies(ec.version, pkg.compat.evolcore, { includePrerelease: true })
147
+ || !pkg.compat.templateFeatures?.length && semver.satisfies(ec.version.replace(/-test\.\d+$/, ''), pkg.compat.evolcore, { includePrerelease: true }))
148
+ && (pkg.compat.templateFeatures === undefined || Array.isArray(pkg.compat.templateFeatures)
149
+ && pkg.compat.templateFeatures.every(feature => feature === 'member-references-v1')),
143
150
  'INCOMPATIBLE', 'Platform or EvolCore version is incompatible', { incompatible: ['platform/version'] });
144
151
  const selections = options.selections ?? {};
145
152
  for (const [name, block] of Object.entries(spec.config.baseagents ?? {})) {
146
153
  assert(BASEAGENTS.includes(name) && isRecord(block) && Object.keys(block).every(f => ['provider', 'model', 'effort', 'params'].includes(f)),
147
154
  'INVALID_ARGUMENT', 'Invalid baseagent block');
148
155
  }
149
- const { config: resolved, refs } = bindTemplateProviders(spec.config,
150
- { providers: options.providers ?? {}, selections, allowMissing: true });
156
+ const planned = planMemberConfig({ member: spec, vars, providers: options.providers ?? {}, selections, allowMissing: true, mode: options.planMode ?? 'overlay_existing' });
157
+ const resolved = planned.config; const refs = planned.providers;
151
158
  assert(resolved.baseagents?.[resolved.active_baseagent], 'INVALID_ARGUMENT', 'Default baseagent must be selected');
152
159
  assert(Object.keys(selections).every(name => resolved.baseagents?.[name]), 'INVALID_ARGUMENT', 'Unknown baseagent selection');
153
160
  const config = mergeObjects(targets, resolveProviderRefs(resolved));
@@ -6,6 +6,7 @@
6
6
  import fs from 'node:fs';
7
7
  import path from 'node:path';
8
8
  import { renderText, renderValue } from './template-runtime.mjs';
9
+ import { validateContractSchema } from './template-contract.mjs';
9
10
 
10
11
  /**
11
12
  * 替换 {{x.y}} 占位符;vars 里没有的保留原文。
@@ -25,38 +26,7 @@ export function renderPlaceholders(text, vars) {
25
26
  * @param {string} at
26
27
  * @returns {string[]}
27
28
  */
28
- export function validateAgainstSchema(value, schema, at = '$') {
29
- const errors = [];
30
- if (!schema || typeof schema !== 'object') return [`${at}: schema missing`];
31
- const types = Array.isArray(schema.type) ? schema.type : schema.type ? [schema.type] : [];
32
- if (types.length) {
33
- const actual = Array.isArray(value) ? 'array' : value === null ? 'null' : typeof value;
34
- const matches = types.some(t => t === actual || (t === 'integer' && Number.isInteger(value)) || (t === 'number' && typeof value === 'number'));
35
- if (!matches) return [`${at}: expected ${types.join('|')}, got ${actual}`];
36
- }
37
- if (schema.enum && !schema.enum.includes(value)) errors.push(`${at}: must be one of ${schema.enum.join(', ')}`);
38
- if (typeof value === 'string') {
39
- if (schema.minLength !== undefined && value.length < schema.minLength) errors.push(`${at}: shorter than ${schema.minLength}`);
40
- if (schema.pattern && !new RegExp(schema.pattern).test(value)) errors.push(`${at}: does not match ${schema.pattern}`);
41
- }
42
- if (typeof value === 'number' && schema.minimum !== undefined && value < schema.minimum) errors.push(`${at}: below ${schema.minimum}`);
43
- if (Array.isArray(value)) {
44
- if (schema.minItems !== undefined && value.length < schema.minItems) errors.push(`${at}: needs at least ${schema.minItems} items`);
45
- if (schema.items) value.forEach((v, i) => errors.push(...validateAgainstSchema(v, schema.items, `${at}[${i}]`)));
46
- }
47
- if (value && typeof value === 'object' && !Array.isArray(value)) {
48
- for (const req of schema.required ?? []) if (!Object.hasOwn(value, req)) errors.push(`${at}: missing "${req}"`);
49
- const props = schema.properties ?? {};
50
- for (const [k, v] of Object.entries(value)) {
51
- if (Object.hasOwn(props, k)) errors.push(...validateAgainstSchema(v, props[k], `${at}.${k}`));
52
- else if (schema.additionalProperties === false) errors.push(`${at}.${k}: not allowed`);
53
- else if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
54
- errors.push(...validateAgainstSchema(v, schema.additionalProperties, `${at}.${k}`));
55
- }
56
- }
57
- }
58
- return errors;
59
- }
29
+ export const validateAgainstSchema = validateContractSchema;
60
30
 
61
31
  /**
62
32
  * 把 baseagents.<x>.provider 的 { id, name } 换成 mapping[id] ?? id;字符串原样保留。
@@ -101,7 +71,7 @@ export function checkAgentProvider({ config, defaults = {}, providers = {}, base
101
71
  }
102
72
 
103
73
  /**
104
- * 读 <templateRoot>/agents/<key>/triggers/<id>/trigger.json,用 vars + { 'agent.aid': aid } 渲染,
74
+ * 读 <templateRoot>/agents/<key>/triggers/<id>/trigger.json,用 成员变量 渲染,
105
75
  * 经 ec.validateTrigger 校验,并核对 agentAid、id。不落盘。
106
76
  * 每个 trigger 记一条 rec.check(`trigger[<key>/<id>]`, …),名称与现在相同。
107
77
  * @param {{ templateRoot: string, key: string, aid: string, vars: Record<string, string>, ec: any, rec: any }} opts