evolcore 0.0.43-test.5 → 0.0.43-test.7

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 (259) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/bin/ecmsg.js +281 -81
  3. package/dist/agents/baseagent-availability.js +20 -5
  4. package/dist/agents/baseagent.js +2 -2
  5. package/dist/agents/claude-runner.js +19 -4
  6. package/dist/agents/codex/app-server-client.js +36 -3
  7. package/dist/agents/codex-runner.js +75 -8
  8. package/dist/aun/group/invite-service.js +3 -2
  9. package/dist/aun/msg/p2p.js +6 -1
  10. package/dist/aun/service-proxy.js +18 -6
  11. package/dist/channels/aun.js +306 -30
  12. package/dist/cli/agent-create.js +18 -8
  13. package/dist/cli/aun-commands.js +9 -1
  14. package/dist/cli/daemon-commands.js +34 -65
  15. package/dist/cli/daemon-lifecycle-client.js +61 -0
  16. package/dist/cli/ecmsg-gateway.js +38 -3
  17. package/dist/cli/events-command.js +73 -0
  18. package/dist/cli/index.js +31 -14
  19. package/dist/cli/init.js +75 -0
  20. package/dist/cli/invoke-command.js +182 -0
  21. package/dist/cli/managed-command-guard.js +6 -1
  22. package/dist/cli/provider-command.js +1 -1
  23. package/dist/cli/restart-monitor.js +67 -50
  24. package/dist/cli/services-command.js +111 -0
  25. package/dist/cli/task-context.js +38 -1
  26. package/dist/cli/team-workspace-command.js +134 -0
  27. package/dist/cli/thread-command.js +6 -2
  28. package/dist/cli/watch-logs.js +6 -4
  29. package/dist/cli/watch-msg.js +1 -1
  30. package/dist/config/boot-log.js +6 -4
  31. package/dist/config/builtin-roles.js +2 -2
  32. package/dist/config/config-field-policy.js +2 -2
  33. package/dist/config/config-manager.js +1 -8
  34. package/dist/config/invoke-ipc-service.js +118 -0
  35. package/dist/config/peer-role-resolver.js +1 -1
  36. package/dist/config/provider-identity-migration.js +92 -17
  37. package/dist/config/provider-local-sync.js +2 -0
  38. package/dist/config/providers-config.js +13 -0
  39. package/dist/config/providers-management.js +100 -10
  40. package/dist/config/role-service.js +8 -8
  41. package/dist/config/role-store.js +22 -22
  42. package/dist/config/schema-migration.js +86 -88
  43. package/dist/config/snapshot.js +70 -41
  44. package/dist/config-store.js +2 -1
  45. package/dist/core/agent-reload-coordinator.js +6 -4
  46. package/dist/core/agent-runtime.js +146 -15
  47. package/dist/core/auth/delegation-authorization.js +66 -0
  48. package/dist/core/auth/operation-catalog.js +20 -0
  49. package/dist/core/baseagent-loader.js +75 -42
  50. package/dist/core/channel-loader.js +45 -13
  51. package/dist/core/channel-runtime.js +116 -45
  52. package/dist/core/command/agent-control.js +1 -1
  53. package/dist/core/command/agent-storage-menu.js +1 -1
  54. package/dist/core/command/chatmode-config.js +2 -36
  55. package/dist/core/command/command-handler.js +58 -16
  56. package/dist/core/command/data-root-resolver.js +32 -23
  57. package/dist/core/command/eventcenter-menu.js +338 -0
  58. package/dist/core/command/menu-catalog.js +8 -0
  59. package/dist/core/command/menu-handler.js +206 -87
  60. package/dist/core/command/menu-protocol.js +142 -22
  61. package/dist/core/command/menu-query-batch.js +194 -0
  62. package/dist/core/command/role-menu.js +27 -15
  63. package/dist/core/command/slash-gate.js +1 -1
  64. package/dist/core/command/slash-handler.js +34 -42
  65. package/dist/core/command/team-workspace-bootstrap.js +350 -0
  66. package/dist/core/command/{pa-workspace-calendar.js → team-workspace-calendar.js} +7 -7
  67. package/dist/core/command/team-workspace-initializer.js +2 -0
  68. package/dist/core/command/{pa-workspace-items.js → team-workspace-items.js} +83 -68
  69. package/dist/core/command/team-workspace-job-store.js +88 -0
  70. package/dist/core/command/team-workspace-management-service.js +2 -0
  71. package/dist/core/command/team-workspace-management-store.js +96 -0
  72. package/dist/core/command/team-workspace-management.js +265 -0
  73. package/dist/core/command/team-workspace-members-menu.js +88 -0
  74. package/dist/core/command/team-workspace-store.js +612 -0
  75. package/dist/core/command/team-workspace-team.js +193 -0
  76. package/dist/core/daemon-control.js +45 -15
  77. package/dist/core/daemon-lifecycle.js +478 -75
  78. package/dist/core/handoff/dispatcher.js +9 -3
  79. package/dist/core/handoff/runtime.js +130 -42
  80. package/dist/core/handoff/store.js +190 -2
  81. package/dist/core/handoff/types.js +5 -0
  82. package/dist/core/initialization/service.js +4 -4
  83. package/dist/core/invoke/executors/index.js +13 -0
  84. package/dist/core/invoke/executors/media.js +283 -0
  85. package/dist/core/invoke/executors/text.js +198 -0
  86. package/dist/core/invoke/invoke-service.js +157 -0
  87. package/dist/core/invoke/style-router.js +48 -0
  88. package/dist/core/invoke/types.js +19 -0
  89. package/dist/core/ipc-registration.js +51 -11
  90. package/dist/core/lifecycle-notice.js +10 -4
  91. package/dist/core/memory/consolidation.js +7 -5
  92. package/dist/core/message/aun-ipc-sender.js +149 -19
  93. package/dist/core/message/im-renderer.js +28 -84
  94. package/dist/core/message/message-bridge.js +57 -4
  95. package/dist/core/message/message-queue.js +46 -4
  96. package/dist/core/message/message-utils.js +10 -2
  97. package/dist/core/message/peer-mode.js +7 -34
  98. package/dist/core/message/pending-hints.js +4 -10
  99. package/dist/core/message/response-engine.js +163 -52
  100. package/dist/core/message/send-options.js +7 -4
  101. package/dist/core/message/send-routing.js +55 -7
  102. package/dist/core/ownership/owner-resolver.js +8 -0
  103. package/dist/core/permission/ec-command-parser.js +14 -3
  104. package/dist/core/permission/protected-paths.js +12 -2
  105. package/dist/core/permission/shell-environment.js +9 -0
  106. package/dist/core/session/adapters/claude-session-file-adapter.js +24 -0
  107. package/dist/core/session/adapters/codex-session-file-adapter.js +80 -0
  108. package/dist/core/session/adapters/ecagent-session-file-adapter.js +22 -0
  109. package/dist/core/session/adapters/gemini-session-file-adapter.js +39 -0
  110. package/dist/core/session/session-file-health.js +243 -0
  111. package/dist/core/session/session-fs-store.js +163 -3
  112. package/dist/core/session/session-idle-monitor.js +9 -1
  113. package/dist/core/session/session-manager.js +36 -2
  114. package/dist/core/task/task-recovery-service.js +13 -2
  115. package/dist/core/thread/command-parser.js +9 -2
  116. package/dist/core/thread/thread-operation.js +21 -2
  117. package/dist/core/thread/thread-route.js +13 -2
  118. package/dist/directory/owner-directory-admission.js +42 -30
  119. package/dist/directory/owner-directory-cache.js +143 -126
  120. package/dist/directory/owner-directory-query-operation.js +9 -8
  121. package/dist/eck/kit-renderer.js +7 -5
  122. package/dist/ecweb/basic-settings-service.js +1 -1
  123. package/dist/ecweb/message-context-service.js +0 -4
  124. package/dist/ecweb/runtime/lifecycle.js +14 -8
  125. package/dist/ecweb/runtime/supervisor.js +62 -30
  126. package/dist/event-center/admission-materializer.js +114 -0
  127. package/dist/event-center/bus-gate.js +136 -0
  128. package/dist/event-center/bus-host.js +290 -0
  129. package/dist/event-center/bus-resolver.js +120 -0
  130. package/dist/event-center/center-config.js +100 -0
  131. package/dist/event-center/client-factory.js +50 -0
  132. package/dist/event-center/daemon.js +45 -0
  133. package/dist/event-center/directory-source.js +53 -0
  134. package/dist/event-center/dispatcher.js +157 -0
  135. package/dist/event-center/event-log.js +110 -0
  136. package/dist/event-center/index-generator.js +63 -0
  137. package/dist/event-center/ipc-operation.js +308 -0
  138. package/dist/event-center/ledger.js +52 -0
  139. package/dist/event-center/pack-loader.js +202 -0
  140. package/dist/event-center/pack-manager.js +85 -0
  141. package/dist/event-center/registry.js +238 -0
  142. package/dist/event-center/runtime.js +641 -0
  143. package/dist/event-center/script-runner.js +356 -0
  144. package/dist/event-center/types.js +35 -0
  145. package/dist/event-center/validation.js +413 -0
  146. package/dist/index.js +751 -268
  147. package/dist/ipc.js +66 -12
  148. package/dist/paths.js +20 -0
  149. package/dist/product.js +14 -0
  150. package/dist/proxy/manager.js +43 -18
  151. package/dist/proxy/service-supervisor.js +78 -35
  152. package/dist/response-system/engines/v1/index.js +0 -1
  153. package/dist/response-system/modes/single-session/index.js +1 -1
  154. package/dist/services/dispatcher.js +100 -0
  155. package/dist/services/idempotency.js +90 -0
  156. package/dist/services/identity.js +52 -0
  157. package/dist/services/index-generator.js +70 -0
  158. package/dist/services/index.js +449 -0
  159. package/dist/services/ipc-operation.js +458 -0
  160. package/dist/services/ledger.js +52 -0
  161. package/dist/services/message-log.js +112 -0
  162. package/dist/services/pack-manager.js +204 -0
  163. package/dist/services/reply.js +55 -0
  164. package/dist/services/router.js +95 -0
  165. package/dist/services/script-runner.js +422 -0
  166. package/dist/services/service-payload.js +70 -0
  167. package/dist/services/types.js +18 -0
  168. package/dist/services/validation.js +297 -0
  169. package/dist/trigger/application-service.js +21 -1
  170. package/dist/trigger/audit.js +19 -4
  171. package/dist/trigger/authorization.js +14 -5
  172. package/dist/trigger/event-source.js +1 -1
  173. package/dist/trigger/history.js +176 -7
  174. package/dist/trigger/ipc-service.js +3 -1
  175. package/dist/trigger/manager.js +1 -3
  176. package/dist/trigger/scheduler.js +78 -5
  177. package/dist/trigger/script-sandbox.js +118 -22
  178. package/dist/utils/cross-platform.js +175 -13
  179. package/dist/utils/evolcore-version.js +69 -27
  180. package/dist/utils/host-info.js +11 -8
  181. package/dist/utils/instance-registry.js +19 -13
  182. package/dist/utils/npm-ops.js +48 -0
  183. package/dist/utils/process-introspect.js +109 -10
  184. package/dist/utils/startup-trace.js +222 -44
  185. package/dist/utils/windows-shell-trust.js +80 -6
  186. package/kits/docs/INDEX.md +2 -2
  187. package/kits/docs/aun/ABILITY_CALLING.md +10 -17
  188. package/kits/docs/context-assembly.md +1 -1
  189. package/kits/docs/evolcore/INDEX.md +5 -2
  190. package/kits/docs/evolcore/ability.md +4 -0
  191. package/kits/docs/evolcore/aid.md +1 -1
  192. package/kits/docs/evolcore/ctl.md +2 -1
  193. package/kits/docs/evolcore/event-center.md +207 -0
  194. package/kits/docs/evolcore/file-navigation.md +10 -264
  195. package/kits/docs/evolcore/fs.md +3 -2
  196. package/kits/docs/evolcore/group.md +2 -2
  197. package/kits/docs/evolcore/memory-architecture.md +2 -0
  198. package/kits/docs/evolcore/menu-exec-schema-commands.md +1 -1
  199. package/kits/docs/evolcore/menu-protocol.md +21 -0
  200. package/kits/docs/evolcore/msg.md +27 -8
  201. package/kits/docs/evolcore/provider.md +23 -3
  202. package/kits/docs/evolcore/response.md +5 -5
  203. package/kits/docs/evolcore/services.md +277 -0
  204. package/kits/docs/evolcore/task.md +2 -0
  205. package/kits/docs/evolcore/team-workspace.md +41 -0
  206. package/kits/eck_manifest.json +45 -7
  207. package/kits/eck_message_manifest.json +3 -3
  208. package/kits/rules/02-navigation.md +10 -1
  209. package/kits/rules/06-channel.md +5 -6
  210. package/kits/schemas/_meta.json +17 -6
  211. package/kits/schemas/agent-config.schema.19.json +5 -7
  212. package/kits/schemas/agent-config.schema.20.json +936 -0
  213. package/kits/schemas/daemon.schema.1.json +5 -0
  214. package/kits/schemas/daemon.schema.2.json +5 -0
  215. package/kits/schemas/daemon.schema.3.json +2 -1
  216. package/kits/schemas/daemon.schema.4.json +2 -1
  217. package/kits/schemas/daemon.schema.5.json +2 -1
  218. package/kits/schemas/daemon.schema.6.json +1 -1
  219. package/kits/schemas/daemon.schema.7.json +1 -1
  220. package/kits/schemas/daemon.schema.8.json +2 -1
  221. package/kits/schemas/daemon.schema.9.json +2 -1
  222. package/kits/schemas/relation-config.schema.12.json +2 -3
  223. package/kits/schemas/role-config.schema.2.json +4 -4
  224. package/kits/schemas/role-registry.schema.1.json +2 -2
  225. package/kits/schemas/single-session.schema.1.json +1 -1
  226. package/kits/schemas/single-session.schema.2.json +1 -1
  227. package/kits/schemas/single-session.schema.3.json +1 -1
  228. package/kits/skills/.switches.json +1 -5
  229. package/kits/skills/ability/SKILL.md +56 -0
  230. package/kits/skills/ability/references/calling.md +56 -0
  231. package/kits/skills/{ec-ability → ability}/references/contract-checklist.md +1 -1
  232. package/kits/skills/{ec-ability → ability}/references/development.md +9 -33
  233. package/kits/skills/{ec-ability → ability}/references/management.md +2 -2
  234. package/kits/skills/{ec-ability → ability}/references/recovery.md +1 -1
  235. package/kits/skills/{ec-ability → ability}/references/runtime-protocol.md +2 -0
  236. package/kits/skills/ec-agent-create/SKILL.md +0 -1
  237. package/kits/skills/ec-group/SKILL.md +8 -5
  238. package/kits/skills/ec-group-collaboration/SKILL.md +7 -7
  239. package/kits/skills/ec-service-proxy/SKILL.md +34 -5
  240. package/kits/skills/ec-trigger/SKILL.md +4 -4
  241. package/kits/skills/personal-assistant/SKILL.md +6 -6
  242. package/kits/skills/personal-assistant/references/02-bootstrap.md +4 -4
  243. package/kits/skills/personal-assistant/scripts/clean.mjs +4 -4
  244. package/kits/skills/personal-assistant/scripts/init.mjs +2 -2
  245. package/kits/skills/personal-assistant/scripts/pa.mjs +4 -4
  246. package/kits/skills/thread-ops/SKILL.md +10 -10
  247. package/kits/templates/system-fragments/channel.md +3 -3
  248. package/kits/templates/system-fragments/commands.md +9 -7
  249. package/kits/templates/system-fragments/reply.md +2 -6
  250. package/kits/templates/system-fragments/session.md +1 -1
  251. package/kits/templates/system-fragments/thread.md +11 -9
  252. package/package.json +5 -6
  253. package/dist/cli/pa-workspace-command.js +0 -225
  254. package/dist/core/command/pa-workspace-store.js +0 -468
  255. package/dist/core/relation/pa-team.js +0 -132
  256. package/kits/docs/evolcore/pa-workspace.md +0 -51
  257. package/kits/skills/aid-ability/SKILL.md +0 -244
  258. package/kits/skills/ec-ability/SKILL.md +0 -67
  259. package/kits/skills/ec-ability/references/workflows.md +0 -15
@@ -5,10 +5,11 @@ import { spawn } from 'node:child_process';
5
5
  import crypto from 'node:crypto';
6
6
  import { resolvePaths } from '../paths.js';
7
7
  import { SERVICE_HEALTH_INTERVALS, SERVICE_RESTART_BACKOFF_MS, SERVICE_RESTART_MAX_ATTEMPTS, SERVICE_RESTART_WINDOW_MS, SERVICE_STARTUP_TIMEOUT_MS, serviceRuntimeMode, } from '../config/daemon-services.js';
8
- import { getProcessStartTime, startTimeMatches } from '../utils/process-introspect.js';
8
+ import { getProcessStartTimeAsync, startTimeMatches } from '../utils/process-introspect.js';
9
9
  import * as platform from '../utils/cross-platform.js';
10
10
  import { logger as defaultLogger } from '../utils/logger.js';
11
11
  import { atomicWriteJson } from '../utils/atomic-write.js';
12
+ import { sanitizeServiceEnvironment } from '../core/permission/shell-environment.js';
12
13
  function sleep(ms) {
13
14
  return new Promise(resolve => setTimeout(resolve, ms));
14
15
  }
@@ -77,12 +78,12 @@ async function tcpReady(port, timeoutMs) {
77
78
  });
78
79
  }
79
80
  async function checkHealth(service, pid) {
80
- if (pid > 0 && !platform.isProcessRunning(pid))
81
+ if (pid > 0 && !(await platform.isProcessRunningAsync(pid)))
81
82
  return false;
82
83
  if (!service.port)
83
84
  return pid > 0;
84
85
  if (pid > 0) {
85
- const listeners = platform.findProcessByPort(service.port);
86
+ const listeners = await platform.findProcessByPortAsync(service.port);
86
87
  if (listeners.length > 0 && !listeners.includes(pid))
87
88
  return false;
88
89
  }
@@ -207,7 +208,9 @@ export class ServiceSupervisor {
207
208
  void this.monitorHealth(active).finally(() => this.scheduleHealthCheck(active));
208
209
  continue;
209
210
  }
210
- const active = this.adoptOrCreate(service);
211
+ const active = await this.adoptOrCreate(service);
212
+ if (this.stopped)
213
+ return;
211
214
  this.active.set(service.name, active);
212
215
  if (active.state !== 'ready') {
213
216
  void this.queueOperation(service.name, () => this.startEntry(active)).catch(() => { });
@@ -242,7 +245,9 @@ export class ServiceSupervisor {
242
245
  this.desired.set(name, service);
243
246
  let active = this.active.get(name);
244
247
  if (!active) {
245
- active = this.adoptOrCreate(service);
248
+ active = await this.adoptOrCreate(service);
249
+ if (this.stopped)
250
+ throw Object.assign(new Error('service start cancelled: ' + name), { code: 'SERVICE_START_CANCELLED' });
246
251
  this.active.set(name, active);
247
252
  }
248
253
  await this.startEntry(active);
@@ -258,7 +263,10 @@ export class ServiceSupervisor {
258
263
  return this.queueOperation(name, async () => {
259
264
  const active = this.active.get(name);
260
265
  if (!active)
261
- return { name, state: 'disabled', failureCount: 0, restartCount: 0, generation: 0, managed: false };
266
+ return {
267
+ name, state: 'disabled', failureCount: 0, restartCount: 0, generation: 0, managed: false,
268
+ healthy: null, hasProbe: !!this.desired.get(name)?.port, endpointHealth: 'unknown',
269
+ };
262
270
  if (active.config.runtime?.mode !== 'managed') {
263
271
  throw Object.assign(new Error('external service lifecycle is not managed: ' + name), { code: 'EXTERNAL_SERVICE_UNMANAGED' });
264
272
  }
@@ -306,9 +314,11 @@ export class ServiceSupervisor {
306
314
  });
307
315
  }
308
316
  async verifyAdopted(active) {
309
- if (active.state !== 'starting' || !active.pid || !platform.isProcessRunning(active.pid))
310
- return;
311
317
  const generation = active.generation;
318
+ if (active.state !== 'starting' || !active.pid || !(await platform.isProcessRunningAsync(active.pid)))
319
+ return;
320
+ if (generation !== active.generation || active.stopping || this.stopped)
321
+ return;
312
322
  const healthy = await checkHealth(active.config, active.pid);
313
323
  if (generation !== active.generation || active.stopping || this.stopped)
314
324
  return;
@@ -333,13 +343,16 @@ export class ServiceSupervisor {
333
343
  this.scheduleRestart(active);
334
344
  }
335
345
  }
336
- adoptOrCreate(service) {
346
+ async adoptOrCreate(service) {
337
347
  const hash = serviceConfigHash(service);
338
348
  const records = readInstanceRecords(service.name);
339
- const liveRecords = records
340
- .filter(record => platform.isProcessRunning(record.pid)
341
- && startTimeMatches(record.startedAt, getProcessStartTime(record.pid)))
342
- .sort((a, b) => b.startedAt - a.startedAt);
349
+ const liveRecords = [];
350
+ for (const record of records) {
351
+ if ((await platform.isProcessRunningAsync(record.pid))
352
+ && startTimeMatches(record.startedAt, await getProcessStartTimeAsync(record.pid)))
353
+ liveRecords.push(record);
354
+ }
355
+ liveRecords.sort((a, b) => b.startedAt - a.startedAt);
343
356
  const adopted = liveRecords.find(record => record.configHash === hash);
344
357
  if (adopted) {
345
358
  return {
@@ -362,7 +375,7 @@ export class ServiceSupervisor {
362
375
  };
363
376
  }
364
377
  for (const record of records) {
365
- if (platform.isProcessRunning(record.pid) && getProcessStartTime(record.pid) === null)
378
+ if ((await platform.isProcessRunningAsync(record.pid)) && await getProcessStartTimeAsync(record.pid) === null)
366
379
  continue;
367
380
  try {
368
381
  fs.unlinkSync(record.filePath);
@@ -423,8 +436,11 @@ export class ServiceSupervisor {
423
436
  if (this.stopped || active.stopping || active.intentionalStop)
424
437
  return;
425
438
  const generation = active.generation;
426
- if (active.pid && platform.isProcessRunning(active.pid)) {
427
- if (active.adoptionAllowed !== false && startTimeMatches(active.startedAt, getProcessStartTime(active.pid))) {
439
+ const running = active.pid && await platform.isProcessRunningAsync(active.pid);
440
+ if (generation !== active.generation || this.stopped || active.stopping || active.intentionalStop)
441
+ return;
442
+ if (running) {
443
+ if (active.adoptionAllowed !== false && startTimeMatches(active.startedAt, await getProcessStartTimeAsync(active.pid))) {
428
444
  const healthy = await checkHealth(active.config, active.pid);
429
445
  if (generation !== active.generation || this.stopped || active.intentionalStop) {
430
446
  throw Object.assign(new Error('service start cancelled: ' + active.config.name), { code: 'SERVICE_START_CANCELLED' });
@@ -452,7 +468,10 @@ export class ServiceSupervisor {
452
468
  }
453
469
  }
454
470
  if (active.config.port) {
455
- const listeners = platform.findProcessByPort(active.config.port);
471
+ const listeners = await platform.findProcessByPortAsync(active.config.port);
472
+ if (this.stopped || active.stopping || active.intentionalStop) {
473
+ throw Object.assign(new Error('service start cancelled: ' + active.config.name), { code: 'SERVICE_START_CANCELLED' });
474
+ }
456
475
  if (listeners.length > 0) {
457
476
  active.portConflictPids = listeners;
458
477
  const error = Object.assign(new Error('configured service port is owned by another process: ' + active.config.port + ' (pid=' + listeners.join(',') + ')'), { code: 'PORT_IN_USE' });
@@ -476,6 +495,8 @@ export class ServiceSupervisor {
476
495
  }
477
496
  active.intentionalStop = false;
478
497
  active.state = 'starting';
498
+ active.healthy = undefined;
499
+ active.checkedAt = undefined;
479
500
  active.lastError = undefined;
480
501
  active.lastErrorCode = undefined;
481
502
  const run = async () => {
@@ -497,7 +518,7 @@ export class ServiceSupervisor {
497
518
  // service away from services[].port and make readiness probe the
498
519
  // wrong listener.
499
520
  env: {
500
- ...process.env,
521
+ ...sanitizeServiceEnvironment(process.env),
501
522
  ...(active.config.port === undefined ? {} : { PORT: String(active.config.port) }),
502
523
  },
503
524
  });
@@ -518,11 +539,12 @@ export class ServiceSupervisor {
518
539
  if (!pid)
519
540
  throw Object.assign(new Error('failed to obtain PID for ' + active.config.name), { code: 'PROCESS_START_FAILED' });
520
541
  active.pid = pid;
521
- active.startedAt = getProcessStartTime(pid) ?? 0;
542
+ active.startedAt = 0;
522
543
  active.recordPath = recordPath(active.config.name, pid);
523
544
  active.adoptionAllowed = true;
524
545
  active.portConflictPids = undefined;
525
546
  active.generation += 1;
547
+ const childGeneration = active.generation;
526
548
  child.once('exit', (code, signal) => {
527
549
  if (active.process !== child)
528
550
  return;
@@ -551,6 +573,19 @@ export class ServiceSupervisor {
551
573
  // for that case as well.
552
574
  this.scheduleRestart(active);
553
575
  });
576
+ child.unref();
577
+ const identity = active.identityPromise = getProcessStartTimeAsync(pid);
578
+ const startedAt = await identity;
579
+ if (active.identityPromise === identity)
580
+ active.identityPromise = undefined;
581
+ const running = await platform.isProcessRunningAsync(pid);
582
+ if (active.process !== child || !running) {
583
+ throw Object.assign(new Error('service exited before identity verification: ' + active.config.name), { code: 'PROCESS_EXITED' });
584
+ }
585
+ active.startedAt = startedAt ?? 0;
586
+ if (this.stopped || active.stopping || active.intentionalStop) {
587
+ throw Object.assign(new Error('service start cancelled: ' + active.config.name), { code: 'SERVICE_START_CANCELLED' });
588
+ }
554
589
  fs.mkdirSync(resolvePaths().instanceDir, { recursive: true });
555
590
  atomicWriteJson(active.recordPath, {
556
591
  owner: 'evolcore-service-supervisor',
@@ -562,12 +597,12 @@ export class ServiceSupervisor {
562
597
  attemptId: active.attemptId,
563
598
  });
564
599
  this.logLifecycle(active, 'service.spawned', { startedAt: active.startedAt });
565
- child.unref();
566
600
  if (!active.startedAt) {
567
601
  throw Object.assign(new Error('cannot verify newly spawned process identity: ' + active.config.name), { code: 'PROCESS_IDENTITY_UNVERIFIED' });
568
602
  }
569
603
  await this.waitForHealth(active);
570
- if (active.stopping || this.stopped || !platform.isProcessRunning(pid))
604
+ if (!(await platform.isProcessRunningAsync(pid)) || active.stopping || this.stopped
605
+ || active.intentionalStop || active.generation !== childGeneration || active.process !== child)
571
606
  return;
572
607
  fs.mkdirSync(resolvePaths().instanceDir, { recursive: true });
573
608
  atomicWriteJson(active.recordPath, {
@@ -595,22 +630,25 @@ export class ServiceSupervisor {
595
630
  throw Object.assign(new Error('service start cancelled: ' + active.config.name), { code: 'SERVICE_START_CANCELLED' });
596
631
  }
597
632
  if (active.config.port) {
598
- const listeners = platform.findProcessByPort(active.config.port);
633
+ const listeners = await platform.findProcessByPortAsync(active.config.port);
599
634
  if (listeners.length > 0 && !listeners.includes(active.pid)) {
600
635
  active.portConflictPids = listeners;
601
636
  throw Object.assign(new Error('configured service port is owned by another process: ' + active.config.port + ' (pid=' + listeners.join(',') + ')'), { code: 'PORT_IN_USE' });
602
637
  }
603
638
  }
604
- if (active.stopping || this.stopped || !platform.isProcessRunning(active.pid)) {
639
+ if (active.stopping || this.stopped || !(await platform.isProcessRunningAsync(active.pid))) {
605
640
  throw Object.assign(new Error('service exited before ready: ' + active.config.name), { code: 'READINESS_TIMEOUT' });
606
641
  }
607
642
  const healthy = await checkHealth(active.config, active.pid);
608
643
  if (generation !== active.generation || active.intentionalStop || this.stopped) {
609
644
  throw Object.assign(new Error('service start cancelled: ' + active.config.name), { code: 'SERVICE_START_CANCELLED' });
610
645
  }
611
- if (!platform.isProcessRunning(active.pid)) {
646
+ if (!(await platform.isProcessRunningAsync(active.pid))) {
612
647
  throw Object.assign(new Error('service exited before ready: ' + active.config.name), { code: 'PROCESS_EXITED' });
613
648
  }
649
+ if (generation !== active.generation || active.stopping || active.intentionalStop || this.stopped) {
650
+ throw Object.assign(new Error('service start cancelled: ' + active.config.name), { code: 'SERVICE_START_CANCELLED' });
651
+ }
614
652
  if (healthy) {
615
653
  active.healthy = true;
616
654
  active.checkedAt = Date.now();
@@ -656,10 +694,10 @@ export class ServiceSupervisor {
656
694
  clearTimeout(active.restartTimer);
657
695
  active.restartTimer = undefined;
658
696
  const pid = active.pid;
659
- const expectedStartedAt = active.startedAt;
660
- if (pid > 0 && platform.isProcessRunning(pid)) {
661
- const actualStartedAt = getProcessStartTime(pid);
662
- if (actualStartedAt === null) {
697
+ const expectedStartedAt = active.startedAt || await active.identityPromise || 0;
698
+ if (pid > 0 && (await platform.isProcessRunningAsync(pid))) {
699
+ const actualStartedAt = await getProcessStartTimeAsync(pid);
700
+ if (actualStartedAt === null && (await platform.isProcessRunningAsync(pid))) {
663
701
  active.state = 'failed';
664
702
  active.lastError = 'cannot verify managed process identity; refusing to stop or replace it (pid=' + pid + ')';
665
703
  active.lastErrorCode = 'PROCESS_IDENTITY_UNVERIFIED';
@@ -667,20 +705,20 @@ export class ServiceSupervisor {
667
705
  this.log.error('[ServiceSupervisor] stop blocked service=' + active.config.name + ' pid=' + pid + ' reason=identity-unverified');
668
706
  return false;
669
707
  }
670
- if (startTimeMatches(expectedStartedAt, actualStartedAt)) {
708
+ if ((await platform.isProcessRunningAsync(pid)) && startTimeMatches(expectedStartedAt, actualStartedAt)) {
671
709
  try {
672
710
  platform.killProcessTree(pid, false);
673
711
  }
674
712
  catch { }
675
713
  let exited = await platform.waitForProcessExit(pid, active.config.runtime?.stopTimeoutMs ?? 10000);
676
- if (!exited && startTimeMatches(expectedStartedAt, getProcessStartTime(pid))) {
714
+ if (!exited && startTimeMatches(expectedStartedAt, await getProcessStartTimeAsync(pid))) {
677
715
  try {
678
716
  platform.killProcessTree(pid, true);
679
717
  }
680
718
  catch { }
681
719
  exited = await platform.waitForProcessExit(pid, 5000);
682
720
  }
683
- const remainingStartedAt = !exited && platform.isProcessRunning(pid) ? getProcessStartTime(pid) : undefined;
721
+ const remainingStartedAt = !exited && (await platform.isProcessRunningAsync(pid)) ? await getProcessStartTimeAsync(pid) : undefined;
684
722
  if (remainingStartedAt === null || (remainingStartedAt !== undefined && startTimeMatches(expectedStartedAt, remainingStartedAt))) {
685
723
  active.state = 'failed';
686
724
  active.lastError = 'process did not exit after graceful and forced termination (pid=' + pid + ')';
@@ -776,7 +814,9 @@ export class ServiceSupervisor {
776
814
  return;
777
815
  active.healthy = healthy;
778
816
  active.checkedAt = Date.now();
779
- const listeners = active.config.port ? platform.findProcessByPort(active.config.port) : [];
817
+ const listeners = active.config.port ? await platform.findProcessByPortAsync(active.config.port) : [];
818
+ if (generation !== active.generation || active.stopping || this.stopped)
819
+ return;
780
820
  active.portConflictPids = listeners.length ? listeners : undefined;
781
821
  if (listeners.length === 0 && active.config.runtime?.restart?.enabled !== false) {
782
822
  active.failures = [];
@@ -793,7 +833,7 @@ export class ServiceSupervisor {
793
833
  return;
794
834
  }
795
835
  const healthy = (serviceRuntimeMode(active.config) === 'external'
796
- || startTimeMatches(active.startedAt, getProcessStartTime(active.pid)))
836
+ || startTimeMatches(active.startedAt, await getProcessStartTimeAsync(active.pid)))
797
837
  && await checkHealth(active.config, active.pid);
798
838
  if (generation !== active.generation || active.stopping || this.stopped)
799
839
  return;
@@ -818,15 +858,18 @@ export class ServiceSupervisor {
818
858
  }
819
859
  }
820
860
  snapshotOne(active) {
861
+ const hasProbe = !!active.config.port;
862
+ const healthy = hasProbe && active.state !== 'disabled' ? active.healthy ?? null : null;
821
863
  return {
822
864
  name: active.config.name,
823
865
  state: active.state,
824
866
  ...(active.pid ? { pid: active.pid } : {}),
825
867
  ...(active.config.port ? { port: active.config.port } : {}),
826
868
  ...(active.startedAt ? { startedAt: active.startedAt } : {}),
827
- ...(active.healthy === undefined ? {} : { healthy: active.healthy }),
869
+ healthy,
870
+ hasProbe,
828
871
  ...(active.checkedAt ? { checkedAt: active.checkedAt } : {}),
829
- endpointHealth: active.healthy === undefined ? 'unknown' : active.healthy ? 'healthy' : 'unhealthy',
872
+ endpointHealth: healthy === null ? 'unknown' : healthy ? 'healthy' : 'unhealthy',
830
873
  failureCount: active.failureCount,
831
874
  restartCount: active.restartCount,
832
875
  ...(active.lastError ? { lastError: active.lastError } : {}),
@@ -9,7 +9,6 @@ import { proactiveFlow } from './proactive-flow.js';
9
9
  const FLOWS = {
10
10
  interactive: interactiveFlow,
11
11
  proactive: proactiveFlow,
12
- paactive: interactiveFlow,
13
12
  };
14
13
  /** 按 chatMode 取处理流。 */
15
14
  export function flowForChatMode(chatMode) {
@@ -16,7 +16,7 @@ import { isChatMode } from '../../../core/message/peer-mode.js';
16
16
  * 单会话响应模式(architecture.md §4.1)—— 合并原 interactive / proactive。
17
17
  *
18
18
  * 本层是薄包装:不含处理行为,全部钩子委托 V1 引擎的 flow。chatMode 决定用哪个
19
- * flow(interactive / proactive;paactive 复用 interactive),取值来自 modeConfig.chatMode(宿主按配置层级
19
+ * flow(interactive / proactive),取值来自 modeConfig.chatMode(宿主按配置层级
20
20
  * 解析后注入,见 implementation-plan.md §三;无 auto 值)。
21
21
  */
22
22
  export class SingleSessionMode {
@@ -0,0 +1,100 @@
1
+ /**
2
+ * 服务分发:全局并发上限 + 每包队列容量。
3
+ *
4
+ * 与 event-center 的 dispatcher 不同:服务调用需要「等到脚本结果才能回复」,
5
+ * 所以这里是带背压的 await 语义,而不是 fire-and-forget。队列满时立即
6
+ * 用 QUEUE_FULL 拒绝,避免调用方无限等待。
7
+ */
8
+ import { logger } from '../utils/logger.js';
9
+ export const DEFAULT_DISPATCHER_LIMITS = { maxConcurrency: 5, queueSize: 100 };
10
+ export class ServiceDispatcher {
11
+ scriptRunner;
12
+ limits;
13
+ running = 0;
14
+ waiters = [];
15
+ pendingByPack = new Map();
16
+ closed = false;
17
+ constructor(scriptRunner, limits = DEFAULT_DISPATCHER_LIMITS) {
18
+ this.scriptRunner = scriptRunner;
19
+ this.limits = limits;
20
+ }
21
+ setLimits(limits) {
22
+ this.limits = { ...this.limits, ...limits };
23
+ }
24
+ /** 队列满 / 已关闭时返回 QUEUE_FULL / DISPATCHER_CLOSED 结果,不抛错。 */
25
+ async run(pack, handler, message) {
26
+ if (this.closed) {
27
+ return {
28
+ outcome: 'error',
29
+ exitCode: 0,
30
+ durationMs: 0,
31
+ stdoutPreview: '',
32
+ stderrPreview: '',
33
+ error: { code: 'DISPATCHER_CLOSED', message: 'services dispatcher is shutting down' },
34
+ };
35
+ }
36
+ const pending = this.pendingByPack.get(pack.id) ?? 0;
37
+ if (pending >= this.limits.queueSize) {
38
+ return {
39
+ outcome: 'error',
40
+ exitCode: 0,
41
+ durationMs: 0,
42
+ stdoutPreview: '',
43
+ stderrPreview: '',
44
+ error: { code: 'QUEUE_FULL', message: `service pack ${pack.id} queue is full` },
45
+ };
46
+ }
47
+ this.pendingByPack.set(pack.id, pending + 1);
48
+ try {
49
+ await this.acquire();
50
+ try {
51
+ return await this.scriptRunner.run(pack, handler, message);
52
+ }
53
+ catch (error) {
54
+ logger.warn(`[Services] ${pack.id} handler for ${message.type} crashed: ${error instanceof Error ? error.message : String(error)}`);
55
+ return {
56
+ outcome: 'error',
57
+ exitCode: 0,
58
+ durationMs: 0,
59
+ stdoutPreview: '',
60
+ stderrPreview: '',
61
+ error: { code: 'DISPATCHER_ERROR', message: error instanceof Error ? error.message : String(error) },
62
+ };
63
+ }
64
+ finally {
65
+ this.release();
66
+ }
67
+ }
68
+ finally {
69
+ const remaining = (this.pendingByPack.get(pack.id) ?? 1) - 1;
70
+ if (remaining <= 0)
71
+ this.pendingByPack.delete(pack.id);
72
+ else
73
+ this.pendingByPack.set(pack.id, remaining);
74
+ }
75
+ }
76
+ acquire() {
77
+ if (this.running < this.limits.maxConcurrency) {
78
+ this.running++;
79
+ return Promise.resolve();
80
+ }
81
+ return new Promise((resolve, reject) => {
82
+ this.waiters.push({ resolve, reject });
83
+ });
84
+ }
85
+ release() {
86
+ const waiter = this.waiters.shift();
87
+ if (waiter)
88
+ waiter.resolve();
89
+ else
90
+ this.running = Math.max(0, this.running - 1);
91
+ }
92
+ /** 关闭:拒绝新任务,唤醒所有等待者让其按 DISPATCHER_CLOSED 返回。 */
93
+ close() {
94
+ this.closed = true;
95
+ this.pendingByPack.clear();
96
+ for (const waiter of this.waiters.splice(0)) {
97
+ waiter.resolve();
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 包内幂等(.idempotency.jsonl):按 (fromAid, request_id) 去重,窗口 24 小时。
3
+ *
4
+ * 与 `claimInboundMessage` 是两层不同的东西:后者管传输层 `message_id` 重投,
5
+ * 这里管对端用同一 `request_id` 重试。命中时回上次结果,脚本不再执行。
6
+ */
7
+ import fs from 'node:fs';
8
+ import path from 'node:path';
9
+ export const IDEMPOTENCY_WINDOW_MS = 24 * 60 * 60 * 1000;
10
+ function key(from, requestId) {
11
+ return `${from}\u0000${requestId}`;
12
+ }
13
+ export class IdempotencyStore {
14
+ filePath;
15
+ records = new Map();
16
+ loadedMtimeMs = -1;
17
+ constructor(filePath) {
18
+ this.filePath = filePath;
19
+ }
20
+ /** 按文件 mtime 懒加载;文件被外部改动时重读。 */
21
+ ensureLoaded(now = Date.now()) {
22
+ let mtimeMs = 0;
23
+ try {
24
+ mtimeMs = fs.statSync(this.filePath).mtimeMs;
25
+ }
26
+ catch {
27
+ // 文件不存在:视为空表。
28
+ }
29
+ if (mtimeMs === this.loadedMtimeMs) {
30
+ this.evict(now);
31
+ return;
32
+ }
33
+ this.records.clear();
34
+ try {
35
+ const text = fs.readFileSync(this.filePath, 'utf8');
36
+ for (const line of text.split('\n')) {
37
+ if (!line)
38
+ continue;
39
+ try {
40
+ const record = JSON.parse(line);
41
+ if (typeof record.from === 'string' && typeof record.requestId === 'string'
42
+ && Number.isFinite(record.ts) && record.result && typeof record.result === 'object') {
43
+ this.records.set(key(record.from, record.requestId), record);
44
+ }
45
+ }
46
+ catch {
47
+ // 跳过坏行
48
+ }
49
+ }
50
+ }
51
+ catch {
52
+ // 读失败按空表处理,下次调用再试。
53
+ }
54
+ this.loadedMtimeMs = mtimeMs;
55
+ this.evict(now);
56
+ }
57
+ evict(now) {
58
+ const cutoff = now - IDEMPOTENCY_WINDOW_MS;
59
+ for (const [entryKey, record] of this.records) {
60
+ if (record.ts < cutoff)
61
+ this.records.delete(entryKey);
62
+ }
63
+ }
64
+ /** 命中的上次结果;未命中返回 undefined。 */
65
+ lookup(from, requestId, now = Date.now()) {
66
+ this.ensureLoaded(now);
67
+ const record = this.records.get(key(from, requestId));
68
+ if (!record)
69
+ return undefined;
70
+ if (record.ts < now - IDEMPOTENCY_WINDOW_MS) {
71
+ this.records.delete(key(from, requestId));
72
+ return undefined;
73
+ }
74
+ return record;
75
+ }
76
+ /** 记录一次成功执行的结果。IO 失败吞掉:去重是优化,不是正确性前提。 */
77
+ record(from, requestId, result, now = Date.now()) {
78
+ this.ensureLoaded(now);
79
+ const record = { ts: now, from, requestId, result };
80
+ this.records.set(key(from, requestId), record);
81
+ try {
82
+ fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
83
+ fs.appendFileSync(this.filePath, `${JSON.stringify(record)}\n`, 'utf8');
84
+ this.loadedMtimeMs = fs.statSync(this.filePath).mtimeMs;
85
+ }
86
+ catch {
87
+ // 写失败不影响本次回复,只是下次重试会再执行一遍。
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * 本机身份:type / exttype 从 agent.md frontmatter 读。
3
+ *
4
+ * `requires` 判定与 ECK 的 hasServicePacks 都读它。名片变更频率极低,
5
+ * 由调用方在加载时算一次并缓存,热重载(ec aid agentmd set)时失效。
6
+ *
7
+ * 优先读本地 `AIDs/<aid>/agent.md`(daemon 启动即可用,不依赖 AUN 连接);
8
+ * 本地缺失时再走 AIDStore.resolve(网络路径)。
9
+ */
10
+ import fs from 'node:fs';
11
+ import { agentMdPath } from '../paths.js';
12
+ import { parseAgentMdFrontmatter } from '../core/relation/peer-identity.js';
13
+ function identityFromFrontmatter(aid, frontmatter) {
14
+ const type = String(frontmatter?.type ?? 'agent').trim() || 'agent';
15
+ const exttype = String(frontmatter?.exttype ?? '').trim();
16
+ return { aid, type, exttype };
17
+ }
18
+ /** 本地名片(同步,不触发网络)。文件缺失时返回 undefined。 */
19
+ export function readLocalSelfIdentity(aid) {
20
+ try {
21
+ const content = fs.readFileSync(agentMdPath(aid), 'utf8');
22
+ return identityFromFrontmatter(aid, parseAgentMdFrontmatter(content));
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ }
28
+ /**
29
+ * 读本机名片的 type / exttype。
30
+ * `AIDStore.resolve` → `ResolveResult.agent_md.frontmatter`;`client.getType()` 只读 type。
31
+ * 本地读不到时才走网络。两处都读不到时按 `agent` / 空 exttype 处理(fail-closed:
32
+ * 只有 `requires` 含 `agent` 或 `*` 的包才会激活)。
33
+ */
34
+ export async function resolveSelfIdentity(store, aid) {
35
+ const local = readLocalSelfIdentity(aid);
36
+ if (local)
37
+ return local;
38
+ if (!store)
39
+ return { aid, type: 'agent', exttype: '' };
40
+ try {
41
+ const result = await store.resolve(aid);
42
+ const frontmatter = result.ok ? result.data.agent_md?.frontmatter : undefined;
43
+ return identityFromFrontmatter(aid, frontmatter);
44
+ }
45
+ catch {
46
+ return { aid, type: 'agent', exttype: '' };
47
+ }
48
+ }
49
+ /** services 模式:本机名片 type 精确等于 services。 */
50
+ export function isServicesIdentity(identity) {
51
+ return identity.type === 'services';
52
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 生成 `$AGENT_DIR/services/.index.md`:本机已激活服务包的清单。
3
+ *
4
+ * 只列 active 包(requires 已通过)。空集时删除文件而不是写空文件——
5
+ * 让 manifest 的 `optional` 判定与文件存在性始终一致。
6
+ *
7
+ * 格式见 docs/eck/services-and-events-manifest.md §五。
8
+ */
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import { logger } from '../utils/logger.js';
12
+ export const SERVICES_INDEX_FILE = '.index.md';
13
+ /**
14
+ * @param servicesDir `$AGENT_DIR/services`
15
+ * @param selfAid 本机 AID,用于示例命令
16
+ * @param activePacks 已激活的包(requires 通过且 enabled)
17
+ */
18
+ export function writeServicesIndex(servicesDir, selfAid, activePacks) {
19
+ const filePath = path.join(servicesDir, SERVICES_INDEX_FILE);
20
+ if (activePacks.length === 0) {
21
+ try {
22
+ if (fs.existsSync(filePath)) {
23
+ fs.unlinkSync(filePath);
24
+ logger.debug(`[services-index] ${SERVICES_INDEX_FILE} 已删除(无激活服务包)`);
25
+ }
26
+ }
27
+ catch (error) {
28
+ logger.warn(`[services-index] cannot remove stale index: ${error instanceof Error ? error.message : String(error)}`);
29
+ }
30
+ return;
31
+ }
32
+ const lines = [];
33
+ lines.push(`[services] 本 Agent 已激活 ${activePacks.length} 个服务包,对外提供以下服务调用。`);
34
+ lines.push('');
35
+ lines.push('调用方式(对端视角):');
36
+ lines.push(` ec services describe <本AID> 查看完整参数与示例`);
37
+ lines.push(` ec services call <本AID> <type> --data '<json>'`);
38
+ lines.push('');
39
+ lines.push('本机管理:');
40
+ lines.push(' ec services status / doctor / ledger / tail / reload');
41
+ lines.push('');
42
+ lines.push('可用服务(type 即对端应发送的 payload.type):');
43
+ for (const pack of activePacks) {
44
+ lines.push(`- ${pack.id}(${pack.name})`);
45
+ for (const entry of pack.listen) {
46
+ const timeoutMs = entry.handler.timeoutMs ?? 30_000;
47
+ lines.push(` ${entry.type} ${entry.handler.script} timeout ${formatTimeout(timeoutMs)}`);
48
+ }
49
+ const first = pack.listen[0];
50
+ if (first) {
51
+ lines.push(` 示例: ec services call ${selfAid} ${exampleType(first.type)} --data '{}'`);
52
+ }
53
+ }
54
+ lines.push('');
55
+ try {
56
+ fs.mkdirSync(servicesDir, { recursive: true });
57
+ fs.writeFileSync(filePath, lines.join('\n'), 'utf8');
58
+ logger.debug(`[services-index] ${SERVICES_INDEX_FILE} 已生成(${activePacks.length} 个包)`);
59
+ }
60
+ catch (error) {
61
+ logger.warn(`[services-index] cannot write index: ${error instanceof Error ? error.message : String(error)}`);
62
+ }
63
+ }
64
+ /** 通配 listen 的示例用具体 action 名,避免把 `*` 写进可复制命令。 */
65
+ function exampleType(listenType) {
66
+ return listenType.endsWith('.*') ? `${listenType.slice(0, -1)}example` : listenType;
67
+ }
68
+ function formatTimeout(timeoutMs) {
69
+ return timeoutMs % 1000 === 0 ? `${timeoutMs / 1000}s` : `${timeoutMs}ms`;
70
+ }