evolcore 0.0.33 → 0.0.35-test.0

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 (152) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/bin/ec.js +3 -2
  3. package/bin/install-codex-managed-hooks.mjs +38 -4
  4. package/dist/agents/baseagent-availability.js +20 -36
  5. package/dist/agents/claude-runner.js +93 -14
  6. package/dist/agents/codex/diagnostics.js +79 -22
  7. package/dist/agents/codex-runner.js +245 -47
  8. package/dist/agents/ecagent-runner.js +90 -27
  9. package/dist/agents/runner-types.js +5 -6
  10. package/dist/aun/aid/agentmd.js +13 -2
  11. package/dist/aun/aid/client.js +1 -1
  12. package/dist/aun/aid/identity.js +1 -1
  13. package/dist/aun/msg/managed-operation.js +16 -0
  14. package/dist/aun/msg/p2p.js +18 -2
  15. package/dist/channels/aun.js +123 -7
  16. package/dist/channels/daemon.js +6 -3
  17. package/dist/cli/aun-commands.js +39 -14
  18. package/dist/cli/ctl-command.js +3 -1
  19. package/dist/cli/daemon-commands.js +130 -23
  20. package/dist/cli/fs-command.js +2 -1
  21. package/dist/cli/getmeta-command.js +211 -0
  22. package/dist/cli/index.js +26 -6
  23. package/dist/cli/integrity-command.js +196 -0
  24. package/dist/cli/managed-command-guard.js +3 -0
  25. package/dist/cli/memory-command.js +200 -156
  26. package/dist/cli/thread-command.js +17 -7
  27. package/dist/cli/trigger-command.js +6 -1
  28. package/dist/config/config-field-policy.js +4 -0
  29. package/dist/config/config-manager.js +19 -0
  30. package/dist/config/contact-book-store.js +5 -0
  31. package/dist/config/resolved-config-op.js +25 -8
  32. package/dist/config/role-service.js +13 -0
  33. package/dist/config/runtime-env.js +16 -0
  34. package/dist/config-store.js +30 -0
  35. package/dist/core/audit/log-integrity.js +3 -1
  36. package/dist/core/auth/agent-delegation.js +108 -35
  37. package/dist/core/auth/delegation-diagnostics.js +414 -0
  38. package/dist/core/auth/operation-authorizer.js +22 -3
  39. package/dist/core/auth/operation-catalog.js +16 -0
  40. package/dist/core/channel-runtime.js +1 -1
  41. package/dist/core/command/agent-control.js +18 -26
  42. package/dist/core/command/command-handler.js +145 -5
  43. package/dist/core/command/daemon-diagnostics.js +1 -0
  44. package/dist/core/command/menu-catalog.js +3 -0
  45. package/dist/core/command/menu-handler.js +24 -7
  46. package/dist/core/command/menu-protocol.js +1 -0
  47. package/dist/core/command/slash-handler.js +2 -0
  48. package/dist/core/command/topic-slash.js +4 -7
  49. package/dist/core/daemon-bootstrap.js +4 -7
  50. package/dist/core/event-catalog.js +14 -0
  51. package/dist/core/file-integrity/read.js +61 -0
  52. package/dist/core/file-integrity/store.js +262 -0
  53. package/dist/core/ipc-registration.js +47 -2
  54. package/dist/core/memory/batch-meta.js +133 -0
  55. package/dist/core/memory/consolidation-context.js +132 -28
  56. package/dist/core/memory/consolidation-ops-records.js +14 -16
  57. package/dist/core/memory/consolidation-trigger.js +15 -7
  58. package/dist/core/memory/consolidation.js +146 -26
  59. package/dist/core/memory/index-manager.js +19 -28
  60. package/dist/core/memory/memory-admin.js +19 -14
  61. package/dist/core/memory/memory-document.js +53 -9
  62. package/dist/core/memory/memory-writer.js +50 -19
  63. package/dist/core/message/aun-ipc-sender.js +19 -1
  64. package/dist/core/message/im-renderer.js +20 -4
  65. package/dist/core/message/message-bridge.js +5 -4
  66. package/dist/core/message/message-log.js +1 -0
  67. package/dist/core/message/peer-mode.js +17 -0
  68. package/dist/core/message/response-engine.js +598 -50
  69. package/dist/core/permission/ec-command-parser.js +169 -44
  70. package/dist/core/permission/protected-paths.js +5 -1
  71. package/dist/core/permission/readonly-shell-query.js +43 -5
  72. package/dist/core/permission/session-path-grants.js +334 -0
  73. package/dist/core/permission/tool-canonical.js +226 -0
  74. package/dist/core/permission/tool-policy.js +60 -62
  75. package/dist/core/relation/peer-identity.js +87 -12
  76. package/dist/core/role/runtime-policy.js +21 -10
  77. package/dist/core/session/session-fs-store.js +123 -8
  78. package/dist/core/session/session-manager.js +131 -6
  79. package/dist/core/session/session-title.js +26 -1
  80. package/dist/core/skill/index-generator.js +17 -3
  81. package/dist/core/system-session/grants.js +40 -0
  82. package/dist/core/system-session/memory.js +289 -0
  83. package/dist/core/system-session/registry.js +74 -0
  84. package/dist/core/system-session/types.js +14 -0
  85. package/dist/core/thread/command-parser.js +6 -1
  86. package/dist/core/thread/ipc-operation.js +33 -16
  87. package/dist/core/thread/thread-operation.js +62 -24
  88. package/dist/core/thread/thread-service.js +258 -51
  89. package/dist/eck/kit-renderer.js +7 -2
  90. package/dist/eck/manifest-engine.js +24 -4
  91. package/dist/index.js +11 -2
  92. package/dist/ipc.js +51 -40
  93. package/dist/paths.js +70 -0
  94. package/dist/stats/billing.js +20 -8
  95. package/dist/trigger/feedback.js +6 -1
  96. package/dist/trigger/parser.js +8 -1
  97. package/dist/trigger/system-definitions.js +3 -3
  98. package/dist/utils/cross-platform.js +17 -5
  99. package/dist/utils/error-dict.json +18 -4
  100. package/dist/utils/error-utils.js +121 -0
  101. package/dist/utils/instance-registry.js +13 -8
  102. package/dist/utils/log-writer.js +12 -0
  103. package/dist/utils/process-introspect.js +11 -0
  104. package/kits/docs/context-assembly.md +0 -1
  105. package/kits/docs/evolcore/agent-create.md +5 -4
  106. package/kits/docs/evolcore/agent.md +2 -2
  107. package/kits/docs/evolcore/config.md +2 -2
  108. package/kits/docs/evolcore/ctl.md +2 -2
  109. package/kits/docs/evolcore/ec-capabilities.md +1 -1
  110. package/kits/docs/evolcore/fs-architecture.md +9 -10
  111. package/kits/docs/evolcore/fs.md +2 -2
  112. package/kits/docs/evolcore/group-collaboration.md +3 -3
  113. package/kits/docs/evolcore/group.md +14 -12
  114. package/kits/docs/evolcore/memory-architecture.md +4 -5
  115. package/kits/docs/evolcore/memory-consolidation.md +19 -16
  116. package/kits/docs/evolcore/memory-tags.md +3 -1
  117. package/kits/docs/evolcore/memory.md +24 -12
  118. package/kits/docs/evolcore/model.md +16 -0
  119. package/kits/docs/evolcore/msg.md +7 -7
  120. package/kits/docs/evolcore/stats.md +1 -1
  121. package/kits/docs/evolcore/thread-chain.md +30 -14
  122. package/kits/docs/prompt-loading-architecture.md +0 -1
  123. package/kits/eck_manifest.auxiliary.json +9 -0
  124. package/kits/eck_manifest.json +20 -20
  125. package/kits/eck_manifest.memory.json +20 -12
  126. package/kits/rules/01-overview.md +11 -0
  127. package/kits/rules/03-identity.md +6 -3
  128. package/kits/rules/06-channel.md +1 -1
  129. package/kits/rules/07-memory-and-thread.md +13 -16
  130. package/kits/schemas/_meta.json +7 -1
  131. package/kits/schemas/agent-config.schema.13.json +1 -1
  132. package/kits/schemas/daemon.schema.7.json +140 -0
  133. package/kits/skills/ec-group/SKILL.md +8 -5
  134. package/kits/skills/ec-skill/scripts/cli.mjs +1 -1
  135. package/kits/skills/ec-skill/scripts/skill.mjs +1 -1
  136. package/kits/skills/thread-ops/SKILL.md +18 -18
  137. package/kits/templates/memory-consolidation/forget.md +2 -2
  138. package/kits/templates/memory-consolidation/generalize.md +4 -4
  139. package/kits/templates/memory-consolidation/notes.md +12 -12
  140. package/kits/templates/memory-consolidation/profile.md +3 -3
  141. package/kits/templates/memory-consolidation/promote.md +3 -3
  142. package/kits/templates/memory-consolidation/workflow.md +42 -7
  143. package/kits/templates/message-fragments/handoff-request-to-target.md +1 -1
  144. package/kits/templates/system-fragments/bash-description.md +9 -0
  145. package/kits/templates/system-fragments/bootstrap.md +4 -3
  146. package/kits/templates/system-fragments/channel.md +2 -2
  147. package/kits/templates/system-fragments/memory.md +16 -9
  148. package/kits/templates/system-fragments/reply.md +6 -6
  149. package/kits/templates/system-fragments/session.md +1 -1
  150. package/package.json +4 -3
  151. package/dist/core/memory/memory-session-policy.js +0 -41
  152. package/dist/core/memory/memory-signature.js +0 -257
@@ -17,22 +17,22 @@
17
17
 
18
18
  ```bash
19
19
  # 文本(明文)
20
- ec msg send <from> <to> "<text>"
20
+ ec msg send <from> <to> '<text>'
21
21
 
22
22
  # 从文件读取文本内容(用于超长消息或避免 Shell 转义)
23
23
  ec msg send <from> <to> --text-from-file <path>
24
24
 
25
25
  # 文本(密文 E2EE)
26
- ec msg send <from> <to> "<text>" --encrypt
26
+ ec msg send <from> <to> '<text>' --encrypt
27
27
 
28
28
  # 强制明文(同时出现时优先于 --encrypt)
29
- ec msg send <from> <to> "<text>" --no-encrypt
29
+ ec msg send <from> <to> '<text>' --no-encrypt
30
30
 
31
31
  # 文件:--as 可选 image|video|voice|file(默认按扩展名推断)
32
32
  ec msg send <from> <to> --file <path> [--as <type>]
33
33
 
34
34
  # 链接卡片
35
- ec msg send <from> <to> --link <url> [--title "<title>"] [--description "<desc>"]
35
+ ec msg send <from> <to> --link <url> [--title '<title>'] [--description '<desc>']
36
36
 
37
37
  # 自定义 payload(JSON)
38
38
  ec msg send <from> <to> --payload '<json>'
@@ -67,7 +67,7 @@ ec contact unblock <target-aid> --self <self-aid>
67
67
 
68
68
  非托管环境的 `ec msg send` 是独立 AUN CLI 发送,不读取或要求 `agents/<aid>/config.json`,因此不会触发这套 Agent 联系人准入判断。
69
69
 
70
- 在 EvolCore 会话内,发送会经过当前 session 的 self/peer/role 鉴权。`visitor` 或 `member` 默认只允许回复当前对端;要联系当前对端以外的对象,必须通过话题路由:先 `ec thread list <对方AID>` 选话题(没有就 `ec thread create`),再用 `ec msg send "<text>" --thread <threadId> --check-every <时长>` 发送;from/to 由话题推断,无需手写。不带 `--thread` 直接改目标会被拒绝。完整话题路由操作序列见 `[memory-and-thread]` 段。没有成功 JSON 回执(含 `message_id`/`status`)不得声称已发送。
70
+ 在 EvolCore 会话内,发送会经过当前 session 的 self/peer/role 鉴权。`visitor` 或 `member` 默认只允许回复当前对端;要联系当前对端以外的对象,必须通过话题路由:先 `ec thread list <对方AID>` 选话题(没有就 `ec thread create`),再用 `ec msg send '<text>' --thread <threadId> --check-every <时长>` 发送;from/to 由话题推断,无需手写。不带 `--thread` 直接改目标会被拒绝。完整话题路由操作序列见 `[memory-and-thread]` 段。没有成功 JSON 回执(含 `message_id`/`status`)不得声称已发送。
71
71
 
72
72
  成功输出:`✓ 已发送 <message_id> seq=<n> status=<status>`
73
73
 
@@ -163,6 +163,6 @@ ec msg history <self-aid> <target-aid> \
163
163
  仅当无法使用 `ec msg send` 时(如拿不到自己的 AID),可用 `ec ctl send`,它自动继承当前会话的 AID 和对端:
164
164
 
165
165
  ```bash
166
- ec ctl send "<text>"
167
- ec ctl send --encrypt "<text>"
166
+ ec ctl send '<text>'
167
+ ec ctl send --encrypt '<text>'
168
168
  ```
@@ -67,7 +67,7 @@ ec stats --rebuild
67
67
  ## 直接 SQL 查询
68
68
 
69
69
  ```bash
70
- ec stats --sql "SELECT model, COUNT(*) AS cnt FROM usage_events GROUP BY model"
70
+ ec stats --sql 'SELECT model, COUNT(*) AS cnt FROM usage_events GROUP BY model'
71
71
  ```
72
72
 
73
73
  仅允许 SELECT 查询(只读安全)。
@@ -27,7 +27,7 @@ ec thread history <peer>/<threadId> --self <selfAid> --limit 20
27
27
  # 第六步:查看/写入 summary
28
28
  ec thread summary show <peer>/<threadId> --self <selfAid>
29
29
  # 写入时必须带 --name(同时设标题);不想改名传 -(详见「话题摘要」一节)
30
- ec thread summary set <peer>/<threadId> "摘要内容" --name "<新标题>" --self <selfAid>
30
+ ec thread summary set <peer>/<threadId> '<摘要内容>' --name '<新标题>' --self <selfAid>
31
31
  ```
32
32
 
33
33
  ## 什么时候用
@@ -85,8 +85,8 @@ ec msg history --thread <threadId>
85
85
  ### 新建话题
86
86
 
87
87
  ```bash
88
- ec thread create <peer> --name "项目A需求讨论"
89
- ec thread create <peer> --name "项目A" --label 项目A --status in_progress
88
+ ec thread create <peer> --name '项目A需求讨论'
89
+ ec thread create <peer> --name '项目A' --label 项目A --status in_progress
90
90
  ```
91
91
 
92
92
  创建成功后返回 `threadId`,格式为 `thread-<ms>-<seq4>-<rand4>`(如 `thread-1791028341906-0000-136a`)。创建时会自动向对端发一条系统消息通知。
@@ -94,12 +94,28 @@ ec thread create <peer> --name "项目A" --label 项目A --status in_progress
94
94
  ### 修改话题
95
95
 
96
96
  ```bash
97
- ec thread rename <peer>/<threadId> "新名称"
97
+ ec thread rename <peer>/<threadId> '新名称'
98
+ ec thread rename <peer> '新名称' # 裸 peer 指主会话;等价于 <peer>/main
98
99
  ec thread label <peer>/<threadId> 重要
99
100
  ec thread label <peer>/<threadId> --clear # 清除标签
100
101
  ec thread status <peer>/<threadId> completed # pending|in_progress|completed|archived
101
102
  ```
102
103
 
104
+ 主会话可以改名(落在会话存档的 `name` 字段),但**不能**打标签或改状态——label/status 只对子话题生效。
105
+ `ec thread list` / `show` 里主会话的名称带 `[主会话] ` 前缀,该前缀只在展示层加,不是真实名字。
106
+
107
+ `summary set ... --name` 对主会话同样生效,改名走与 `ec thread rename` 相同的路径。
108
+
109
+ #### 名称长度
110
+
111
+ 正文上限 **80 字符**(按 Unicode 码点计,含空格与标点);加末尾 `...` 后落盘上限 **83 字符**。
112
+ 自动生成与手动改名(`create` / `rename` / `summary set --name`)共用 `session-title.ts` 里的同一组常量。
113
+
114
+ - 长于 80 字符的文本由 `sanitizeSessionTitle` 截为前 80 字符 + `...`;
115
+ - 写入时按 **83 字符**校验(落盘上限),超过即报 `NAME_TOO_LONG`,报错里带上当前长度和上限;
116
+ - 为什么不按 80 拒绝:系统自动生成的话题名最长就是 83 字符,按 80 拒绝会让这些名字「改不回去」;
117
+ - 历史遗留的超长名称原样保留、可正常读取。
118
+
103
119
  `/name` 和 `/rename` 也会同步更新话题索引。
104
120
 
105
121
  ### 删除话题
@@ -120,13 +136,13 @@ ec thread delete <peer>/<threadId> # 软删除:session 文件移入 _trash/
120
136
 
121
137
  ```bash
122
138
  # 完整形式
123
- ec msg send <from> <to> "消息内容" --thread <threadId>
139
+ ec msg send <from> <to> '<消息内容>' --thread <threadId>
124
140
 
125
141
  # 托管会话简化形式(from/to 自动从运行时上下文推断)
126
- ec msg send "消息内容" --thread <threadId>
142
+ ec msg send '<消息内容>' --thread <threadId>
127
143
 
128
144
  # 附带复查 Trigger(跨话题时必填;每 30m 唤醒本端回查)
129
- ec msg send "消息内容" --thread <threadId> --check-every 30m
145
+ ec msg send '<消息内容>' --thread <threadId> --check-every 30m
130
146
  ```
131
147
 
132
148
  注意事项:
@@ -147,7 +163,7 @@ ec msg send "消息内容" --thread <threadId> --check-every 30m
147
163
 
148
164
  ```bash
149
165
  # A 向 B 的话题 T2 发送任务,并设置周期复查
150
- ec msg send "请处理项目A的数据清洗" --thread thread-T2-xxxx --check-every 2h
166
+ ec msg send '请处理项目A的数据清洗' --thread thread-T2-xxxx --check-every 2h
151
167
  ```
152
168
 
153
169
  **B 接收时感知来源上下文:**
@@ -174,12 +190,12 @@ daemon 不自动总结,需要 agent 主动写入。
174
190
  ec thread summary show <peer>/<threadId>
175
191
 
176
192
  # 写入摘要 —— --name 必填:同时把话题改成这个标题
177
- ec thread summary set <peer>/<threadId> "项目A需求已确认,正在开发登录模块" --name "项目A登录模块"
193
+ ec thread summary set <peer>/<threadId> '项目A需求已确认,正在开发登录模块' --name '项目A登录模块'
178
194
  # 不想改话题名就显式传 -
179
- ec thread summary set <peer>/<threadId> "摘要内容" --name -
195
+ ec thread summary set <peer>/<threadId> '<摘要内容>' --name -
180
196
 
181
197
  # 支持 CAS(乐观锁),防止并发覆盖
182
- ec thread summary set <peer>/<threadId> "新内容" --name - --if-rev 3
198
+ ec thread summary set <peer>/<threadId> '新内容' --name - --if-rev 3
183
199
 
184
200
  # 查看历史版本
185
201
  ec thread summary log <peer>/<threadId>
@@ -206,7 +222,7 @@ ec thread history <peer>/<threadId> --after <coveredThroughTs> --limit 50
206
222
  ec thread history <peer>/<threadId> --before <本页最早一条的ts> --limit 50
207
223
 
208
224
  # 4. 读完增量后写摘要,游标自动推进到当前最新一条
209
- ec thread summary set <peer>/<threadId> "新摘要" --name -
225
+ ec thread summary set <peer>/<threadId> '新摘要' --name -
210
226
  ```
211
227
 
212
228
  **约束**:`summary set` 把游标设为**写入时刻话题的最新一条**,所以跨话题总结必须**先把增量读完再写**——
@@ -263,5 +279,5 @@ ec thread check-index # 同 rebuild-index --check
263
279
  | `TOPIC_CONFLICT` | 同名话题已存在 | 改名或用现有话题 |
264
280
  | `TOPIC_BUSY` | 话题正在处理中 | 等待处理完成后再删除 |
265
281
  | `SUMMARY_CAS_CONFLICT` | 摘要版本冲突 | 重新 `show` 获取最新 rev,再重试 |
266
- | `INVALID_NAME` | 话题名称不合法 | 名称不能为空,不超过 80 字符 |
267
- | `NAME_TOO_LONG` | 话题名称超过 80 字符 | 缩短名称 |
282
+ | `INVALID_NAME` | 话题名称不合法 | 名称不能为空 |
283
+ | `NAME_TOO_LONG` | 话题名称超过 83 字符(正文 80 + 省略号) | 按报错里的当前长度缩写后重试 |
@@ -103,7 +103,6 @@
103
103
  | 10 | rules | always | ✗ | `$KITS_RULES/` 目录(ECK 核心规则) |
104
104
  | 20 | identity-layer | chatType≠null | ✓ | 身份层 fragment |
105
105
  | 21 | persona | chatType≠null | ✗ | `$PERSONAL_DIR/persona.md` |
106
- | 21.5 | personal-profile | chatType≠null | ✗ | `$PERSONAL_DIR/personal.md` |
107
106
  | 30 | relation-layer | chatType∈{private,group} | ✓ | 关系层 fragment |
108
107
  | 35 | memory | memoryEnableRelation≠false | ✓ | 记忆系统 fragment(按 sessionType 分支) |
109
108
  | 36 | agent-memory | memoryEnableAgent≠false | ✗ | `$PERSONAL_DIR/memory/MEMORY.md` |
@@ -38,6 +38,15 @@
38
38
  "needsInjection": true,
39
39
  "when": { "var": "baseAgent", "neq": null },
40
40
  "description": "Base Agent 特定配置"
41
+ },
42
+ {
43
+ "id": "bash-description",
44
+ "type": "file",
45
+ "file": "$KITS_FRAGMENTS/bash-description.md",
46
+ "order": 75,
47
+ "needsInjection": true,
48
+ "when": { "var": "baseAgent", "in": ["claude", "ecagent"] },
49
+ "description": "Bash 调用 description 格式:目标描述 + 风险等级标记"
41
50
  }
42
51
  ]
43
52
  }
@@ -91,26 +91,6 @@
91
91
  },
92
92
  "description": "人格档案(persona.md)"
93
93
  },
94
- {
95
- "id": "personal-profile",
96
- "type": "file",
97
- "file": "$PERSONAL_DIR/personal.md",
98
- "order": 21.5,
99
- "needsInjection": false,
100
- "when": {
101
- "and": [
102
- {
103
- "var": "chatType",
104
- "neq": null
105
- },
106
- {
107
- "var": "lifecycle",
108
- "eq": "active"
109
- }
110
- ]
111
- },
112
- "description": "个人资料(personal.md)"
113
- },
114
94
  {
115
95
  "id": "relation-layer",
116
96
  "type": "file",
@@ -464,6 +444,26 @@
464
444
  },
465
445
  "description": "Base Agent 特定配置"
466
446
  },
447
+ {
448
+ "id": "bash-description",
449
+ "type": "file",
450
+ "file": "$KITS_FRAGMENTS/bash-description.md",
451
+ "order": 75,
452
+ "needsInjection": true,
453
+ "when": {
454
+ "and": [
455
+ {
456
+ "var": "baseAgent",
457
+ "in": ["claude", "ecagent"]
458
+ },
459
+ {
460
+ "var": "lifecycle",
461
+ "in": ["active", "bootstrapping"]
462
+ }
463
+ ]
464
+ },
465
+ "description": "Bash 调用 description 格式:目标描述 + 风险等级标记"
466
+ },
467
467
  {
468
468
  "id": "managed-runtime-notice",
469
469
  "type": "file",
@@ -45,18 +45,6 @@
45
45
  },
46
46
  "description": "人格档案(判断记忆取舍时的行为准则参考)"
47
47
  },
48
- {
49
- "id": "personal-profile",
50
- "type": "file",
51
- "file": "$PERSONAL_DIR/personal.md",
52
- "order": 26,
53
- "needsInjection": false,
54
- "when": {
55
- "var": "lifecycle",
56
- "eq": "active"
57
- },
58
- "description": "个人资料与工作背景(判断记忆取舍时的自身定位参考)"
59
- },
60
48
  {
61
49
  "id": "peer-profile",
62
50
  "type": "file",
@@ -252,6 +240,26 @@
252
240
  "eq": "active"
253
241
  },
254
242
  "description": "会话层:当前会话实例状态"
243
+ },
244
+ {
245
+ "id": "bash-description",
246
+ "type": "file",
247
+ "file": "$KITS_FRAGMENTS/bash-description.md",
248
+ "order": 65,
249
+ "needsInjection": true,
250
+ "when": {
251
+ "and": [
252
+ {
253
+ "var": "baseAgent",
254
+ "in": ["claude", "ecagent"]
255
+ },
256
+ {
257
+ "var": "lifecycle",
258
+ "eq": "active"
259
+ }
260
+ ]
261
+ },
262
+ "description": "Bash 调用 description 格式:目标描述 + 风险等级标记"
255
263
  }
256
264
  ]
257
265
  }
@@ -148,6 +148,17 @@ manifest schema、when 条件、合并覆盖、模板渲染、运行时变量目
148
148
  开启后落 `$EVOLCORE_HOME/data/eck-debug/`,文件名带时间戳:`vars-<ts>.json`、`context-<ts>.md`、
149
149
  `fragments-<ts>.md`、`manifest-<ts>.md`(逐条消息渲染另有 `msg-render-<ts>.md`),保留 24 小时。
150
150
 
151
+ ## 命令行的引号写法
152
+
153
+ `ec` 命令里的自由文本参数(消息正文、`--desc`、`--prompt`、`--name`、`--question`、
154
+ `--reason` 等)默认**用单引号包住**(`'…'`)。
155
+
156
+ 用双引号的话,正文里的反引号(`` ` ``)和 `$` 会被 shell 当作命令替换或变量展开,
157
+ 命令会被拒绝——`ec` 只接受能确认为字面量的命令。
158
+
159
+ **正文本身含单引号时**,改用 bash ANSI-C quoting:`$'…'`。
160
+ 内部支持转义:`\'` `\n` `\t` `\\`。例:`ec msg send $'it\'s fine'`。
161
+
151
162
  ## 术语
152
163
 
153
164
  - **主体(Principal)**:通信参与者——人或 agent。AUN 网络上的主体持有 AID;非 AUN 渠道(飞书/微信等)的对端以该渠道的账号标识,同样是主体
@@ -17,8 +17,7 @@
17
17
 
18
18
  | 路径 | 用途 | 实际状态 |
19
19
  |------|------|----------|
20
- | `persona.md` | 人格(行为规范、身份认知) | evolcore 自动注入;通过 `ec agent persona` 读写 |
21
- | `personal.md` | 个人资料与工作背景 | evolcore 自动注入;当前 Agent 在 owner 权限下可直接编辑 |
20
+ | `persona.md` | 人格(行为规范、身份认知)+ 个人资料与工作背景 + `## Bootstrap 交接` | evolcore 自动注入;通过 `ec agent persona` 读写,owner 会话中也可用文件工具直接编辑 |
22
21
  | `memory/MEMORY.md` | agent 级 consolidated 记忆索引 | manifest order 36 注入(受 `memory.enableAgent` 开关控制) |
23
22
  | `memory/pending/` | 待整理记忆(note) | 主会话写入,不注入 |
24
23
  | `memory/consolidated/` | 正式记忆文件(签名) | 整理会话产出,通过 MEMORY.md 索引按需读取 |
@@ -26,6 +25,10 @@
26
25
  | `$EVOLCORE_HOME/memory/owner/<ownerAid>/MEMORY.md` | owner 级 consolidated 记忆索引 | manifest order 37 注入(受 `memory.enableOwner` 开关控制) |
27
26
  | `skills/` 目录 | 预留 | 会被创建,但目前无人读写 |
28
27
 
28
+ > `persona.md` 是**唯一**的人格/资料文件(`personal.md` 已废弃并入)。整体设置用
29
+ > `ec agent persona --text`(**整体覆盖**);只改其中某一段(如 `## Bootstrap 交接`)
30
+ > 用文件工具直接编辑,**不要**用 `--text` 单写一段,否则会冲掉其它段落。
31
+
29
32
  `memory/episodic.jsonl`、`memory/semantic.md`、`style.md`、`goals.md`、`journal.jsonl`
30
33
  是早期设计稿里的约定,**源码尚未实现读写**——不要假设写了就会生效。
31
34
 
@@ -34,7 +37,7 @@
34
37
  - **注入条件**是 `chatType ≠ null` 且 `lifecycle = active`(即处于正常运行阶段的渠道会话),不是"有没有注入 AID"。生命周期变量缺失时按 `active` 处理;非法生命周期仍失败关闭。本地 coding 模式也不注入。
35
38
  - persona.md 由 evolcore **自动前置**进 system prompt,你不需要主动 Read。
36
39
  - persona.md 缺失时**没有默认人格兜底**,只是这一段不出现;行为约束改由 `kits/rules/` + `roles/` 权限定义承担。
37
- - personal.md 缺失时跳过注入;文件位于 `$PERSONAL_DIR/personal.md`。人格文件 `persona.md` 通过 `ec agent persona show`、`ec agent persona --text <text>` 或 `ec agent persona --file <path>` 管理,修改后按 mtime 自动刷新(必要时可 `ec agent reload`)。
40
+ - `persona.md` 缺失时跳过注入;文件位于 `$PERSONAL_DIR/persona.md`。通过 `ec agent persona show`、`ec agent persona --text <text>` 或 `ec agent persona --file <path>` 管理,修改后按 mtime 自动刷新(必要时可 `ec agent reload`)。
38
41
  - 改完 persona.md 后 `ec agent reload` 生效(mtime 门控缓存)。
39
42
 
40
43
  不同 AID 可以有不同 persona——切换身份即切换人格。
@@ -24,7 +24,7 @@
24
24
  - interactive:直接输出即回复
25
25
  - proactive:通过托管发送通道正式回复,见 `[reply]` 段(thought.put vs message.send)
26
26
  - **附加能力与模式无关、始终需要 CLI**:发文件/图片/语音、@某人、加密、联系第三方
27
- - **以自己的 AID 为发送者**;拿不到时退回 `ec ctl send "<text>"`
27
+ - **以自己的 AID 为发送者**;拿不到时退回 `ec ctl send '<text>'`
28
28
 
29
29
  ### 命令返回值
30
30
 
@@ -33,16 +33,13 @@
33
33
 
34
34
  ```bash
35
35
  # 写入新 note
36
- ec memory note --slug <slug> [--tags <tag1,tag2>] "<正文>"
36
+ ec memory note --slug <slug> [--tags '<tag1>,<tag2>'] '<正文>'
37
37
 
38
38
  # 修改已有 note
39
- ec memory note --slug <slug> --update "<新正文>"
40
-
41
- # 查看记忆概览
42
- ec memory show
39
+ ec memory note update <slug> '<新正文>'
43
40
 
44
41
  # 查看待整理 notes
45
- ec memory notes
42
+ ec memory note list
46
43
 
47
44
  # 触发整理会话(将 notes 归档为正式记忆)
48
45
  ec memory consolidate
@@ -85,11 +82,11 @@ ec thread summary show <peer>/<threadId> --self <selfAid>
85
82
  ```bash
86
83
  # 1. 选中目标话题(没有就新建)
87
84
  ec thread list <对方AID> --self <selfAid>
88
- ec thread create <对方AID> --name "问题跟踪" --self <selfAid> # 返回 threadId
85
+ ec thread create <对方AID> --name '问题跟踪' --self <selfAid> # 返回 threadId
89
86
 
90
87
  # 2. 带上话题发送;托管会话中 from/to 由话题推断,--check-every 必填
91
- ec msg send "<text>" --thread <threadId> --check-every 5m
92
- ec group send "<text>" --thread <threadId> --check-every 5m # 群对端
88
+ ec msg send '<text>' --thread <threadId> --check-every 5m
89
+ ec group send '<text>' --thread <threadId> --check-every 5m # 群对端
93
90
  ```
94
91
 
95
92
  - 不带 `--thread` 而直接把目标换成第三方,会被运行时拒绝(只能联系当前对端/群)
@@ -114,8 +111,8 @@ ec group send "<text>" --thread <threadId> --check-every 5m # 群对端
114
111
  - 避免:日期、轮次序号、"话题会话"等占位词
115
112
 
116
113
  ```bash
117
- ec thread rename current "<新名称>" # 托管会话
118
- ec thread rename <peer>/<threadId> "<新名称>" --self <selfAid> # 宿主终端
114
+ ec thread rename current '<新名称>' # 托管会话
115
+ ec thread rename <peer>/<threadId> '<新名称>' --self <selfAid> # 宿主终端
119
116
  ```
120
117
 
121
118
  ### 话题摘要维护
@@ -130,15 +127,15 @@ ec thread rename <peer>/<threadId> "<新名称>" --self <selfAid> # 宿主终
130
127
  ```bash
131
128
  # 情形 A:就在当前话题里总结(对话在上下文,增量就是本轮对话,不用读历史)
132
129
  ec thread summary show current # 1. 看上次摘要 + coveredThroughTs
133
- ec thread summary set current "<摘要内容>" --name "<新标题>" # 2. 写摘要 + 标题(--name 必填)
130
+ ec thread summary set current '<摘要内容>' --name '<新标题>' # 2. 写摘要 + 标题(--name 必填)
134
131
  # 游标自动推进;不想改名就传 --name -
135
132
 
136
133
  # 情形 B:从别的话题/别处总结(必须读增量)
137
134
  ec thread summary show <peer>/<threadId> # 1. 拿 coveredThroughTs
138
135
  ec thread history <peer>/<threadId> --after <coveredThroughTs> --limit 50 # 2. 读增量
139
136
  ec thread history <peer>/<threadId> --before <最早ts-1> --limit 50 # 3. 增量多则往回翻页
140
- ec thread summary set <peer>/<threadId> "<摘要内容>" # 4. 读完再写(游标自动推进)
141
- ec thread rename <peer>/<threadId> "<新名称>" # 5. 必要时改名
137
+ ec thread summary set <peer>/<threadId> '<摘要内容>' # 4. 读完再写(游标自动推进)
138
+ ec thread rename <peer>/<threadId> '<新名称>' # 5. 必要时改名
142
139
  ```
143
140
 
144
141
  **关键约束**:`summary set` 把游标设为**当时话题的最新一条**,所以跨话题总结**必须先把增量读完再写**——
@@ -171,10 +168,10 @@ ec thread rename <peer>/<threadId> "<新名称>" # 5.
171
168
  ec thread summary show current
172
169
 
173
170
  # 写入摘要(单 agent)
174
- ec thread summary set current "<摘要内容>"
171
+ ec thread summary set current '<摘要内容>'
175
172
 
176
173
  # 写入摘要(多 agent 协作,用 CAS 防覆盖)
177
- ec thread summary set current "<摘要内容>" --if-rev <当前rev>
174
+ ec thread summary set current '<摘要内容>' --if-rev <当前rev>
178
175
 
179
176
  # 查看摘要历史
180
177
  ec thread summary log current
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemas": {
3
3
  "daemon": {
4
- "currentVersion": 6
4
+ "currentVersion": 7
5
5
  },
6
6
  "defaults": {
7
7
  "currentVersion": 5
@@ -26,6 +26,12 @@
26
26
  }
27
27
  },
28
28
  "history": [
29
+ {
30
+ "schema": "daemon",
31
+ "version": 7,
32
+ "date": "2026-10-16",
33
+ "description": "add hot-reloadable delegated authorization diagnostic persistence switch"
34
+ },
29
35
  {
30
36
  "schema": "daemon",
31
37
  "version": 1,
@@ -120,7 +120,7 @@
120
120
  "description": "允许同时属于 AgentOwner 与 daemonOwner 的直接私聊任务使用宿主级 fullaccess"
121
121
  }
122
122
  },
123
- "description": "Agent 级宿主执行策略;仅 EC Web 可设置,不从 defaults 或 relation 继承"
123
+ "description": "Agent 级宿主执行策略;已认证 EC Web 或目标 Agent 与 daemon 的双 Owner 直接 Menu 可设置,不从 defaults 或 relation 继承"
124
124
  },
125
125
  "access": {
126
126
  "type": "object",
@@ -0,0 +1,140 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "daemon.schema.7.json",
4
+ "title": "ProcessConfig v7 (daemon.json)",
5
+ "description": "进程级配置:daemon 自身运行配置,链外独立作用域,不进覆盖链。",
6
+ "x-logical-name": "daemon",
7
+ "x-scope": "process",
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "$schema_version": { "type": "number", "const": 7, "default": 7, "x-merge": "scalar" },
12
+ "aid": { "type": "string", "description": "daemon 默认身份 AID", "x-merge": "scalar" },
13
+ "owners": {
14
+ "type": "array",
15
+ "items": { "type": "string" },
16
+ "description": "进程控制面鉴权名单(谁能远程管 daemon)",
17
+ "x-merge": "list"
18
+ },
19
+ "debug": {
20
+ "type": "object",
21
+ "description": "进程级调试配置;唯一合法来源为 daemon.json,不参与 Agent 覆盖链",
22
+ "x-merge": "dict",
23
+ "additionalProperties": false,
24
+ "properties": {
25
+ "logLevel": { "type": "string", "enum": ["DEBUG", "INFO", "WARN", "ERROR"], "description": "daemon 日志级别" },
26
+ "aunTrace": { "type": "boolean", "description": "是否记录 AUN 协议 trace" },
27
+ "aunSdkLog": { "type": "boolean", "description": "是否启用 AUN SDK 调试日志" },
28
+ "upmsg": { "type": "boolean", "description": "是否向 Agent owner 发送 daemon 上线通知" },
29
+ "eckSnapshots": { "type": "boolean", "default": false, "description": "是否写入可能包含敏感上下文的 ECK 旁路调试快照" }
30
+ }
31
+ },
32
+ "tunnel": {
33
+ "type": "object",
34
+ "description": "内网穿透配置",
35
+ "x-merge": "dict",
36
+ "properties": {
37
+ "targets": { "type": "array", "description": "穿透目标列表", "items": { "type": "object" } }
38
+ }
39
+ },
40
+ "aun": {
41
+ "type": "object",
42
+ "description": "AUN 进程配置",
43
+ "x-merge": "dict",
44
+ "properties": {
45
+ "gatewayUrl": { "not": {}, "description": "已移除;网关由 fastaun 缓存和 AID discovery 决定" },
46
+ "defaultAidDomain": {
47
+ "type": "string",
48
+ "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$",
49
+ "description": "自动生成控制 AID 与 benchmark AID 使用的后缀域名;不影响已有 AID"
50
+ },
51
+ "minEvolVersion": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$", "description": "AUN Menu 允许的最低 Evol 客户端版本;省略时不限制" },
52
+ "menuTokenRequired": { "type": "boolean", "default": false, "description": "是否要求普通 AUN Menu 请求携带有效 menu_token;默认 false" },
53
+ "defaultEncrypt": { "type": "boolean", "description": "所有 daemon 管理的 AUN 通道共用的出站默认加密值;省略时为 true" }
54
+ }
55
+ },
56
+ "services": {
57
+ "type": "array",
58
+ "description": "daemon 管理的本机服务及其可选 AUN 代理",
59
+ "x-merge": "list",
60
+ "items": {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "required": ["name", "enabled"],
64
+ "properties": {
65
+ "name": {
66
+ "type": "string",
67
+ "pattern": "^[a-z0-9_-]+$",
68
+ "description": "服务的逻辑标识,同时作为 AUN 代理路由名;ecweb 表示本机 EC Web 服务实例"
69
+ },
70
+ "enabled": { "type": "boolean", "default": true, "description": "是否启用本机服务实例" },
71
+ "port": { "type": "integer", "minimum": 1, "maximum": 65535, "description": "本机服务期望监听端口" },
72
+ "proxy": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "allOf": [
76
+ {
77
+ "if": { "properties": { "enabled": { "const": true }, "source": { "const": "static" } }, "required": ["enabled", "source"] },
78
+ "then": { "required": ["endpoint", "visibility"] }
79
+ },
80
+ {
81
+ "if": { "properties": { "enabled": { "const": true } }, "required": ["enabled"] },
82
+ "then": { "required": ["source", "visibility"] }
83
+ }
84
+ ],
85
+ "properties": {
86
+ "enabled": { "type": "boolean", "default": false, "description": "是否通过 AUN Service Proxy 暴露该服务" },
87
+ "source": { "type": "string", "enum": ["instance", "static"], "description": "instance 表示自动发现同名本机服务;static 使用 endpoint 显式回连" },
88
+ "endpoint": { "type": "string", "maxLength": 2048, "description": "source=static 时使用的本机 HTTP/HTTPS 或 WS/WSS 回连地址" },
89
+ "serviceType": { "type": "string", "enum": ["http", "websocket", "ssh"], "default": "http", "description": "AUN 中公布的服务类型" },
90
+ "visibility": { "type": "string", "enum": ["public", "private", "aun-auth"], "default": "private", "description": "AUN Service Proxy 访问策略" },
91
+ "metadata": {
92
+ "type": "object",
93
+ "description": "非敏感服务描述;不得包含 endpoint、token、secret、cookie 等敏感信息",
94
+ "additionalProperties": { "type": "string", "maxLength": 8192 }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ },
101
+ "configSnapshots": { "type": "boolean", "default": true, "description": "是否自动维护配置快照、启动日志和自检回落", "x-merge": "scalar" },
102
+ "restartRecovery": {
103
+ "type": "object",
104
+ "description": "重启失败后的自动修复配置;仅控制 restart-monitor 的 Claude self-heal",
105
+ "x-merge": "dict",
106
+ "additionalProperties": false,
107
+ "properties": {
108
+ "enabled": { "type": "boolean", "default": false, "description": "是否在重启失败后执行 Claude 自动修复;默认关闭" }
109
+ }
110
+ },
111
+ "delegationDiagnostics": {
112
+ "type": "object",
113
+ "description": "任务授权诊断持久化;仅用于排障,不恢复授权,事件保留 180 天、历史状态保留 90 天",
114
+ "x-merge": "dict",
115
+ "additionalProperties": false,
116
+ "properties": {
117
+ "enabled": { "type": "boolean", "default": true, "description": "是否持久化任务授权诊断;关闭后保留历史,内存诊断与权限校验不受影响,保存后热生效" }
118
+ }
119
+ },
120
+ "idleMonitor": {
121
+ "type": "object",
122
+ "description": "流式输出空闲监控配置",
123
+ "x-merge": "dict",
124
+ "properties": {
125
+ "enabled": { "type": "boolean", "default": true, "description": "是否启用空闲监控" },
126
+ "timeout": { "type": "number", "default": 120, "description": "空闲超时秒数" },
127
+ "apiRetryTimeout": { "type": "number", "description": "API 重试尝试连续无事件时的超时秒数;未设置时继承 timeout" },
128
+ "maxExecutionTime": { "type": "number", "description": "单个任务总执行时限(秒);未配置、非数字或小于等于 0 表示不限制" }
129
+ }
130
+ },
131
+ "watch": {
132
+ "type": "object",
133
+ "description": "日志监听配置",
134
+ "x-merge": "dict",
135
+ "properties": {
136
+ "logTypes": { "type": "array", "description": "要监听的日志类型", "items": { "type": "string" } }
137
+ }
138
+ }
139
+ }
140
+ }