evolcore 0.0.21 → 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 (64) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/bin/codex-managed-hook.mjs +3 -0
  3. package/bin/install-codex-managed-hooks.mjs +3 -1
  4. package/dist/agents/claude-runner.js +14 -0
  5. package/dist/agents/codex-app-server-client.js +31 -5
  6. package/dist/agents/codex-runner.js +926 -121
  7. package/dist/aun/outbox.js +7 -0
  8. package/dist/channels/aun.js +209 -35
  9. package/dist/cli/daemon-commands.js +29 -8
  10. package/dist/cli/task-context.js +4 -0
  11. package/dist/cli/trigger-command.js +13 -4
  12. package/dist/config/config-field-policy.js +3 -0
  13. package/dist/config/config-manager.js +32 -5
  14. package/dist/config/contact-book-store.js +25 -3
  15. package/dist/core/auth/agent-delegation.js +12 -0
  16. package/dist/core/auth/auth-gateway.js +8 -0
  17. package/dist/core/auth/authorization-audit.js +66 -6
  18. package/dist/core/bootstrap-messages.js +8 -0
  19. package/dist/core/bootstrap-service.js +93 -25
  20. package/dist/core/command/command-handler.js +21 -0
  21. package/dist/core/command/menu-handler.js +9 -0
  22. package/dist/core/command/menu-protocol.js +1 -1
  23. package/dist/core/command/slash-handler.js +41 -18
  24. package/dist/core/data-migration.js +11 -1
  25. package/dist/core/event-catalog.js +32 -0
  26. package/dist/core/handoff/runtime.js +23 -3
  27. package/dist/core/message/im-renderer.js +7 -3
  28. package/dist/core/message/message-bridge.js +60 -2
  29. package/dist/core/message/message-log.js +33 -0
  30. package/dist/core/message/message-queue.js +21 -0
  31. package/dist/core/message/response-engine.js +172 -41
  32. package/dist/core/permission/ec-command-parser.js +272 -70
  33. package/dist/core/permission/protected-paths.js +11 -10
  34. package/dist/core/permission/tool-error-code.js +12 -0
  35. package/dist/core/permission/tool-policy.js +46 -5
  36. package/dist/core/session/session-manager.js +30 -0
  37. package/dist/core/session/session-renew.js +18 -1
  38. package/dist/core/session/session-turn-coordinator.js +5 -1
  39. package/dist/index.js +64 -5
  40. package/dist/ipc.js +97 -17
  41. package/dist/paths.js +18 -0
  42. package/dist/response-system/engines/v1/proactive-flow.js +7 -2
  43. package/dist/stats/price-resolver.js +4 -0
  44. package/dist/trigger/feedback.js +14 -2
  45. package/dist/trigger/parser.js +10 -1
  46. package/dist/trigger/scheduler.js +20 -3
  47. package/dist/utils/logger.js +9 -4
  48. package/dist/utils/tool-summary.js +59 -0
  49. package/dist/utils/windows-shell-trust.js +201 -0
  50. package/kits/docs/evolcore/INDEX.md +2 -2
  51. package/kits/docs/evolcore/agent-create.md +146 -0
  52. package/kits/docs/evolcore/agent.md +6 -0
  53. package/kits/docs/evolcore/group-collaboration.md +251 -0
  54. package/kits/docs/evolcore/group-rules.md +1 -19
  55. package/kits/docs/evolcore/group.md +3 -1
  56. package/kits/docs/evolcore/trigger.md +6 -3
  57. package/kits/docs/prompt-loading-architecture.md +6 -0
  58. package/kits/eck_message_manifest.json +6 -6
  59. package/kits/schemas/_meta.json +3 -2
  60. package/kits/schemas/agent-config.schema.12.json +427 -0
  61. package/kits/templates/message-fragments/item.md +1 -1
  62. package/kits/templates/system-fragments/bootstrap.md +2 -1
  63. package/kits/templates/system-fragments/commands.md +2 -2
  64. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  本文件记录 EvolCore 的重要变更。EvolClaw 版本线的历史记录已归档至
4
4
  [`docs/_archive/CHANGELOG-evolclaw.md`](docs/_archive/CHANGELOG-evolclaw.md)。
5
5
 
6
+ ## 0.0.22 (2026-09-05)
7
+
8
+ ### 话题续接与触发任务
9
+
10
+ - 完善话题 `/renew` 的并发屏障、后端身份校验和辅助模型配置迁移,避免续接期间旧任务或旧后端结果串入新话题。
11
+ - 完善 Fullaccess Trigger 的持久授权、批准状态、CLI 参数和调度运行时,统一 daemon-owner 身份与审计关联。
12
+
13
+ ### Bootstrap、会话与消息队列
14
+
15
+ - 增强 Agent 创建规划、Bootstrap 完成鉴权和欢迎消息投递,补齐生命周期门禁、事件记录与失败恢复。
16
+ - 完善消息队列、会话恢复、跨会话 Handoff 和响应引擎的状态收敛,降低重启、续接与并发操作造成的消息丢失或重复处理。
17
+
18
+ ### 服务配置与消息管理
19
+
20
+ - 统一本机服务和 AUN Service Proxy 的配置读取、schema 与旧版迁移,并贯通 Agent 启动和 IPC 管理链路。
21
+ - 完善 `ec msg history` 按渠道实例和原生对端 ID 查询历史的参数传递、权限校验与结果处理。
22
+
23
+ ### AUN 投递、联系人与观察者
24
+
25
+ - 完善 Outbox 投递状态、消息回执、永久失败诊断和路由变更保护,避免迟到结果误删已调整路由的待发消息。
26
+ - 强化联系人申请、Owner 审核以及托管私聊入站/出站准入,补齐拒绝原因与审计信息。
27
+ - 修复 Observer 消息转发的异步时序,并按群成员关系过滤重复通知。
28
+
29
+ ### Codex 权限与跨平台安全
30
+
31
+ - 强化 Codex Shell 命令解析、委派校验、工具摘要和受保护路径策略,明确受管运行身份与权限决策证据。
32
+ - 修复 Windows Codex managed hook 的动态 IPC 校验与安装配置,统一 proactive hook 可用性检查并保持 H-class/L-class 保护边界。
33
+ - 修正 Codex Windows 文件系统 glob 规则,改善受管临时目录和锁目录的跨平台匹配。
34
+ - 统一 BaseAgent 请求地址和身份请求头传递,完善 Codex 会话启动、重连与错误诊断。
35
+ - 完善 Codex 子代理的上下文继承、权限传递和任务生命周期收敛,并贯通工具调用标识与授权审计。
36
+ - 为受信任的 root Fullaccess Claude 会话显式设置沙箱标记,并限制复杂 PowerShell carrier 的摘要解包范围。
37
+
38
+ ### Windows IPC 与运行稳定性
39
+
40
+ - 统一 Windows IPC 端点路径规范和跨进程命名管道连接,修复实例 socket 路径在不同运行入口间不一致的问题。
41
+ - 修复 Windows 配置与联系人数据的锁竞争,支持安全识别并回收损坏或遗留锁文件。
42
+ - 强化 Windows Shell 签名信任校验,在允许受信任命令执行的同时收紧受管命令边界。
43
+
44
+ ### Trigger 与监控收敛
45
+
46
+ - 确保 daemon Trigger 在错误已经渲染后仍发送明确终态,并传播中断生命周期元数据、统一中断结果分类。
47
+ - EC Web Monitor 按订阅生命周期启停进程树采样,避免无订阅时持续采集。
48
+
6
49
  ## 0.0.21 (2026-09-03)
7
50
 
8
51
  ### 话题与权限控制
@@ -80,6 +80,9 @@ async function main() {
80
80
  threadId: input.session_id,
81
81
  toolName: input.tool_name,
82
82
  toolInput: input.tool_input ?? null,
83
+ ...(typeof (input.tool_use_id ?? input.toolUseId ?? input.item_id ?? input.itemId) === 'string'
84
+ ? { callId: input.tool_use_id ?? input.toolUseId ?? input.item_id ?? input.itemId }
85
+ : {}),
83
86
  });
84
87
  if (!result) {
85
88
  deny('EvolCore policy service is unavailable.');
@@ -231,7 +231,9 @@ function main() {
231
231
  content = setTomlKey(content, 'features', 'hooks', 'true');
232
232
  content = setTomlKey(content, 'hooks', 'windows_managed_dir', tomlString(path.resolve(targetDirectory)));
233
233
  if (!content.endsWith('\n')) content += '\n';
234
- const command = `${windowsCommandArg(nodePath)} ${windowsCommandArg(hookPath)}`;
234
+ // Windows hook command must include %EVOLCORE_INSTANCE_SOCKET% so Codex
235
+ // expands it at runtime with the per-daemon socket path
236
+ const command = `${windowsCommandArg(nodePath)} ${windowsCommandArg(hookPath)} %EVOLCORE_INSTANCE_SOCKET%`;
235
237
  content += [
236
238
  markerStart,
237
239
  '[[hooks.PreToolUse]]',
@@ -719,6 +719,20 @@ export class AgentRunner {
719
719
  ...(evolcoreSessionId ? { EVOLCORE_SESSION_ID: evolcoreSessionId } : {}),
720
720
  ...(runtimeEnv ?? {}),
721
721
  }, { lockExecutableResolution: permissionMode === 'readonly' });
722
+ const trustedRootFullAccess = permissionMode === 'fullaccess'
723
+ && typeof process.getuid === 'function'
724
+ && process.getuid() === 0
725
+ && typeof evolcoreSessionId === 'string'
726
+ && hasTrustedFullAccessContext(this.permissionContexts.get(evolcoreSessionId));
727
+ // Claude Code refuses --dangerously-skip-permissions as root unless its
728
+ // caller asserts that the execution is intentionally sandbox-managed.
729
+ // EvolCore fullaccess is an explicit daemon-owner-authorized host run, so
730
+ // scope this assertion to that single trusted call. Never inherit a
731
+ // process-wide IS_SANDBOX into ordinary or untrusted Claude sessions.
732
+ if (trustedRootFullAccess)
733
+ env.IS_SANDBOX = '1';
734
+ else
735
+ delete env.IS_SANDBOX;
722
736
  const bubblewrapPath = resolveBubblewrapPath();
723
737
  return bubblewrapPath
724
738
  ? prependExecutableDirectory(env, bubblewrapPath)
@@ -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();
@@ -613,7 +628,10 @@ export class CodexAppServerClient {
613
628
  // second command or changing the hook's behavior.
614
629
  if (!command || !hook || /[\r\n;&|<>]/.test(command))
615
630
  return false;
616
- 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);
617
635
  };
618
636
  const managedHookLoaded = Array.isArray(preToolUse)
619
637
  && preToolUse.some(group => {
@@ -765,8 +783,16 @@ export class CodexAppServerClient {
765
783
  this.pending.delete(messageId);
766
784
  if (message.error) {
767
785
  const detail = typeof message.error?.message === 'string' ? message.error.message : JSON.stringify(message.error);
768
- const stderr = this.stderrBuffer.length ? `\n${this.stderrBuffer.join('\n')}` : '';
769
- 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);
770
796
  return;
771
797
  }
772
798
  pending.resolve(message.result ?? null);