@easbot/gateway 0.2.26 → 0.2.28

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.cts 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;
@@ -2074,14 +2046,19 @@ declare class GatewayClient {
2074
2046
  subscriberCount?: number;
2075
2047
  }>;
2076
2048
  createSession(params?: {
2077
- channel?: string;
2078
- userId?: string;
2079
- platform?: string;
2049
+ title?: string;
2050
+ channel?: {
2051
+ platform?: string;
2052
+ channelId?: string;
2053
+ userId?: string;
2054
+ chatId?: string;
2055
+ };
2080
2056
  }): Promise<CreateSessionResponse>;
2081
2057
  getOrCreateSession(options: {
2082
2058
  sessionId?: string;
2083
2059
  channel?: string;
2084
2060
  userId?: string;
2061
+ chatId?: string;
2085
2062
  platform?: string;
2086
2063
  }): Promise<{
2087
2064
  sessionId: string;
@@ -2093,6 +2070,7 @@ declare class GatewayClient {
2093
2070
  platform?: string;
2094
2071
  channelId?: string;
2095
2072
  userId?: string;
2073
+ chatId?: string;
2096
2074
  }): Promise<SessionListResponse>;
2097
2075
  sendMessage(sessionId: string, message: {
2098
2076
  content: Array<{
@@ -2103,7 +2081,10 @@ declare class GatewayClient {
2103
2081
  }>;
2104
2082
  channel?: string;
2105
2083
  userId?: string;
2084
+ chatId?: string;
2106
2085
  messageType?: string;
2086
+ processorId?: string;
2087
+ agent?: string;
2107
2088
  }): Promise<SendMessageResponse>;
2108
2089
  }
2109
2090
 
@@ -2173,12 +2154,33 @@ declare class TelegramPlugin extends BaseChannelPlugin {
2173
2154
  private abortController;
2174
2155
  private lastUpdateId;
2175
2156
  private typingTimers;
2157
+ private sentMessages;
2158
+ private sessionIdMap;
2176
2159
  private commandRouter;
2177
2160
  private retryState;
2178
2161
  constructor(id?: string);
2179
2162
  protected doStart(): Promise<void>;
2180
2163
  protected doStop(): Promise<void>;
2181
2164
  send(message: GatewayMessage): Promise<string>;
2165
+ private sendPhoto;
2166
+ private sendDocument;
2167
+ private isParseError;
2168
+ getCapabilities(): {
2169
+ supportsText: boolean;
2170
+ supportsMedia: boolean;
2171
+ supportsReply: boolean;
2172
+ supportsThread: boolean;
2173
+ supportsEdit: boolean;
2174
+ supportsDelete: boolean;
2175
+ supportsTyping: boolean;
2176
+ supportsBatchSend: boolean;
2177
+ supportsMarkdown: boolean;
2178
+ supportsHtml: boolean;
2179
+ supportsDeliveryReceipt: boolean;
2180
+ supportsReadReceipt: boolean;
2181
+ maxMessageLength: number;
2182
+ maxMediaCount: number;
2183
+ };
2182
2184
  sendTyping(chatId: string): Promise<void>;
2183
2185
  sendChatAction(chatId: string, action: 'typing' | 'upload_photo' | 'upload_document' | 'record_video' | 'upload_video' | 'record_audio' | 'upload_audio'): Promise<void>;
2184
2186
  private scheduleTypingStop;
@@ -2187,11 +2189,16 @@ declare class TelegramPlugin extends BaseChannelPlugin {
2187
2189
  private startPolling;
2188
2190
  private pollLoop;
2189
2191
  private poll;
2192
+ private handleMessageReaction;
2193
+ private handleMessageReactionCount;
2194
+ private findSentMessageEntry;
2190
2195
  private handlePollingError;
2191
2196
  private sleep;
2192
2197
  private handleTelegramMessage;
2193
2198
  private handleCommand;
2194
2199
  private toGatewayMessage;
2200
+ private parseFileContent;
2201
+ private downloadBinaryFile;
2195
2202
  private parseContent;
2196
2203
  protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
2197
2204
  private processMessageAndGetSessionId;
@@ -2231,6 +2238,22 @@ declare class DiscordPlugin extends BaseChannelPlugin {
2231
2238
  protected doStart(): Promise<void>;
2232
2239
  protected doStop(): Promise<void>;
2233
2240
  send(message: GatewayMessage): Promise<string>;
2241
+ getCapabilities(): {
2242
+ supportsText: boolean;
2243
+ supportsMedia: boolean;
2244
+ supportsReply: boolean;
2245
+ supportsThread: boolean;
2246
+ supportsEdit: boolean;
2247
+ supportsDelete: boolean;
2248
+ supportsTyping: boolean;
2249
+ supportsBatchSend: boolean;
2250
+ supportsMarkdown: boolean;
2251
+ supportsHtml: boolean;
2252
+ supportsDeliveryReceipt: boolean;
2253
+ supportsReadReceipt: boolean;
2254
+ maxMessageLength: number;
2255
+ maxMediaCount: number;
2256
+ };
2234
2257
  private startGateway;
2235
2258
  private handleGatewayMessage;
2236
2259
  private handleHello;
@@ -2269,6 +2292,22 @@ declare class SlackPlugin extends BaseChannelPlugin {
2269
2292
  protected doStart(): Promise<void>;
2270
2293
  protected doStop(): Promise<void>;
2271
2294
  send(message: GatewayMessage): Promise<string>;
2295
+ getCapabilities(): {
2296
+ supportsText: boolean;
2297
+ supportsMedia: boolean;
2298
+ supportsReply: boolean;
2299
+ supportsThread: boolean;
2300
+ supportsEdit: boolean;
2301
+ supportsDelete: boolean;
2302
+ supportsTyping: boolean;
2303
+ supportsBatchSend: boolean;
2304
+ supportsMarkdown: boolean;
2305
+ supportsHtml: boolean;
2306
+ supportsDeliveryReceipt: boolean;
2307
+ supportsReadReceipt: boolean;
2308
+ maxMessageLength: number;
2309
+ maxMediaCount: number;
2310
+ };
2272
2311
  private startSocketMode;
2273
2312
  private handleSocketModeEvent;
2274
2313
  private handleSlackMessage;
@@ -2331,6 +2370,22 @@ declare class FeishuPlugin extends BaseChannelPlugin {
2331
2370
  protected doStart(): Promise<void>;
2332
2371
  protected doStop(): Promise<void>;
2333
2372
  send(message: GatewayMessage): Promise<string>;
2373
+ getCapabilities(): {
2374
+ supportsText: boolean;
2375
+ supportsMedia: boolean;
2376
+ supportsReply: boolean;
2377
+ supportsThread: boolean;
2378
+ supportsEdit: boolean;
2379
+ supportsDelete: boolean;
2380
+ supportsTyping: boolean;
2381
+ supportsBatchSend: boolean;
2382
+ supportsMarkdown: boolean;
2383
+ supportsHtml: boolean;
2384
+ supportsDeliveryReceipt: boolean;
2385
+ supportsReadReceipt: boolean;
2386
+ maxMessageLength: number;
2387
+ maxMediaCount: number;
2388
+ };
2334
2389
  handleWebhookEvent(event: FeishuMessageEvent): Promise<void>;
2335
2390
  private toGatewayMessage;
2336
2391
  private parseContent;
@@ -2367,6 +2422,22 @@ declare class WeChatPlugin extends BaseChannelPlugin {
2367
2422
  protected doStart(): Promise<void>;
2368
2423
  protected doStop(): Promise<void>;
2369
2424
  send(message: GatewayMessage): Promise<string>;
2425
+ getCapabilities(): {
2426
+ supportsText: boolean;
2427
+ supportsMedia: boolean;
2428
+ supportsReply: boolean;
2429
+ supportsThread: boolean;
2430
+ supportsEdit: boolean;
2431
+ supportsDelete: boolean;
2432
+ supportsTyping: boolean;
2433
+ supportsBatchSend: boolean;
2434
+ supportsMarkdown: boolean;
2435
+ supportsHtml: boolean;
2436
+ supportsDeliveryReceipt: boolean;
2437
+ supportsReadReceipt: boolean;
2438
+ maxMessageLength: number;
2439
+ maxMediaCount: number;
2440
+ };
2370
2441
  handleWebhookMessage(xmlData: string): Promise<void>;
2371
2442
  private parseXmlMessage;
2372
2443
  private toGatewayMessage;
@@ -2404,10 +2475,27 @@ declare class WebChatPlugin extends BaseChannelPlugin {
2404
2475
  private startWebSocketServer;
2405
2476
  protected doStop(): Promise<void>;
2406
2477
  send(message: GatewayMessage): Promise<string>;
2478
+ getCapabilities(): {
2479
+ supportsText: boolean;
2480
+ supportsMedia: boolean;
2481
+ supportsReply: boolean;
2482
+ supportsThread: boolean;
2483
+ supportsEdit: boolean;
2484
+ supportsDelete: boolean;
2485
+ supportsTyping: boolean;
2486
+ supportsBatchSend: boolean;
2487
+ supportsMarkdown: boolean;
2488
+ supportsHtml: boolean;
2489
+ supportsDeliveryReceipt: boolean;
2490
+ supportsReadReceipt: boolean;
2491
+ maxMessageLength: number;
2492
+ maxMediaCount: number;
2493
+ };
2407
2494
  pushEvent(sessionId: string, event: SessionEventPayload): void;
2408
2495
  getWebSocketServer(): GatewayWebSocketServer | null;
2409
2496
  handleConnection(ws: WebSocket, userId: string): Promise<void>;
2410
2497
  private handleWebSocketMessage;
2498
+ private handleMessageAcknowledgment;
2411
2499
  private handleChatMessage;
2412
2500
  private startHeartbeat;
2413
2501
  private findConnectionByUser;
@@ -2438,6 +2526,22 @@ declare class SignalPlugin extends BaseChannelPlugin {
2438
2526
  protected doStart(): Promise<void>;
2439
2527
  protected doStop(): Promise<void>;
2440
2528
  send(message: GatewayMessage): Promise<string>;
2529
+ getCapabilities(): {
2530
+ supportsText: boolean;
2531
+ supportsMedia: boolean;
2532
+ supportsReply: boolean;
2533
+ supportsThread: boolean;
2534
+ supportsEdit: boolean;
2535
+ supportsDelete: boolean;
2536
+ supportsTyping: boolean;
2537
+ supportsBatchSend: boolean;
2538
+ supportsMarkdown: boolean;
2539
+ supportsHtml: boolean;
2540
+ supportsDeliveryReceipt: boolean;
2541
+ supportsReadReceipt: boolean;
2542
+ maxMessageLength: number;
2543
+ maxMediaCount: number;
2544
+ };
2441
2545
  private startPolling;
2442
2546
  private pollLoop;
2443
2547
  private poll;
@@ -2473,6 +2577,22 @@ declare class NostrPlugin extends BaseChannelPlugin {
2473
2577
  protected doStart(): Promise<void>;
2474
2578
  protected doStop(): Promise<void>;
2475
2579
  send(message: GatewayMessage): Promise<string>;
2580
+ getCapabilities(): {
2581
+ supportsText: boolean;
2582
+ supportsMedia: boolean;
2583
+ supportsReply: boolean;
2584
+ supportsThread: boolean;
2585
+ supportsEdit: boolean;
2586
+ supportsDelete: boolean;
2587
+ supportsTyping: boolean;
2588
+ supportsBatchSend: boolean;
2589
+ supportsMarkdown: boolean;
2590
+ supportsHtml: boolean;
2591
+ supportsDeliveryReceipt: boolean;
2592
+ supportsReadReceipt: boolean;
2593
+ maxMessageLength: number;
2594
+ maxMediaCount: number;
2595
+ };
2476
2596
  private connectToRelay;
2477
2597
  private handleRelayMessage;
2478
2598
  private handleNostrEvent;
@@ -2563,4 +2683,4 @@ declare function initLog(options: {
2563
2683
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
2564
2684
  }): Promise<void>;
2565
2685
 
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 };
2686
+ 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 };