@coze/realtime-api 1.0.5 → 1.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/cjs/index.cjs +26 -4
- package/dist/esm/index.js +26 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/umd/index.js +26 -4
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
@@ -283,7 +283,7 @@ class error_APIError extends CozeError {
|
|
283
283
|
}
|
284
284
|
}
|
285
285
|
class APIConnectionError extends error_APIError {
|
286
|
-
constructor({ message
|
286
|
+
constructor({ message }){
|
287
287
|
super(void 0, void 0, message || 'Connection error.', void 0), this.status = void 0;
|
288
288
|
// if (cause) {
|
289
289
|
// this.cause = cause;
|
@@ -3518,6 +3518,17 @@ class Runs extends APIResource {
|
|
3518
3518
|
const response = await this._client.post(apiUrl, params, false, options);
|
3519
3519
|
return response;
|
3520
3520
|
}
|
3521
|
+
/**
|
3522
|
+
* Get the workflow run history | 工作流异步运行后,查看执行结果
|
3523
|
+
* @docs zh: https://www.coze.cn/open/docs/developer_guides/workflow_history
|
3524
|
+
* @param workflowId - Required The ID of the workflow. | 必选 工作流 ID。
|
3525
|
+
* @param executeId - Required The ID of the workflow execution. | 必选 工作流执行 ID。
|
3526
|
+
* @returns WorkflowExecuteHistory[] | 工作流执行历史
|
3527
|
+
*/ async history(workflowId, executeId, options) {
|
3528
|
+
const apiUrl = `/v1/workflows/${workflowId}/run_histories/${executeId}`;
|
3529
|
+
const response = await this._client.get(apiUrl, void 0, false, options);
|
3530
|
+
return response.data;
|
3531
|
+
}
|
3521
3532
|
}
|
3522
3533
|
class WorkflowEvent {
|
3523
3534
|
constructor(id, event, data){
|
@@ -3679,7 +3690,7 @@ class documents_Documents extends APIResource {
|
|
3679
3690
|
* @returns ListDocumentData | 知识库文件列表
|
3680
3691
|
*/ async list(params, options) {
|
3681
3692
|
const apiUrl = '/open_api/knowledge/document/list';
|
3682
|
-
const response = await this._client.
|
3693
|
+
const response = await this._client.post(apiUrl, params, false, mergeConfig(options, {
|
3683
3694
|
headers: documents_documents_headers
|
3684
3695
|
}));
|
3685
3696
|
return response;
|
@@ -4628,7 +4639,7 @@ class WebSocketAPI {
|
|
4628
4639
|
// EXTERNAL MODULE: os (ignored)
|
4629
4640
|
var os_ignored_ = __webpack_require__("?9050");
|
4630
4641
|
var os_ignored_default = /*#__PURE__*/ __webpack_require__.n(os_ignored_);
|
4631
|
-
var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.0
|
4642
|
+
var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.1.0","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":{".":"./src/index.ts","./ws-tools":"./src/ws-tools/index.ts"},"main":"src/index.ts","module":"src/index.ts","browser":{"crypto":false,"os":false,"jsonwebtoken":false,"node-fetch":false},"typesVersions":{"*":{".":["dist/types/index.d.ts"],"ws-tools":["dist/types/ws-tools/ws-tools/index.d.ts"]}},"files":["dist","LICENSE","README.md","README.zh-CN.md"],"scripts":{"build":"rslib build","format":"prettier --write .","lint":"eslint ./ --cache --quiet","start":"rslib build -w","test":"vitest","test:cov":"vitest --coverage --run"},"dependencies":{"jsonwebtoken":"^9.0.2","node-fetch":"^2.x","reconnecting-websocket":"^4.4.0","uuid":"^10.0.0","ws":"^8.11.0"},"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/node-fetch":"^2.x","@types/uuid":"^9.0.1","@types/whatwg-fetch":"^0.0.33","@types/ws":"^8.5.1","@vitest/coverage-v8":"~2.1.4","axios":"^1.7.7","typescript":"^5.5.3","vitest":"~2.1.4"},"peerDependencies":{"axios":"^1.7.1"},"cozePublishConfig":{"exports":{".":{"require":"./dist/cjs/index.cjs","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"},"./ws-tools":{"require":"./dist/cjs/ws-tools/index.cjs","import":"./dist/esm/ws-tools/index.js","types":"./dist/types/ws-tools/ws-tools/index.d.ts"}},"main":"dist/cjs/index.cjs","module":"dist/esm/index.js","types":"dist/types/index.d.ts"}}'); // CONCATENATED MODULE: ../coze-js/src/version.ts
|
4632
4643
|
const { version: version_version } = package_namespaceObject;
|
4633
4644
|
const getEnv = ()=>{
|
4634
4645
|
const nodeVersion = process.version.slice(1); // Remove 'v' prefix
|
@@ -43128,13 +43139,24 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
43128
43139
|
let roomInfo;
|
43129
43140
|
try {
|
43130
43141
|
// Step1 get token
|
43142
|
+
let config;
|
43143
|
+
if (this._config.videoConfig) config = isScreenShareDevice(this._config.videoConfig.videoInputDeviceId) ? {
|
43144
|
+
video_config: {
|
43145
|
+
stream_video_type: 'screen'
|
43146
|
+
}
|
43147
|
+
} : {
|
43148
|
+
video_config: {
|
43149
|
+
stream_video_type: 'main'
|
43150
|
+
}
|
43151
|
+
};
|
43131
43152
|
roomInfo = await this._api.audio.rooms.create({
|
43132
43153
|
bot_id: botId,
|
43133
43154
|
conversation_id: conversationId || void 0,
|
43134
43155
|
voice_id: voiceId && voiceId.length > 0 ? voiceId : void 0,
|
43135
43156
|
connector_id: this._config.connectorId,
|
43136
43157
|
uid: this._config.userId || void 0,
|
43137
|
-
workflow_id: this._config.workflowId || void 0
|
43158
|
+
workflow_id: this._config.workflowId || void 0,
|
43159
|
+
config
|
43138
43160
|
});
|
43139
43161
|
} catch (error) {
|
43140
43162
|
this.dispatch(event_handler_EventNames.ERROR, error);
|
package/dist/esm/index.js
CHANGED
@@ -271,7 +271,7 @@ class error_APIError extends CozeError {
|
|
271
271
|
}
|
272
272
|
}
|
273
273
|
class APIConnectionError extends error_APIError {
|
274
|
-
constructor({ message
|
274
|
+
constructor({ message }){
|
275
275
|
super(void 0, void 0, message || 'Connection error.', void 0), this.status = void 0;
|
276
276
|
// if (cause) {
|
277
277
|
// this.cause = cause;
|
@@ -3506,6 +3506,17 @@ class Runs extends APIResource {
|
|
3506
3506
|
const response = await this._client.post(apiUrl, params, false, options);
|
3507
3507
|
return response;
|
3508
3508
|
}
|
3509
|
+
/**
|
3510
|
+
* Get the workflow run history | 工作流异步运行后,查看执行结果
|
3511
|
+
* @docs zh: https://www.coze.cn/open/docs/developer_guides/workflow_history
|
3512
|
+
* @param workflowId - Required The ID of the workflow. | 必选 工作流 ID。
|
3513
|
+
* @param executeId - Required The ID of the workflow execution. | 必选 工作流执行 ID。
|
3514
|
+
* @returns WorkflowExecuteHistory[] | 工作流执行历史
|
3515
|
+
*/ async history(workflowId, executeId, options) {
|
3516
|
+
const apiUrl = `/v1/workflows/${workflowId}/run_histories/${executeId}`;
|
3517
|
+
const response = await this._client.get(apiUrl, void 0, false, options);
|
3518
|
+
return response.data;
|
3519
|
+
}
|
3509
3520
|
}
|
3510
3521
|
class WorkflowEvent {
|
3511
3522
|
constructor(id, event, data){
|
@@ -3667,7 +3678,7 @@ class documents_Documents extends APIResource {
|
|
3667
3678
|
* @returns ListDocumentData | 知识库文件列表
|
3668
3679
|
*/ async list(params, options) {
|
3669
3680
|
const apiUrl = '/open_api/knowledge/document/list';
|
3670
|
-
const response = await this._client.
|
3681
|
+
const response = await this._client.post(apiUrl, params, false, mergeConfig(options, {
|
3671
3682
|
headers: documents_documents_headers
|
3672
3683
|
}));
|
3673
3684
|
return response;
|
@@ -4616,7 +4627,7 @@ class WebSocketAPI {
|
|
4616
4627
|
// EXTERNAL MODULE: os (ignored)
|
4617
4628
|
var os_ignored_ = __webpack_require__("?9050");
|
4618
4629
|
var os_ignored_default = /*#__PURE__*/ __webpack_require__.n(os_ignored_);
|
4619
|
-
var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.0
|
4630
|
+
var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.1.0","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":{".":"./src/index.ts","./ws-tools":"./src/ws-tools/index.ts"},"main":"src/index.ts","module":"src/index.ts","browser":{"crypto":false,"os":false,"jsonwebtoken":false,"node-fetch":false},"typesVersions":{"*":{".":["dist/types/index.d.ts"],"ws-tools":["dist/types/ws-tools/ws-tools/index.d.ts"]}},"files":["dist","LICENSE","README.md","README.zh-CN.md"],"scripts":{"build":"rslib build","format":"prettier --write .","lint":"eslint ./ --cache --quiet","start":"rslib build -w","test":"vitest","test:cov":"vitest --coverage --run"},"dependencies":{"jsonwebtoken":"^9.0.2","node-fetch":"^2.x","reconnecting-websocket":"^4.4.0","uuid":"^10.0.0","ws":"^8.11.0"},"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/node-fetch":"^2.x","@types/uuid":"^9.0.1","@types/whatwg-fetch":"^0.0.33","@types/ws":"^8.5.1","@vitest/coverage-v8":"~2.1.4","axios":"^1.7.7","typescript":"^5.5.3","vitest":"~2.1.4"},"peerDependencies":{"axios":"^1.7.1"},"cozePublishConfig":{"exports":{".":{"require":"./dist/cjs/index.cjs","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"},"./ws-tools":{"require":"./dist/cjs/ws-tools/index.cjs","import":"./dist/esm/ws-tools/index.js","types":"./dist/types/ws-tools/ws-tools/index.d.ts"}},"main":"dist/cjs/index.cjs","module":"dist/esm/index.js","types":"dist/types/index.d.ts"}}'); // CONCATENATED MODULE: ../coze-js/src/version.ts
|
4620
4631
|
const { version: version_version } = package_namespaceObject;
|
4621
4632
|
const getEnv = ()=>{
|
4622
4633
|
const nodeVersion = process.version.slice(1); // Remove 'v' prefix
|
@@ -43116,13 +43127,24 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
43116
43127
|
let roomInfo;
|
43117
43128
|
try {
|
43118
43129
|
// Step1 get token
|
43130
|
+
let config;
|
43131
|
+
if (this._config.videoConfig) config = isScreenShareDevice(this._config.videoConfig.videoInputDeviceId) ? {
|
43132
|
+
video_config: {
|
43133
|
+
stream_video_type: 'screen'
|
43134
|
+
}
|
43135
|
+
} : {
|
43136
|
+
video_config: {
|
43137
|
+
stream_video_type: 'main'
|
43138
|
+
}
|
43139
|
+
};
|
43119
43140
|
roomInfo = await this._api.audio.rooms.create({
|
43120
43141
|
bot_id: botId,
|
43121
43142
|
conversation_id: conversationId || void 0,
|
43122
43143
|
voice_id: voiceId && voiceId.length > 0 ? voiceId : void 0,
|
43123
43144
|
connector_id: this._config.connectorId,
|
43124
43145
|
uid: this._config.userId || void 0,
|
43125
|
-
workflow_id: this._config.workflowId || void 0
|
43146
|
+
workflow_id: this._config.workflowId || void 0,
|
43147
|
+
config
|
43126
43148
|
});
|
43127
43149
|
} catch (error) {
|
43128
43150
|
this.dispatch(event_handler_EventNames.ERROR, error);
|
package/dist/types/index.d.ts
CHANGED
@@ -30,7 +30,7 @@ export interface RealtimeClientConfig {
|
|
30
30
|
isAutoSubscribeAudio?: boolean /** optional, Whether to automatically subscribe to bot reply audio streams, defaults to true */;
|
31
31
|
}
|
32
32
|
declare class RealtimeClient extends RealtimeEventHandler {
|
33
|
-
|
33
|
+
_config: RealtimeClientConfig;
|
34
34
|
private _client;
|
35
35
|
isConnected: boolean;
|
36
36
|
private _api;
|
package/dist/umd/index.js
CHANGED
@@ -289,7 +289,7 @@
|
|
289
289
|
}
|
290
290
|
}
|
291
291
|
class APIConnectionError extends error_APIError {
|
292
|
-
constructor({ message
|
292
|
+
constructor({ message }){
|
293
293
|
super(void 0, void 0, message || 'Connection error.', void 0), this.status = void 0;
|
294
294
|
// if (cause) {
|
295
295
|
// this.cause = cause;
|
@@ -3524,6 +3524,17 @@
|
|
3524
3524
|
const response = await this._client.post(apiUrl, params, false, options);
|
3525
3525
|
return response;
|
3526
3526
|
}
|
3527
|
+
/**
|
3528
|
+
* Get the workflow run history | 工作流异步运行后,查看执行结果
|
3529
|
+
* @docs zh: https://www.coze.cn/open/docs/developer_guides/workflow_history
|
3530
|
+
* @param workflowId - Required The ID of the workflow. | 必选 工作流 ID。
|
3531
|
+
* @param executeId - Required The ID of the workflow execution. | 必选 工作流执行 ID。
|
3532
|
+
* @returns WorkflowExecuteHistory[] | 工作流执行历史
|
3533
|
+
*/ async history(workflowId, executeId, options) {
|
3534
|
+
const apiUrl = `/v1/workflows/${workflowId}/run_histories/${executeId}`;
|
3535
|
+
const response = await this._client.get(apiUrl, void 0, false, options);
|
3536
|
+
return response.data;
|
3537
|
+
}
|
3527
3538
|
}
|
3528
3539
|
class WorkflowEvent {
|
3529
3540
|
constructor(id, event, data){
|
@@ -3685,7 +3696,7 @@
|
|
3685
3696
|
* @returns ListDocumentData | 知识库文件列表
|
3686
3697
|
*/ async list(params, options) {
|
3687
3698
|
const apiUrl = '/open_api/knowledge/document/list';
|
3688
|
-
const response = await this._client.
|
3699
|
+
const response = await this._client.post(apiUrl, params, false, mergeConfig(options, {
|
3689
3700
|
headers: documents_documents_headers
|
3690
3701
|
}));
|
3691
3702
|
return response;
|
@@ -4634,7 +4645,7 @@ and limitations under the License.
|
|
4634
4645
|
// EXTERNAL MODULE: os (ignored)
|
4635
4646
|
var os_ignored_ = __webpack_require__("?9050");
|
4636
4647
|
var os_ignored_default = /*#__PURE__*/ __webpack_require__.n(os_ignored_);
|
4637
|
-
var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.0
|
4648
|
+
var package_namespaceObject = JSON.parse('{"name":"@coze/api","version":"1.1.0","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":{".":"./src/index.ts","./ws-tools":"./src/ws-tools/index.ts"},"main":"src/index.ts","module":"src/index.ts","browser":{"crypto":false,"os":false,"jsonwebtoken":false,"node-fetch":false},"typesVersions":{"*":{".":["dist/types/index.d.ts"],"ws-tools":["dist/types/ws-tools/ws-tools/index.d.ts"]}},"files":["dist","LICENSE","README.md","README.zh-CN.md"],"scripts":{"build":"rslib build","format":"prettier --write .","lint":"eslint ./ --cache --quiet","start":"rslib build -w","test":"vitest","test:cov":"vitest --coverage --run"},"dependencies":{"jsonwebtoken":"^9.0.2","node-fetch":"^2.x","reconnecting-websocket":"^4.4.0","uuid":"^10.0.0","ws":"^8.11.0"},"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/node-fetch":"^2.x","@types/uuid":"^9.0.1","@types/whatwg-fetch":"^0.0.33","@types/ws":"^8.5.1","@vitest/coverage-v8":"~2.1.4","axios":"^1.7.7","typescript":"^5.5.3","vitest":"~2.1.4"},"peerDependencies":{"axios":"^1.7.1"},"cozePublishConfig":{"exports":{".":{"require":"./dist/cjs/index.cjs","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"},"./ws-tools":{"require":"./dist/cjs/ws-tools/index.cjs","import":"./dist/esm/ws-tools/index.js","types":"./dist/types/ws-tools/ws-tools/index.d.ts"}},"main":"dist/cjs/index.cjs","module":"dist/esm/index.js","types":"dist/types/index.d.ts"}}'); // CONCATENATED MODULE: ../coze-js/src/version.ts
|
4638
4649
|
const { version: version_version } = package_namespaceObject;
|
4639
4650
|
const getEnv = ()=>{
|
4640
4651
|
const nodeVersion = process.version.slice(1); // Remove 'v' prefix
|
@@ -43134,13 +43145,24 @@ and limitations under the License.
|
|
43134
43145
|
let roomInfo;
|
43135
43146
|
try {
|
43136
43147
|
// Step1 get token
|
43148
|
+
let config;
|
43149
|
+
if (this._config.videoConfig) config = isScreenShareDevice(this._config.videoConfig.videoInputDeviceId) ? {
|
43150
|
+
video_config: {
|
43151
|
+
stream_video_type: 'screen'
|
43152
|
+
}
|
43153
|
+
} : {
|
43154
|
+
video_config: {
|
43155
|
+
stream_video_type: 'main'
|
43156
|
+
}
|
43157
|
+
};
|
43137
43158
|
roomInfo = await this._api.audio.rooms.create({
|
43138
43159
|
bot_id: botId,
|
43139
43160
|
conversation_id: conversationId || void 0,
|
43140
43161
|
voice_id: voiceId && voiceId.length > 0 ? voiceId : void 0,
|
43141
43162
|
connector_id: this._config.connectorId,
|
43142
43163
|
uid: this._config.userId || void 0,
|
43143
|
-
workflow_id: this._config.workflowId || void 0
|
43164
|
+
workflow_id: this._config.workflowId || void 0,
|
43165
|
+
config
|
43144
43166
|
});
|
43145
43167
|
} catch (error) {
|
43146
43168
|
this.dispatch(event_handler_EventNames.ERROR, error);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coze/realtime-api",
|
3
|
-
"version": "1.0
|
3
|
+
"version": "1.1.0",
|
4
4
|
"description": "A powerful real-time communication SDK for voice interactions with Coze AI bots | 扣子官方实时通信 SDK,用于与 Coze AI bots 进行语音交互",
|
5
5
|
"keywords": [
|
6
6
|
"coze",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"test:cov": "vitest --coverage --run"
|
50
50
|
},
|
51
51
|
"dependencies": {
|
52
|
-
"@coze/api": "1.0
|
52
|
+
"@coze/api": "1.1.0",
|
53
53
|
"@volcengine/rtc": "^4.62.1"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|