@easbot/gateway 0.2.39 → 0.2.41
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/chunks/chunk-3SBZTZXS.cjs +7 -0
- package/dist/chunks/chunk-OBFSXYWV.mjs +30 -0
- package/dist/chunks/chunk-RFOEJ3A2.cjs +30 -0
- package/dist/chunks/chunk-RGPJTZUB.mjs +7 -0
- package/dist/chunks/log-FQII2FT4.mjs +1 -0
- package/dist/chunks/log-VLMXTUPA.cjs +1 -0
- package/dist/chunks/server-3QASQ56E.cjs +1 -0
- package/dist/chunks/server-54GY5XXD.mjs +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +210 -23
- package/dist/index.d.ts +210 -23
- package/dist/index.mjs +2 -2
- package/package.json +5 -5
- package/dist/chunks/chunk-7OFQ65NG.mjs +0 -7
- package/dist/chunks/chunk-AUPHFE34.cjs +0 -7
- package/dist/chunks/chunk-GY3SWWW3.cjs +0 -1
- package/dist/chunks/chunk-H425RRAV.mjs +0 -18
- package/dist/chunks/chunk-HAMGVOQD.mjs +0 -1
- package/dist/chunks/chunk-O6R6U45A.cjs +0 -18
- package/dist/chunks/global-FIBJJFBN.cjs +0 -1
- package/dist/chunks/global-Z3HUTR5L.mjs +0 -2
- package/dist/chunks/log-JFEBRH2W.cjs +0 -1
- package/dist/chunks/log-MIT4H7S5.mjs +0 -1
- package/dist/chunks/server-4GO5DAEQ.cjs +0 -1
- package/dist/chunks/server-QOFBCSK5.mjs +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -42,6 +42,7 @@ declare const ChannelTypeSchema: z.ZodEnum<{
|
|
|
42
42
|
webchat: "webchat";
|
|
43
43
|
signal: "signal";
|
|
44
44
|
nostr: "nostr";
|
|
45
|
+
dingtalk: "dingtalk";
|
|
45
46
|
}>;
|
|
46
47
|
type ChannelType = z.infer<typeof ChannelTypeSchema>;
|
|
47
48
|
declare const MessagePrioritySchema: z.ZodEnum<{
|
|
@@ -193,6 +194,20 @@ declare const ChannelConfigSchema: z.ZodObject<{
|
|
|
193
194
|
maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
194
195
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
195
196
|
}, z.core.$strip>>;
|
|
197
|
+
dingtalk: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
199
|
+
appKey: z.ZodString;
|
|
200
|
+
appSecret: z.ZodString;
|
|
201
|
+
token: z.ZodOptional<z.ZodString>;
|
|
202
|
+
encryptKey: z.ZodOptional<z.ZodString>;
|
|
203
|
+
webhook: z.ZodOptional<z.ZodObject<{
|
|
204
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
205
|
+
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
206
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
209
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
210
|
+
}, z.core.$strip>>;
|
|
196
211
|
}, z.core.$strip>;
|
|
197
212
|
declare const HTTPSConfigSchema: z.ZodObject<{
|
|
198
213
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -549,6 +564,20 @@ declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
549
564
|
maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
550
565
|
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
551
566
|
}, z.core.$strip>>;
|
|
567
|
+
dingtalk: z.ZodOptional<z.ZodObject<{
|
|
568
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
569
|
+
appKey: z.ZodString;
|
|
570
|
+
appSecret: z.ZodString;
|
|
571
|
+
token: z.ZodOptional<z.ZodString>;
|
|
572
|
+
encryptKey: z.ZodOptional<z.ZodString>;
|
|
573
|
+
webhook: z.ZodOptional<z.ZodObject<{
|
|
574
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
575
|
+
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
576
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
577
|
+
}, z.core.$strip>>;
|
|
578
|
+
maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
579
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
580
|
+
}, z.core.$strip>>;
|
|
552
581
|
}, z.core.$strip>>;
|
|
553
582
|
cluster: z.ZodOptional<z.ZodObject<{
|
|
554
583
|
nodeId: z.ZodString;
|
|
@@ -705,6 +734,9 @@ interface ChannelCapabilities {
|
|
|
705
734
|
supportsHtml: boolean;
|
|
706
735
|
supportsDeliveryReceipt: boolean;
|
|
707
736
|
supportsReadReceipt: boolean;
|
|
737
|
+
supportsSlashCommands: boolean;
|
|
738
|
+
supportsNativeCommands: boolean;
|
|
739
|
+
commandPrefix: string;
|
|
708
740
|
maxMessageLength: number;
|
|
709
741
|
maxMediaCount: number;
|
|
710
742
|
}
|
|
@@ -1562,6 +1594,12 @@ declare abstract class BaseChannelPlugin implements ChannelPlugin {
|
|
|
1562
1594
|
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
1563
1595
|
protected handleMessage(message: GatewayMessage): Promise<void>;
|
|
1564
1596
|
protected handleEvent(type: string, data?: unknown): Promise<void>;
|
|
1597
|
+
protected getCommandList(): Promise<Array<{
|
|
1598
|
+
name: string;
|
|
1599
|
+
description?: string;
|
|
1600
|
+
agent?: string;
|
|
1601
|
+
model?: string;
|
|
1602
|
+
}>>;
|
|
1565
1603
|
}
|
|
1566
1604
|
|
|
1567
1605
|
interface PluginLoaderConfig {
|
|
@@ -1634,6 +1672,8 @@ declare class MessageStore {
|
|
|
1634
1672
|
private storagePath;
|
|
1635
1673
|
private dirty;
|
|
1636
1674
|
constructor(config?: Partial<MessageStoreConfig>);
|
|
1675
|
+
loadFromDisk(): Promise<number>;
|
|
1676
|
+
private addToSessionMessages;
|
|
1637
1677
|
private ensureDir;
|
|
1638
1678
|
private getMessageFilePath;
|
|
1639
1679
|
private getSessionDir;
|
|
@@ -1876,6 +1916,7 @@ declare class GatewayServer implements IGatewayServer {
|
|
|
1876
1916
|
private wsServer;
|
|
1877
1917
|
private running;
|
|
1878
1918
|
private connections;
|
|
1919
|
+
private gatewayAgent;
|
|
1879
1920
|
constructor(config: GatewayServerConfig$1);
|
|
1880
1921
|
private loadChannelPlugins;
|
|
1881
1922
|
start(): Promise<void>;
|
|
@@ -1889,11 +1930,10 @@ declare class GatewayServer implements IGatewayServer {
|
|
|
1889
1930
|
onMessage(message: GatewayMessage): Promise<void>;
|
|
1890
1931
|
private saveContactFromMessage;
|
|
1891
1932
|
private dispatchToAgent;
|
|
1933
|
+
private getGatewayAgent;
|
|
1934
|
+
private dispatchToGatewayAgent;
|
|
1892
1935
|
private buildChannelContext;
|
|
1893
|
-
private
|
|
1894
|
-
private executeLocalAgent;
|
|
1895
|
-
private dispatchToLocalAgentWithFallback;
|
|
1896
|
-
private executeLocalAgentWithFallback;
|
|
1936
|
+
private executeGatewayAgent;
|
|
1897
1937
|
private handleAgentResult;
|
|
1898
1938
|
private handleAgentError;
|
|
1899
1939
|
private dispatchToSubAgent;
|
|
@@ -2187,6 +2227,9 @@ declare class TelegramPlugin extends BaseChannelPlugin {
|
|
|
2187
2227
|
supportsHtml: boolean;
|
|
2188
2228
|
supportsDeliveryReceipt: boolean;
|
|
2189
2229
|
supportsReadReceipt: boolean;
|
|
2230
|
+
supportsSlashCommands: boolean;
|
|
2231
|
+
supportsNativeCommands: boolean;
|
|
2232
|
+
commandPrefix: string;
|
|
2190
2233
|
maxMessageLength: number;
|
|
2191
2234
|
maxMediaCount: number;
|
|
2192
2235
|
};
|
|
@@ -2216,6 +2259,7 @@ declare class TelegramPlugin extends BaseChannelPlugin {
|
|
|
2216
2259
|
private getUpdates;
|
|
2217
2260
|
private sendApiMessage;
|
|
2218
2261
|
private request;
|
|
2262
|
+
private syncBotCommands;
|
|
2219
2263
|
}
|
|
2220
2264
|
|
|
2221
2265
|
interface DiscordBotConfig {
|
|
@@ -2223,13 +2267,39 @@ interface DiscordBotConfig {
|
|
|
2223
2267
|
applicationId?: string;
|
|
2224
2268
|
gateway?: {
|
|
2225
2269
|
enabled: boolean;
|
|
2226
|
-
intents
|
|
2270
|
+
intents?: number[];
|
|
2227
2271
|
};
|
|
2228
2272
|
webhook?: {
|
|
2229
2273
|
enabled: boolean;
|
|
2230
2274
|
path: string;
|
|
2231
2275
|
port?: number;
|
|
2232
2276
|
};
|
|
2277
|
+
commands?: DiscordCommand[];
|
|
2278
|
+
retry?: {
|
|
2279
|
+
maxAttempts?: number;
|
|
2280
|
+
initialDelay?: number;
|
|
2281
|
+
maxDelay?: number;
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2284
|
+
interface DiscordCommand {
|
|
2285
|
+
name: string;
|
|
2286
|
+
description: string;
|
|
2287
|
+
options?: Array<{
|
|
2288
|
+
name: string;
|
|
2289
|
+
description: string;
|
|
2290
|
+
type: number;
|
|
2291
|
+
required?: boolean;
|
|
2292
|
+
}>;
|
|
2293
|
+
handler: (ctx: DiscordCommandContext) => Promise<void>;
|
|
2294
|
+
}
|
|
2295
|
+
interface DiscordCommandContext {
|
|
2296
|
+
userId: string;
|
|
2297
|
+
guildId?: string;
|
|
2298
|
+
channelId: string;
|
|
2299
|
+
messageId: string;
|
|
2300
|
+
commandName: string;
|
|
2301
|
+
options: Record<string, unknown>;
|
|
2302
|
+
reply?: (text: string) => Promise<string>;
|
|
2233
2303
|
}
|
|
2234
2304
|
declare class DiscordPlugin extends BaseChannelPlugin {
|
|
2235
2305
|
readonly id: string;
|
|
@@ -2242,12 +2312,20 @@ declare class DiscordPlugin extends BaseChannelPlugin {
|
|
|
2242
2312
|
private sessionId;
|
|
2243
2313
|
private sequenceNumber;
|
|
2244
2314
|
private abortController;
|
|
2315
|
+
private processedMessageIds;
|
|
2316
|
+
private sentMessages;
|
|
2317
|
+
private sessionIdMap;
|
|
2318
|
+
private commandRouter;
|
|
2245
2319
|
private reconnectAttempts;
|
|
2246
2320
|
private maxReconnectAttempts;
|
|
2321
|
+
private retryState;
|
|
2247
2322
|
constructor(id?: string);
|
|
2248
2323
|
protected doStart(): Promise<void>;
|
|
2249
2324
|
protected doStop(): Promise<void>;
|
|
2325
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2250
2326
|
send(message: GatewayMessage): Promise<string>;
|
|
2327
|
+
private createMessage;
|
|
2328
|
+
private syncCommands;
|
|
2251
2329
|
getCapabilities(): {
|
|
2252
2330
|
supportsText: boolean;
|
|
2253
2331
|
supportsMedia: boolean;
|
|
@@ -2261,6 +2339,9 @@ declare class DiscordPlugin extends BaseChannelPlugin {
|
|
|
2261
2339
|
supportsHtml: boolean;
|
|
2262
2340
|
supportsDeliveryReceipt: boolean;
|
|
2263
2341
|
supportsReadReceipt: boolean;
|
|
2342
|
+
supportsSlashCommands: boolean;
|
|
2343
|
+
supportsNativeCommands: boolean;
|
|
2344
|
+
commandPrefix: string;
|
|
2264
2345
|
maxMessageLength: number;
|
|
2265
2346
|
maxMediaCount: number;
|
|
2266
2347
|
};
|
|
@@ -2268,14 +2349,17 @@ declare class DiscordPlugin extends BaseChannelPlugin {
|
|
|
2268
2349
|
private handleGatewayMessage;
|
|
2269
2350
|
private handleHello;
|
|
2270
2351
|
private handleDispatch;
|
|
2352
|
+
private handleReactionEvent;
|
|
2353
|
+
private findSentMessageEntry;
|
|
2271
2354
|
private handleDiscordMessage;
|
|
2272
2355
|
private toGatewayMessage;
|
|
2273
2356
|
private parseContent;
|
|
2357
|
+
private downloadFile;
|
|
2358
|
+
private downloadTextFile;
|
|
2274
2359
|
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2275
2360
|
private processMessageAndGetSessionId;
|
|
2276
2361
|
private getCurrentUser;
|
|
2277
2362
|
private getGatewayBot;
|
|
2278
|
-
private createMessage;
|
|
2279
2363
|
private request;
|
|
2280
2364
|
}
|
|
2281
2365
|
|
|
@@ -2289,6 +2373,24 @@ interface SlackBotConfig {
|
|
|
2289
2373
|
path: string;
|
|
2290
2374
|
port?: number;
|
|
2291
2375
|
};
|
|
2376
|
+
commands?: SlackBotCommand[];
|
|
2377
|
+
retry?: {
|
|
2378
|
+
maxAttempts?: number;
|
|
2379
|
+
initialDelay?: number;
|
|
2380
|
+
maxDelay?: number;
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
2383
|
+
interface SlackBotCommand {
|
|
2384
|
+
command: string;
|
|
2385
|
+
description: string;
|
|
2386
|
+
handler: (ctx: SlackCommandContext) => Promise<void>;
|
|
2387
|
+
}
|
|
2388
|
+
interface SlackCommandContext {
|
|
2389
|
+
channelId: string;
|
|
2390
|
+
userId: string;
|
|
2391
|
+
args: string[];
|
|
2392
|
+
ts: string;
|
|
2393
|
+
reply?: (text: string) => Promise<string>;
|
|
2292
2394
|
}
|
|
2293
2395
|
declare class SlackPlugin extends BaseChannelPlugin {
|
|
2294
2396
|
readonly id: string;
|
|
@@ -2298,10 +2400,22 @@ declare class SlackPlugin extends BaseChannelPlugin {
|
|
|
2298
2400
|
private baseUrl;
|
|
2299
2401
|
private socketModeClient;
|
|
2300
2402
|
private abortController;
|
|
2403
|
+
private processedMessageIds;
|
|
2404
|
+
private sentMessages;
|
|
2405
|
+
private sessionIdMap;
|
|
2406
|
+
private commandRouter;
|
|
2407
|
+
private retryState;
|
|
2408
|
+
private socketReconnectAttempts;
|
|
2409
|
+
private maxSocketReconnectAttempts;
|
|
2301
2410
|
constructor(id?: string);
|
|
2302
2411
|
protected doStart(): Promise<void>;
|
|
2303
2412
|
protected doStop(): Promise<void>;
|
|
2413
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2304
2414
|
send(message: GatewayMessage): Promise<string>;
|
|
2415
|
+
private postMessage;
|
|
2416
|
+
private postImage;
|
|
2417
|
+
private postFile;
|
|
2418
|
+
private uploadFile;
|
|
2305
2419
|
getCapabilities(): {
|
|
2306
2420
|
supportsText: boolean;
|
|
2307
2421
|
supportsMedia: boolean;
|
|
@@ -2315,18 +2429,31 @@ declare class SlackPlugin extends BaseChannelPlugin {
|
|
|
2315
2429
|
supportsHtml: boolean;
|
|
2316
2430
|
supportsDeliveryReceipt: boolean;
|
|
2317
2431
|
supportsReadReceipt: boolean;
|
|
2432
|
+
supportsSlashCommands: boolean;
|
|
2433
|
+
supportsNativeCommands: boolean;
|
|
2434
|
+
commandPrefix: string;
|
|
2318
2435
|
maxMessageLength: number;
|
|
2319
2436
|
maxMediaCount: number;
|
|
2320
2437
|
};
|
|
2321
2438
|
private startSocketMode;
|
|
2322
2439
|
private handleSocketModeEvent;
|
|
2440
|
+
private handleReactionEvent;
|
|
2441
|
+
private findSentMessageEntry;
|
|
2323
2442
|
private handleSlackMessage;
|
|
2443
|
+
private handleCommand;
|
|
2444
|
+
protected getCommandList(): Promise<Array<{
|
|
2445
|
+
name: string;
|
|
2446
|
+
description?: string;
|
|
2447
|
+
agent?: string;
|
|
2448
|
+
model?: string;
|
|
2449
|
+
}>>;
|
|
2450
|
+
private syncBotCommands;
|
|
2324
2451
|
private toGatewayMessage;
|
|
2325
2452
|
private parseContent;
|
|
2453
|
+
private downloadFile;
|
|
2454
|
+
private downloadTextFile;
|
|
2326
2455
|
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2327
|
-
private processMessageAndGetSessionId;
|
|
2328
2456
|
private authTest;
|
|
2329
|
-
private postMessage;
|
|
2330
2457
|
private request;
|
|
2331
2458
|
}
|
|
2332
2459
|
|
|
@@ -2340,6 +2467,11 @@ interface FeishuBotConfig {
|
|
|
2340
2467
|
path: string;
|
|
2341
2468
|
port?: number;
|
|
2342
2469
|
};
|
|
2470
|
+
retry?: {
|
|
2471
|
+
maxAttempts?: number;
|
|
2472
|
+
initialDelay?: number;
|
|
2473
|
+
maxDelay?: number;
|
|
2474
|
+
};
|
|
2343
2475
|
}
|
|
2344
2476
|
interface FeishuMessageEvent {
|
|
2345
2477
|
type: string;
|
|
@@ -2376,9 +2508,12 @@ declare class FeishuPlugin extends BaseChannelPlugin {
|
|
|
2376
2508
|
private tenantAccessToken;
|
|
2377
2509
|
private tokenExpireTime;
|
|
2378
2510
|
private abortController;
|
|
2511
|
+
private processedMessageIds;
|
|
2512
|
+
private retryState;
|
|
2379
2513
|
constructor(id?: string);
|
|
2380
2514
|
protected doStart(): Promise<void>;
|
|
2381
2515
|
protected doStop(): Promise<void>;
|
|
2516
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2382
2517
|
send(message: GatewayMessage): Promise<string>;
|
|
2383
2518
|
getCapabilities(): {
|
|
2384
2519
|
supportsText: boolean;
|
|
@@ -2393,18 +2528,26 @@ declare class FeishuPlugin extends BaseChannelPlugin {
|
|
|
2393
2528
|
supportsHtml: boolean;
|
|
2394
2529
|
supportsDeliveryReceipt: boolean;
|
|
2395
2530
|
supportsReadReceipt: boolean;
|
|
2531
|
+
supportsSlashCommands: boolean;
|
|
2532
|
+
supportsNativeCommands: boolean;
|
|
2533
|
+
commandPrefix: string;
|
|
2396
2534
|
maxMessageLength: number;
|
|
2397
2535
|
maxMediaCount: number;
|
|
2398
2536
|
};
|
|
2399
2537
|
handleWebhookEvent(event: FeishuMessageEvent): Promise<void>;
|
|
2538
|
+
private refreshTenantAccessToken;
|
|
2539
|
+
private ensureTokenValid;
|
|
2540
|
+
private sendMessage;
|
|
2541
|
+
private sendImage;
|
|
2542
|
+
private sendFile;
|
|
2543
|
+
private uploadImage;
|
|
2544
|
+
private uploadFile;
|
|
2400
2545
|
private toGatewayMessage;
|
|
2401
2546
|
private parseContent;
|
|
2547
|
+
private downloadImage;
|
|
2548
|
+
private downloadFile;
|
|
2402
2549
|
private extractPostContent;
|
|
2403
2550
|
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2404
|
-
private processMessageAndGetSessionId;
|
|
2405
|
-
private refreshTenantAccessToken;
|
|
2406
|
-
private ensureTokenValid;
|
|
2407
|
-
private sendMessage;
|
|
2408
2551
|
}
|
|
2409
2552
|
|
|
2410
2553
|
interface WeChatBotConfig {
|
|
@@ -2419,6 +2562,11 @@ interface WeChatBotConfig {
|
|
|
2419
2562
|
path: string;
|
|
2420
2563
|
port?: number;
|
|
2421
2564
|
};
|
|
2565
|
+
retry?: {
|
|
2566
|
+
maxAttempts?: number;
|
|
2567
|
+
initialDelay?: number;
|
|
2568
|
+
maxDelay?: number;
|
|
2569
|
+
};
|
|
2422
2570
|
}
|
|
2423
2571
|
declare class WeChatPlugin extends BaseChannelPlugin {
|
|
2424
2572
|
readonly id: string;
|
|
@@ -2428,9 +2576,12 @@ declare class WeChatPlugin extends BaseChannelPlugin {
|
|
|
2428
2576
|
private accessToken;
|
|
2429
2577
|
private tokenExpireTime;
|
|
2430
2578
|
private abortController;
|
|
2579
|
+
private processedMessageIds;
|
|
2580
|
+
private retryState;
|
|
2431
2581
|
constructor(id?: string);
|
|
2432
2582
|
protected doStart(): Promise<void>;
|
|
2433
2583
|
protected doStop(): Promise<void>;
|
|
2584
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2434
2585
|
send(message: GatewayMessage): Promise<string>;
|
|
2435
2586
|
getCapabilities(): {
|
|
2436
2587
|
supportsText: boolean;
|
|
@@ -2445,19 +2596,23 @@ declare class WeChatPlugin extends BaseChannelPlugin {
|
|
|
2445
2596
|
supportsHtml: boolean;
|
|
2446
2597
|
supportsDeliveryReceipt: boolean;
|
|
2447
2598
|
supportsReadReceipt: boolean;
|
|
2599
|
+
supportsSlashCommands: boolean;
|
|
2600
|
+
supportsNativeCommands: boolean;
|
|
2601
|
+
commandPrefix: string;
|
|
2448
2602
|
maxMessageLength: number;
|
|
2449
2603
|
maxMediaCount: number;
|
|
2450
2604
|
};
|
|
2451
2605
|
handleWebhookMessage(xmlData: string): Promise<void>;
|
|
2452
|
-
private parseXmlMessage;
|
|
2453
|
-
private toGatewayMessage;
|
|
2454
|
-
private parseContent;
|
|
2455
|
-
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2456
|
-
private processMessageAndGetSessionId;
|
|
2457
2606
|
private refreshAccessToken;
|
|
2458
2607
|
private ensureTokenValid;
|
|
2459
2608
|
private sendOfficialMessage;
|
|
2460
2609
|
private sendWeComMessage;
|
|
2610
|
+
private sendImage;
|
|
2611
|
+
private uploadImage;
|
|
2612
|
+
private parseXmlMessage;
|
|
2613
|
+
private toGatewayMessage;
|
|
2614
|
+
private parseContent;
|
|
2615
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2461
2616
|
}
|
|
2462
2617
|
|
|
2463
2618
|
interface WebChatConfig {
|
|
@@ -2479,11 +2634,13 @@ declare class WebChatPlugin extends BaseChannelPlugin {
|
|
|
2479
2634
|
private connections;
|
|
2480
2635
|
private heartbeatInterval;
|
|
2481
2636
|
private abortController;
|
|
2637
|
+
private processedMessageIds;
|
|
2638
|
+
private sentMessages;
|
|
2482
2639
|
private wsServer;
|
|
2483
2640
|
constructor(id?: string);
|
|
2484
2641
|
protected doStart(): Promise<void>;
|
|
2485
|
-
private startWebSocketServer;
|
|
2486
2642
|
protected doStop(): Promise<void>;
|
|
2643
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2487
2644
|
send(message: GatewayMessage): Promise<string>;
|
|
2488
2645
|
getCapabilities(): {
|
|
2489
2646
|
supportsText: boolean;
|
|
@@ -2498,20 +2655,24 @@ declare class WebChatPlugin extends BaseChannelPlugin {
|
|
|
2498
2655
|
supportsHtml: boolean;
|
|
2499
2656
|
supportsDeliveryReceipt: boolean;
|
|
2500
2657
|
supportsReadReceipt: boolean;
|
|
2658
|
+
supportsSlashCommands: boolean;
|
|
2659
|
+
supportsNativeCommands: boolean;
|
|
2660
|
+
commandPrefix: string;
|
|
2501
2661
|
maxMessageLength: number;
|
|
2502
2662
|
maxMediaCount: number;
|
|
2503
2663
|
};
|
|
2504
2664
|
pushEvent(sessionId: string, event: SessionEventPayload): void;
|
|
2505
2665
|
getWebSocketServer(): GatewayWebSocketServer | null;
|
|
2506
2666
|
handleConnection(ws: WebSocket, userId: string): Promise<void>;
|
|
2667
|
+
getConnectionCount(): number;
|
|
2668
|
+
getWsServerConnectionCount(): number;
|
|
2669
|
+
private startWebSocketServer;
|
|
2507
2670
|
private handleWebSocketMessage;
|
|
2508
2671
|
private handleMessageAcknowledgment;
|
|
2509
2672
|
private handleChatMessage;
|
|
2510
2673
|
private startHeartbeat;
|
|
2511
2674
|
private findConnectionByUser;
|
|
2512
2675
|
private generateConnectionId;
|
|
2513
|
-
getConnectionCount(): number;
|
|
2514
|
-
getWsServerConnectionCount(): number;
|
|
2515
2676
|
}
|
|
2516
2677
|
|
|
2517
2678
|
interface SignalBotConfig {
|
|
@@ -2523,6 +2684,15 @@ interface SignalBotConfig {
|
|
|
2523
2684
|
path: string;
|
|
2524
2685
|
port?: number;
|
|
2525
2686
|
};
|
|
2687
|
+
polling?: {
|
|
2688
|
+
enabled: boolean;
|
|
2689
|
+
interval?: number;
|
|
2690
|
+
};
|
|
2691
|
+
retry?: {
|
|
2692
|
+
maxAttempts?: number;
|
|
2693
|
+
initialDelay?: number;
|
|
2694
|
+
maxDelay?: number;
|
|
2695
|
+
};
|
|
2526
2696
|
}
|
|
2527
2697
|
declare class SignalPlugin extends BaseChannelPlugin {
|
|
2528
2698
|
readonly id: string;
|
|
@@ -2532,9 +2702,13 @@ declare class SignalPlugin extends BaseChannelPlugin {
|
|
|
2532
2702
|
private abortController;
|
|
2533
2703
|
private lastTimestamp;
|
|
2534
2704
|
private pollingIntervalMs;
|
|
2705
|
+
private processedMessageIds;
|
|
2706
|
+
private sentMessages;
|
|
2707
|
+
private retryState;
|
|
2535
2708
|
constructor(id?: string);
|
|
2536
2709
|
protected doStart(): Promise<void>;
|
|
2537
2710
|
protected doStop(): Promise<void>;
|
|
2711
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2538
2712
|
send(message: GatewayMessage): Promise<string>;
|
|
2539
2713
|
getCapabilities(): {
|
|
2540
2714
|
supportsText: boolean;
|
|
@@ -2549,6 +2723,9 @@ declare class SignalPlugin extends BaseChannelPlugin {
|
|
|
2549
2723
|
supportsHtml: boolean;
|
|
2550
2724
|
supportsDeliveryReceipt: boolean;
|
|
2551
2725
|
supportsReadReceipt: boolean;
|
|
2726
|
+
supportsSlashCommands: boolean;
|
|
2727
|
+
supportsNativeCommands: boolean;
|
|
2728
|
+
commandPrefix: string;
|
|
2552
2729
|
maxMessageLength: number;
|
|
2553
2730
|
maxMediaCount: number;
|
|
2554
2731
|
};
|
|
@@ -2559,7 +2736,6 @@ declare class SignalPlugin extends BaseChannelPlugin {
|
|
|
2559
2736
|
private toGatewayMessage;
|
|
2560
2737
|
private parseContent;
|
|
2561
2738
|
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2562
|
-
private processMessageAndGetSessionId;
|
|
2563
2739
|
private getAccountInfo;
|
|
2564
2740
|
private receiveMessages;
|
|
2565
2741
|
private sendMessage;
|
|
@@ -2571,6 +2747,11 @@ interface NostrBotConfig {
|
|
|
2571
2747
|
privateKey?: string;
|
|
2572
2748
|
publicKey?: string;
|
|
2573
2749
|
timeout: number;
|
|
2750
|
+
retry?: {
|
|
2751
|
+
maxAttempts?: number;
|
|
2752
|
+
initialDelay?: number;
|
|
2753
|
+
maxDelay?: number;
|
|
2754
|
+
};
|
|
2574
2755
|
}
|
|
2575
2756
|
declare class NostrPlugin extends BaseChannelPlugin {
|
|
2576
2757
|
readonly id: string;
|
|
@@ -2579,13 +2760,16 @@ declare class NostrPlugin extends BaseChannelPlugin {
|
|
|
2579
2760
|
private botConfig;
|
|
2580
2761
|
private relayConnections;
|
|
2581
2762
|
private subscriptions;
|
|
2582
|
-
private eventHandlers;
|
|
2583
2763
|
private abortController;
|
|
2764
|
+
private processedEventIds;
|
|
2765
|
+
private sentMessages;
|
|
2584
2766
|
private relayReconnectAttempts;
|
|
2585
2767
|
private maxReconnectAttempts;
|
|
2768
|
+
private retryState;
|
|
2586
2769
|
constructor(id?: string);
|
|
2587
2770
|
protected doStart(): Promise<void>;
|
|
2588
2771
|
protected doStop(): Promise<void>;
|
|
2772
|
+
protected doHealthCheck(): Promise<boolean>;
|
|
2589
2773
|
send(message: GatewayMessage): Promise<string>;
|
|
2590
2774
|
getCapabilities(): {
|
|
2591
2775
|
supportsText: boolean;
|
|
@@ -2600,6 +2784,9 @@ declare class NostrPlugin extends BaseChannelPlugin {
|
|
|
2600
2784
|
supportsHtml: boolean;
|
|
2601
2785
|
supportsDeliveryReceipt: boolean;
|
|
2602
2786
|
supportsReadReceipt: boolean;
|
|
2787
|
+
supportsSlashCommands: boolean;
|
|
2788
|
+
supportsNativeCommands: boolean;
|
|
2789
|
+
commandPrefix: string;
|
|
2603
2790
|
maxMessageLength: number;
|
|
2604
2791
|
maxMediaCount: number;
|
|
2605
2792
|
};
|
|
@@ -2610,8 +2797,8 @@ declare class NostrPlugin extends BaseChannelPlugin {
|
|
|
2610
2797
|
private parseContent;
|
|
2611
2798
|
private findReplyTo;
|
|
2612
2799
|
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2613
|
-
private processMessageAndGetSessionId;
|
|
2614
2800
|
private subscribeToRelay;
|
|
2801
|
+
private unsubscribeFromRelay;
|
|
2615
2802
|
private createEvent;
|
|
2616
2803
|
private computeEventId;
|
|
2617
2804
|
private signEvent;
|