evolclaw 3.1.3 → 3.1.5

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 (100) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/assets/.env.template +4 -0
  3. package/assets/config.json.template +6 -0
  4. package/assets/wechat-group-qr.jpeg +0 -0
  5. package/dist/agents/claude-runner.js +348 -156
  6. package/dist/agents/kit-renderer.js +211 -42
  7. package/dist/aun/aid/agentmd.js +75 -139
  8. package/dist/aun/aid/client.js +1 -14
  9. package/dist/aun/aid/identity.js +381 -54
  10. package/dist/aun/aid/index.js +3 -2
  11. package/dist/aun/aid/store.js +74 -0
  12. package/dist/aun/msg/p2p.js +26 -2
  13. package/dist/aun/rpc/connection.js +23 -35
  14. package/dist/channels/aun.js +92 -144
  15. package/dist/channels/dingtalk.js +1 -0
  16. package/dist/channels/feishu.js +270 -190
  17. package/dist/channels/qqbot.js +1 -0
  18. package/dist/channels/wechat.js +1 -0
  19. package/dist/channels/wecom.js +1 -0
  20. package/dist/cli/agent.js +26 -27
  21. package/dist/cli/bench.js +45 -34
  22. package/dist/cli/help.js +23 -0
  23. package/dist/cli/index.js +538 -77
  24. package/dist/cli/init-channel.js +7 -4
  25. package/dist/cli/link-rules.js +2 -1
  26. package/dist/cli/model.js +324 -0
  27. package/dist/cli/net-check.js +138 -56
  28. package/dist/cli/watch-msg.js +7 -7
  29. package/dist/cli/watch-web/debug-log.js +18 -0
  30. package/dist/cli/watch-web/server.js +306 -0
  31. package/dist/cli/watch-web/sources/aid.js +63 -0
  32. package/dist/cli/watch-web/sources/msg.js +70 -0
  33. package/dist/cli/watch-web/sources/session.js +638 -0
  34. package/dist/cli/watch-web/sources/types.js +10 -0
  35. package/dist/cli/watch-web/static/app.js +546 -0
  36. package/dist/cli/watch-web/static/index.html +54 -0
  37. package/dist/cli/watch-web/static/style.css +247 -0
  38. package/dist/core/channel-loader.js +7 -4
  39. package/dist/core/command-handler.js +87 -93
  40. package/dist/core/evolagent-registry.js +1 -1
  41. package/dist/core/evolagent.js +4 -4
  42. package/dist/core/interaction-router.js +59 -0
  43. package/dist/core/message/message-bridge.js +6 -6
  44. package/dist/core/message/message-log.js +2 -2
  45. package/dist/core/message/message-processor.js +104 -118
  46. package/dist/core/message/stream-idle-monitor.js +21 -0
  47. package/dist/core/model/model-catalog.js +215 -0
  48. package/dist/core/model/model-scope.js +250 -0
  49. package/dist/core/relation/peer-identity.js +78 -44
  50. package/dist/core/relation/peer-key.js +16 -0
  51. package/dist/core/session/session-fs-store.js +34 -55
  52. package/dist/core/session/session-key.js +24 -0
  53. package/dist/core/session/session-manager.js +312 -251
  54. package/dist/core/session/session-mapper.js +9 -4
  55. package/dist/core/trigger/manager.js +37 -0
  56. package/dist/core/trigger/scheduler.js +2 -1
  57. package/dist/index.js +10 -3
  58. package/dist/ipc.js +22 -0
  59. package/dist/paths.js +87 -16
  60. package/dist/utils/npm-ops.js +18 -11
  61. package/kits/docs/GUIDE.md +2 -2
  62. package/kits/docs/INDEX.md +11 -7
  63. package/kits/docs/channels/aun.md +56 -17
  64. package/kits/docs/channels/feishu.md +41 -12
  65. package/kits/docs/context-assembly.md +181 -0
  66. package/kits/docs/evolclaw/agent.md +49 -0
  67. package/kits/docs/evolclaw/aid.md +49 -0
  68. package/kits/docs/evolclaw/ctl.md +46 -0
  69. package/kits/docs/evolclaw/group.md +82 -0
  70. package/kits/docs/evolclaw/msg.md +86 -0
  71. package/kits/docs/evolclaw/rpc.md +35 -0
  72. package/kits/docs/evolclaw/storage.md +49 -0
  73. package/kits/docs/venues/aun-group.md +10 -0
  74. package/kits/docs/venues/aun-private.md +10 -0
  75. package/kits/docs/venues/client-desktop.md +10 -0
  76. package/kits/docs/venues/client-mobile.md +10 -0
  77. package/kits/docs/venues/feishu-group.md +13 -0
  78. package/kits/docs/venues/feishu-private.md +9 -0
  79. package/kits/docs/venues/group.md +11 -0
  80. package/kits/docs/venues/private.md +10 -0
  81. package/kits/eck_manifest.json +75 -39
  82. package/kits/rules/01-overview.md +20 -10
  83. package/kits/rules/05-venue.md +2 -2
  84. package/kits/rules/06-channel.md +30 -27
  85. package/kits/templates/system-fragments/baseagent.md +7 -1
  86. package/kits/templates/system-fragments/channel.md +4 -1
  87. package/kits/templates/system-fragments/identity.md +4 -4
  88. package/kits/templates/system-fragments/relation.md +8 -5
  89. package/kits/templates/system-fragments/session.md +27 -0
  90. package/kits/templates/system-fragments/venue.md +13 -1
  91. package/package.json +13 -6
  92. package/dist/aun/aid/lifecycle-log.js +0 -33
  93. package/dist/net-check.js +0 -640
  94. package/dist/utils/aid-lifecycle-log.js +0 -33
  95. package/dist/watch-msg.js +0 -544
  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
  100. package/kits/templates/system-fragments/eckruntime.md +0 -14
@@ -4,92 +4,128 @@
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": "scene",
21
- "neq": "coding"
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": "scene",
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
- },
71
- "description": "渠道层:我通过什么通信"
109
+ "when": { "var": "channel", "neq": null },
110
+ "description": "渠道层:通信渠道及能力"
72
111
  },
73
112
  {
74
- "id": "eckruntime",
113
+ "id": "session",
75
114
  "type": "file",
76
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/eckruntime.md",
115
+ "file": "$KITS_FRAGMENTS/session.md",
77
116
  "order": 60,
78
117
  "needsInjection": true,
79
118
  "when": "always",
80
- "description": "运行时参数"
119
+ "description": "会话层:当前会话实例状态"
81
120
  },
82
121
  {
83
122
  "id": "baseagent",
84
123
  "type": "file",
85
- "file": "$PACKAGE_ROOT/kits/templates/system-fragments/baseagent.md",
124
+ "file": "$KITS_FRAGMENTS/baseagent.md",
86
125
  "order": 70,
87
126
  "needsInjection": true,
88
- "when": {
89
- "var": "baseAgent",
90
- "neq": null
91
- },
127
+ "when": { "var": "baseAgent", "neq": null },
92
128
  "description": "Base Agent 特定配置"
93
129
  }
94
130
  ]
95
- }
131
+ }
@@ -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)**:渠道 + 场景(私聊/群聊)构成的交互空间
@@ -1,6 +1,6 @@
1
- # 环境层:我在什么场景下
1
+ # 环境层:当前对话场景
2
2
 
3
- 环境层决定当前会话加载哪些信息。动态注入的 `scene` 标识当前场景类型,`venueKey`(`<channel>#<urlEncode(venueId)>`)是 venue 在所有渠道中的稳定标识。
3
+ 环境层决定当前会话加载哪些信息。动态注入的 `chatType` 标识当前聊天类型(private/group/null),`venueUid` 是场所唯一标识(预留)。
4
4
 
5
5
  ## 场景判定
6
6
 
@@ -6,45 +6,41 @@
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 为发送者。详细用法按需 Read 对应文档。
37
34
 
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` |
35
+ | 命令集 | 用途 | 触发词 | 详细文档 |
36
+ |--------|------|--------|----------|
37
+ | `ec msg` | 私聊收发消息 | 回复/发消息/拉取/撤回 | `$KITS_DOCS/evolclaw/msg.md` |
38
+ | `ec group` | 群聊收发与群管理 | 群发/建群/邀请/踢人 | `$KITS_DOCS/evolclaw/group.md` |
39
+ | `ec agent` | EvolAgent 生命周期 | 创建/启用禁用/热重载/改配置 | `$KITS_DOCS/evolclaw/agent.md` |
40
+ | `ec aid` | AID 身份管理 | 身份/证书/名片/探测对端 | `$KITS_DOCS/evolclaw/aid.md` |
41
+ | `ec storage` | 文件存储 | 上传/下载/配额 | `$KITS_DOCS/evolclaw/storage.md` |
42
+ | `ec ctl` | 会话运行时自管理 | 切模型/推理强度/压缩/重启 | `$KITS_DOCS/evolclaw/ctl.md` |
43
+ | `ec rpc` | 底层 AUN RPC(逃生通道) | 直接调协议方法 | `$KITS_DOCS/evolclaw/rpc.md` |
48
44
 
49
45
  共同约定:
50
46
  - 以自己的 AID 为发送者
@@ -52,6 +48,13 @@ ec ctl send --encrypt "<text>"
52
48
  - `--format json` 所有命令通用
53
49
  - `--app <name>` 指定应用 slot
54
50
 
55
- ## 各渠道文档
51
+ ## 各渠道知识文档(按需加载)
52
+
53
+ `$KITS_DOCS/channels/` 下每个渠道一份知识文档,内容是该渠道的**配置、参数、特有机制**——
54
+ 属于知识性内容,**不依赖**当前注入的渠道类型。需要了解某渠道怎么配置、有哪些参数、
55
+ 有哪些特别机制时,按需 Read 对应文档(在 aun 会话里也可查飞书,反之亦然)。
56
56
 
57
- 不同渠道的详细通信规则和命令工具使用方式:Read `$KITS_DOCS/channels/` 中的对应文档。
57
+ | 渠道 | 文档 | 触发词 |
58
+ |------|------|--------|
59
+ | AUN | `$KITS_DOCS/channels/aun.md` | aun 怎么配置/网关/E2EE/群 ID 格式/证书链 |
60
+ | 飞书 | `$KITS_DOCS/channels/feishu.md` | 飞书怎么配置/appId/合并转发/卡片/user_id |
@@ -1,2 +1,8 @@
1
1
  [baseagent]
2
- base-agent: {{baseAgentName}}
2
+ baseAgentName: {{baseAgentName}} # 底层推理引擎(Claude Code / Codex / Gemini CLI)
3
+ {{?baseAgentModel}}
4
+ baseAgentModel: {{baseAgentModel}}
5
+ {{/}}
6
+ {{?agentSessionId}}
7
+ agentSessionId: {{agentSessionId}} # 底层引擎的会话 ID(区别于 evolclaw sessionId)
8
+ {{/}}
@@ -1,5 +1,8 @@
1
1
  [channel]
2
- channel: {{channel}}
2
+ channel: {{channel}} # 渠道类型:aun|feishu|wechat|dingtalk|qqbot|wecom
3
+ {{?capabilities}}
4
+ capabilities: {{capabilities}} # 当前渠道支持的能力
5
+ {{/}}
3
6
  {{?peerId}}
4
7
  {{?channel=aun}}
5
8
  ec msg send {{selfAid}} {{peerId}} "<text>" [--encrypt] [--file <path> --as image|video|voice|file] [--link <url> --title "<title>"] [--payload '<json>']
@@ -1,11 +1,11 @@
1
1
  [identity]
2
2
  {{?selfAid}}
3
- self-name: {{selfName}}
4
- self-aid: {{selfAid}}
3
+ selfName: {{selfName}}
4
+ selfAid: {{selfAid}}
5
5
  {{/}}
6
6
  {{?hasPersona}}
7
- persona: loaded
7
+ hasPersona: active
8
8
  {{/}}
9
9
  {{?hasWorkingMemory}}
10
- working-memory: loaded
10
+ hasWorkingMemory: active
11
11
  {{/}}
@@ -1,11 +1,14 @@
1
1
  {{?peerKey}}
2
2
  [relation]
3
- peer-name: {{peerName}}
4
- peer-aid: {{peerId}}
5
- peer-role: {{peerRole}}
6
- peer-key: {{peerKey}}
3
+ peerName: {{peerName}}
4
+ peerId: {{peerId}} # 对端在当前渠道内的原生 ID
5
+ peerRole: {{peerRole}} # owner|admin|guest|anonymous
6
+ {{?peerType}}
7
+ peerType: {{peerType}} # human 或 agent
8
+ {{/}}
9
+ peerKey: {{peerKey}} # 跨渠道唯一标识,格式 channel#urlEncode(peerId)
7
10
  {{/}}
8
11
  {{?groupId}}
9
12
  [relation]
10
- group-id: {{groupId}}
13
+ groupId: {{groupId}}
11
14
  {{/}}
@@ -0,0 +1,27 @@
1
+ [session]
2
+ project: {{project}} # 项目目录名
3
+ CURRENT_PROJECT: {{CURRENT_PROJECT}} # 项目完整路径
4
+ sessionId: {{sessionId}} # evolclaw 会话 ID
5
+ {{?sessionKey}}
6
+ sessionKey: {{sessionKey}} # 会话路由键(channelType#urlEncode(channelId)#urlEncode(threadId))
7
+ {{/}}
8
+ {{?sessionName}}
9
+ sessionName: {{sessionName}}
10
+ {{/}}
11
+ sessionCreatedAt: {{sessionCreatedAt}}
12
+ chatMode: {{chatMode}} # interactive=同步对话 / proactive=主动推送(输出静默)
13
+ {{?permissionMode}}
14
+ permissionMode: {{permissionMode}} # auto / bypass / request / edit / plan / noask / readonly
15
+ {{/}}
16
+ {{?threadId}}
17
+ threadId: {{threadId}} # 同一会话内的子话题 ID(多话题路由时)
18
+ {{/}}
19
+ {{?readonly}}
20
+ readonly: true — 禁止修改项目文件,如需生成文件请写入 .evolclaw/tmp/
21
+ {{/}}
22
+ {{?chatMode=proactive}}
23
+ # proactive 模式:你的普通文本会作为"思考过程"实时展示给用户(可见,但不入消息历史、不是回复)。
24
+ # 要正式回复对端,必须显式调用发送命令(命令集见 06-channel)。
25
+ proactive-send: ec msg send {{selfAid}} {{peerId}} "<text>" # 拿不到 self-aid 时退回 ec ctl send "<text>"
26
+ proactive-file: ec msg send {{selfAid}} {{peerId}} --file <path> --as <image|video|voice|file>
27
+ {{/}}
@@ -1,4 +1,16 @@
1
1
  [venue]
2
+ chatType: {{chatType}} # private|group
3
+ EVOLCLAW_HOME: {{EVOLCLAW_HOME}} # 用户数据根目录(agents/sessions/logs)
4
+ PACKAGE_ROOT: {{PACKAGE_ROOT}} # evolclaw 安装目录(kits/rules/docs)
2
5
  {{?venueUid}}
3
- venue-id: {{venueUid}}
6
+ venueUid: {{venueUid}}
7
+ {{/}}
8
+ {{?dispatch}}
9
+ dispatch: {{dispatch}} # 群分发模式:mention(被@才响应) / broadcast(所有消息都响应)
10
+ {{/}}
11
+ {{?clientType}}
12
+ clientType: {{clientType}} # 客户端类型:desktop / web / mobile
13
+ {{/}}
14
+ {{?groupId}}
15
+ groupId: {{groupId}}
4
16
  {{/}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evolclaw",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
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",
@@ -11,6 +11,7 @@
11
11
  "files": [
12
12
  "dist/",
13
13
  "bin/",
14
+ "assets/",
14
15
  "!dist/experimental/",
15
16
  "kits/",
16
17
  "!kits/.kits-version",
@@ -21,19 +22,24 @@
21
22
  ],
22
23
  "scripts": {
23
24
  "dev": "tsx watch src/index.ts",
24
- "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')\"",
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')\" && node -e \"require('fs').cpSync('src/cli/watch-web/static','dist/cli/watch-web/static',{recursive:true})\"",
25
26
  "start": "node dist/index.js",
26
- "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",
27
28
  "test:watch": "vitest",
28
29
  "test:hooks": "tsx test-sdk-hooks.ts",
29
30
  "prepublishOnly": "npm run build && npm test"
30
31
  },
31
32
  "dependencies": {
32
- "@agentunion/fastaun": "^0.3.2",
33
- "@anthropic-ai/claude-agent-sdk": "^0.2.100",
33
+ "@agentunion/fastaun": "^0.4.7",
34
+ "@anthropic-ai/claude-agent-sdk": "^0.3.156",
35
+ "@anthropic-ai/sdk": "^0.100.1",
36
+ "@modelcontextprotocol/sdk": "^1.29.0",
34
37
  "cron-parser": "^5.5.0",
38
+ "dotenv": "^17.4.2",
35
39
  "image-type": "^6.0.0",
36
- "qrcode-terminal": "^0.12.0"
40
+ "qrcode-terminal": "^0.12.0",
41
+ "ws": "^8.21.0",
42
+ "zod": "^4.0.0"
37
43
  },
38
44
  "optionalDependencies": {
39
45
  "@larksuiteoapi/node-sdk": "^1.59.0",
@@ -47,6 +53,7 @@
47
53
  "@types/form-data": "^2.2.1",
48
54
  "@types/node": "^25.5.0",
49
55
  "@types/qrcode-terminal": "^0.12.2",
56
+ "@types/ws": "^8.18.1",
50
57
  "@vitest/coverage-v8": "^4.1.0",
51
58
  "tsx": "^4.19.0",
52
59
  "typescript": "^5.6.0",
@@ -1,33 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { resolvePaths } from '../../paths.js';
4
- function ensureDir(dir) {
5
- fs.mkdirSync(dir, { recursive: true });
6
- }
7
- function logPath(aid) {
8
- const aidName = aid.startsWith('@') ? aid.slice(1) : aid;
9
- return path.join(resolvePaths().aidLogsDir, `${aidName}.jsonl`);
10
- }
11
- export function appendAidLifecycle(event) {
12
- const filePath = logPath(event.aid);
13
- ensureDir(path.dirname(filePath));
14
- fs.appendFileSync(filePath, JSON.stringify(event) + '\n');
15
- }
16
- export function readAidLifecycle(aid, lastN = 50) {
17
- const filePath = logPath(aid);
18
- try {
19
- const content = fs.readFileSync(filePath, 'utf-8');
20
- const lines = content.trim().split('\n').filter(Boolean);
21
- const events = [];
22
- for (const line of lines.slice(-lastN)) {
23
- try {
24
- events.push(JSON.parse(line));
25
- }
26
- catch { }
27
- }
28
- return events;
29
- }
30
- catch {
31
- return [];
32
- }
33
- }