@xuanyue202/wecom 2026.3.24 → 2026.3.31
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/dist/index.d.ts +95 -0
- package/dist/index.js +455 -59
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ type WecomDmPolicy = "open" | "pairing" | "allowlist" | "disabled";
|
|
|
4
4
|
type WecomGroupPolicy = "open" | "allowlist" | "disabled";
|
|
5
5
|
type WecomTransportMode = "webhook" | "ws";
|
|
6
6
|
type WecomWsImageReplyMode = "native" | "markdown-url";
|
|
7
|
+
type WecomRetryConfig = {
|
|
8
|
+
/** 最大重试次数,默认 3 */
|
|
9
|
+
attempts?: number;
|
|
10
|
+
/** 最小退避延迟(ms),默认 400 */
|
|
11
|
+
minDelayMs?: number;
|
|
12
|
+
/** 最大退避延迟(ms),封顶,默认 30000 */
|
|
13
|
+
maxDelayMs?: number;
|
|
14
|
+
/** 随机抖动比例(0-1),防多实例同时重试,默认 0.1 */
|
|
15
|
+
jitter?: number;
|
|
16
|
+
};
|
|
7
17
|
type WecomAccountConfig = {
|
|
8
18
|
name?: string;
|
|
9
19
|
enabled?: boolean;
|
|
@@ -26,6 +36,9 @@ type WecomAccountConfig = {
|
|
|
26
36
|
groupPolicy?: WecomGroupPolicy;
|
|
27
37
|
groupAllowFrom?: string[];
|
|
28
38
|
requireMention?: boolean;
|
|
39
|
+
retry?: WecomRetryConfig;
|
|
40
|
+
/** 单条消息最大字符数,超过后自动拆分,默认 500 */
|
|
41
|
+
textChunkLimit?: number;
|
|
29
42
|
};
|
|
30
43
|
type WecomConfig = WecomAccountConfig & {
|
|
31
44
|
accounts?: Record<string, WecomAccountConfig>;
|
|
@@ -48,6 +61,8 @@ type ResolvedWecomAccount = {
|
|
|
48
61
|
reconnectMaxDelayMs: number;
|
|
49
62
|
publicBaseUrl?: string;
|
|
50
63
|
wsImageReplyMode: WecomWsImageReplyMode;
|
|
64
|
+
retry: Required<WecomRetryConfig>;
|
|
65
|
+
textChunkLimit: number;
|
|
51
66
|
config: WecomAccountConfig;
|
|
52
67
|
};
|
|
53
68
|
type WecomInboundBase = {
|
|
@@ -103,6 +118,13 @@ interface PluginConfig {
|
|
|
103
118
|
};
|
|
104
119
|
}
|
|
105
120
|
|
|
121
|
+
type WecomMessageActionName = "send" | "sendAttachment";
|
|
122
|
+
interface WecomMessageToolResult {
|
|
123
|
+
ok: boolean;
|
|
124
|
+
messageId?: string;
|
|
125
|
+
error?: string;
|
|
126
|
+
[key: string]: unknown;
|
|
127
|
+
}
|
|
106
128
|
declare const wecomPlugin: {
|
|
107
129
|
id: string;
|
|
108
130
|
meta: {
|
|
@@ -217,6 +239,33 @@ declare const wecomPlugin: {
|
|
|
217
239
|
requireMention: {
|
|
218
240
|
type: string;
|
|
219
241
|
};
|
|
242
|
+
retry: {
|
|
243
|
+
type: string;
|
|
244
|
+
additionalProperties: boolean;
|
|
245
|
+
properties: {
|
|
246
|
+
attempts: {
|
|
247
|
+
type: string;
|
|
248
|
+
minimum: number;
|
|
249
|
+
};
|
|
250
|
+
minDelayMs: {
|
|
251
|
+
type: string;
|
|
252
|
+
minimum: number;
|
|
253
|
+
};
|
|
254
|
+
maxDelayMs: {
|
|
255
|
+
type: string;
|
|
256
|
+
minimum: number;
|
|
257
|
+
};
|
|
258
|
+
jitter: {
|
|
259
|
+
type: string;
|
|
260
|
+
minimum: number;
|
|
261
|
+
maximum: number;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
textChunkLimit: {
|
|
266
|
+
type: string;
|
|
267
|
+
minimum: number;
|
|
268
|
+
};
|
|
220
269
|
defaultAccount: {
|
|
221
270
|
type: string;
|
|
222
271
|
};
|
|
@@ -303,6 +352,33 @@ declare const wecomPlugin: {
|
|
|
303
352
|
requireMention: {
|
|
304
353
|
type: string;
|
|
305
354
|
};
|
|
355
|
+
retry: {
|
|
356
|
+
type: string;
|
|
357
|
+
additionalProperties: boolean;
|
|
358
|
+
properties: {
|
|
359
|
+
attempts: {
|
|
360
|
+
type: string;
|
|
361
|
+
minimum: number;
|
|
362
|
+
};
|
|
363
|
+
minDelayMs: {
|
|
364
|
+
type: string;
|
|
365
|
+
minimum: number;
|
|
366
|
+
};
|
|
367
|
+
maxDelayMs: {
|
|
368
|
+
type: string;
|
|
369
|
+
minimum: number;
|
|
370
|
+
};
|
|
371
|
+
jitter: {
|
|
372
|
+
type: string;
|
|
373
|
+
minimum: number;
|
|
374
|
+
maximum: number;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
textChunkLimit: {
|
|
379
|
+
type: string;
|
|
380
|
+
minimum: number;
|
|
381
|
+
};
|
|
306
382
|
};
|
|
307
383
|
};
|
|
308
384
|
};
|
|
@@ -463,6 +539,25 @@ declare const wecomPlugin: {
|
|
|
463
539
|
setStatus?: (status: Record<string, unknown>) => void;
|
|
464
540
|
}) => Promise<void>;
|
|
465
541
|
};
|
|
542
|
+
actions: {
|
|
543
|
+
describeMessageTool: () => {
|
|
544
|
+
actions: WecomMessageActionName[];
|
|
545
|
+
capabilities: string[];
|
|
546
|
+
schema?: {
|
|
547
|
+
properties: Record<string, unknown>;
|
|
548
|
+
visibility?: "current-channel" | "all-configured";
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
handleAction: (ctx: {
|
|
552
|
+
channel: string;
|
|
553
|
+
action: string;
|
|
554
|
+
params: Record<string, unknown>;
|
|
555
|
+
cfg: PluginConfig;
|
|
556
|
+
accountId?: string | null;
|
|
557
|
+
sessionKey?: string | null;
|
|
558
|
+
sessionId?: string | null;
|
|
559
|
+
}) => Promise<WecomMessageToolResult>;
|
|
560
|
+
};
|
|
466
561
|
};
|
|
467
562
|
|
|
468
563
|
/**
|