evolcore 0.0.23 → 0.0.24

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 (84) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +3 -1
  3. package/bin/codex-managed-acl.ps1 +7 -2
  4. package/bin/codex-managed-hook.mjs +127 -10
  5. package/bin/ec-safe-output.js +85 -3
  6. package/bin/install-codex-managed-hooks.mjs +17 -6
  7. package/dist/agents/baseagent-availability.js +4 -4
  8. package/dist/agents/baseagent.js +29 -1
  9. package/dist/agents/claude-runner.js +148 -13
  10. package/dist/agents/codex/app-server-client.js +18 -8
  11. package/dist/agents/codex/catalog.js +1 -1
  12. package/dist/agents/codex/diagnostics.js +215 -0
  13. package/dist/agents/codex-runner.js +438 -59
  14. package/dist/agents/ecagent-runner.js +17 -3
  15. package/dist/agents/gemini-runner.js +60 -2
  16. package/dist/agents/runner-types.js +1 -1
  17. package/dist/aun/aid/managed-operation.js +28 -6
  18. package/dist/aun/aid/store.js +41 -0
  19. package/dist/aun/msg/managed-operation.js +6 -1
  20. package/dist/aun/outbox.js +56 -18
  21. package/dist/aun/rpc/client.js +4 -5
  22. package/dist/channels/aun.js +147 -76
  23. package/dist/channels/daemon.js +7 -1
  24. package/dist/channels/dingtalk.js +1 -0
  25. package/dist/channels/feishu.js +10 -4
  26. package/dist/channels/wecom.js +2 -1
  27. package/dist/cli/agent-command.js +29 -3
  28. package/dist/cli/agent-create.js +538 -0
  29. package/dist/cli/agent.js +26 -675
  30. package/dist/cli/aun-commands.js +60 -20
  31. package/dist/cli/ctl-command.js +2 -0
  32. package/dist/cli/daemon-commands.js +148 -17
  33. package/dist/cli/index.js +2 -2
  34. package/dist/cli/managed-command-guard.js +3 -0
  35. package/dist/cli/restart-monitor.js +432 -8
  36. package/dist/cli/stats.js +110 -0
  37. package/dist/config/builtin-roles.js +2 -0
  38. package/dist/core/auth/auth-gateway.js +3 -2
  39. package/dist/core/auth/authorization-audit.js +72 -19
  40. package/dist/core/auth/operation-authorizer.js +63 -3
  41. package/dist/core/auth/operation-catalog.js +10 -2
  42. package/dist/core/auth/remote-access-store.js +3 -2
  43. package/dist/core/baseagent-loader.js +4 -4
  44. package/dist/core/bootstrap-messages.js +39 -18
  45. package/dist/core/bootstrap-service.js +32 -26
  46. package/dist/core/capability/capability-manager.js +8 -4
  47. package/dist/core/capability/providers/codex-capability-provider.js +1 -1
  48. package/dist/core/command/agent-control.js +7 -2
  49. package/dist/core/command/command-handler.js +87 -25
  50. package/dist/core/command/menu-catalog.js +3 -1
  51. package/dist/core/command/menu-handler.js +274 -70
  52. package/dist/core/command/menu-protocol.js +6 -2
  53. package/dist/core/command/slash-gate.js +1 -3
  54. package/dist/core/command/slash-handler.js +157 -48
  55. package/dist/core/data-migration.js +5 -15
  56. package/dist/core/event-catalog.js +3 -0
  57. package/dist/core/handoff/runtime.js +3 -1
  58. package/dist/core/handoff/store.js +7 -1
  59. package/dist/core/message/im-renderer.js +13 -6
  60. package/dist/core/message/message-bridge.js +5 -36
  61. package/dist/core/message/message-utils.js +6 -3
  62. package/dist/core/message/response-engine.js +73 -21
  63. package/dist/core/model/catalog-service.js +3 -1
  64. package/dist/core/model/model-catalog.js +10 -0
  65. package/dist/core/model/model-permission.js +4 -1
  66. package/dist/core/permission/approval-gateway.js +169 -33
  67. package/dist/core/permission/tool-policy.js +13 -6
  68. package/dist/core/session/adapters/codex-session-file-adapter.js +71 -3
  69. package/dist/core/session/session-manager.js +49 -13
  70. package/dist/core/session/session-renew.js +1 -0
  71. package/dist/index.js +174 -28
  72. package/dist/ipc.js +68 -21
  73. package/dist/paths.js +23 -1
  74. package/dist/stats/billing.js +18 -4
  75. package/dist/utils/atomic-write.js +26 -2
  76. package/dist/utils/cross-platform.js +436 -1
  77. package/dist/utils/error-utils.js +11 -4
  78. package/dist/utils/model-prices.jsonl +23 -20
  79. package/dist/utils/npm-ops.js +24 -1
  80. package/dist/utils/windows-autostart.js +1 -1
  81. package/kits/templates/roles/admin.json +2 -0
  82. package/package.json +7 -3
  83. package/AGENTS.md +0 -62
  84. package/dist/utils/codex-cli.js +0 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evolcore",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "AI Agent gateway connecting Claude, Codex, Gemini, and the bundled ecagent runner to messaging channels with multi-project session management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,6 +24,7 @@
24
24
  "kits/",
25
25
  "!kits/.kits-version",
26
26
  "*.md",
27
+ "!AGENTS.md",
27
28
  "!CLAUDE.md",
28
29
  "!COMPLETED.md",
29
30
  "!DECISIONS_PENDING.md",
@@ -39,7 +40,7 @@
39
40
  "predev": "npm run build:ecagent",
40
41
  "dev": "tsx watch src/index.ts",
41
42
  "build:ecagent": "npm --prefix ecagent run build",
42
- "build": "npm run build:ecagent && node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node -e \"const f='dist/cli/index.js',c=require('fs').readFileSync(f,'utf8');if(!c.startsWith('#!'))require('fs').writeFileSync(f,'#!/usr/bin/env node\\n'+c)\" && node -e \"try{require('child_process').execFileSync('chmod',['+x','dist/cli/index.js'])}catch{}\" && node -e \"require('fs').copyFileSync('src/utils/error-dict.json','dist/utils/error-dict.json');require('fs').copyFileSync('src/utils/model-prices.jsonl','dist/utils/model-prices.jsonl')\" && npm --prefix ecweb run build",
43
+ "build": "npm run build:ecagent && node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node -e \"const f='dist/cli/index.js',c=require('fs').readFileSync(f,'utf8');if(!c.startsWith('#!'))require('fs').writeFileSync(f,'#!/usr/bin/env node\\n'+c)\" && node -e \"try{require('child_process').execFileSync('chmod',['+x','dist/cli/index.js'])}catch{}\" && node -e \"for(const f of ['error-dict.json','model-prices.jsonl'])require('fs').copyFileSync('src/utils/'+f,'dist/utils/'+f)\" && npm --prefix ecweb run build",
43
44
  "start": "node dist/index.js",
44
45
  "test": "npm run build && vitest run",
45
46
  "test:watch": "vitest",
@@ -48,7 +49,7 @@
48
49
  "prepublishOnly": "npm test"
49
50
  },
50
51
  "dependencies": {
51
- "@agentunion/fastaun": "0.5.13",
52
+ "@agentunion/fastaun": "0.5.14",
52
53
  "@anthropic-ai/claude-agent-sdk": "0.3.220",
53
54
  "@modelcontextprotocol/sdk": "^1.29.0",
54
55
  "ajv": "^8.20.0",
@@ -71,6 +72,9 @@
71
72
  "form-data": "^4.0.5",
72
73
  "pure-qqbot": "^2.0.0"
73
74
  },
75
+ "overrides": {
76
+ "qs": "6.16.0"
77
+ },
74
78
  "devDependencies": {
75
79
  "@types/form-data": "^2.2.1",
76
80
  "@types/node": "24.12.4",
package/AGENTS.md DELETED
@@ -1,62 +0,0 @@
1
- # AGENTS.md
2
-
3
- EvolCore 仓库的通用 AI agent 指引。与 CLAUDE.md 并列,供 Codex、Gemini CLI 等非 Claude base agent 使用。内容保持一致,修改时两边同步。
4
-
5
- ## 这是什么
6
-
7
- EvolCore(npm 包 `evolcore`,CLI `ec`)运行在 base agent(Claude Code / Codex / Gemini)之上,为其接入 AUN 网络与各 IM 渠道,并提供身份、关系、环境感知与持久记忆。仓库内含两个子包:`ecweb/`(`ec-web`,Web 控制台)、`ecagent/`(agent harness)。
8
-
9
- **运行时行为去哪查**(先查 ECK,别凭记忆答):
10
-
11
- | 需要什么 | 去哪 |
12
- |---|---|
13
- | `ec` 全部命令集(含触发词) | `kits/docs/evolcore/INDEX.md` |
14
- | 上下文组装 / manifest / 运行时变量 | `kits/docs/context-assembly.md` |
15
- | 身份、关系、环境、渠道、路径注册表 | `kits/rules/`(每会话全量加载)+ `kits/docs/INDEX.md` |
16
-
17
- ## 开发命令
18
-
19
- | 目的 | 命令 |
20
- |---|---|
21
- | 热重载开发 | `npm run dev` |
22
- | 构建(含 ecweb 子包) | `npm run build` |
23
- | 全量测试(会先 build) | `npm test` |
24
- | 单文件测试(迭代时用这个) | `npx vitest run tests/unit/<name>.test.ts` |
25
- | 监听模式 | `npm run test:watch` |
26
-
27
- 改了 `src/` 必须 `npm run build` + `ec restart` 才生效。`ec agent reload` 只重载配置/persona/memory,**不重载源码**。
28
-
29
- ## 本机运行形态(重要)
30
-
31
- `resolveRoot()`(`src/paths.ts`)解析顺序:`EVOLCORE_HOME` → cwd 下存在 `agents/defaults.json` 则取 cwd → `~/.evolcore`。
32
-
33
- 本机 `/home/evolcore` 既是包根也是运行时数据根(dev 模式),所以仓库里的 `data/`、`agents/`、`logs/`、`backups/`、`eck/` 是**线上真实数据**:不要清空或批量重写,提交前确认 diff 里没有混进会话文件。测试已自动隔离到临时 `EVOLCORE_HOME`(`tests/global-setup.ts` + `tests/setup.ts`),新测试沿用该机制,不要自己指向真实 root。
34
-
35
- ## 硬约束
36
-
37
- - **ESM**:`"type": "module"`,所有相对 import 必须带 `.js` 后缀(即使源文件是 `.ts`)。
38
- - **命名边界**:产品名 / CLI 名 / 数据目录名 / 环境变量一律从 `src/product.ts` 取常量(`MAIN_CLI_BIN`、`RUNTIME_HOME_ENV`、`DAEMON_CONFIG_FILENAME` …)。仓库里仍有 evolclaw 时代的残留字符串,新代码不要跟着写死,也不要顺手做全局改名。
39
- - **跨平台**:进程与路径能力走 `src/utils/cross-platform.ts`(`isProcessRunning` / `killProcess` / `findProcesses` / `commandExists` / `tailFile` / `onShutdown` / `isMainScript`);路径一律 `path.join`;入口判断用 `isMainScript(import.meta.url)`,不要拼 `file://${process.argv[1]}`。
40
- - **执行外部命令**:用 `execFile` 系列,不要用 `execSync` 拼字符串(安全 hook 会拦)。
41
- - **别改死代码**:`src/core/message/_archived/` 是留档,改了不生效。响应主流程在 `src/core/message/response-engine.ts`;`message-processor.ts` 只是它的类型门面(27 行)。
42
- - **SDK 会话文件**:`{projectPath}/.claude/` 下的 JSONL 由 SDK 管理,只读不写;续接会话走 resume/sessionId。
43
- - **代码风格**:`docs/DEV_GUIDELINES.md`(2 空格、单引号、分号、文件名 kebab-case)。
44
-
45
- ## docs/ 的性质
46
-
47
- `docs/` 有 300+ 个文件,绝大多数是历史设计稿和阶段性报告,**相当一部分已与源码不符**。查实现以源码为准,docs 只当线索;引用某个结论前先核对当前代码。
48
-
49
- ### 功能设计文档命名规范
50
-
51
- 功能设计/方案文档必须在**文档头部**标注以下信息:
52
-
53
- ```
54
- > 状态:[draft] | [wip] | [done]
55
- > 创建:YYYY-MM-DD
56
- ```
57
-
58
- - `[draft]` — 规划了但尚未开始开发
59
- - `[wip]` — 部分阶段完成,还有后续阶段未实施
60
- - `[done]` — 已全部落地(含主动取消的范围,需在正文中注明)
61
-
62
- 判断依据:文档状态必须与 `src/`、`ecweb/src/` 中的实际实现一致。引用文档结论前先核源码。
@@ -1,43 +0,0 @@
1
- import { execFileSync } from 'child_process';
2
- import { isWindows, resolveCommandPath } from './cross-platform.js';
3
- /**
4
- * Resolve the installed Codex CLI entrypoint. npm creates a `.cmd` shim on
5
- * Windows, which is not the same executable as the extensionless Unix shim.
6
- */
7
- export function resolveCodexCliPath() {
8
- return resolveCommandPath('codex');
9
- }
10
- /**
11
- * Build a child-process invocation that works for npm's Windows command shim.
12
- * The options are injectable so platform-specific behavior can be tested on
13
- * non-Windows CI hosts.
14
- */
15
- export function resolveCodexLaunchCommand(args, options = {}) {
16
- const windows = options.isWindows ?? isWindows;
17
- const commandPath = options.commandPath !== undefined
18
- ? options.commandPath
19
- : resolveCodexCliPath();
20
- if (!commandPath)
21
- return null;
22
- if (windows && /\.(cmd|bat)$/i.test(commandPath)) {
23
- return {
24
- command: options.comSpec ?? process.env.ComSpec ?? 'cmd.exe',
25
- args: ['/d', '/s', '/c', commandPath, ...args],
26
- };
27
- }
28
- return { command: commandPath, args };
29
- }
30
- /** Execute a Codex CLI command using the resolved npm shim/path. */
31
- export function execCodexCliSync(args, options) {
32
- const commandPath = resolveCodexCliPath();
33
- if (!commandPath)
34
- throw new Error('Codex CLI not found');
35
- const launchCommand = resolveCodexLaunchCommand(args, { commandPath });
36
- if (!launchCommand)
37
- throw new Error('Codex CLI not found');
38
- return execFileSync(launchCommand.command, launchCommand.args, {
39
- ...(options ?? {}),
40
- // Keep the Windows console policy authoritative for every Codex CLI call.
41
- windowsHide: process.platform === 'win32',
42
- });
43
- }