evolcore 0.0.47 → 0.0.49

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 (266) hide show
  1. package/CHANGELOG.md +90 -1
  2. package/bin/ec-build.mjs +86 -0
  3. package/dist/agent-template/jobs.js +12 -4
  4. package/dist/agent-template/runtime.js +143 -40
  5. package/dist/agent-template/service.js +66 -13
  6. package/dist/agents/baseagent.js +60 -20
  7. package/dist/agents/claude-runner.js +34 -17
  8. package/dist/agents/codex-runner.js +36 -17
  9. package/dist/agents/ecagent-runner.js +7 -4
  10. package/dist/agents/gemini-runner.js +5 -2
  11. package/dist/agents/runner-types.js +5 -21
  12. package/dist/aun/aid/agentmd.js +5 -1
  13. package/dist/aun/msg/p2p.js +2 -1
  14. package/dist/aun/service-proxy.js +4 -2
  15. package/dist/build-identity.json +1 -0
  16. package/dist/channels/aun.js +722 -295
  17. package/dist/channels/daemon.js +9 -25
  18. package/dist/cli/aun-commands.js +86 -51
  19. package/dist/cli/code-stats.js +19 -8
  20. package/dist/cli/command-log.js +1 -1
  21. package/dist/cli/daemon-commands.js +44 -43
  22. package/dist/cli/directory.js +13 -2
  23. package/dist/cli/ecmsg-gateway.js +5 -2
  24. package/dist/cli/index.js +9 -9
  25. package/dist/cli/init-channel.js +4 -6
  26. package/dist/cli/init.js +72 -50
  27. package/dist/cli/invoke-command.js +1 -1
  28. package/dist/cli/managed-command-guard.js +2 -0
  29. package/dist/cli/model.js +20 -5
  30. package/dist/cli/provider-command.js +74 -13
  31. package/dist/cli/quota.js +89 -0
  32. package/dist/cli/role.js +62 -17
  33. package/dist/cli/services-command.js +1 -0
  34. package/dist/cli/stats.js +3 -3
  35. package/dist/cli/team-workspace-command.js +56 -2
  36. package/dist/cli/thread-command.js +16 -51
  37. package/dist/config/boot-log.js +3 -9
  38. package/dist/config/builtin-roles.js +5 -7
  39. package/dist/config/config-field-policy.js +71 -1
  40. package/dist/config/config-manager.js +13 -7
  41. package/dist/config/daemon-services.js +30 -3
  42. package/dist/config/gateway-config.js +2 -2
  43. package/dist/config/invoke-ipc-service.js +6 -4
  44. package/dist/config/peer-bind-code.js +3 -4
  45. package/dist/config/peer-book-store.js +62 -229
  46. package/dist/config/peer-book.js +26 -27
  47. package/dist/config/peer-role-resolver.js +16 -1
  48. package/dist/config/provider-identity-migration.js +4 -1
  49. package/dist/config/provider-ipc-service.js +56 -11
  50. package/dist/config/provider-menu-request.js +24 -5
  51. package/dist/config/provider-templates.js +127 -0
  52. package/dist/config/providers-config.js +67 -12
  53. package/dist/config/providers-management.js +477 -51
  54. package/dist/config/resolved-config-op.js +3 -2
  55. package/dist/config/role-command-service.js +248 -1
  56. package/dist/config/schema-migration.js +105 -4
  57. package/dist/core/agent-application-service.js +6 -1
  58. package/dist/core/agent-runtime.js +4 -0
  59. package/dist/core/auth/agent-delegation.js +2 -1
  60. package/dist/core/auth/auth-gateway.js +2 -1
  61. package/dist/core/auth/delegation-authorization.js +36 -26
  62. package/dist/core/auth/operation-authorizer.js +25 -0
  63. package/dist/core/auth/operation-catalog.js +37 -64
  64. package/dist/core/capability/providers/codex-capability-provider.js +7 -8
  65. package/dist/core/channel-loader.js +18 -0
  66. package/dist/core/command/agent-control.js +32 -0
  67. package/dist/core/command/cli-intent-parser.js +13 -0
  68. package/dist/core/command/command-handler.js +126 -87
  69. package/dist/core/command/menu-catalog.js +1 -0
  70. package/dist/core/command/menu-handler.js +67 -150
  71. package/dist/core/command/menu-protocol.js +31 -1
  72. package/dist/core/command/provider-menu.js +13 -3
  73. package/dist/core/command/remote-shell.js +565 -0
  74. package/dist/core/command/role-menu.js +47 -23
  75. package/dist/core/command/slash-handler.js +26 -43
  76. package/dist/core/command/team-workspace-items.js +81 -12
  77. package/dist/core/command/team-workspace-team.js +9 -71
  78. package/dist/core/command/topic-slash.js +9 -30
  79. package/dist/core/daemon-bootstrap.js +8 -1
  80. package/dist/core/daemon-control.js +64 -8
  81. package/dist/core/daemon-lifecycle.js +16 -2
  82. package/dist/core/evolagent-registry.js +20 -3
  83. package/dist/core/file-integrity/store.js +2 -0
  84. package/dist/core/handoff/runtime.js +37 -1
  85. package/dist/core/inference/text-inference.js +3 -1
  86. package/dist/core/initialization/service.js +11 -6
  87. package/dist/core/interaction-router.js +3 -0
  88. package/dist/core/invoke/executors/text.js +72 -19
  89. package/dist/core/ipc-registration.js +3 -1
  90. package/dist/core/message/aun-ipc-sender.js +279 -107
  91. package/dist/core/message/contact-admission.js +91 -6
  92. package/dist/core/message/contact-pending-inbound.js +113 -0
  93. package/dist/core/message/contact-thread-approval.js +212 -0
  94. package/dist/core/message/im-renderer.js +41 -2
  95. package/dist/core/message/message-admission.js +5 -39
  96. package/dist/core/message/message-bridge.js +140 -370
  97. package/dist/core/message/message-log.js +29 -0
  98. package/dist/core/message/message-queue.js +119 -15
  99. package/dist/core/message/message-utils.js +8 -0
  100. package/dist/core/message/response-engine.js +580 -134
  101. package/dist/core/message/send-routing.js +5 -1
  102. package/dist/core/model/catalog-service.js +31 -11
  103. package/dist/core/model/config-scope.js +6 -14
  104. package/dist/core/model/model-capabilities.js +22 -4
  105. package/dist/core/model/model-catalog.js +1 -0
  106. package/dist/core/model/model-diagnostics.js +19 -0
  107. package/dist/core/model/model-fallback.js +13 -2
  108. package/dist/core/ownership/owner-resolver.js +328 -50
  109. package/dist/core/pack-auth.js +3 -0
  110. package/dist/core/pack-install.js +1 -1
  111. package/dist/core/permission/ec-command-parser.js +106 -19
  112. package/dist/core/permission/protected-paths.js +6 -6
  113. package/dist/core/permission/services-path-acl.js +451 -0
  114. package/dist/core/permission/tool-policy.js +5 -1
  115. package/dist/core/relation/peer-identity.js +36 -1
  116. package/dist/core/relation/same-owner-proof.js +81 -112
  117. package/dist/core/session/adapters/codex-session-file-adapter.js +96 -15
  118. package/dist/core/session/session-file-health.js +13 -7
  119. package/dist/core/session/session-fs-store.js +91 -35
  120. package/dist/core/session/session-manager.js +68 -24
  121. package/dist/core/session/session-mapper.js +14 -34
  122. package/dist/core/session/session-transcript.js +5 -1
  123. package/dist/core/task/task-activity-store.js +84 -0
  124. package/dist/core/task/task-recovery-service.js +13 -0
  125. package/dist/core/thread/command-parser.js +7 -12
  126. package/dist/core/thread/thread-context-storage.js +3 -2
  127. package/dist/core/thread/thread-operation.js +2 -13
  128. package/dist/core/thread/thread-service.js +15 -46
  129. package/dist/core/thread/topic-id.js +15 -0
  130. package/dist/directory/owner-directory-admission.js +12 -9
  131. package/dist/directory/owner-directory-cache.js +64 -28
  132. package/dist/directory/owner-directory-markdown.js +14 -2
  133. package/dist/directory/owner-directory-policy.js +5 -30
  134. package/dist/directory/owner-directory-query-operation.js +29 -3
  135. package/dist/directory/owner-directory-remarks.js +11 -3
  136. package/dist/directory/owner-directory-request-operation.js +5 -2
  137. package/dist/eck/kit-renderer.js +1 -1
  138. package/dist/eck/message-renderer.js +112 -29
  139. package/dist/ecweb/basic-settings-service.js +3 -1
  140. package/dist/ecweb/message-context-service.js +1 -1
  141. package/dist/ecweb/pairing.js +4 -3
  142. package/dist/ecweb/providers-service.js +26 -1
  143. package/dist/ecweb/runtime/lifecycle.js +18 -8
  144. package/dist/ecweb/runtime/proxy-access.js +74 -0
  145. package/dist/ecweb/runtime/supervisor.js +36 -6
  146. package/dist/event-center/center-config.js +9 -5
  147. package/dist/event-center/dispatcher.js +10 -1
  148. package/dist/event-center/ipc-operation.js +19 -0
  149. package/dist/event-center/registry.js +29 -3
  150. package/dist/event-center/runtime.js +106 -11
  151. package/dist/event-center/script-runner.js +5 -5
  152. package/dist/index.js +96 -59
  153. package/dist/ipc.js +38 -3
  154. package/dist/outputs/authorization.js +16 -0
  155. package/dist/outputs/cards.js +336 -0
  156. package/dist/outputs/events.js +63 -0
  157. package/dist/outputs/protocol.js +103 -0
  158. package/dist/outputs/service.js +266 -0
  159. package/dist/paths.js +3 -0
  160. package/dist/proxy/manager.js +43 -13
  161. package/dist/services/index.js +114 -5
  162. package/dist/services/ipc-operation.js +88 -15
  163. package/dist/services/pack-manager.js +13 -1
  164. package/dist/services/router.js +21 -6
  165. package/dist/services/script-runner.js +5 -4
  166. package/dist/services/service-payload.js +13 -7
  167. package/dist/services/validation.js +1 -1
  168. package/dist/stats/budget.js +2 -2
  169. package/dist/stats/db.js +19 -0
  170. package/dist/stats/index.js +1 -1
  171. package/dist/stats/{price-resolver.js → model-resolver.js} +304 -23
  172. package/dist/stats/normalizer.js +2 -0
  173. package/dist/stats/query.js +35 -27
  174. package/dist/stats/quota-query.js +95 -0
  175. package/dist/stats/role-budget.js +5 -2
  176. package/dist/stats/writer.js +10 -6
  177. package/dist/trigger/audit.js +7 -0
  178. package/dist/trigger/authorization.js +105 -11
  179. package/dist/trigger/feedback.js +10 -0
  180. package/dist/trigger/history.js +37 -11
  181. package/dist/trigger/ipc-service.js +12 -1
  182. package/dist/trigger/manager.js +1 -0
  183. package/dist/trigger/scheduler.js +7 -5
  184. package/dist/trigger/script-executor.js +2 -1
  185. package/dist/trigger/script-sandbox.js +21 -3
  186. package/dist/trigger/validation.js +22 -0
  187. package/dist/utils/atomic-write.js +22 -8
  188. package/dist/utils/cross-platform.js +73 -26
  189. package/dist/utils/error-dict.json +94 -4
  190. package/dist/utils/error-utils.js +27 -4
  191. package/dist/utils/evolcore-version.js +36 -65
  192. package/dist/utils/host-info.js +100 -1
  193. package/dist/utils/msg-diag.js +1 -0
  194. package/dist/utils/npm-ops.js +43 -8
  195. package/dist/utils/process-introspect.js +12 -7
  196. package/dist/utils/process-tree.js +50 -2
  197. package/dist/utils/windows-shell-trust.js +2 -0
  198. package/dist/workbench/protocol.js +80 -0
  199. package/dist/workbench/service.js +359 -0
  200. package/ecagent/dist/types.d.ts +6 -2
  201. package/kits/docs/context-assembly.md +1 -1
  202. package/kits/docs/evolcore/INDEX.md +4 -2
  203. package/kits/docs/evolcore/aid.md +25 -0
  204. package/kits/docs/evolcore/config.md +16 -1
  205. package/kits/docs/evolcore/directory.md +30 -12
  206. package/kits/docs/evolcore/ecweb-lifecycle.md +15 -0
  207. package/kits/docs/evolcore/model.md +10 -0
  208. package/kits/docs/evolcore/msg.md +9 -0
  209. package/kits/docs/evolcore/peer.md +19 -65
  210. package/kits/docs/evolcore/provider.md +124 -4
  211. package/kits/docs/evolcore/quota.md +54 -0
  212. package/kits/docs/evolcore/role.md +83 -0
  213. package/kits/docs/evolcore/services.md +6 -6
  214. package/kits/docs/evolcore/stats.md +2 -0
  215. package/kits/docs/evolcore/team-workspace.md +1 -1
  216. package/kits/docs/evolcore/thread-chain.md +14 -15
  217. package/kits/docs/evolcore/tool-authorization.md +5 -0
  218. package/kits/docs/evolcore/trigger.md +12 -0
  219. package/kits/eck_message_manifest.json +12 -0
  220. package/kits/provider-templates.json +1213 -0
  221. package/kits/rules/04-relation.md +3 -3
  222. package/kits/schemas/_meta.json +14 -2
  223. package/kits/schemas/agent-config.schema.20.json +24 -0
  224. package/kits/schemas/contact-book.schema.4.json +52 -0
  225. package/kits/schemas/providers.schema.3.json +200 -0
  226. package/kits/skills/.switches.json +8 -0
  227. package/kits/skills/ability/references/calling.md +1 -1
  228. package/kits/skills/agent-output-cards/SKILL.md +57 -0
  229. package/kits/skills/ec-group/SKILL.md +2 -2
  230. package/kits/skills/ec-identity/SKILL.md +19 -72
  231. package/kits/skills/ec-provider/SKILL.md +270 -0
  232. package/kits/skills/ec-provider/scripts/check-model.mjs +80 -0
  233. package/kits/skills/ec-trigger/SKILL.md +1 -1
  234. package/kits/skills/thread-ops/SKILL.md +34 -21
  235. package/kits/templates/message-fragments/group-batch-item.md +1 -1
  236. package/kits/templates/message-fragments/group-batch.md +1 -1
  237. package/kits/templates/message-fragments/inject-default.md +1 -1
  238. package/kits/templates/message-fragments/interrupt-insert.md +1 -0
  239. package/kits/templates/message-fragments/item-group.md +1 -1
  240. package/kits/templates/message-fragments/item-private.md +1 -1
  241. package/kits/templates/message-fragments/thread-context.md +1 -1
  242. package/kits/templates/message-fragments/trigger-session.md +1 -1
  243. package/kits/templates/message-fragments/trigger-thread-check.md +1 -1
  244. package/kits/templates/roles/admin.json +2 -19
  245. package/kits/templates/roles/member.json +0 -3
  246. package/kits/templates/roles/visitor.json +1 -0
  247. package/kits/templates/system-fragments/baseagent.md +6 -0
  248. package/kits/templates/system-fragments/commands.md +4 -3
  249. package/kits/templates/system-fragments/directory-contacts.md +3 -4
  250. package/kits/templates/system-fragments/managed-runtime.md +1 -1
  251. package/kits/templates/system-fragments/relation.md +1 -1
  252. package/kits/templates/system-fragments/thread.md +7 -5
  253. package/kits/templates/system-fragments/venue.md +11 -0
  254. package/package.json +6 -4
  255. package/scripts/agent-template/inspect.mjs +50 -11
  256. package/scripts/agent-template/shared/common.mjs +11 -6
  257. package/scripts/agent-template/shared/team-schema.json +6 -4
  258. package/scripts/agent-template/shared/template-contract.mjs +62 -11
  259. package/scripts/agent-template/shared/template-package.mjs +189 -21
  260. package/scripts/agent-template/shared/template-runtime.mjs +54 -6
  261. package/scripts/agent-template/shared/template.mjs +2 -2
  262. package/scripts/agent-template/team-pack.mjs +52 -14
  263. package/dist/cli/peer.js +0 -127
  264. package/dist/config/peer-operation-service.js +0 -132
  265. package/dist/config/peer-request-service.js +0 -532
  266. package/dist/core/command/connect-menu.js +0 -624
@@ -4,7 +4,7 @@ import { createRequire } from 'module';
4
4
  import { execFileSync, execFile, spawn, spawnSync } from 'child_process';
5
5
  import { promisify, TextDecoder } from 'util';
6
6
  import fs from 'fs';
7
- import { getProcessStartTime, parseCimDate } from './process-introspect.js';
7
+ import { createWindowsProcessQuery, getProcessSnapshot, getProcessStartTime, parseCimDate } from './process-introspect.js';
8
8
  import { requireTrustedWindowsCmdPath, requireTrustedWindowsCmdPathAsync, WindowsShellTrustError, } from './windows-shell-trust.js';
9
9
  import { logger } from './logger.js';
10
10
  const execFileAsync = promisify(execFile);
@@ -990,33 +990,47 @@ export function findProcessesWithCommandLine(pattern) {
990
990
  // stable literal anchor first, then apply the requested regex locally.
991
991
  const anchor = windowsProcessSearchAnchor(pattern);
992
992
  const escapedAnchor = anchor.replace(/'/g, "''");
993
- const script = `$a='${escapedAnchor}'; Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine -like ('*' + $a + '*') } | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress`;
994
- const result = spawnSync('powershell', ['-NoProfile', '-Command', script], { encoding: null, timeout: 8000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true });
995
- const raw = decodeWindowsOutput(result.stdout).trim();
996
- if (raw) {
993
+ // Reuse the native WMI transport, but keep enumeration fresh and retain
994
+ // the original literal pre-filter. Wildcard anchors keep the old query.
995
+ let rows;
996
+ if (/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(anchor)) {
997
+ try {
998
+ const snapshot = getProcessSnapshot({ fresh: true });
999
+ if (snapshot.complete)
1000
+ rows = [...snapshot.commandLines]
1001
+ .filter(([, command]) => command.toLowerCase().includes(anchor.toLowerCase()))
1002
+ .map(([pid, commandLine]) => ({ ProcessId: pid, CommandLine: commandLine }));
1003
+ }
1004
+ catch { /* Retain the original query if snapshot collection failed. */ }
1005
+ }
1006
+ if (rows === undefined) {
1007
+ const script = `$a='${escapedAnchor}'; Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -and $_.CommandLine -like ('*' + $a + '*') } | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress`;
1008
+ const result = spawnSync('powershell', ['-NoProfile', '-Command', script], { encoding: null, timeout: 8000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true });
1009
+ const raw = decodeWindowsOutput(result.stdout).trim();
1010
+ if (!raw)
1011
+ return [];
997
1012
  const parsed = JSON.parse(raw);
998
- const rows = !parsed ? [] : Array.isArray(parsed) ? parsed : [parsed];
999
- const matcherCandidates = [pattern, pattern.replace(/\\\\/g, '\\')]
1000
- .filter((value, index, values) => values.indexOf(value) === index)
1001
- .map((value) => {
1002
- try {
1003
- return new RegExp(value, 'i');
1004
- }
1005
- catch {
1006
- return null;
1007
- }
1008
- })
1009
- .filter((value) => value !== null);
1010
- return rows
1011
- .filter(row => Number.isInteger(row.ProcessId) && row.ProcessId !== process.pid)
1012
- .filter(row => {
1013
- const commandLine = row.CommandLine || '';
1014
- const normalized = commandLine.replace(/\\/g, '/');
1015
- return matcherCandidates.some(matcher => matcher.test(commandLine) || matcher.test(normalized));
1016
- })
1017
- .map(row => ({ pid: row.ProcessId, commandLine: row.CommandLine || '' }));
1013
+ rows = !parsed ? [] : Array.isArray(parsed) ? parsed : [parsed];
1018
1014
  }
1019
- return [];
1015
+ const matcherCandidates = [pattern, pattern.replace(/\\\\/g, '\\')]
1016
+ .filter((value, index, values) => values.indexOf(value) === index)
1017
+ .map((value) => {
1018
+ try {
1019
+ return new RegExp(value, 'i');
1020
+ }
1021
+ catch {
1022
+ return null;
1023
+ }
1024
+ })
1025
+ .filter((value) => value !== null);
1026
+ return rows
1027
+ .filter(row => Number.isInteger(row.ProcessId) && row.ProcessId !== process.pid)
1028
+ .filter(row => {
1029
+ const commandLine = row.CommandLine || '';
1030
+ const normalized = commandLine.replace(/\\/g, '/');
1031
+ return matcherCandidates.some(matcher => matcher.test(commandLine) || matcher.test(normalized));
1032
+ })
1033
+ .map(row => ({ pid: row.ProcessId, commandLine: row.CommandLine || '' }));
1020
1034
  }
1021
1035
  else {
1022
1036
  const output = execFileSync('pgrep', ['-f', pattern], { encoding: 'utf-8' }).trim();
@@ -1117,9 +1131,42 @@ export async function findProcessByPortAsync(port) {
1117
1131
  }
1118
1132
  return [...pids];
1119
1133
  }
1134
+ const WINDOWS_WMI_PROCESS_INFO_SCRIPT = String.raw `
1135
+ var service = GetObject('winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2');
1136
+ var rows = new Enumerator(service.ExecQuery('SELECT ProcessId,WorkingSetSize,CreationDate FROM Win32_Process WHERE ProcessId=' + Number(WScript.Arguments(0))));
1137
+ for (; !rows.atEnd(); rows.moveNext()) {
1138
+ var item = rows.item();
1139
+ WScript.Echo('{"ProcessId":' + Number(item.ProcessId)
1140
+ + ',"WorkingSetSize":' + Number(item.WorkingSetSize)
1141
+ + ',"CreationDate":' + (item.CreationDate == null ? 'null' : '"' + String(item.CreationDate) + '"') + '}');
1142
+ }
1143
+ `;
1120
1144
  export function getProcessInfo(pid) {
1121
1145
  try {
1122
1146
  if (isWindows) {
1147
+ const query = createWindowsProcessQuery(WINDOWS_WMI_PROCESS_INFO_SCRIPT, pid);
1148
+ if (query) {
1149
+ try {
1150
+ const result = spawnSync(query.command, query.args, {
1151
+ encoding: 'utf8', timeout: 2000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true,
1152
+ });
1153
+ if (result.status === 0) {
1154
+ const row = JSON.parse(result.stdout || '');
1155
+ const memory = Number(row?.WorkingSetSize);
1156
+ const createdAt = typeof row?.CreationDate === 'string' ? parseCimDate(row.CreationDate) : null;
1157
+ if (row?.ProcessId === pid && Number.isFinite(memory) && memory > 0 && createdAt !== null) {
1158
+ return {
1159
+ memory: String(Math.round(memory / 1024)),
1160
+ uptime: formatUptime(Math.max(0, Math.floor((Date.now() - createdAt) / 1000))),
1161
+ };
1162
+ }
1163
+ }
1164
+ }
1165
+ catch { /* Keep the original transports when WMI scripting is unavailable. */ }
1166
+ finally {
1167
+ query.dispose();
1168
+ }
1169
+ }
1123
1170
  // WMIC was removed from recent Windows installations. Prefer the
1124
1171
  // supported CIM API and keep WMIC as a compatibility fallback.
1125
1172
  const psScript = `(Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}' | Select-Object WorkingSetSize,CreationDate | ConvertTo-Json -Compress)`;
@@ -24,16 +24,66 @@
24
24
  {
25
25
  "id": "invalid-api-key",
26
26
  "match": "invalid api key",
27
- "action": "stop",
27
+ "action": "ask",
28
28
  "type": "auth_error",
29
- "message": "❌ API Key 无效,请检查密钥配置。使用 /status 查看当前配置"
29
+ "message": "❌ API Key 无效,请更新服务商连接凭据",
30
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
30
31
  },
31
32
  {
32
33
  "id": "key-not-found",
33
34
  "match": "key_not_found",
34
- "action": "stop",
35
+ "action": "ask",
36
+ "type": "auth_error",
37
+ "message": "❌ API Key 未找到,请补充服务商连接凭据",
38
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
39
+ },
40
+ {
41
+ "id": "provider-key-missing",
42
+ "match": "has no API key",
43
+ "action": "ask",
44
+ "type": "auth_error",
45
+ "message": "请补充服务商 API Key / Token",
46
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
47
+ },
48
+ {
49
+ "id": "provider-environment-missing",
50
+ "match": "provider_connection_missing",
51
+ "action": "ask",
52
+ "type": "auth_error",
53
+ "message": "服务商连接配置不完整,请补充缺失信息",
54
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
55
+ },
56
+ {
57
+ "id": "provider-base-url-missing",
58
+ "match": "provider_base_url_missing",
59
+ "action": "ask",
60
+ "type": "auth_error",
61
+ "message": "请补充服务商地址",
62
+ "question": { "handler": "provider-connection", "fields": ["baseUrl"], "includeMissing": ["apiKey"] }
63
+ },
64
+ {
65
+ "id": "native-key-missing",
66
+ "match": "no api key found",
67
+ "action": "ask",
35
68
  "type": "auth_error",
36
- "message": "❌ API Key 未找到,请检查密钥配置"
69
+ "message": "请补充模型连接 API Key / Token",
70
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
71
+ },
72
+ {
73
+ "id": "codex-key-missing",
74
+ "match": "no codex credential found",
75
+ "action": "ask",
76
+ "type": "auth_error",
77
+ "message": "请补充模型连接 API Key / Token",
78
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
79
+ },
80
+ {
81
+ "id": "ecagent-key-missing",
82
+ "match": "no ecagent api key found",
83
+ "action": "ask",
84
+ "type": "auth_error",
85
+ "message": "请补充模型连接 API Key / Token",
86
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
37
87
  },
38
88
  {
39
89
  "id": "api-key-verifier-too-many-connections",
@@ -161,6 +211,46 @@
161
211
  "type": "unknown",
162
212
  "message": "❌ 权限不足,请联系管理员配置应用权限"
163
213
  },
214
+ {
215
+ "id": "provider-authentication-error",
216
+ "match": "authentication_error",
217
+ "action": "ask",
218
+ "type": "auth_error",
219
+ "message": "服务商认证失败,请更新 API Key / Token",
220
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
221
+ },
222
+ {
223
+ "id": "provider-invalid-credential",
224
+ "match": "provider_credential_invalid",
225
+ "action": "ask",
226
+ "type": "auth_error",
227
+ "message": "服务商认证失败,请更新 API Key / Token",
228
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
229
+ },
230
+ {
231
+ "id": "provider-http-401",
232
+ "match": "http 401",
233
+ "action": "ask",
234
+ "type": "auth_error",
235
+ "message": "服务商认证失败,请更新 API Key / Token",
236
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
237
+ },
238
+ {
239
+ "id": "provider-api-401",
240
+ "match": "api error: 401",
241
+ "action": "ask",
242
+ "type": "auth_error",
243
+ "message": "服务商认证失败,请更新 API Key / Token",
244
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
245
+ },
246
+ {
247
+ "id": "provider-status-401",
248
+ "match": "401 unauthorized",
249
+ "action": "ask",
250
+ "type": "auth_error",
251
+ "message": "服务商认证失败,请更新 API Key / Token",
252
+ "question": { "handler": "provider-connection", "fields": ["apiKey"], "includeMissing": ["baseUrl"] }
253
+ },
164
254
  {
165
255
  "id": "stream-error",
166
256
  "match": "stream",
@@ -296,7 +296,7 @@ export function prefixErrorType(prefix, errorType) {
296
296
  return `${prefix}:${errorType}`;
297
297
  }
298
298
  // ── 错误字典 ──────────────────────────────────────────────────────────
299
- const VALID_ACTIONS = new Set(['retry', 'stop', 'ignore']);
299
+ const VALID_ACTIONS = new Set(['retry', 'stop', 'ignore', 'ask']);
300
300
  let _dictPath = null;
301
301
  let _dictPathExplicit = false;
302
302
  let _rules = [];
@@ -337,11 +337,23 @@ function validateRule(r, index) {
337
337
  if (!r.match || typeof r.match !== 'string')
338
338
  return `rules[${index}] (${r.id}): 缺少 match 或类型不是 string`;
339
339
  if (!VALID_ACTIONS.has(r.action))
340
- return `rules[${index}] (${r.id}): action 无效 "${r.action}",允许值: retry/stop/ignore`;
340
+ return `rules[${index}] (${r.id}): action 无效 "${r.action}",允许值: retry/stop/ignore/ask`;
341
341
  if (r.type !== undefined && typeof r.type !== 'string')
342
342
  return `rules[${index}] (${r.id}): type 类型不是 string`;
343
343
  if (r.message !== undefined && typeof r.message !== 'string')
344
344
  return `rules[${index}] (${r.id}): message 类型不是 string`;
345
+ if (r.action === 'ask') {
346
+ const q = r.question;
347
+ const fields = (value) => Array.isArray(value)
348
+ && value.length <= 2 && value.every(field => field === 'apiKey' || field === 'baseUrl')
349
+ && new Set(value).size === value.length;
350
+ if (!q || q.handler !== 'provider-connection' || !fields(q.fields) || !q.fields.length
351
+ || (q.includeMissing !== undefined && !fields(q.includeMissing))) {
352
+ return `rules[${index}] (${r.id}): ask 需要合法的 provider-connection question`;
353
+ }
354
+ }
355
+ else if (r.question !== undefined)
356
+ return `rules[${index}] (${r.id}): question 仅用于 ask`;
345
357
  return null;
346
358
  }
347
359
  /**
@@ -427,6 +439,13 @@ export function matchErrorRule(errorMessage) {
427
439
  }
428
440
  return null;
429
441
  }
442
+ /** Ask is a terminal, human-assisted action. Match nested setup codes as well as provider messages. */
443
+ export function errorQuestionRule(error) {
444
+ const raw = getErrorRawText(error) ?? '';
445
+ const record = error && typeof error === 'object' ? error : undefined;
446
+ const rule = matchErrorRule(`${record?.code ?? ''}\n${record?.message ?? ''}\n${raw}`.toLowerCase());
447
+ return rule?.action === 'ask' ? rule : undefined;
448
+ }
430
449
  /** 获取当前已加载的规则数量(供测试和状态查询使用) */
431
450
  export function getLoadedRuleCount() {
432
451
  refreshDict();
@@ -520,7 +539,7 @@ export function classifyError(error) {
520
539
  return ErrorType.CONTEXT_TOO_LONG;
521
540
  }
522
541
  // 字典优先 — 命中则直接返回
523
- const rule = matchErrorRule(msg);
542
+ const rule = errorQuestionRule(error) ?? matchErrorRule(msg);
524
543
  if (rule) {
525
544
  if (rule.type)
526
545
  return rule.type;
@@ -528,6 +547,8 @@ export function classifyError(error) {
528
547
  return ErrorType.API_ERROR;
529
548
  if (rule.action === 'stop')
530
549
  return ErrorType.AUTH_ERROR;
550
+ if (rule.action === 'ask')
551
+ return ErrorType.INPUT_REQUIRED;
531
552
  return ErrorType.UNKNOWN;
532
553
  }
533
554
  // 内置兜底规则(结构性、稳定的错误模式)
@@ -574,6 +595,8 @@ export function isRetryableError(error) {
574
595
  return false;
575
596
  if (isPolicyRejectedError(error))
576
597
  return false;
598
+ if (errorQuestionRule(error))
599
+ return false;
577
600
  const msg = error?.message || String(error);
578
601
  const lower = msg.toLowerCase();
579
602
  if (lower.includes('invalid jsonl session file') || lower.includes('invalid session file'))
@@ -713,7 +736,7 @@ export function getErrorMessage(error, terminalReason, includeEmoji = true) {
713
736
  return `${warnPrefix}当前会话已失效,请发送 /renew。`;
714
737
  }
715
738
  // 字典优先 — 命中且有自定义消息则直接返回
716
- const rule = matchErrorRule(msg.toLowerCase());
739
+ const rule = errorQuestionRule(error) ?? matchErrorRule(msg.toLowerCase());
717
740
  if (rule?.message && (!isContextTooLongText(msg) || rule.type === ErrorType.CONTEXT_TOO_LONG))
718
741
  return rule.message;
719
742
  // 内置兜底规则(结构性错误)
@@ -3,6 +3,11 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { getPackageRoot } from '../paths.js';
6
+ // Embedded by bin/ec-build.mjs; loaded processes retain these values across rebuilds.
7
+ // @evolcore-build-identity:start
8
+ export const RUNTIME_BUILD_ID = "sha256:12c2256a403ff169bb86c416";
9
+ export const RUNTIME_BUILD_TIME = "2026-11-15T03:59:05.194Z";
10
+ // @evolcore-build-identity:end
6
11
  let cachedVersion;
7
12
  let cachedFlavor;
8
13
  let cachedStartStamp;
@@ -170,10 +175,23 @@ export function computeBuildId(distDir) {
170
175
  try {
171
176
  const hash = crypto.createHash('sha256');
172
177
  for (const relative of collectFiles(distDir)) {
178
+ const normalized = relative.replaceAll(path.sep, '/');
179
+ if (['build-identity.json', 'build-identity.json.tmp'].includes(normalized))
180
+ continue;
173
181
  const full = path.join(distDir, relative);
174
- hash.update(relative.replaceAll(path.sep, '/'));
182
+ let content = fs.readFileSync(full);
183
+ if (normalized === 'utils/evolcore-version.js') {
184
+ // Match the build writer without excluding changes to this module's implementation.
185
+ content = Buffer.from(content.toString('utf8').replace(/^\/\/ @evolcore-build-identity:start\r?\n[\s\S]*?^\/\/ @evolcore-build-identity:end[ \t]*(?=\r?$)/gm, [
186
+ '// @evolcore-build-identity:start',
187
+ 'export const RUNTIME_BUILD_ID = null;',
188
+ 'export const RUNTIME_BUILD_TIME = null;',
189
+ '// @evolcore-build-identity:end',
190
+ ].join('\n')));
191
+ }
192
+ hash.update(normalized);
175
193
  hash.update('\0');
176
- hash.update(fs.readFileSync(full));
194
+ hash.update(content);
177
195
  hash.update('\0');
178
196
  }
179
197
  return `sha256:${hash.digest('hex').slice(0, 24)}`;
@@ -184,56 +202,21 @@ export function computeBuildId(distDir) {
184
202
  }
185
203
  export function readBuildIdentity(distDir, version) {
186
204
  return {
187
- id: computeBuildId(distDir),
205
+ id: readBuildMarker(distDir)?.id ?? null,
188
206
  entry: path.join(distDir, 'index.js'),
189
207
  ...(version ? { version } : {}),
190
208
  };
191
209
  }
192
- /** Keep the same content hash as computeBuildId without blocking the event loop. */
193
- async function readBuildTreeAsync(root, hashFiles = true) {
194
- let latestMtime = 0;
210
+ function readBuildMarker(distDir) {
195
211
  try {
196
- const files = [];
197
- const collect = async (directory) => {
198
- const entries = await fs.promises.readdir(directory, { withFileTypes: true });
199
- for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
200
- if (!hashFiles && entry.name === 'node_modules')
201
- continue;
202
- const full = path.join(directory, entry.name);
203
- if (entry.isDirectory())
204
- await collect(full);
205
- else if (entry.isFile())
206
- files.push(full);
207
- }
208
- };
209
- await collect(root);
210
- const hash = crypto.createHash('sha256');
211
- for (let offset = 0; offset < files.length; offset += 8) {
212
- const batch = await Promise.all(files.slice(offset, offset + 8).map(async (file) => {
213
- const [content, stat] = await Promise.all([
214
- hashFiles ? fs.promises.readFile(file) : undefined,
215
- /\.(js|ts)$/.test(file) ? fs.promises.stat(file) : undefined,
216
- ]);
217
- return { file, content, stat };
218
- }));
219
- for (const { file, content, stat } of batch) {
220
- if (stat)
221
- latestMtime = Math.max(latestMtime, stat.mtimeMs);
222
- if (content) {
223
- hash.update(path.relative(root, file).replaceAll(path.sep, '/'));
224
- hash.update('\0');
225
- hash.update(content);
226
- hash.update('\0');
227
- }
228
- }
229
- }
230
- return { id: hashFiles ? `sha256:${hash.digest('hex').slice(0, 24)}` : null, latestMtime };
231
- }
232
- catch {
233
- return { id: null, latestMtime };
212
+ const marker = JSON.parse(fs.readFileSync(path.join(distDir, 'build-identity.json'), 'utf8'));
213
+ if (/^sha256:[a-f0-9]{24}$/.test(marker?.id) && typeof marker.builtAt === 'string'
214
+ && Number.isFinite(Date.parse(marker.builtAt)))
215
+ return marker;
234
216
  }
217
+ catch { /* Older or incomplete builds have no identity; never fall back to a tree scan. */ }
235
218
  }
236
- /** Cheap initial status; the full build identity is published after hashing. */
219
+ /** Capture the imported runtime identity before background work or later rebuilds. */
237
220
  export function createEvolcoreStartupDiagnostics(entryUrl) {
238
221
  const packageRoot = getPackageRoot();
239
222
  const runtimeEntry = fileURLToPath(entryUrl);
@@ -241,46 +224,34 @@ export function createEvolcoreStartupDiagnostics(entryUrl) {
241
224
  const runtimeIsDist = path.resolve(path.dirname(runtimeEntry)) === path.resolve(diskDistDir);
242
225
  return {
243
226
  state: 'pending', runtimeIsDist, diskDistDir, diskDistId: null,
244
- runtimeBuildIdentity: { id: null, entry: path.join(diskDistDir, 'index.js'), version: readInstalledEvolcoreVersion() },
227
+ runtimeBuildIdentity: { id: runtimeIsDist ? RUNTIME_BUILD_ID : null,
228
+ entry: runtimeEntry, version: readInstalledEvolcoreVersion() },
245
229
  };
246
230
  }
247
231
  export async function reportEvolcoreStartup(entryUrl, report, diagnostics = createEvolcoreStartupDiagnostics(entryUrl)) {
248
232
  const packageRoot = getPackageRoot();
249
233
  const { runtimeIsDist, diskDistDir } = diagnostics;
250
- const [dist, source] = await Promise.all([
251
- readBuildTreeAsync(diskDistDir),
252
- runtimeIsDist ? undefined : readBuildTreeAsync(path.join(packageRoot, 'src'), false),
253
- ]);
254
- const diskDistId = dist.id;
255
- const runtimeBuildIdentity = {
256
- id: runtimeIsDist ? diskDistId : null,
257
- entry: path.join(diskDistDir, 'index.js'),
258
- version: readInstalledEvolcoreVersion(),
259
- };
260
- // Publish both IDs together. Pending/failed reads must never claim a match.
234
+ const marker = readBuildMarker(diskDistDir);
235
+ const diskDistId = marker?.id ?? null;
236
+ const runtimeBuildIdentity = diagnostics.runtimeBuildIdentity;
261
237
  Object.assign(diagnostics, {
262
- state: diskDistId === null ? 'unavailable' : 'ready', runtimeBuildIdentity, diskDistId,
238
+ state: diskDistId === null || (runtimeIsDist && runtimeBuildIdentity.id === null) ? 'unavailable' : 'ready', diskDistId,
263
239
  });
264
240
  const isLinked = fs.existsSync(path.join(packageRoot, '.git'));
265
241
  const directoryType = runtimeIsDist ? (isLinked ? '开发仓/dist' : '安装路径/dist') : '源码(tsx)';
266
- const latestMtime = source?.latestMtime ?? dist.latestMtime;
267
242
  let version = '?';
268
243
  try {
269
244
  version = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf-8')).version;
270
245
  }
271
246
  catch { }
272
- const formatTime = (milliseconds) => {
273
- const date = new Date(milliseconds);
274
- return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())}`;
275
- };
276
247
  console.error(`[EvolCore] EvolCore v${version}`);
277
248
  console.error(`[EvolCore] 执行类型: ${directoryType}`);
278
249
  console.error(`[EvolCore] 包路径: ${packageRoot}`);
279
- console.error(`[EvolCore] 代码时间: ${latestMtime ? formatTime(latestMtime) : '?'}`);
250
+ console.error(`[EvolCore] 构建时间: ${runtimeIsDist ? (RUNTIME_BUILD_TIME ?? '?') : 'source'}`);
280
251
  console.error('[EvolCore] ✓ Version info printed');
281
252
  const diskBuildId = diskDistId;
282
253
  console.error(`[EvolCore] 运行 build ID: ${runtimeIsDist ? (runtimeBuildIdentity.id ?? '?') : 'source'}`);
283
254
  console.error(`[EvolCore] 磁盘 dist build ID: ${diskBuildId ?? '?'}`);
284
- report(`[Build] runtimeMode=${runtimeIsDist ? 'dist' : 'source'} runtimeBuildId=${runtimeBuildIdentity.id ?? 'source'} diskDistBuildId=${diskBuildId ?? 'unknown'} match=${runtimeIsDist && runtimeBuildIdentity.id !== null && runtimeBuildIdentity.id === diskBuildId}`);
255
+ report(`[Build] runtimeMode=${runtimeIsDist ? 'dist' : 'source'} runtimeBuildId=${runtimeBuildIdentity.id ?? (runtimeIsDist ? 'unknown' : 'source')} diskDistBuildId=${diskBuildId ?? 'unknown'} match=${runtimeIsDist && runtimeBuildIdentity.id !== null && runtimeBuildIdentity.id === diskBuildId}`);
285
256
  return diagnostics;
286
257
  }
@@ -128,6 +128,105 @@ function readDisk(evolcoreHomePath) {
128
128
  return { evolcoreHomePath, availableBytes: null, totalBytes: null };
129
129
  }
130
130
  }
131
+ function readText(file) {
132
+ try {
133
+ return fs.readFileSync(file, 'utf8').trim();
134
+ }
135
+ catch {
136
+ return null;
137
+ }
138
+ }
139
+ function parseQuota(quota, period) {
140
+ if (!quota || !period || !/^\d+$/u.test(quota) || !/^\d+$/u.test(period))
141
+ return null;
142
+ const value = Number(quota) / Number(period);
143
+ return Number.isFinite(value) && value > 0 ? value : null;
144
+ }
145
+ /** Resolve the process's own CPU hierarchy, including nonstandard mount points. */
146
+ function cpuHierarchies() {
147
+ const memberships = (readText('/proc/self/cgroup') ?? '').split('\n')
148
+ .map(line => line.match(/^\d+:([^:]*):(\/.*)$/u))
149
+ .filter((match) => match !== null);
150
+ const hierarchies = [];
151
+ const unescapePath = (value) => value.replace(/\\([0-7]{3})/gu, (_match, octal) => String.fromCharCode(Number.parseInt(octal, 8)));
152
+ for (const line of (readText('/proc/self/mountinfo') ?? '').split('\n')) {
153
+ const [mount, filesystem] = line.split(' - ');
154
+ if (!mount || !filesystem)
155
+ continue;
156
+ const fields = mount.split(' ');
157
+ const [type, , options = ''] = filesystem.split(' ');
158
+ if (type !== 'cgroup2' && !(type === 'cgroup' && options.split(',').includes('cpu')))
159
+ continue;
160
+ if (!fields[3] || !fields[4])
161
+ continue;
162
+ const version = type === 'cgroup2' ? 2 : 1;
163
+ const member = memberships.find(match => version === 2
164
+ ? match[1] === '' : match[1].split(',').includes('cpu'));
165
+ if (!member)
166
+ continue;
167
+ const root = unescapePath(fields[3]);
168
+ const mountPoint = unescapePath(fields[4]);
169
+ const relative = path.posix.relative(root, member[2]);
170
+ // A cgroup namespace can expose membership relative to the mounted root.
171
+ const suffix = relative === '..' || relative.startsWith('../') ? member[2] : relative;
172
+ const directory = path.posix.resolve(mountPoint, `./${suffix}`);
173
+ if (directory !== mountPoint && !directory.startsWith(`${mountPoint}/`))
174
+ continue;
175
+ hierarchies.push({ directory, mountPoint, version });
176
+ }
177
+ // Conventional namespace-root mounts also work when procfs is unavailable.
178
+ if (hierarchies.length === 0) {
179
+ for (const [mountPoint, version] of [
180
+ ['/sys/fs/cgroup', 2], ['/sys/fs/cgroup/cpu', 1],
181
+ ['/sys/fs/cgroup/cpu,cpuacct', 1], ['/sys/fs/cgroup/cpuacct,cpu', 1],
182
+ ]) {
183
+ const member = memberships.find(match => version === 2
184
+ ? match[1] === '' : match[1].split(',').includes('cpu'));
185
+ const directory = path.posix.resolve(mountPoint, `.${member?.[2] ?? '/'}`);
186
+ if (directory === mountPoint || directory.startsWith(`${mountPoint}/`)) {
187
+ hierarchies.push({ directory, mountPoint, version });
188
+ }
189
+ }
190
+ }
191
+ return hierarchies;
192
+ }
193
+ /**
194
+ * CPU capacity available to this process. Linux quota/period may be fractional;
195
+ * availableParallelism alone reports an integer suitable for worker counts.
196
+ * Read afresh so live container quota changes are reflected without a restart.
197
+ */
198
+ export function readEffectiveCpuCount() {
199
+ let count = 1;
200
+ try {
201
+ const parallelism = os.availableParallelism();
202
+ if (Number.isInteger(parallelism) && parallelism > 0)
203
+ count = parallelism;
204
+ else
205
+ count = Math.max(1, os.cpus().length);
206
+ }
207
+ catch {
208
+ try {
209
+ count = Math.max(1, os.cpus().length);
210
+ }
211
+ catch { /* retain one CPU */ }
212
+ }
213
+ if (process.platform !== 'linux')
214
+ return count;
215
+ for (const hierarchy of cpuHierarchies()) {
216
+ let directory = hierarchy.directory;
217
+ while (true) {
218
+ const quota = hierarchy.version === 2
219
+ ? parseQuota(...(readText(`${directory}/cpu.max`) ?? '').split(/\s+/u))
220
+ : parseQuota(readText(`${directory}/cpu.cfs_quota_us`) ?? undefined, readText(`${directory}/cpu.cfs_period_us`) ?? undefined);
221
+ if (quota !== null)
222
+ count = Math.min(count, quota);
223
+ if (directory === hierarchy.mountPoint)
224
+ break;
225
+ directory = path.posix.dirname(directory);
226
+ }
227
+ }
228
+ return count;
229
+ }
131
230
  function readCpuModel() {
132
231
  try {
133
232
  const model = os.cpus()[0]?.model?.trim().replace(/\s+/gu, ' ');
@@ -164,7 +263,7 @@ export function readHostInfo(evolcoreVersion, evolcoreHomePath, options = {}) {
164
263
  },
165
264
  hardware: {
166
265
  architecture: process.arch,
167
- cpuCount: os.cpus().length,
266
+ cpuCount: readEffectiveCpuCount(),
168
267
  cpuModel: readCpuModel(),
169
268
  memoryTotalBytes: memInfo.memTotal,
170
269
  memoryUsedBytes: memInfo.memUsed,
@@ -85,6 +85,7 @@ export function diagLog(stage, data) {
85
85
  to: shortId(data.to ?? ''),
86
86
  msgId: data.msgId ?? '',
87
87
  taskId: data.taskId,
88
+ sessionId: data.sessionId,
88
89
  preview: cut(data.text ?? '', 50),
89
90
  };
90
91
  const fd = getFd();