@easbot/gateway 0.2.23 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/chunk-GQFBXITJ.mjs +5 -0
- package/dist/chunks/chunk-LR37LRDG.cjs +5 -0
- package/dist/chunks/chunk-OBW6CNOG.mjs +7 -0
- package/dist/chunks/chunk-RIWYHEQ6.cjs +7 -0
- package/dist/chunks/global-DVGSJ3V3.mjs +2 -0
- package/dist/chunks/global-WNXPJXAS.cjs +1 -0
- package/dist/chunks/log-7WPRHZWH.cjs +1 -0
- package/dist/chunks/log-MKRLBH4R.mjs +1 -0
- package/dist/chunks/server-HGRZI7JT.mjs +1 -0
- package/dist/chunks/server-ZWJPPFTK.cjs +1 -0
- package/dist/index.cjs +2 -11
- package/dist/index.d.cts +444 -99
- package/dist/index.d.ts +444 -99
- package/dist/index.mjs +2 -11
- package/package.json +14 -13
- package/dist/chunks/chunk-2MXYBRPH.cjs +0 -1
- package/dist/chunks/chunk-5ETPYYQR.cjs +0 -7
- package/dist/chunks/chunk-6TRL3CVJ.mjs +0 -7
- package/dist/chunks/chunk-77F43CRD.mjs +0 -2
- package/dist/chunks/chunk-ASIAS35P.cjs +0 -2
- package/dist/chunks/chunk-DJTIL3AB.mjs +0 -2
- package/dist/chunks/chunk-RR6UFR5U.cjs +0 -2
- package/dist/chunks/chunk-YP2P4RQW.mjs +0 -1
- package/dist/chunks/global-5DV25LCJ.mjs +0 -2
- package/dist/chunks/global-OVOYDKEL.cjs +0 -1
- package/dist/chunks/log-B5SORET6.cjs +0 -1
- package/dist/chunks/log-K67H67P2.mjs +0 -1
- package/dist/chunks/server-CPD2KBY7.cjs +0 -1
- package/dist/chunks/server-TLTUACMN.mjs +0 -1
- package/dist/cli.cjs +0 -8
- package/dist/cli.d.cts +0 -6
- package/dist/cli.d.ts +0 -6
- package/dist/cli.mjs +0 -8
package/dist/index.d.cts
CHANGED
|
@@ -35,12 +35,12 @@ declare namespace Gateway {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const ChannelTypeSchema: z.ZodEnum<{
|
|
38
|
-
signal: "signal";
|
|
39
38
|
telegram: "telegram";
|
|
40
39
|
slack: "slack";
|
|
41
40
|
feishu: "feishu";
|
|
42
41
|
wechat: "wechat";
|
|
43
42
|
webchat: "webchat";
|
|
43
|
+
signal: "signal";
|
|
44
44
|
nostr: "nostr";
|
|
45
45
|
}>;
|
|
46
46
|
type ChannelType = z.infer<typeof ChannelTypeSchema>;
|
|
@@ -262,8 +262,8 @@ declare const AuthConfigSchema: z.ZodObject<{
|
|
|
262
262
|
type AuthConfig = z.infer<typeof AuthConfigSchema>;
|
|
263
263
|
declare const AgentSyncConfigSchema: z.ZodObject<{
|
|
264
264
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
265
|
-
push: "push";
|
|
266
265
|
pull: "pull";
|
|
266
|
+
push: "push";
|
|
267
267
|
both: "both";
|
|
268
268
|
}>>;
|
|
269
269
|
interval: z.ZodDefault<z.ZodNumber>;
|
|
@@ -297,8 +297,8 @@ declare const GatewayClusterConfigSchema: z.ZodObject<{
|
|
|
297
297
|
}, z.core.$strip>>>;
|
|
298
298
|
sync: z.ZodOptional<z.ZodObject<{
|
|
299
299
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
300
|
-
push: "push";
|
|
301
300
|
pull: "pull";
|
|
301
|
+
push: "push";
|
|
302
302
|
both: "both";
|
|
303
303
|
}>>;
|
|
304
304
|
interval: z.ZodDefault<z.ZodNumber>;
|
|
@@ -545,8 +545,8 @@ declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
545
545
|
}, z.core.$strip>>>;
|
|
546
546
|
sync: z.ZodOptional<z.ZodObject<{
|
|
547
547
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
548
|
-
push: "push";
|
|
549
548
|
pull: "pull";
|
|
549
|
+
push: "push";
|
|
550
550
|
both: "both";
|
|
551
551
|
}>>;
|
|
552
552
|
interval: z.ZodDefault<z.ZodNumber>;
|
|
@@ -603,6 +603,10 @@ declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
603
603
|
maxSessions: z.ZodDefault<z.ZodNumber>;
|
|
604
604
|
persistenceFile: z.ZodOptional<z.ZodString>;
|
|
605
605
|
}, z.core.$strip>>;
|
|
606
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
607
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
608
|
+
fallbackChannels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
609
|
+
}, z.core.$strip>>;
|
|
606
610
|
defaultAgent: z.ZodOptional<z.ZodString>;
|
|
607
611
|
logLevel: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
608
612
|
DEBUG: "DEBUG";
|
|
@@ -729,7 +733,7 @@ interface GatewaySession {
|
|
|
729
733
|
createdAt: number;
|
|
730
734
|
lastActiveAt: number;
|
|
731
735
|
}
|
|
732
|
-
interface SessionChannelInfo {
|
|
736
|
+
interface SessionChannelInfo extends ChannelInfo {
|
|
733
737
|
platform: PlatformType;
|
|
734
738
|
channelId: string;
|
|
735
739
|
chatId?: string;
|
|
@@ -756,6 +760,55 @@ interface SessionFilter {
|
|
|
756
760
|
declare function generateSessionId(channel: SessionChannelInfo): string;
|
|
757
761
|
declare function createDefaultSessionState(): SessionState;
|
|
758
762
|
|
|
763
|
+
interface ContactProfile {
|
|
764
|
+
displayName?: string;
|
|
765
|
+
username?: string;
|
|
766
|
+
avatar?: string;
|
|
767
|
+
email?: string;
|
|
768
|
+
phone?: string;
|
|
769
|
+
locale?: string;
|
|
770
|
+
timezone?: string;
|
|
771
|
+
}
|
|
772
|
+
interface PlatformAlias {
|
|
773
|
+
stableId?: string;
|
|
774
|
+
username?: string;
|
|
775
|
+
displayName?: string;
|
|
776
|
+
chatId?: string;
|
|
777
|
+
}
|
|
778
|
+
interface PlatformAliases {
|
|
779
|
+
[platform: string]: PlatformAlias | undefined;
|
|
780
|
+
}
|
|
781
|
+
interface Contact {
|
|
782
|
+
uid: string;
|
|
783
|
+
platform: PlatformType;
|
|
784
|
+
stableId: string;
|
|
785
|
+
aliases: PlatformAliases;
|
|
786
|
+
profile: ContactProfile;
|
|
787
|
+
createdAt: number;
|
|
788
|
+
lastSeenAt: number;
|
|
789
|
+
metadata?: Record<string, unknown>;
|
|
790
|
+
}
|
|
791
|
+
interface CreateContactParams {
|
|
792
|
+
platform: PlatformType;
|
|
793
|
+
stableId: string;
|
|
794
|
+
profile?: Partial<ContactProfile>;
|
|
795
|
+
aliases?: PlatformAliases;
|
|
796
|
+
metadata?: Record<string, unknown>;
|
|
797
|
+
}
|
|
798
|
+
interface UpdateContactParams {
|
|
799
|
+
profile?: Partial<ContactProfile>;
|
|
800
|
+
aliases?: Partial<PlatformAliases>;
|
|
801
|
+
metadata?: Record<string, unknown>;
|
|
802
|
+
}
|
|
803
|
+
interface ContactQuery {
|
|
804
|
+
platform?: PlatformType;
|
|
805
|
+
username?: string;
|
|
806
|
+
email?: string;
|
|
807
|
+
phone?: string;
|
|
808
|
+
limit?: number;
|
|
809
|
+
offset?: number;
|
|
810
|
+
}
|
|
811
|
+
|
|
759
812
|
interface Subscriber {
|
|
760
813
|
id: string;
|
|
761
814
|
type: SubscriberType;
|
|
@@ -809,6 +862,7 @@ interface ClientInitializeMessage extends WebSocketMessageBase {
|
|
|
809
862
|
interface ClientSubscribeMessage extends WebSocketMessageBase {
|
|
810
863
|
type: 'subscribe';
|
|
811
864
|
sessionId: string;
|
|
865
|
+
backendSessionId?: string;
|
|
812
866
|
payload?: {
|
|
813
867
|
eventTypes?: string[];
|
|
814
868
|
};
|
|
@@ -1001,7 +1055,7 @@ interface CreateSessionRequest {
|
|
|
1001
1055
|
};
|
|
1002
1056
|
context?: Record<string, unknown>;
|
|
1003
1057
|
}
|
|
1004
|
-
interface CreateSessionResponse {
|
|
1058
|
+
interface CreateSessionResponse$1 {
|
|
1005
1059
|
id: string;
|
|
1006
1060
|
createdAt: number;
|
|
1007
1061
|
}
|
|
@@ -1016,10 +1070,15 @@ interface SendMessageRequest {
|
|
|
1016
1070
|
}>;
|
|
1017
1071
|
[key: string]: unknown;
|
|
1018
1072
|
}
|
|
1019
|
-
interface SendMessageResponse {
|
|
1073
|
+
interface SendMessageResponse$1 {
|
|
1020
1074
|
messageId: string;
|
|
1021
1075
|
sessionId: string;
|
|
1022
1076
|
createdAt: number;
|
|
1077
|
+
metadata?: {
|
|
1078
|
+
channel?: string;
|
|
1079
|
+
channelSource?: string;
|
|
1080
|
+
channelInfo?: ChannelInfo;
|
|
1081
|
+
};
|
|
1023
1082
|
}
|
|
1024
1083
|
interface SubscriptionsResponse {
|
|
1025
1084
|
subscriptions: Array<{
|
|
@@ -1252,6 +1311,46 @@ interface ConnectionPoolEvent<T = unknown> {
|
|
|
1252
1311
|
}
|
|
1253
1312
|
type ConnectionPoolEventCallback<T = unknown> = (event: ConnectionPoolEvent<T>) => void | Promise<void>;
|
|
1254
1313
|
|
|
1314
|
+
interface CancelEvent {
|
|
1315
|
+
sessionId: string;
|
|
1316
|
+
messageId: string;
|
|
1317
|
+
processedBy: string;
|
|
1318
|
+
reason: 'completed' | 'failed' | 'timeout';
|
|
1319
|
+
timestamp: number;
|
|
1320
|
+
}
|
|
1321
|
+
type CancelEventHandler = (event: CancelEvent) => void | Promise<void>;
|
|
1322
|
+
declare class MessageRouter {
|
|
1323
|
+
private log;
|
|
1324
|
+
private subscribers;
|
|
1325
|
+
private subscriptions;
|
|
1326
|
+
private sessionSubscriptions;
|
|
1327
|
+
private channelPlugins;
|
|
1328
|
+
private lockManager;
|
|
1329
|
+
private retryManager;
|
|
1330
|
+
private cancelHandlers;
|
|
1331
|
+
constructor();
|
|
1332
|
+
onCancel(handler: CancelEventHandler): void;
|
|
1333
|
+
offCancel(handler: CancelEventHandler): void;
|
|
1334
|
+
private emitCancel;
|
|
1335
|
+
route(message: GatewayMessage): Promise<RouteResult>;
|
|
1336
|
+
completeMessage(sessionId: string, messageId: string, subscriberId: string, reason?: 'completed' | 'failed' | 'timeout'): Promise<void>;
|
|
1337
|
+
scheduleRetry(message: GatewayMessage, error: Error): boolean;
|
|
1338
|
+
subscribe(sessionId: string, subscriber: Subscriber): Promise<Subscription>;
|
|
1339
|
+
unsubscribe(subscriptionId: string): Promise<void>;
|
|
1340
|
+
unsubscribeAll(subscriberId: string): Promise<void>;
|
|
1341
|
+
registerChannel(plugin: ChannelPlugin): void;
|
|
1342
|
+
unregisterChannel(pluginId: string): void;
|
|
1343
|
+
getSubscriber(subscriberId: string): Subscriber | undefined;
|
|
1344
|
+
getSubscription(subscriptionId: string): Subscription | undefined;
|
|
1345
|
+
getSubscriberCount(sessionId: string): number;
|
|
1346
|
+
getStats(): {
|
|
1347
|
+
subscribers: number;
|
|
1348
|
+
subscriptions: number;
|
|
1349
|
+
sessions: number;
|
|
1350
|
+
};
|
|
1351
|
+
shutdown(): Promise<void>;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1255
1354
|
interface LockState {
|
|
1256
1355
|
sessionId: string;
|
|
1257
1356
|
messageId: string;
|
|
@@ -1320,44 +1419,6 @@ declare class MessageRetryManager {
|
|
|
1320
1419
|
};
|
|
1321
1420
|
}
|
|
1322
1421
|
|
|
1323
|
-
interface CancelEvent {
|
|
1324
|
-
sessionId: string;
|
|
1325
|
-
messageId: string;
|
|
1326
|
-
processedBy: string;
|
|
1327
|
-
reason: 'completed' | 'failed' | 'timeout';
|
|
1328
|
-
timestamp: number;
|
|
1329
|
-
}
|
|
1330
|
-
type CancelEventHandler = (event: CancelEvent) => void | Promise<void>;
|
|
1331
|
-
declare class MessageRouter {
|
|
1332
|
-
private log;
|
|
1333
|
-
private subscribers;
|
|
1334
|
-
private subscriptions;
|
|
1335
|
-
private sessionSubscriptions;
|
|
1336
|
-
private channelPlugins;
|
|
1337
|
-
private lockManager;
|
|
1338
|
-
private retryManager;
|
|
1339
|
-
private cancelHandlers;
|
|
1340
|
-
constructor();
|
|
1341
|
-
onCancel(handler: CancelEventHandler): void;
|
|
1342
|
-
offCancel(handler: CancelEventHandler): void;
|
|
1343
|
-
private emitCancel;
|
|
1344
|
-
route(message: GatewayMessage): Promise<RouteResult>;
|
|
1345
|
-
completeMessage(sessionId: string, messageId: string, subscriberId: string, reason?: 'completed' | 'failed' | 'timeout'): Promise<void>;
|
|
1346
|
-
scheduleRetry(message: GatewayMessage, error: Error): boolean;
|
|
1347
|
-
subscribe(sessionId: string, subscriber: Subscriber): Promise<Subscription>;
|
|
1348
|
-
unsubscribe(subscriptionId: string): Promise<void>;
|
|
1349
|
-
unsubscribeAll(subscriberId: string): Promise<void>;
|
|
1350
|
-
registerChannel(plugin: ChannelPlugin): Promise<void>;
|
|
1351
|
-
unregisterChannel(pluginId: string): Promise<void>;
|
|
1352
|
-
getSubscriberCount(sessionId: string): number;
|
|
1353
|
-
getAllSubscribers(): Subscriber[];
|
|
1354
|
-
getChannelPlugin(pluginId: string): ChannelPlugin | undefined;
|
|
1355
|
-
getAllChannelPlugins(): ChannelPlugin[];
|
|
1356
|
-
getLockManager(): MessageLockManager;
|
|
1357
|
-
getRetryManager(): MessageRetryManager;
|
|
1358
|
-
shutdown(): Promise<void>;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
1422
|
interface SessionManagerConfig {
|
|
1362
1423
|
enablePersistence: boolean;
|
|
1363
1424
|
storagePath: string;
|
|
@@ -1431,15 +1492,11 @@ declare class AgentSyncManager {
|
|
|
1431
1492
|
private remoteAgents;
|
|
1432
1493
|
private syncTimer;
|
|
1433
1494
|
private running;
|
|
1434
|
-
private httpClient;
|
|
1435
1495
|
constructor(options: {
|
|
1436
1496
|
registry: AgentRegistry;
|
|
1437
1497
|
localNodeId: string;
|
|
1438
1498
|
localNodeName: string;
|
|
1439
1499
|
config?: Partial<SyncConfig>;
|
|
1440
|
-
httpClient?: {
|
|
1441
|
-
fetch: typeof fetch;
|
|
1442
|
-
};
|
|
1443
1500
|
});
|
|
1444
1501
|
start(): Promise<void>;
|
|
1445
1502
|
stop(): Promise<void>;
|
|
@@ -1513,10 +1570,14 @@ declare abstract class BaseChannelPlugin implements ChannelPlugin {
|
|
|
1513
1570
|
protected messageHandler: MessageHandler | null;
|
|
1514
1571
|
protected _status: ChannelStatusType;
|
|
1515
1572
|
protected lastActivity: number;
|
|
1573
|
+
private startPromise;
|
|
1574
|
+
private stopPromise;
|
|
1516
1575
|
constructor();
|
|
1517
1576
|
protected initLog(): void;
|
|
1518
1577
|
start(config: ChannelConfig, messageHandler: MessageHandler): Promise<void>;
|
|
1578
|
+
private doStartInternal;
|
|
1519
1579
|
stop(): Promise<void>;
|
|
1580
|
+
private doStopInternal;
|
|
1520
1581
|
healthCheck(): Promise<ChannelHealth>;
|
|
1521
1582
|
getStatus(): ChannelStatus;
|
|
1522
1583
|
abstract send(message: GatewayMessage): Promise<string>;
|
|
@@ -1524,10 +1585,50 @@ declare abstract class BaseChannelPlugin implements ChannelPlugin {
|
|
|
1524
1585
|
protected abstract doStop(): Promise<void>;
|
|
1525
1586
|
protected doHealthCheck(): Promise<boolean>;
|
|
1526
1587
|
protected updateActivity(): void;
|
|
1588
|
+
protected extractText(message: GatewayMessage): string;
|
|
1589
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
1527
1590
|
protected handleMessage(message: GatewayMessage): Promise<void>;
|
|
1528
1591
|
protected handleEvent(type: string, data?: unknown): Promise<void>;
|
|
1529
1592
|
}
|
|
1530
1593
|
|
|
1594
|
+
interface PluginLoaderConfig {
|
|
1595
|
+
pluginDir?: string;
|
|
1596
|
+
autoDiscover?: boolean;
|
|
1597
|
+
healthCheckInterval?: number;
|
|
1598
|
+
healthCheckTimeout?: number;
|
|
1599
|
+
autoReconnect?: boolean;
|
|
1600
|
+
maxReconnectAttempts?: number;
|
|
1601
|
+
reconnectInitialDelay?: number;
|
|
1602
|
+
reconnectMaxDelay?: number;
|
|
1603
|
+
}
|
|
1604
|
+
declare class ChannelPluginLoader {
|
|
1605
|
+
private log;
|
|
1606
|
+
private plugins;
|
|
1607
|
+
private messageHandler;
|
|
1608
|
+
private healthCheckTimer;
|
|
1609
|
+
private config;
|
|
1610
|
+
private backoffPolicy;
|
|
1611
|
+
constructor(config?: PluginLoaderConfig);
|
|
1612
|
+
setMessageHandler(handler: MessageHandler): void;
|
|
1613
|
+
register(plugin: ChannelPlugin, config: ChannelConfig): Promise<void>;
|
|
1614
|
+
unregister(pluginId: string): Promise<void>;
|
|
1615
|
+
start(pluginId: string): Promise<void>;
|
|
1616
|
+
stop(pluginId: string): Promise<void>;
|
|
1617
|
+
startAll(): Promise<void>;
|
|
1618
|
+
stopAll(): Promise<void>;
|
|
1619
|
+
getPlugin(pluginId: string): ChannelPlugin | undefined;
|
|
1620
|
+
getAllPlugins(): ChannelPlugin[];
|
|
1621
|
+
getRunningPlugins(): ChannelPlugin[];
|
|
1622
|
+
isRunning(pluginId: string): boolean;
|
|
1623
|
+
healthCheck(pluginId: string): Promise<ChannelHealth>;
|
|
1624
|
+
healthCheckAll(): Promise<Map<string, ChannelHealth>>;
|
|
1625
|
+
startHealthCheckTimer(): void;
|
|
1626
|
+
stopHealthCheckTimer(): void;
|
|
1627
|
+
private scheduleReconnect;
|
|
1628
|
+
private cancelReconnect;
|
|
1629
|
+
private calculateBackoffDelay;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1531
1632
|
interface MessageRecord {
|
|
1532
1633
|
message: GatewayMessage;
|
|
1533
1634
|
status: MessageStatus;
|
|
@@ -1543,13 +1644,21 @@ interface MessageStoreConfig {
|
|
|
1543
1644
|
storagePath: string;
|
|
1544
1645
|
maxRetentionDays: number;
|
|
1545
1646
|
maxRecords: number;
|
|
1647
|
+
cleanupIntervalMs: number;
|
|
1648
|
+
cleanupBatchSize: number;
|
|
1649
|
+
lruEnabled: boolean;
|
|
1650
|
+
lruMaxMemory?: number;
|
|
1546
1651
|
}
|
|
1547
1652
|
declare class MessageStore {
|
|
1548
1653
|
private log;
|
|
1549
1654
|
private config;
|
|
1550
1655
|
private messages;
|
|
1551
1656
|
private sessionMessages;
|
|
1657
|
+
private cleanupTimer;
|
|
1658
|
+
private accessOrder;
|
|
1552
1659
|
constructor(config?: Partial<MessageStoreConfig>);
|
|
1660
|
+
private startCleanupTimer;
|
|
1661
|
+
private performCleanup;
|
|
1553
1662
|
store(message: GatewayMessage): Promise<MessageRecord>;
|
|
1554
1663
|
get(messageId: string): MessageRecord | undefined;
|
|
1555
1664
|
updateStatus(messageId: string, status: MessageStatus, options?: {
|
|
@@ -1561,7 +1670,10 @@ declare class MessageStore {
|
|
|
1561
1670
|
getSessionHistory(sessionId: string, limit?: number): MessageRecord[];
|
|
1562
1671
|
getPendingMessages(sessionId?: string): MessageRecord[];
|
|
1563
1672
|
getFailedMessages(maxRetries?: number): MessageRecord[];
|
|
1564
|
-
cleanup():
|
|
1673
|
+
cleanup(): number;
|
|
1674
|
+
private evictLRU;
|
|
1675
|
+
private updateAccessOrder;
|
|
1676
|
+
private deleteMessage;
|
|
1565
1677
|
getStats(): {
|
|
1566
1678
|
total: number;
|
|
1567
1679
|
pending: number;
|
|
@@ -1569,7 +1681,9 @@ declare class MessageStore {
|
|
|
1569
1681
|
completed: number;
|
|
1570
1682
|
failed: number;
|
|
1571
1683
|
cancelled: number;
|
|
1684
|
+
sessions: number;
|
|
1572
1685
|
};
|
|
1686
|
+
close(): Promise<void>;
|
|
1573
1687
|
}
|
|
1574
1688
|
|
|
1575
1689
|
interface SerializableSession {
|
|
@@ -1620,37 +1734,101 @@ declare class SessionStore {
|
|
|
1620
1734
|
};
|
|
1621
1735
|
}
|
|
1622
1736
|
|
|
1623
|
-
interface
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1737
|
+
interface ContactListResult {
|
|
1738
|
+
contacts: Contact[];
|
|
1739
|
+
total: number;
|
|
1740
|
+
hasMore: boolean;
|
|
1741
|
+
}
|
|
1742
|
+
interface IContactStore {
|
|
1743
|
+
initialize?(): Promise<void>;
|
|
1744
|
+
save(contact: Contact): Promise<Contact>;
|
|
1745
|
+
create(params: CreateContactParams): Promise<Contact>;
|
|
1746
|
+
getOrCreate(platform: PlatformType, stableId: string, profile?: Partial<ContactProfile>): Promise<Contact>;
|
|
1747
|
+
findByUid(uid: string): Promise<Contact | null>;
|
|
1748
|
+
findByPlatformId(platform: PlatformType, stableId: string): Promise<Contact | null>;
|
|
1749
|
+
update(uid: string, params: UpdateContactParams): Promise<Contact | null>;
|
|
1750
|
+
touch(uid: string): Promise<void>;
|
|
1751
|
+
delete(uid: string): Promise<boolean>;
|
|
1752
|
+
listByPlatform(platform: PlatformType, limit?: number, offset?: number): Promise<ContactListResult>;
|
|
1753
|
+
findByUsername(username: string): Promise<Contact | null>;
|
|
1754
|
+
findByEmail(email: string): Promise<Contact | null>;
|
|
1755
|
+
findByPhone(phone: string): Promise<Contact | null>;
|
|
1756
|
+
search(query: ContactQuery): Promise<ContactListResult>;
|
|
1757
|
+
count(platform?: PlatformType): Promise<number>;
|
|
1758
|
+
exists(uid: string): Promise<boolean>;
|
|
1759
|
+
addAlias(uid: string, platform: PlatformType, alias: {
|
|
1760
|
+
stableId?: string;
|
|
1761
|
+
username?: string;
|
|
1762
|
+
displayName?: string;
|
|
1763
|
+
chatId?: string;
|
|
1764
|
+
}): Promise<Contact | null>;
|
|
1765
|
+
close(): Promise<void>;
|
|
1628
1766
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1767
|
+
|
|
1768
|
+
interface ResolveChannelParams {
|
|
1769
|
+
channel?: string | null;
|
|
1770
|
+
sessionId?: string | null;
|
|
1771
|
+
userId?: string | null;
|
|
1772
|
+
defaultChannel?: string | null;
|
|
1773
|
+
fallbackChannels?: string[] | null;
|
|
1774
|
+
sessionManager?: {
|
|
1775
|
+
get(sessionId: string): GatewaySession | undefined;
|
|
1776
|
+
bindBackendSession(gatewaySessionId: string, backendSessionId: string): Promise<void>;
|
|
1777
|
+
};
|
|
1778
|
+
pluginLoader?: {
|
|
1779
|
+
getPlugin(pluginId: string): {
|
|
1780
|
+
id: string;
|
|
1781
|
+
platform: PlatformType;
|
|
1782
|
+
} | undefined;
|
|
1783
|
+
getAllPlugins(): Array<{
|
|
1784
|
+
id: string;
|
|
1785
|
+
platform: PlatformType;
|
|
1786
|
+
}>;
|
|
1787
|
+
isRunning(pluginId: string): boolean;
|
|
1788
|
+
};
|
|
1789
|
+
contactStore?: {
|
|
1790
|
+
findByPlatformId(platform: PlatformType, stableId: string): Promise<{
|
|
1791
|
+
uid: string;
|
|
1792
|
+
platform: PlatformType;
|
|
1793
|
+
stableId: string;
|
|
1794
|
+
profile: {
|
|
1795
|
+
username?: string;
|
|
1796
|
+
displayName?: string;
|
|
1797
|
+
};
|
|
1798
|
+
lastSeenAt: number;
|
|
1799
|
+
} | null>;
|
|
1800
|
+
findByUid(uid: string): Promise<{
|
|
1801
|
+
uid: string;
|
|
1802
|
+
platform: PlatformType;
|
|
1803
|
+
stableId: string;
|
|
1804
|
+
profile: {
|
|
1805
|
+
username?: string;
|
|
1806
|
+
displayName?: string;
|
|
1807
|
+
};
|
|
1808
|
+
aliases?: Record<string, unknown>;
|
|
1809
|
+
lastSeenAt: number;
|
|
1810
|
+
createdAt: number;
|
|
1811
|
+
} | null>;
|
|
1812
|
+
listByPlatform(platform: PlatformType, limit?: number, offset?: number): Promise<{
|
|
1813
|
+
contacts: Array<{
|
|
1814
|
+
uid: string;
|
|
1815
|
+
platform: PlatformType;
|
|
1816
|
+
stableId: string;
|
|
1817
|
+
profile: {
|
|
1818
|
+
username?: string;
|
|
1819
|
+
displayName?: string;
|
|
1820
|
+
};
|
|
1821
|
+
lastSeenAt: number;
|
|
1822
|
+
createdAt: number;
|
|
1823
|
+
}>;
|
|
1824
|
+
total: number;
|
|
1825
|
+
hasMore: boolean;
|
|
1826
|
+
}>;
|
|
1827
|
+
count(platform?: PlatformType): Promise<number>;
|
|
1828
|
+
};
|
|
1652
1829
|
}
|
|
1653
1830
|
|
|
1831
|
+
type MessageSender = (pluginId: string, message: GatewayMessage) => Promise<string>;
|
|
1654
1832
|
declare class GatewayWebSocketServer {
|
|
1655
1833
|
private config;
|
|
1656
1834
|
private server;
|
|
@@ -1665,7 +1843,16 @@ declare class GatewayWebSocketServer {
|
|
|
1665
1843
|
private heartbeatInterval;
|
|
1666
1844
|
private startTime;
|
|
1667
1845
|
private running;
|
|
1846
|
+
private channelResolveParams;
|
|
1668
1847
|
constructor(config?: Partial<GatewayServerConfig>);
|
|
1848
|
+
setChannelResolveDeps(params: ResolveChannelParams): void;
|
|
1849
|
+
setMessageSender(sender: MessageSender): void;
|
|
1850
|
+
private messageSender;
|
|
1851
|
+
private pluginLoaderRef;
|
|
1852
|
+
setPluginLoader(loader: {
|
|
1853
|
+
send(pluginId: string, message: GatewayMessage): Promise<string>;
|
|
1854
|
+
}): void;
|
|
1855
|
+
private getChannelResolveParams;
|
|
1669
1856
|
start(): Promise<void>;
|
|
1670
1857
|
private startHTTPServer;
|
|
1671
1858
|
private startHTTPSServer;
|
|
@@ -1703,10 +1890,12 @@ declare class GatewayServer implements IGatewayServer {
|
|
|
1703
1890
|
private sessionManager;
|
|
1704
1891
|
private pluginLoader;
|
|
1705
1892
|
private messageStore;
|
|
1893
|
+
private contactStore;
|
|
1706
1894
|
private wsServer;
|
|
1707
1895
|
private running;
|
|
1708
1896
|
private connections;
|
|
1709
1897
|
constructor(config: GatewayServerConfig$1);
|
|
1898
|
+
private loadChannelPlugins;
|
|
1710
1899
|
start(): Promise<void>;
|
|
1711
1900
|
stop(): Promise<void>;
|
|
1712
1901
|
getStatus(): {
|
|
@@ -1716,6 +1905,9 @@ declare class GatewayServer implements IGatewayServer {
|
|
|
1716
1905
|
connections?: number;
|
|
1717
1906
|
};
|
|
1718
1907
|
onMessage(message: GatewayMessage): Promise<void>;
|
|
1908
|
+
private saveContactFromMessage;
|
|
1909
|
+
private dispatchToSubAgent;
|
|
1910
|
+
private triggerHook;
|
|
1719
1911
|
private storeMessage;
|
|
1720
1912
|
processMessage(sessionId: string, messageId: string, processorId: string, options?: {
|
|
1721
1913
|
processType?: 'subagent' | 'direct' | 'tool';
|
|
@@ -1743,6 +1935,7 @@ declare class GatewayServer implements IGatewayServer {
|
|
|
1743
1935
|
getRouter(): MessageRouter;
|
|
1744
1936
|
getPluginLoader(): ChannelPluginLoader;
|
|
1745
1937
|
getMessageStore(): MessageStore;
|
|
1938
|
+
getContactStore(): IContactStore | null;
|
|
1746
1939
|
getMessageHistory(sessionId: string, limit?: number): Promise<MessageRecord[]>;
|
|
1747
1940
|
}
|
|
1748
1941
|
|
|
@@ -1762,6 +1955,58 @@ interface GatewayClientConfig {
|
|
|
1762
1955
|
}
|
|
1763
1956
|
type MessageCallback = (message: GatewayMessage) => void | Promise<void>;
|
|
1764
1957
|
type AgentListChangeCallback = (agents: AgentSyncInfo[]) => void | Promise<void>;
|
|
1958
|
+
interface HealthResponse {
|
|
1959
|
+
status: string;
|
|
1960
|
+
timestamp: number;
|
|
1961
|
+
version: string;
|
|
1962
|
+
}
|
|
1963
|
+
interface StatusResponse {
|
|
1964
|
+
status: string;
|
|
1965
|
+
connections: number;
|
|
1966
|
+
sessions: number;
|
|
1967
|
+
subscriptions: number;
|
|
1968
|
+
uptime: number;
|
|
1969
|
+
version: string;
|
|
1970
|
+
}
|
|
1971
|
+
interface ContactInfo {
|
|
1972
|
+
uid: string;
|
|
1973
|
+
platform: string;
|
|
1974
|
+
stableId: string;
|
|
1975
|
+
profile: {
|
|
1976
|
+
displayName?: string;
|
|
1977
|
+
username?: string;
|
|
1978
|
+
};
|
|
1979
|
+
lastSeenAt: number;
|
|
1980
|
+
createdAt: number;
|
|
1981
|
+
}
|
|
1982
|
+
interface ContactListResponse {
|
|
1983
|
+
contacts: ContactInfo[];
|
|
1984
|
+
total: number;
|
|
1985
|
+
hasMore: boolean;
|
|
1986
|
+
}
|
|
1987
|
+
interface SessionInfo {
|
|
1988
|
+
id: string;
|
|
1989
|
+
platform?: string;
|
|
1990
|
+
channelId?: string;
|
|
1991
|
+
userId?: string;
|
|
1992
|
+
chatId?: string;
|
|
1993
|
+
state: string;
|
|
1994
|
+
createdAt: number;
|
|
1995
|
+
lastActiveAt: number;
|
|
1996
|
+
}
|
|
1997
|
+
interface SessionListResponse {
|
|
1998
|
+
sessions: SessionInfo[];
|
|
1999
|
+
total: number;
|
|
2000
|
+
hasMore: boolean;
|
|
2001
|
+
}
|
|
2002
|
+
interface CreateSessionResponse {
|
|
2003
|
+
id: string;
|
|
2004
|
+
createdAt: number;
|
|
2005
|
+
}
|
|
2006
|
+
interface SendMessageResponse {
|
|
2007
|
+
success: boolean;
|
|
2008
|
+
messageId?: string;
|
|
2009
|
+
}
|
|
1765
2010
|
type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
1766
2011
|
interface AgentListMergeOptions {
|
|
1767
2012
|
localAgents?: AgentSyncInfo[];
|
|
@@ -1786,7 +2031,7 @@ declare class GatewayClient {
|
|
|
1786
2031
|
constructor(config: GatewayClientConfig);
|
|
1787
2032
|
connect(): Promise<void>;
|
|
1788
2033
|
disconnect(): Promise<void>;
|
|
1789
|
-
subscribe(sessionId: string): Promise<void>;
|
|
2034
|
+
subscribe(sessionId: string, backendSessionId?: string): Promise<void>;
|
|
1790
2035
|
unsubscribe(sessionId: string): Promise<void>;
|
|
1791
2036
|
send(message: GatewayMessage): Promise<void>;
|
|
1792
2037
|
onMessage(callback: MessageCallback): void;
|
|
@@ -1812,6 +2057,38 @@ declare class GatewayClient {
|
|
|
1812
2057
|
private startHeartbeat;
|
|
1813
2058
|
private stopHeartbeat;
|
|
1814
2059
|
private resubscribeAll;
|
|
2060
|
+
private getHttpUrl;
|
|
2061
|
+
private httpRequest;
|
|
2062
|
+
healthCheck(): Promise<HealthResponse>;
|
|
2063
|
+
getStatus(): Promise<StatusResponse>;
|
|
2064
|
+
listContacts(platform: string, options?: {
|
|
2065
|
+
limit?: number;
|
|
2066
|
+
offset?: number;
|
|
2067
|
+
}): Promise<ContactListResponse>;
|
|
2068
|
+
getContact(uid: string): Promise<ContactInfo & {
|
|
2069
|
+
aliases?: Record<string, unknown>;
|
|
2070
|
+
}>;
|
|
2071
|
+
listSessions(options?: {
|
|
2072
|
+
limit?: number;
|
|
2073
|
+
offset?: number;
|
|
2074
|
+
}): Promise<SessionListResponse>;
|
|
2075
|
+
getSession(sessionId: string): Promise<SessionInfo & {
|
|
2076
|
+
subscriberCount?: number;
|
|
2077
|
+
}>;
|
|
2078
|
+
createSession(params?: {
|
|
2079
|
+
channel?: string;
|
|
2080
|
+
}): Promise<CreateSessionResponse>;
|
|
2081
|
+
sendMessage(sessionId: string, message: {
|
|
2082
|
+
content: Array<{
|
|
2083
|
+
type: string;
|
|
2084
|
+
text?: string;
|
|
2085
|
+
image?: string;
|
|
2086
|
+
data?: string;
|
|
2087
|
+
}>;
|
|
2088
|
+
channel?: string;
|
|
2089
|
+
userId?: string;
|
|
2090
|
+
messageType?: string;
|
|
2091
|
+
}): Promise<SendMessageResponse>;
|
|
1815
2092
|
}
|
|
1816
2093
|
|
|
1817
2094
|
interface TelegramBotConfig {
|
|
@@ -1820,35 +2097,91 @@ interface TelegramBotConfig {
|
|
|
1820
2097
|
enabled: boolean;
|
|
1821
2098
|
url: string;
|
|
1822
2099
|
port?: number;
|
|
2100
|
+
secret?: string;
|
|
1823
2101
|
};
|
|
1824
2102
|
polling?: {
|
|
1825
2103
|
enabled: boolean;
|
|
1826
2104
|
interval?: number;
|
|
2105
|
+
timeout?: number;
|
|
2106
|
+
};
|
|
2107
|
+
retry?: {
|
|
2108
|
+
maxAttempts?: number;
|
|
2109
|
+
initialDelay?: number;
|
|
2110
|
+
maxDelay?: number;
|
|
1827
2111
|
};
|
|
2112
|
+
commands?: TelegramBotCommand[];
|
|
2113
|
+
}
|
|
2114
|
+
interface TelegramBotCommand {
|
|
2115
|
+
command: string;
|
|
2116
|
+
description: string;
|
|
2117
|
+
handler: (ctx: TelegramCommandContext) => Promise<void>;
|
|
2118
|
+
}
|
|
2119
|
+
interface TelegramCommandContext {
|
|
2120
|
+
chatId: string;
|
|
2121
|
+
userId?: string;
|
|
2122
|
+
args: string[];
|
|
2123
|
+
messageId: number;
|
|
2124
|
+
reply?: (text: string, options?: SendMessageOptions) => Promise<string>;
|
|
2125
|
+
}
|
|
2126
|
+
interface SendMessageOptions {
|
|
2127
|
+
parseMode?: 'Markdown' | 'HTML' | 'None';
|
|
2128
|
+
replyTo?: number;
|
|
2129
|
+
replyMarkup?: ReplyMarkup;
|
|
2130
|
+
}
|
|
2131
|
+
type ReplyMarkup = InlineKeyboardMarkup | ReplyKeyboardMarkup;
|
|
2132
|
+
interface InlineKeyboardMarkup {
|
|
2133
|
+
inline_keyboard: InlineKeyboardButton[][];
|
|
2134
|
+
}
|
|
2135
|
+
interface InlineKeyboardButton {
|
|
2136
|
+
text: string;
|
|
2137
|
+
url?: string;
|
|
2138
|
+
callback_data?: string;
|
|
2139
|
+
}
|
|
2140
|
+
interface ReplyKeyboardMarkup {
|
|
2141
|
+
keyboard: KeyboardButton[][];
|
|
2142
|
+
resize_keyboard?: boolean;
|
|
2143
|
+
one_time_keyboard?: boolean;
|
|
2144
|
+
selective?: boolean;
|
|
2145
|
+
}
|
|
2146
|
+
interface KeyboardButton {
|
|
2147
|
+
text: string;
|
|
2148
|
+
request_contact?: boolean;
|
|
2149
|
+
request_location?: boolean;
|
|
1828
2150
|
}
|
|
1829
2151
|
declare class TelegramPlugin extends BaseChannelPlugin {
|
|
1830
2152
|
readonly id: string;
|
|
1831
2153
|
readonly platform: "telegram";
|
|
1832
2154
|
readonly name = "Telegram Bot";
|
|
1833
2155
|
private botConfig;
|
|
1834
|
-
private pollingInterval;
|
|
1835
|
-
private lastUpdateId;
|
|
1836
2156
|
private baseUrl;
|
|
2157
|
+
private abortController;
|
|
2158
|
+
private lastUpdateId;
|
|
2159
|
+
private typingTimers;
|
|
2160
|
+
private commandRouter;
|
|
2161
|
+
private retryState;
|
|
1837
2162
|
constructor(id?: string);
|
|
1838
2163
|
protected doStart(): Promise<void>;
|
|
1839
2164
|
protected doStop(): Promise<void>;
|
|
1840
2165
|
send(message: GatewayMessage): Promise<string>;
|
|
2166
|
+
sendTyping(chatId: string): Promise<void>;
|
|
2167
|
+
sendChatAction(chatId: string, action: 'typing' | 'upload_photo' | 'upload_document' | 'record_video' | 'upload_video' | 'record_audio' | 'upload_audio'): Promise<void>;
|
|
2168
|
+
private scheduleTypingStop;
|
|
2169
|
+
private clearAllTyping;
|
|
2170
|
+
private detectParseMode;
|
|
1841
2171
|
private startPolling;
|
|
1842
|
-
private
|
|
2172
|
+
private pollLoop;
|
|
1843
2173
|
private poll;
|
|
2174
|
+
private handlePollingError;
|
|
2175
|
+
private sleep;
|
|
1844
2176
|
private handleTelegramMessage;
|
|
2177
|
+
private handleCommand;
|
|
1845
2178
|
private toGatewayMessage;
|
|
1846
2179
|
private parseContent;
|
|
1847
|
-
|
|
1848
|
-
private
|
|
2180
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2181
|
+
private processMessageAndGetSessionId;
|
|
1849
2182
|
private getMe;
|
|
1850
2183
|
private getUpdates;
|
|
1851
|
-
private
|
|
2184
|
+
private sendApiMessage;
|
|
1852
2185
|
private request;
|
|
1853
2186
|
}
|
|
1854
2187
|
|
|
@@ -1875,6 +2208,9 @@ declare class DiscordPlugin extends BaseChannelPlugin {
|
|
|
1875
2208
|
private heartbeatInterval;
|
|
1876
2209
|
private sessionId;
|
|
1877
2210
|
private sequenceNumber;
|
|
2211
|
+
private abortController;
|
|
2212
|
+
private reconnectAttempts;
|
|
2213
|
+
private maxReconnectAttempts;
|
|
1878
2214
|
constructor(id?: string);
|
|
1879
2215
|
protected doStart(): Promise<void>;
|
|
1880
2216
|
protected doStop(): Promise<void>;
|
|
@@ -1886,8 +2222,8 @@ declare class DiscordPlugin extends BaseChannelPlugin {
|
|
|
1886
2222
|
private handleDiscordMessage;
|
|
1887
2223
|
private toGatewayMessage;
|
|
1888
2224
|
private parseContent;
|
|
1889
|
-
|
|
1890
|
-
private
|
|
2225
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2226
|
+
private processMessageAndGetSessionId;
|
|
1891
2227
|
private getCurrentUser;
|
|
1892
2228
|
private getGatewayBot;
|
|
1893
2229
|
private createMessage;
|
|
@@ -1912,6 +2248,7 @@ declare class SlackPlugin extends BaseChannelPlugin {
|
|
|
1912
2248
|
private botConfig;
|
|
1913
2249
|
private baseUrl;
|
|
1914
2250
|
private socketModeClient;
|
|
2251
|
+
private abortController;
|
|
1915
2252
|
constructor(id?: string);
|
|
1916
2253
|
protected doStart(): Promise<void>;
|
|
1917
2254
|
protected doStop(): Promise<void>;
|
|
@@ -1921,8 +2258,8 @@ declare class SlackPlugin extends BaseChannelPlugin {
|
|
|
1921
2258
|
private handleSlackMessage;
|
|
1922
2259
|
private toGatewayMessage;
|
|
1923
2260
|
private parseContent;
|
|
1924
|
-
|
|
1925
|
-
private
|
|
2261
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2262
|
+
private processMessageAndGetSessionId;
|
|
1926
2263
|
private authTest;
|
|
1927
2264
|
private postMessage;
|
|
1928
2265
|
private request;
|
|
@@ -1973,6 +2310,7 @@ declare class FeishuPlugin extends BaseChannelPlugin {
|
|
|
1973
2310
|
private baseUrl;
|
|
1974
2311
|
private tenantAccessToken;
|
|
1975
2312
|
private tokenExpireTime;
|
|
2313
|
+
private abortController;
|
|
1976
2314
|
constructor(id?: string);
|
|
1977
2315
|
protected doStart(): Promise<void>;
|
|
1978
2316
|
protected doStop(): Promise<void>;
|
|
@@ -1981,8 +2319,8 @@ declare class FeishuPlugin extends BaseChannelPlugin {
|
|
|
1981
2319
|
private toGatewayMessage;
|
|
1982
2320
|
private parseContent;
|
|
1983
2321
|
private extractPostContent;
|
|
1984
|
-
|
|
1985
|
-
private
|
|
2322
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2323
|
+
private processMessageAndGetSessionId;
|
|
1986
2324
|
private refreshTenantAccessToken;
|
|
1987
2325
|
private ensureTokenValid;
|
|
1988
2326
|
private sendMessage;
|
|
@@ -2008,6 +2346,7 @@ declare class WeChatPlugin extends BaseChannelPlugin {
|
|
|
2008
2346
|
private botConfig;
|
|
2009
2347
|
private accessToken;
|
|
2010
2348
|
private tokenExpireTime;
|
|
2349
|
+
private abortController;
|
|
2011
2350
|
constructor(id?: string);
|
|
2012
2351
|
protected doStart(): Promise<void>;
|
|
2013
2352
|
protected doStop(): Promise<void>;
|
|
@@ -2016,8 +2355,8 @@ declare class WeChatPlugin extends BaseChannelPlugin {
|
|
|
2016
2355
|
private parseXmlMessage;
|
|
2017
2356
|
private toGatewayMessage;
|
|
2018
2357
|
private parseContent;
|
|
2019
|
-
|
|
2020
|
-
private
|
|
2358
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2359
|
+
private processMessageAndGetSessionId;
|
|
2021
2360
|
private refreshAccessToken;
|
|
2022
2361
|
private ensureTokenValid;
|
|
2023
2362
|
private sendOfficialMessage;
|
|
@@ -2042,6 +2381,7 @@ declare class WebChatPlugin extends BaseChannelPlugin {
|
|
|
2042
2381
|
private webChatConfig;
|
|
2043
2382
|
private connections;
|
|
2044
2383
|
private heartbeatInterval;
|
|
2384
|
+
private abortController;
|
|
2045
2385
|
private wsServer;
|
|
2046
2386
|
constructor(id?: string);
|
|
2047
2387
|
protected doStart(): Promise<void>;
|
|
@@ -2075,19 +2415,21 @@ declare class SignalPlugin extends BaseChannelPlugin {
|
|
|
2075
2415
|
readonly platform: "signal";
|
|
2076
2416
|
readonly name = "Signal Bot";
|
|
2077
2417
|
private botConfig;
|
|
2078
|
-
private
|
|
2418
|
+
private abortController;
|
|
2079
2419
|
private lastTimestamp;
|
|
2420
|
+
private pollingIntervalMs;
|
|
2080
2421
|
constructor(id?: string);
|
|
2081
2422
|
protected doStart(): Promise<void>;
|
|
2082
2423
|
protected doStop(): Promise<void>;
|
|
2083
2424
|
send(message: GatewayMessage): Promise<string>;
|
|
2084
2425
|
private startPolling;
|
|
2426
|
+
private pollLoop;
|
|
2085
2427
|
private poll;
|
|
2086
2428
|
private handleSignalMessage;
|
|
2087
2429
|
private toGatewayMessage;
|
|
2088
2430
|
private parseContent;
|
|
2089
|
-
|
|
2090
|
-
private
|
|
2431
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2432
|
+
private processMessageAndGetSessionId;
|
|
2091
2433
|
private getAccountInfo;
|
|
2092
2434
|
private receiveMessages;
|
|
2093
2435
|
private sendMessage;
|
|
@@ -2108,6 +2450,9 @@ declare class NostrPlugin extends BaseChannelPlugin {
|
|
|
2108
2450
|
private relayConnections;
|
|
2109
2451
|
private subscriptions;
|
|
2110
2452
|
private eventHandlers;
|
|
2453
|
+
private abortController;
|
|
2454
|
+
private relayReconnectAttempts;
|
|
2455
|
+
private maxReconnectAttempts;
|
|
2111
2456
|
constructor(id?: string);
|
|
2112
2457
|
protected doStart(): Promise<void>;
|
|
2113
2458
|
protected doStop(): Promise<void>;
|
|
@@ -2118,8 +2463,8 @@ declare class NostrPlugin extends BaseChannelPlugin {
|
|
|
2118
2463
|
private toGatewayMessage;
|
|
2119
2464
|
private parseContent;
|
|
2120
2465
|
private findReplyTo;
|
|
2121
|
-
|
|
2122
|
-
private
|
|
2466
|
+
protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
|
|
2467
|
+
private processMessageAndGetSessionId;
|
|
2123
2468
|
private subscribeToRelay;
|
|
2124
2469
|
private createEvent;
|
|
2125
2470
|
private computeEventId;
|
|
@@ -2202,4 +2547,4 @@ declare function initLog(options: {
|
|
|
2202
2547
|
level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
2203
2548
|
}): Promise<void>;
|
|
2204
2549
|
|
|
2205
|
-
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 CreateSessionRequest, type 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 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, 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 SessionManagerConfig, type SessionResetPolicy, type SessionState, type SessionStatusType, SessionStore, type SessionStoreConfig, type SignalBotConfig, type SignalChannelConfig, SignalChannelConfigSchema, SignalPlugin, type SlackBotConfig, type SlackChannelConfig, SlackChannelConfigSchema, SlackPlugin, 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 };
|
|
2550
|
+
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 };
|