evolclaw 2.8.0 → 2.8.2
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.
- package/dist/agents/templates.js +122 -0
- package/dist/channels/aun-ops.js +275 -0
- package/dist/channels/aun.js +206 -103
- package/dist/channels/qqbot.js +1 -1
- package/dist/channels/wechat.js +1 -1
- package/dist/cli.js +676 -20
- package/dist/config.js +94 -22
- package/dist/core/agent-registry.js +450 -0
- package/dist/core/command-handler.js +422 -255
- package/dist/core/evolagent-registry.js +503 -0
- package/dist/core/evolagent-schema.js +72 -0
- package/dist/core/evolagent.js +315 -0
- package/dist/core/message/message-bridge.js +23 -3
- package/dist/core/message/message-processor.js +56 -11
- package/dist/core/message/message-queue.js +59 -4
- package/dist/core/reload-hooks.js +87 -0
- package/dist/index.js +119 -20
- package/dist/ipc.js +47 -0
- package/dist/paths.js +2 -0
- package/dist/types.js +2 -0
- package/dist/utils/init-channel.js +91 -221
- package/dist/utils/init.js +18 -42
- package/dist/utils/logger.js +58 -2
- package/dist/utils/reload-hooks.js +87 -0
- package/dist/utils/rich-content-renderer.js +33 -0
- package/dist/utils/stats-collector.js +15 -10
- package/evolclaw-install-aun.md +48 -7
- package/package.json +1 -1
|
@@ -7,23 +7,24 @@ export class StatsCollector {
|
|
|
7
7
|
// 订阅相关事件
|
|
8
8
|
eventBus.subscribe('message:received', (event) => {
|
|
9
9
|
const e = event;
|
|
10
|
-
this.recordEvent({ type: 'received', timestamp: e.timestamp || Date.now() });
|
|
10
|
+
this.recordEvent({ type: 'received', timestamp: e.timestamp || Date.now(), agentName: e.agentName });
|
|
11
11
|
});
|
|
12
12
|
eventBus.subscribe('message:completed', (event) => {
|
|
13
13
|
const e = event;
|
|
14
|
-
this.recordEvent({ type: 'completed', timestamp: e.timestamp || Date.now(), durationMs: e.durationMs });
|
|
14
|
+
this.recordEvent({ type: 'completed', timestamp: e.timestamp || Date.now(), durationMs: e.durationMs, agentName: e.agentName });
|
|
15
15
|
});
|
|
16
16
|
eventBus.subscribe('message:error', (event) => {
|
|
17
17
|
const e = event;
|
|
18
|
-
this.recordEvent({ type: 'error', timestamp: Date.now(), errorType: e.errorType });
|
|
18
|
+
this.recordEvent({ type: 'error', timestamp: Date.now(), errorType: e.errorType, agentName: e.agentName });
|
|
19
19
|
});
|
|
20
|
-
eventBus.subscribe('message:interrupted', (
|
|
21
|
-
|
|
20
|
+
eventBus.subscribe('message:interrupted', (event) => {
|
|
21
|
+
const e = event;
|
|
22
|
+
this.recordEvent({ type: 'interrupted', timestamp: Date.now(), agentName: e.agentName });
|
|
22
23
|
});
|
|
23
24
|
eventBus.subscribe('tool:result', (event) => {
|
|
24
25
|
const e = event;
|
|
25
26
|
if (e.isError) {
|
|
26
|
-
this.recordEvent({ type: 'tool-error', timestamp: Date.now(), toolName: e.toolName });
|
|
27
|
+
this.recordEvent({ type: 'tool-error', timestamp: Date.now(), toolName: e.toolName, agentName: e.agentName });
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -31,14 +32,18 @@ export class StatsCollector {
|
|
|
31
32
|
this.events.push(record);
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
+
* 获取统计快照。可选 agentName 过滤:未传则全局;传入则只统计该 agent。
|
|
36
|
+
* 自动裁剪 >1h 的事件。
|
|
35
37
|
*/
|
|
36
|
-
getSnapshot() {
|
|
38
|
+
getSnapshot(agentName) {
|
|
37
39
|
const now = Date.now();
|
|
38
40
|
const cutoff = now - this.HOUR_MS;
|
|
39
41
|
// 裁剪过期事件
|
|
40
42
|
this.events = this.events.filter(e => e.timestamp >= cutoff);
|
|
41
|
-
//
|
|
43
|
+
// 聚合统计(可按 agent 过滤)
|
|
44
|
+
const filtered = agentName === undefined
|
|
45
|
+
? this.events
|
|
46
|
+
: this.events.filter(e => (e.agentName ?? '[default]') === agentName);
|
|
42
47
|
let received = 0;
|
|
43
48
|
let completed = 0;
|
|
44
49
|
let errors = 0;
|
|
@@ -48,7 +53,7 @@ export class StatsCollector {
|
|
|
48
53
|
let interrupts = 0;
|
|
49
54
|
let totalDuration = 0;
|
|
50
55
|
let durationCount = 0;
|
|
51
|
-
for (const event of
|
|
56
|
+
for (const event of filtered) {
|
|
52
57
|
switch (event.type) {
|
|
53
58
|
case 'received':
|
|
54
59
|
received++;
|
package/evolclaw-install-aun.md
CHANGED
|
@@ -46,23 +46,64 @@ export PATH=~/.npm-global/bin:$PATH
|
|
|
46
46
|
npm install -g evolclaw
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
### 步骤 3
|
|
49
|
+
### 步骤 3:检查是否已在运行
|
|
50
|
+
|
|
51
|
+
npm 安装完成后,先检查是否有正在运行的 evolclaw 进程。升级或重装场景下,旧进程仍在使用旧版本代码,必须停止后才能让新版本生效。
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
evolclaw status
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
判断逻辑:
|
|
58
|
+
|
|
59
|
+
- 输出包含 `running` / `PID` / `已启动` 等表明服务在运行 → **询问用户**是否停止:
|
|
60
|
+
|
|
61
|
+
> 检测到 evolclaw 正在运行(PID: xxx)。继续安装需要停止当前服务以应用新版本,是否停止?(y/N)
|
|
62
|
+
|
|
63
|
+
用户确认后执行:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
evolclaw stop
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
用户拒绝则中止安装流程,提醒其手动 `evolclaw stop` 后重新发起。
|
|
70
|
+
|
|
71
|
+
- 输出表明未运行(`not running` / `stopped` / 无 PID)→ 直接进入下一步。
|
|
72
|
+
|
|
73
|
+
### 步骤 4:准备配置信息
|
|
50
74
|
|
|
51
75
|
| 参数 | 说明 | 示例 |
|
|
52
76
|
|------|------|------|
|
|
53
77
|
| `--aun-aid` | **必填**,Agent 自身的 AID,作为 bot 在 AUN 网络上的独立身份 | `mybot.agentid.pub` |
|
|
54
78
|
| `--aun-owner` | **必填**,Owner 的 AID,用于接收欢迎消息和管理权限 | `alice.agentid.pub` |
|
|
55
|
-
| `--default-path` |
|
|
79
|
+
| `--default-path` | 默认项目路径(bot 会话未显式 `/bind` 时使用的工作目录) | `/home/user/myproject` |
|
|
56
80
|
|
|
57
81
|
**注意**:`--aun-aid` 和 `--aun-owner` 必须是不同的 AID。Agent 需要独立身份,不能与 Owner 相同。
|
|
58
82
|
|
|
59
83
|
如果用户在触发安装时已提供 Owner AID(例如消息中包含"将 xxx 添加为 Owner ID"),直接使用该值,否则询问用户。Agent AID 必须单独询问用户,不能默认使用 Owner AID。
|
|
60
84
|
|
|
61
|
-
|
|
85
|
+
**默认项目路径必须询问用户,提供三个选项:**
|
|
86
|
+
|
|
87
|
+
1. **推荐默认**:`~/projects/default`(EvolClaw 约定的默认工作区;若不存在会自动创建)
|
|
88
|
+
2. **当前 Claude Code 运行目录**:即本次会话启动 `claude` 的工作目录(通过 `pwd` 获取)——适合希望 bot 直接在当前项目里工作的场景
|
|
89
|
+
3. **自定义路径**:用户指定绝对路径(须是已存在的目录,或接受后自动创建)
|
|
90
|
+
|
|
91
|
+
示例提问:
|
|
92
|
+
|
|
93
|
+
> 请选择默认项目目录(bot 未显式 `/bind` 时使用的工作目录):
|
|
94
|
+
> 1) `~/projects/default`(推荐,EvolClaw 默认工作区)
|
|
95
|
+
> 2) 当前目录:`<pwd 输出>`
|
|
96
|
+
> 3) 自定义路径(请提供绝对路径)
|
|
97
|
+
|
|
98
|
+
用户未选择时,默认取选项 1。选项 3 需校验路径是绝对路径;目录不存在则 `mkdir -p` 创建。
|
|
99
|
+
|
|
100
|
+
### 步骤 5:非交互式初始化
|
|
101
|
+
|
|
102
|
+
将用户选择的目录作为 `--default-path` 传入:
|
|
62
103
|
|
|
63
104
|
```bash
|
|
64
105
|
evolclaw init --non-interactive \
|
|
65
|
-
--default-path
|
|
106
|
+
--default-path <用户选择的绝对路径> \
|
|
66
107
|
--channel aun \
|
|
67
108
|
--aun-aid <AID> \
|
|
68
109
|
--aun-owner <Owner AID>
|
|
@@ -76,7 +117,7 @@ evolclaw init --non-interactive \
|
|
|
76
117
|
5. 写入初始 `agent.md`(`initialized: false`)
|
|
77
118
|
6. 写入配置(含 owner 字段)
|
|
78
119
|
|
|
79
|
-
### 步骤
|
|
120
|
+
### 步骤 6:启动前验证
|
|
80
121
|
|
|
81
122
|
读取配置文件确认关键字段:
|
|
82
123
|
|
|
@@ -92,13 +133,13 @@ cat ~/.evolclaw/data/evolclaw.json
|
|
|
92
133
|
|
|
93
134
|
如发现缺失或异常,向用户说明并提供修复方案。
|
|
94
135
|
|
|
95
|
-
### 步骤
|
|
136
|
+
### 步骤 7:启动服务
|
|
96
137
|
|
|
97
138
|
```bash
|
|
98
139
|
evolclaw start
|
|
99
140
|
```
|
|
100
141
|
|
|
101
|
-
### 步骤
|
|
142
|
+
### 步骤 8:验证运行状态
|
|
102
143
|
|
|
103
144
|
```bash
|
|
104
145
|
evolclaw status
|
package/package.json
CHANGED