@insta-dev01/intclaw 1.0.10 → 1.1.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.
- package/LICENSE +1 -1
- package/README.en.md +424 -0
- package/README.md +365 -164
- package/index.ts +28 -0
- package/openclaw.plugin.json +12 -41
- package/package.json +69 -40
- package/src/channel.ts +557 -0
- package/src/config/accounts.ts +230 -0
- package/src/config/schema.ts +144 -0
- package/src/core/connection.ts +733 -0
- package/src/core/message-handler.ts +1268 -0
- package/src/core/provider.ts +106 -0
- package/src/core/state.ts +54 -0
- package/src/directory.ts +95 -0
- package/src/gateway-methods.ts +237 -0
- package/src/onboarding.ts +387 -0
- package/src/policy.ts +19 -0
- package/src/probe.ts +213 -0
- package/src/reply-dispatcher.ts +674 -0
- package/src/runtime.ts +7 -0
- package/src/sdk/helpers.ts +317 -0
- package/src/sdk/types.ts +515 -0
- package/src/secret-input.ts +19 -0
- package/src/services/media/audio.ts +54 -0
- package/src/services/media/chunk-upload.ts +293 -0
- package/src/services/media/common.ts +154 -0
- package/src/services/media/file.ts +70 -0
- package/src/services/media/image.ts +67 -0
- package/src/services/media/index.ts +10 -0
- package/src/services/media/video.ts +162 -0
- package/src/services/media.ts +1134 -0
- package/src/services/messaging/index.ts +16 -0
- package/src/services/messaging/send.ts +137 -0
- package/src/services/messaging.ts +800 -0
- package/src/targets.ts +45 -0
- package/src/types/index.ts +52 -0
- package/src/utils/agent.ts +63 -0
- package/src/utils/async.ts +51 -0
- package/src/utils/constants.ts +9 -0
- package/src/utils/http-client.ts +84 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +78 -0
- package/src/utils/session.ts +118 -0
- package/src/utils/token.ts +94 -0
- package/src/utils/utils-legacy.ts +506 -0
- package/.env.example +0 -11
- package/skills/intclaw_matrix/SKILL.md +0 -20
- package/src/channel/intclaw_channel.js +0 -155
- package/src/index.js +0 -23
package/README.md
CHANGED
|
@@ -1,234 +1,435 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img alt="IntClaw" src="docs/images/intclaw.svg" width="72" height="72" />
|
|
3
|
+
<h1>IntClaw OpenClaw 官方连接器</h1>
|
|
4
|
+
<p>将IntClaw机器人连接到 OpenClaw Gateway,支持 AI Card 流式响应和会话管理</p>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<a href="README.en.md">English</a> •
|
|
8
|
+
<a href="CHANGELOG.md">更新日志</a>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
---
|
|
4
13
|
|
|
5
|
-
|
|
6
|
-
- IntClaw Message Channel (引态消息通道)
|
|
7
|
-
- IntClaw Agent Collaboration Engine (引态智能体协作引擎)
|
|
8
|
-
- IntClaw Claw Hub Services (引态 Claw Hub 服务)
|
|
14
|
+
## 📋 目录
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
- [前置要求](#前置要求)
|
|
17
|
+
- [快速开始](#快速开始)
|
|
18
|
+
- [功能特性](#功能特性)
|
|
19
|
+
- [配置说明](#配置说明)
|
|
20
|
+
- [常见问题](#常见问题)
|
|
21
|
+
- [进阶主题](#进阶主题)
|
|
22
|
+
- [许可证](#许可证)
|
|
11
23
|
|
|
12
|
-
|
|
13
|
-
- Connects to IntClaw servers using WebSocket protocol
|
|
14
|
-
- Authenticates via API Key/Token
|
|
15
|
-
- Exchanges JSON-formatted messages
|
|
16
|
-
- Supports both direct messages and group messages
|
|
17
|
-
- Handles automatic reconnection on connection loss
|
|
24
|
+
---
|
|
18
25
|
|
|
19
|
-
##
|
|
26
|
+
## 前置要求
|
|
27
|
+
|
|
28
|
+
开始之前,请确保你已经:
|
|
29
|
+
|
|
30
|
+
> 本插件作为 OpenClaw Gateway 插件使用,一般无需你单独安装或管理 Node.js 运行时。
|
|
31
|
+
|
|
32
|
+
### 1. OpenClaw Gateway
|
|
33
|
+
|
|
34
|
+
- **官方网站**:https://openclaw.ai/
|
|
35
|
+
- **安装说明**:按照官方指南安装 OpenClaw
|
|
36
|
+
- **验证安装**:
|
|
37
|
+
```bash
|
|
38
|
+
openclaw gateway status
|
|
39
|
+
```
|
|
40
|
+
预期输出:`✓ Gateway is running on http://127.0.0.1:18789`
|
|
41
|
+
|
|
42
|
+
### 2. IntClaw企业账号
|
|
43
|
+
|
|
44
|
+
- 你需要一个IntClaw企业账号来创建企业内部应用
|
|
45
|
+
- 官方网站:https://www.intclaw.com/
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 快速开始
|
|
50
|
+
|
|
51
|
+
> 💡 **目标**:5 分钟内让你的IntClaw机器人运行起来
|
|
52
|
+
|
|
53
|
+
### 操作系统支持
|
|
54
|
+
|
|
55
|
+
- macOS / Linux:使用默认的 Shell 终端(zsh、bash 等)。
|
|
56
|
+
- Windows:
|
|
57
|
+
- 推荐使用 **PowerShell** 或 **Windows Terminal**。
|
|
58
|
+
- OpenClaw 配置文件路径默认为:`C:\Users\<你的用户名>\.openclaw\openclaw.json`。
|
|
59
|
+
|
|
60
|
+
下文中出现的 `~/.openclaw/openclaw.json`,在 Windows 上等价于以上路径。
|
|
61
|
+
|
|
62
|
+
### 步骤 1:安装插件
|
|
20
63
|
|
|
21
64
|
```bash
|
|
22
|
-
#
|
|
23
|
-
openclaw plugins install @
|
|
65
|
+
# 推荐:从 npm 安装
|
|
66
|
+
openclaw plugins install @intclaw-real-ai/intclaw-connector
|
|
24
67
|
|
|
25
|
-
#
|
|
26
|
-
openclaw plugins install /
|
|
68
|
+
# 或者:从 Git 安装
|
|
69
|
+
openclaw plugins install https://github.com/IntClaw-Real-AI/intclaw-openclaw-connector.git
|
|
70
|
+
```
|
|
27
71
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
72
|
+
**验证安装**:
|
|
73
|
+
```bash
|
|
74
|
+
openclaw plugins list
|
|
31
75
|
```
|
|
76
|
+
你应该看到 `✓ IntClaw Channel (v0.8.0) - loaded`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### 步骤 2:创建IntClaw机器人
|
|
81
|
+
|
|
82
|
+
#### 3.1 创建应用
|
|
83
|
+
|
|
84
|
+
1. 访问 [IntClaw开放平台](https://open-dev.intclaw.com/)
|
|
85
|
+
2. 点击 **"应用开发"**
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
89
|
+
#### 3.2 添加机器人能力
|
|
90
|
+
|
|
91
|
+
1. 在应用详情页,点击 一键创建OpenClaw机器人应用
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
#### 3.3 获取凭证
|
|
96
|
+
|
|
97
|
+
1. 完成创建并获取 **"凭证与基础信息"**
|
|
98
|
+
2. 复制你的 **AppKey**(Client ID)
|
|
99
|
+
3. 复制你的 **AppSecret**(Client Secret)
|
|
100
|
+
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+

|
|
32
104
|
|
|
33
|
-
|
|
105
|
+
> ⚠️ **重要**:Client ID和 Client Secret是机器人的唯一凭证。请合理保存。
|
|
34
106
|
|
|
35
|
-
|
|
107
|
+
---
|
|
36
108
|
|
|
37
|
-
|
|
109
|
+
### 步骤 3:配置 OpenClaw
|
|
110
|
+
|
|
111
|
+
你有三种方式配置连接器:
|
|
112
|
+
|
|
113
|
+
#### 方式 A:配置向导(推荐新手使用)
|
|
114
|
+
|
|
115
|
+
> 你可以直接复制粘贴下面的命令,在终端中运行配置向导。
|
|
38
116
|
|
|
39
117
|
```bash
|
|
40
118
|
openclaw channels add
|
|
41
119
|
```
|
|
42
120
|
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
121
|
+
选择 **"IntClaw (IntClaw)"**,然后按提示输入:
|
|
122
|
+
- `clientId`(AppKey)
|
|
123
|
+
- `clientSecret`(AppSecret)
|
|
46
124
|
|
|
47
|
-
|
|
125
|
+
#### 方式 B:编辑配置文件
|
|
48
126
|
|
|
49
|
-
|
|
127
|
+
编辑配置文件:
|
|
50
128
|
|
|
51
|
-
|
|
129
|
+
- macOS / Linux:`~/.openclaw/openclaw.json`
|
|
130
|
+
- Windows:`C:\Users\<你的用户名>\.openclaw\openclaw.json`
|
|
52
131
|
|
|
53
|
-
```
|
|
132
|
+
```json
|
|
54
133
|
{
|
|
55
|
-
channels: {
|
|
56
|
-
intclaw: {
|
|
57
|
-
enabled: true,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
},
|
|
134
|
+
"channels": {
|
|
135
|
+
"intclaw-connector": {
|
|
136
|
+
"enabled": true,
|
|
137
|
+
"clientId": "dingxxxxxxxxx",
|
|
138
|
+
"clientSecret": "your_app_secret"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
64
141
|
}
|
|
65
142
|
```
|
|
66
143
|
|
|
67
|
-
|
|
144
|
+
> 💡 **提示**:如果文件已有内容,在 `channels` 节点下添加 `intclaw-connector` 部分即可。
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 步骤 4:重启并测试
|
|
68
149
|
|
|
69
150
|
```bash
|
|
151
|
+
# 重启 OpenClaw Gateway
|
|
70
152
|
openclaw gateway restart
|
|
153
|
+
|
|
154
|
+
# 实时查看日志
|
|
155
|
+
openclaw logs --follow
|
|
71
156
|
```
|
|
72
157
|
|
|
73
|
-
|
|
158
|
+
**测试你的机器人**:
|
|
159
|
+
1. 打开IntClaw App
|
|
160
|
+
2. 在联系人列表中找到你的机器人
|
|
161
|
+
3. 发送消息:`你好`
|
|
162
|
+
4. 你应该在 10 秒内收到回复
|
|
74
163
|
|
|
75
|
-
|
|
164
|
+
---
|
|
76
165
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
166
|
+
## 功能特性
|
|
167
|
+
|
|
168
|
+
### ✅ 核心功能
|
|
169
|
+
|
|
170
|
+
- **AI Card 流式响应** - 打字机效果,实时流式显示回复
|
|
171
|
+
- **会话管理** - 多轮对话,保持上下文
|
|
172
|
+
- **会话隔离** - 私聊、群聊、不同群之间会话独立
|
|
173
|
+
- **自动会话重置** - 30 分钟无活动后自动开启新会话
|
|
174
|
+
- **手动会话重置** - 发送 `/new` 或 `新会话` 清空对话历史
|
|
175
|
+
- **图片自动上传** - 本地图片路径自动上传到IntClaw
|
|
176
|
+
- **主动发送消息** - 程序化地向用户或群发送消息
|
|
177
|
+
- **富媒体接收** - 接收并处理 JPEG/PNG 图片,传递给视觉模型
|
|
178
|
+
- **文件附件提取** - 解析 .docx、.pdf、文本文件和二进制文件
|
|
179
|
+
- **音频消息支持** - 发送多种格式的音频消息(mp3、wav、amr、ogg)
|
|
180
|
+
- **IntClaw文档 API** - 创建、追加、搜索和列举IntClaw文档
|
|
181
|
+
- **多 Agent 路由** - 将多个机器人连接到不同的 Agent,实现专业化服务
|
|
182
|
+
- **Markdown 表格转换** - 自动将 Markdown 表格转换为IntClaw兼容格式
|
|
183
|
+
- **异步模式** - 立即确认消息,后台处理(可选)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 配置说明
|
|
188
|
+
|
|
189
|
+
### 基础配置
|
|
190
|
+
|
|
191
|
+
| 选项 | 环境变量 | 说明 |
|
|
192
|
+
|------|---------|------|
|
|
193
|
+
| `clientId` | — | IntClaw AppKey |
|
|
194
|
+
| `clientSecret` | — | IntClaw AppSecret |
|
|
195
|
+
|
|
196
|
+
### 会话管理
|
|
197
|
+
|
|
198
|
+
| 选项 | 默认值 | 说明 |
|
|
199
|
+
|------|--------|------|
|
|
200
|
+
| `separateSessionByConversation` | `true` | 私聊/群聊分别维护会话 |
|
|
201
|
+
| `groupSessionScope` | `group` | 群聊会话范围:`group`(共享)或 `group_sender`(每人独立) |
|
|
202
|
+
| `sharedMemoryAcrossConversations` | `false` | 是否在不同会话间共享记忆 |
|
|
203
|
+
|
|
204
|
+
### 会话路由策略(`pmpolicy` / `groupPolicy`)
|
|
205
|
+
|
|
206
|
+
当前版本已支持会话路由/消息策略相关配置(包含 `pmpolicy`、`groupPolicy`),**无需删除**。如你在历史配置中已经设置了这些字段,可以继续保留并按需调整。
|
|
207
|
+
|
|
208
|
+
> 说明:不同版本/上游可能对字段命名有差异;本连接器侧同时支持并会按策略生效(如 `dmPolicy`/`groupPolicy` 的默认值为 `open`)。
|
|
209
|
+
|
|
210
|
+
### 异步模式
|
|
211
|
+
|
|
212
|
+
| 选项 | 默认值 | 说明 |
|
|
213
|
+
|------|--------|------|
|
|
214
|
+
| `asyncMode` | `false` | 启用异步模式处理长时间任务 |
|
|
215
|
+
| `ackText` | `🫡 任务已接收,处理中...` | 确认消息文本 |
|
|
82
216
|
|
|
83
|
-
**Note**: Configuration file values take precedence over environment variables.
|
|
84
217
|
|
|
85
|
-
|
|
218
|
+
---
|
|
86
219
|
|
|
87
|
-
|
|
88
|
-
|--------|------|-------------|---------|
|
|
89
|
-
| `enabled` | boolean | Enable/disable the channel | `true` |
|
|
90
|
-
| `wsUrl` | string | WebSocket server URL | **Required** |
|
|
91
|
-
| `apiKey` | string | API key for authentication | **Required** |
|
|
92
|
-
| `reconnectInterval` | number | Reconnection interval (ms) | `5000` |
|
|
93
|
-
| `dmPolicy` | string | DM policy (`pairing`, `allowlist`, `open`, `disabled`) | `pairing` |
|
|
94
|
-
| `allowFrom` | array | DM allowlist (peer IDs) | - |
|
|
95
|
-
| `groupPolicy` | string | Group policy (`allowlist`, `open`, `disabled`) | `allowlist` |
|
|
96
|
-
| `groupAllowFrom` | array | Group allowlist (peer IDs) | - |
|
|
97
|
-
| `groups` | object | Per-group configuration | - |
|
|
220
|
+
## 常见问题
|
|
98
221
|
|
|
99
|
-
###
|
|
222
|
+
### 机器人不回复
|
|
223
|
+
|
|
224
|
+
**症状**:机器人不回复消息
|
|
225
|
+
|
|
226
|
+
**解决方案**:
|
|
227
|
+
1. 检查插件状态:`openclaw plugins list`
|
|
228
|
+
2. 检查网关状态:`openclaw gateway status`
|
|
229
|
+
3. 查看日志:`openclaw logs --follow`
|
|
230
|
+
4. 确认应用已在IntClaw开放平台发布
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### HTTP 401 错误
|
|
235
|
+
|
|
236
|
+
**症状**:错误信息显示 "401 Unauthorized"
|
|
237
|
+
|
|
238
|
+
**原因**:Gateway 认证失败
|
|
239
|
+
|
|
240
|
+
**解决方案**:
|
|
241
|
+
|
|
242
|
+
升级到最新版本
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### Stream 连接 400 错误
|
|
247
|
+
|
|
248
|
+
**症状**:日志显示 "Request failed with status code 400"
|
|
249
|
+
|
|
250
|
+
**常见原因**:
|
|
251
|
+
|
|
252
|
+
| 原因 | 解决方案 |
|
|
253
|
+
|------|----------|
|
|
254
|
+
| 应用未发布 | 前往IntClaw开放平台 → 版本管理 → 发布 |
|
|
255
|
+
| 凭证错误 | 检查 `clientId`/`clientSecret` 是否有拼写错误或多余空格 |
|
|
256
|
+
| 非 Stream 模式 | 确认机器人配置为 Stream 模式(不是 Webhook) |
|
|
257
|
+
| IP 白名单限制 | 检查应用是否设置了 IP 白名单 |
|
|
258
|
+
|
|
259
|
+
**验证步骤**:
|
|
260
|
+
|
|
261
|
+
1. **检查应用状态**:
|
|
262
|
+
- 登录 [IntClaw开放平台](https://open-dev.intclaw.com/)
|
|
263
|
+
- 确认应用已发布
|
|
264
|
+
- 确认机器人已启用且为 Stream 模式
|
|
265
|
+
|
|
266
|
+
2. **重新发布应用**:
|
|
267
|
+
- 修改任何配置后,必须点击 **保存** → **发布**
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## 进阶主题
|
|
272
|
+
|
|
273
|
+
### 多 Agent 配置
|
|
274
|
+
|
|
275
|
+
配置多个机器人连接到不同的 Agent:
|
|
100
276
|
|
|
101
277
|
```json5
|
|
102
278
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
enabled: true,
|
|
117
|
-
},
|
|
279
|
+
"agents": {
|
|
280
|
+
"list": [
|
|
281
|
+
{
|
|
282
|
+
"id": "ding-bot1",
|
|
283
|
+
"name": "IntClaw客服机器人",
|
|
284
|
+
"model": "your-model-config",
|
|
285
|
+
"workspace": "~/.openclaw/workspace-bot1",
|
|
286
|
+
"identity": {
|
|
287
|
+
"name": "客服小助手",
|
|
288
|
+
"theme": "专业客服",
|
|
289
|
+
"emoji": "🤝"
|
|
290
|
+
}
|
|
291
|
+
// 其他 agent 配置...
|
|
118
292
|
},
|
|
119
|
-
|
|
293
|
+
{
|
|
294
|
+
"id": "ding-bot2",
|
|
295
|
+
"name": "IntClaw技术支持机器人",
|
|
296
|
+
"model": "your-model-config",
|
|
297
|
+
"workspace": "~/.openclaw/workspace-bot2",
|
|
298
|
+
"identity": {
|
|
299
|
+
"name": "技术专家",
|
|
300
|
+
"theme": "技术支持",
|
|
301
|
+
"emoji": "🔧"
|
|
302
|
+
}
|
|
303
|
+
// 其他 agent 配置...
|
|
304
|
+
}
|
|
305
|
+
]
|
|
120
306
|
},
|
|
307
|
+
"channels": {
|
|
308
|
+
"intclaw-connector": {
|
|
309
|
+
"enabled": true,
|
|
310
|
+
"accounts": {
|
|
311
|
+
"bot1": {
|
|
312
|
+
"enabled": true,
|
|
313
|
+
"clientId": "ding_bot1_app_key",
|
|
314
|
+
"clientSecret": "bot1_secret"
|
|
315
|
+
},
|
|
316
|
+
"bot2": {
|
|
317
|
+
"enabled": true,
|
|
318
|
+
"clientId": "ding_bot2_app_key",
|
|
319
|
+
"clientSecret": "bot2_secret"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"bindings": [
|
|
325
|
+
{
|
|
326
|
+
"agentId": "ding-bot1",
|
|
327
|
+
"match": {
|
|
328
|
+
"channel": "intclaw-connector",
|
|
329
|
+
"accountId": "bot1"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"agentId": "ding-bot2",
|
|
334
|
+
"match": {
|
|
335
|
+
"channel": "intclaw-connector",
|
|
336
|
+
"accountId": "bot2"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
]
|
|
121
340
|
}
|
|
122
341
|
```
|
|
123
342
|
|
|
124
|
-
|
|
343
|
+
更多详情请参考 [OpenClaw 多 Agent 配置指南](https://gist.github.com/smallnest/c5c13482740fd179e40070e620f66a52)。
|
|
125
344
|
|
|
126
|
-
|
|
345
|
+
---
|
|
127
346
|
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
"type": "incoming_message",
|
|
131
|
-
"payload": {
|
|
132
|
-
"id": "msg_1234567890",
|
|
133
|
-
"accountId": "default",
|
|
134
|
-
"peerId": "user_abc",
|
|
135
|
-
"peerKind": "direct",
|
|
136
|
-
"peerName": "Alice",
|
|
137
|
-
"text": "Hello from IntClaw!",
|
|
138
|
-
"timestamp": 1704067200000,
|
|
139
|
-
"threadId": null,
|
|
140
|
-
"replyToId": null
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
```
|
|
347
|
+
### 会话命令
|
|
144
348
|
|
|
145
|
-
|
|
349
|
+
用户可以发送以下命令清理对话历史,重新开始会话:
|
|
146
350
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"type": "outgoing_message",
|
|
150
|
-
"payload": {
|
|
151
|
-
"id": "intclaw_1704067200000_abc123",
|
|
152
|
-
"accountId": "default",
|
|
153
|
-
"peerId": "user_abc",
|
|
154
|
-
"peerKind": "direct",
|
|
155
|
-
"text": "Hello from OpenClaw!",
|
|
156
|
-
"timestamp": 1704067200000,
|
|
157
|
-
"threadId": null,
|
|
158
|
-
"replyToId": null
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
```
|
|
351
|
+
- `/new`、`/reset`、`/clear`
|
|
352
|
+
- `新会话`、`重新开始`、`清空对话`
|
|
162
353
|
|
|
163
|
-
|
|
354
|
+
---
|
|
164
355
|
|
|
165
|
-
|
|
166
|
-
2. Client sends `auth_request`:
|
|
167
|
-
```json
|
|
168
|
-
{
|
|
169
|
-
"type": "auth_request",
|
|
170
|
-
"apiKey": "your-api-key",
|
|
171
|
-
"timestamp": 1704067200000
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
3. Server responds with `auth_response`:
|
|
175
|
-
```json
|
|
176
|
-
{
|
|
177
|
-
"type": "auth_response",
|
|
178
|
-
"success": true,
|
|
179
|
-
"timestamp": 1704067200000
|
|
180
|
-
}
|
|
181
|
-
```
|
|
356
|
+
### IntClaw文档(Docs)与 MCP(`docs.*`)
|
|
182
357
|
|
|
183
|
-
|
|
358
|
+
IntClaw文档能力(`docs.*`,包含 `docs.create` / `docs.append` / `docs.search` / `docs.list` / `docs.read`)依赖 MCP(Model Context Protocol)提供底层 tool。你需要先在 OpenClaw 的 Gateway/Agent 侧启用对应的 MCP Server/Tool,然后上述 `docs.*` 才能正常工作。
|
|
184
359
|
|
|
185
|
-
|
|
360
|
+
- **获取 MCP Server/Tool**:可通过 [IntClaw MCP 市场](https://mcp.intclaw.com/) 安装启用(或你们团队维护的 MCP 市场);也可以选择同类的“IntClaw Docs Read / IntClaw Docs Reader”能力并接入到 OpenClaw。
|
|
361
|
+
- **配置位置**:通常在 **Gateway 或 Agent 的工具配置**中完成(而不是在连接器里)。
|
|
362
|
+
- **生效方式**:配置完成后重启 Gateway,并确认该 tool 已对目标 Agent 暴露。
|
|
186
363
|
|
|
187
|
-
|
|
188
|
-
-
|
|
364
|
+
参考(OpenClaw 官方配置文档):
|
|
365
|
+
- `https://docs.openclaw.ai/configuration`
|
|
366
|
+
- `https://docs.openclaw.ai/gateway/configuration-reference`
|
|
189
367
|
|
|
190
|
-
|
|
368
|
+
从你的 Agent 中创建和管理IntClaw文档:
|
|
191
369
|
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
370
|
+
```javascript
|
|
371
|
+
// 创建文档
|
|
372
|
+
intclaw-connector.docs.create({
|
|
373
|
+
spaceId: "your-space-id",
|
|
374
|
+
title: "测试文档",
|
|
375
|
+
content: "# 测试内容"
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
// 追加内容
|
|
379
|
+
intclaw-connector.docs.append({
|
|
380
|
+
docId: "your-doc-id",
|
|
381
|
+
markdownContent: "\n## 追加的内容"
|
|
382
|
+
})
|
|
383
|
+
|
|
384
|
+
// 搜索文档
|
|
385
|
+
intclaw-connector.docs.search({
|
|
386
|
+
keyword: "搜索关键词"
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
// 列举文档
|
|
390
|
+
intclaw-connector.docs.list({
|
|
391
|
+
spaceId: "your-space-id"
|
|
392
|
+
})
|
|
201
393
|
```
|
|
202
394
|
|
|
203
|
-
|
|
395
|
+
---
|
|
204
396
|
|
|
205
|
-
|
|
206
|
-
# Install dependencies
|
|
207
|
-
pnpm install
|
|
397
|
+
## 项目结构
|
|
208
398
|
|
|
209
|
-
|
|
210
|
-
|
|
399
|
+
```
|
|
400
|
+
intclaw-openclaw-connector/
|
|
401
|
+
├── src/
|
|
402
|
+
│ ├── core/ # Core connector logic
|
|
403
|
+
│ ├── services/ # IntClaw API services
|
|
404
|
+
│ ├── utils/ # Utility functions
|
|
405
|
+
│ └── types/ # TypeScript type definitions
|
|
406
|
+
├── docs/
|
|
407
|
+
│ └── images/ # Documentation images
|
|
408
|
+
├── openclaw.plugin.json # Plugin manifest
|
|
409
|
+
├── package.json # npm dependencies
|
|
410
|
+
└── LICENSE
|
|
211
411
|
```
|
|
212
412
|
|
|
213
|
-
|
|
413
|
+
---
|
|
214
414
|
|
|
215
|
-
|
|
415
|
+
## 依赖
|
|
216
416
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
417
|
+
| 包 | 用途 |
|
|
418
|
+
|----|------|
|
|
419
|
+
| `dingtalk-stream` | IntClaw Stream 协议客户端 |
|
|
420
|
+
| `axios` | HTTP 客户端 |
|
|
421
|
+
| `mammoth` | Word 文档(.docx)解析 |
|
|
422
|
+
| `pdf-parse` | PDF 文档解析 |
|
|
221
423
|
|
|
222
|
-
|
|
424
|
+
---
|
|
223
425
|
|
|
224
|
-
|
|
225
|
-
2. Check API key hasn't expired
|
|
226
|
-
3. Ensure API key has required permissions
|
|
426
|
+
## 许可证
|
|
227
427
|
|
|
228
|
-
|
|
428
|
+
[MIT](LICENSE)
|
|
229
429
|
|
|
230
|
-
|
|
430
|
+
---
|
|
231
431
|
|
|
232
|
-
##
|
|
432
|
+
## 支持
|
|
233
433
|
|
|
234
|
-
- [
|
|
434
|
+
- **问题反馈**:[GitHub Issues](https://github.com/IntClaw-Real-AI/intclaw-openclaw-connector/issues)
|
|
435
|
+
- **更新日志**:[CHANGELOG.md](CHANGELOG.md)
|
package/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IntClaw Connector Plugin for OpenClaw
|
|
3
|
+
*
|
|
4
|
+
* IntClaw企业内部机器人插件,使用 Stream 模式连接,支持 AI Card 流式响应。
|
|
5
|
+
* 已迁移到 OpenClaw SDK,支持多账号、安全策略等完整功能。
|
|
6
|
+
*
|
|
7
|
+
* Last updated: 2026-03-18 17:00:00
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* IntClaw Connector Plugin for OpenClaw
|
|
12
|
+
*
|
|
13
|
+
* 注意:本插件使用专用的 HTTP 客户端(见 src/utils/http-client.ts)
|
|
14
|
+
* 不会影响 OpenClaw Gateway 和其他插件的网络请求
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
18
|
+
import { intclawPlugin } from "./src/channel.ts";
|
|
19
|
+
import { setIntclawRuntime } from "./src/runtime.ts";
|
|
20
|
+
import { registerGatewayMethods } from "./src/gateway-methods.ts";
|
|
21
|
+
|
|
22
|
+
export default function register(api: OpenClawPluginApi) {
|
|
23
|
+
setIntclawRuntime(api.runtime);
|
|
24
|
+
api.registerChannel({ plugin: intclawPlugin });
|
|
25
|
+
|
|
26
|
+
// 注册 Gateway Methods
|
|
27
|
+
registerGatewayMethods(api);
|
|
28
|
+
}
|