@easbot/gateway 0.2.25 → 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.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;
687
+ }): GatewayMessage;
688
+
689
+ declare function convertToGatewayMessage(input: GatewayMessageReceiveInput & {
690
+ processorId?: string;
691
+ agent?: string;
692
+ proactive?: boolean;
672
693
  }): GatewayMessage;
673
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;
@@ -1656,20 +1631,29 @@ declare class MessageStore {
1656
1631
  private sessionMessages;
1657
1632
  private cleanupTimer;
1658
1633
  private accessOrder;
1634
+ private storagePath;
1635
+ private dirty;
1659
1636
  constructor(config?: Partial<MessageStoreConfig>);
1637
+ private ensureDir;
1638
+ private getMessageFilePath;
1639
+ private getSessionDir;
1640
+ private sanitizeFileName;
1660
1641
  private startCleanupTimer;
1661
1642
  private performCleanup;
1662
- store(message: GatewayMessage): Promise<MessageRecord>;
1643
+ store(message: GatewayMessage, initialStatus?: MessageStatus): Promise<MessageRecord>;
1644
+ private saveMessageToFile;
1663
1645
  get(messageId: string): MessageRecord | undefined;
1664
1646
  updateStatus(messageId: string, status: MessageStatus, options?: {
1665
1647
  processedBy?: string;
1666
1648
  error?: string;
1649
+ deliveredAt?: number;
1650
+ readAt?: number;
1667
1651
  }): Promise<void>;
1668
- incrementRetry(messageId: string): number;
1652
+ incrementRetry(messageId: string): Promise<number>;
1669
1653
  isProcessed(messageId: string): boolean;
1670
1654
  getSessionHistory(sessionId: string, limit?: number): MessageRecord[];
1671
- getPendingMessages(sessionId?: string): MessageRecord[];
1672
- getFailedMessages(maxRetries?: number): MessageRecord[];
1655
+ getPendingMessages(sessionId?: string, type?: string): MessageRecord[];
1656
+ getFailedMessages(maxRetries?: number, type?: string): MessageRecord[];
1673
1657
  cleanup(): number;
1674
1658
  private evictLRU;
1675
1659
  private updateAccessOrder;
@@ -1681,6 +1665,8 @@ declare class MessageStore {
1681
1665
  completed: number;
1682
1666
  failed: number;
1683
1667
  cancelled: number;
1668
+ delivered: number;
1669
+ read: number;
1684
1670
  sessions: number;
1685
1671
  };
1686
1672
  close(): Promise<void>;
@@ -1773,7 +1759,9 @@ interface ResolveChannelParams {
1773
1759
  fallbackChannels?: string[] | null;
1774
1760
  sessionManager?: {
1775
1761
  get(sessionId: string): GatewaySession | undefined;
1762
+ getOrCreate(channelInfo: SessionChannelInfo, context?: Record<string, unknown>): Promise<GatewaySession>;
1776
1763
  bindBackendSession(gatewaySessionId: string, backendSessionId: string): Promise<void>;
1764
+ getAll?(): GatewaySession[];
1777
1765
  };
1778
1766
  pluginLoader?: {
1779
1767
  getPlugin(pluginId: string): ChannelPlugin | undefined;
@@ -1822,7 +1810,9 @@ interface ResolveChannelParams {
1822
1810
  };
1823
1811
  }
1824
1812
 
1825
- 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
+ }
1826
1816
  declare class GatewayWebSocketServer {
1827
1817
  private config;
1828
1818
  private server;
@@ -1840,12 +1830,8 @@ declare class GatewayWebSocketServer {
1840
1830
  private channelResolveParams;
1841
1831
  constructor(config?: Partial<GatewayServerConfig>);
1842
1832
  setChannelResolveDeps(params: ResolveChannelParams): void;
1843
- setMessageSender(sender: MessageSender): void;
1844
- private messageSender;
1845
1833
  private pluginLoaderRef;
1846
- setPluginLoader(loader: {
1847
- send(pluginId: string, message: GatewayMessage): Promise<string>;
1848
- }): void;
1834
+ setPluginLoader(sender: MessageSender): void;
1849
1835
  private getChannelResolveParams;
1850
1836
  start(): Promise<void>;
1851
1837
  private startHTTPServer;
@@ -1878,6 +1864,8 @@ declare class GatewayWebSocketServer {
1878
1864
  }
1879
1865
 
1880
1866
  declare class GatewayServer implements IGatewayServer {
1867
+ private static readonly MAX_RETRY_COUNT;
1868
+ private static readonly SEVEN_DAYS_MS;
1881
1869
  private log;
1882
1870
  private config;
1883
1871
  private router;
@@ -1902,29 +1890,18 @@ declare class GatewayServer implements IGatewayServer {
1902
1890
  private saveContactFromMessage;
1903
1891
  private dispatchToSubAgent;
1904
1892
  private triggerHook;
1893
+ private retryPendingMessages;
1905
1894
  private storeMessage;
1906
- processMessage(sessionId: string, messageId: string, processorId: string, options?: {
1907
- processType?: 'subagent' | 'direct' | 'tool';
1908
- agent?: string;
1909
- }): Promise<void>;
1910
- completeMessage(sessionId: string, messageId: string, processorId: string, options?: {
1911
- success?: boolean;
1912
- error?: string;
1913
- responseMessageId?: string;
1914
- tokens?: number;
1915
- duration?: number;
1916
- }): Promise<void>;
1917
1895
  onEvent(event: ChannelEvent): Promise<void>;
1918
1896
  registerChannel(plugin: ChannelPlugin, config?: ChannelConfig): Promise<void>;
1919
1897
  unregisterChannel(pluginId: string): Promise<void>;
1920
1898
  subscribe(sessionId: string, subscriber: Subscriber): Promise<void>;
1921
1899
  unsubscribe(subscriptionId: string): Promise<void>;
1922
- send(message: GatewayMessage): Promise<void>;
1923
- sendToChannel(pluginId: string, message: GatewayMessage, options?: {
1924
- proactive?: boolean;
1925
- 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;
1926
1904
  }): Promise<string>;
1927
- sendProactiveMessage(pluginId: string, sessionId: string, content: GatewayMessage['content'], channel: ChannelInfo): Promise<string>;
1928
1905
  getSessionManager(): GatewaySessionManager;
1929
1906
  getRouter(): MessageRouter;
1930
1907
  getPluginLoader(): ChannelPluginLoader;
@@ -1984,6 +1961,8 @@ interface SessionInfo {
1984
1961
  channelId?: string;
1985
1962
  userId?: string;
1986
1963
  chatId?: string;
1964
+ chatType?: string;
1965
+ chatTitle?: string;
1987
1966
  state: string;
1988
1967
  createdAt: number;
1989
1968
  lastActiveAt: number;
@@ -2063,16 +2042,30 @@ declare class GatewayClient {
2063
2042
  getContact(uid: string): Promise<ContactInfo & {
2064
2043
  aliases?: Record<string, unknown>;
2065
2044
  }>;
2066
- listSessions(options?: {
2067
- limit?: number;
2068
- offset?: number;
2069
- }): Promise<SessionListResponse>;
2070
2045
  getSession(sessionId: string): Promise<SessionInfo & {
2071
2046
  subscriberCount?: number;
2072
2047
  }>;
2073
2048
  createSession(params?: {
2074
2049
  channel?: string;
2050
+ userId?: string;
2051
+ platform?: string;
2075
2052
  }): Promise<CreateSessionResponse>;
2053
+ getOrCreateSession(options: {
2054
+ sessionId?: string;
2055
+ channel?: string;
2056
+ userId?: string;
2057
+ platform?: string;
2058
+ }): Promise<{
2059
+ sessionId: string;
2060
+ created: boolean;
2061
+ }>;
2062
+ listSessions(options?: {
2063
+ limit?: number;
2064
+ offset?: number;
2065
+ platform?: string;
2066
+ channelId?: string;
2067
+ userId?: string;
2068
+ }): Promise<SessionListResponse>;
2076
2069
  sendMessage(sessionId: string, message: {
2077
2070
  content: Array<{
2078
2071
  type: string;
@@ -2082,7 +2075,10 @@ declare class GatewayClient {
2082
2075
  }>;
2083
2076
  channel?: string;
2084
2077
  userId?: string;
2078
+ chatId?: string;
2085
2079
  messageType?: string;
2080
+ processorId?: string;
2081
+ agent?: string;
2086
2082
  }): Promise<SendMessageResponse>;
2087
2083
  }
2088
2084
 
@@ -2152,12 +2148,33 @@ declare class TelegramPlugin extends BaseChannelPlugin {
2152
2148
  private abortController;
2153
2149
  private lastUpdateId;
2154
2150
  private typingTimers;
2151
+ private sentMessages;
2152
+ private sessionIdMap;
2155
2153
  private commandRouter;
2156
2154
  private retryState;
2157
2155
  constructor(id?: string);
2158
2156
  protected doStart(): Promise<void>;
2159
2157
  protected doStop(): Promise<void>;
2160
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
+ };
2161
2178
  sendTyping(chatId: string): Promise<void>;
2162
2179
  sendChatAction(chatId: string, action: 'typing' | 'upload_photo' | 'upload_document' | 'record_video' | 'upload_video' | 'record_audio' | 'upload_audio'): Promise<void>;
2163
2180
  private scheduleTypingStop;
@@ -2166,11 +2183,16 @@ declare class TelegramPlugin extends BaseChannelPlugin {
2166
2183
  private startPolling;
2167
2184
  private pollLoop;
2168
2185
  private poll;
2186
+ private handleMessageReaction;
2187
+ private handleMessageReactionCount;
2188
+ private findSentMessageEntry;
2169
2189
  private handlePollingError;
2170
2190
  private sleep;
2171
2191
  private handleTelegramMessage;
2172
2192
  private handleCommand;
2173
2193
  private toGatewayMessage;
2194
+ private parseFileContent;
2195
+ private downloadBinaryFile;
2174
2196
  private parseContent;
2175
2197
  protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
2176
2198
  private processMessageAndGetSessionId;
@@ -2210,6 +2232,22 @@ declare class DiscordPlugin extends BaseChannelPlugin {
2210
2232
  protected doStart(): Promise<void>;
2211
2233
  protected doStop(): Promise<void>;
2212
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
+ };
2213
2251
  private startGateway;
2214
2252
  private handleGatewayMessage;
2215
2253
  private handleHello;
@@ -2248,6 +2286,22 @@ declare class SlackPlugin extends BaseChannelPlugin {
2248
2286
  protected doStart(): Promise<void>;
2249
2287
  protected doStop(): Promise<void>;
2250
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
+ };
2251
2305
  private startSocketMode;
2252
2306
  private handleSocketModeEvent;
2253
2307
  private handleSlackMessage;
@@ -2310,6 +2364,22 @@ declare class FeishuPlugin extends BaseChannelPlugin {
2310
2364
  protected doStart(): Promise<void>;
2311
2365
  protected doStop(): Promise<void>;
2312
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
+ };
2313
2383
  handleWebhookEvent(event: FeishuMessageEvent): Promise<void>;
2314
2384
  private toGatewayMessage;
2315
2385
  private parseContent;
@@ -2346,6 +2416,22 @@ declare class WeChatPlugin extends BaseChannelPlugin {
2346
2416
  protected doStart(): Promise<void>;
2347
2417
  protected doStop(): Promise<void>;
2348
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
+ };
2349
2435
  handleWebhookMessage(xmlData: string): Promise<void>;
2350
2436
  private parseXmlMessage;
2351
2437
  private toGatewayMessage;
@@ -2383,10 +2469,27 @@ declare class WebChatPlugin extends BaseChannelPlugin {
2383
2469
  private startWebSocketServer;
2384
2470
  protected doStop(): Promise<void>;
2385
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
+ };
2386
2488
  pushEvent(sessionId: string, event: SessionEventPayload): void;
2387
2489
  getWebSocketServer(): GatewayWebSocketServer | null;
2388
2490
  handleConnection(ws: WebSocket, userId: string): Promise<void>;
2389
2491
  private handleWebSocketMessage;
2492
+ private handleMessageAcknowledgment;
2390
2493
  private handleChatMessage;
2391
2494
  private startHeartbeat;
2392
2495
  private findConnectionByUser;
@@ -2417,6 +2520,22 @@ declare class SignalPlugin extends BaseChannelPlugin {
2417
2520
  protected doStart(): Promise<void>;
2418
2521
  protected doStop(): Promise<void>;
2419
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
+ };
2420
2539
  private startPolling;
2421
2540
  private pollLoop;
2422
2541
  private poll;
@@ -2452,6 +2571,22 @@ declare class NostrPlugin extends BaseChannelPlugin {
2452
2571
  protected doStart(): Promise<void>;
2453
2572
  protected doStop(): Promise<void>;
2454
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
+ };
2455
2590
  private connectToRelay;
2456
2591
  private handleRelayMessage;
2457
2592
  private handleNostrEvent;
@@ -2542,4 +2677,4 @@ declare function initLog(options: {
2542
2677
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
2543
2678
  }): Promise<void>;
2544
2679
 
2545
- 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 };