@insta-dev01/intclaw 1.0.11 → 1.1.1
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 +10 -39
- 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/LICENSE
CHANGED
package/README.en.md
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img alt="IntClaw" src="docs/images/intclaw.svg" width="72" height="72" />
|
|
3
|
+
<h1>Official IntClaw OpenClaw Connector</h1>
|
|
4
|
+
<p>Connect IntClaw bots to OpenClaw Gateway with AI Card streaming and session management</p>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<a href="README.md">简体中文</a> •
|
|
8
|
+
<a href="CHANGELOG.md">Changelog</a>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Prerequisites](#prerequisites)
|
|
17
|
+
- [Quick Start](#quick-start)
|
|
18
|
+
- [Features](#features)
|
|
19
|
+
- [Configuration](#configuration)
|
|
20
|
+
- [Troubleshooting](#troubleshooting)
|
|
21
|
+
- [Advanced Topics](#advanced-topics)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
Before you begin, ensure you have:
|
|
29
|
+
|
|
30
|
+
> This connector is used as an OpenClaw Gateway plugin, and you usually don't need to install or manage Node.js runtime by yourself.
|
|
31
|
+
|
|
32
|
+
### 1. OpenClaw Gateway
|
|
33
|
+
|
|
34
|
+
- **Official Website**: https://openclaw.ai/
|
|
35
|
+
- **Installation**: Follow the official guide to install OpenClaw
|
|
36
|
+
- **Verify installation**:
|
|
37
|
+
```bash
|
|
38
|
+
openclaw gateway status
|
|
39
|
+
```
|
|
40
|
+
Expected output: `✓ Gateway is running on http://127.0.0.1:18789`
|
|
41
|
+
|
|
42
|
+
### 2. IntClaw Enterprise Account
|
|
43
|
+
|
|
44
|
+
- You need a IntClaw enterprise account to create internal applications
|
|
45
|
+
- Official Website: https://www.intclaw.com/
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
> 💡 **Goal**: Get your IntClaw bot working in ~5 minutes
|
|
52
|
+
|
|
53
|
+
### Operating System Support
|
|
54
|
+
|
|
55
|
+
- macOS / Linux: Use the default shell (zsh, bash, etc.).
|
|
56
|
+
- Windows:
|
|
57
|
+
- Recommended: **PowerShell** or **Windows Terminal**.
|
|
58
|
+
- OpenClaw config file path (default): `C:\Users\<YourUserName>\.openclaw\openclaw.json`.
|
|
59
|
+
|
|
60
|
+
Whenever you see `~/.openclaw/openclaw.json` below, it is equivalent to the above path on Windows.
|
|
61
|
+
|
|
62
|
+
### Step 1: Install the Plugin
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Recommended: Install from npm
|
|
66
|
+
openclaw plugins install @intclaw-real-ai/intclaw-connector
|
|
67
|
+
|
|
68
|
+
# Alternative: Install from Git
|
|
69
|
+
openclaw plugins install https://github.com/IntClaw-Real-AI/intclaw-openclaw-connector.git
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Verify installation**:
|
|
73
|
+
```bash
|
|
74
|
+
openclaw plugins list
|
|
75
|
+
```
|
|
76
|
+
You should see `✓ IntClaw Channel (v0.8.0) - loaded`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Step 2: Create a IntClaw Bot
|
|
81
|
+
|
|
82
|
+
#### 2.1 Create Application
|
|
83
|
+
|
|
84
|
+
1. Go to [IntClaw Open Platform](https://open-dev.intclaw.com/)
|
|
85
|
+
2. Click **"Application Development"**
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
89
|
+
#### 2.2 Add Bot Capability
|
|
90
|
+
|
|
91
|
+
1. On the application details page, use the “one-click OpenClaw bot app” flow
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
#### 2.3 Get Credentials
|
|
96
|
+
|
|
97
|
+
1. Finish creation and open **"Credentials & Basic Info"**
|
|
98
|
+
2. Copy your **AppKey** (Client ID)
|
|
99
|
+
3. Copy your **AppSecret** (Client Secret)
|
|
100
|
+
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+

|
|
104
|
+
|
|
105
|
+
> ⚠️ **Important**: Client ID and Client Secret are your bot’s unique credentials. Store them safely.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### Step 3: Configure OpenClaw
|
|
110
|
+
|
|
111
|
+
You have three options to configure the connector:
|
|
112
|
+
|
|
113
|
+
#### Option A: Configuration Wizard (Recommended for Beginners)
|
|
114
|
+
|
|
115
|
+
> You can directly copy and paste the following command into your terminal to run the configuration wizard.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
openclaw channels add
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Select **"IntClaw (IntClaw)"** and follow the prompts to enter:
|
|
122
|
+
- `clientId` (AppKey)
|
|
123
|
+
- `clientSecret` (AppSecret)
|
|
124
|
+
|
|
125
|
+
#### Option B: Edit Configuration File
|
|
126
|
+
|
|
127
|
+
Edit the configuration file:
|
|
128
|
+
|
|
129
|
+
- macOS / Linux: `~/.openclaw/openclaw.json`
|
|
130
|
+
- Windows: `C:\Users\<YourUserName>\.openclaw\openclaw.json`
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"channels": {
|
|
135
|
+
"intclaw-connector": {
|
|
136
|
+
"enabled": true,
|
|
137
|
+
"clientId": "dingxxxxxxxxx",
|
|
138
|
+
"clientSecret": "your_app_secret"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> 💡 **Tip**: If the file already has content, add the `intclaw-connector` section under the `channels` node.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### Step 4: Restart and Test
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Restart OpenClaw Gateway
|
|
152
|
+
openclaw gateway restart
|
|
153
|
+
|
|
154
|
+
# Watch logs in real-time
|
|
155
|
+
openclaw logs --follow
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Test your bot**:
|
|
159
|
+
1. Open IntClaw app
|
|
160
|
+
2. Find your bot in the contact list
|
|
161
|
+
3. Send a message: `Hello`
|
|
162
|
+
4. You should receive a response within 10 seconds
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Features
|
|
167
|
+
|
|
168
|
+
### ✅ Core Features
|
|
169
|
+
|
|
170
|
+
- **AI Card Streaming** - Typewriter-like replies with real-time streaming
|
|
171
|
+
- **Session Management** - Multi-turn conversations with context preservation
|
|
172
|
+
- **Session Isolation** - Separate sessions for DMs, groups, and different groups
|
|
173
|
+
- **Auto Session Reset** - Automatic new session after 30 minutes of inactivity
|
|
174
|
+
- **Manual Session Reset** - Send `/new` or `新会话` to clear conversation history
|
|
175
|
+
- **Image Auto-Upload** - Local image paths automatically uploaded to IntClaw
|
|
176
|
+
- **Proactive Messaging** - Send messages to users or groups programmatically
|
|
177
|
+
- **Rich Media Reception** - Receive and process JPEG/PNG images, pass to vision models
|
|
178
|
+
- **File Attachment Extraction** - Parse .docx, .pdf, text files, and binary files
|
|
179
|
+
- **Audio Message Support** - Send audio messages in multiple formats (mp3, wav, amr, ogg)
|
|
180
|
+
- **IntClaw Docs API** - Create, append, search, and list IntClaw documents
|
|
181
|
+
- **Multi-Agent Routing** - Connect multiple bots to different agents for specialized services
|
|
182
|
+
- **Markdown Table Conversion** - Auto-convert Markdown tables to IntClaw-compatible format
|
|
183
|
+
- **Async Mode** - Immediate acknowledgment with background processing (optional)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Configuration
|
|
188
|
+
|
|
189
|
+
### Basic Configuration
|
|
190
|
+
|
|
191
|
+
| Option | Environment Variable | Description |
|
|
192
|
+
|--------|---------------------|-------------|
|
|
193
|
+
| `clientId` | — | IntClaw AppKey |
|
|
194
|
+
| `clientSecret` | — | IntClaw AppSecret |
|
|
195
|
+
|
|
196
|
+
### Session Management
|
|
197
|
+
|
|
198
|
+
| Option | Default | Description |
|
|
199
|
+
|--------|---------|-------------|
|
|
200
|
+
| `separateSessionByConversation` | `true` | Separate sessions for DMs/groups |
|
|
201
|
+
| `groupSessionScope` | `group` | Group session scope: `group` (shared) or `group_sender` (per-user) |
|
|
202
|
+
| `sharedMemoryAcrossConversations` | `false` | Share memory across different conversations |
|
|
203
|
+
|
|
204
|
+
### Session routing policies (`pmpolicy` / `groupPolicy`)
|
|
205
|
+
|
|
206
|
+
Both session routing/message policy options (including `pmpolicy` and `groupPolicy`) are supported now, so you **do not need to remove** them from existing configurations.
|
|
207
|
+
|
|
208
|
+
> Note: field names may vary across versions/upstream; on the connector side, related policies are supported and applied (for example, `dmPolicy`/`groupPolicy` default to `open`).
|
|
209
|
+
|
|
210
|
+
### Async Mode
|
|
211
|
+
|
|
212
|
+
| Option | Default | Description |
|
|
213
|
+
|--------|---------|-------------|
|
|
214
|
+
| `asyncMode` | `false` | Enable async mode for long-running tasks |
|
|
215
|
+
| `ackText` | `🫡 任务已接收,处理中...` | Acknowledgment message text |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Troubleshooting
|
|
220
|
+
|
|
221
|
+
### Bot Not Responding
|
|
222
|
+
|
|
223
|
+
**Symptoms**: Bot doesn't reply to messages
|
|
224
|
+
|
|
225
|
+
**Solutions**:
|
|
226
|
+
1. Check plugin status: `openclaw plugins list`
|
|
227
|
+
2. Check gateway status: `openclaw gateway status`
|
|
228
|
+
3. Check logs: `openclaw logs --follow`
|
|
229
|
+
4. Verify the app is published/enabled in IntClaw Open Platform
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### HTTP 401 Error
|
|
234
|
+
|
|
235
|
+
**Symptoms**: Error message shows "401 Unauthorized"
|
|
236
|
+
|
|
237
|
+
**Solution**: Upgrade to the latest version.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### Stream Connection 400 Error
|
|
242
|
+
|
|
243
|
+
**Symptoms**: Logs show "Request failed with status code 400"
|
|
244
|
+
|
|
245
|
+
**Common Causes**:
|
|
246
|
+
|
|
247
|
+
| Cause | Solution |
|
|
248
|
+
|-------|----------|
|
|
249
|
+
| App not published | IntClaw Open Platform → Version Management → Publish |
|
|
250
|
+
| Invalid credentials | Check `clientId`/`clientSecret` for typos or extra spaces |
|
|
251
|
+
| Not Stream mode | Verify bot is configured for Stream mode (not Webhook) |
|
|
252
|
+
| IP whitelist | Check if the app has IP whitelist restrictions |
|
|
253
|
+
|
|
254
|
+
**Verification Steps**:
|
|
255
|
+
1. Check app status in [IntClaw Open Platform](https://open-dev.intclaw.com/)
|
|
256
|
+
2. After any configuration change, click **Save** → **Publish**
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Advanced Topics
|
|
261
|
+
|
|
262
|
+
### Multi-Agent Configuration
|
|
263
|
+
|
|
264
|
+
Configure multiple bots connected to different agents:
|
|
265
|
+
|
|
266
|
+
```json5
|
|
267
|
+
{
|
|
268
|
+
"agents": {
|
|
269
|
+
"list": [
|
|
270
|
+
{
|
|
271
|
+
"id": "ding-bot1",
|
|
272
|
+
"name": "Customer Service Bot",
|
|
273
|
+
"model": "your-model-config",
|
|
274
|
+
"workspace": "~/.openclaw/workspace-bot1",
|
|
275
|
+
"identity": {
|
|
276
|
+
"name": "Service Assistant",
|
|
277
|
+
"theme": "customer service",
|
|
278
|
+
"emoji": "🤝"
|
|
279
|
+
}
|
|
280
|
+
// Other agent configurations...
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"id": "ding-bot2",
|
|
284
|
+
"name": "Technical Support Bot",
|
|
285
|
+
"model": "your-model-config",
|
|
286
|
+
"workspace": "~/.openclaw/workspace-bot2",
|
|
287
|
+
"identity": {
|
|
288
|
+
"name": "Tech Expert",
|
|
289
|
+
"theme": "technical support",
|
|
290
|
+
"emoji": "🔧"
|
|
291
|
+
}
|
|
292
|
+
// Other agent configurations...
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
"channels": {
|
|
297
|
+
"intclaw-connector": {
|
|
298
|
+
"enabled": true,
|
|
299
|
+
"accounts": {
|
|
300
|
+
"bot1": {
|
|
301
|
+
"enabled": true,
|
|
302
|
+
"clientId": "ding_bot1_app_key",
|
|
303
|
+
"clientSecret": "bot1_secret"
|
|
304
|
+
},
|
|
305
|
+
"bot2": {
|
|
306
|
+
"enabled": true,
|
|
307
|
+
"clientId": "ding_bot2_app_key",
|
|
308
|
+
"clientSecret": "bot2_secret"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"bindings": [
|
|
314
|
+
{
|
|
315
|
+
"agentId": "ding-bot1",
|
|
316
|
+
"match": {
|
|
317
|
+
"channel": "intclaw-connector",
|
|
318
|
+
"accountId": "bot1"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"agentId": "ding-bot2",
|
|
323
|
+
"match": {
|
|
324
|
+
"channel": "intclaw-connector",
|
|
325
|
+
"accountId": "bot2"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
For more details, see [OpenClaw Multi-Agent Configuration Guide](https://gist.github.com/smallnest/c5c13482740fd179e40070e620f66a52).
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### Session Commands
|
|
337
|
+
|
|
338
|
+
Users can send the following commands to start a fresh session:
|
|
339
|
+
|
|
340
|
+
- `/new`, `/reset`, `/clear`
|
|
341
|
+
- `新会话`, `重新开始`, `清空对话`
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
### IntClaw Docs via MCP (`docs.*`)
|
|
346
|
+
|
|
347
|
+
IntClaw Docs capabilities (`docs.*`, including `docs.create` / `docs.append` / `docs.search` / `docs.list` / `docs.read`) require MCP (Model Context Protocol) to provide the underlying tools. To enable `docs.*`, install and enable the corresponding MCP Server/Tool in the OpenClaw Gateway/Agent.
|
|
348
|
+
|
|
349
|
+
- **Where to get MCP Server/Tool**: via the [IntClaw MCP Marketplace](https://mcp.intclaw.com/) (or your team’s internal MCP marketplace). You can also use a third-party marketplace to source an equivalent “IntClaw Docs Read / IntClaw Docs Reader” capability and connect it to OpenClaw.
|
|
350
|
+
- **Where to configure**: usually at the **Gateway or Agent tool configuration** level (not in this connector).
|
|
351
|
+
- **How it takes effect**: restart the Gateway and ensure the tool is exposed to the target agent.
|
|
352
|
+
|
|
353
|
+
References (OpenClaw configuration docs):
|
|
354
|
+
- `https://docs.openclaw.ai/configuration`
|
|
355
|
+
- `https://docs.openclaw.ai/gateway/configuration-reference`
|
|
356
|
+
|
|
357
|
+
Create and manage IntClaw documents from your agent:
|
|
358
|
+
|
|
359
|
+
```javascript
|
|
360
|
+
// Create document
|
|
361
|
+
intclaw-connector.docs.create({
|
|
362
|
+
spaceId: "your-space-id",
|
|
363
|
+
title: "Test Document",
|
|
364
|
+
content: "# Test Content"
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
// Append content
|
|
368
|
+
intclaw-connector.docs.append({
|
|
369
|
+
docId: "your-doc-id",
|
|
370
|
+
markdownContent: "\n## Appended Content"
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
// Search documents
|
|
374
|
+
intclaw-connector.docs.search({
|
|
375
|
+
keyword: "search keyword"
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
// List documents
|
|
379
|
+
intclaw-connector.docs.list({
|
|
380
|
+
spaceId: "your-space-id"
|
|
381
|
+
})
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Project Structure
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
intclaw-openclaw-connector/
|
|
390
|
+
├── src/
|
|
391
|
+
│ ├── core/ # Core connector logic
|
|
392
|
+
│ ├── services/ # IntClaw API services
|
|
393
|
+
│ ├── utils/ # Utility functions
|
|
394
|
+
│ └── types/ # TypeScript type definitions
|
|
395
|
+
├── docs/
|
|
396
|
+
│ └── images/ # Documentation images
|
|
397
|
+
├── openclaw.plugin.json # Plugin manifest
|
|
398
|
+
├── package.json # npm dependencies
|
|
399
|
+
└── LICENSE
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Dependencies
|
|
405
|
+
|
|
406
|
+
| Package | Purpose |
|
|
407
|
+
|---------|---------|
|
|
408
|
+
| `dingtalk-stream` | IntClaw Stream protocol client |
|
|
409
|
+
| `axios` | HTTP client |
|
|
410
|
+
| `mammoth` | Word document (.docx) parsing |
|
|
411
|
+
| `pdf-parse` | PDF document parsing |
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## License
|
|
416
|
+
|
|
417
|
+
[MIT](LICENSE)
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Support
|
|
422
|
+
|
|
423
|
+
- **Issues**: [GitHub Issues](https://github.com/IntClaw-Real-AI/intclaw-openclaw-connector/issues)
|
|
424
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|