evolcore 0.0.20 → 0.0.22

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 (147) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +58 -9
  3. package/bin/codex-managed-hook.mjs +3 -0
  4. package/bin/install-codex-managed-hooks.mjs +3 -1
  5. package/dist/agents/baseagent.js +10 -6
  6. package/dist/agents/claude-runner.js +393 -108
  7. package/dist/agents/codex-app-server-client.js +41 -7
  8. package/dist/agents/codex-runner.js +1292 -220
  9. package/dist/agents/ecagent-runner.js +171 -61
  10. package/dist/agents/gemini-runner.js +130 -30
  11. package/dist/agents/request-identity.js +25 -0
  12. package/dist/agents/runner-types.js +19 -0
  13. package/dist/aun/aid/agentmd.js +59 -2
  14. package/dist/aun/aid/identity.js +4 -1
  15. package/dist/aun/aid/index.js +1 -1
  16. package/dist/aun/msg/group.js +72 -6
  17. package/dist/aun/msg/history.js +213 -36
  18. package/dist/aun/msg/managed-operation.js +58 -9
  19. package/dist/aun/msg/p2p.js +5 -0
  20. package/dist/aun/outbox.js +189 -80
  21. package/dist/aun/service-proxy.js +43 -25
  22. package/dist/channels/aun.js +618 -123
  23. package/dist/channels/daemon.js +6 -1
  24. package/dist/cli/agent-command.js +4 -3
  25. package/dist/cli/agent.js +66 -56
  26. package/dist/cli/aun-commands.js +177 -42
  27. package/dist/cli/command-log.js +10 -11
  28. package/dist/cli/contact.js +1 -0
  29. package/dist/cli/daemon-commands.js +98 -123
  30. package/dist/cli/init.js +27 -15
  31. package/dist/cli/task-context.js +50 -0
  32. package/dist/cli/trigger-command.js +14 -5
  33. package/dist/cli/watch-logs.js +10 -3
  34. package/dist/config/builtin-roles.js +1 -0
  35. package/dist/config/config-field-policy.js +19 -5
  36. package/dist/config/config-manager.js +167 -22
  37. package/dist/config/contact-book-store.js +25 -3
  38. package/dist/config/contact-operation-service.js +32 -1
  39. package/dist/config/contact-request-service.js +44 -0
  40. package/dist/config/daemon-services.js +186 -0
  41. package/dist/config/gateway-config.js +20 -9
  42. package/dist/config/role-service.js +54 -3
  43. package/dist/config/schema-migration.js +550 -0
  44. package/dist/config-store.js +151 -9
  45. package/dist/core/agent-application-service.js +279 -0
  46. package/dist/core/audit/log-integrity.js +102 -0
  47. package/dist/core/auth/agent-delegation.js +43 -1
  48. package/dist/core/auth/auth-gateway.js +41 -4
  49. package/dist/core/auth/authorization-audit.js +216 -8
  50. package/dist/core/auth/operation-authorizer.js +41 -1
  51. package/dist/core/auth/operation-catalog.js +9 -1
  52. package/dist/core/bootstrap-messages.js +8 -0
  53. package/dist/core/bootstrap-service.js +99 -27
  54. package/dist/core/causation/aun-association.js +7 -4
  55. package/dist/core/command/agent-control.js +56 -16
  56. package/dist/core/command/command-handler.js +311 -44
  57. package/dist/core/command/connect-menu.js +3 -4
  58. package/dist/core/command/group-menu.js +5 -7
  59. package/dist/core/command/menu-handler.js +288 -80
  60. package/dist/core/command/menu-protocol.js +1 -1
  61. package/dist/core/command/role-menu.js +21 -11
  62. package/dist/core/command/slash-gate.js +85 -18
  63. package/dist/core/command/slash-handler.js +377 -36
  64. package/dist/core/data-migration.js +11 -1
  65. package/dist/core/event-catalog.js +37 -0
  66. package/dist/core/evolagent.js +4 -0
  67. package/dist/core/handoff/dispatcher.js +4 -0
  68. package/dist/core/handoff/runtime.js +33 -3
  69. package/dist/core/handoff/store.js +32 -9
  70. package/dist/core/inference/text-inference.js +7 -15
  71. package/dist/core/message/im-renderer.js +90 -87
  72. package/dist/core/message/{inbound-admission.js → message-admission.js} +51 -1
  73. package/dist/core/message/message-bridge.js +184 -12
  74. package/dist/core/message/message-log.js +47 -7
  75. package/dist/core/message/message-queue.js +227 -16
  76. package/dist/core/message/message-utils.js +12 -5
  77. package/dist/core/message/response-engine.js +658 -109
  78. package/dist/core/message/send-receipt.js +1 -0
  79. package/dist/core/message/stream-debouncer.js +9 -2
  80. package/dist/core/model/model-catalog.js +23 -15
  81. package/dist/core/model/model-diagnostics.js +28 -10
  82. package/dist/core/permission/approval-gateway.js +180 -6
  83. package/dist/core/permission/ec-command-parser.js +627 -69
  84. package/dist/core/permission/mode.js +18 -3
  85. package/dist/core/{protected-paths.js → permission/protected-paths.js} +27 -14
  86. package/dist/core/permission/readonly-shell-query.js +263 -9
  87. package/dist/core/permission/sandbox-runtime.js +159 -1
  88. package/dist/core/permission/tool-error-code.js +12 -0
  89. package/dist/core/permission/tool-policy.js +618 -23
  90. package/dist/core/session/session-fs-store.js +154 -5
  91. package/dist/core/session/session-manager.js +329 -30
  92. package/dist/core/session/session-renew.js +37 -13
  93. package/dist/core/session/session-turn-coordinator.js +16 -5
  94. package/dist/eck/kit-renderer.js +1 -1
  95. package/dist/index.js +316 -50
  96. package/dist/ipc.js +459 -29
  97. package/dist/paths.js +82 -7
  98. package/dist/response-system/context-builder.js +1 -7
  99. package/dist/response-system/engines/v1/proactive-flow.js +7 -2
  100. package/dist/stats/price-resolver.js +4 -0
  101. package/dist/trigger/anomaly-store.js +1 -0
  102. package/dist/trigger/feedback.js +70 -7
  103. package/dist/trigger/history.js +79 -4
  104. package/dist/trigger/legacy-session-history.js +2 -2
  105. package/dist/trigger/parser.js +13 -3
  106. package/dist/trigger/scheduler.js +20 -3
  107. package/dist/trigger/validation.js +6 -1
  108. package/dist/utils/atomic-write.js +27 -0
  109. package/dist/utils/ecweb-utils.js +16 -2
  110. package/dist/utils/error-utils.js +4 -1
  111. package/dist/utils/logger.js +30 -6
  112. package/dist/utils/process-tree-stats.js +24 -4
  113. package/dist/utils/process-tree-worker.js +31 -0
  114. package/dist/utils/project-path.js +1 -2
  115. package/dist/utils/tool-summary.js +59 -0
  116. package/dist/utils/windows-shell-trust.js +201 -0
  117. package/kits/docs/INDEX.md +1 -1
  118. package/kits/docs/evolcore/INDEX.md +3 -3
  119. package/kits/docs/evolcore/agent-create.md +146 -0
  120. package/kits/docs/evolcore/agent.md +6 -0
  121. package/kits/docs/evolcore/contact.md +7 -1
  122. package/kits/docs/evolcore/group-collaboration.md +251 -0
  123. package/kits/docs/evolcore/group-rules.md +1 -19
  124. package/kits/docs/evolcore/group.md +3 -1
  125. package/kits/docs/evolcore/msg.md +16 -0
  126. package/kits/docs/evolcore/trigger.md +6 -3
  127. package/kits/docs/prompt-loading-architecture.md +6 -0
  128. package/kits/eck_message_manifest.json +6 -6
  129. package/kits/schemas/_meta.json +7 -4
  130. package/kits/schemas/agent-config.schema.11.json +13 -0
  131. package/kits/schemas/agent-config.schema.12.json +427 -0
  132. package/kits/schemas/daemon.schema.5.json +0 -1
  133. package/kits/schemas/daemon.schema.6.json +131 -0
  134. package/kits/schemas/defaults.schema.5.json +15 -3
  135. package/kits/schemas/migrations/README.md +3 -1
  136. package/kits/schemas/relation-config.schema.8.json +13 -0
  137. package/kits/schemas/role-config.schema.1.json +1 -2
  138. package/kits/schemas/single-session.schema.3.json +32 -0
  139. package/kits/templates/message-fragments/item.md +1 -1
  140. package/kits/templates/roles/admin.json +1 -0
  141. package/kits/templates/roles/member.json +1 -0
  142. package/kits/templates/roles/visitor.json +1 -0
  143. package/kits/templates/system-fragments/bootstrap.md +2 -1
  144. package/kits/templates/system-fragments/commands.md +2 -2
  145. package/package.json +6 -3
  146. package/skills/eclink/SKILL.md +2 -0
  147. package/dist/config/aun-gateway-config.js +0 -2
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'child_process';
2
2
  import readline from 'readline';
3
3
  import { logger } from '../utils/logger.js';
4
- import { buildHClassGuardCommand } from '../core/permission/sandbox-runtime.js';
4
+ import { buildHClassGuardCommand, collectSandboxGuardDiagnostics, summarizeBubblewrapArgsForLog, summarizeSandboxGuardDiagnostics, } from '../core/permission/sandbox-runtime.js';
5
5
  import { resolveCodexLaunchCommand } from '../utils/codex-cli.js';
6
6
  import { createHash } from 'crypto';
7
7
  import { sanitizeShellExecutionEnvironment } from '../core/permission/shell-environment.js';
@@ -9,6 +9,7 @@ import fs from 'fs';
9
9
  import path from 'path';
10
10
  import { ensureProcessManagedTempDir } from '../cli/task-context.js';
11
11
  import { getPackageRoot, resolvePaths } from '../paths.js';
12
+ import { killProcess } from '../utils/cross-platform.js';
12
13
  import { registerCodexAppServerProcess, unregisterCodexAppServerProcess, } from '../utils/codex-app-server-registry.js';
13
14
  const BUILT_IN_CODEX_PROVIDER_IDS = new Set(['openai']);
14
15
  function tomlProviderKey(value) {
@@ -126,6 +127,14 @@ export class CodexAppServerClient {
126
127
  ...(options?.effort ? { effort: options.effort } : {}),
127
128
  });
128
129
  }
130
+ async turnSteer(threadId, expectedTurnId, input, additionalContext) {
131
+ return this.request('turn/steer', {
132
+ threadId,
133
+ expectedTurnId,
134
+ input,
135
+ ...(additionalContext ? { additionalContext } : {}),
136
+ });
137
+ }
129
138
  toTurnSandboxPolicy(sandbox) {
130
139
  if (!sandbox)
131
140
  return undefined;
@@ -332,7 +341,10 @@ export class CodexAppServerClient {
332
341
  }
333
342
  // 优雅关闭:先关闭 stdin,然后发送 SIGTERM,等待进程退出
334
343
  proc.stdin.end();
335
- proc.kill('SIGTERM');
344
+ if (process.platform === 'win32' && proc.pid)
345
+ killProcess(proc.pid, false);
346
+ else
347
+ proc.kill('SIGTERM');
336
348
  // 等待进程退出,最多等待 5 秒
337
349
  await new Promise((resolve) => {
338
350
  let exited = false;
@@ -341,7 +353,10 @@ export class CodexAppServerClient {
341
353
  return;
342
354
  logger.warn('[CodexAppServer] Process did not exit after SIGTERM, sending SIGKILL');
343
355
  try {
344
- proc.kill('SIGKILL');
356
+ if (process.platform === 'win32' && proc.pid)
357
+ killProcess(proc.pid, true);
358
+ else
359
+ proc.kill('SIGKILL');
345
360
  }
346
361
  catch { }
347
362
  resolve();
@@ -410,8 +425,11 @@ export class CodexAppServerClient {
410
425
  let command = launchCommand.command;
411
426
  let commandArgs = launchCommand.args;
412
427
  if (process.platform === 'linux') {
428
+ const guardRoot = resolvePaths().root;
429
+ const preflightDiagnostics = collectSandboxGuardDiagnostics(guardRoot);
430
+ logger.info(`[CodexAppServer] H-class guard preflight ${JSON.stringify(summarizeSandboxGuardDiagnostics(preflightDiagnostics))}`);
413
431
  const managedRequirements = this.ensureManagedHookRuntime();
414
- const guardedCommand = buildHClassGuardCommand(command, commandArgs, undefined, {
432
+ const guardedCommand = buildHClassGuardCommand(command, commandArgs, guardRoot, {
415
433
  managedCodexRequirements: managedRequirements,
416
434
  });
417
435
  if (!guardedCommand) {
@@ -419,6 +437,11 @@ export class CodexAppServerClient {
419
437
  }
420
438
  command = guardedCommand.command;
421
439
  commandArgs = guardedCommand.args;
440
+ const launchDiagnostics = collectSandboxGuardDiagnostics(guardRoot);
441
+ logger.info(`[CodexAppServer] H-class guard launch ${JSON.stringify({
442
+ ...summarizeBubblewrapArgsForLog(commandArgs),
443
+ diagnostics: summarizeSandboxGuardDiagnostics(launchDiagnostics),
444
+ })}`);
422
445
  }
423
446
  this.proc = spawn(command, commandArgs, {
424
447
  cwd: this.options.cwd,
@@ -605,7 +628,10 @@ export class CodexAppServerClient {
605
628
  // second command or changing the hook's behavior.
606
629
  if (!command || !hook || /[\r\n;&|<>]/.test(command))
607
630
  return false;
608
- return command.replace(/["']+$/, '').endsWith(hook);
631
+ const commandWithoutSocket = command
632
+ .replace(/\s+%EVOLCORE_INSTANCE_SOCKET%\s*$/i, '')
633
+ .trim();
634
+ return commandWithoutSocket.replace(/["']+$/, '').endsWith(hook);
609
635
  };
610
636
  const managedHookLoaded = Array.isArray(preToolUse)
611
637
  && preToolUse.some(group => {
@@ -757,8 +783,16 @@ export class CodexAppServerClient {
757
783
  this.pending.delete(messageId);
758
784
  if (message.error) {
759
785
  const detail = typeof message.error?.message === 'string' ? message.error.message : JSON.stringify(message.error);
760
- const stderr = this.stderrBuffer.length ? `\n${this.stderrBuffer.join('\n')}` : '';
761
- pending.reject(new Error(`${pending.method} failed: ${detail}${stderr}`));
786
+ // The CLI's one-time bubblewrap configuration warning is process-wide
787
+ // startup noise, not evidence about this RPC. Do not append it to an
788
+ // unrelated request failure such as thread/resume.
789
+ const stderrLines = this.stderrBuffer.filter(line => !/could not find bubblewrap on PATH/i.test(line));
790
+ const stderr = stderrLines.length ? `\n${stderrLines.join('\n')}` : '';
791
+ const error = new Error(`${pending.method} failed: ${detail}${stderr}`);
792
+ if (/no rollout found for thread id/i.test(detail)) {
793
+ error.code = 'CODEX_ROLLOUT_NOT_FOUND';
794
+ }
795
+ pending.reject(error);
762
796
  return;
763
797
  }
764
798
  pending.resolve(message.result ?? null);