ppagent 0.0.37 → 0.1.0

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/lib.d.ts CHANGED
@@ -5,10 +5,10 @@ import { WebSocket } from 'ws';
5
5
  import { ReadStream, Stats } from 'node:fs';
6
6
  import { Buffer as Buffer$1 } from 'node:buffer';
7
7
  import { ISchema, SchemaProperties } from '@formily/react';
8
+ import Keyv from 'keyv';
8
9
  import * as http from 'http';
9
- import { AuthenticationClient, RestClient } from '@directus/sdk';
10
+ import { Tool } from 'ai';
10
11
  import pino, { Level } from 'pino';
11
- import Keyv from 'keyv';
12
12
  import { StreamChatReq, CozeAPI, CreateChatData, StreamChatData } from '@coze/api';
13
13
  import OpenAI, { ClientOptions } from 'openai';
14
14
  import * as typeorm from 'typeorm';
@@ -105,6 +105,7 @@ interface IModelInfo {
105
105
  user_updated?: string;
106
106
  date_update?: any;
107
107
  name: string;
108
+ displayName?: string;
108
109
  desc?: string;
109
110
  }
110
111
  declare enum SimpleSchemaType {
@@ -153,7 +154,7 @@ interface IConfigParams {
153
154
  name: string;
154
155
  desc?: string;
155
156
  /**
156
- * 公共目录的相对路径,如 /public/images/logo.png
157
+ * 公共目录的相对或者绝对路径,如 /public/images/logo.png
157
158
  */
158
159
  logoPath?: string;
159
160
  /**
@@ -187,10 +188,6 @@ declare const config: {
187
188
  publicPathName: string;
188
189
  tempDir: string;
189
190
  redisUrl: string;
190
- offline: boolean;
191
- configServerUrl: string;
192
- configServerEmail: string;
193
- configServerPassword: string;
194
191
  publicToken: string;
195
192
  publicForceAuth: boolean;
196
193
  secretFile: string;
@@ -204,6 +201,20 @@ declare const config: {
204
201
  dbProvider: string;
205
202
  dbConnection: string;
206
203
  minioMessageBucket: string;
204
+ imUserId: string;
205
+ imUserNickname: string;
206
+ imUserFaceURL: string;
207
+ imUserEx: {
208
+ owner: boolean;
209
+ };
210
+ imUserUpdateInfo: boolean;
211
+ imEnabled: boolean;
212
+ imApiAddr: string;
213
+ imWSAddr: string;
214
+ imRootID: string;
215
+ imRootSecret: string;
216
+ imSourceFilterMode: string;
217
+ imSourceFilterList: string[];
207
218
  };
208
219
 
209
220
  interface IInstanceCreateOptions {
@@ -249,6 +260,7 @@ declare abstract class InstanceBaseManager<InstanceType extends IInstance, Creat
249
260
  * @returns
250
261
  */
251
262
  getInstance(instanceName: string): InstanceType;
263
+ removeInstance(instanceName: string): void;
252
264
  /**
253
265
  * 获取某个类型的所有的实例
254
266
  * @param typeName 类型名称
@@ -705,9 +717,9 @@ interface ISourceChatMessage {
705
717
  */
706
718
  customType?: string;
707
719
  /**
708
- * 消息状态,仅用于标记大模型返回的消息。reasoning表示推理过程消息,content表示回复的消息。为空表示content。
720
+ * 消息状态,仅用于标记大模型返回的消息。reasoning表示推理过程消息,content表示回复的消息,tool表示工具调用消息。为空表示content。
709
721
  */
710
- status?: "reasoning" | "content";
722
+ status?: "reasoning" | "content" | "tool";
711
723
  }
712
724
  interface ISourceGroupChatMessage extends ISourceChatMessage {
713
725
  groupInfo: ISourceUserInfo;
@@ -886,6 +898,7 @@ interface IBotParams extends IConfigParams {
886
898
  * 在一个用户的当前对话中是否允许有多个活跃的chat,默认false。,一般均不允许,agent会等待bot上一个回复完成再继续下一次对话
887
899
  */
888
900
  allowMultiActiveChat?: boolean;
901
+ supportTools?: boolean;
889
902
  }
890
903
  /**
891
904
  * 机器人的实例属性,在创建机器人实例的时候配置
@@ -895,6 +908,11 @@ interface IBotOptions extends IInstanceCreateOptions {
895
908
  * 并不是所有bot都支持自定义prompt,比如agent类的,一般都在agent平台上预置好,或者通过自定义变量传入
896
909
  */
897
910
  systemPrompt?: string;
911
+ /**
912
+ * 可调用的工具集的instanceId.toolKey集合。不是所有bot都支持工具调用。
913
+ * 如 ["toolInstanceId1.toolKey1", "toolInstanceId2.toolKey2"]
914
+ */
915
+ tools?: string[];
898
916
  }
899
917
  interface IMessageContentReceiver {
900
918
  /**
@@ -1007,22 +1025,28 @@ interface IBotCacheMessage {
1007
1025
  */
1008
1026
  declare class HistoryMessageManager {
1009
1027
  protected options: IHisotryMessageManagerOptions;
1028
+ protected namespace: string;
1010
1029
  static DefaultOptions: IHisotryMessageManagerOptions;
1011
- constructor(options: IHisotryMessageManagerOptions);
1030
+ protected cache: Keyv;
1031
+ constructor(options: IHisotryMessageManagerOptions, namespace?: string);
1012
1032
  protected messages: IBotCacheMessage[];
1013
1033
  protected wordsCount: number;
1034
+ protected loaded: boolean;
1035
+ protected loadPromise: Promise<void> | undefined;
1036
+ protected load(): Promise<void>;
1037
+ protected save(): void;
1014
1038
  /**
1015
1039
  * 增加一条历史消息,如果是文本类型的,需要单独传入文本内容content,以便统计字数
1016
1040
  * @param message
1017
1041
  * @param content
1018
1042
  */
1019
- addMessage(message: IBotHistoryMessage, content?: SourceChatContent): void;
1043
+ addMessage(message: IBotHistoryMessage, content?: SourceChatContent): Promise<void>;
1020
1044
  /**
1021
1045
  * 获取历史消息,获取的是内部的一个浅拷贝
1022
1046
  * @returns
1023
1047
  */
1024
- getHistoryMessages(): IBotHistoryMessage[];
1025
- clearHistory(): void;
1048
+ getHistoryMessages(): Promise<IBotHistoryMessage[]>;
1049
+ clearHistory(): Promise<void>;
1026
1050
  }
1027
1051
 
1028
1052
  interface IDisposable {
@@ -1215,6 +1239,21 @@ declare class TaskService implements IDisposable {
1215
1239
  dispose(): Promise<string>;
1216
1240
  }
1217
1241
 
1242
+ interface IToolOptions extends IInstanceCreateOptions {
1243
+ /**
1244
+ * 工具集的描述
1245
+ */
1246
+ description?: string;
1247
+ }
1248
+ interface ITool extends IInstance {
1249
+ getTools(): Promise<Record<string, Tool>>;
1250
+ get options(): IToolOptions;
1251
+ get params(): IToolParams;
1252
+ }
1253
+ type ToolCreator = (options: IToolOptions) => ITool;
1254
+ interface IToolParams extends IConfigParams {
1255
+ }
1256
+
1218
1257
  type Creator<OptionsType, InstanceType> = (options: OptionsType) => InstanceType;
1219
1258
  interface IInstanceCreator<OptionsType, InstanceType, ParamsType> {
1220
1259
  creator: Creator<OptionsType, InstanceType>;
@@ -1241,6 +1280,7 @@ interface IPPAgentPluginHandler extends IDisposable {
1241
1280
  sources?: IInstanceCreator<ISourceOptions, ISource, ISourceParamas>[];
1242
1281
  taskTriggers?: IInstanceCreator<ITaskTriggerOptions, ITaskTrigger, ITaskTriggerParams>[];
1243
1282
  taskRunners?: IInstanceCreator<ITaskRunnerOptions, ITaskRunner, ITaskRunnerParams>[];
1283
+ tools?: IInstanceCreator<IToolOptions, ITool, IToolParams>[];
1244
1284
  }>;
1245
1285
  /**
1246
1286
  * HTTP服务启动之前(agent和task创建之后)
@@ -1257,10 +1297,6 @@ interface IPPAgentPluginHandler extends IDisposable {
1257
1297
  * @returns
1258
1298
  */
1259
1299
  beforeClose?: () => Promise<void>;
1260
- /**
1261
- * 是否必须使用在线配置的相关功能,如进行数据存储。
1262
- */
1263
- needOnline: boolean;
1264
1300
  /**
1265
1301
  * 插件名称,需要跟package.json中的完全一致
1266
1302
  */
@@ -1303,6 +1339,13 @@ interface IAgentModels {
1303
1339
  name: string;
1304
1340
  options: ISourceOptions;
1305
1341
  }[];
1342
+ /**
1343
+ * 工具列表
1344
+ */
1345
+ tools?: {
1346
+ name: string;
1347
+ options: IToolOptions;
1348
+ }[];
1306
1349
  }
1307
1350
  interface IAgentServiceOptions {
1308
1351
  /**
@@ -1327,6 +1370,7 @@ declare class AgentService implements IDisposable {
1327
1370
  bots: number;
1328
1371
  sources: number;
1329
1372
  skills: number;
1373
+ tools: number;
1330
1374
  };
1331
1375
  get agents(): Agent[];
1332
1376
  init(): Promise<void>;
@@ -1338,6 +1382,7 @@ declare class AgentService implements IDisposable {
1338
1382
  private _loadConfig;
1339
1383
  private _loadTableConfig;
1340
1384
  private _loadInstances;
1385
+ private _loadTools;
1341
1386
  private _loadSources;
1342
1387
  private _loadBots;
1343
1388
  private _loadSkills;
@@ -1442,16 +1487,74 @@ declare class GlobalEvent extends Emittery<{
1442
1487
  registerGlobalEventNames(name: string): void;
1443
1488
  }
1444
1489
 
1490
+ declare class ToolManager extends InstanceBaseManager<ITool, ToolCreator, IToolOptions, IToolParams> {
1491
+ }
1492
+
1493
+ interface GetListParams {
1494
+ resource: string;
1495
+ pagination?: {
1496
+ current?: number;
1497
+ pageSize?: number;
1498
+ };
1499
+ sorters?: Array<{
1500
+ field: string;
1501
+ order: "asc" | "desc";
1502
+ }>;
1503
+ filters?: Array<{
1504
+ field: string;
1505
+ operator: string;
1506
+ value: any;
1507
+ }>;
1508
+ }
1509
+ interface GetOneParams {
1510
+ resource: string;
1511
+ id: string;
1512
+ }
1513
+ interface CreateParams {
1514
+ resource: string;
1515
+ variables: any;
1516
+ }
1517
+ interface UpdateParams {
1518
+ resource: string;
1519
+ id: string;
1520
+ variables: any;
1521
+ }
1522
+ interface DeleteOneParams {
1523
+ resource: string;
1524
+ id: string;
1525
+ }
1526
+ interface GetListResult<T = any> {
1527
+ data: T[];
1528
+ total: number;
1529
+ }
1530
+ interface DataResult<T = any> {
1531
+ data: T;
1532
+ }
1533
+ declare class DbService {
1534
+ private repositories;
1535
+ private currentUserId;
1536
+ constructor();
1537
+ private initRepositories;
1538
+ private getRepository;
1539
+ private buildFilters;
1540
+ private buildOrder;
1541
+ getList(params: GetListParams): Promise<GetListResult>;
1542
+ getOne(params: GetOneParams): Promise<DataResult>;
1543
+ create(params: CreateParams): Promise<DataResult>;
1544
+ update(params: UpdateParams): Promise<DataResult>;
1545
+ deleteOne(params: DeleteOneParams): Promise<DataResult>;
1546
+ getMany(params: {
1547
+ resource: string;
1548
+ ids: string[];
1549
+ }): Promise<GetListResult>;
1550
+ }
1551
+
1445
1552
  interface IPPAgentOptions {
1446
1553
  /**
1447
1554
  * agent服务的构建参数
1448
1555
  */
1449
1556
  agentServiceOptions?: IAgentServiceOptions;
1450
1557
  taskServiceOptions?: ITaskServiceOptions;
1451
- /**
1452
- * 是否是离线模式,离线模式不从网络加载配置
1453
- */
1454
- offline?: boolean;
1455
1558
  /**
1456
1559
  * 如果配置,那么应用可以在有需要的时候使用默认图
1457
1560
  */
@@ -1486,163 +1589,34 @@ declare class PPAgent extends Emittery {
1486
1589
  private _taskService;
1487
1590
  private _taskTriggerManager;
1488
1591
  private _taskRunnerManager;
1592
+ private _toolManager;
1489
1593
  private _xmlParser;
1490
1594
  private _sharedCover;
1491
1595
  private _sharedLogo;
1492
- private _client;
1493
1596
  private _me;
1494
1597
  private _globalEvent;
1495
1598
  private _logger;
1496
1599
  private _onlinePluginInfos;
1497
1600
  private _services;
1601
+ private _dbService;
1498
1602
  get server(): FastifyInstance<fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>;
1499
1603
  get skillManager(): SkillManager;
1500
1604
  get sourceManager(): SourceManager;
1501
1605
  get botManager(): BotManager;
1502
1606
  get taskTriggerManager(): TaskTriggerManager;
1503
1607
  get taskRunnerManager(): TaskRunnerManager;
1608
+ get toolManager(): ToolManager;
1504
1609
  get agentService(): AgentService;
1505
- get offlineMode(): boolean;
1506
1610
  get sharedCover(): IAsyncFile;
1507
1611
  get sharedLogo(): IAsyncFile;
1508
- get client(): AuthenticationClient<any> & RestClient<any>;
1509
1612
  get options(): IPPAgentOptions;
1510
1613
  get taskService(): TaskService;
1511
1614
  get globalEvent(): GlobalEvent;
1512
1615
  get plugins(): IPPAgentPluginHandler[];
1513
- get me(): {
1514
- id: string;
1515
- first_name: string | null;
1516
- last_name: string | null;
1517
- email: string | null;
1518
- password: string | null;
1519
- location: string | null;
1520
- title: string | null;
1521
- description: string | null;
1522
- tags: string[] | null;
1523
- avatar: string | {
1524
- id: string;
1525
- storage: string;
1526
- filename_disk: string | null;
1527
- filename_download: string;
1528
- title: string | null;
1529
- type: string | null;
1530
- folder: string | {
1531
- id: string;
1532
- name: string;
1533
- parent: string | /*elided*/ any;
1534
- };
1535
- uploaded_by: string | /*elided*/ any;
1536
- uploaded_on: "datetime";
1537
- modified_by: string | /*elided*/ any;
1538
- modified_on: "datetime";
1539
- charset: string | null;
1540
- filesize: string | null;
1541
- width: number | null;
1542
- height: number | null;
1543
- duration: number | null;
1544
- embed: unknown | null;
1545
- description: string | null;
1546
- location: string | null;
1547
- tags: string[] | null;
1548
- metadata: Record<string, any> | null;
1549
- focal_point_x: number | null;
1550
- focal_point_y: number | null;
1551
- };
1552
- language: string | null;
1553
- theme: string | null;
1554
- tfa_secret: string | null;
1555
- status: string;
1556
- role: string | {
1557
- id: string;
1558
- name: string;
1559
- icon: string;
1560
- description: string | null;
1561
- parent: string | /*elided*/ any;
1562
- children: string[] | /*elided*/ any[];
1563
- policies: string[] | {
1564
- id: string;
1565
- role: string | /*elided*/ any;
1566
- user: string | /*elided*/ any;
1567
- policy: string | {
1568
- id: string;
1569
- name: string;
1570
- icon: string;
1571
- description: string | null;
1572
- ip_access: string | null;
1573
- enforce_tfa: boolean;
1574
- admin_access: boolean;
1575
- app_access: boolean;
1576
- permissions: number[] | {
1577
- id: number;
1578
- policy: string | /*elided*/ any;
1579
- collection: string;
1580
- action: string;
1581
- permissions: Record<string, any> | null;
1582
- validation: Record<string, any> | null;
1583
- presets: Record<string, any> | null;
1584
- fields: string[] | null;
1585
- }[];
1586
- users: string[] | /*elided*/ any[];
1587
- roles: string[] | /*elided*/ any[];
1588
- };
1589
- sort: number;
1590
- }[];
1591
- users: string[] | /*elided*/ any[];
1592
- };
1593
- token: string | null;
1594
- last_access: "datetime" | null;
1595
- last_page: string | null;
1596
- provider: string;
1597
- external_identifier: string | null;
1598
- auth_data: Record<string, any> | null;
1599
- email_notifications: boolean | null;
1600
- appearance: string | null;
1601
- theme_dark: string | null;
1602
- theme_light: string | null;
1603
- theme_light_overrides: Record<string, unknown> | null;
1604
- theme_dark_overrides: Record<string, unknown> | null;
1605
- policies: string[] | {
1606
- id: string;
1607
- name: string;
1608
- icon: string;
1609
- description: string | null;
1610
- ip_access: string | null;
1611
- enforce_tfa: boolean;
1612
- admin_access: boolean;
1613
- app_access: boolean;
1614
- permissions: number[] | {
1615
- id: number;
1616
- policy: string | /*elided*/ any;
1617
- collection: string;
1618
- action: string;
1619
- permissions: Record<string, any> | null;
1620
- validation: Record<string, any> | null;
1621
- presets: Record<string, any> | null;
1622
- fields: string[] | null;
1623
- }[];
1624
- users: string[] | /*elided*/ any[];
1625
- roles: string[] | {
1626
- id: string;
1627
- name: string;
1628
- icon: string;
1629
- description: string | null;
1630
- parent: string | /*elided*/ any;
1631
- children: string[] | /*elided*/ any[];
1632
- policies: string[] | {
1633
- id: string;
1634
- role: string | /*elided*/ any;
1635
- user: string | /*elided*/ any;
1636
- policy: string | /*elided*/ any;
1637
- sort: number;
1638
- }[];
1639
- users: string[] | /*elided*/ any[];
1640
- }[];
1641
- }[];
1642
- };
1643
1616
  get onlinePlugins(): MapIterator<IOnlinePluginInfo>;
1644
1617
  get running(): boolean;
1645
1618
  get services(): Map<string, any>;
1619
+ get dbService(): DbService;
1646
1620
  private _createServer;
1647
1621
  private _initServer;
1648
1622
  private _checkRegister;
@@ -1800,6 +1774,10 @@ interface IAgentOptions {
1800
1774
  * 回复内容的前缀,如 【回复】。仅对推理模型生效。正常对内容的修改可以通过添加技能完成
1801
1775
  */
1802
1776
  contentPrefix?: string;
1777
+ /**
1778
+ * 是否公开该Agent,如果公开,则可以通过公开接口无需鉴权访问
1779
+ */
1780
+ public?: boolean;
1803
1781
  }
1804
1782
  /**
1805
1783
  * 一个智能体,用于连接source和bot。
@@ -1836,6 +1814,7 @@ declare class Agent extends Emittery implements IDisposable {
1836
1814
  */
1837
1815
  sendMessage(message: ISourceChatMessage, to: ISource, now?: boolean, fromMessage?: ISourceChatMessage): Promise<string>;
1838
1816
  dispose(): Promise<string>;
1817
+ processChatRequest(sourceData: ISourceChatMessageEventData): Promise<void>;
1839
1818
  protected processChatMessage: (sourceData: ISourceChatMessageEventData) => Promise<void>;
1840
1819
  protected onChatMessage: (data: IAgentChatEventData) => Promise<void>;
1841
1820
  protected onSelfChatMessage: (data: ISourceChatMessageEventData) => void;
@@ -2117,9 +2096,10 @@ interface IOpenAIBotOptions extends IBasicBotOptions {
2117
2096
  chatOptions: Omit<OpenAI.ChatCompletionCreateParamsStreaming, "messages" | "stream" | "audio">;
2118
2097
  }
2119
2098
  declare class OpenAIBot extends BasicBot {
2099
+ protected _app: PPAgent;
2120
2100
  protected _options: IOpenAIBotOptions;
2121
2101
  static params: IBotParams;
2122
- constructor(_options: IOpenAIBotOptions);
2102
+ constructor(_app: PPAgent, _options: IOpenAIBotOptions);
2123
2103
  protected client: OpenAI;
2124
2104
  get options(): IOpenAIBotOptions;
2125
2105
  get params(): IBotParams;
@@ -2140,7 +2120,7 @@ declare class OpenAIBot extends BasicBot {
2140
2120
  * @returns
2141
2121
  */
2142
2122
  onCompleted: (conversationId: string, timeInSeconds: number) => void;
2143
- }): Promise<IBotHistoryMessage>;
2123
+ }, lastInfo?: ILastBotMessageInfo, evt?: IAgentChatEventData): Promise<IBotHistoryMessage>;
2144
2124
  init(): Promise<void>;
2145
2125
  }
2146
2126
 
@@ -2160,9 +2140,10 @@ interface IFastGPTBotOptions extends IOpenAIBotOptions {
2160
2140
  appId: string;
2161
2141
  }
2162
2142
  declare class FastGPTBot extends OpenAIBot {
2143
+ protected _app: PPAgent;
2163
2144
  protected _options: IFastGPTBotOptions;
2164
2145
  static params: IBotParams;
2165
- constructor(_options: IFastGPTBotOptions);
2146
+ constructor(_app: PPAgent, _options: IFastGPTBotOptions);
2166
2147
  private _commonApiBase;
2167
2148
  get options(): IFastGPTBotOptions;
2168
2149
  get supportConversationOnline(): boolean;
@@ -2224,8 +2205,10 @@ declare class OllamaBot extends BasicBot {
2224
2205
  }
2225
2206
 
2226
2207
  declare class OpenRouterBot extends OpenAIBot {
2208
+ protected _app: PPAgent;
2209
+ protected _options: IOpenAIBotOptions;
2227
2210
  static params: IBotParams;
2228
- constructor(options: IOpenAIBotOptions);
2211
+ constructor(_app: PPAgent, _options: IOpenAIBotOptions);
2229
2212
  }
2230
2213
 
2231
2214
  interface IQAnythingBotOptions extends IBasicBotOptions {
@@ -2350,8 +2333,10 @@ declare class ZhipuQingyanBot extends BasicBot {
2350
2333
  }
2351
2334
 
2352
2335
  declare class SiliconFlowBot extends OpenAIBot {
2336
+ protected _app: PPAgent;
2337
+ protected _options: IOpenAIBotOptions;
2353
2338
  static params: IBotParams;
2354
- constructor(options: IOpenAIBotOptions);
2339
+ constructor(_app: PPAgent, _options: IOpenAIBotOptions);
2355
2340
  }
2356
2341
 
2357
2342
  interface IXunfeiBotOptions extends IOpenAIBotOptions {
@@ -2361,8 +2346,10 @@ interface IXunfeiBotOptions extends IOpenAIBotOptions {
2361
2346
  modelName?: string;
2362
2347
  }
2363
2348
  declare class XunfeiBot extends OpenAIBot {
2349
+ protected _app: PPAgent;
2350
+ protected _options: IXunfeiBotOptions;
2364
2351
  static params: IBotParams;
2365
- constructor(options: IXunfeiBotOptions);
2352
+ constructor(_app: PPAgent, _options: IXunfeiBotOptions);
2366
2353
  }
2367
2354
 
2368
2355
  interface IZhipuBotOptions extends IOpenAIBotOptions {
@@ -2372,8 +2359,10 @@ interface IZhipuBotOptions extends IOpenAIBotOptions {
2372
2359
  modelName?: string;
2373
2360
  }
2374
2361
  declare class ZhipuBot extends OpenAIBot {
2362
+ protected _app: PPAgent;
2363
+ protected _options: IZhipuBotOptions;
2375
2364
  static params: IBotParams;
2376
- constructor(options: IZhipuBotOptions);
2365
+ constructor(_app: PPAgent, _options: IZhipuBotOptions);
2377
2366
  }
2378
2367
 
2379
2368
  interface IPPAgentPluginOptions {
@@ -3059,6 +3048,7 @@ declare class FeishuSource implements ISource, IDisposable {
3059
3048
  static params: ISourceParamas;
3060
3049
  constructor(_app: PPAgent, _options: IFeishuSourceOptions);
3061
3050
  private _me;
3051
+ private _initTime;
3062
3052
  private _client;
3063
3053
  private _wsClient;
3064
3054
  private _connected;
@@ -3529,6 +3519,7 @@ declare function directRunBot(bot: IBot, type: SourceChatMessageType, content: S
3529
3519
  type: SourceChatMessageType;
3530
3520
  }[];
3531
3521
  }>;
3522
+ declare function getTools(ids: string[], toolManager: ToolManager): Promise<Record<string, Tool>>;
3532
3523
 
3533
3524
  /**
3534
3525
  * 按照进来顺序回调输出
@@ -3539,4 +3530,4 @@ declare class SortedPromise extends Emittery {
3539
3530
  add<T>(p: Promise<T>): Promise<T>;
3540
3531
  }
3541
3532
 
3542
- export { Agent, type AgentChatMessageReplyType, AgentService, AsyncFile, type AsyncFileLoader, BaiduSTTSkill, BaiduTTSSkill, BaseDrawSkill, BaseSTTSkill, BaseTTSSkill, BasicBot, type BotCreator, BotManager, ChatMessage, ChatMessageTaskRunner, CogVideoDrawSkill, CogviewDrawSkill, CozeBot, CozeService, CronTaskTrigger, DifyAgentBot, DingRobotSource, EchoTaskRunner, EventTaskTrigger, FastGPTBot, FeishuSource, FishAudioTTSSkill, GlobalEvent, GlobalEventNames, GlobalEventTaskTrigger, HistoryMessageManager, type IAgentChatEventData, type IAgentModels, type IAgentOptions, type IAgentServiceOptions, type IAsyncFile, type IAsyncFileSource, type IBaiduSTTSkillOptions, type IBaiduTTSSkillOptions, type IBaseDrawSkillOptions, type IBaseSTTSkillOptions, type IBaseTTSSkillOptions, type IBasicBotOptions, type IBot, type IBotEventData, type IBotFileInfo, type IBotHistoryMessage, type IBotHistoryRecordEventData, type IBotOptions, type IBotParams, type IBotReadyMessage, type IChatMessageTaskRunnerOptions, type ICogVideoDrawSkillOptions, type ICogviewDrawSkillOptions, type IConfigParams, type IConfigSchema, type ICozeBotOptions, type ICozeServiceOptions, type ICronTaskTriggerOptions, type IDifyAgentBotOptions, type IDingRobotSourceOptions, type IDingRobotSourceParams, type IDisposable, type IDrawResult, type IEventTaskTriggerOptions, type IFastGPTBotOptions, type IFeishuSourceOptions, type IFishAudioTTSSkillOptions, type IGlobalEventData, type IGlobalNotifyEventData, type IHisotryMessageManagerOptions, type IInstance, type IInstanceBaseMangerOptions, type IInstanceCreateOptions, type ILastBotMessageInfo, type ILogger, type ILoggerEmitContent, type IMessageContentReceiver, type IMessageContentRule, type IMessageRule, type IModelInfo, type IOllamaBotOptions, type IOnlinePluginInfo, type IOpenAIBotOptions, type IOpenAIDrawSkillOptions, type IOpenAISTTSkillOptions, type IOpenAITTSSkillOptions, type IPPAgentOptions, type IPPAgentPlugin, type IPPAgentPluginHandler, type IPPAgentPluginOptions, type IQAnythingBotOptions, type IQQSourceOptions, type ISenseVoiceSTTSkillOptions, type ISiliconFlowDrawSkillOptions, type ISiliconFlowSTTSkillOptions, type ISiliconFlowTTSSkillOptions, type ISimpleSchemaItem, type ISkill, type ISkillOptions, type ISkillParams, type ISource, type ISourceActionInfo, type ISourceApiAction, type ISourceApiResponseType, type ISourceChatMessage, type ISourceChatMessageEventData, type ISourceEventData, type ISourceEventTaskTriggerOptions, type ISourceGroupChatMessage, type ISourceGroupInfoChangedEventData, type ISourceLoginEventData, type ISourceLogoutEventData, type ISourceOptions, type ISourceParamas, type ISourceResponseMessageEventData, type ISourceSystemEventData, type ISourceTodoEventData, type ISourceUserInfo, type ISourceWSNormalInMessage, type ISourceWSNormalOutMessage, type ISoviteTTSSkillOptions, type ITaskConfig, type ITaskEventTriggerData, type ITaskRunResult, type ITaskRunner, type ITaskRunnerOptions, type ITaskRunnerParams, type ITaskServiceOptions, type ITaskTrigger, type ITaskTriggerData, type ITaskTriggerOptions, type ITaskTriggerParams, type ITencentSTTSkillOptions, type ITencentTTSSkillOptions, type IWCAISourceOptions, type IWCOASourceOptions, type IWeWorkSourceOptions, type IWenxinAgentBotOptions, type IXunfeiBotOptions, type IXunfeiSTTSkillOptions, type IXunfeiTTSSkillOptions, type IYuanQiBotOptions, type IZhipuBotOptions, type IZhipuQingyanBotOptions, InstanceBaseManager, OllamaBot, OpenAIBot, OpenAIDrawSkill, OpenAISTTSkill, OpenAITTSSkill, OpenRouterBot, PPAgent, QAnythingBot, QQSource, SchemaBaseProperties, SenseVoiceSTTSkill, SiliconFlowBot, SiliconFlowDrawSkill, SiliconFlowSTTSkill, SiliconFlowTTSSkill, SimpleSchemaType, type SkillCreator, SkillManager, SkillSchemaBaseProperties, SortedPromise, SourceApiMissingParamsError, SourceApiNotFoundError, SourceApiUnAuthorizedError, type SourceChatArticleContent, type SourceChatAudioContent, type SourceChatCardContent, type SourceChatContactContent, type SourceChatContent, type SourceChatEmotionContent, type SourceChatFileContent, type SourceChatImageContent, type SourceChatMPContent, SourceChatMessageType, type SourceChatMusicContent, type SourceChatPatContentType, type SourceChatPhoneContent, type SourceChatPositionContent, type SourceChatRecallContent, type SourceChatRefContent, type SourceChatRichTextContent, type SourceChatSubscribeContent, type SourceChatSystemContent, type SourceChatTextContent, type SourceChatVideoContent, type SourceCreator, SourceEventTaskTrigger, SourceEventType, SourceManager, type SourceWSCustomAction, type SourceWSNormalAction, SoviteTTSSkill, type TaskRunnerCreator, TaskRunnerManager, TaskRunnerSchemaBaseProperties, TaskService, TaskTrigger, type TaskTriggerCreator, TaskTriggerManager, TencentSTTSkill, TencentTTSSkill, WCAISource, WCOASource, WeWorkSource, WenxinAgentBot, XunfeiBot, XunfeiSTTSkill, XunfeiTTSSkill, YuanQiBot, ZhipuBot, ZhipuQingyanBot, addWavHeader, apiPlugin, arm2wav, betterMarkdown, chatMessageRepo, chatSource, checkMessageRule, config, createCacheManager, createFakeMessage, createFormilySchema, defaultPlugin, detectName, directRunBot, disposeObjects, extractArticleInfo, extractImageUrls, extractMarkdownImageTags, extractMessageContentText, extractPositionInfo, filterContentRule, generateRandomString, getEnvNumber, getFromMessageSummary, getLogger, getSecret, getToMessageSummary, hasEmoji, hasMarkdown, installAndGetPluginInfo, installDep, isPhoneNumber, removeEmoji, removeMarkdown, removeTextAt, richText2Markdown, sleep, sse, stream2buffer, transFileFormat, transFormat, uninstallDep, wav2amr };
3533
+ export { Agent, type AgentChatMessageReplyType, AgentService, AsyncFile, type AsyncFileLoader, BaiduSTTSkill, BaiduTTSSkill, BaseDrawSkill, BaseSTTSkill, BaseTTSSkill, BasicBot, type BotCreator, BotManager, ChatMessage, ChatMessageTaskRunner, CogVideoDrawSkill, CogviewDrawSkill, CozeBot, CozeService, CronTaskTrigger, DifyAgentBot, DingRobotSource, EchoTaskRunner, EventTaskTrigger, FastGPTBot, FeishuSource, FishAudioTTSSkill, GlobalEvent, GlobalEventNames, GlobalEventTaskTrigger, HistoryMessageManager, type IAgentChatEventData, type IAgentModels, type IAgentOptions, type IAgentServiceOptions, type IAsyncFile, type IAsyncFileSource, type IBaiduSTTSkillOptions, type IBaiduTTSSkillOptions, type IBaseDrawSkillOptions, type IBaseSTTSkillOptions, type IBaseTTSSkillOptions, type IBasicBotOptions, type IBot, type IBotEventData, type IBotFileInfo, type IBotHistoryMessage, type IBotHistoryRecordEventData, type IBotOptions, type IBotParams, type IBotReadyMessage, type IChatMessageTaskRunnerOptions, type ICogVideoDrawSkillOptions, type ICogviewDrawSkillOptions, type IConfigParams, type IConfigSchema, type ICozeBotOptions, type ICozeServiceOptions, type ICronTaskTriggerOptions, type IDifyAgentBotOptions, type IDingRobotSourceOptions, type IDingRobotSourceParams, type IDisposable, type IDrawResult, type IEventTaskTriggerOptions, type IFastGPTBotOptions, type IFeishuSourceOptions, type IFishAudioTTSSkillOptions, type IGlobalEventData, type IGlobalNotifyEventData, type IHisotryMessageManagerOptions, type IInstance, type IInstanceBaseMangerOptions, type IInstanceCreateOptions, type ILastBotMessageInfo, type ILogger, type ILoggerEmitContent, type IMessageContentReceiver, type IMessageContentRule, type IMessageRule, type IModelInfo, type IOllamaBotOptions, type IOnlinePluginInfo, type IOpenAIBotOptions, type IOpenAIDrawSkillOptions, type IOpenAISTTSkillOptions, type IOpenAITTSSkillOptions, type IPPAgentOptions, type IPPAgentPlugin, type IPPAgentPluginHandler, type IPPAgentPluginOptions, type IQAnythingBotOptions, type IQQSourceOptions, type ISenseVoiceSTTSkillOptions, type ISiliconFlowDrawSkillOptions, type ISiliconFlowSTTSkillOptions, type ISiliconFlowTTSSkillOptions, type ISimpleSchemaItem, type ISkill, type ISkillOptions, type ISkillParams, type ISource, type ISourceActionInfo, type ISourceApiAction, type ISourceApiResponseType, type ISourceChatMessage, type ISourceChatMessageEventData, type ISourceEventData, type ISourceEventTaskTriggerOptions, type ISourceGroupChatMessage, type ISourceGroupInfoChangedEventData, type ISourceLoginEventData, type ISourceLogoutEventData, type ISourceOptions, type ISourceParamas, type ISourceResponseMessageEventData, type ISourceSystemEventData, type ISourceTodoEventData, type ISourceUserInfo, type ISourceWSNormalInMessage, type ISourceWSNormalOutMessage, type ISoviteTTSSkillOptions, type ITaskConfig, type ITaskEventTriggerData, type ITaskRunResult, type ITaskRunner, type ITaskRunnerOptions, type ITaskRunnerParams, type ITaskServiceOptions, type ITaskTrigger, type ITaskTriggerData, type ITaskTriggerOptions, type ITaskTriggerParams, type ITencentSTTSkillOptions, type ITencentTTSSkillOptions, type IWCAISourceOptions, type IWCOASourceOptions, type IWeWorkSourceOptions, type IWenxinAgentBotOptions, type IXunfeiBotOptions, type IXunfeiSTTSkillOptions, type IXunfeiTTSSkillOptions, type IYuanQiBotOptions, type IZhipuBotOptions, type IZhipuQingyanBotOptions, InstanceBaseManager, OllamaBot, OpenAIBot, OpenAIDrawSkill, OpenAISTTSkill, OpenAITTSSkill, OpenRouterBot, PPAgent, QAnythingBot, QQSource, SchemaBaseProperties, SenseVoiceSTTSkill, SiliconFlowBot, SiliconFlowDrawSkill, SiliconFlowSTTSkill, SiliconFlowTTSSkill, SimpleSchemaType, type SkillCreator, SkillManager, SkillSchemaBaseProperties, SortedPromise, SourceApiMissingParamsError, SourceApiNotFoundError, SourceApiUnAuthorizedError, type SourceChatArticleContent, type SourceChatAudioContent, type SourceChatCardContent, type SourceChatContactContent, type SourceChatContent, type SourceChatEmotionContent, type SourceChatFileContent, type SourceChatImageContent, type SourceChatMPContent, SourceChatMessageType, type SourceChatMusicContent, type SourceChatPatContentType, type SourceChatPhoneContent, type SourceChatPositionContent, type SourceChatRecallContent, type SourceChatRefContent, type SourceChatRichTextContent, type SourceChatSubscribeContent, type SourceChatSystemContent, type SourceChatTextContent, type SourceChatVideoContent, type SourceCreator, SourceEventTaskTrigger, SourceEventType, SourceManager, type SourceWSCustomAction, type SourceWSNormalAction, SoviteTTSSkill, type TaskRunnerCreator, TaskRunnerManager, TaskRunnerSchemaBaseProperties, TaskService, TaskTrigger, type TaskTriggerCreator, TaskTriggerManager, TencentSTTSkill, TencentTTSSkill, WCAISource, WCOASource, WeWorkSource, WenxinAgentBot, XunfeiBot, XunfeiSTTSkill, XunfeiTTSSkill, YuanQiBot, ZhipuBot, ZhipuQingyanBot, addWavHeader, apiPlugin, arm2wav, betterMarkdown, chatMessageRepo, chatSource, checkMessageRule, config, createCacheManager, createFakeMessage, createFormilySchema, defaultPlugin, detectName, directRunBot, disposeObjects, extractArticleInfo, extractImageUrls, extractMarkdownImageTags, extractMessageContentText, extractPositionInfo, filterContentRule, generateRandomString, getEnvNumber, getFromMessageSummary, getLogger, getSecret, getToMessageSummary, getTools, hasEmoji, hasMarkdown, installAndGetPluginInfo, installDep, isPhoneNumber, removeEmoji, removeMarkdown, removeTextAt, richText2Markdown, sleep, sse, stream2buffer, transFileFormat, transFormat, uninstallDep, wav2amr };