@coremail/lunkr-openclaw 1.0.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/README.md ADDED
@@ -0,0 +1,221 @@
1
+ # OpenClaw Lunkr Channel Plugin
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@coremail/lunkr.svg)](https://www.npmjs.com/package/@coremail/lunkr)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A channel plugin for [OpenClaw](https://github.com/openclaw/openclaw) that provides integration with [Lunkr](https://lunkr.cn), an enterprise collaboration platform from Coremail.
7
+
8
+ ## Overview
9
+
10
+ This plugin enables OpenClaw AI agents to interact with Lunkr through:
11
+
12
+ - **Direct Messages (DM)** - Private conversations between users
13
+ - **Group Discussions** - Team collaboration channels
14
+ - **Bot Discussions** - Dedicated groups where all messages trigger the AI agent
15
+
16
+ ## Requirements
17
+
18
+ - **Node.js**: v22 or higher
19
+ - **OpenClaw**: v2026.3 or higher
20
+ - **Lunkr Account**: A valid Lunkr/Coremail account with API access
21
+
22
+ ## Installation
23
+
24
+ ### Via npm (Recommended)
25
+
26
+ ```bash
27
+ npm install @coremail/lunkr
28
+ ```
29
+
30
+ ### Local Development
31
+
32
+ ```bash
33
+ cd extensions/lunkr
34
+ npm install
35
+ npm run build
36
+ ```
37
+
38
+ ## Quick Reference
39
+
40
+ | Command | Description |
41
+ |---------|-------------|
42
+ | `npm test` | Run tests |
43
+ | `npm run build` | Compile TypeScript |
44
+ | `npm run deploy:local` | Deploy to local OpenClaw |
45
+ | `npm run pack` | Create release package |
46
+
47
+ > See [DEVELOPMENT.md](./docs/DEVELOPMENT.md) for complete development guide.
48
+
49
+ ## Quick Start
50
+
51
+ ### 1. Login to Lunkr
52
+
53
+ First, authenticate with your Lunkr account:
54
+
55
+ ```bash
56
+ openclaw lunkr login --email your-email@example.com
57
+ ```
58
+
59
+ You will be prompted for your password. The session will be stored securely in `~/.lunkr-mcp/config.json`.
60
+
61
+ ### 2. Enable the Channel
62
+
63
+ Add Lunkr to your OpenClaw configuration:
64
+
65
+ ```yaml
66
+ channels:
67
+ lunkr:
68
+ enabled: true
69
+ botName: "AI Assistant"
70
+ commandPrefix: "/bot"
71
+ ```
72
+
73
+ ### 3. Restart the Gateway
74
+
75
+ ```bash
76
+ openclaw gateway restart
77
+ ```
78
+
79
+ ### 4. Start Chatting
80
+
81
+ - **In Bot Discussions**: All messages automatically trigger the AI
82
+ - **In normal groups/DMs**: Use `/bot <message>` to trigger the AI
83
+
84
+ ## Configuration
85
+
86
+ ### Basic Configuration
87
+
88
+ ```yaml
89
+ channels:
90
+ lunkr:
91
+ enabled: true
92
+ botName: "Bot"
93
+ commandPrefix: "/bot"
94
+ dmPolicy: "allow"
95
+ groupPolicy: "allow"
96
+ ```
97
+
98
+ ### Configuration Options
99
+
100
+ | Option | Type | Default | Description |
101
+ |--------|------|---------|-------------|
102
+ | `enabled` | boolean | `true` | Enable/disable the channel |
103
+ | `botName` | string | `"Bot"` | Display name for bot replies |
104
+ | `commandPrefix` | string | `"/bot"` | Prefix to trigger bot in normal chats |
105
+ | `dmPolicy` | string | `"allow"` | DM access policy: `allow`, `deny`, `whitelist` |
106
+ | `allowFrom` | string[] | `[]` | Whitelisted user IDs for DM (when `dmPolicy: whitelist`) |
107
+ | `groupPolicy` | string | `"allow"` | Group access policy: `allow`, `deny`, `whitelist` |
108
+ | `groups` | string[] | `[]` | Whitelisted group IDs (when `groupPolicy: whitelist`) |
109
+ | `botDiscussions` | object | `{}` | Bot discussion configurations |
110
+
111
+ ### Bot Discussions
112
+
113
+ Bot Discussions are dedicated groups where all messages trigger the AI agent without needing a prefix:
114
+
115
+ ```yaml
116
+ channels:
117
+ lunkr:
118
+ botDiscussions:
119
+ "discussion-id-123":
120
+ name: "AI Help Desk"
121
+ agentId: "support-agent"
122
+ creatorUid: "user-456"
123
+ createdAt: "2024-01-15T10:30:00Z"
124
+ ```
125
+
126
+ ### Multi-Agent Routing
127
+
128
+ You can route different Bot Discussions to different AI agents:
129
+
130
+ ```yaml
131
+ channels:
132
+ lunkr:
133
+ botDiscussions:
134
+ "sales-discussion":
135
+ name: "Sales Bot"
136
+ agentId: "sales-agent"
137
+ creatorUid: "admin"
138
+ createdAt: "2024-01-01T00:00:00Z"
139
+ "support-discussion":
140
+ name: "Support Bot"
141
+ agentId: "support-agent"
142
+ creatorUid: "admin"
143
+ createdAt: "2024-01-01T00:00:00Z"
144
+ ```
145
+
146
+ ## Security
147
+
148
+ ### DM Policies
149
+
150
+ - **`allow`** (default): Accept DMs from all users
151
+ - **`deny`**: Reject all DMs
152
+ - **`whitelist`**: Only accept DMs from users in `allowFrom`
153
+
154
+ ### Group Policies
155
+
156
+ - **`allow`** (default): Respond in all groups when mentioned
157
+ - **`deny`**: Never respond in groups
158
+ - **`whitelist`**: Only respond in groups listed in `groups`
159
+
160
+ ### Pairing
161
+
162
+ Users can pair with the bot to be added to the whitelist:
163
+
164
+ ```bash
165
+ # User sends a pairing code
166
+ openclaw pairing approve lunkr <code>
167
+ ```
168
+
169
+ ## Troubleshooting
170
+
171
+ ### Login Fails
172
+
173
+ 1. Verify your email and password are correct
174
+ 2. Check if your Lunkr server is accessible
175
+ 3. Ensure your account has API access enabled
176
+
177
+ ### Bot Not Responding
178
+
179
+ 1. Check the gateway logs: `openclaw gateway logs`
180
+ 2. Verify the channel is enabled in configuration
181
+ 3. Ensure you're using the correct command prefix (`/bot` by default)
182
+ 4. For DMs, verify the `dmPolicy` allows messages from your user
183
+
184
+ ### Session Expired
185
+
186
+ If you see authentication errors:
187
+
188
+ ```bash
189
+ openclaw lunkr logout
190
+ openclaw lunkr login --email your-email@example.com
191
+ ```
192
+
193
+ ### Connection Issues
194
+
195
+ 1. Check your network connectivity
196
+ 2. Verify the Lunkr server URL is correct
197
+ 3. Check if there's a firewall blocking WebSocket connections
198
+
199
+ ## Capabilities
200
+
201
+ | Feature | Supported |
202
+ |---------|-----------|
203
+ | Direct Messages | Yes |
204
+ | Group Messages | Yes |
205
+ | Message Editing | Yes |
206
+ | Message Replies | Yes |
207
+ | Message Reactions | Yes |
208
+ | Media Attachments | Yes |
209
+ | Streaming Responses | Yes (blocked) |
210
+ | Polls | No |
211
+ | Threads | No |
212
+ | Group Management | No |
213
+
214
+ ## License
215
+
216
+ MIT License - See [LICENSE](LICENSE) for details.
217
+
218
+ ## Support
219
+
220
+ - **Issues**: [GitHub Issues](https://github.com/openclaw/openclaw/issues)
221
+ - **Documentation**: [OpenClaw Docs](https://docs.openclaw.dev/channels/lunkr)