@coze/realtime-api 1.0.1 → 1.0.3

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/umd/index.js CHANGED
@@ -7,11 +7,11 @@
7
7
  })(self, ()=>(()=>{
8
8
  "use strict";
9
9
  var __webpack_modules__ = {
10
- "?de24": function() {
10
+ "?c628": function() {
11
11
  /* (ignored) */ },
12
- "?2a9f": function() {
12
+ "?9452": function() {
13
13
  /* (ignored) */ },
14
- "?d039": function() {
14
+ "?e2b1": function() {
15
15
  /* (ignored) */ }
16
16
  };
17
17
  /************************************************************************/ // The module cache
@@ -79,7 +79,7 @@
79
79
  EventNames: ()=>/* reexport */ event_handler_EventNames,
80
80
  RealtimeClient: ()=>/* binding */ RealtimeClient
81
81
  });
82
- // NAMESPACE OBJECT: ../../common/temp/default/node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/platform/common/utils.js
82
+ // NAMESPACE OBJECT: ../../common/temp/default/node_modules/.pnpm/axios@1.7.7_debug@4.3.7/node_modules/axios/lib/platform/common/utils.js
83
83
  var common_utils_namespaceObject = {};
84
84
  __webpack_require__.r(common_utils_namespaceObject);
85
85
  __webpack_require__.d(common_utils_namespaceObject, {
@@ -93,6 +93,7 @@
93
93
  var src_utils_namespaceObject = {};
94
94
  __webpack_require__.r(src_utils_namespaceObject);
95
95
  __webpack_require__.d(src_utils_namespaceObject, {
96
+ checkDevicePermission: ()=>checkDevicePermission,
96
97
  checkPermission: ()=>checkPermission,
97
98
  getAudioDevices: ()=>getAudioDevices,
98
99
  sleep: ()=>utils_sleep
@@ -2141,7 +2142,7 @@
2141
2142
  }, {
2142
2143
  highWaterMark: 2
2143
2144
  });
2144
- }; // CONCATENATED MODULE: ../../common/temp/default/node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/adapters/fetch.js
2145
+ }; // CONCATENATED MODULE: ../../common/temp/default/node_modules/.pnpm/axios@1.7.7_debug@4.3.7/node_modules/axios/lib/adapters/fetch.js
2145
2146
  const isFetchSupported = 'function' == typeof fetch && 'function' == typeof Request && 'function' == typeof Response;
2146
2147
  const isReadableStreamSupported = isFetchSupported && 'function' == typeof ReadableStream;
2147
2148
  // used only inside the fetch adapter
@@ -2863,11 +2864,11 @@
2863
2864
  // so that it can keep same with es module or cjs
2864
2865
  const { Axios: axios_Axios, AxiosError: axios_AxiosError, CanceledError: axios_CanceledError, isCancel: axios_isCancel, CancelToken: axios_CancelToken, VERSION: axios_VERSION, all: axios_all, Cancel, isAxiosError: axios_isAxiosError, spread: axios_spread, toFormData: axios_toFormData, AxiosHeaders: axios_AxiosHeaders, HttpStatusCode: axios_HttpStatusCode, formToJSON, getAdapter, mergeConfig: axios_mergeConfig } = lib_axios;
2865
2866
  // EXTERNAL MODULE: os (ignored)
2866
- var os_ignored_ = __webpack_require__("?d039");
2867
+ var os_ignored_ = __webpack_require__("?e2b1");
2867
2868
  // EXTERNAL MODULE: crypto (ignored)
2868
- __webpack_require__("?de24");
2869
+ __webpack_require__("?c628");
2869
2870
  // EXTERNAL MODULE: jsonwebtoken (ignored)
2870
- __webpack_require__("?2a9f");
2871
+ __webpack_require__("?9452");
2871
2872
  class APIResource {
2872
2873
  constructor(client){
2873
2874
  this._client = client;
@@ -3109,6 +3110,10 @@
3109
3110
  }
3110
3111
  }
3111
3112
  const uuid = ()=>(Math.random() * new Date().getTime()).toString();
3113
+ const handleAdditionalMessages = (additional_messages)=>null == additional_messages ? void 0 : additional_messages.map((i)=>({
3114
+ ...i,
3115
+ content: 'object' == typeof i.content ? JSON.stringify(i.content) : i.content
3116
+ }));
3112
3117
  class Chat extends APIResource {
3113
3118
  /**
3114
3119
  * Call the Chat API to send messages to a published Coze agent. | 调用此接口发起一次对话,支持添加上下文
@@ -3130,6 +3135,7 @@
3130
3135
  const apiUrl = `/v3/chat${conversation_id ? `?conversation_id=${conversation_id}` : ''}`;
3131
3136
  const payload = {
3132
3137
  ...rest,
3138
+ additional_messages: handleAdditionalMessages(params.additional_messages),
3133
3139
  stream: false
3134
3140
  };
3135
3141
  const result = await this._client.post(apiUrl, payload, false, options);
@@ -3155,6 +3161,7 @@
3155
3161
  const apiUrl = `/v3/chat${conversation_id ? `?conversation_id=${conversation_id}` : ''}`;
3156
3162
  const payload = {
3157
3163
  ...rest,
3164
+ additional_messages: handleAdditionalMessages(params.additional_messages),
3158
3165
  stream: false
3159
3166
  };
3160
3167
  const result = await this._client.post(apiUrl, payload, false, options);
@@ -3192,6 +3199,7 @@
3192
3199
  const apiUrl = `/v3/chat${conversation_id ? `?conversation_id=${conversation_id}` : ''}`;
3193
3200
  const payload = {
3194
3201
  ...rest,
3202
+ additional_messages: handleAdditionalMessages(params.additional_messages),
3195
3203
  stream: true
3196
3204
  };
3197
3205
  const result = await this._client.post(apiUrl, payload, true, options);
@@ -3282,6 +3290,19 @@
3282
3290
  super(...args), this.messages = new Messages(this._client);
3283
3291
  }
3284
3292
  }
3293
+ var chat_ChatEventType = /*#__PURE__*/ function(ChatEventType) {
3294
+ ChatEventType["CONVERSATION_CHAT_CREATED"] = "conversation.chat.created";
3295
+ ChatEventType["CONVERSATION_CHAT_IN_PROGRESS"] = "conversation.chat.in_progress";
3296
+ ChatEventType["CONVERSATION_CHAT_COMPLETED"] = "conversation.chat.completed";
3297
+ ChatEventType["CONVERSATION_CHAT_FAILED"] = "conversation.chat.failed";
3298
+ ChatEventType["CONVERSATION_CHAT_REQUIRES_ACTION"] = "conversation.chat.requires_action";
3299
+ ChatEventType["CONVERSATION_MESSAGE_DELTA"] = "conversation.message.delta";
3300
+ ChatEventType["CONVERSATION_MESSAGE_COMPLETED"] = "conversation.message.completed";
3301
+ ChatEventType["CONVERSATION_AUDIO_DELTA"] = "conversation.audio.delta";
3302
+ ChatEventType["DONE"] = "done";
3303
+ ChatEventType["ERROR"] = "error";
3304
+ return ChatEventType;
3305
+ }({});
3285
3306
  class messages_Messages extends APIResource {
3286
3307
  /**
3287
3308
  * Create a message and add it to the specified conversation. | 创建一条消息,并将其添加到指定的会话中。
@@ -3366,6 +3387,7 @@
3366
3387
  * @param params - Required The parameters for creating a conversation | 创建会话所需的参数
3367
3388
  * @param params.messages - Optional Messages in the conversation. | 会话中的消息内容。
3368
3389
  * @param params.meta_data - Optional Additional information when creating a message. | 创建消息时的附加消息。
3390
+ * @param params.bot_id - Optional Bind and isolate conversation on different bots. | 绑定和隔离不同Bot的会话。
3369
3391
  * @returns Information about the created conversation. | 会话的基础信息。
3370
3392
  */ async create(params, options) {
3371
3393
  const apiUrl = '/v1/conversation/create';
@@ -3383,6 +3405,27 @@
3383
3405
  const response = await this._client.get(apiUrl, null, false, options);
3384
3406
  return response.data;
3385
3407
  }
3408
+ /**
3409
+ * List all conversations. | 列出 Bot 下所有会话。
3410
+ * @param params
3411
+ * @param params.bot_id - Required Bot ID. | Bot ID。
3412
+ * @param params.page_num - Optional The page number. | 页码,默认值为 1。
3413
+ * @param params.page_size - Optional The number of conversations per page. | 每页的会话数量,默认值为 50。
3414
+ * @returns Information about the conversations. | 会话的信息。
3415
+ */ async list(params, options) {
3416
+ const apiUrl = '/v1/conversations';
3417
+ const response = await this._client.get(apiUrl, params, false, options);
3418
+ return response.data;
3419
+ }
3420
+ /**
3421
+ * Clear a conversation. | 清空会话。
3422
+ * @param conversation_id - Required The ID of the conversation. | Conversation ID,即会话的唯一标识。
3423
+ * @returns Information about the conversation session. | 会话的会话 ID。
3424
+ */ async clear(conversation_id, options) {
3425
+ const apiUrl = `/v1/conversations/${conversation_id}/clear`;
3426
+ const response = await this._client.post(apiUrl, null, false, options);
3427
+ return response.data;
3428
+ }
3386
3429
  constructor(...args){
3387
3430
  super(...args), this.messages = new messages_Messages(this._client);
3388
3431
  }
@@ -3421,6 +3464,9 @@
3421
3464
  * @param params.bot_id - Optional The ID of the bot associated with the workflow. | 可选 与工作流关联的机器人 ID。
3422
3465
  * @param params.parameters - Optional Parameters for the workflow execution. | 可选 工作流执行的参数。
3423
3466
  * @param params.ext - Optional Additional information for the workflow execution. | 可选 工作流执行的附加信息。
3467
+ * @param params.execute_mode - Optional The mode in which to execute the workflow. | 可选 工作流执行的模式。
3468
+ * @param params.connector_id - Optional The ID of the connector to use for the workflow. | 可选 用于工作流的连接器 ID。
3469
+ * @param params.app_id - Optional The ID of the app. | 可选 要进行会话聊天的 App ID
3424
3470
  * @returns RunWorkflowData | 工作流运行数据
3425
3471
  */ async create(params, options) {
3426
3472
  const apiUrl = '/v1/workflow/run';
@@ -3435,6 +3481,9 @@
3435
3481
  * @param params.bot_id - Optional The ID of the bot associated with the workflow. | 可选 与工作流关联的机器人 ID。
3436
3482
  * @param params.parameters - Optional Parameters for the workflow execution. | 可选 工作流执行的参数。
3437
3483
  * @param params.ext - Optional Additional information for the workflow execution. | 可选 工作流执行的附加信息。
3484
+ * @param params.execute_mode - Optional The mode in which to execute the workflow. | 可选 工作流执行的模式。
3485
+ * @param params.connector_id - Optional The ID of the connector to use for the workflow. | 可选 用于工作流的连接器 ID。
3486
+ * @param params.app_id - Optional The ID of the app. | 可选 要进行会话聊天的 App ID
3438
3487
  * @returns Stream<WorkflowEvent, { id: string; event: string; data: string }> | 工作流事件流
3439
3488
  */ async *stream(params, options) {
3440
3489
  const apiUrl = '/v1/workflow/stream_run';
@@ -3468,9 +3517,46 @@
3468
3517
  this.data = data;
3469
3518
  }
3470
3519
  }
3520
+ class WorkflowChat extends APIResource {
3521
+ /**
3522
+ * Execute a chat workflow. | 执行对话流
3523
+ * @docs en: https://www.coze.cn/docs/developer_guides/workflow_chat?_lang=en
3524
+ * @docs zh: https://www.coze.cn/docs/developer_guides/workflow_chat?_lang=zh
3525
+ * @param params.workflow_id - Required The ID of the workflow to chat with. | 必选 要对话的工作流 ID。
3526
+ * @param params.additional_messages - Required Array of messages for the chat. | 必选 对话的消息数组。
3527
+ * @param params.parameters - Required Parameters for the workflow execution. | 必选 工作流执行的参数。
3528
+ * @param params.app_id - Optional The ID of the app. | 可选 应用 ID。
3529
+ * @param params.bot_id - Optional The ID of the bot. | 可选 Bot ID。
3530
+ * @param params.conversation_id - Optional The ID of the conversation. | 可选 会话 ID。
3531
+ * @param params.ext - Optional Additional information for the chat. | 可选 对话的附加信息。
3532
+ * @returns AsyncGenerator<StreamChatData> | 对话数据流
3533
+ */ async *stream(params, options) {
3534
+ const apiUrl = '/v1/workflows/chat';
3535
+ const payload = {
3536
+ ...params,
3537
+ additional_messages: handleAdditionalMessages(params.additional_messages)
3538
+ };
3539
+ const result = await this._client.post(apiUrl, payload, true, options);
3540
+ for await (const message of result)if (message.event === chat_ChatEventType.DONE) {
3541
+ const ret = {
3542
+ event: message.event,
3543
+ data: '[DONE]'
3544
+ };
3545
+ yield ret;
3546
+ } else try {
3547
+ const ret = {
3548
+ event: message.event,
3549
+ data: JSON.parse(message.data)
3550
+ };
3551
+ yield ret;
3552
+ } catch (error) {
3553
+ throw new CozeError(`Could not parse message into JSON:${message.data}`);
3554
+ }
3555
+ }
3556
+ }
3471
3557
  class Workflows extends APIResource {
3472
3558
  constructor(...args){
3473
- super(...args), this.runs = new Runs(this._client);
3559
+ super(...args), this.runs = new Runs(this._client), this.chat = new WorkflowChat(this._client);
3474
3560
  }
3475
3561
  }
3476
3562
  class WorkSpaces extends APIResource {
@@ -3494,6 +3580,8 @@
3494
3580
  };
3495
3581
  class Documents extends APIResource {
3496
3582
  /**
3583
+ * @deprecated The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.list' instead.
3584
+ *
3497
3585
  * View the file list of a specified knowledge base, which includes lists of documents, spreadsheets, or images.
3498
3586
  * | 调用接口查看指定知识库的内容列表,即文件、表格或图像列表。
3499
3587
  * @docs en: https://www.coze.com/docs/developer_guides/list_knowledge_files?_lang=en
@@ -3510,6 +3598,8 @@
3510
3598
  return response;
3511
3599
  }
3512
3600
  /**
3601
+ * @deprecated The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.create' instead.
3602
+ *
3513
3603
  * Upload files to the specific knowledge. | 调用此接口向指定知识库中上传文件。
3514
3604
  * @docs en: https://www.coze.com/docs/developer_guides/create_knowledge_files?_lang=en
3515
3605
  * @docs zh: https://www.coze.cn/docs/developer_guides/create_knowledge_files?_lang=zh
@@ -3526,6 +3616,8 @@
3526
3616
  return response.document_infos;
3527
3617
  }
3528
3618
  /**
3619
+ * @deprecated The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.delete' instead.
3620
+ *
3529
3621
  * Delete text, images, sheets, and other files in the knowledge base, supporting batch deletion.
3530
3622
  * | 删除知识库中的文本、图像、表格等文件,支持批量删除。
3531
3623
  * @docs en: https://www.coze.com/docs/developer_guides/delete_knowledge_files?_lang=en
@@ -3539,6 +3631,8 @@
3539
3631
  }));
3540
3632
  }
3541
3633
  /**
3634
+ * @deprecated The method is deprecated and will be removed in a future version. Please use 'client.datasets.documents.update' instead.
3635
+ *
3542
3636
  * Modify the knowledge base file name and update strategy. | 调用接口修改知识库文件名称和更新策略。
3543
3637
  * @docs en: https://www.coze.com/docs/developer_guides/modify_knowledge_files?_lang=en
3544
3638
  * @docs zh: https://www.coze.cn/docs/developer_guides/modify_knowledge_files?_lang=zh
@@ -3555,7 +3649,79 @@
3555
3649
  }
3556
3650
  class Knowledge extends APIResource {
3557
3651
  constructor(...args){
3558
- super(...args), this.documents = new Documents(this._client);
3652
+ super(...args), /**
3653
+ * @deprecated
3654
+ */ this.documents = new Documents(this._client);
3655
+ }
3656
+ }
3657
+ // Required header for knowledge APIs
3658
+ const documents_documents_headers = {
3659
+ 'agw-js-conv': 'str'
3660
+ };
3661
+ class documents_Documents extends APIResource {
3662
+ /**
3663
+ * View the file list of a specified knowledge base, which includes lists of documents, spreadsheets, or images.
3664
+ * | 调用接口查看指定知识库的内容列表,即文件、表格或图像列表。
3665
+ * @docs en: https://www.coze.com/docs/developer_guides/list_knowledge_files?_lang=en
3666
+ * @docs zh: https://www.coze.cn/docs/developer_guides/list_knowledge_files?_lang=zh
3667
+ * @param params.dataset_id - Required The ID of the knowledge base. | 必选 待查看文件的知识库 ID。
3668
+ * @param params.page - Optional The page number for paginated queries. Default is 1. | 可选 分页查询时的页码。默认为 1。
3669
+ * @param params.page_size - Optional The size of pagination. Default is 10. | 可选 分页大小。默认为 10。
3670
+ * @returns ListDocumentData | 知识库文件列表
3671
+ */ list(params, options) {
3672
+ const apiUrl = '/open_api/knowledge/document/list';
3673
+ const response = this._client.get(apiUrl, params, false, esm_mergeConfig(options, {
3674
+ headers: documents_documents_headers
3675
+ }));
3676
+ return response;
3677
+ }
3678
+ /**
3679
+ * Upload files to the specific knowledge. | 调用此接口向指定知识库中上传文件。
3680
+ * @docs en: https://www.coze.com/docs/developer_guides/create_knowledge_files?_lang=en
3681
+ * @docs zh: https://www.coze.cn/docs/developer_guides/create_knowledge_files?_lang=zh
3682
+ * @param params.dataset_id - Required The ID of the knowledge. | 必选 知识库 ID。
3683
+ * @param params.document_bases - Required The metadata information of the files awaiting upload. | 必选 待上传文件的元数据信息。
3684
+ * @param params.chunk_strategy - Required when uploading files to a new knowledge for the first time. Chunk strategy.
3685
+ * | 向新知识库首次上传文件时必选 分段规则。
3686
+ * @returns DocumentInfo[] | 已上传文件的基本信息
3687
+ */ async create(params, options) {
3688
+ const apiUrl = '/open_api/knowledge/document/create';
3689
+ const response = await this._client.post(apiUrl, params, false, esm_mergeConfig(options, {
3690
+ headers: documents_documents_headers
3691
+ }));
3692
+ return response.document_infos;
3693
+ }
3694
+ /**
3695
+ * Delete text, images, sheets, and other files in the knowledge base, supporting batch deletion.
3696
+ * | 删除知识库中的文本、图像、表格等文件,支持批量删除。
3697
+ * @docs en: https://www.coze.com/docs/developer_guides/delete_knowledge_files?_lang=en
3698
+ * @docs zh: https://www.coze.cn/docs/developer_guides/delete_knowledge_files?_lang=zh
3699
+ * @param params.document_ids - Required The list of knowledge base files to be deleted. | 必选 待删除的文件 ID。
3700
+ * @returns void | 无返回
3701
+ */ async delete(params, options) {
3702
+ const apiUrl = '/open_api/knowledge/document/delete';
3703
+ await this._client.post(apiUrl, params, false, esm_mergeConfig(options, {
3704
+ headers: documents_documents_headers
3705
+ }));
3706
+ }
3707
+ /**
3708
+ * Modify the knowledge base file name and update strategy. | 调用接口修改知识库文件名称和更新策略。
3709
+ * @docs en: https://www.coze.com/docs/developer_guides/modify_knowledge_files?_lang=en
3710
+ * @docs zh: https://www.coze.cn/docs/developer_guides/modify_knowledge_files?_lang=zh
3711
+ * @param params.document_id - Required The ID of the knowledge base file. | 必选 待修改的知识库文件 ID。
3712
+ * @param params.document_name - Optional The new name of the knowledge base file. | 可选 知识库文件的新名称。
3713
+ * @param params.update_rule - Optional The update strategy for online web pages. | 可选 在线网页更新策略。
3714
+ * @returns void | 无返回
3715
+ */ async update(params, options) {
3716
+ const apiUrl = '/open_api/knowledge/document/update';
3717
+ await this._client.post(apiUrl, params, false, esm_mergeConfig(options, {
3718
+ headers: documents_documents_headers
3719
+ }));
3720
+ }
3721
+ }
3722
+ class Datasets extends APIResource {
3723
+ constructor(...args){
3724
+ super(...args), this.documents = new documents_Documents(this._client);
3559
3725
  }
3560
3726
  }
3561
3727
  class Voices extends APIResource {
@@ -3630,7 +3796,7 @@
3630
3796
  super(...args), this.rooms = new Rooms(this._client), this.voices = new Voices(this._client), this.speech = new Speech(this._client);
3631
3797
  }
3632
3798
  }
3633
- var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.0.11","description":"Official Coze Node.js SDK for seamless AI integration into your applications | 扣子官方 Node.js SDK,助您轻松集成 AI 能力到应用中","keywords":["coze","ai","nodejs","sdk","chatbot","typescript"],"homepage":"https://github.com/coze-dev/coze-js/tree/main/packages/coze-js","bugs":{"url":"https://github.com/coze-dev/coze-js/issues"},"repository":{"type":"git","url":"https://github.com/coze-dev/coze-js.git","directory":"packages/coze-js"},"license":"MIT","author":"Leeight <leeight@gmail.com>","type":"module","exports":{".":{"require":"./dist/cjs/index.cjs","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"}},"main":"dist/cjs/index.cjs","module":"dist/esm/index.js","browser":{"crypto":false,"os":false,"jsonwebtoken":false},"types":"dist/types/index.d.ts","files":["dist","LICENSE","README.md","!**/*.tsbuildinfo"],"scripts":{"build":"rm -rf dist && rslib build","format":"prettier --write .","lint":"eslint ./ --cache --quiet","prepublishOnly":"npm run build","start":"rm -rf dist && rslib build -w","test":"vitest","test:cov":"vitest --coverage --run"},"dependencies":{"jsonwebtoken":"^9.0.2"},"devDependencies":{"@coze-infra/eslint-config":"workspace:*","@coze-infra/ts-config":"workspace:*","@coze-infra/vitest-config":"workspace:*","@rslib/core":"0.0.18","@swc/core":"^1.3.14","@types/jsonwebtoken":"^9.0.0","@types/node":"^20","@types/uuid":"^9.0.1","@types/whatwg-fetch":"^0.0.33","@vitest/coverage-v8":"~2.1.4","axios":"^1.7.7","typescript":"^5.5.3","vitest":"~2.1.4"},"peerDependencies":{"axios":"^1.7.1"}}'); // CONCATENATED MODULE: ./src/version.ts
3799
+ var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.0.15","description":"Official Coze Node.js SDK for seamless AI integration into your applications | 扣子官方 Node.js SDK,助您轻松集成 AI 能力到应用中","keywords":["coze","ai","nodejs","sdk","chatbot","typescript"],"homepage":"https://github.com/coze-dev/coze-js/tree/main/packages/coze-js","bugs":{"url":"https://github.com/coze-dev/coze-js/issues"},"repository":{"type":"git","url":"https://github.com/coze-dev/coze-js.git","directory":"packages/coze-js"},"license":"MIT","author":"Leeight <leeight@gmail.com>","type":"module","exports":{".":{"require":"./dist/cjs/index.cjs","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"}},"main":"dist/cjs/index.cjs","module":"dist/esm/index.js","browser":{"crypto":false,"os":false,"jsonwebtoken":false},"types":"dist/types/index.d.ts","files":["dist","LICENSE","README.md","!**/*.tsbuildinfo"],"scripts":{"build":"rm -rf dist && rslib build","format":"prettier --write .","lint":"eslint ./ --cache --quiet","prepublishOnly":"npm run build","start":"rm -rf dist && rslib build -w","test":"vitest","test:cov":"vitest --coverage --run"},"dependencies":{"jsonwebtoken":"^9.0.2"},"devDependencies":{"@coze-infra/eslint-config":"workspace:*","@coze-infra/ts-config":"workspace:*","@coze-infra/vitest-config":"workspace:*","@rslib/core":"0.0.18","@swc/core":"^1.3.14","@types/jsonwebtoken":"^9.0.0","@types/node":"^20","@types/uuid":"^9.0.1","@types/whatwg-fetch":"^0.0.33","@vitest/coverage-v8":"~2.1.4","axios":"^1.7.7","typescript":"^5.5.3","vitest":"~2.1.4"},"peerDependencies":{"axios":"^1.7.1"}}'); // CONCATENATED MODULE: ./src/version.ts
3634
3800
  const { version: esm_version } = package_namespaceObject;
3635
3801
  const getEnv = ()=>{
3636
3802
  const nodeVersion = process.version.slice(1); // Remove 'v' prefix
@@ -3693,6 +3859,11 @@
3693
3859
  async function fetchAPI(url) {
3694
3860
  let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3695
3861
  const axiosInstance = options.axiosInstance || lib_axios;
3862
+ // Add version check for streaming requests
3863
+ if (options.isStreaming && isAxiosStatic(axiosInstance)) {
3864
+ const axiosVersion = axiosInstance.VERSION || lib_axios.VERSION;
3865
+ if (!axiosVersion || compareVersions(axiosVersion, '1.7.1') < 0) throw new CozeError('Streaming requests require axios version 1.7.1 or higher. Please upgrade your axios version.');
3866
+ }
3696
3867
  const response = await axiosInstance({
3697
3868
  url,
3698
3869
  responseType: options.isStreaming ? 'stream' : 'json',
@@ -3705,12 +3876,12 @@
3705
3876
  async *stream () {
3706
3877
  try {
3707
3878
  const stream = response.data;
3708
- const reader = stream[Symbol.asyncIterator]();
3879
+ const reader = stream[Symbol.asyncIterator] ? stream[Symbol.asyncIterator]() : stream.getReader();
3709
3880
  const decoder = new TextDecoder();
3710
3881
  const fieldValues = {};
3711
3882
  let buffer = '';
3712
3883
  while(true){
3713
- const { done, value } = await reader.next();
3884
+ const { done, value } = await (reader.next ? reader.next() : reader.read());
3714
3885
  if (done) {
3715
3886
  if (buffer) {
3716
3887
  // If the stream ends without a newline, it means an error occurred
@@ -3744,13 +3915,33 @@
3744
3915
  response
3745
3916
  };
3746
3917
  }
3918
+ // Add version comparison utility
3919
+ function compareVersions(v1, v2) {
3920
+ const v1Parts = v1.split('.').map(Number);
3921
+ const v2Parts = v2.split('.').map(Number);
3922
+ for(let i = 0; i < 3; i++){
3923
+ const part1 = v1Parts[i] || 0;
3924
+ const part2 = v2Parts[i] || 0;
3925
+ if (part1 > part2) return 1;
3926
+ if (part1 < part2) return -1;
3927
+ }
3928
+ return 0;
3929
+ }
3930
+ function isAxiosStatic(instance) {
3931
+ return !!(null == instance ? void 0 : instance.Axios);
3932
+ }
3747
3933
  /**
3748
3934
  * default coze base URL is api.coze.com
3749
3935
  */ const COZE_COM_BASE_URL = 'https://api.coze.com';
3750
3936
  /* eslint-disable max-params */ class APIClient {
3751
- buildOptions(method, body, options) {
3937
+ async getToken() {
3938
+ if ('function' == typeof this.token) return await this.token();
3939
+ return this.token;
3940
+ }
3941
+ async buildOptions(method, body, options) {
3942
+ const token = await this.getToken();
3752
3943
  const headers = {
3753
- authorization: `Bearer ${this.token}`
3944
+ authorization: `Bearer ${token}`
3754
3945
  };
3755
3946
  if (!isBrowser()) {
3756
3947
  headers['User-Agent'] = getUserAgent();
@@ -3765,14 +3956,17 @@
3765
3956
  }
3766
3957
  async makeRequest(apiUrl, method, body, isStream, options) {
3767
3958
  const fullUrl = `${this.baseURL}${apiUrl}`;
3768
- const fetchOptions = this.buildOptions(method, body, options);
3959
+ const fetchOptions = await this.buildOptions(method, body, options);
3769
3960
  fetchOptions.isStreaming = isStream;
3961
+ fetchOptions.axiosInstance = this.axiosInstance;
3770
3962
  this.debugLog(`--- request url: ${fullUrl}`);
3771
3963
  this.debugLog('--- request options:', fetchOptions);
3772
3964
  const { response, stream, json } = await fetchAPI(fullUrl, fetchOptions);
3773
3965
  this.debugLog(`--- response status: ${response.status}`);
3774
3966
  this.debugLog('--- response headers: ', response.headers);
3775
- const contentType = response.headers['content-type'];
3967
+ var _response_headers;
3968
+ // Taro use `header`
3969
+ const contentType = (null !== (_response_headers = response.headers) && void 0 !== _response_headers ? _response_headers : response.header)['content-type'];
3776
3970
  if (isStream) {
3777
3971
  if (contentType && contentType.includes('application/json')) {
3778
3972
  const result = await json();
@@ -3820,10 +4014,11 @@
3820
4014
  this.baseURL = config.baseURL || COZE_COM_BASE_URL;
3821
4015
  this.token = config.token;
3822
4016
  this.axiosOptions = config.axiosOptions || {};
4017
+ this.axiosInstance = config.axiosInstance;
3823
4018
  this.debug = config.debug || false;
3824
4019
  this.allowPersonalAccessTokenInBrowser = config.allowPersonalAccessTokenInBrowser || false;
3825
4020
  this.headers = config.headers;
3826
- if (isBrowser() && isPersonalAccessToken(this.token) && !this.allowPersonalAccessTokenInBrowser) throw new CozeError('Browser environments do not support authentication using Personal Access Token (PAT) by default.\nas it may expose secret API keys. \n\nPlease use OAuth2.0 authentication mechanism. see:\nhttps://www.coze.com/docs/developer_guides/oauth_apps?_lang=en \n\nIf you need to force use, please set the `allowPersonalAccessTokenInBrowser` option to `true`. \n\ne.g new CozeAPI({ token, allowPersonalAccessTokenInBrowser: true });\n\n');
4021
+ if (isBrowser() && 'function' != typeof this.token && isPersonalAccessToken(this.token) && !this.allowPersonalAccessTokenInBrowser) throw new CozeError('Browser environments do not support authentication using Personal Access Token (PAT) by default.\nas it may expose secret API keys. \n\nPlease use OAuth2.0 authentication mechanism. see:\nhttps://www.coze.com/docs/developer_guides/oauth_apps?_lang=en \n\nIf you need to force use, please set the `allowPersonalAccessTokenInBrowser` option to `true`. \n\ne.g new CozeAPI({ token, allowPersonalAccessTokenInBrowser: true });\n\n');
3827
4022
  }
3828
4023
  }
3829
4024
  APIClient.APIError = APIError;
@@ -3838,7 +4033,9 @@
3838
4033
  APIClient.UserAbortError = APIUserAbortError;
3839
4034
  class CozeAPI extends APIClient {
3840
4035
  constructor(...args){
3841
- super(...args), this.bots = new Bots(this), this.chat = new Chat(this), this.conversations = new Conversations(this), this.files = new Files(this), this.knowledge = new Knowledge(this), this.workflows = new Workflows(this), this.workspaces = new WorkSpaces(this), this.audio = new esm_Audio(this);
4036
+ super(...args), this.bots = new Bots(this), this.chat = new Chat(this), this.conversations = new Conversations(this), this.files = new Files(this), /**
4037
+ * @deprecated
4038
+ */ this.knowledge = new Knowledge(this), this.datasets = new Datasets(this), this.workflows = new Workflows(this), this.workspaces = new WorkSpaces(this), this.audio = new esm_Audio(this);
3842
4039
  }
3843
4040
  }
3844
4041
  /**
@@ -12643,8 +12840,8 @@
12643
12840
  }
12644
12841
  var _navigator$userAgent$, isFirefox = "mozilla" === getBrowser(), isSafari = "safari" === getBrowser(), isChrome = "chrome-stable" === getBrowser(), isCriOS = !isSSR2() && /CriOS/i.test(userAgentString), isEdgeForDesktop = !isSSR2() && /Edg\//i.test(userAgentString), isEdgeForAndroid = !isSSR2() && /EdgA/i.test(userAgentString), isEdgeForIOS = !isSSR2() && /EdgiOS/i.test(userAgentString), isEdge = isEdgeForDesktop || isEdgeForAndroid || isEdgeForIOS, isDingTalk = !isSSR2() && /DingTalk/i.test(navigator.userAgent), isOpera = !isSSR2() && /OPR\//.test(navigator.userAgent), isIPad = !isSSR2() && (!!/(iPad)/i.exec(userAgentString) || /Macintosh/i.test(userAgentString) && "ontouchend" in document), isMac = !isSSR2() && /Macintosh/i.test(userAgentString), isWeChat = !isSSR2() && /MicroMessenger/i.test(userAgentString), isMobile = !isSSR2() && _includesInstanceProperty(_context$3 = userAgentString.toLowerCase()).call(_context$3, "mobile"), isIOS = !isSSR2() && !!/(iPhone|iPad|iPod)/i.exec(userAgentString), isAndroid = !isSSR2() && /Android/i.test(userAgentString), isWindows = !isSSR2() && /Windows/i.test(userAgentString), isOpenHarmony = !isSSR2() && /OpenHarmony/i.test(userAgentString), sv = 0, sv2 = "0", index_esm_min_v = !isSSR2() && (null === (_userAgentString$matc = userAgentString.match(/version\/(\d+)/i)) || void 0 === _userAgentString$matc ? void 0 : _userAgentString$matc[1]);
12645
12842
  isSafari && index_esm_min_v && (sv = Number(index_esm_min_v), sv2 = null === (_navigator$userAgent$ = navigator.userAgent.match(/version\/(\d+\.\d+)/i)) || void 0 === _navigator$userAgent$ ? void 0 : _navigator$userAgent$[1]);
12646
- var v2 = !isSSR2() && (null === (_userAgentString$matc2 = userAgentString.match(/Firefox\/(\d+)/i)) || void 0 === _userAgentString$matc2 ? void 0 : _userAgentString$matc2[1]);
12647
- isFirefox && v2 && (sv = Number(v2));
12843
+ var index_esm_min_v2 = !isSSR2() && (null === (_userAgentString$matc2 = userAgentString.match(/Firefox\/(\d+)/i)) || void 0 === _userAgentString$matc2 ? void 0 : _userAgentString$matc2[1]);
12844
+ isFirefox && index_esm_min_v2 && (sv = Number(index_esm_min_v2));
12648
12845
  var safariVersion = sv, firefoxVersion = sv, safariMinorVersion = sv2, iOSVersion = null !== (_ref = !isSSR2() && (null === (_userAgentString$matc3 = userAgentString.match(/ ([\d_]+) like Mac OS X/i)) || void 0 === _userAgentString$matc3 || null === (_userAgentString$matc4 = _userAgentString$matc3[1]) || void 0 === _userAgentString$matc4 ? void 0 : _mapInstanceProperty(_context2 = _userAgentString$matc4.split("_")).call(_context2, function(e) {
12649
12846
  return _parseInt$7(e);
12650
12847
  }))) && void 0 !== _ref ? _ref : [], cv = 0, cvs = !isSSR2() && (null === (_userAgentString$matc5 = userAgentString.match(/Chrome\/(\d+)/i)) || void 0 === _userAgentString$matc5 ? void 0 : _userAgentString$matc5[1]);
@@ -38228,6 +38425,7 @@
38228
38425
  return new Promise((resolve)=>setTimeout(resolve, milliseconds));
38229
38426
  };
38230
38427
  /**
38428
+ * @deprecated use checkDevicePermission instead
38231
38429
  * Check microphone permission,return boolean
38232
38430
  */ const checkPermission = async function() {
38233
38431
  let { audio = true, video = false } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
@@ -38242,22 +38440,32 @@
38242
38440
  return false;
38243
38441
  }
38244
38442
  };
38443
+ const checkDevicePermission = async function() {
38444
+ let checkVideo = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
38445
+ return await index_esm_min_index.enableDevices({
38446
+ audio: true,
38447
+ video: checkVideo
38448
+ });
38449
+ };
38245
38450
  /**
38246
38451
  * Get audio devices
38247
38452
  * @returns Promise<AudioDevices> Object containing arrays of audio input and output devices
38248
- */ const getAudioDevices = async ()=>{
38249
- const devices = await index_esm_min_index.enumerateDevices();
38453
+ */ const getAudioDevices = async function() {
38454
+ let { video = false } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
38455
+ let devices = [];
38456
+ devices = video ? await index_esm_min_index.enumerateDevices() : await [
38457
+ ...await index_esm_min_index.enumerateAudioCaptureDevices(),
38458
+ ...await index_esm_min_index.enumerateAudioPlaybackDevices()
38459
+ ];
38250
38460
  if (!(null == devices ? void 0 : devices.length)) return {
38251
38461
  audioInputs: [],
38252
38462
  audioOutputs: [],
38253
- videoInputs: [],
38254
- videoOutputs: []
38463
+ videoInputs: []
38255
38464
  };
38256
38465
  return {
38257
38466
  audioInputs: devices.filter((i)=>i.deviceId && 'audioinput' === i.kind),
38258
38467
  audioOutputs: devices.filter((i)=>i.deviceId && 'audiooutput' === i.kind),
38259
- videoInputs: devices.filter((i)=>i.deviceId && 'videoinput' === i.kind),
38260
- videoOutputs: devices.filter((i)=>i.deviceId && 'videooutput' === i.kind)
38468
+ videoInputs: devices.filter((i)=>i.deviceId && 'videoinput' === i.kind)
38261
38469
  };
38262
38470
  };
38263
38471
  var error_RealtimeError = /*#__PURE__*/ function(RealtimeError) {
@@ -38360,6 +38568,34 @@
38360
38568
  * en: Bot left
38361
38569
  * zh: Bot 离开
38362
38570
  */ EventNames["BOT_LEAVE"] = "server.bot.leave";
38571
+ /**
38572
+ * en: Audio speech started
38573
+ * zh: 开始说话
38574
+ */ EventNames["AUDIO_AGENT_SPEECH_STARTED"] = "server.audio.agent.speech_started";
38575
+ /**
38576
+ * en: Audio speech stopped
38577
+ * zh: 停止说话
38578
+ */ EventNames["AUDIO_SPEECH_STOPPED"] = "server.audio.speech_stopped";
38579
+ /**
38580
+ * en: Server error
38581
+ * zh: 服务端错误
38582
+ */ EventNames["SERVER_ERROR"] = "server.error";
38583
+ /**
38584
+ * en: User speech started
38585
+ * zh: 用户开始说话
38586
+ */ EventNames["AUDIO_USER_SPEECH_STARTED"] = "server.audio.user.speech_started";
38587
+ /**
38588
+ * en: User speech stopped
38589
+ * zh: 用户停止说话
38590
+ */ EventNames["AUDIO_USER_SPEECH_STOPPED"] = "server.audio.user.speech_stopped";
38591
+ /**
38592
+ * en: User successfully enters the room
38593
+ * zh: 用户成功进入房间后,会收到该事件
38594
+ */ EventNames["SESSION_CREATED"] = "server.session.created";
38595
+ /**
38596
+ * en: Session updated
38597
+ * zh: 会话更新
38598
+ */ EventNames["SESSION_UPDATE"] = "server.session.update";
38363
38599
  return EventNames;
38364
38600
  }({});
38365
38601
  class RealtimeEventHandler {
@@ -38390,7 +38626,8 @@
38390
38626
  }
38391
38627
  }
38392
38628
  dispatch(eventName, event) {
38393
- this._log(`dispatch ${eventName} event`);
38629
+ let consoleLog = !(arguments.length > 2) || void 0 === arguments[2] || arguments[2];
38630
+ if (consoleLog) this._log(`dispatch ${eventName} event`);
38394
38631
  const handlers = (this.eventHandlers[eventName] || []).slice();
38395
38632
  this._dispatchToHandlers(eventName, event, handlers);
38396
38633
  const allHandlers = (this.eventHandlers["realtime.event"] || []).slice();
@@ -41659,7 +41896,7 @@
41659
41896
  this.engine.on(index_esm_min_index.events.onUserJoined, this.handleUserJoin);
41660
41897
  this.engine.on(index_esm_min_index.events.onUserLeave, this.handleUserLeave);
41661
41898
  this.engine.on(index_esm_min_index.events.onError, this.handleEventError);
41662
- this.engine.on(index_esm_min_index.events.onPlayerEvent, this.handlePlayerEvent);
41899
+ if (this._isSupportVideo) this.engine.on(index_esm_min_index.events.onPlayerEvent, this.handlePlayerEvent);
41663
41900
  if (this._debug) {
41664
41901
  this.engine.on(index_esm_min_index.events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
41665
41902
  this.engine.on(index_esm_min_index.events.onRemoteAudioPropertiesReport, this.handleRemoteAudioPropertiesReport);
@@ -41670,7 +41907,7 @@
41670
41907
  this.engine.off(index_esm_min_index.events.onUserJoined, this.handleUserJoin);
41671
41908
  this.engine.off(index_esm_min_index.events.onUserLeave, this.handleUserLeave);
41672
41909
  this.engine.off(index_esm_min_index.events.onError, this.handleEventError);
41673
- this.engine.off(index_esm_min_index.events.onPlayerEvent, this.handlePlayerEvent);
41910
+ if (this._isSupportVideo) this.engine.off(index_esm_min_index.events.onPlayerEvent, this.handlePlayerEvent);
41674
41911
  if (this._debug) {
41675
41912
  this.engine.off(index_esm_min_index.events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
41676
41913
  this.engine.off(index_esm_min_index.events.onRemoteAudioPropertiesReport, this.handleRemoteAudioPropertiesReport);
@@ -41715,13 +41952,13 @@
41715
41952
  this.dispatch(event_handler_EventNames.PLAYER_EVENT, event);
41716
41953
  }
41717
41954
  async joinRoom(options) {
41718
- const { token, roomId, uid, audioMutedDefault, videoOnDefault } = options;
41955
+ const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
41719
41956
  try {
41720
41957
  await this.engine.joinRoom(token, roomId, {
41721
41958
  userId: uid
41722
41959
  }, {
41723
41960
  isAutoPublish: !audioMutedDefault,
41724
- isAutoSubscribeAudio: true,
41961
+ isAutoSubscribeAudio,
41725
41962
  isAutoSubscribeVideo: this._isSupportVideo && videoOnDefault
41726
41963
  });
41727
41964
  } catch (e) {
@@ -41735,14 +41972,18 @@
41735
41972
  await this.engine.startAudioCapture(deviceId);
41736
41973
  }
41737
41974
  async setAudioOutputDevice(deviceId) {
41738
- const devices = await getAudioDevices();
41975
+ const devices = await getAudioDevices({
41976
+ video: false
41977
+ });
41739
41978
  if (-1 === devices.audioOutputs.findIndex((i)=>i.deviceId === deviceId)) throw new RealtimeAPIError(error_RealtimeError.DEVICE_ACCESS_ERROR, `Audio output device not found: ${deviceId}`);
41740
41979
  await this.engine.setAudioPlaybackDevice(deviceId);
41741
41980
  }
41742
41981
  async createLocalStream(userId, videoConfig) {
41743
- const devices = await getAudioDevices();
41744
- if (!devices.audioInputs.length) throw new RealtimeAPIError(error_RealtimeError.DEVICE_ACCESS_ERROR, 'Failed to get devices');
41745
- if (this._isSupportVideo && !devices.videoInputs.length) throw new RealtimeAPIError(error_RealtimeError.DEVICE_ACCESS_ERROR, 'Failed to get devices');
41982
+ const devices = await getAudioDevices({
41983
+ video: this._isSupportVideo
41984
+ });
41985
+ if (!devices.audioInputs.length) throw new RealtimeAPIError(error_RealtimeError.DEVICE_ACCESS_ERROR, 'Failed to get audio devices');
41986
+ if (this._isSupportVideo && !devices.videoInputs.length) throw new RealtimeAPIError(error_RealtimeError.DEVICE_ACCESS_ERROR, 'Failed to get video devices');
41746
41987
  await this.engine.startAudioCapture(devices.audioInputs[0].deviceId);
41747
41988
  if (this._isSupportVideo && (null == videoConfig ? void 0 : videoConfig.videoOnDefault)) await this.engine.startVideoCapture(devices.videoInputs[0].deviceId);
41748
41989
  if (this._isSupportVideo) this.engine.setLocalVideoPlayer(StreamIndex$1.STREAM_INDEX_MAIN, {
@@ -41895,7 +42136,7 @@
41895
42136
  // Step3 bind engine events
41896
42137
  this._client.bindEngineEvents();
41897
42138
  this._client.on(event_handler_EventNames.ALL, (eventName, data)=>{
41898
- this.dispatch(eventName, data);
42139
+ this.dispatch(eventName, data, false);
41899
42140
  });
41900
42141
  if (this._config.suppressStationaryNoise) {
41901
42142
  await this._client.enableAudioNoiseReduction();
@@ -41906,14 +42147,15 @@
41906
42147
  this._client.changeAIAnsExtension(true);
41907
42148
  this.dispatch(event_handler_EventNames.SUPPRESS_NON_STATIONARY_NOISE, {});
41908
42149
  }
41909
- var _this__config_audioMutedDefault, _this__config_videoConfig_videoOnDefault;
42150
+ var _this__config_audioMutedDefault, _this__config_videoConfig_videoOnDefault, _this__config_isAutoSubscribeAudio;
41910
42151
  // Step4 join room
41911
42152
  await this._client.joinRoom({
41912
42153
  token: roomInfo.token,
41913
42154
  roomId: roomInfo.room_id,
41914
42155
  uid: roomInfo.uid,
41915
42156
  audioMutedDefault: null !== (_this__config_audioMutedDefault = this._config.audioMutedDefault) && void 0 !== _this__config_audioMutedDefault && _this__config_audioMutedDefault,
41916
- videoOnDefault: null === (_this__config_videoConfig_videoOnDefault = null === (_this__config_videoConfig = this._config.videoConfig) || void 0 === _this__config_videoConfig ? void 0 : _this__config_videoConfig.videoOnDefault) || void 0 === _this__config_videoConfig_videoOnDefault || _this__config_videoConfig_videoOnDefault
42157
+ videoOnDefault: null === (_this__config_videoConfig_videoOnDefault = null === (_this__config_videoConfig = this._config.videoConfig) || void 0 === _this__config_videoConfig ? void 0 : _this__config_videoConfig.videoOnDefault) || void 0 === _this__config_videoConfig_videoOnDefault || _this__config_videoConfig_videoOnDefault,
42158
+ isAutoSubscribeAudio: null === (_this__config_isAutoSubscribeAudio = this._config.isAutoSubscribeAudio) || void 0 === _this__config_isAutoSubscribeAudio || _this__config_isAutoSubscribeAudio
41917
42159
  });
41918
42160
  // Step5 create local stream
41919
42161
  await this._client.createLocalStream(roomInfo.uid, this._config.videoConfig);
@@ -41925,7 +42167,6 @@
41925
42167
  token: roomInfo.token,
41926
42168
  appId: roomInfo.app_id
41927
42169
  });
41928
- this._log('dispatch client.connected event');
41929
42170
  }
41930
42171
  /**
41931
42172
  * en: Interrupt the current conversation
@@ -41935,7 +42176,6 @@
41935
42176
  var _this__client;
41936
42177
  await (null === (_this__client = this._client) || void 0 === _this__client ? void 0 : _this__client.stop());
41937
42178
  this.dispatch(event_handler_EventNames.INTERRUPTED, {});
41938
- this._log('dispatch client.interrupted event');
41939
42179
  }
41940
42180
  /**
41941
42181
  * en: Disconnect from the current session
@@ -42057,6 +42297,7 @@
42057
42297
  * 可选,默认是否抑制静态噪声,默认值为 false。
42058
42298
  * @param config.suppressNonStationaryNoise - Optional, suppress non-stationary noise, defaults to false. |
42059
42299
  * 可选,默认是否抑制非静态噪声,默认值为 false。
42300
+ * @param config.isAutoSubscribeAudio - Optional, whether to automatically subscribe to bot reply audio streams, defaults to true. |
42060
42301
  */ constructor(config){
42061
42302
  super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
42062
42303
  this._config = config;