evolclaw 2.0.2 → 2.0.4
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/LICENSE +21 -0
- package/README.md +144 -90
- package/data/evolclaw.sample.json +8 -17
- package/dist/cli.js +21 -10
- package/dist/index.js +11 -3
- package/package.json +4 -6
- package/bin/evolclaw +0 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 eLeanwang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,27 +1,93 @@
|
|
|
1
1
|
# EvolClaw
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 把 Claude Code 装进飞书和微信 —— 随时随地,接力开发
|
|
4
|
+
|
|
5
|
+
EvolClaw 是一个轻量级 AI Agent 网关,基于 Claude Agent SDK 构建。它将终端中的 Claude Code 能力延伸到飞书、微信等即时通讯工具,让你在手机上也能review 代码、调试问题、管理项目,真正实现多终端无缝接力开发。
|
|
4
6
|
|
|
5
7
|
## 核心特性
|
|
6
8
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
9
|
+
- **多端会话接力**:跨终端共享会话、环境、项目,无缝切换开发体验
|
|
10
|
+
- **配置自动继承**:复用 CLI 环境的 API Key/URL、记忆文件、MCP/Skills 插件,零额外配置
|
|
11
|
+
- **轻量化设计**:进程模式运行,CLI 命令行管理,无端口开放,无容器依赖,无 UI 界面
|
|
12
|
+
- **多项目支持**:每个项目独立会话,支持动态切换
|
|
13
|
+
- **双模式会话**:私聊会话隔离互不干扰,群聊会话共享协同协作
|
|
14
|
+
- **多渠道接入**:Channel Adapter 模式,飞书 + 微信扫码一键接入
|
|
15
|
+
- **分层权限**:用户级/管理员级命令分离,多用户安全隔离
|
|
16
|
+
- **统一消息处理**:消息处理与渠道解耦,新增渠道仅需 ~15 行代码
|
|
17
|
+
- **会话持久化**:会话数据与 CLI 工具共享,不额外存储,服务重启不丢失
|
|
18
|
+
- **执行中插入**:任务执行中可发送新消息,自动中断当前任务并处理新请求
|
|
19
|
+
- **消息智能发送**:前台任务动态聚合批量发送,后台任务静默完成后通知
|
|
20
|
+
- **健壮性保障**:任务超时提醒、会话异常安全模式修复、重启失败自动自愈
|
|
21
|
+
|
|
22
|
+
## 适合场景
|
|
23
|
+
|
|
24
|
+
- **通勤路上**:手机打开飞书,继续昨晚的代码 review,到公司无缝切回终端
|
|
25
|
+
- **会议间隙**:微信快速问一句「这个接口的返回格式是什么」,Agent 直接查代码回复
|
|
26
|
+
- **下班之后**:躺在沙发上用手机跟进 CI 报错,让 Agent 定位问题并修复
|
|
27
|
+
- **外出离开工位**:不带电脑也能通过 IM 给 Agent 下达任务,回来看结果
|
|
28
|
+
- **团队协作**:拉个飞书群,成员共享同一个 Agent 会话,一起讨论和调试
|
|
29
|
+
|
|
30
|
+
## 系统架构
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
消息渠道层 → 消息队列层 → 命令处理层 → 消息处理层 → 会话管理层 → 存储层
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 核心组件
|
|
37
|
+
|
|
38
|
+
1. **消息渠道层** (`src/channels/`) - Feishu WebSocket + WeChat HTTP 长轮询
|
|
39
|
+
2. **消息队列层** (`src/core/message-queue.ts`) - 会话级串行处理 + 中断支持
|
|
40
|
+
3. **命令处理层** (`src/core/command-handler.ts`) - 斜杠命令处理(CommandHandler 类)
|
|
41
|
+
4. **消息处理层** (`src/core/message-processor.ts`) - 统一事件处理引擎
|
|
42
|
+
5. **会话管理层** (`src/core/session-manager.ts`) - 多项目会话管理
|
|
43
|
+
6. **会话存储层** - JSONL 文件(CLI 共用)+ SQLite 元数据
|
|
44
|
+
|
|
45
|
+
### 消息流转
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
用户发送消息
|
|
49
|
+
↓
|
|
50
|
+
Channel.onMessage
|
|
51
|
+
↓
|
|
52
|
+
检查命令 → 是 → CommandHandler.handle() → 立即响应(绕过队列)
|
|
53
|
+
↓ 否
|
|
54
|
+
MessageQueue.enqueue(streamKey, message)
|
|
55
|
+
↓
|
|
56
|
+
检测正在处理 → 是 → 触发中断 → AgentRunner.interrupt()
|
|
57
|
+
↓ 否 ↓
|
|
58
|
+
MessageQueue.processNext() ←──────────────┘
|
|
59
|
+
↓
|
|
60
|
+
MessageProcessor.processMessage()
|
|
61
|
+
↓
|
|
62
|
+
├─ 解析会话和项目路径
|
|
63
|
+
├─ 创建 StreamFlusher(3 秒批量发送)
|
|
64
|
+
├─ AgentRunner.runQuery() → 事件流
|
|
65
|
+
├─ 处理事件(tool_use / text / result)
|
|
66
|
+
├─ 提取文件标记(Feishu)
|
|
67
|
+
└─ 发送最终响应
|
|
68
|
+
```
|
|
19
69
|
|
|
20
70
|
## 快速开始
|
|
21
71
|
|
|
72
|
+
### 环境要求
|
|
73
|
+
|
|
74
|
+
- **操作系统**:macOS / Linux(Windows 暂不支持,见 TODO)
|
|
75
|
+
- **Node.js** >= 22(需要 node:sqlite 内置模块支持)
|
|
76
|
+
- **Claude Code** >= 2.1.32(`npm install -g @anthropic-ai/claude-code`)
|
|
77
|
+
|
|
22
78
|
### 1. 安装
|
|
23
79
|
|
|
80
|
+
**npm 全局安装**(推荐):
|
|
81
|
+
|
|
24
82
|
```bash
|
|
83
|
+
npm install -g evolclaw
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**从源码安装**:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git clone https://github.com/eLeanwang/evolclaw.git
|
|
90
|
+
cd evolclaw
|
|
25
91
|
npm install
|
|
26
92
|
npm run build
|
|
27
93
|
npm link
|
|
@@ -30,18 +96,48 @@ npm link
|
|
|
30
96
|
### 2. 初始化
|
|
31
97
|
|
|
32
98
|
```bash
|
|
99
|
+
# 完整初始化(选择飞书或微信)
|
|
33
100
|
evolclaw init
|
|
101
|
+
|
|
102
|
+
# 单独配置飞书(扫码登录)
|
|
103
|
+
evolclaw init feishu
|
|
104
|
+
|
|
105
|
+
# 单独配置微信(扫码登录)
|
|
106
|
+
evolclaw init wechat
|
|
34
107
|
```
|
|
35
108
|
|
|
36
109
|
交互式引导完成以下配置:
|
|
37
110
|
- 环境检查(Node.js >= 22、claude CLI、SDK 版本)
|
|
38
|
-
-
|
|
111
|
+
- 渠道选择(飞书/微信)并扫码登录
|
|
39
112
|
- 默认项目路径
|
|
40
113
|
- 模型选择(sonnet/opus/haiku)
|
|
41
114
|
- 自动写入 `EVOLCLAW_HOME` 到 shell profile
|
|
42
115
|
|
|
43
116
|
配置文件生成在 `{EVOLCLAW_HOME}/data/evolclaw.json`(默认 `~/.evolclaw/data/evolclaw.json`)。
|
|
44
117
|
|
|
118
|
+
### 补充配置(可选)
|
|
119
|
+
|
|
120
|
+
以下参数不包含在 `evolclaw init` 交互流程中,需要手动编辑 `evolclaw.json`:
|
|
121
|
+
|
|
122
|
+
```jsonc
|
|
123
|
+
{
|
|
124
|
+
"projects": {
|
|
125
|
+
"autoCreate": true // 绑定不存在的项目路径时自动创建目录
|
|
126
|
+
},
|
|
127
|
+
"idleMonitor": {
|
|
128
|
+
"enabled": true, // 任务超时监控开关
|
|
129
|
+
"timeout": 120000, // 超时阈值(ms),默认 2 分钟
|
|
130
|
+
"safeModeThreshold": 3 // 连续超时 N 次后进入安全模式(设为 0 禁用安全模式)
|
|
131
|
+
},
|
|
132
|
+
"flushDelay": 4000 // 工具活动消息聚合发送间隔(ms),默认 4 秒
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**API 继承机制**:`agents.anthropic` 整个 section 可省略,系统自动按以下优先级继承:
|
|
137
|
+
- `apiKey`:配置文件 → `ANTHROPIC_AUTH_TOKEN` 环境变量 → `~/.claude/settings.json`
|
|
138
|
+
- `baseUrl`:配置文件 → `ANTHROPIC_BASE_URL` 环境变量 → `~/.claude/settings.json`
|
|
139
|
+
- `model`:配置文件 → `~/.claude/settings.json` → 默认 `sonnet`
|
|
140
|
+
|
|
45
141
|
### 3. 运行
|
|
46
142
|
|
|
47
143
|
```bash
|
|
@@ -59,61 +155,6 @@ npm run dev
|
|
|
59
155
|
npm test
|
|
60
156
|
```
|
|
61
157
|
|
|
62
|
-
## 系统架构
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
消息渠道层 → 消息队列层 → 命令处理层 → 消息处理层 → 会话管理层 → 存储层
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 核心组件
|
|
69
|
-
|
|
70
|
-
1. **消息渠道层** (`src/channels/`) - Feishu WebSocket + AUN 协议
|
|
71
|
-
2. **消息队列层** (`src/core/message-queue.ts`) - 会话级串行处理 + 中断支持
|
|
72
|
-
3. **命令处理层** (`src/core/command-handler.ts`) - 斜杠命令处理(CommandHandler 类)
|
|
73
|
-
4. **消息处理层** (`src/core/message-processor.ts`) - 统一事件处理引擎
|
|
74
|
-
5. **会话管理层** (`src/core/session-manager.ts`) - 多项目会话管理
|
|
75
|
-
6. **存储层** - JSONL 文件(SDK 管理)+ SQLite 元数据
|
|
76
|
-
|
|
77
|
-
### 数据目录
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
{EVOLCLAW_HOME}/ # 默认: ~/.evolclaw
|
|
81
|
-
├── data/
|
|
82
|
-
│ ├── evolclaw.json # 配置文件(含密钥,不在 git)
|
|
83
|
-
│ ├── evolclaw.sample.json # 配置模板
|
|
84
|
-
│ └── sessions.db # 会话数据库
|
|
85
|
-
└── logs/
|
|
86
|
-
├── evolclaw.pid # PID 文件
|
|
87
|
-
├── evolclaw.log # 主日志
|
|
88
|
-
├── stdout.log # 标准输出
|
|
89
|
-
└── messages.log # 消息日志
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 消息流转
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
用户发送消息
|
|
96
|
-
↓
|
|
97
|
-
Channel.onMessage
|
|
98
|
-
↓
|
|
99
|
-
检查命令 → 是 → CommandHandler.handle() → 立即响应(绕过队列)
|
|
100
|
-
↓ 否
|
|
101
|
-
MessageQueue.enqueue(streamKey, message)
|
|
102
|
-
↓
|
|
103
|
-
检测正在处理 → 是 → 触发中断 → AgentRunner.interrupt()
|
|
104
|
-
↓ 否 ↓
|
|
105
|
-
MessageQueue.processNext() ←──────────────┘
|
|
106
|
-
↓
|
|
107
|
-
MessageProcessor.processMessage()
|
|
108
|
-
↓
|
|
109
|
-
├─ 解析会话和项目路径
|
|
110
|
-
├─ 创建 StreamFlusher(3 秒批量发送)
|
|
111
|
-
├─ AgentRunner.runQuery() → 事件流
|
|
112
|
-
├─ 处理事件(tool_use / text / result)
|
|
113
|
-
├─ 提取文件标记(Feishu)
|
|
114
|
-
└─ 发送最终响应
|
|
115
|
-
```
|
|
116
|
-
|
|
117
158
|
## 项目结构
|
|
118
159
|
|
|
119
160
|
```
|
|
@@ -131,7 +172,7 @@ evolclaw/
|
|
|
131
172
|
│ │ └── message-cache.ts # 消息缓存
|
|
132
173
|
│ ├── channels/
|
|
133
174
|
│ │ ├── feishu.ts # 飞书 WebSocket 渠道
|
|
134
|
-
│ │ └──
|
|
175
|
+
│ │ └── wechat.ts # 微信 ClawBot 渠道
|
|
135
176
|
│ ├── utils/ # 工具函数
|
|
136
177
|
│ ├── types.ts # 类型定义
|
|
137
178
|
│ ├── config.ts # 配置加载
|
|
@@ -144,11 +185,7 @@ evolclaw/
|
|
|
144
185
|
|
|
145
186
|
## 斜杠命令
|
|
146
187
|
|
|
147
|
-
|
|
148
|
-
- `/pwd` - 显示当前项目路径
|
|
149
|
-
- `/plist` - 列出所有项目(显示会话空闲时间)
|
|
150
|
-
- `/p <name|path>` - 切换项目(保留会话历史)
|
|
151
|
-
- `/bind <path>` - 绑定新项目目录
|
|
188
|
+
### 用户级命令(所有用户可用)
|
|
152
189
|
|
|
153
190
|
**会话管理**:
|
|
154
191
|
- `/new [名称]` - 创建新会话
|
|
@@ -156,36 +193,53 @@ evolclaw/
|
|
|
156
193
|
- `/s <名称>` - 切换到指定会话
|
|
157
194
|
- `/name <新名称>` - 重命名当前会话
|
|
158
195
|
- `/status` - 显示会话状态
|
|
196
|
+
- `/help` - 显示所有命令
|
|
197
|
+
|
|
198
|
+
### 管理员级命令(仅 Owner 可用)
|
|
199
|
+
|
|
200
|
+
**项目管理**:
|
|
201
|
+
- `/pwd` - 显示当前项目路径
|
|
202
|
+
- `/plist` - 列出所有项目(显示会话空闲时间)
|
|
203
|
+
- `/p <name|path>` - 切换项目(保留会话历史)
|
|
204
|
+
- `/bind <path>` - 绑定新项目目录
|
|
205
|
+
|
|
206
|
+
**系统管理**:
|
|
159
207
|
- `/clear` - 清空对话历史
|
|
160
208
|
- `/compact` - 压缩会话上下文
|
|
161
209
|
- `/stop` - 中断当前任务
|
|
162
|
-
- `/restart` -
|
|
210
|
+
- `/restart` - 重启服务(自愈机制)
|
|
211
|
+
- `/repair` - 检查并修复会话
|
|
212
|
+
- `/safe` - 进入安全模式
|
|
163
213
|
|
|
164
214
|
**模型管理**:
|
|
165
215
|
- `/model` - 显示当前模型和可用列表
|
|
166
216
|
- `/model <model-id>` - 切换模型
|
|
167
217
|
|
|
168
|
-
**其他**:
|
|
169
|
-
- `/repair` - 检查并修复会话
|
|
170
|
-
- `/safe` - 进入安全模式
|
|
171
|
-
- `/help` - 显示所有命令
|
|
172
|
-
|
|
173
218
|
## 技术栈
|
|
174
219
|
|
|
175
220
|
- **运行时**:Node.js >= 22 + TypeScript(ES modules)
|
|
176
221
|
- **AI SDK**:@anthropic-ai/claude-agent-sdk >= 0.2.75
|
|
177
|
-
- **消息渠道**:飞书(@larksuiteoapi/node-sdk)
|
|
178
|
-
- **数据存储**:node:sqlite
|
|
222
|
+
- **消息渠道**:飞书(@larksuiteoapi/node-sdk)、微信(ClawBot ilink API)
|
|
223
|
+
- **数据存储**:node:sqlite(内置模块)+ JSONL(CLI 共用)
|
|
179
224
|
- **测试框架**:Vitest
|
|
180
225
|
|
|
181
|
-
##
|
|
226
|
+
## TODO
|
|
227
|
+
|
|
228
|
+
- [ ] Windows 系统 CLI 命令支持
|
|
229
|
+
- [ ] 微信插件支持图片/文件的收发
|
|
230
|
+
- [ ] 自动授权可配置(自动放行/自动拒绝)
|
|
231
|
+
- [ ] 手动授权支持(飞书卡片/文本回复)
|
|
232
|
+
- [ ] ACP 协议支持(接入 Codex / Gemini CLI)
|
|
182
233
|
|
|
183
|
-
- [CLAUDE.md](./CLAUDE.md) - 开发指南
|
|
184
|
-
- [架构设计](./docs/architecture.md) - 系统架构和技术实现
|
|
185
|
-
- [多项目支持](./docs/multi-project-and-commands.md) - 多项目管理和命令
|
|
186
|
-
- [多会话设计](./docs/multi-session-design.md) - 多会话管理设计
|
|
187
|
-
- [设计文档 v2](./docs/DESIGN-v2.md) - 完整设计文档
|
|
188
234
|
|
|
189
235
|
## 许可证
|
|
190
236
|
|
|
191
|
-
MIT
|
|
237
|
+
MIT — 详见 [LICENSE](LICENSE) 声明
|
|
238
|
+
|
|
239
|
+
## 交流群
|
|
240
|
+
|
|
241
|
+
EvolClaw 正在内测中,欢迎加入微信群交流使用体验、反馈问题或参与讨论:
|
|
242
|
+
|
|
243
|
+
<img src="assets/wechat-group-qr.jpeg" width="300" alt="EvolClaw 内测群二维码" />
|
|
244
|
+
|
|
245
|
+
> 二维码过期后可在 [Issues](https://github.com/eLeanwang/evolclaw/issues) 中留言,我会更新邀请链接。
|
|
@@ -1,44 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"agents": {
|
|
3
3
|
"anthropic": {
|
|
4
|
-
"
|
|
5
|
-
"apiKey": "your-api-key-here",
|
|
6
|
-
"model": "sonnet",
|
|
7
|
-
"useSettingSources": true,
|
|
8
|
-
"agentProgressSummaries": true
|
|
4
|
+
"model": "sonnet"
|
|
9
5
|
}
|
|
10
6
|
},
|
|
11
7
|
"channels": {
|
|
12
8
|
"feishu": {
|
|
13
9
|
"enabled": true,
|
|
14
|
-
"appId": "
|
|
15
|
-
"appSecret": "
|
|
16
|
-
"owner": ""
|
|
10
|
+
"appId": "",
|
|
11
|
+
"appSecret": ""
|
|
17
12
|
},
|
|
18
13
|
"wechat": {
|
|
19
14
|
"enabled": false,
|
|
20
15
|
"baseUrl": "https://ilinkai.weixin.qq.com",
|
|
21
|
-
"token": ""
|
|
22
|
-
"owner": ""
|
|
16
|
+
"token": ""
|
|
23
17
|
},
|
|
24
18
|
"aun": {
|
|
25
19
|
"enabled": true,
|
|
26
20
|
"domain": "your-aun-domain",
|
|
27
|
-
"agentName": "your-agent-name"
|
|
28
|
-
"owner": ""
|
|
21
|
+
"agentName": "your-agent-name"
|
|
29
22
|
}
|
|
30
23
|
},
|
|
31
24
|
"projects": {
|
|
32
25
|
"defaultPath": "/path/to/default/project",
|
|
33
26
|
"autoCreate": true,
|
|
34
|
-
"list": {
|
|
35
|
-
"project1": "/path/to/project1"
|
|
36
|
-
}
|
|
27
|
+
"list": {}
|
|
37
28
|
},
|
|
38
29
|
"idleMonitor": {
|
|
39
30
|
"enabled": true,
|
|
40
|
-
"
|
|
41
|
-
"
|
|
31
|
+
"timeout": 120000,
|
|
32
|
+
"safeModeThreshold": 3
|
|
42
33
|
},
|
|
43
34
|
"flushDelay": 4000
|
|
44
35
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import { spawn, execFileSync, execFile } from 'child_process';
|
|
@@ -341,9 +342,9 @@ async function cmdStatus() {
|
|
|
341
342
|
'SELECT count(*) FROM sessions; SELECT count(*) FROM sessions WHERE is_active=1; SELECT count(DISTINCT channel_id) FROM sessions; SELECT count(DISTINCT project_path) FROM sessions;'
|
|
342
343
|
], { encoding: 'utf-8' }).trim().split('\n');
|
|
343
344
|
if (output.length >= 4) {
|
|
344
|
-
console.log(`
|
|
345
|
-
console.log(`
|
|
346
|
-
console.log(`
|
|
345
|
+
console.log(` Total sessions: ${output[0]} (active: ${output[1]})`);
|
|
346
|
+
console.log(` Unique chats: ${output[2]}`);
|
|
347
|
+
console.log(` Projects: ${output[3]}`);
|
|
347
348
|
}
|
|
348
349
|
}
|
|
349
350
|
catch { }
|
|
@@ -382,12 +383,6 @@ async function cmdStatus() {
|
|
|
382
383
|
else {
|
|
383
384
|
console.log(' Feishu: - Not configured');
|
|
384
385
|
}
|
|
385
|
-
if (config.channels?.aun?.domain && config.channels?.aun?.agentName) {
|
|
386
|
-
console.log(` AUN: ✓ Configured (${config.channels.aun.agentName}@${config.channels.aun.domain})`);
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
console.log(' AUN: - Not configured');
|
|
390
|
-
}
|
|
391
386
|
if (config.channels?.wechat?.token) {
|
|
392
387
|
const tokenPreview = config.channels.wechat.token.slice(0, 20);
|
|
393
388
|
console.log(` WeChat: ✓ Configured (Token: ${tokenPreview}...)`);
|
|
@@ -395,6 +390,18 @@ async function cmdStatus() {
|
|
|
395
390
|
else {
|
|
396
391
|
console.log(' WeChat: - Not configured');
|
|
397
392
|
}
|
|
393
|
+
// Check AUN with placeholder detection
|
|
394
|
+
const aunDomain = config.channels?.aun?.domain;
|
|
395
|
+
const aunAgent = config.channels?.aun?.agentName;
|
|
396
|
+
const isAunPlaceholder = !aunDomain || !aunAgent ||
|
|
397
|
+
aunDomain.includes('your-') || aunDomain.includes('placeholder') ||
|
|
398
|
+
aunAgent.includes('your-') || aunAgent.includes('placeholder');
|
|
399
|
+
if (aunDomain && aunAgent && !isAunPlaceholder) {
|
|
400
|
+
console.log(` AUN: ✓ Configured (${aunAgent}@${aunDomain})`);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
console.log(' AUN: - Not configured');
|
|
404
|
+
}
|
|
398
405
|
if (config.agents?.anthropic?.model) {
|
|
399
406
|
console.log(` Model: ${config.agents.anthropic.model}`);
|
|
400
407
|
}
|
|
@@ -804,6 +811,10 @@ Environment:
|
|
|
804
811
|
}
|
|
805
812
|
}
|
|
806
813
|
// 直接运行时自动执行(node dist/cli.js ...)
|
|
807
|
-
|
|
814
|
+
// 用 realpath 解析 symlink,否则 npm link 的 bin 路径与实际文件路径不匹配
|
|
815
|
+
const __selfUrl = import.meta.url;
|
|
816
|
+
const __argv1 = process.argv[1];
|
|
817
|
+
if (__argv1 && (__selfUrl === `file://${__argv1}` ||
|
|
818
|
+
__selfUrl === `file://${fs.realpathSync(__argv1)}`)) {
|
|
808
819
|
main(process.argv.slice(2));
|
|
809
820
|
}
|
package/dist/index.js
CHANGED
|
@@ -269,13 +269,21 @@ async function main() {
|
|
|
269
269
|
// 连接渠道
|
|
270
270
|
const channels = [];
|
|
271
271
|
const channelInstances = [
|
|
272
|
-
...(feishu ? [{ name: 'Feishu', instance: feishu }] : []),
|
|
272
|
+
...(feishu ? [{ name: 'Feishu', instance: feishu, timeout: 5000 }] : []),
|
|
273
273
|
...(aun ? [{ name: 'AUN', instance: aun }] : []),
|
|
274
274
|
...(wechat ? [{ name: 'WeChat', instance: wechat }] : []),
|
|
275
275
|
];
|
|
276
|
-
for (const { name, instance } of channelInstances) {
|
|
276
|
+
for (const { name, instance, timeout } of channelInstances) {
|
|
277
277
|
try {
|
|
278
|
-
|
|
278
|
+
if (timeout) {
|
|
279
|
+
await Promise.race([
|
|
280
|
+
instance.connect(),
|
|
281
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout')), timeout))
|
|
282
|
+
]);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
await instance.connect();
|
|
286
|
+
}
|
|
279
287
|
logger.info(`✓ ${name} connected`);
|
|
280
288
|
channels.push(name);
|
|
281
289
|
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evolclaw",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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",
|
|
7
7
|
"bin": {
|
|
8
|
-
"evolclaw": "./
|
|
8
|
+
"evolclaw": "./dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/",
|
|
12
12
|
"!dist/experimental/",
|
|
13
|
-
"bin/",
|
|
14
13
|
"data/evolclaw.sample.json"
|
|
15
14
|
],
|
|
16
15
|
"scripts": {
|
|
17
16
|
"dev": "tsx watch src/index.ts",
|
|
18
|
-
"build": "tsc",
|
|
17
|
+
"build": "tsc && node -e \"const f='dist/cli.js',c=require('fs').readFileSync(f,'utf8');if(!c.startsWith('#!'))require('fs').writeFileSync(f,'#!/usr/bin/env node\\n'+c)\" && chmod +x dist/cli.js",
|
|
19
18
|
"start": "node dist/index.js",
|
|
20
19
|
"test": "vitest run",
|
|
21
20
|
"test:watch": "vitest",
|
|
@@ -23,9 +22,8 @@
|
|
|
23
22
|
"prepublishOnly": "npm run build && npm test"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.
|
|
25
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.75",
|
|
27
26
|
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
28
|
-
"dotenv": "^17.3.1",
|
|
29
27
|
"image-type": "^6.0.0",
|
|
30
28
|
"qrcode-terminal": "^0.12.0"
|
|
31
29
|
},
|
package/bin/evolclaw
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { dirname, join } from 'path';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
|
|
9
|
-
const { main } = await import(join(__dirname, '..', 'dist', 'cli.js'));
|
|
10
|
-
main(process.argv.slice(2));
|