evolclaw 3.1.4 → 3.1.6

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 (99) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/agents/claude-runner.js +398 -161
  3. package/dist/agents/kit-renderer.js +191 -25
  4. package/dist/aun/aid/agentmd.js +75 -103
  5. package/dist/aun/aid/client.js +1 -29
  6. package/dist/aun/aid/identity.js +105 -64
  7. package/dist/aun/aid/index.js +2 -1
  8. package/dist/aun/aid/store.js +74 -0
  9. package/dist/aun/msg/group.js +2 -2
  10. package/dist/aun/msg/p2p.js +26 -2
  11. package/dist/aun/rpc/connection.js +23 -30
  12. package/dist/channels/aun.js +174 -99
  13. package/dist/channels/dingtalk.js +2 -1
  14. package/dist/channels/feishu.js +301 -199
  15. package/dist/channels/qqbot.js +2 -1
  16. package/dist/channels/wechat.js +2 -1
  17. package/dist/channels/wecom.js +2 -1
  18. package/dist/cli/agent.js +21 -16
  19. package/dist/cli/bench.js +41 -28
  20. package/dist/cli/help.js +8 -0
  21. package/dist/cli/index.js +176 -87
  22. package/dist/cli/init-channel.js +5 -1
  23. package/dist/cli/init.js +37 -21
  24. package/dist/cli/link-rules.js +1 -7
  25. package/dist/cli/model.js +549 -0
  26. package/dist/cli/net-check.js +133 -50
  27. package/dist/cli/watch-msg.js +7 -7
  28. package/dist/cli/watch-web/debug-log.js +18 -0
  29. package/dist/cli/watch-web/server.js +306 -0
  30. package/dist/cli/watch-web/sources/aid.js +63 -0
  31. package/dist/cli/watch-web/sources/msg.js +70 -0
  32. package/dist/cli/watch-web/sources/session.js +638 -0
  33. package/dist/cli/watch-web/sources/types.js +10 -0
  34. package/dist/cli/watch-web/static/app.js +546 -0
  35. package/dist/cli/watch-web/static/index.html +54 -0
  36. package/dist/cli/watch-web/static/style.css +247 -0
  37. package/dist/config-store.js +1 -22
  38. package/dist/core/channel-loader.js +7 -4
  39. package/dist/core/command-handler.js +261 -133
  40. package/dist/core/evolagent-registry.js +1 -1
  41. package/dist/core/evolagent.js +4 -22
  42. package/dist/core/interaction-router.js +59 -0
  43. package/dist/core/message/im-renderer.js +9 -20
  44. package/dist/core/message/message-bridge.js +13 -9
  45. package/dist/core/message/message-log.js +2 -2
  46. package/dist/core/message/message-processor.js +211 -123
  47. package/dist/core/message/stream-idle-monitor.js +21 -0
  48. package/dist/core/model/model-catalog.js +215 -0
  49. package/dist/core/model/model-scope.js +250 -0
  50. package/dist/core/relation/peer-identity.js +58 -55
  51. package/dist/core/relation/peer-key.js +16 -0
  52. package/dist/core/session/session-fs-store.js +34 -55
  53. package/dist/core/session/session-key.js +24 -0
  54. package/dist/core/session/session-manager.js +308 -251
  55. package/dist/core/session/session-mapper.js +9 -4
  56. package/dist/core/trigger/manager.js +3 -3
  57. package/dist/core/trigger/parser.js +4 -4
  58. package/dist/core/trigger/scheduler.js +22 -7
  59. package/dist/index.js +61 -7
  60. package/dist/ipc.js +23 -1
  61. package/dist/utils/error-utils.js +6 -0
  62. package/dist/utils/process-introspect.js +7 -5
  63. package/kits/docs/GUIDE.md +2 -2
  64. package/kits/docs/INDEX.md +8 -8
  65. package/kits/docs/channels/aun.md +56 -17
  66. package/kits/docs/channels/feishu.md +41 -12
  67. package/kits/docs/context-assembly.md +182 -0
  68. package/kits/docs/evolclaw/INDEX.md +43 -0
  69. package/kits/docs/evolclaw/agent.md +49 -0
  70. package/kits/docs/evolclaw/aid.md +49 -0
  71. package/kits/docs/evolclaw/ctl.md +46 -0
  72. package/kits/docs/evolclaw/group.md +89 -0
  73. package/kits/docs/evolclaw/model.md +51 -0
  74. package/kits/docs/evolclaw/msg.md +91 -0
  75. package/kits/docs/evolclaw/rpc.md +35 -0
  76. package/kits/docs/evolclaw/storage.md +49 -0
  77. package/kits/docs/venues/aun-group.md +10 -0
  78. package/kits/docs/venues/aun-private.md +10 -0
  79. package/kits/docs/venues/client-desktop.md +10 -0
  80. package/kits/docs/venues/client-mobile.md +10 -0
  81. package/kits/docs/venues/feishu-group.md +13 -0
  82. package/kits/docs/venues/feishu-private.md +9 -0
  83. package/kits/docs/venues/group.md +23 -0
  84. package/kits/docs/venues/private.md +10 -0
  85. package/kits/eck_manifest.json +81 -36
  86. package/kits/rules/01-overview.md +20 -10
  87. package/kits/rules/06-channel.md +34 -27
  88. package/kits/templates/system-fragments/baseagent.md +7 -1
  89. package/kits/templates/system-fragments/channel.md +7 -5
  90. package/kits/templates/system-fragments/commands.md +19 -0
  91. package/kits/templates/system-fragments/session.md +19 -3
  92. package/kits/templates/system-fragments/venue.md +24 -0
  93. package/package.json +10 -5
  94. package/dist/aun/aid/lifecycle-log.js +0 -33
  95. package/dist/utils/aid-lifecycle-log.js +0 -33
  96. package/kits/docs/evolclaw/AGENT_CMD.md +0 -31
  97. package/kits/docs/evolclaw/MSG_GROUP.md +0 -30
  98. package/kits/docs/evolclaw/MSG_PRIVATE.md +0 -72
  99. package/kits/docs/evolclaw/tools.md +0 -25
@@ -0,0 +1,49 @@
1
+ # ec storage — 文件存储
2
+
3
+ AUN 网络上的文件存储:上传、下载、列举、删除、查配额。触发词:上传/下载/存文件/配额。
4
+
5
+ 以自己的 AID 为操作者(`<aid>`)。
6
+
7
+ ## 子命令
8
+
9
+ ```bash
10
+ # 上传文件(默认私有,--public 公开)
11
+ ec storage upload <aid> <local-file> <remote-path> [--public]
12
+
13
+ # 下载文件
14
+ ec storage download <aid> <url> [local-path]
15
+
16
+ # 列文件
17
+ ec storage ls <aid> [prefix]
18
+
19
+ # 删文件
20
+ ec storage rm <aid> <remote-path>
21
+
22
+ # 查配额
23
+ ec storage quota <aid>
24
+ ```
25
+
26
+ ## `<url>` 格式
27
+
28
+ `[https://]<owner-aid>/<path>` —— 下载可指向自己或他人的公开文件:
29
+
30
+ ```bash
31
+ # 下载自己的文件
32
+ ec storage download myaid.agentid.pub myaid.agentid.pub/notes/doc.txt ./doc.txt
33
+
34
+ # 下载他人的公开文件
35
+ ec storage download myaid.agentid.pub bob.agentid.pub/public/file.pdf ./file.pdf
36
+ ```
37
+
38
+ ## 示例
39
+
40
+ ```bash
41
+ ec storage upload myaid.agentid.pub ./pic.png images/pic.png --public
42
+ ec storage ls myaid.agentid.pub notes/
43
+ ec storage rm myaid.agentid.pub notes/doc.txt
44
+ ec storage quota myaid.agentid.pub
45
+ ```
46
+
47
+ ## 通用约定
48
+
49
+ - `--format json` — 输出 JSON
@@ -0,0 +1,10 @@
1
+ # AUN 群聊特有指引
2
+
3
+ AUN 群组是基于 AID 的多方对话。
4
+
5
+ ## 特点
6
+ - 群组通过 group.* 命名空间管理
7
+ - 群成员都有 AID
8
+ - 默认仅响应被 @ 自己的消息
9
+
10
+ (待补充)
@@ -0,0 +1,10 @@
1
+ # AUN 单聊特有指引
2
+
3
+ AUN 是 agent 的存在基础,单聊对端是另一个 AUN 主体(人或 agent)。
4
+
5
+ ## 特点
6
+ - 对端有 AID,可通过 `agent.md` 获取其身份信息
7
+ - 支持端到端加密(E2EE)
8
+ - 消息通过 message.* 命名空间收发
9
+
10
+ (待补充)
@@ -0,0 +1,10 @@
1
+ # 桌面端环境
2
+
3
+ 对端使用桌面客户端(macOS / Windows / Linux)。
4
+
5
+ ## 特点
6
+ - 屏幕较大,可承载较长内容
7
+ - 文件下载方便
8
+ - 通常处于工作场景
9
+
10
+ (待补充)
@@ -0,0 +1,10 @@
1
+ # 移动端环境
2
+
3
+ 对端使用移动客户端(iOS / Android)。
4
+
5
+ ## 特点
6
+ - 屏幕较小,长文需谨慎
7
+ - 流量敏感,大文件需谨慎
8
+ - 可能处于碎片场景(地铁/会议等)
9
+
10
+ (待补充)
@@ -0,0 +1,13 @@
1
+ # 飞书群聊特有指引
2
+
3
+ 飞书群通过 chat_id 标识,支持话题(thread)回复。
4
+
5
+ ## 工具
6
+ - 群消息命令:`ec group`(详见 $KITS_DOCS/evolclaw/group.md)
7
+ - 取群信息 / 公告 / 成员 / 管理员
8
+
9
+ ## 注意
10
+ - 飞书群默认 dispatch=mention,被 @ 才响应
11
+ - 话题回复会创建独立的 session(thread session)
12
+
13
+ (待补充)
@@ -0,0 +1,9 @@
1
+ # 飞书单聊特有指引
2
+
3
+ 飞书单聊场景下,对端通过 user_id (open_id) 标识。
4
+
5
+ ## 工具
6
+ - 飞书消息命令:`ec msg`(详见 $KITS_DOCS/evolclaw/msg.md)
7
+ - 文件/图片上传与发送
8
+
9
+ (待补充)
@@ -0,0 +1,23 @@
1
+ # 群聊场景指引
2
+
3
+ 群聊场景下默认仅在被 @ 时响应,除非 dispatch=broadcast。
4
+
5
+ ## 行为准则
6
+ - 默认 dispatch=mention:仅响应明确 @ 自己的消息
7
+ - dispatch=broadcast 时:对所有消息进行判断,选择性响应
8
+ - 关注 venue 档案(venue-group-profile)中的群文化与策略
9
+ - 群发言会被多人看到,谨言慎行
10
+
11
+ ## 可按需查询的群数据
12
+
13
+ 群结构信息(成员名单、各成员角色、群主、管理员、在线状态等)**不预先注入上下文**,
14
+ 需要时用 `ec group` 自行查询(完整用法 Read `$KITS_DOCS/evolclaw/group.md`):
15
+
16
+ | 想知道 | 用命令 | 拿到 |
17
+ |--------|--------|------|
18
+ | 群基本信息、群主是谁 | `ec group info <from> <group-id>` | name / owner_aid / 成员数 / 描述等 |
19
+ | 成员名单与各自角色 | `ec group members <from> <group-id>` | 每个成员的 aid + role(owner/admin/member)|
20
+ | 当前谁在线 | `ec group online <from> <group-id>` | 在线成员及其角色 |
21
+
22
+ 典型场景:要判断某人是不是管理员、给特定角色发消息、决定是否执行管理操作前,先查 members
23
+ 拿到角色再决策——而不是假设。自己在群里的角色也从 members 里查自己的 aid 得到。
@@ -0,0 +1,10 @@
1
+ # 单聊场景指引
2
+
3
+ 私聊场景下你和一位对端直接对话,无需被 @ 即可响应。
4
+
5
+ ## 行为准则
6
+ - 自主判断每条消息是否需要响应
7
+ - 关注对端的关系档案(peer-profile)与历史互动
8
+ - 长程对话中保持人格与风格的一致性
9
+
10
+ (本文档为最小骨架,后续将完善具体行为指引)
@@ -4,76 +4,124 @@
4
4
  {
5
5
  "id": "rules",
6
6
  "type": "directory",
7
- "path": "$PACKAGE_ROOT/kits/rules",
7
+ "path": "$KITS_RULES",
8
8
  "order": 10,
9
9
  "needsInjection": false,
10
10
  "when": "always",
11
- "description": "ECK 核心规则(自动载入)"
11
+ "description": "ECK 核心规则(自动加载)"
12
12
  },
13
13
  {
14
14
  "id": "identity-layer",
15
15
  "type": "file",
16
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/identity.md",
16
+ "file": "$KITS_FRAGMENTS/identity.md",
17
17
  "order": 20,
18
18
  "needsInjection": true,
19
- "when": {
20
- "var": "chatType",
21
- "neq": null
22
- },
19
+ "when": { "var": "chatType", "neq": null },
23
20
  "description": "身份层:我是谁"
24
21
  },
22
+ {
23
+ "id": "persona",
24
+ "type": "file",
25
+ "file": "$PERSONAL_DIR/persona.md",
26
+ "order": 21,
27
+ "needsInjection": false,
28
+ "when": { "var": "chatType", "neq": null },
29
+ "description": "人格档案(persona.md)"
30
+ },
31
+ {
32
+ "id": "working-memory",
33
+ "type": "file",
34
+ "file": "$PERSONAL_DIR/memory/working.md",
35
+ "order": 22,
36
+ "needsInjection": false,
37
+ "when": { "var": "chatType", "neq": null },
38
+ "description": "当前关注(working memory)"
39
+ },
25
40
  {
26
41
  "id": "relation-layer",
27
42
  "type": "file",
28
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/relation.md",
43
+ "file": "$KITS_FRAGMENTS/relation.md",
29
44
  "order": 30,
30
45
  "needsInjection": true,
31
- "when": {
32
- "var": "chatType",
33
- "in": ["private", "group"]
34
- },
46
+ "when": { "var": "chatType", "in": ["private", "group"] },
35
47
  "description": "关系层:跟我聊天的是谁"
36
48
  },
37
49
  {
38
50
  "id": "peer-profile",
39
51
  "type": "file",
40
- "file": "$EVOLCLAW_HOME/agents/{{selfAid}}/relations/{{peerKey}}/profile.md",
52
+ "file": "$RELATIONS_DIR/{{peerKey}}/profile.md",
41
53
  "order": 35,
42
54
  "needsInjection": false,
43
- "when": {
44
- "var": "peerKey",
45
- "neq": null
46
- },
55
+ "when": { "var": "peerKey", "neq": null },
47
56
  "description": "当前对端的关系档案"
48
57
  },
49
58
  {
50
- "id": "venue-layer",
59
+ "id": "venue-fragment",
51
60
  "type": "file",
52
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/venue.md",
61
+ "file": "$KITS_FRAGMENTS/venue.md",
53
62
  "order": 40,
54
63
  "needsInjection": true,
55
- "when": {
56
- "var": "chatType",
57
- "neq": null
58
- },
59
- "description": "环境层:当前对话场景"
64
+ "when": { "var": "chatType", "neq": null },
65
+ "description": "环境层模板(基础参数)"
66
+ },
67
+ {
68
+ "id": "venue-chattype",
69
+ "type": "file",
70
+ "file": "$KITS_DOCS/venues/{{chatType}}.md",
71
+ "order": 41,
72
+ "needsInjection": false,
73
+ "when": { "var": "chatType", "neq": null },
74
+ "description": "场景通用文档(private/group)"
75
+ },
76
+ {
77
+ "id": "venue-channel-chattype",
78
+ "type": "file",
79
+ "file": "$KITS_DOCS/venues/{{channel}}-{{chatType}}.md",
80
+ "order": 42,
81
+ "needsInjection": false,
82
+ "when": { "var": "chatType", "neq": null },
83
+ "description": "渠道+场景文档(如 feishu-group)"
84
+ },
85
+ {
86
+ "id": "venue-group-profile",
87
+ "type": "file",
88
+ "file": "$VENUES_DIR/{{channel}}#{{groupId}}/profile.md",
89
+ "order": 43,
90
+ "needsInjection": false,
91
+ "when": { "var": "groupId", "neq": null },
92
+ "description": "具体群环境文档"
93
+ },
94
+ {
95
+ "id": "venue-client",
96
+ "type": "file",
97
+ "file": "$KITS_DOCS/venues/client-{{clientType}}.md",
98
+ "order": 44,
99
+ "needsInjection": false,
100
+ "when": { "var": "clientType", "neq": null },
101
+ "description": "客户端环境文档"
60
102
  },
61
103
  {
62
104
  "id": "channel-layer",
63
105
  "type": "file",
64
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/channel.md",
106
+ "file": "$KITS_FRAGMENTS/channel.md",
65
107
  "order": 50,
66
108
  "needsInjection": true,
67
- "when": {
68
- "var": "channel",
69
- "neq": null
70
- },
109
+ "when": { "var": "channel", "neq": null },
71
110
  "description": "渠道层:通信渠道及能力"
72
111
  },
112
+ {
113
+ "id": "commands",
114
+ "type": "file",
115
+ "file": "$KITS_FRAGMENTS/commands.md",
116
+ "order": 55,
117
+ "needsInjection": true,
118
+ "when": { "var": "channel", "neq": null },
119
+ "description": "命令集能力卡:按场景列出可用命令集及文档路径"
120
+ },
73
121
  {
74
122
  "id": "session",
75
123
  "type": "file",
76
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/session.md",
124
+ "file": "$KITS_FRAGMENTS/session.md",
77
125
  "order": 60,
78
126
  "needsInjection": true,
79
127
  "when": "always",
@@ -82,14 +130,11 @@
82
130
  {
83
131
  "id": "baseagent",
84
132
  "type": "file",
85
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/baseagent.md",
133
+ "file": "$KITS_FRAGMENTS/baseagent.md",
86
134
  "order": 70,
87
135
  "needsInjection": true,
88
- "when": {
89
- "var": "baseAgent",
90
- "neq": null
91
- },
136
+ "when": { "var": "baseAgent", "neq": null },
92
137
  "description": "Base Agent 特定配置"
93
138
  }
94
139
  ]
95
- }
140
+ }
@@ -57,7 +57,7 @@ AUN 把 agent 当网络主体(具备社会人属性:身份/通信/自主),
57
57
  │ │
58
58
  Evol 前端 EvolClaw
59
59
  (App/Web/Desktop) Channel 适配层(AUN/飞书/微信/...)
60
- 或其它 AUN 客户端 关系层 / 环境层 / 个人数据层 / 上下文注入
60
+ 或其它 AUN 客户端 身份层 / 关系层 / 环境层 / 渠道层 / 会话层
61
61
  Base Agent(Claude Code / Codex / Gemini/...)
62
62
 
63
63
  ```
@@ -69,7 +69,7 @@ EvolClaw 是一个 Node.js 项目,通过 `npm install -g evolclaw@latest` 安
69
69
 
70
70
  ### Evol
71
71
 
72
- Evol 是 AUN 原生的消息应用(App / Web / Desktop)——人和 agent 都是其中的主体。用户通过 Evol 与 agent 和其他人对话。
72
+ Evol 是 AUN 原生的消息应用(App / Web / Desktop)——人和 agent 都是其中的主体。用户通过 Evol 与 agent以及其他人对话。
73
73
 
74
74
  ### Channel
75
75
 
@@ -102,13 +102,24 @@ ECK(EvolClaw Context Kit)是 EvolClaw 的上下文组装系统。你正在
102
102
 
103
103
  ### 上下文组装流程
104
104
 
105
- evolclaw 收到消息后,按场景决定加载哪些层:
105
+ evolclaw 收到每条消息时,由一份**声明式 manifest** 决定加载哪些上下文段——不是写死的分支。
106
+ 每个 section 带 `when` 条件,evolclaw 按当前会话构造一组运行时变量(`chatType`、`channel`、
107
+ `selfAid`、`peerKey` 等)逐段求值,命中的才按顺序拼进 system prompt(`needsInjection` 的段还会先做模板渲染)。
106
108
 
107
- | 场景 | 加载的层 |
108
- |------|----------|
109
- | coding | rules(不加载身份层、关系层) |
110
- | private | rules + 身份层 + 关系层(对端)+ 环境层 + 渠道层 |
111
- | group | rules + 身份层 + 关系层(群)+ 环境层 + 渠道层 |
109
+ 按场景,命中的段大致是:
110
+
111
+ | 场景 | 命中的层/段 |
112
+ |------|------------|
113
+ | coding(无渠道) | rules + 会话层 + baseagent(身份/关系/环境/渠道层因无 channel、无身份而落选) |
114
+ | private(私聊) | rules + 身份层 + 关系层(对端)+ 环境层 + 渠道层 + 会话层 + baseagent |
115
+ | group(群聊) | rules + 身份层 + 关系层(群)+ 环境层 + 渠道层 + 会话层 + baseagent |
116
+
117
+ > 会话层(session fragment)是 `when:always`、baseagent 段只要注入了 base agent 信息就加载——
118
+ > 二者与 chatType 无关,每个场景都在;所以 coding 并非"仅 rules"。
119
+
120
+ manifest schema、when 条件、合并覆盖、模板渲染、运行时变量目录,以及**实际渲染结果的调试输出**
121
+ (`$EVOLCLAW_HOME/data/eck-debug/` 下的 vars / context / fragments / manifest 四个文件):
122
+ 详见 `$KITS_DOCS/context-assembly.md`。
112
123
 
113
124
  ## 术语
114
125
 
@@ -116,5 +127,4 @@ evolclaw 收到消息后,按场景决定加载哪些层:
116
127
  - **对端**:和你通信的主体
117
128
  - **本端(self)**:你自己
118
129
  - **用户**:对端中的人类一方
119
- - **环境(Venue)**:渠道 + 场景(私聊/群聊)构成的交互空间
120
-
130
+ - **环境(Venue)**:渠道 + 场景(私聊/群聊)构成的交互空间
@@ -6,45 +6,45 @@
6
6
 
7
7
  | 位置 | 内容 |
8
8
  |------|------|
9
- | `$KITS_DOCS/channels/` | 各渠道的使用手册(只读,按需加载) |
9
+ | `$KITS_DOCS/channels/` | 各渠道的**知识文档**:配置、参数、特有机制(只读,按需加载) |
10
10
  | `$AGENT_DIR/channels/` | 各渠道的运行时数据(可写) |
11
11
 
12
- ## 通信规则
13
-
14
- 与其他主体通信时,**必须调用 CLI 命令**发消息,不要把输出当成发送给对方的内容。
12
+ > 运行时"当前渠道怎么发消息"由动态注入的 `[channel]` 段决定(见下方通信规则);
13
+ > `$KITS_DOCS/channels/` 是**不依赖当前渠道**的知识库,任意会话都可按需 Read 任意渠道文档。
15
14
 
16
- 当前渠道的发消息命令已在上下文中注入(见 `[aun]` 或对应渠道块)。
15
+ ## 通信规则
17
16
 
18
- ### 仅在无法获取 self-aid 时才用 `ec ctl send`
17
+ 与其他主体通信**必须调用 CLI 命令**(首选 `ec msg send <self-aid> <peer-id> "<text>"`),
18
+ 不要把模型输出当成发送给对方的内容。当前渠道的发消息命令已在上下文中注入(见 `[aun]` 或对应渠道块)。
19
19
 
20
- ```bash
21
- ec ctl send "<text>"
22
- ec ctl send --encrypt "<text>"
23
- ```
20
+ > proactive 模式尤其注意:你直接输出的普通文本会被投影成"思考过程"实时展示给用户,
21
+ > 它可见、但不入消息历史、也不是发给对端的回复。只有显式调用 `ec msg send` 对端才真正收到。
22
+ > 拿不到 self-aid 时才退回 `ec ctl send "<text>"`(自动继承当前会话的 AID 和对端)。
24
23
 
25
24
  ### 命令返回值
26
25
 
27
26
  - 成功:`ok` 或包含 `✓ 已发送 ...` 的输出(exit 0)
28
27
  - 失败:`✗ ...` 错误信息(exit 非零)
29
28
 
30
- 发送成功后**继续后续处理**。一次任务可能发 0 到多条消息,不要因为看到"已发送"就反复发送同一条消息。
31
-
32
- ## Agent 管理命令
29
+ 发送成功后**继续后续处理**。一次任务可能发 0 到多条消息不要因为看到"已发送"就反复发送同一条消息。
33
30
 
34
- `evolclaw agent` — agent 全生命周期管理。
31
+ ## 命令集
35
32
 
36
- 触发词:创建/新建/初始化、列出/查看、启用/禁用/删除、热重载、修改配置。
33
+ 所有命令以 `ec` 为前缀,以自己的 AID 为发送者。下表是静态总览;
34
+ **运行时按当前场景(有无对端/群、对端角色)注入的精简能力卡由 `commands` fragment 决定**
35
+ (见动态注入的 `[commands]` 段)。完整目录(含触发词与适用场景):`$KITS_DOCS/evolclaw/INDEX.md`。
36
+ 单个命令集的详细用法按需 Read 对应文档。
37
37
 
38
- 详细参考:Read `$KITS_DOCS/evolclaw/AGENT_CMD.md`
39
-
40
- ## 消息命令
41
-
42
- `evolclaw msg` / `evolclaw group` 通信 CLI。
43
-
44
- | 聊天类型 | 详细文档 |
45
- |----------|----------|
46
- | private | `$KITS_DOCS/evolclaw/MSG_PRIVATE.md` |
47
- | group | `$KITS_DOCS/evolclaw/MSG_GROUP.md` |
38
+ | 命令集 | 用途 | 触发词 | 详细文档 |
39
+ |--------|------|--------|----------|
40
+ | `ec msg` | 私聊收发消息 | 回复/发消息/拉取/撤回 | `$KITS_DOCS/evolclaw/msg.md` |
41
+ | `ec group` | 群聊收发与群管理 | 群发/建群/邀请/踢人 | `$KITS_DOCS/evolclaw/group.md` |
42
+ | `ec agent` | EvolAgent 生命周期 | 创建/启用禁用/热重载/改配置 | `$KITS_DOCS/evolclaw/agent.md` |
43
+ | `ec aid` | AID 身份管理 | 身份/证书/名片/探测对端 | `$KITS_DOCS/evolclaw/aid.md` |
44
+ | `ec storage` | 文件存储 | 上传/下载/配额 | `$KITS_DOCS/evolclaw/storage.md` |
45
+ | `ec ctl` | 会话运行时自管理 | 切模型/推理强度/压缩/重启 | `$KITS_DOCS/evolclaw/ctl.md` |
46
+ | `ec model` | 模型管理(按作用域持久化) | 切模型/列模型/改强度 | `$KITS_DOCS/evolclaw/model.md` |
47
+ | `ec rpc` | 底层 AUN RPC(逃生通道) | 直接调协议方法 | `$KITS_DOCS/evolclaw/rpc.md` |
48
48
 
49
49
  共同约定:
50
50
  - 以自己的 AID 为发送者
@@ -52,6 +52,13 @@ ec ctl send --encrypt "<text>"
52
52
  - `--format json` 所有命令通用
53
53
  - `--app <name>` 指定应用 slot
54
54
 
55
- ## 各渠道文档
55
+ ## 各渠道知识文档(按需加载)
56
+
57
+ `$KITS_DOCS/channels/` 下每个渠道一份知识文档,内容是该渠道的**配置、参数、特有机制**——
58
+ 属于知识性内容,**不依赖**当前注入的渠道类型。需要了解某渠道怎么配置、有哪些参数、
59
+ 有哪些特别机制时,按需 Read 对应文档(在 aun 会话里也可查飞书,反之亦然)。
56
60
 
57
- 不同渠道的详细通信规则和命令工具使用方式:Read `$KITS_DOCS/channels/` 中的对应文档。
61
+ | 渠道 | 文档 | 触发词 |
62
+ |------|------|--------|
63
+ | AUN | `$KITS_DOCS/channels/aun.md` | aun 怎么配置/网关/E2EE/群 ID 格式/证书链 |
64
+ | 飞书 | `$KITS_DOCS/channels/feishu.md` | 飞书怎么配置/appId/合并转发/卡片/user_id |
@@ -1,7 +1,13 @@
1
1
  [baseagent]
2
2
  baseAgentName: {{baseAgentName}} # 底层推理引擎(Claude Code / Codex / Gemini CLI)
3
+ {{?effectiveModel}}
4
+ effectiveModel: {{effectiveModel}} # 当前实际生效的模型(关系级 > agent级 > 全局 优先级解析)
5
+ {{/}}
3
6
  {{?baseAgentModel}}
4
- baseAgentModel: {{baseAgentModel}}
7
+ baseAgentModel: {{baseAgentModel}} # base agent 引擎底座模型(evolclaw 作用域无配置时的兜底)
8
+ {{/}}
9
+ {{?modelFallbackActive}}
10
+ modelFallbackActive: true # evolclaw 配置的模型不可用,当前正在使用降级模型 {{modelFallbackModel}}
5
11
  {{/}}
6
12
  {{?agentSessionId}}
7
13
  agentSessionId: {{agentSessionId}} # 底层引擎的会话 ID(区别于 evolclaw sessionId)
@@ -3,18 +3,20 @@ channel: {{channel}} # 渠道类型:aun|feishu|wechat|dingtalk|qqbot|wecom
3
3
  {{?capabilities}}
4
4
  capabilities: {{capabilities}} # 当前渠道支持的能力
5
5
  {{/}}
6
- {{?peerId}}
6
+ {{?groupId}}
7
7
  {{?channel=aun}}
8
- ec msg send {{selfAid}} {{peerId}} "<text>" [--encrypt] [--file <path> --as image|video|voice|file] [--link <url> --title "<title>"] [--payload '<json>']
9
- encrypt: 跟随对端消息加密状态(密文回密文,明文回明文);本端主动发时依据会话 encrypt 配置(待实现)
8
+ ec group send {{selfAid}} {{groupId}} "<text>" [--encrypt] [--file <path> --as image|video|voice|file] [--payload '<json>'] [--mention <aid>] [--mention-all]
9
+ group-send 是群内公开回复,群聊场景的默认回复方式
10
10
  {{/}}
11
11
  {{?channel!=aun}}
12
12
  非 aun 渠道:回复由 evolclaw 自动完成,无需调用 CLI
13
13
  {{/}}
14
14
  {{/}}
15
- {{?groupId}}
15
+ {{?peerId}}
16
16
  {{?channel=aun}}
17
- ec group send {{selfAid}} {{groupId}} "<text>" [--file <path> --as image|video|voice|file] [--mention <aid>]
17
+ ec msg send {{selfAid}} {{peerId}} "<text>" [--encrypt] [--file <path> --as image|video|voice|file] [--link <url> --title "<title>"] [--payload '<json>']
18
+ msg-send 是私聊对端;群聊中仅在确需私下联系本条消息发送者时才用,否则用上面的 group send
19
+ encrypt: 跟随对端消息加密状态(密文回密文,明文回明文);本端主动发时依据会话 encrypt 配置(待实现)
18
20
  {{/}}
19
21
  {{?channel!=aun}}
20
22
  非 aun 渠道:回复由 evolclaw 自动完成,无需调用 CLI
@@ -0,0 +1,19 @@
1
+ [commands] 当前场景可用命令集(前缀 ec,以自己 AID 为发送者;完整用法 Read 对应文档)
2
+ ec ctl 会话运行时自管理(切模型/强度/压缩/重启) $KITS_DOCS/evolclaw/ctl.md
3
+ ec model 查看/设置/检查模型与推理强度(持久化作用域;检查可用模型用 check 子命令) $KITS_DOCS/evolclaw/model.md
4
+ ec aid 身份/证书/名片/探测对端 $KITS_DOCS/evolclaw/aid.md
5
+ ec storage 文件上传/下载/配额 $KITS_DOCS/evolclaw/storage.md
6
+ ec rpc 底层 AUN RPC 逃生通道 $KITS_DOCS/evolclaw/rpc.md
7
+ {{?peerId}}
8
+ ec msg 私聊收发消息(回复/拉取/撤回) $KITS_DOCS/evolclaw/msg.md
9
+ {{/}}
10
+ {{?groupId}}
11
+ ec group 群聊收发与群管理(群发/邀请/踢人) $KITS_DOCS/evolclaw/group.md
12
+ {{/}}
13
+ {{?peerRole=owner}}
14
+ ec agent EvolAgent 生命周期(创建/启停/热重载/改配置) $KITS_DOCS/evolclaw/agent.md
15
+ {{/}}
16
+ {{?peerRole=admin}}
17
+ ec agent EvolAgent 生命周期(创建/启停/热重载/改配置) $KITS_DOCS/evolclaw/agent.md
18
+ {{/}}
19
+ 完整命令集目录(含触发词与适用场景):$KITS_DOCS/evolclaw/INDEX.md
@@ -2,11 +2,26 @@
2
2
  project: {{project}} # 项目目录名
3
3
  CURRENT_PROJECT: {{CURRENT_PROJECT}} # 项目完整路径
4
4
  sessionId: {{sessionId}} # evolclaw 会话 ID
5
+ {{?sessionKey}}
6
+ sessionKey: {{sessionKey}} # 会话路由键(channelType#urlEncode(channelId)#urlEncode(threadId))
7
+ {{/}}
5
8
  {{?sessionName}}
6
9
  sessionName: {{sessionName}}
7
10
  {{/}}
8
11
  sessionCreatedAt: {{sessionCreatedAt}}
12
+ {{?timezone}}
13
+ timezone: {{timezone}} # 时区 IANA 名:把消息/记忆里的 ISO 时间戳转成本地时间字符串时按此换算
14
+ {{/}}
15
+ {{?tzOffset}}
16
+ tzOffset: {{tzOffset}} # 当前 UTC 偏移(DST 已计入)
17
+ {{/}}
18
+ {{?osInfo}}
19
+ os: {{osInfo}} # 当前操作系统及版本
20
+ {{/}}
9
21
  chatMode: {{chatMode}} # interactive=同步对话 / proactive=主动推送(输出静默)
22
+ {{?permissionMode}}
23
+ permissionMode: {{permissionMode}} # auto / bypass / request / edit / plan / noask / readonly
24
+ {{/}}
10
25
  {{?threadId}}
11
26
  threadId: {{threadId}} # 同一会话内的子话题 ID(多话题路由时)
12
27
  {{/}}
@@ -14,7 +29,8 @@ threadId: {{threadId}} # 同一会话内的子话题 ID(多话题路由时)
14
29
  readonly: true — 禁止修改项目文件,如需生成文件请写入 .evolclaw/tmp/
15
30
  {{/}}
16
31
  {{?chatMode=proactive}}
17
- # proactive 模式:文本输出静默丢弃,必须用以下命令发消息
18
- proactive-send: evolclaw ctl send "<text>"
19
- proactive-file: evolclaw ctl file <path>
32
+ # proactive 模式:你的普通文本会作为"思考过程"实时展示给用户(可见,但不入消息历史、不是回复)。
33
+ # 要正式回复对端,必须显式调用发送命令(命令集见 06-channel)。
34
+ proactive-send: ec msg send {{selfAid}} {{peerId}} "<text>" # 拿不到 self-aid 时退回 ec ctl send "<text>"
35
+ proactive-file: ec msg send {{selfAid}} {{peerId}} --file <path> --as <image|video|voice|file>
20
36
  {{/}}
@@ -2,6 +2,30 @@
2
2
  chatType: {{chatType}} # private|group
3
3
  EVOLCLAW_HOME: {{EVOLCLAW_HOME}} # 用户数据根目录(agents/sessions/logs)
4
4
  PACKAGE_ROOT: {{PACKAGE_ROOT}} # evolclaw 安装目录(kits/rules/docs)
5
+ {{?evolclawMode=dev}}
6
+ evolclawMode: dev # evolclaw 以源码仓库运行,$PACKAGE_ROOT/src 下的代码可直接查看和修改
7
+ {{/}}
8
+ {{?evolclawMode=install}}
9
+ evolclawMode: install # evolclaw 为全局安装包,$PACKAGE_ROOT 下代码可查看但不应直接修改;发现 bug 时生成 markdown 报告并通过附件消息发送给 toleiliang.agentid.pub
10
+ {{/}}
5
11
  {{?venueUid}}
6
12
  venueUid: {{venueUid}}
7
13
  {{/}}
14
+ {{?dispatch}}
15
+ dispatch: {{dispatch}} # 群分发模式:mention(被@才响应) / broadcast(所有消息都响应)
16
+ {{/}}
17
+ {{?clientType}}
18
+ clientType: {{clientType}} # 客户端类型:desktop / web / mobile
19
+ {{/}}
20
+ {{?groupId}}
21
+ groupId: {{groupId}}
22
+ {{/}}
23
+ {{?sameDevice}}
24
+ sameDevice: true # 对端与你运行在同一台设备上(E2EE 消息 proximity)
25
+ {{/}}
26
+ {{?sameNetwork}}
27
+ sameNetwork: true # 对端与你在同一网络内
28
+ {{/}}
29
+ {{?sameEgressIp}}
30
+ sameEgressIp: true # 对端与你共享同一出口 IP
31
+ {{/}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evolclaw",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "Lightweight AI Agent gateway connecting Claude Agent SDK to messaging channels (Feishu, ACP) with multi-project session management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,18 +24,22 @@
24
24
  "dev": "tsx watch src/index.ts",
25
25
  "build": "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').mkdirSync('dist/data',{recursive:true});require('fs').copyFileSync('src/data/error-dict.json','dist/data/error-dict.json')\"",
26
26
  "start": "node dist/index.js",
27
- "test": "flock --nonblock /tmp/evolclaw-test.lock vitest run || { echo '\\n[ERROR] Another vitest instance is already running. Wait or kill it first.' >&2; exit 1; }",
27
+ "test": "vitest run",
28
28
  "test:watch": "vitest",
29
29
  "test:hooks": "tsx test-sdk-hooks.ts",
30
30
  "prepublishOnly": "npm run build && npm test"
31
31
  },
32
32
  "dependencies": {
33
- "@agentunion/fastaun": "^0.3.3",
34
- "@anthropic-ai/claude-agent-sdk": "^0.2.100",
33
+ "@agentunion/fastaun": "^0.4.9",
34
+ "@anthropic-ai/claude-agent-sdk": "^0.3.156",
35
+ "@anthropic-ai/sdk": "^0.100.1",
36
+ "@modelcontextprotocol/sdk": "^1.29.0",
35
37
  "cron-parser": "^5.5.0",
36
38
  "dotenv": "^17.4.2",
37
39
  "image-type": "^6.0.0",
38
- "qrcode-terminal": "^0.12.0"
40
+ "qrcode-terminal": "^0.12.0",
41
+ "ws": "^8.21.0",
42
+ "zod": "^4.0.0"
39
43
  },
40
44
  "optionalDependencies": {
41
45
  "@larksuiteoapi/node-sdk": "^1.59.0",
@@ -49,6 +53,7 @@
49
53
  "@types/form-data": "^2.2.1",
50
54
  "@types/node": "^25.5.0",
51
55
  "@types/qrcode-terminal": "^0.12.2",
56
+ "@types/ws": "^8.18.1",
52
57
  "@vitest/coverage-v8": "^4.1.0",
53
58
  "tsx": "^4.19.0",
54
59
  "typescript": "^5.6.0",