evolcore 0.0.39 → 0.0.40

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 (102) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +31 -20
  3. package/bin/ec-safe-output.js +14 -2
  4. package/dist/agents/baseagent-availability.js +1 -0
  5. package/dist/agents/claude-runner.js +32 -46
  6. package/dist/agents/codex-runner.js +51 -27
  7. package/dist/agents/ecagent-runner.js +18 -7
  8. package/dist/agents/gemini-runner.js +1 -2
  9. package/dist/agents/runner-types.js +28 -6
  10. package/dist/aun/aid/client.js +1 -1
  11. package/dist/aun/aid/control-aid.js +23 -98
  12. package/dist/aun/aid/ownership-operation.js +1 -3
  13. package/dist/aun/group/invite-service.js +6 -0
  14. package/dist/aun/msg/p2p.js +8 -12
  15. package/dist/channels/aun.js +66 -48
  16. package/dist/channels/dingtalk.js +8 -2
  17. package/dist/channels/feishu.js +6 -1
  18. package/dist/channels/wecom.js +7 -3
  19. package/dist/cli/agent-create.js +23 -4
  20. package/dist/cli/aid-bind-command.js +4 -1
  21. package/dist/cli/daemon-commands.js +242 -17
  22. package/dist/cli/index.js +25 -13
  23. package/dist/cli/memory-command.js +33 -14
  24. package/dist/cli/restart-monitor.js +35 -13
  25. package/dist/cli/task-context.js +1 -0
  26. package/dist/config/config-field-policy.js +1 -0
  27. package/dist/contracts/ecweb-service-protocol.js +44 -0
  28. package/dist/core/agent-runtime.js +6 -0
  29. package/dist/core/auth/agent-delegation.js +7 -4
  30. package/dist/core/auth/auth-gateway.js +3 -1
  31. package/dist/core/auth/authorization-audit.js +5 -1
  32. package/dist/core/auth/debug-context.js +5 -1
  33. package/dist/core/auth/operation-catalog.js +16 -0
  34. package/dist/core/command/command-handler.js +7 -1
  35. package/dist/core/command/menu-catalog.js +48 -12
  36. package/dist/core/command/menu-handler.js +72 -4
  37. package/dist/core/command/menu-protocol.js +20 -1
  38. package/dist/core/command/slash-gate.js +17 -3
  39. package/dist/core/command/slash-handler.js +90 -7
  40. package/dist/core/event-catalog.js +2 -0
  41. package/dist/core/interaction-router.js +2 -1
  42. package/dist/core/ipc-registration.js +26 -7
  43. package/dist/core/memory/batch-meta.js +2 -0
  44. package/dist/core/memory/consolidation-context.js +42 -51
  45. package/dist/core/memory/consolidation-ops-records.js +39 -7
  46. package/dist/core/memory/consolidation-trigger.js +71 -64
  47. package/dist/core/memory/consolidation.js +226 -20
  48. package/dist/core/memory/memory-writer.js +160 -34
  49. package/dist/core/memory/relation-idle-monitor.js +287 -0
  50. package/dist/core/memory/relation-sweep.js +206 -0
  51. package/dist/core/message/aun-ipc-sender.js +5 -0
  52. package/dist/core/message/message-bridge.js +64 -55
  53. package/dist/core/message/message-log.js +17 -0
  54. package/dist/core/message/message-queue.js +6 -0
  55. package/dist/core/message/outbound.js +70 -0
  56. package/dist/core/message/peer-mode.js +7 -2
  57. package/dist/core/message/response-engine.js +341 -73
  58. package/dist/core/ownership/owner-resolver.js +384 -178
  59. package/dist/core/permission/ec-command-parser.js +19 -3
  60. package/dist/core/permission/tool-policy.js +7 -7
  61. package/dist/core/role/runtime-policy.js +64 -0
  62. package/dist/core/session/session-manager.js +25 -5
  63. package/dist/core/system-session/memory.js +3 -18
  64. package/dist/ecweb/basic-settings-service.js +709 -0
  65. package/dist/ecweb/providers-service.js +172 -0
  66. package/dist/index.js +92 -4
  67. package/dist/ipc.js +78 -11
  68. package/dist/stats/db.js +33 -0
  69. package/dist/stats/index.js +2 -2
  70. package/dist/stats/query.js +246 -0
  71. package/dist/stats/writer.js +41 -1
  72. package/dist/trigger/application-service.js +12 -0
  73. package/dist/trigger/authorization.js +2 -2
  74. package/dist/trigger/history.js +36 -0
  75. package/dist/trigger/scheduler.js +3 -0
  76. package/dist/utils/ecweb-supervisor.js +31 -10
  77. package/dist/utils/error-utils.js +8 -4
  78. package/dist/utils/evolcore-version.js +3 -2
  79. package/dist/utils/host-info.js +52 -0
  80. package/ecagent/dist/harness/agent-harness.js +4 -1
  81. package/kits/docs/evolcore/INDEX.md +1 -1
  82. package/kits/docs/evolcore/agent.md +1 -1
  83. package/kits/docs/evolcore/aid.md +29 -12
  84. package/kits/docs/evolcore/config.md +9 -7
  85. package/kits/docs/evolcore/memory-architecture.md +3 -4
  86. package/kits/docs/evolcore/memory-consolidation.md +28 -7
  87. package/kits/docs/evolcore/memory-tags.md +1 -1
  88. package/kits/docs/evolcore/memory.md +1 -1
  89. package/kits/docs/evolcore/menu-client.md +1 -1
  90. package/kits/docs/evolcore/menu-protocol.md +6 -0
  91. package/kits/docs/evolcore/msg.md +1 -1
  92. package/kits/eck_manifest.json +3 -3
  93. package/kits/rules/04-relation.md +3 -2
  94. package/kits/schemas/agent-config.schema.13.json +5 -1
  95. package/kits/templates/memory-consolidation/generalize.md +32 -4
  96. package/kits/templates/memory-consolidation/notes.md +2 -2
  97. package/kits/templates/memory-consolidation/promote.md +10 -2
  98. package/kits/templates/system-fragments/baseagent.md +5 -0
  99. package/kits/templates/system-fragments/memory.md +12 -3
  100. package/kits/templates/system-fragments/session.md +1 -1
  101. package/kits/{rules/07-memory-and-thread.md → templates/system-fragments/thread.md} +17 -80
  102. package/package.json +3 -3
@@ -1,59 +1,13 @@
1
- # 记忆与话题:持久化上下文的两套机制
1
+ [thread] 话题系统(ec thread)
2
+ 触发词:话题/thread/summary/摘要/ec thread/话题名/工作报告
2
3
 
3
- 触发词:记忆/memory/话题/thread/summary/摘要/ec memory/ec thread/话题名/工作报告
4
+ 话题摘要是**话题级**的进展快照:这条任务线做了什么、结果如何,供下次激活时快速恢复。
5
+ 对端的长期事实(偏好、角色、背景)不写这里,写记忆(见 `[memory]` 段)。
4
6
 
5
- 这两套机制共同解决"跨会话上下文丢失"的问题,但定位不同:
7
+ `ec thread` 的 `<peer>` 参数是对端**裸 AID**(取 `peerId`,如 `alice.agentid.cn`),
8
+ 不是 `aun#…` 形态的 peerKey;传 peerKey 会静默返回 0 条。
6
9
 
7
- | 机制 | 粒度 | 作用 | 写入时机 |
8
- |------|------|------|----------|
9
- | 记忆(memory) | 对端级 / agent 级 / owner 级 | 跨所有话题持久化的长期事实 | 每轮对话中识别到值得保留的事实时 |
10
- | 话题摘要(summary) | 话题级 | 这个话题的进展快照,供下次激活时快速恢复 | 阶段完成时、离开话题前 |
11
-
12
- 两者不冲突,按粒度分工:对端的基本信息(偏好、角色、背景)写进记忆;这个任务线做了什么、结果如何写进话题摘要。
13
-
14
- ---
15
-
16
- ## 一、记忆系统(ec memory)
17
-
18
- 记忆是写给自己、跨会话持久的事实。不要依赖会话上下文来记住用户说过的事,用记忆系统写下来。
19
-
20
- ### 什么时候写记忆
21
-
22
- **必须写的情况**:
23
- - 用户告知了关于自己的事实(姓名、职业、偏好、背景)
24
- - 用户明确要求"记住"某件事
25
- - 发现了跨会话有用的规律(用户的工作方式、反馈模式)
26
-
27
- **不要写的情况**:
28
- - 当前话题的具体进展(写话题摘要,不写记忆)
29
- - 只在本会话有意义的临时状态
30
- - 代码结构、文件路径、git 历史(代码库本身就记录了)
31
-
32
- ### 记忆命令
33
-
34
- ```bash
35
- # 写入新 note
36
- ec memory note --slug <slug> [--tags '<tag1>,<tag2>'] '<正文>'
37
-
38
- # 修改已有 note
39
- ec memory note update <slug> '<新正文>'
40
-
41
- # 查看待整理 notes
42
- ec memory note list
43
-
44
- # 触发整理会话(将 notes 归档为正式记忆)
45
- ec memory consolidate
46
- ```
47
-
48
- ### 默认行为
49
-
50
- 记忆写入动作默认**静默**,不打断对话。用户明确要求记住某事时,给一句简短确认("已记下"),然后继续。
51
-
52
- ---
53
-
54
- ## 二、话题系统(ec thread)
55
-
56
- ### 标准工作流
10
+ ## 标准工作流
57
11
 
58
12
  ```bash
59
13
  # 1. 列出本机所有 agent
@@ -71,11 +25,11 @@ ec thread list <peer> --self <selfAid> --page 2 --limit 10 --sort recent
71
25
  # 5. 查看某话题的历史消息
72
26
  ec thread history <peer>/<threadId> --self <selfAid> --limit 20
73
27
 
74
- # 6. 查看/更新话题摘要
28
+ # 6. 查看话题摘要(写摘要见下文「话题摘要维护」)
75
29
  ec thread summary show <peer>/<threadId> --self <selfAid>
76
30
  ```
77
31
 
78
- ### 跨话题发送(联系当前对端以外的对象)
32
+ ## 跨话题发送(联系当前对端以外的对象)
79
33
 
80
34
  一个话题只有本端与对端两端。当前话题能直接回复的只有本话题的对端;要联系**其他**对象,必须换到与该对象的话题上发送:
81
35
 
@@ -95,7 +49,7 @@ ec group send '<text>' --thread <threadId> --check-every 5m # 群对端
95
49
  - `--check-every` 会创建周期复查 Trigger(每次发送各新建一个,名称 `check-<目标>-from-<来源>-<唯一后缀>`),
96
50
  需显式 `ec trigger delete <trigger_id>` 结束(不要用 `cancel`,那只是 disable,会留下挂起的死 Trigger);定位用返回的 `trigger_id`(`trig_…`),**不是名称**
97
51
 
98
- ### 话题名称维护
52
+ ## 话题名称维护
99
53
 
100
54
  **何时更新名称**(主动触发,不等对端问):
101
55
 
@@ -115,7 +69,7 @@ ec thread rename current '<新名称>' # 托管会
115
69
  ec thread rename <peer>/<threadId> '<新名称>' --self <selfAid> # 宿主终端
116
70
  ```
117
71
 
118
- ### 话题摘要维护
72
+ ## 话题摘要维护
119
73
 
120
74
  摘要是话题的进展快照,**daemon 不自动总结**,需要主动写入。
121
75
 
@@ -134,8 +88,7 @@ ec thread summary set current '<摘要内容>' --name '<新标题>' # 2. 写
134
88
  ec thread summary show <peer>/<threadId> # 1. 拿 coveredThroughTs
135
89
  ec thread history <peer>/<threadId> --after <coveredThroughTs> --limit 50 # 2. 读增量
136
90
  ec thread history <peer>/<threadId> --before <最早ts-1> --limit 50 # 3. 增量多则往回翻页
137
- ec thread summary set <peer>/<threadId> '<摘要内容>' # 4. 读完再写(游标自动推进)
138
- ec thread rename <peer>/<threadId> '<新名称>' # 5. 必要时改名
91
+ ec thread summary set <peer>/<threadId> '<摘要内容>' --name '<新标题>' # 4. 读完再写(游标自动推进)
139
92
  ```
140
93
 
141
94
  **关键约束**:`summary set` 把游标设为**当时话题的最新一条**,所以跨话题总结**必须先把增量读完再写**——
@@ -164,22 +117,15 @@ ec thread rename <peer>/<threadId> '<新名称>' # 5.
164
117
  - summary 是本端私有的(keyed by 本地 sessionId),只写"我下次该知道什么",不写给对端的话
165
118
 
166
119
  ```bash
167
- # 查看当前摘要和版本号
168
- ec thread summary show current
169
-
170
- # 写入摘要(单 agent)
171
- ec thread summary set current '<摘要内容>'
172
-
173
- # 写入摘要(多 agent 协作,用 CAS 防覆盖)
174
- ec thread summary set current '<摘要内容>' --if-rev <当前rev>
175
-
176
- # 查看摘要历史
177
- ec thread summary log current
120
+ ec thread summary set current '<摘要内容>' --name - --if-rev <当前rev> # 多 agent 协作,CAS 防覆盖
121
+ ec thread summary log current # 查看摘要历史
178
122
  ```
179
123
 
180
124
  `ec thread list` 输出里摘要显示"未总结"就是行动信号。
181
125
 
182
- ### 话题状态管理
126
+ **不要**:每条消息后都更新摘要(只在阶段完成时);把摘要写成会议纪要;因为对端没问就不更新。
127
+
128
+ ## 话题状态管理
183
129
 
184
130
  ```bash
185
131
  ec thread status current in_progress # 开始处理
@@ -188,12 +134,3 @@ ec thread status current completed # 任务完成
188
134
  ```
189
135
 
190
136
  状态改为 `completed` 前,先写入最终摘要。
191
-
192
- ---
193
-
194
- ## 三、不需要做的事
195
-
196
- - 不要在每条消息后都更新摘要——只在阶段完成时
197
- - 不要把话题摘要当成会议纪要——简短的进展摘记即可
198
- - 不要把当前话题的进展写进记忆——那是话题摘要的工作
199
- - 不要因为对端没问就不更新——摘要和记忆都是给自己的
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evolcore",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
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",
@@ -54,14 +54,14 @@
54
54
  "prepublishOnly": "npm test"
55
55
  },
56
56
  "dependencies": {
57
- "@agentunion/fastaun": "0.5.23",
57
+ "@agentunion/fastaun": "0.5.25",
58
58
  "@anthropic-ai/claude-agent-sdk": "0.3.300",
59
59
  "@modelcontextprotocol/sdk": "^1.29.0",
60
60
  "ajv": "^8.20.0",
61
61
  "chokidar": "^5.0.0",
62
62
  "cron-parser": "^5.5.0",
63
63
  "dotenv": "^17.4.2",
64
- "ec-web": "0.0.39",
64
+ "ec-web": "0.0.40",
65
65
  "ignore": "7.0.5",
66
66
  "image-type": "^6.0.0",
67
67
  "partial-json": "0.1.7",