@huo15/dingtalk-connector-pro 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.
Files changed (62) hide show
  1. package/CHANGELOG.md +485 -0
  2. package/LICENSE +21 -0
  3. package/README.en.md +479 -0
  4. package/README.md +209 -0
  5. package/docs/AGENT_ROUTING.md +335 -0
  6. package/docs/DEAP_AGENT_GUIDE.en.md +115 -0
  7. package/docs/DEAP_AGENT_GUIDE.md +115 -0
  8. package/docs/images/dingtalk.svg +1 -0
  9. package/docs/images/image-1.png +0 -0
  10. package/docs/images/image-2.png +0 -0
  11. package/docs/images/image-3.png +0 -0
  12. package/docs/images/image-4.png +0 -0
  13. package/docs/images/image-5.png +0 -0
  14. package/docs/images/image-6.png +0 -0
  15. package/docs/images/image-7.png +0 -0
  16. package/index.ts +28 -0
  17. package/install-beta.sh +438 -0
  18. package/install-npm.sh +167 -0
  19. package/openclaw.plugin.json +498 -0
  20. package/package.json +80 -0
  21. package/src/channel.ts +463 -0
  22. package/src/config/accounts.ts +242 -0
  23. package/src/config/schema.ts +148 -0
  24. package/src/core/connection.ts +722 -0
  25. package/src/core/message-handler.ts +1700 -0
  26. package/src/core/provider.ts +111 -0
  27. package/src/core/state.ts +54 -0
  28. package/src/directory.ts +95 -0
  29. package/src/docs.ts +293 -0
  30. package/src/gateway-methods.ts +404 -0
  31. package/src/onboarding.ts +413 -0
  32. package/src/policy.ts +32 -0
  33. package/src/probe.ts +212 -0
  34. package/src/reply-dispatcher.ts +630 -0
  35. package/src/runtime.ts +32 -0
  36. package/src/sdk/helpers.ts +322 -0
  37. package/src/sdk/types.ts +513 -0
  38. package/src/secret-input.ts +19 -0
  39. package/src/services/media/audio.ts +54 -0
  40. package/src/services/media/chunk-upload.ts +296 -0
  41. package/src/services/media/common.ts +155 -0
  42. package/src/services/media/file.ts +70 -0
  43. package/src/services/media/image.ts +81 -0
  44. package/src/services/media/index.ts +10 -0
  45. package/src/services/media/video.ts +162 -0
  46. package/src/services/media.ts +1136 -0
  47. package/src/services/messaging/card.ts +342 -0
  48. package/src/services/messaging/index.ts +17 -0
  49. package/src/services/messaging/send.ts +141 -0
  50. package/src/services/messaging.ts +1013 -0
  51. package/src/targets.ts +45 -0
  52. package/src/types/index.ts +59 -0
  53. package/src/utils/agent.ts +63 -0
  54. package/src/utils/async.ts +51 -0
  55. package/src/utils/constants.ts +27 -0
  56. package/src/utils/http-client.ts +37 -0
  57. package/src/utils/index.ts +8 -0
  58. package/src/utils/logger.ts +78 -0
  59. package/src/utils/session.ts +147 -0
  60. package/src/utils/token.ts +93 -0
  61. package/src/utils/utils-legacy.ts +454 -0
  62. package/tsconfig.json +20 -0
@@ -0,0 +1,498 @@
1
+ {
2
+ "id": "huo15-dingtalk-connector-pro",
3
+ "name": "Huo15 DingTalk Connector Pro",
4
+ "version": "1.0.0",
5
+ "description": "DingTalk (钉钉) messaging channel via Stream mode with AI Card streaming",
6
+ "author": "火一五信息科技有限公司",
7
+ "main": "index.ts",
8
+ "channels": [
9
+ "dingtalk-connector"
10
+ ],
11
+ "configSchema": {
12
+ "type": "object",
13
+ "additionalProperties": true
14
+ },
15
+ "channelConfigs": {
16
+ "dingtalk-connector": {
17
+ "label": "DingTalk",
18
+ "description": "钉钉企业内部机器人,使用 Stream 模式,无需公网 IP,支持 AI Card 流式响应。",
19
+ "schema": {
20
+ "type": "object",
21
+ "properties": {
22
+ "enabled": {
23
+ "type": "boolean"
24
+ },
25
+ "defaultAccount": {
26
+ "type": "string"
27
+ },
28
+ "clientId": {
29
+ "anyOf": [
30
+ {
31
+ "type": "string"
32
+ },
33
+ {
34
+ "type": "number"
35
+ }
36
+ ]
37
+ },
38
+ "clientSecret": {
39
+ "anyOf": [
40
+ {
41
+ "type": "string"
42
+ },
43
+ {
44
+ "type": "object",
45
+ "properties": {
46
+ "source": {
47
+ "type": "string",
48
+ "enum": [
49
+ "env",
50
+ "file",
51
+ "exec"
52
+ ]
53
+ },
54
+ "provider": {
55
+ "type": "string",
56
+ "minLength": 1
57
+ },
58
+ "id": {
59
+ "type": "string",
60
+ "minLength": 1
61
+ }
62
+ },
63
+ "required": [
64
+ "source",
65
+ "provider",
66
+ "id"
67
+ ],
68
+ "additionalProperties": false
69
+ }
70
+ ]
71
+ },
72
+ "enableMediaUpload": {
73
+ "type": "boolean"
74
+ },
75
+ "systemPrompt": {
76
+ "type": "string"
77
+ },
78
+ "dmPolicy": {
79
+ "default": "open",
80
+ "type": "string",
81
+ "enum": [
82
+ "open",
83
+ "pairing",
84
+ "allowlist"
85
+ ]
86
+ },
87
+ "allowFrom": {
88
+ "type": "array",
89
+ "items": {
90
+ "anyOf": [
91
+ {
92
+ "type": "string"
93
+ },
94
+ {
95
+ "type": "number"
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ "groupPolicy": {
101
+ "default": "open",
102
+ "type": "string",
103
+ "enum": [
104
+ "open",
105
+ "allowlist",
106
+ "disabled"
107
+ ]
108
+ },
109
+ "groupAllowFrom": {
110
+ "type": "array",
111
+ "items": {
112
+ "anyOf": [
113
+ {
114
+ "type": "string"
115
+ },
116
+ {
117
+ "type": "number"
118
+ }
119
+ ]
120
+ }
121
+ },
122
+ "requireMention": {
123
+ "default": true,
124
+ "type": "boolean"
125
+ },
126
+ "groups": {
127
+ "type": "object",
128
+ "additionalProperties": {
129
+ "type": "object",
130
+ "properties": {
131
+ "requireMention": {
132
+ "type": "boolean"
133
+ },
134
+ "tools": {
135
+ "type": "object",
136
+ "properties": {
137
+ "allow": {
138
+ "type": "array",
139
+ "items": {
140
+ "type": "string"
141
+ }
142
+ },
143
+ "deny": {
144
+ "type": "array",
145
+ "items": {
146
+ "type": "string"
147
+ }
148
+ }
149
+ },
150
+ "additionalProperties": false
151
+ },
152
+ "enabled": {
153
+ "type": "boolean"
154
+ },
155
+ "allowFrom": {
156
+ "type": "array",
157
+ "items": {
158
+ "anyOf": [
159
+ {
160
+ "type": "string"
161
+ },
162
+ {
163
+ "type": "number"
164
+ }
165
+ ]
166
+ }
167
+ },
168
+ "systemPrompt": {
169
+ "type": "string"
170
+ },
171
+ "groupSessionScope": {
172
+ "type": "string",
173
+ "enum": [
174
+ "group",
175
+ "group_sender"
176
+ ]
177
+ }
178
+ },
179
+ "additionalProperties": false
180
+ }
181
+ },
182
+ "historyLimit": {
183
+ "type": "integer",
184
+ "minimum": 0
185
+ },
186
+ "textChunkLimit": {
187
+ "type": "integer",
188
+ "exclusiveMinimum": 0
189
+ },
190
+ "mediaMaxMb": {
191
+ "type": "number",
192
+ "exclusiveMinimum": 0
193
+ },
194
+ "tools": {
195
+ "type": "object",
196
+ "properties": {
197
+ "docs": {
198
+ "type": "boolean"
199
+ },
200
+ "media": {
201
+ "type": "boolean"
202
+ }
203
+ },
204
+ "additionalProperties": false
205
+ },
206
+ "typingIndicator": {
207
+ "type": "boolean"
208
+ },
209
+ "resolveSenderNames": {
210
+ "type": "boolean"
211
+ },
212
+ "separateSessionByConversation": {
213
+ "default": true,
214
+ "type": "boolean"
215
+ },
216
+ "sharedMemoryAcrossConversations": {
217
+ "default": false,
218
+ "type": "boolean"
219
+ },
220
+ "groupSessionScope": {
221
+ "default": "group",
222
+ "type": "string",
223
+ "enum": [
224
+ "group",
225
+ "group_sender"
226
+ ]
227
+ },
228
+ "asyncMode": {
229
+ "type": "boolean"
230
+ },
231
+ "ackText": {
232
+ "type": "string"
233
+ },
234
+ "endpoint": {
235
+ "type": "string"
236
+ },
237
+ "debug": {
238
+ "type": "boolean"
239
+ },
240
+ "accounts": {
241
+ "type": "object",
242
+ "additionalProperties": {
243
+ "type": "object",
244
+ "properties": {
245
+ "enabled": {
246
+ "type": "boolean"
247
+ },
248
+ "name": {
249
+ "type": "string"
250
+ },
251
+ "clientId": {
252
+ "anyOf": [
253
+ {
254
+ "type": "string"
255
+ },
256
+ {
257
+ "type": "number"
258
+ }
259
+ ]
260
+ },
261
+ "clientSecret": {
262
+ "anyOf": [
263
+ {
264
+ "type": "string"
265
+ },
266
+ {
267
+ "type": "object",
268
+ "properties": {
269
+ "source": {
270
+ "type": "string",
271
+ "enum": [
272
+ "env",
273
+ "file",
274
+ "exec"
275
+ ]
276
+ },
277
+ "provider": {
278
+ "type": "string",
279
+ "minLength": 1
280
+ },
281
+ "id": {
282
+ "type": "string",
283
+ "minLength": 1
284
+ }
285
+ },
286
+ "required": [
287
+ "source",
288
+ "provider",
289
+ "id"
290
+ ],
291
+ "additionalProperties": false
292
+ }
293
+ ]
294
+ },
295
+ "dmPolicy": {
296
+ "type": "string",
297
+ "enum": [
298
+ "open",
299
+ "pairing",
300
+ "allowlist"
301
+ ]
302
+ },
303
+ "allowFrom": {
304
+ "type": "array",
305
+ "items": {
306
+ "anyOf": [
307
+ {
308
+ "type": "string"
309
+ },
310
+ {
311
+ "type": "number"
312
+ }
313
+ ]
314
+ }
315
+ },
316
+ "groupPolicy": {
317
+ "type": "string",
318
+ "enum": [
319
+ "open",
320
+ "allowlist",
321
+ "disabled"
322
+ ]
323
+ },
324
+ "groupAllowFrom": {
325
+ "type": "array",
326
+ "items": {
327
+ "anyOf": [
328
+ {
329
+ "type": "string"
330
+ },
331
+ {
332
+ "type": "number"
333
+ }
334
+ ]
335
+ }
336
+ },
337
+ "requireMention": {
338
+ "type": "boolean"
339
+ },
340
+ "groups": {
341
+ "type": "object",
342
+ "additionalProperties": {
343
+ "type": "object",
344
+ "properties": {
345
+ "requireMention": {
346
+ "type": "boolean"
347
+ },
348
+ "tools": {
349
+ "type": "object",
350
+ "properties": {
351
+ "allow": {
352
+ "type": "array",
353
+ "items": {
354
+ "type": "string"
355
+ }
356
+ },
357
+ "deny": {
358
+ "type": "array",
359
+ "items": {
360
+ "type": "string"
361
+ }
362
+ }
363
+ },
364
+ "additionalProperties": false
365
+ },
366
+ "enabled": {
367
+ "type": "boolean"
368
+ },
369
+ "allowFrom": {
370
+ "type": "array",
371
+ "items": {
372
+ "anyOf": [
373
+ {
374
+ "type": "string"
375
+ },
376
+ {
377
+ "type": "number"
378
+ }
379
+ ]
380
+ }
381
+ },
382
+ "systemPrompt": {
383
+ "type": "string"
384
+ },
385
+ "groupSessionScope": {
386
+ "type": "string",
387
+ "enum": [
388
+ "group",
389
+ "group_sender"
390
+ ]
391
+ }
392
+ },
393
+ "additionalProperties": false
394
+ }
395
+ },
396
+ "historyLimit": {
397
+ "type": "integer",
398
+ "minimum": 0
399
+ },
400
+ "textChunkLimit": {
401
+ "type": "integer",
402
+ "exclusiveMinimum": 0
403
+ },
404
+ "mediaMaxMb": {
405
+ "type": "number",
406
+ "exclusiveMinimum": 0
407
+ },
408
+ "tools": {
409
+ "type": "object",
410
+ "properties": {
411
+ "docs": {
412
+ "type": "boolean"
413
+ },
414
+ "media": {
415
+ "type": "boolean"
416
+ }
417
+ },
418
+ "additionalProperties": false
419
+ },
420
+ "typingIndicator": {
421
+ "type": "boolean"
422
+ },
423
+ "resolveSenderNames": {
424
+ "type": "boolean"
425
+ },
426
+ "separateSessionByConversation": {
427
+ "type": "boolean"
428
+ },
429
+ "sharedMemoryAcrossConversations": {
430
+ "type": "boolean"
431
+ },
432
+ "groupSessionScope": {
433
+ "type": "string",
434
+ "enum": [
435
+ "group",
436
+ "group_sender"
437
+ ]
438
+ },
439
+ "asyncMode": {
440
+ "type": "boolean"
441
+ },
442
+ "ackText": {
443
+ "type": "string"
444
+ },
445
+ "endpoint": {
446
+ "type": "string"
447
+ },
448
+ "debug": {
449
+ "type": "boolean"
450
+ }
451
+ },
452
+ "additionalProperties": false
453
+ }
454
+ }
455
+ },
456
+ "additionalProperties": false
457
+ },
458
+ "uiHints": {
459
+ "channels.dingtalk-connector.clientId": {
460
+ "label": "Client ID (AppKey)",
461
+ "help": "钉钉应用的 AppKey / Client ID",
462
+ "sensitive": true
463
+ },
464
+ "channels.dingtalk-connector.clientSecret": {
465
+ "label": "Client Secret (AppSecret)",
466
+ "help": "钉钉应用的 AppSecret / Client Secret",
467
+ "sensitive": true
468
+ },
469
+ "channels.dingtalk-connector.dmPolicy": {
470
+ "label": "DM Policy",
471
+ "help": "单聊策略:open(开放)、pairing(配对)、allowlist(白名单)"
472
+ },
473
+ "channels.dingtalk-connector.groupPolicy": {
474
+ "label": "Group Policy",
475
+ "help": "群聊策略:open(开放)、allowlist(白名单)、disabled(禁用)"
476
+ },
477
+ "channels.dingtalk-connector.requireMention": {
478
+ "label": "Require @Mention",
479
+ "help": "群聊中是否需要 @机器人 才响应"
480
+ },
481
+ "channels.dingtalk-connector.debug": {
482
+ "label": "Debug Mode",
483
+ "help": "启用调试日志",
484
+ "advanced": true
485
+ },
486
+ "channels.dingtalk-connector.endpoint": {
487
+ "label": "Gateway Endpoint",
488
+ "help": "自定义 DWClient 网关地址(高级)",
489
+ "advanced": true
490
+ },
491
+ "channels.dingtalk-connector.accounts": {
492
+ "label": "Accounts",
493
+ "help": "多账号配置,每个 key 是账号 ID"
494
+ }
495
+ }
496
+ }
497
+ }
498
+ }
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@huo15/dingtalk-connector-pro",
3
+ "version": "1.0.0",
4
+ "description": "火一五定制版钉钉 OpenClaw 连接器 - 支持记忆系统集成、会话管理、AI Card 流式响应",
5
+ "main": "index.ts",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "echo 'No build needed - jiti loads TS at runtime'",
9
+ "lint": "echo 'Lint check skipped'",
10
+ "lint:fix": "echo 'Lint fix skipped'",
11
+ "test": "vitest run tests/gateway-methods.unit.test.ts",
12
+ "test:unit": "vitest run tests/gateway-methods.unit.test.ts",
13
+ "test:integration": "vitest run tests/gateway-methods.unit.test.ts",
14
+ "test:all": "vitest run",
15
+ "test:watch": "vitest watch",
16
+ "test:ui": "vitest --ui",
17
+ "test:coverage": "vitest run --coverage --exclude tests/gateway-methods.test.ts",
18
+ "type-check": "npx tsc --noEmit",
19
+ "version:check": "echo 'Version check skipped'",
20
+ "release:prepare": "echo 'Release prepare skipped'",
21
+ "release:publish": "npm publish --access public",
22
+ "release:verify": "npm view @dingtalk-real-ai/dingtalk-connector version",
23
+ "clean": "rm -rf node_modules package-lock.json",
24
+ "install:fresh": "npm run clean && npm install",
25
+ "dev": "echo 'Run: openclaw start'",
26
+ "validate": "npm run lint && npm run type-check && npm run version:check"
27
+ },
28
+ "keywords": [
29
+ "dingtalk",
30
+ "channel",
31
+ "stream",
32
+ "ai-card",
33
+ "connector"
34
+ ],
35
+ "author": "DingTalk Real Team",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git"
40
+ },
41
+ "homepage": "https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector#readme",
42
+ "bugs": "https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "dependencies": {
47
+ "axios": "1.6.0",
48
+ "dingtalk-stream": "2.1.4",
49
+ "form-data": "^4.0.0",
50
+ "zod": "^4.3.6"
51
+ },
52
+ "optionalDependencies": {
53
+ "mammoth": "^1.8.0"
54
+ },
55
+ "peerDependencies": {
56
+ "openclaw": "^2026.3.23-2"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "openclaw": {
60
+ "optional": true
61
+ }
62
+ },
63
+ "devDependencies": {
64
+ "@types/node": "^20.19.37",
65
+ "@vitest/coverage-v8": "^2.0.0",
66
+ "@vitest/ui": "^2.1.9",
67
+ "openclaw": "^2026.3.23-2",
68
+ "typescript": "^5.6.0",
69
+ "vitest": "^2.1.9"
70
+ },
71
+ "openclaw": {
72
+ "extensions": [
73
+ "./index.ts"
74
+ ],
75
+ "channels": [
76
+ "dingtalk-connector"
77
+ ],
78
+ "installDependencies": true
79
+ }
80
+ }