@easbot/gateway 0.2.26 → 0.2.27

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { IGatewayServer, GatewayConfig as GatewayConfig$1, GatewayServerConfig as GatewayServerConfig$1, PlatformType, GatewayMessage, SubAgentConfig, ChannelInfo, ChannelListResponse, AgentAdapter } from '@easbot/types';
1
+ import { IGatewayServer, GatewayConfig as GatewayConfig$1, GatewayServerConfig as GatewayServerConfig$1, GatewayMessageReceiveInput, GatewayMessage, PlatformType, SubAgentConfig, ChannelInfo, ChannelListResponse, AgentAdapter } from '@easbot/types';
2
2
  export { AgentAdapter, AgentInfo, ChannelInfo, GatewayMessage, GatewayMessagePromptPart, IGatewayServer, IGlobal, IHookRegistry, IInstance, ISubAgentRunner, MessageContext, MessageMetadata, MessageStorage, MessageType, PlatformType } from '@easbot/types';
3
3
  import z from 'zod';
4
4
  import { WSContext } from '@easbot/utils';
@@ -55,6 +55,11 @@ declare const TelegramChannelConfigSchema: z.ZodObject<{
55
55
  enabled: z.ZodDefault<z.ZodBoolean>;
56
56
  botToken: z.ZodString;
57
57
  webhookUrl: z.ZodOptional<z.ZodString>;
58
+ polling: z.ZodOptional<z.ZodObject<{
59
+ enabled: z.ZodBoolean;
60
+ interval: z.ZodOptional<z.ZodNumber>;
61
+ timeout: z.ZodOptional<z.ZodNumber>;
62
+ }, z.core.$strip>>;
58
63
  maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
59
64
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
60
65
  }, z.core.$strip>;
@@ -125,6 +130,11 @@ declare const ChannelConfigSchema: z.ZodObject<{
125
130
  enabled: z.ZodDefault<z.ZodBoolean>;
126
131
  botToken: z.ZodString;
127
132
  webhookUrl: z.ZodOptional<z.ZodString>;
133
+ polling: z.ZodOptional<z.ZodObject<{
134
+ enabled: z.ZodBoolean;
135
+ interval: z.ZodOptional<z.ZodNumber>;
136
+ timeout: z.ZodOptional<z.ZodNumber>;
137
+ }, z.core.$strip>>;
128
138
  maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
129
139
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
130
140
  }, z.core.$strip>>;
@@ -476,6 +486,11 @@ declare const GatewayConfigSchema: z.ZodObject<{
476
486
  enabled: z.ZodDefault<z.ZodBoolean>;
477
487
  botToken: z.ZodString;
478
488
  webhookUrl: z.ZodOptional<z.ZodString>;
489
+ polling: z.ZodOptional<z.ZodObject<{
490
+ enabled: z.ZodBoolean;
491
+ interval: z.ZodOptional<z.ZodNumber>;
492
+ timeout: z.ZodOptional<z.ZodNumber>;
493
+ }, z.core.$strip>>;
479
494
  maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
480
495
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
481
496
  }, z.core.$strip>>;
@@ -657,7 +672,7 @@ declare function createGatewayMessage(sessionId: string, type: 'input' | 'output
657
672
  [key: string]: unknown;
658
673
  };
659
674
  context?: Record<string, unknown>;
660
- agent?: Record<string, unknown>;
675
+ agent?: string;
661
676
  }): GatewayMessage;
662
677
  declare function createTextMessage(sessionId: string, type: 'input' | 'output' | 'system' | 'control', text: string, metadata?: {
663
678
  channel?: {
@@ -668,9 +683,32 @@ declare function createTextMessage(sessionId: string, type: 'input' | 'output' |
668
683
  [key: string]: unknown;
669
684
  };
670
685
  context?: Record<string, unknown>;
671
- agent?: Record<string, unknown>;
686
+ agent?: string;
672
687
  }): GatewayMessage;
673
688
 
689
+ declare function convertToGatewayMessage(input: GatewayMessageReceiveInput & {
690
+ processorId?: string;
691
+ agent?: string;
692
+ proactive?: boolean;
693
+ }): GatewayMessage;
694
+
695
+ interface ChannelCapabilities {
696
+ supportsText: boolean;
697
+ supportsMedia: boolean;
698
+ supportsReply: boolean;
699
+ supportsThread: boolean;
700
+ supportsEdit: boolean;
701
+ supportsDelete: boolean;
702
+ supportsTyping: boolean;
703
+ supportsBatchSend: boolean;
704
+ supportsMarkdown: boolean;
705
+ supportsHtml: boolean;
706
+ supportsDeliveryReceipt: boolean;
707
+ supportsReadReceipt: boolean;
708
+ maxMessageLength: number;
709
+ maxMediaCount: number;
710
+ }
711
+
674
712
  interface ChannelConfig {
675
713
  enabled: boolean;
676
714
  platform: Record<string, unknown>;
@@ -698,6 +736,7 @@ interface ChannelPlugin {
698
736
  send(message: GatewayMessage): Promise<string>;
699
737
  healthCheck(): Promise<ChannelHealth>;
700
738
  getStatus(): ChannelStatus;
739
+ getCapabilities(): ChannelCapabilities;
701
740
  }
702
741
  interface MessageHandler {
703
742
  onMessage(message: GatewayMessage): Promise<void>;
@@ -716,13 +755,13 @@ interface ChannelStatus {
716
755
  error?: string;
717
756
  }
718
757
  type ChannelStatusType = 'starting' | 'running' | 'stopping' | 'stopped' | 'error' | 'reconnecting';
719
- interface ChannelEvent {
758
+ interface ChannelEvent<T = unknown> {
720
759
  type: ChannelEventType;
721
760
  channelId: string;
722
- data?: unknown;
761
+ data?: T;
723
762
  timestamp: number;
724
763
  }
725
- type ChannelEventType = 'connected' | 'disconnected' | 'reconnecting' | 'error' | 'message_received' | 'message_sent' | 'user_joined' | 'user_left';
764
+ type ChannelEventType = 'connected' | 'disconnected' | 'reconnecting' | 'error' | 'message_received' | 'message_sent' | 'message_delivered' | 'message_read' | 'user_joined' | 'user_left';
726
765
 
727
766
  interface GatewaySession {
728
767
  id: string;
@@ -838,7 +877,7 @@ interface SubscriptionOptions {
838
877
  }
839
878
  interface RouteResult {
840
879
  success: boolean;
841
- broadcastCount: number;
880
+ dispatched: boolean;
842
881
  dispatchedToSubAgent: boolean;
843
882
  error?: string;
844
883
  }
@@ -1325,16 +1364,17 @@ declare class MessageRouter {
1325
1364
  private subscriptions;
1326
1365
  private sessionSubscriptions;
1327
1366
  private channelPlugins;
1328
- private lockManager;
1329
- private retryManager;
1330
1367
  private cancelHandlers;
1331
- constructor();
1368
+ private processingMessages;
1369
+ private hookRegistry;
1370
+ constructor(hookRegistry?: typeof this.hookRegistry);
1371
+ private triggerHook;
1372
+ private triggerBeforeSend;
1332
1373
  onCancel(handler: CancelEventHandler): void;
1333
1374
  offCancel(handler: CancelEventHandler): void;
1334
1375
  private emitCancel;
1335
1376
  route(message: GatewayMessage): Promise<RouteResult>;
1336
1377
  completeMessage(sessionId: string, messageId: string, subscriberId: string, reason?: 'completed' | 'failed' | 'timeout'): Promise<void>;
1337
- scheduleRetry(message: GatewayMessage, error: Error): boolean;
1338
1378
  subscribe(sessionId: string, subscriber: Subscriber): Promise<Subscription>;
1339
1379
  unsubscribe(subscriptionId: string): Promise<void>;
1340
1380
  unsubscribeAll(subscriberId: string): Promise<void>;
@@ -1351,74 +1391,6 @@ declare class MessageRouter {
1351
1391
  shutdown(): Promise<void>;
1352
1392
  }
1353
1393
 
1354
- interface LockState {
1355
- sessionId: string;
1356
- messageId: string;
1357
- holderId: string;
1358
- acquiredAt: number;
1359
- timeout: number;
1360
- }
1361
- interface LockManagerConfig {
1362
- defaultTimeout: number;
1363
- checkInterval: number;
1364
- }
1365
- declare class MessageLockManager {
1366
- private log;
1367
- private config;
1368
- private locks;
1369
- private cleanupTimer;
1370
- constructor(config?: Partial<LockManagerConfig>);
1371
- tryAcquire(sessionId: string, messageId: string, subscriberId: string, timeout?: number): boolean;
1372
- release(sessionId: string, subscriberId: string): boolean;
1373
- forceRelease(sessionId: string): boolean;
1374
- private isLockExpired;
1375
- getLock(sessionId: string): LockState | undefined;
1376
- isLocked(sessionId: string): boolean;
1377
- getHolder(sessionId: string): string | undefined;
1378
- startCleanup(): void;
1379
- stopCleanup(): void;
1380
- cleanupExpired(): number;
1381
- getAllLocks(): LockState[];
1382
- getLockCount(): number;
1383
- }
1384
-
1385
- interface RetryPolicy {
1386
- maxRetries: number;
1387
- initialDelay: number;
1388
- maxDelay: number;
1389
- backoffMultiplier: number;
1390
- }
1391
- interface RetryRecord {
1392
- messageId: string;
1393
- retryCount: number;
1394
- nextRetryAt: number;
1395
- errors: Array<{
1396
- error: string;
1397
- timestamp: number;
1398
- }>;
1399
- }
1400
- type RetryHandler = (message: GatewayMessage) => Promise<void>;
1401
- declare class MessageRetryManager {
1402
- private log;
1403
- private policy;
1404
- private retryQueue;
1405
- private retryTimer;
1406
- private handlers;
1407
- constructor(policy?: Partial<RetryPolicy>);
1408
- registerHandler(messageId: string, handler: RetryHandler): void;
1409
- unregisterHandler(messageId: string): void;
1410
- scheduleRetry(message: GatewayMessage, error: Error): boolean;
1411
- getPendingRetries(): RetryRecord[];
1412
- executeRetry(record: RetryRecord): Promise<boolean>;
1413
- clearRetry(messageId: string): void;
1414
- startProcessing(): void;
1415
- stopProcessing(): void;
1416
- getStats(): {
1417
- pendingCount: number;
1418
- totalErrors: number;
1419
- };
1420
- }
1421
-
1422
1394
  interface SessionManagerConfig {
1423
1395
  enablePersistence: boolean;
1424
1396
  storagePath: string;
@@ -1581,6 +1553,7 @@ declare abstract class BaseChannelPlugin implements ChannelPlugin {
1581
1553
  healthCheck(): Promise<ChannelHealth>;
1582
1554
  getStatus(): ChannelStatus;
1583
1555
  abstract send(message: GatewayMessage): Promise<string>;
1556
+ getCapabilities(): ChannelCapabilities;
1584
1557
  protected abstract doStart(): Promise<void>;
1585
1558
  protected abstract doStop(): Promise<void>;
1586
1559
  protected doHealthCheck(): Promise<boolean>;
@@ -1638,8 +1611,10 @@ interface MessageRecord {
1638
1611
  error: string | null;
1639
1612
  createdAt: number;
1640
1613
  updatedAt: number;
1614
+ deliveredAt: number | null;
1615
+ readAt: number | null;
1641
1616
  }
1642
- type MessageStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
1617
+ type MessageStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled' | 'delivered' | 'read';
1643
1618
  interface MessageStoreConfig {
1644
1619
  storagePath: string;
1645
1620
  maxRetentionDays: number;
@@ -1665,18 +1640,20 @@ declare class MessageStore {
1665
1640
  private sanitizeFileName;
1666
1641
  private startCleanupTimer;
1667
1642
  private performCleanup;
1668
- store(message: GatewayMessage): Promise<MessageRecord>;
1643
+ store(message: GatewayMessage, initialStatus?: MessageStatus): Promise<MessageRecord>;
1669
1644
  private saveMessageToFile;
1670
1645
  get(messageId: string): MessageRecord | undefined;
1671
1646
  updateStatus(messageId: string, status: MessageStatus, options?: {
1672
1647
  processedBy?: string;
1673
1648
  error?: string;
1649
+ deliveredAt?: number;
1650
+ readAt?: number;
1674
1651
  }): Promise<void>;
1675
1652
  incrementRetry(messageId: string): Promise<number>;
1676
1653
  isProcessed(messageId: string): boolean;
1677
1654
  getSessionHistory(sessionId: string, limit?: number): MessageRecord[];
1678
- getPendingMessages(sessionId?: string): MessageRecord[];
1679
- getFailedMessages(maxRetries?: number): MessageRecord[];
1655
+ getPendingMessages(sessionId?: string, type?: string): MessageRecord[];
1656
+ getFailedMessages(maxRetries?: number, type?: string): MessageRecord[];
1680
1657
  cleanup(): number;
1681
1658
  private evictLRU;
1682
1659
  private updateAccessOrder;
@@ -1688,6 +1665,8 @@ declare class MessageStore {
1688
1665
  completed: number;
1689
1666
  failed: number;
1690
1667
  cancelled: number;
1668
+ delivered: number;
1669
+ read: number;
1691
1670
  sessions: number;
1692
1671
  };
1693
1672
  close(): Promise<void>;
@@ -1780,7 +1759,9 @@ interface ResolveChannelParams {
1780
1759
  fallbackChannels?: string[] | null;
1781
1760
  sessionManager?: {
1782
1761
  get(sessionId: string): GatewaySession | undefined;
1762
+ getOrCreate(channelInfo: SessionChannelInfo, context?: Record<string, unknown>): Promise<GatewaySession>;
1783
1763
  bindBackendSession(gatewaySessionId: string, backendSessionId: string): Promise<void>;
1764
+ getAll?(): GatewaySession[];
1784
1765
  };
1785
1766
  pluginLoader?: {
1786
1767
  getPlugin(pluginId: string): ChannelPlugin | undefined;
@@ -1829,7 +1810,9 @@ interface ResolveChannelParams {
1829
1810
  };
1830
1811
  }
1831
1812
 
1832
- type MessageSender = (pluginId: string, message: GatewayMessage) => Promise<string>;
1813
+ type MessageSender = (pluginId: string, message: GatewayMessage, options?: SendOptions) => Promise<string>;
1814
+ interface SendOptions extends Record<string, unknown> {
1815
+ }
1833
1816
  declare class GatewayWebSocketServer {
1834
1817
  private config;
1835
1818
  private server;
@@ -1847,12 +1830,8 @@ declare class GatewayWebSocketServer {
1847
1830
  private channelResolveParams;
1848
1831
  constructor(config?: Partial<GatewayServerConfig>);
1849
1832
  setChannelResolveDeps(params: ResolveChannelParams): void;
1850
- setMessageSender(sender: MessageSender): void;
1851
- private messageSender;
1852
1833
  private pluginLoaderRef;
1853
- setPluginLoader(loader: {
1854
- send(pluginId: string, message: GatewayMessage): Promise<string>;
1855
- }): void;
1834
+ setPluginLoader(sender: MessageSender): void;
1856
1835
  private getChannelResolveParams;
1857
1836
  start(): Promise<void>;
1858
1837
  private startHTTPServer;
@@ -1885,6 +1864,8 @@ declare class GatewayWebSocketServer {
1885
1864
  }
1886
1865
 
1887
1866
  declare class GatewayServer implements IGatewayServer {
1867
+ private static readonly MAX_RETRY_COUNT;
1868
+ private static readonly SEVEN_DAYS_MS;
1888
1869
  private log;
1889
1870
  private config;
1890
1871
  private router;
@@ -1909,29 +1890,18 @@ declare class GatewayServer implements IGatewayServer {
1909
1890
  private saveContactFromMessage;
1910
1891
  private dispatchToSubAgent;
1911
1892
  private triggerHook;
1893
+ private retryPendingMessages;
1912
1894
  private storeMessage;
1913
- processMessage(sessionId: string, messageId: string, processorId: string, options?: {
1914
- processType?: 'subagent' | 'direct' | 'tool';
1915
- agent?: string;
1916
- }): Promise<void>;
1917
- completeMessage(sessionId: string, messageId: string, processorId: string, options?: {
1918
- success?: boolean;
1919
- error?: string;
1920
- responseMessageId?: string;
1921
- tokens?: number;
1922
- duration?: number;
1923
- }): Promise<void>;
1924
1895
  onEvent(event: ChannelEvent): Promise<void>;
1925
1896
  registerChannel(plugin: ChannelPlugin, config?: ChannelConfig): Promise<void>;
1926
1897
  unregisterChannel(pluginId: string): Promise<void>;
1927
1898
  subscribe(sessionId: string, subscriber: Subscriber): Promise<void>;
1928
1899
  unsubscribe(subscriptionId: string): Promise<void>;
1929
- send(message: GatewayMessage): Promise<void>;
1930
- sendToChannel(pluginId: string, message: GatewayMessage, options?: {
1931
- proactive?: boolean;
1932
- replyToMessageId?: string;
1900
+ sendToChannel(pluginId: string, message: GatewayMessage, options?: Record<string, unknown>): Promise<string>;
1901
+ sendProactiveMessage(pluginId: string, sessionId: string, content: GatewayMessage['content'], channel: ChannelInfo, options?: {
1902
+ processorId?: string;
1903
+ agent?: string;
1933
1904
  }): Promise<string>;
1934
- sendProactiveMessage(pluginId: string, sessionId: string, content: GatewayMessage['content'], channel: ChannelInfo): Promise<string>;
1935
1905
  getSessionManager(): GatewaySessionManager;
1936
1906
  getRouter(): MessageRouter;
1937
1907
  getPluginLoader(): ChannelPluginLoader;
@@ -1991,6 +1961,8 @@ interface SessionInfo {
1991
1961
  channelId?: string;
1992
1962
  userId?: string;
1993
1963
  chatId?: string;
1964
+ chatType?: string;
1965
+ chatTitle?: string;
1994
1966
  state: string;
1995
1967
  createdAt: number;
1996
1968
  lastActiveAt: number;
@@ -2103,7 +2075,10 @@ declare class GatewayClient {
2103
2075
  }>;
2104
2076
  channel?: string;
2105
2077
  userId?: string;
2078
+ chatId?: string;
2106
2079
  messageType?: string;
2080
+ processorId?: string;
2081
+ agent?: string;
2107
2082
  }): Promise<SendMessageResponse>;
2108
2083
  }
2109
2084
 
@@ -2173,12 +2148,33 @@ declare class TelegramPlugin extends BaseChannelPlugin {
2173
2148
  private abortController;
2174
2149
  private lastUpdateId;
2175
2150
  private typingTimers;
2151
+ private sentMessages;
2152
+ private sessionIdMap;
2176
2153
  private commandRouter;
2177
2154
  private retryState;
2178
2155
  constructor(id?: string);
2179
2156
  protected doStart(): Promise<void>;
2180
2157
  protected doStop(): Promise<void>;
2181
2158
  send(message: GatewayMessage): Promise<string>;
2159
+ private sendPhoto;
2160
+ private sendDocument;
2161
+ private isParseError;
2162
+ getCapabilities(): {
2163
+ supportsText: boolean;
2164
+ supportsMedia: boolean;
2165
+ supportsReply: boolean;
2166
+ supportsThread: boolean;
2167
+ supportsEdit: boolean;
2168
+ supportsDelete: boolean;
2169
+ supportsTyping: boolean;
2170
+ supportsBatchSend: boolean;
2171
+ supportsMarkdown: boolean;
2172
+ supportsHtml: boolean;
2173
+ supportsDeliveryReceipt: boolean;
2174
+ supportsReadReceipt: boolean;
2175
+ maxMessageLength: number;
2176
+ maxMediaCount: number;
2177
+ };
2182
2178
  sendTyping(chatId: string): Promise<void>;
2183
2179
  sendChatAction(chatId: string, action: 'typing' | 'upload_photo' | 'upload_document' | 'record_video' | 'upload_video' | 'record_audio' | 'upload_audio'): Promise<void>;
2184
2180
  private scheduleTypingStop;
@@ -2187,11 +2183,16 @@ declare class TelegramPlugin extends BaseChannelPlugin {
2187
2183
  private startPolling;
2188
2184
  private pollLoop;
2189
2185
  private poll;
2186
+ private handleMessageReaction;
2187
+ private handleMessageReactionCount;
2188
+ private findSentMessageEntry;
2190
2189
  private handlePollingError;
2191
2190
  private sleep;
2192
2191
  private handleTelegramMessage;
2193
2192
  private handleCommand;
2194
2193
  private toGatewayMessage;
2194
+ private parseFileContent;
2195
+ private downloadBinaryFile;
2195
2196
  private parseContent;
2196
2197
  protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
2197
2198
  private processMessageAndGetSessionId;
@@ -2231,6 +2232,22 @@ declare class DiscordPlugin extends BaseChannelPlugin {
2231
2232
  protected doStart(): Promise<void>;
2232
2233
  protected doStop(): Promise<void>;
2233
2234
  send(message: GatewayMessage): Promise<string>;
2235
+ getCapabilities(): {
2236
+ supportsText: boolean;
2237
+ supportsMedia: boolean;
2238
+ supportsReply: boolean;
2239
+ supportsThread: boolean;
2240
+ supportsEdit: boolean;
2241
+ supportsDelete: boolean;
2242
+ supportsTyping: boolean;
2243
+ supportsBatchSend: boolean;
2244
+ supportsMarkdown: boolean;
2245
+ supportsHtml: boolean;
2246
+ supportsDeliveryReceipt: boolean;
2247
+ supportsReadReceipt: boolean;
2248
+ maxMessageLength: number;
2249
+ maxMediaCount: number;
2250
+ };
2234
2251
  private startGateway;
2235
2252
  private handleGatewayMessage;
2236
2253
  private handleHello;
@@ -2269,6 +2286,22 @@ declare class SlackPlugin extends BaseChannelPlugin {
2269
2286
  protected doStart(): Promise<void>;
2270
2287
  protected doStop(): Promise<void>;
2271
2288
  send(message: GatewayMessage): Promise<string>;
2289
+ getCapabilities(): {
2290
+ supportsText: boolean;
2291
+ supportsMedia: boolean;
2292
+ supportsReply: boolean;
2293
+ supportsThread: boolean;
2294
+ supportsEdit: boolean;
2295
+ supportsDelete: boolean;
2296
+ supportsTyping: boolean;
2297
+ supportsBatchSend: boolean;
2298
+ supportsMarkdown: boolean;
2299
+ supportsHtml: boolean;
2300
+ supportsDeliveryReceipt: boolean;
2301
+ supportsReadReceipt: boolean;
2302
+ maxMessageLength: number;
2303
+ maxMediaCount: number;
2304
+ };
2272
2305
  private startSocketMode;
2273
2306
  private handleSocketModeEvent;
2274
2307
  private handleSlackMessage;
@@ -2331,6 +2364,22 @@ declare class FeishuPlugin extends BaseChannelPlugin {
2331
2364
  protected doStart(): Promise<void>;
2332
2365
  protected doStop(): Promise<void>;
2333
2366
  send(message: GatewayMessage): Promise<string>;
2367
+ getCapabilities(): {
2368
+ supportsText: boolean;
2369
+ supportsMedia: boolean;
2370
+ supportsReply: boolean;
2371
+ supportsThread: boolean;
2372
+ supportsEdit: boolean;
2373
+ supportsDelete: boolean;
2374
+ supportsTyping: boolean;
2375
+ supportsBatchSend: boolean;
2376
+ supportsMarkdown: boolean;
2377
+ supportsHtml: boolean;
2378
+ supportsDeliveryReceipt: boolean;
2379
+ supportsReadReceipt: boolean;
2380
+ maxMessageLength: number;
2381
+ maxMediaCount: number;
2382
+ };
2334
2383
  handleWebhookEvent(event: FeishuMessageEvent): Promise<void>;
2335
2384
  private toGatewayMessage;
2336
2385
  private parseContent;
@@ -2367,6 +2416,22 @@ declare class WeChatPlugin extends BaseChannelPlugin {
2367
2416
  protected doStart(): Promise<void>;
2368
2417
  protected doStop(): Promise<void>;
2369
2418
  send(message: GatewayMessage): Promise<string>;
2419
+ getCapabilities(): {
2420
+ supportsText: boolean;
2421
+ supportsMedia: boolean;
2422
+ supportsReply: boolean;
2423
+ supportsThread: boolean;
2424
+ supportsEdit: boolean;
2425
+ supportsDelete: boolean;
2426
+ supportsTyping: boolean;
2427
+ supportsBatchSend: boolean;
2428
+ supportsMarkdown: boolean;
2429
+ supportsHtml: boolean;
2430
+ supportsDeliveryReceipt: boolean;
2431
+ supportsReadReceipt: boolean;
2432
+ maxMessageLength: number;
2433
+ maxMediaCount: number;
2434
+ };
2370
2435
  handleWebhookMessage(xmlData: string): Promise<void>;
2371
2436
  private parseXmlMessage;
2372
2437
  private toGatewayMessage;
@@ -2404,10 +2469,27 @@ declare class WebChatPlugin extends BaseChannelPlugin {
2404
2469
  private startWebSocketServer;
2405
2470
  protected doStop(): Promise<void>;
2406
2471
  send(message: GatewayMessage): Promise<string>;
2472
+ getCapabilities(): {
2473
+ supportsText: boolean;
2474
+ supportsMedia: boolean;
2475
+ supportsReply: boolean;
2476
+ supportsThread: boolean;
2477
+ supportsEdit: boolean;
2478
+ supportsDelete: boolean;
2479
+ supportsTyping: boolean;
2480
+ supportsBatchSend: boolean;
2481
+ supportsMarkdown: boolean;
2482
+ supportsHtml: boolean;
2483
+ supportsDeliveryReceipt: boolean;
2484
+ supportsReadReceipt: boolean;
2485
+ maxMessageLength: number;
2486
+ maxMediaCount: number;
2487
+ };
2407
2488
  pushEvent(sessionId: string, event: SessionEventPayload): void;
2408
2489
  getWebSocketServer(): GatewayWebSocketServer | null;
2409
2490
  handleConnection(ws: WebSocket, userId: string): Promise<void>;
2410
2491
  private handleWebSocketMessage;
2492
+ private handleMessageAcknowledgment;
2411
2493
  private handleChatMessage;
2412
2494
  private startHeartbeat;
2413
2495
  private findConnectionByUser;
@@ -2438,6 +2520,22 @@ declare class SignalPlugin extends BaseChannelPlugin {
2438
2520
  protected doStart(): Promise<void>;
2439
2521
  protected doStop(): Promise<void>;
2440
2522
  send(message: GatewayMessage): Promise<string>;
2523
+ getCapabilities(): {
2524
+ supportsText: boolean;
2525
+ supportsMedia: boolean;
2526
+ supportsReply: boolean;
2527
+ supportsThread: boolean;
2528
+ supportsEdit: boolean;
2529
+ supportsDelete: boolean;
2530
+ supportsTyping: boolean;
2531
+ supportsBatchSend: boolean;
2532
+ supportsMarkdown: boolean;
2533
+ supportsHtml: boolean;
2534
+ supportsDeliveryReceipt: boolean;
2535
+ supportsReadReceipt: boolean;
2536
+ maxMessageLength: number;
2537
+ maxMediaCount: number;
2538
+ };
2441
2539
  private startPolling;
2442
2540
  private pollLoop;
2443
2541
  private poll;
@@ -2473,6 +2571,22 @@ declare class NostrPlugin extends BaseChannelPlugin {
2473
2571
  protected doStart(): Promise<void>;
2474
2572
  protected doStop(): Promise<void>;
2475
2573
  send(message: GatewayMessage): Promise<string>;
2574
+ getCapabilities(): {
2575
+ supportsText: boolean;
2576
+ supportsMedia: boolean;
2577
+ supportsReply: boolean;
2578
+ supportsThread: boolean;
2579
+ supportsEdit: boolean;
2580
+ supportsDelete: boolean;
2581
+ supportsTyping: boolean;
2582
+ supportsBatchSend: boolean;
2583
+ supportsMarkdown: boolean;
2584
+ supportsHtml: boolean;
2585
+ supportsDeliveryReceipt: boolean;
2586
+ supportsReadReceipt: boolean;
2587
+ maxMessageLength: number;
2588
+ maxMediaCount: number;
2589
+ };
2476
2590
  private connectToRelay;
2477
2591
  private handleRelayMessage;
2478
2592
  private handleNostrEvent;
@@ -2563,4 +2677,4 @@ declare function initLog(options: {
2563
2677
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
2564
2678
  }): Promise<void>;
2565
2679
 
2566
- export { type AgentDeregisterMessage, type AgentHealthStatus, type AgentHeartbeat, type AgentHeartbeatSyncMessage, type AgentListRequestMessage, type AgentListResponseMessage, type AgentRegisterMessage, type AgentRegistration, type AgentRegistrationRequest, AgentRegistry, type AgentRegistryConfig, AgentRegistryConfigSchema, type AgentRegistryStats, type AgentSelectionOptions, type AgentSelectionRecord, type AgentSelectionStrategy, type AgentStatusChangeMessage, type AgentSyncConfig, AgentSyncConfigSchema, type AgentSyncInfo, AgentSyncManager, type AuthConfig, AuthConfigSchema, type AuthResult, BaseChannelPlugin, type CancelEvent, type CancelEventHandler, type ChannelConfig, ChannelConfigSchema, type ChannelEvent, type ChannelEventType, type ChannelHealth, type ChannelPlugin, ChannelPluginLoader, ChannelPluginRegistry, type SessionConfig as ChannelSessionConfig, type ChannelStatus, type ChannelStatusType, type ChannelType, type CircuitBreakerConfig, CircuitBreakerConfigSchema, type ConnectionState as ClientConnectionState, type ClientInitializeMessage, type ClientInterruptMessage, type ClientMessage, type ClientMessageMessage, type ClientMessageType, type ClientPingMessage, type ClientReleaseSubscriptionMessage, type ClientSubscribeMessage, type ClientSubscription, type ClientUnsubscribeMessage, type ConflictResolutionStrategy, type ConnectionCloser, type ConnectionFactory, type ConnectionHealthChecker, type ConnectionPoolConfig, ConnectionPoolConfigSchema, type ConnectionPoolEvent, type ConnectionPoolEventCallback, type ConnectionPoolEventType, type ConnectionPoolStats, type ConnectionState$1 as ConnectionState, type ContactInfo, type ContactListResponse, type CreateSessionRequest, type CreateSessionResponse$1 as CreateSessionResponse, DEFAULT_AGENT_REGISTRY_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TOKEN_AUTH_CONFIG, DEFAULT_WEBSOCKET_SERVER_CONFIG, type DiscordBotConfig, DiscordPlugin, type FeishuBotConfig, type FeishuChannelConfig, FeishuChannelConfigSchema, FeishuPlugin, Gateway, GatewayClient, type GatewayClientConfig, type GatewayClusterConfig, GatewayClusterConfigSchema, type GatewayConfig, GatewayConfigSchema, type GatewayNodeConfig, type GatewayNodeInfo, GatewayServer, type GatewayServerConfig, GatewayServerConfigSchema, type GatewaySession, GatewaySessionManager, type HTTPSConfig, HTTPSConfigSchema, type HealthCheckResponse, type HealthResponse, type IAuthProvider, type MessageCallback, type MessageHandler, MessageLockManager, type MessagePriority, type MessageQueueConfig, MessageQueueConfigSchema, type MessageRecord, MessageRetryManager, MessageRouter, type MessageStatus, MessageStore, type MessageStoreConfig, type NostrBotConfig, type NostrChannelConfig, NostrChannelConfigSchema, NostrPlugin, type OAuth2AuthConfig, type PluginLoaderConfig, type PooledConnection, type PushEventType, type RouteResult, type RoutingConfig, type SendMessageRequest, type SendMessageResponse$1 as SendMessageResponse, type SerializableSession, type ServerConnectedMessage, type ServerErrorMessage, type ServerEventMessage, type ServerInitializeResponseMessage, type ServerInterruptedMessage, type ServerMessage, type ServerMessageType, type ServerPongMessage, type ServerResponseMessage, type ServerSessionClosedMessage, type ServerStatusResponse, type ServerSubscribedMessage, type ServerSubscriptionReleasedMessage, type ServerUnsubscribedMessage, type SessionChannelInfo, type SessionConfig$1 as SessionConfig, SessionConfigSchema, type SessionContext, type SessionEventPayload, type SessionEventType, type SessionFilter, type SessionInfo, type SessionListResponse, type SessionManagerConfig, type SessionResetPolicy, type SessionState, type SessionStatusType, SessionStore, type SessionStoreConfig, type SignalBotConfig, type SignalChannelConfig, SignalChannelConfigSchema, SignalPlugin, type SlackBotConfig, type SlackChannelConfig, SlackChannelConfigSchema, SlackPlugin, type StatusResponse, type Subscriber, type SubscriberConnection, type SubscriberType, type Subscription, type SubscriptionOptions, type SubscriptionsResponse, type SyncConfig, type SyncMessage, type SyncMode, type SyncState, type SyncStats, type TelegramBotConfig, type TelegramChannelConfig, TelegramChannelConfigSchema, TelegramPlugin, type TokenAuthConfig, type TokenAuthItem, type TokenConfig, type WeChatBotConfig, type WeChatChannelConfig, WeChatChannelConfigSchema, WeChatPlugin, type WebChatChannelConfig, WebChatChannelConfigSchema, type WebChatConfig, WebChatPlugin, type WebSocketConnectionInfo, type WebSocketConnectionState, type WebSocketMessage, type WebSocketMessageBase, clearConfigCache, createChannelPlugin, createDefaultSessionState, createGatewayMessage, createTextMessage, generateSessionId, generateSubscriptionId, getAgentAdapter, getAgentRegistryConfig, getAuthConfig, getChannelConfig, getCircuitBreakerConfig, getClusterConfig, getConfig, getConfigDirectory, getConnectionPoolConfig, getDefaultAgent, getHTTPSConfig, getLogLevel, getMessageQueueConfig, getServerConfig, getSessionConfig, getSupportedPlatforms, hasAgentAdapter, initLog, isConfigLoaded, loadConfig, parsePartialConfig, requireAgentAdapter, setAgentAdapter, validateConfig };
2680
+ export { type AgentDeregisterMessage, type AgentHealthStatus, type AgentHeartbeat, type AgentHeartbeatSyncMessage, type AgentListRequestMessage, type AgentListResponseMessage, type AgentRegisterMessage, type AgentRegistration, type AgentRegistrationRequest, AgentRegistry, type AgentRegistryConfig, AgentRegistryConfigSchema, type AgentRegistryStats, type AgentSelectionOptions, type AgentSelectionRecord, type AgentSelectionStrategy, type AgentStatusChangeMessage, type AgentSyncConfig, AgentSyncConfigSchema, type AgentSyncInfo, AgentSyncManager, type AuthConfig, AuthConfigSchema, type AuthResult, BaseChannelPlugin, type CancelEvent, type CancelEventHandler, type ChannelConfig, ChannelConfigSchema, type ChannelEvent, type ChannelEventType, type ChannelHealth, type ChannelPlugin, ChannelPluginLoader, ChannelPluginRegistry, type SessionConfig as ChannelSessionConfig, type ChannelStatus, type ChannelStatusType, type ChannelType, type CircuitBreakerConfig, CircuitBreakerConfigSchema, type ConnectionState as ClientConnectionState, type ClientInitializeMessage, type ClientInterruptMessage, type ClientMessage, type ClientMessageMessage, type ClientMessageType, type ClientPingMessage, type ClientReleaseSubscriptionMessage, type ClientSubscribeMessage, type ClientSubscription, type ClientUnsubscribeMessage, type ConflictResolutionStrategy, type ConnectionCloser, type ConnectionFactory, type ConnectionHealthChecker, type ConnectionPoolConfig, ConnectionPoolConfigSchema, type ConnectionPoolEvent, type ConnectionPoolEventCallback, type ConnectionPoolEventType, type ConnectionPoolStats, type ConnectionState$1 as ConnectionState, type ContactInfo, type ContactListResponse, type CreateSessionRequest, type CreateSessionResponse$1 as CreateSessionResponse, DEFAULT_AGENT_REGISTRY_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TOKEN_AUTH_CONFIG, DEFAULT_WEBSOCKET_SERVER_CONFIG, type DiscordBotConfig, DiscordPlugin, type FeishuBotConfig, type FeishuChannelConfig, FeishuChannelConfigSchema, FeishuPlugin, Gateway, GatewayClient, type GatewayClientConfig, type GatewayClusterConfig, GatewayClusterConfigSchema, type GatewayConfig, GatewayConfigSchema, type GatewayNodeConfig, type GatewayNodeInfo, GatewayServer, type GatewayServerConfig, GatewayServerConfigSchema, type GatewaySession, GatewaySessionManager, type HTTPSConfig, HTTPSConfigSchema, type HealthCheckResponse, type HealthResponse, type IAuthProvider, type MessageCallback, type MessageHandler, type MessagePriority, type MessageQueueConfig, MessageQueueConfigSchema, type MessageRecord, MessageRouter, type MessageStatus, MessageStore, type MessageStoreConfig, type NostrBotConfig, type NostrChannelConfig, NostrChannelConfigSchema, NostrPlugin, type OAuth2AuthConfig, type PluginLoaderConfig, type PooledConnection, type PushEventType, type RouteResult, type RoutingConfig, type SendMessageRequest, type SendMessageResponse$1 as SendMessageResponse, type SerializableSession, type ServerConnectedMessage, type ServerErrorMessage, type ServerEventMessage, type ServerInitializeResponseMessage, type ServerInterruptedMessage, type ServerMessage, type ServerMessageType, type ServerPongMessage, type ServerResponseMessage, type ServerSessionClosedMessage, type ServerStatusResponse, type ServerSubscribedMessage, type ServerSubscriptionReleasedMessage, type ServerUnsubscribedMessage, type SessionChannelInfo, type SessionConfig$1 as SessionConfig, SessionConfigSchema, type SessionContext, type SessionEventPayload, type SessionEventType, type SessionFilter, type SessionInfo, type SessionListResponse, type SessionManagerConfig, type SessionResetPolicy, type SessionState, type SessionStatusType, SessionStore, type SessionStoreConfig, type SignalBotConfig, type SignalChannelConfig, SignalChannelConfigSchema, SignalPlugin, type SlackBotConfig, type SlackChannelConfig, SlackChannelConfigSchema, SlackPlugin, type StatusResponse, type Subscriber, type SubscriberConnection, type SubscriberType, type Subscription, type SubscriptionOptions, type SubscriptionsResponse, type SyncConfig, type SyncMessage, type SyncMode, type SyncState, type SyncStats, type TelegramBotConfig, type TelegramChannelConfig, TelegramChannelConfigSchema, TelegramPlugin, type TokenAuthConfig, type TokenAuthItem, type TokenConfig, type WeChatBotConfig, type WeChatChannelConfig, WeChatChannelConfigSchema, WeChatPlugin, type WebChatChannelConfig, WebChatChannelConfigSchema, type WebChatConfig, WebChatPlugin, type WebSocketConnectionInfo, type WebSocketConnectionState, type WebSocketMessage, type WebSocketMessageBase, clearConfigCache, convertToGatewayMessage, createChannelPlugin, createDefaultSessionState, createGatewayMessage, createTextMessage, generateSessionId, generateSubscriptionId, getAgentAdapter, getAgentRegistryConfig, getAuthConfig, getChannelConfig, getCircuitBreakerConfig, getClusterConfig, getConfig, getConfigDirectory, getConnectionPoolConfig, getDefaultAgent, getHTTPSConfig, getLogLevel, getMessageQueueConfig, getServerConfig, getSessionConfig, getSupportedPlatforms, hasAgentAdapter, initLog, isConfigLoaded, loadConfig, parsePartialConfig, requireAgentAdapter, setAgentAdapter, validateConfig };