@coze/realtime-api 0.0.1
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/LICENSE +21 -0
- package/README.md +136 -0
- package/assets/api-overview.png +0 -0
- package/assets/realtime-console.png +0 -0
- package/dist/client.d.ts +32 -0
- package/dist/client.js +205 -0
- package/dist/error.d.ts +17 -0
- package/dist/error.js +36 -0
- package/dist/event-handler.d.ts +60 -0
- package/dist/event-handler.js +106 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +223 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +25 -0
- package/package.json +55 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Spring (SG) Pte. Ltd.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
# Coze Realtime API
|
2
|
+
|
3
|
+
A powerful real-time communication SDK for voice interactions with Coze AI bots.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
1. Precise Speech Recognition: Leveraging large language models for ASR (Automatic Speech Recognition), our system offers contextual understanding capabilities. It can reference previously mentioned terms, understand speaking styles and references, and delivers enhanced recognition accuracy in challenging scenarios including noise, domain-specific terminology, and mixed Chinese-English speech.
|
7
|
+
|
8
|
+
2. Powerful AI Agent Capabilities: As an AI Agent development platform, Coze provides comprehensive agent functionalities including:
|
9
|
+
- Memory systems (file storage, databases, variables)
|
10
|
+
- Knowledge integration (text, tables, images)
|
11
|
+
- Skills (plugins, triggers)
|
12
|
+
- Workflow orchestration (task flows, image processing pipelines)
|
13
|
+
|
14
|
+
3. Low Latency: Implemented using RTC (Real-Time Communication) technology to minimize latency throughout the communication pipeline.
|
15
|
+
|
16
|
+
4. Natural Voice Synthesis: Using advanced TTS (Text-to-Speech) models powered by large language models, our system:
|
17
|
+
- Intelligently predicts emotional context and intonation
|
18
|
+
- Generates ultra-natural, high-fidelity, personalized voice output
|
19
|
+
- Excels in naturalness, audio quality, prosody, breathing patterns, and emotional expression
|
20
|
+
- Handles mixed Chinese-English content seamlessly
|
21
|
+
- Delivers human-like expression of modal particles and emotional nuances
|
22
|
+
|
23
|
+

|
24
|
+
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
```bash
|
28
|
+
npm install @coze/realtime-api
|
29
|
+
# or
|
30
|
+
yarn add @coze/realtime-api
|
31
|
+
```
|
32
|
+
|
33
|
+
## Quick Start
|
34
|
+
|
35
|
+
```ts
|
36
|
+
import { RealtimeClient, EventNames, RealtimeUtils } from "@coze/realtime-api";
|
37
|
+
|
38
|
+
// Initialize the client
|
39
|
+
const client = new RealtimeClient({
|
40
|
+
baseURL: "https://api.coze.cn",
|
41
|
+
accessToken: "your_access_token",
|
42
|
+
botId: "your_bot_id",
|
43
|
+
voiceId: "your_voice_id", // Optional: Specify voice ID
|
44
|
+
conversationId: "conversation_id", // Optional: For conversation continuity
|
45
|
+
debug: true, // Optional: Enable debug logging
|
46
|
+
allowPersonalAccessTokenInBrowser: true, // Optional: Enable PAT token usage in browser
|
47
|
+
audioMutedDefault: false, // Optional: Initial audio state (default: false)
|
48
|
+
});
|
49
|
+
|
50
|
+
// Essential Setup
|
51
|
+
async function initializeVoiceChat() {
|
52
|
+
// 1. Verify device permissions
|
53
|
+
const hasPermission = await RealtimeUtils.checkPermission();
|
54
|
+
if (!hasPermission) {
|
55
|
+
throw new Error("Microphone access required");
|
56
|
+
}
|
57
|
+
|
58
|
+
// 2. Establish connection
|
59
|
+
await client.connect();
|
60
|
+
}
|
61
|
+
|
62
|
+
// Core Operations
|
63
|
+
const operations = {
|
64
|
+
disconnect: () => client.disconnect(),
|
65
|
+
interrupt: () => client.interrupt(),
|
66
|
+
toggleMicrophone: (enabled: boolean) => client.setAudioEnable(enabled),
|
67
|
+
checkConnection: () => client.isConnected
|
68
|
+
};
|
69
|
+
|
70
|
+
// Event Handling
|
71
|
+
function setupEventListeners() {
|
72
|
+
// Listen to all events
|
73
|
+
client.on(EventNames.EventNames, console.log);
|
74
|
+
|
75
|
+
// Client-side events only
|
76
|
+
client.on(EventNames.ALL_CLIENT, console.log);
|
77
|
+
|
78
|
+
// Server-side events only
|
79
|
+
client.on(EventNames.ALL_SERVER, console.log);
|
80
|
+
|
81
|
+
// Specific event handling
|
82
|
+
client.on(EventNames.CONNECTED, (event) => {
|
83
|
+
console.log("Connection established:", event);
|
84
|
+
});
|
85
|
+
}
|
86
|
+
```
|
87
|
+
|
88
|
+
## Development Guide
|
89
|
+
|
90
|
+
### Prerequisites
|
91
|
+
1. Set up your development environment following the [coze-js](../../README.md#development-guide) guide
|
92
|
+
2. Ensure you have Node.js (v14+) installed
|
93
|
+
|
94
|
+
### Running the Demo
|
95
|
+
|
96
|
+
1. Navigate to the example directory:
|
97
|
+
|
98
|
+
```bash
|
99
|
+
rush update
|
100
|
+
cd examples/realtime-console
|
101
|
+
npm run start
|
102
|
+
```
|
103
|
+
|
104
|
+
2. Access the demo interface:
|
105
|
+

|
106
|
+
|
107
|
+
### Demo Features
|
108
|
+
1. Visit [http://localhost:3000](http://localhost:3000)
|
109
|
+
2. Configure your credentials in the settings panel:
|
110
|
+
- Access Token
|
111
|
+
- Bot ID
|
112
|
+
- Voice ID
|
113
|
+
- API Base URL
|
114
|
+
3. Optional: Use browser extensions for custom headers during testing
|
115
|
+
4. Grant microphone permissions when prompted
|
116
|
+
5. Initialize connection via the "Connect" button
|
117
|
+
|
118
|
+
### Available Operations
|
119
|
+
- Microphone control (toggle on/off)
|
120
|
+
- Bot interaction interruption
|
121
|
+
- Connection management
|
122
|
+
- Audio debugging tools:
|
123
|
+
- Playback device monitoring
|
124
|
+
- Device status logging
|
125
|
+
- Diagnostic features
|
126
|
+
|
127
|
+
### Monitoring
|
128
|
+
- Real-time event logging in the upper console
|
129
|
+
- Bot response display in the lower panel
|
130
|
+
- Detailed console logs for debugging
|
131
|
+
|
132
|
+
## Run Unit Tests
|
133
|
+
|
134
|
+
```bash
|
135
|
+
npm run test
|
136
|
+
```
|
Binary file
|
Binary file
|
package/dist/client.d.ts
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
import { type AudioPropertiesConfig, type onUserJoinedEvent, type onUserLeaveEvent, type UserMessageEvent } from '@volcengine/rtc';
|
2
|
+
import { RealtimeEventHandler } from './event-handler';
|
3
|
+
export declare class EngineClient extends RealtimeEventHandler {
|
4
|
+
private engine;
|
5
|
+
private joinUserId;
|
6
|
+
constructor(appId: string, debug?: boolean, isTestEnv?: boolean);
|
7
|
+
bindEngineEvents(): void;
|
8
|
+
removeEventListener(): void;
|
9
|
+
handleMessage(event: UserMessageEvent): void;
|
10
|
+
handleEventError(e: unknown): void;
|
11
|
+
handleUserJoin(event: onUserJoinedEvent): void;
|
12
|
+
handleUserLeave(event: onUserLeaveEvent): void;
|
13
|
+
joinRoom(options: {
|
14
|
+
token: string;
|
15
|
+
roomId: string;
|
16
|
+
uid: string;
|
17
|
+
audioMutedDefault?: boolean;
|
18
|
+
}): Promise<void>;
|
19
|
+
getDevices(): Promise<{
|
20
|
+
audioInputs: MediaDeviceInfo[];
|
21
|
+
}>;
|
22
|
+
createLocalStream(): Promise<void>;
|
23
|
+
disconnect(): Promise<void>;
|
24
|
+
changeAudioState(isMicOn: boolean): Promise<void>;
|
25
|
+
stop(): Promise<void>;
|
26
|
+
sendMessage(message: Record<string, unknown>): Promise<void>;
|
27
|
+
enableAudioPropertiesReport(config?: AudioPropertiesConfig): void;
|
28
|
+
handleLocalAudioPropertiesReport(event: any): void;
|
29
|
+
handleRemoteAudioPropertiesReport(event: unknown): void;
|
30
|
+
startAudioPlaybackDeviceTest(): Promise<void>;
|
31
|
+
stopAudioPlaybackDeviceTest(): void;
|
32
|
+
}
|
package/dist/client.js
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.EngineClient = void 0;
|
27
|
+
const rtc_1 = __importStar(require("@volcengine/rtc"));
|
28
|
+
const event_handler_1 = require("./event-handler");
|
29
|
+
const error_1 = require("./error");
|
30
|
+
class EngineClient extends event_handler_1.RealtimeEventHandler {
|
31
|
+
constructor(appId, debug = false, isTestEnv = false) {
|
32
|
+
super(debug);
|
33
|
+
this.joinUserId = '';
|
34
|
+
if (isTestEnv) {
|
35
|
+
rtc_1.default.setParameter('ICE_CONFIG_REQUEST_URLS', ['rtc-test.bytedance.com']);
|
36
|
+
}
|
37
|
+
this.engine = rtc_1.default.createEngine(appId);
|
38
|
+
this.handleMessage = this.handleMessage.bind(this);
|
39
|
+
this.handleUserJoin = this.handleUserJoin.bind(this);
|
40
|
+
this.handleUserLeave = this.handleUserLeave.bind(this);
|
41
|
+
this.handleEventError = this.handleEventError.bind(this);
|
42
|
+
// Debug only
|
43
|
+
this.handleLocalAudioPropertiesReport =
|
44
|
+
this.handleLocalAudioPropertiesReport.bind(this);
|
45
|
+
this.handleRemoteAudioPropertiesReport =
|
46
|
+
this.handleRemoteAudioPropertiesReport.bind(this);
|
47
|
+
}
|
48
|
+
bindEngineEvents() {
|
49
|
+
this.engine.on(rtc_1.default.events.onUserMessageReceived, this.handleMessage);
|
50
|
+
this.engine.on(rtc_1.default.events.onUserJoined, this.handleUserJoin);
|
51
|
+
this.engine.on(rtc_1.default.events.onUserLeave, this.handleUserLeave);
|
52
|
+
this.engine.on(rtc_1.default.events.onError, this.handleEventError);
|
53
|
+
if (this._debug) {
|
54
|
+
this.engine.on(rtc_1.default.events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
55
|
+
this.engine.on(rtc_1.default.events.onRemoteAudioPropertiesReport, this.handleRemoteAudioPropertiesReport);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
removeEventListener() {
|
59
|
+
this.engine.off(rtc_1.default.events.onUserMessageReceived, this.handleMessage);
|
60
|
+
this.engine.off(rtc_1.default.events.onUserJoined, this.handleUserJoin);
|
61
|
+
this.engine.off(rtc_1.default.events.onUserLeave, this.handleUserLeave);
|
62
|
+
this.engine.off(rtc_1.default.events.onError, this.handleEventError);
|
63
|
+
if (this._debug) {
|
64
|
+
this.engine.off(rtc_1.default.events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
65
|
+
this.engine.off(rtc_1.default.events.onRemoteAudioPropertiesReport, this.handleRemoteAudioPropertiesReport);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
handleMessage(event) {
|
69
|
+
try {
|
70
|
+
const message = JSON.parse(event.message);
|
71
|
+
this.dispatch(`server.${message.event_type}`, message);
|
72
|
+
}
|
73
|
+
catch (e) {
|
74
|
+
this.dispatch('client.error', {
|
75
|
+
message: `Failed to parse message: ${event.message}`,
|
76
|
+
error: e,
|
77
|
+
});
|
78
|
+
}
|
79
|
+
}
|
80
|
+
handleEventError(e) {
|
81
|
+
this.dispatch('client.error', e);
|
82
|
+
}
|
83
|
+
handleUserJoin(event) {
|
84
|
+
this.joinUserId = event.userInfo.userId;
|
85
|
+
this.dispatch('server.bot.join', event);
|
86
|
+
}
|
87
|
+
handleUserLeave(event) {
|
88
|
+
this.dispatch('server.bot.leave', event);
|
89
|
+
}
|
90
|
+
async joinRoom(options) {
|
91
|
+
const { token, roomId, uid, audioMutedDefault = false } = options;
|
92
|
+
try {
|
93
|
+
await this.engine.joinRoom(token, roomId, {
|
94
|
+
userId: uid,
|
95
|
+
}, {
|
96
|
+
isAutoPublish: !audioMutedDefault,
|
97
|
+
isAutoSubscribeAudio: true,
|
98
|
+
isAutoSubscribeVideo: false,
|
99
|
+
});
|
100
|
+
}
|
101
|
+
catch (e) {
|
102
|
+
if (e instanceof Error) {
|
103
|
+
throw new error_1.RealtimeAPIError(error_1.RealtimeError.CONNECTION_ERROR, e.message);
|
104
|
+
}
|
105
|
+
throw new error_1.RealtimeAPIError(error_1.RealtimeError.CONNECTION_ERROR, 'Unknown error');
|
106
|
+
}
|
107
|
+
}
|
108
|
+
async getDevices() {
|
109
|
+
const devices = await rtc_1.default.enumerateDevices();
|
110
|
+
return {
|
111
|
+
audioInputs: devices.filter(i => i.deviceId && i.kind === 'audioinput'),
|
112
|
+
};
|
113
|
+
}
|
114
|
+
async createLocalStream() {
|
115
|
+
const devices = await this.getDevices();
|
116
|
+
if (!devices.audioInputs.length) {
|
117
|
+
throw new error_1.RealtimeAPIError(error_1.RealtimeError.DEVICE_ACCESS_ERROR, 'Failed to get devices');
|
118
|
+
}
|
119
|
+
await this.engine.startAudioCapture(devices.audioInputs[0].deviceId);
|
120
|
+
}
|
121
|
+
async disconnect() {
|
122
|
+
try {
|
123
|
+
await this.engine.stopAudioCapture();
|
124
|
+
await this.engine.unpublishStream(rtc_1.MediaType.AUDIO);
|
125
|
+
await this.engine.leaveRoom();
|
126
|
+
this.removeEventListener();
|
127
|
+
}
|
128
|
+
catch (e) {
|
129
|
+
this.dispatch('client.error', e);
|
130
|
+
throw e;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
async changeAudioState(isMicOn) {
|
134
|
+
try {
|
135
|
+
if (isMicOn) {
|
136
|
+
await this.engine.publishStream(rtc_1.MediaType.AUDIO);
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
await this.engine.unpublishStream(rtc_1.MediaType.AUDIO);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
catch (e) {
|
143
|
+
this.dispatch('client.error', e);
|
144
|
+
throw e;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
async stop() {
|
148
|
+
try {
|
149
|
+
const result = await this.engine.sendUserMessage(this.joinUserId, JSON.stringify({
|
150
|
+
id: 'event_1',
|
151
|
+
event_type: 'conversation.chat.cancel',
|
152
|
+
data: {},
|
153
|
+
}));
|
154
|
+
this._log(`interrupt ${this.joinUserId} ${result}`);
|
155
|
+
}
|
156
|
+
catch (e) {
|
157
|
+
this.dispatch('client.error', e);
|
158
|
+
throw e;
|
159
|
+
}
|
160
|
+
}
|
161
|
+
async sendMessage(message) {
|
162
|
+
try {
|
163
|
+
const result = await this.engine.sendUserMessage(this.joinUserId, JSON.stringify(message));
|
164
|
+
this._log(`sendMessage ${this.joinUserId} ${JSON.stringify(message)} ${result}`);
|
165
|
+
}
|
166
|
+
catch (e) {
|
167
|
+
this.dispatch('client.error', e);
|
168
|
+
throw e;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
enableAudioPropertiesReport(config) {
|
172
|
+
this.engine.enableAudioPropertiesReport(config);
|
173
|
+
}
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
175
|
+
handleLocalAudioPropertiesReport(event) {
|
176
|
+
var _a, _b;
|
177
|
+
if (this._debug && ((_b = (_a = event[0]) === null || _a === void 0 ? void 0 : _a.audioPropertiesInfo) === null || _b === void 0 ? void 0 : _b.linearVolume) > 0) {
|
178
|
+
console.log('handleLocalAudioPropertiesReport', event);
|
179
|
+
}
|
180
|
+
}
|
181
|
+
handleRemoteAudioPropertiesReport(event) {
|
182
|
+
if (this._debug) {
|
183
|
+
console.log('handleRemoteAudioPropertiesReport', event);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
async startAudioPlaybackDeviceTest() {
|
187
|
+
try {
|
188
|
+
await this.engine.startAudioPlaybackDeviceTest('audio-test.wav', 200);
|
189
|
+
}
|
190
|
+
catch (e) {
|
191
|
+
this.dispatch('client.error', e);
|
192
|
+
throw e;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
stopAudioPlaybackDeviceTest() {
|
196
|
+
try {
|
197
|
+
this.engine.stopAudioPlaybackDeviceTest();
|
198
|
+
}
|
199
|
+
catch (e) {
|
200
|
+
this.dispatch('client.error', e);
|
201
|
+
throw e;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
exports.EngineClient = EngineClient;
|
package/dist/error.d.ts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare enum RealtimeError {
|
2
|
+
DEVICE_ACCESS_ERROR = "DEVICE_ACCESS_ERROR",
|
3
|
+
STREAM_CREATION_ERROR = "STREAM_CREATION_ERROR",
|
4
|
+
CONNECTION_ERROR = "CONNECTION_ERROR",
|
5
|
+
DISCONNECTION_ERROR = "DISCONNECTION_ERROR",
|
6
|
+
INTERRUPT_ERROR = "INTERRUPT_ERROR",
|
7
|
+
EVENT_HANDLER_ERROR = "EVENT_HANDLER_ERROR",
|
8
|
+
PERMISSION_DENIED = "PERMISSION_DENIED",
|
9
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
10
|
+
INVALID_STATE = "INVALID_STATE",
|
11
|
+
CREATE_ROOM_ERROR = "CREATE_ROOM_ERROR"
|
12
|
+
}
|
13
|
+
export declare const ErrorMessages: Record<RealtimeError, string>;
|
14
|
+
export declare class RealtimeAPIError extends Error {
|
15
|
+
code: RealtimeError;
|
16
|
+
constructor(code: RealtimeError, message: string);
|
17
|
+
}
|
package/dist/error.js
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RealtimeAPIError = exports.ErrorMessages = exports.RealtimeError = void 0;
|
4
|
+
var RealtimeError;
|
5
|
+
(function (RealtimeError) {
|
6
|
+
RealtimeError["DEVICE_ACCESS_ERROR"] = "DEVICE_ACCESS_ERROR";
|
7
|
+
RealtimeError["STREAM_CREATION_ERROR"] = "STREAM_CREATION_ERROR";
|
8
|
+
RealtimeError["CONNECTION_ERROR"] = "CONNECTION_ERROR";
|
9
|
+
RealtimeError["DISCONNECTION_ERROR"] = "DISCONNECTION_ERROR";
|
10
|
+
RealtimeError["INTERRUPT_ERROR"] = "INTERRUPT_ERROR";
|
11
|
+
RealtimeError["EVENT_HANDLER_ERROR"] = "EVENT_HANDLER_ERROR";
|
12
|
+
RealtimeError["PERMISSION_DENIED"] = "PERMISSION_DENIED";
|
13
|
+
RealtimeError["NETWORK_ERROR"] = "NETWORK_ERROR";
|
14
|
+
RealtimeError["INVALID_STATE"] = "INVALID_STATE";
|
15
|
+
RealtimeError["CREATE_ROOM_ERROR"] = "CREATE_ROOM_ERROR";
|
16
|
+
})(RealtimeError || (exports.RealtimeError = RealtimeError = {}));
|
17
|
+
exports.ErrorMessages = {
|
18
|
+
[RealtimeError.DEVICE_ACCESS_ERROR]: 'Failed to get devices',
|
19
|
+
[RealtimeError.STREAM_CREATION_ERROR]: 'Failed to create local stream',
|
20
|
+
[RealtimeError.CONNECTION_ERROR]: 'Failed to connect',
|
21
|
+
[RealtimeError.DISCONNECTION_ERROR]: 'Failed to disconnect',
|
22
|
+
[RealtimeError.INTERRUPT_ERROR]: 'Failed to interrupt',
|
23
|
+
[RealtimeError.EVENT_HANDLER_ERROR]: 'Event handler not found',
|
24
|
+
[RealtimeError.PERMISSION_DENIED]: 'Permission denied for requested operation',
|
25
|
+
[RealtimeError.NETWORK_ERROR]: 'Network connection error occurred',
|
26
|
+
[RealtimeError.INVALID_STATE]: 'Operation invalid in current state',
|
27
|
+
[RealtimeError.CREATE_ROOM_ERROR]: 'Failed to create room',
|
28
|
+
};
|
29
|
+
class RealtimeAPIError extends Error {
|
30
|
+
constructor(code, message) {
|
31
|
+
super(`[${code}] ${message}`);
|
32
|
+
this.code = code;
|
33
|
+
this.name = 'RealtimeAPIError';
|
34
|
+
}
|
35
|
+
}
|
36
|
+
exports.RealtimeAPIError = RealtimeAPIError;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
export declare enum EventNames {
|
2
|
+
/**
|
3
|
+
* en: All events
|
4
|
+
* zh: 所有事件
|
5
|
+
*/
|
6
|
+
ALL = "realtime.event",
|
7
|
+
/**
|
8
|
+
* en: All client events
|
9
|
+
* zh: 所有客户端事件
|
10
|
+
*/
|
11
|
+
ALL_CLIENT = "client.*",
|
12
|
+
/**
|
13
|
+
* en: All server events
|
14
|
+
* zh: 所有服务端事件
|
15
|
+
*/
|
16
|
+
ALL_SERVER = "server.*",
|
17
|
+
/**
|
18
|
+
* en: Client connected
|
19
|
+
* zh: 客户端连接
|
20
|
+
*/
|
21
|
+
CONNECTED = "client.connected",
|
22
|
+
/**
|
23
|
+
* en: Client interrupted
|
24
|
+
* zh: 客户端中断
|
25
|
+
*/
|
26
|
+
INTERRUPTED = "client.interrupted",
|
27
|
+
/**
|
28
|
+
* en: Client disconnected
|
29
|
+
* zh: 客户端断开
|
30
|
+
*/
|
31
|
+
DISCONNECTED = "client.disconnected",
|
32
|
+
/**
|
33
|
+
* en: Client audio unmuted
|
34
|
+
* zh: 客户端音频未静音
|
35
|
+
*/
|
36
|
+
AUDIO_UNMUTED = "client.audio.unmuted",
|
37
|
+
/**
|
38
|
+
* en: Client audio muted
|
39
|
+
* zh: 客户端音频静音
|
40
|
+
*/
|
41
|
+
AUDIO_MUTED = "client.audio.muted",
|
42
|
+
/**
|
43
|
+
* en: Client error
|
44
|
+
* zh: 客户端错误
|
45
|
+
*/
|
46
|
+
ERROR = "client.error"
|
47
|
+
}
|
48
|
+
type EventCallback = (eventName: string, event: unknown) => void;
|
49
|
+
export declare class RealtimeEventHandler {
|
50
|
+
private eventHandlers;
|
51
|
+
protected _debug: boolean;
|
52
|
+
constructor(debug?: boolean);
|
53
|
+
clearEventHandlers(): void;
|
54
|
+
on(eventName: string, callback: EventCallback): EventCallback;
|
55
|
+
off(eventName: string, callback: EventCallback): void;
|
56
|
+
private _dispatchToHandlers;
|
57
|
+
dispatch(eventName: string, event: unknown): void;
|
58
|
+
_log(message: string): void;
|
59
|
+
}
|
60
|
+
export {};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RealtimeEventHandler = exports.EventNames = void 0;
|
4
|
+
const error_1 = require("./error");
|
5
|
+
var EventNames;
|
6
|
+
(function (EventNames) {
|
7
|
+
/**
|
8
|
+
* en: All events
|
9
|
+
* zh: 所有事件
|
10
|
+
*/
|
11
|
+
EventNames["ALL"] = "realtime.event";
|
12
|
+
/**
|
13
|
+
* en: All client events
|
14
|
+
* zh: 所有客户端事件
|
15
|
+
*/
|
16
|
+
EventNames["ALL_CLIENT"] = "client.*";
|
17
|
+
/**
|
18
|
+
* en: All server events
|
19
|
+
* zh: 所有服务端事件
|
20
|
+
*/
|
21
|
+
EventNames["ALL_SERVER"] = "server.*";
|
22
|
+
/**
|
23
|
+
* en: Client connected
|
24
|
+
* zh: 客户端连接
|
25
|
+
*/
|
26
|
+
EventNames["CONNECTED"] = "client.connected";
|
27
|
+
/**
|
28
|
+
* en: Client interrupted
|
29
|
+
* zh: 客户端中断
|
30
|
+
*/
|
31
|
+
EventNames["INTERRUPTED"] = "client.interrupted";
|
32
|
+
/**
|
33
|
+
* en: Client disconnected
|
34
|
+
* zh: 客户端断开
|
35
|
+
*/
|
36
|
+
EventNames["DISCONNECTED"] = "client.disconnected";
|
37
|
+
/**
|
38
|
+
* en: Client audio unmuted
|
39
|
+
* zh: 客户端音频未静音
|
40
|
+
*/
|
41
|
+
EventNames["AUDIO_UNMUTED"] = "client.audio.unmuted";
|
42
|
+
/**
|
43
|
+
* en: Client audio muted
|
44
|
+
* zh: 客户端音频静音
|
45
|
+
*/
|
46
|
+
EventNames["AUDIO_MUTED"] = "client.audio.muted";
|
47
|
+
/**
|
48
|
+
* en: Client error
|
49
|
+
* zh: 客户端错误
|
50
|
+
*/
|
51
|
+
EventNames["ERROR"] = "client.error";
|
52
|
+
})(EventNames || (exports.EventNames = EventNames = {}));
|
53
|
+
class RealtimeEventHandler {
|
54
|
+
constructor(debug = false) {
|
55
|
+
this.eventHandlers = {};
|
56
|
+
this._debug = debug;
|
57
|
+
}
|
58
|
+
clearEventHandlers() {
|
59
|
+
this.eventHandlers = {};
|
60
|
+
}
|
61
|
+
on(eventName, callback) {
|
62
|
+
this._log(`on ${eventName} event`);
|
63
|
+
this.eventHandlers[eventName] = this.eventHandlers[eventName] || [];
|
64
|
+
this.eventHandlers[eventName].push(callback);
|
65
|
+
return callback;
|
66
|
+
}
|
67
|
+
off(eventName, callback) {
|
68
|
+
this._log(`off ${eventName} event`);
|
69
|
+
const handlers = this.eventHandlers[eventName] || [];
|
70
|
+
if (callback) {
|
71
|
+
const index = handlers.indexOf(callback);
|
72
|
+
if (index === -1) {
|
73
|
+
throw new error_1.RealtimeAPIError(error_1.RealtimeError.EVENT_HANDLER_ERROR, `Could not turn off specified event listener for "${eventName}": not found as a listener`);
|
74
|
+
}
|
75
|
+
handlers.splice(index, 1);
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
delete this.eventHandlers[eventName];
|
79
|
+
}
|
80
|
+
}
|
81
|
+
// eslint-disable-next-line max-params
|
82
|
+
_dispatchToHandlers(eventName, event, handlers, prefix) {
|
83
|
+
for (const handler of handlers) {
|
84
|
+
if (!prefix || eventName.startsWith(prefix)) {
|
85
|
+
handler(eventName, event);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
dispatch(eventName, event) {
|
90
|
+
this._log(`dispatch ${eventName} event`);
|
91
|
+
const handlers = (this.eventHandlers[eventName] || []).slice();
|
92
|
+
this._dispatchToHandlers(eventName, event, handlers);
|
93
|
+
const allHandlers = (this.eventHandlers[EventNames.ALL] || []).slice();
|
94
|
+
this._dispatchToHandlers(eventName, event, allHandlers);
|
95
|
+
const allClientHandlers = (this.eventHandlers[EventNames.ALL_CLIENT] || []).slice();
|
96
|
+
this._dispatchToHandlers(eventName, event, allClientHandlers, 'client.');
|
97
|
+
const allServerHandlers = (this.eventHandlers[EventNames.ALL_SERVER] || []).slice();
|
98
|
+
this._dispatchToHandlers(eventName, event, allServerHandlers, 'server.');
|
99
|
+
}
|
100
|
+
_log(message) {
|
101
|
+
if (this._debug) {
|
102
|
+
console.log(`[RealtimeClient] ${message}`);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
exports.RealtimeEventHandler = RealtimeEventHandler;
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
import { type AudioPropertiesConfig } from '@volcengine/rtc';
|
2
|
+
import * as RealtimeUtils from './utils';
|
3
|
+
import { RealtimeEventHandler, EventNames } from './event-handler';
|
4
|
+
import { RealtimeAPIError, RealtimeError } from './error';
|
5
|
+
export interface RealtimeClientConfig {
|
6
|
+
accessToken: string /** required, Access Token */;
|
7
|
+
botId: string /** required, Bot Id */;
|
8
|
+
voiceId?: string /** optional, Voice Id */;
|
9
|
+
conversationId?: string /** optional, Conversation Id */;
|
10
|
+
baseURL?: string /** optional, defaults to "https://api.coze.cn" */;
|
11
|
+
debug?: boolean /** optional, defaults to false */;
|
12
|
+
/** Whether Personal Access Tokens (PAT) are allowed in browser environments */
|
13
|
+
allowPersonalAccessTokenInBrowser?: boolean;
|
14
|
+
/** Whether to mute by default, defaults to false
|
15
|
+
* If set to true, audio streams will not be automatically published and subscribed */
|
16
|
+
audioMutedDefault?: boolean;
|
17
|
+
connectorId?: string /** optional, Connector Id, defaults to '999' */;
|
18
|
+
}
|
19
|
+
declare class RealtimeClient extends RealtimeEventHandler {
|
20
|
+
private _config;
|
21
|
+
private _client;
|
22
|
+
private _roomInfo;
|
23
|
+
isConnected: boolean;
|
24
|
+
private _api;
|
25
|
+
private _isTestEnv;
|
26
|
+
/**
|
27
|
+
* Constructor for initializing a RealtimeClient instance.
|
28
|
+
*
|
29
|
+
* 构造函数,初始化RealtimeClient实例。
|
30
|
+
*
|
31
|
+
* @param config
|
32
|
+
* @param config.accessToken - Required, Access Token. |
|
33
|
+
* 必填,Access Token。
|
34
|
+
* @param config.botId - Required, Bot Id. |
|
35
|
+
* 必填,Bot Id。
|
36
|
+
* @param config.voiceId - Optional, Voice Id. |
|
37
|
+
* 可选,音色Id。
|
38
|
+
* @param config.conversationId - Optional, Conversation Id. |
|
39
|
+
* 可选,会话Id。
|
40
|
+
* @param config.baseURL - Optional, defaults to "https://api.coze.cn". |
|
41
|
+
* 可选,默认值为 "https://api.coze.cn"。
|
42
|
+
* @param config.debug - Optional, defaults to false.
|
43
|
+
* 可选,默认值为 false。
|
44
|
+
* @param config.allowPersonalAccessTokenInBrowser
|
45
|
+
* - Optional, whether to allow personal access tokens in browser environment. |
|
46
|
+
* 可选,是否允许在浏览器环境中使用个人访问令牌。
|
47
|
+
* @param config.audioMutedDefault - Optional, whether audio is muted by default, defaults to false. |
|
48
|
+
* 可选,默认是否静音,默认值为 false。
|
49
|
+
*/
|
50
|
+
constructor(config: RealtimeClientConfig);
|
51
|
+
/**
|
52
|
+
* en: Establish a connection to the Coze API and join the room
|
53
|
+
*
|
54
|
+
* zh: 建立与 Coze API 的连接并加入房间
|
55
|
+
*/
|
56
|
+
connect(): Promise<void>;
|
57
|
+
/**
|
58
|
+
* en: Interrupt the current conversation
|
59
|
+
*
|
60
|
+
* zh: 中断当前对话
|
61
|
+
*/
|
62
|
+
interrupt(): Promise<void>;
|
63
|
+
/**
|
64
|
+
* en: Disconnect from the current session
|
65
|
+
*
|
66
|
+
* zh: 断开与当前会话的连接
|
67
|
+
*/
|
68
|
+
disconnect(): Promise<void>;
|
69
|
+
/**
|
70
|
+
* en: Send a message to the bot
|
71
|
+
*
|
72
|
+
* zh: 发送消息给Bot
|
73
|
+
*/
|
74
|
+
sendMessage(message: Record<string, unknown>): Promise<void>;
|
75
|
+
/**
|
76
|
+
* en: Enable or disable audio
|
77
|
+
*
|
78
|
+
* zh: 启用或禁用音频
|
79
|
+
*/
|
80
|
+
setAudioEnable(isEnable: boolean): Promise<void>;
|
81
|
+
/**
|
82
|
+
* en: Enable audio properties reporting (debug mode only)
|
83
|
+
*
|
84
|
+
* zh: 启用音频属性报告(仅限调试模式)
|
85
|
+
*/
|
86
|
+
enableAudioPropertiesReport(config?: AudioPropertiesConfig): boolean;
|
87
|
+
/**
|
88
|
+
* en: Start audio playback device test (debug mode only)
|
89
|
+
*
|
90
|
+
* zh: 开始音频播放设备测试(仅限调试模式)
|
91
|
+
*/
|
92
|
+
startAudioPlaybackDeviceTest(): Promise<void>;
|
93
|
+
/**
|
94
|
+
* en: Stop audio playback device test (debug mode only)
|
95
|
+
*
|
96
|
+
* zh: 停止音频播放设备测试(仅限调试模式)
|
97
|
+
*/
|
98
|
+
stopAudioPlaybackDeviceTest(): void;
|
99
|
+
}
|
100
|
+
export { RealtimeUtils, RealtimeClient, RealtimeAPIError, RealtimeError, EventNames, };
|
package/dist/index.js
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.EventNames = exports.RealtimeError = exports.RealtimeAPIError = exports.RealtimeClient = exports.RealtimeUtils = void 0;
|
27
|
+
const api_1 = require("@coze/api");
|
28
|
+
const RealtimeUtils = __importStar(require("./utils"));
|
29
|
+
exports.RealtimeUtils = RealtimeUtils;
|
30
|
+
const event_handler_1 = require("./event-handler");
|
31
|
+
Object.defineProperty(exports, "EventNames", { enumerable: true, get: function () { return event_handler_1.EventNames; } });
|
32
|
+
const error_1 = require("./error");
|
33
|
+
Object.defineProperty(exports, "RealtimeAPIError", { enumerable: true, get: function () { return error_1.RealtimeAPIError; } });
|
34
|
+
Object.defineProperty(exports, "RealtimeError", { enumerable: true, get: function () { return error_1.RealtimeError; } });
|
35
|
+
const client_1 = require("./client");
|
36
|
+
class RealtimeClient extends event_handler_1.RealtimeEventHandler {
|
37
|
+
/**
|
38
|
+
* Constructor for initializing a RealtimeClient instance.
|
39
|
+
*
|
40
|
+
* 构造函数,初始化RealtimeClient实例。
|
41
|
+
*
|
42
|
+
* @param config
|
43
|
+
* @param config.accessToken - Required, Access Token. |
|
44
|
+
* 必填,Access Token。
|
45
|
+
* @param config.botId - Required, Bot Id. |
|
46
|
+
* 必填,Bot Id。
|
47
|
+
* @param config.voiceId - Optional, Voice Id. |
|
48
|
+
* 可选,音色Id。
|
49
|
+
* @param config.conversationId - Optional, Conversation Id. |
|
50
|
+
* 可选,会话Id。
|
51
|
+
* @param config.baseURL - Optional, defaults to "https://api.coze.cn". |
|
52
|
+
* 可选,默认值为 "https://api.coze.cn"。
|
53
|
+
* @param config.debug - Optional, defaults to false.
|
54
|
+
* 可选,默认值为 false。
|
55
|
+
* @param config.allowPersonalAccessTokenInBrowser
|
56
|
+
* - Optional, whether to allow personal access tokens in browser environment. |
|
57
|
+
* 可选,是否允许在浏览器环境中使用个人访问令牌。
|
58
|
+
* @param config.audioMutedDefault - Optional, whether audio is muted by default, defaults to false. |
|
59
|
+
* 可选,默认是否静音,默认值为 false。
|
60
|
+
*/
|
61
|
+
constructor(config) {
|
62
|
+
var _a;
|
63
|
+
super(config.debug);
|
64
|
+
this._client = null;
|
65
|
+
this._roomInfo = null;
|
66
|
+
this.isConnected = false;
|
67
|
+
this._isTestEnv = false;
|
68
|
+
this._config = config;
|
69
|
+
const defaultBaseURL = (_a = this._config.baseURL) !== null && _a !== void 0 ? _a : 'https://api.coze.cn';
|
70
|
+
this._config.baseURL = defaultBaseURL;
|
71
|
+
// init api
|
72
|
+
this._api = new api_1.CozeAPI({
|
73
|
+
token: this._config.accessToken,
|
74
|
+
baseURL: defaultBaseURL,
|
75
|
+
allowPersonalAccessTokenInBrowser: this._config.allowPersonalAccessTokenInBrowser,
|
76
|
+
});
|
77
|
+
this._isTestEnv = defaultBaseURL !== 'https://api.coze.cn';
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* en: Establish a connection to the Coze API and join the room
|
81
|
+
*
|
82
|
+
* zh: 建立与 Coze API 的连接并加入房间
|
83
|
+
*/
|
84
|
+
async connect() {
|
85
|
+
var _a, _b;
|
86
|
+
const { botId, conversationId, voiceId } = this._config;
|
87
|
+
let roomInfo;
|
88
|
+
try {
|
89
|
+
// Step1 get token
|
90
|
+
roomInfo = await this._api.audio.rooms.create({
|
91
|
+
bot_id: botId,
|
92
|
+
conversation_id: conversationId,
|
93
|
+
voice_id: voiceId && voiceId.length > 0 ? voiceId : undefined,
|
94
|
+
connector_id: (_a = this._config.connectorId) !== null && _a !== void 0 ? _a : '999',
|
95
|
+
});
|
96
|
+
}
|
97
|
+
catch (error) {
|
98
|
+
this.dispatch(event_handler_1.EventNames.ERROR, error);
|
99
|
+
throw new error_1.RealtimeAPIError(error_1.RealtimeError.CREATE_ROOM_ERROR, error instanceof Error ? error.message : 'Unknown error');
|
100
|
+
}
|
101
|
+
this._roomInfo = roomInfo;
|
102
|
+
// Step2 create engine
|
103
|
+
this._client = new client_1.EngineClient(roomInfo.app_id, this._config.debug, this._isTestEnv);
|
104
|
+
// Step3 bind engine events
|
105
|
+
this._client.bindEngineEvents();
|
106
|
+
this._client.on(event_handler_1.EventNames.ALL, (eventName, data) => {
|
107
|
+
this.dispatch(eventName, data);
|
108
|
+
});
|
109
|
+
// Step4 join room
|
110
|
+
await this._client.joinRoom({
|
111
|
+
token: roomInfo.token,
|
112
|
+
roomId: roomInfo.room_id,
|
113
|
+
uid: roomInfo.uid,
|
114
|
+
audioMutedDefault: (_b = this._config.audioMutedDefault) !== null && _b !== void 0 ? _b : false,
|
115
|
+
});
|
116
|
+
// Step5 create local stream
|
117
|
+
await this._client.createLocalStream();
|
118
|
+
// step6 set connected and dispatch connected event
|
119
|
+
this.isConnected = true;
|
120
|
+
this.dispatch(event_handler_1.EventNames.CONNECTED, {
|
121
|
+
roomId: roomInfo.room_id,
|
122
|
+
uid: roomInfo.uid,
|
123
|
+
token: roomInfo.token,
|
124
|
+
appId: roomInfo.app_id,
|
125
|
+
});
|
126
|
+
this._log('dispatch client.connected event');
|
127
|
+
}
|
128
|
+
/**
|
129
|
+
* en: Interrupt the current conversation
|
130
|
+
*
|
131
|
+
* zh: 中断当前对话
|
132
|
+
*/
|
133
|
+
async interrupt() {
|
134
|
+
var _a;
|
135
|
+
await ((_a = this._client) === null || _a === void 0 ? void 0 : _a.stop());
|
136
|
+
this.dispatch(event_handler_1.EventNames.INTERRUPTED, {});
|
137
|
+
this._log('dispatch client.interrupted event');
|
138
|
+
}
|
139
|
+
/**
|
140
|
+
* en: Disconnect from the current session
|
141
|
+
*
|
142
|
+
* zh: 断开与当前会话的连接
|
143
|
+
*/
|
144
|
+
async disconnect() {
|
145
|
+
var _a;
|
146
|
+
await ((_a = this._client) === null || _a === void 0 ? void 0 : _a.disconnect());
|
147
|
+
this.isConnected = false;
|
148
|
+
this.dispatch(event_handler_1.EventNames.DISCONNECTED, {});
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* en: Send a message to the bot
|
152
|
+
*
|
153
|
+
* zh: 发送消息给Bot
|
154
|
+
*/
|
155
|
+
async sendMessage(message) {
|
156
|
+
var _a;
|
157
|
+
await ((_a = this._client) === null || _a === void 0 ? void 0 : _a.sendMessage(message));
|
158
|
+
const eventType = typeof message.event_type === 'string'
|
159
|
+
? message.event_type
|
160
|
+
: 'unknown_event';
|
161
|
+
this.dispatch(`client.${eventType}`, message);
|
162
|
+
}
|
163
|
+
/**
|
164
|
+
* en: Enable or disable audio
|
165
|
+
*
|
166
|
+
* zh: 启用或禁用音频
|
167
|
+
*/
|
168
|
+
async setAudioEnable(isEnable) {
|
169
|
+
var _a;
|
170
|
+
await ((_a = this._client) === null || _a === void 0 ? void 0 : _a.changeAudioState(isEnable));
|
171
|
+
if (isEnable) {
|
172
|
+
this.dispatch(event_handler_1.EventNames.AUDIO_UNMUTED, {});
|
173
|
+
}
|
174
|
+
else {
|
175
|
+
this.dispatch(event_handler_1.EventNames.AUDIO_MUTED, {});
|
176
|
+
}
|
177
|
+
}
|
178
|
+
/**
|
179
|
+
* en: Enable audio properties reporting (debug mode only)
|
180
|
+
*
|
181
|
+
* zh: 启用音频属性报告(仅限调试模式)
|
182
|
+
*/
|
183
|
+
enableAudioPropertiesReport(config) {
|
184
|
+
var _a;
|
185
|
+
if (this._config.debug) {
|
186
|
+
(_a = this._client) === null || _a === void 0 ? void 0 : _a.enableAudioPropertiesReport(config);
|
187
|
+
return true;
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
console.warn('enableAudioPropertiesReport is not supported in non-debug mode');
|
191
|
+
return false;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
/**
|
195
|
+
* en: Start audio playback device test (debug mode only)
|
196
|
+
*
|
197
|
+
* zh: 开始音频播放设备测试(仅限调试模式)
|
198
|
+
*/
|
199
|
+
async startAudioPlaybackDeviceTest() {
|
200
|
+
var _a;
|
201
|
+
if (this._config.debug) {
|
202
|
+
await ((_a = this._client) === null || _a === void 0 ? void 0 : _a.startAudioPlaybackDeviceTest());
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
console.warn('startAudioPlaybackDeviceTest is not supported in non-debug mode');
|
206
|
+
}
|
207
|
+
}
|
208
|
+
/**
|
209
|
+
* en: Stop audio playback device test (debug mode only)
|
210
|
+
*
|
211
|
+
* zh: 停止音频播放设备测试(仅限调试模式)
|
212
|
+
*/
|
213
|
+
stopAudioPlaybackDeviceTest() {
|
214
|
+
var _a;
|
215
|
+
if (this._config.debug) {
|
216
|
+
(_a = this._client) === null || _a === void 0 ? void 0 : _a.stopAudioPlaybackDeviceTest();
|
217
|
+
}
|
218
|
+
else {
|
219
|
+
console.warn('stopAudioPlaybackDeviceTest is not supported in non-debug mode');
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
exports.RealtimeClient = RealtimeClient;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"fileNames":["../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../common/temp/default/node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../common/temp/default/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@volcengine+rtc@4.63.1/node_modules/@volcengine/rtc/index.d.ts","../src/error.ts","../src/event-handler.ts","../src/client.ts","../../../common/temp/default/node_modules/.pnpm/axios@1.7.7/node_modules/axios/index.d.ts","../../coze-js/dist/fetcher.d.ts","../../coze-js/dist/error.d.ts","../../coze-js/dist/core.d.ts","../../coze-js/dist/resources/resource.d.ts","../../coze-js/dist/resources/bots/bots.d.ts","../../coze-js/dist/resources/bots/index.d.ts","../../coze-js/dist/resources/chat/messages/index.d.ts","../../coze-js/dist/resources/chat/chat.d.ts","../../coze-js/dist/resources/chat/index.d.ts","../../coze-js/dist/resources/conversations/messages/messages.d.ts","../../coze-js/dist/resources/conversations/messages/index.d.ts","../../coze-js/dist/resources/conversations/index.d.ts","../../coze-js/dist/resources/files/files.d.ts","../../coze-js/dist/resources/files/index.d.ts","../../coze-js/dist/resources/workflows/runs/runs.d.ts","../../coze-js/dist/resources/workflows/runs/index.d.ts","../../coze-js/dist/resources/workflows/index.d.ts","../../coze-js/dist/resources/workspaces/workspaces.d.ts","../../coze-js/dist/resources/workspaces/index.d.ts","../../coze-js/dist/resources/knowledge/documents/documents.d.ts","../../coze-js/dist/resources/knowledge/documents/index.d.ts","../../coze-js/dist/resources/knowledge/index.d.ts","../../coze-js/dist/resources/audio/voices/voices.d.ts","../../coze-js/dist/resources/audio/voices/index.d.ts","../../coze-js/dist/resources/audio/speech/speech.d.ts","../../coze-js/dist/resources/audio/speech/index.d.ts","../../coze-js/dist/resources/audio/rooms/rooms.d.ts","../../coze-js/dist/resources/audio/rooms/index.d.ts","../../coze-js/dist/resources/audio/index.d.ts","../../coze-js/dist/resources/index.d.ts","../../coze-js/dist/auth.d.ts","../../coze-js/dist/constant.d.ts","../../coze-js/dist/index.d.ts","../src/utils.ts","../src/index.ts","../../../common/temp/default/node_modules/.pnpm/@jest+expect-utils@29.7.0/node_modules/@jest/expect-utils/build/index.d.ts","../../../common/temp/default/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@sinclair+typebox@0.27.8/node_modules/@sinclair/typebox/typebox.d.ts","../../../common/temp/default/node_modules/.pnpm/@jest+schemas@29.6.3/node_modules/@jest/schemas/build/index.d.ts","../../../common/temp/default/node_modules/.pnpm/pretty-format@29.7.0/node_modules/pretty-format/build/index.d.ts","../../../common/temp/default/node_modules/.pnpm/jest-diff@29.7.0/node_modules/jest-diff/build/index.d.ts","../../../common/temp/default/node_modules/.pnpm/jest-matcher-utils@29.7.0/node_modules/jest-matcher-utils/build/index.d.ts","../../../common/temp/default/node_modules/.pnpm/expect@29.7.0/node_modules/expect/build/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+jest@29.5.14/node_modules/@types/jest/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/compatibility/disposable.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/compatibility/indexable.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/compatibility/iterators.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/compatibility/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/header.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/readable.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/file.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/fetch.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/formdata.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/connector.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/client.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/errors.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/dispatcher.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/global-dispatcher.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/global-origin.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/pool-stats.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/pool.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/handlers.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/balanced-pool.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/agent.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-interceptor.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-agent.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-client.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-pool.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/mock-errors.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/proxy-agent.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/retry-handler.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/retry-agent.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/api.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/interceptors.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/util.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/cookies.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/patch.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/websocket.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/eventsource.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/filereader.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/diagnostics-channel.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/content-type.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/cache.d.ts","../../../common/temp/default/node_modules/.pnpm/undici-types@6.19.8/node_modules/undici-types/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/globals.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/assert.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/assert/strict.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/async_hooks.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/buffer.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/child_process.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/cluster.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/console.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/constants.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/crypto.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/dgram.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/diagnostics_channel.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/dns.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/dns/promises.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/domain.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/dom-events.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/events.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/fs.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/fs/promises.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/http.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/http2.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/https.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/inspector.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/module.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/net.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/os.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/path.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/perf_hooks.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/process.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/punycode.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/querystring.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/readline.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/readline/promises.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/repl.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/sea.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/stream.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/stream/promises.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/stream/consumers.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/stream/web.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/string_decoder.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/test.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/timers.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/timers/promises.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/tls.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/trace_events.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/tty.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/url.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/util.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/v8.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/vm.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/wasi.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/worker_threads.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/zlib.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+node@20.16.15/node_modules/@types/node/ts5.6/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts","../../../common/temp/default/node_modules/.pnpm/@types+whatwg-fetch@0.0.33/node_modules/@types/whatwg-fetch/index.d.ts"],"fileIdsList":[[100,142],[88,100,142],[90,93,100,142],[100,139,142],[100,141,142],[100,142,147,176],[100,142,143,148,154,155,162,173,184],[100,142,143,144,154,162],[95,96,97,100,142],[100,142,145,185],[100,142,146,147,155,163],[100,142,147,173,181],[100,142,148,150,154,162],[100,141,142,149],[100,142,150,151],[100,142,154],[100,142,152,154],[100,141,142,154],[100,142,154,155,156,173,184],[100,142,154,155,156,169,173,176],[100,137,142,189],[100,142,150,154,157,162,173,184],[100,142,154,155,157,158,162,173,181,184],[100,142,157,159,173,181,184],[100,142,154,160],[100,142,161,184,189],[100,142,150,154,162,173],[100,142,163],[100,142,164],[100,141,142,165],[100,139,140,141,142,143,144,145,146,147,148,149,150,151,152,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190],[100,142,167],[100,142,168],[100,142,154,169,170],[100,142,169,171,185,187],[100,142,154,173,174,175,176],[100,142,173,175],[100,142,173,174],[100,142,176],[100,142,177],[100,139,142,173],[100,142,154,179,180],[100,142,179,180],[100,142,147,162,173,181],[100,142,182],[142],[98,99,100,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190],[100,142,162,183],[100,142,157,168,184],[100,142,147,185],[100,142,173,186],[100,142,161,187],[100,142,188],[100,142,147,154,156,165,173,184,187,189],[100,142,173,190],[45,100,142],[86,92,100,142],[90,100,142],[87,91,100,142],[89,100,142],[100,109,113,142,184],[100,109,142,173,184],[100,104,142],[100,106,109,142,181,184],[100,142,162,181],[100,142,191],[100,104,142,191],[100,106,109,142,162,184],[100,101,102,105,108,142,154,173,184],[100,109,116,142],[100,101,107,142],[100,109,130,131,142],[100,105,109,142,176,184,191],[100,130,142,191],[100,103,104,142,191],[100,109,142],[100,103,104,105,106,107,108,109,110,111,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,131,132,133,134,135,136,142],[100,109,124,142],[100,109,116,117,142],[100,107,109,117,118,142],[100,108,142],[100,101,104,109,142],[100,109,113,117,118,142],[100,113,142],[100,107,109,112,142,184],[100,101,106,109,116,142],[100,142,173],[100,104,109,130,142,189,191],[53,100,142],[50,51,52,100,142],[50,100,142],[51,52,53,80,81,82,100,142],[54,74,76,78,100,142],[77,100,142],[53,54,100,142],[75,100,142],[73,100,142],[55,100,142],[53,54,57,100,142],[58,100,142],[53,54,59,100,142],[53,54,61,80,100,142],[60,100,142],[53,54,80,100,142],[63,100,142],[56,59,62,64,67,69,72,79,100,142],[70,100,142],[54,71,100,142],[54,66,100,142],[65,100,142],[68,100,142],[46,47,48,100,142],[47,100,142],[46,47,48,49,83,84,100,142],[46,100,142]],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"45d8ccb3dfd57355eb29749919142d4321a0aa4df6acdfc54e30433d7176600a","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true,"impliedFormat":1},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1a94697425a99354df73d9c8291e2ecd4dddd370aed4023c2d6dee6cccb32666","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3f9fc0ec0b96a9e642f11eda09c0be83a61c7b336977f8b9fdb1e9788e925fe","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"b80c780c52524beb13488942543972c8b0e54400e8b59cee0169f38d0fabb968","impliedFormat":1},{"version":"20ba7b0bcb995967dcc7a7848d45073c9fabf6014765b77d3bc857707c9c7e53","impliedFormat":1},{"version":"a706e6ca0c22a02cd703b12fd938b49d54b7ba832f27a7d48f880fabb2d5edf1","signature":"277d7a33c5540cb554a0d96bab93da13c28305397e3add569987f0b945d13815"},{"version":"97655622848357b9b9274ad60f81296220ede90fc3958b4520fd19bd05fd64f2","signature":"7281772f2095c1bac3361e9d0632f08c0cf0a7eea49248cb050d029c27acfb0a"},{"version":"04cd110124d4d4db1ea140b87a634220f724f53ba3079a436c43ea3dca671753","signature":"b400aec3b8fbe6cafc7f2a3ad955217d3d78c912850d7dc51cd05320241854bd"},{"version":"01ba761ce6d75a4142858a053f45d64d255e057049ab1cc4d9a93e76b8b5c444","impliedFormat":99},"6d436236d51b12afe8d441fc0823320a934cc0b880da78c4803e0153e37d70aa","d44ebeaaa9e373bc00e438105c6535de8c245de3255d2c76758f3416621705ae","815ac4282705a2a8a20488af2a6905513d24892e0b1944a0a32168ffd33cf698","63ecee3977a910b3944c081e8241b896401a60c75b303af9c4090236f27fc90a","de49c67542c006120c3393c64e2eeb01e328a2af8884a8eb52ba746b9cde2af4","5ea2d7dcff13e90ea95f8a107732e20f250f145a0a8debedd13837653f6fb0a5","2f04ffd339e39a5c6a07d44008d935e0af2f704adf9fb216cbaccb7e16177e75","b657531ce3d6f18e3100baeefd5974c402b3becd1c67b680b03fe7352b83f2b4","7d33b1d7fd6f0b44df3c826d73fa4bd214c8f37b38423b205dc6ddd9762697d3","525b55f7179ff869b4dde5f76f4604bad1c7c0ddcfad93f91fd48cca08d228de","25aabdc730ecda53117f2795202888b9e423573d7dd8d154b1895c2f87946812","42a3d3ec00118dfe569a2bbef33cf5e24b576bb03a899010b4af470ab01937ff","5adb2d96a4bb94fb3be8866f0f4209886c0b5ecad413328e5f0851d3fdc1b7a6","6d985f82ba402122771072ddf5abcc31cbf0f71dc7233b5bcbec3cac12c81ca0","5df0886c4d9ccdd09c80a17af7fe79a4cbab526f2623afd074988df1368e2b84","26c6dbbb8505484b1a9c3f1b34f0c921d2c3c31b6b68ff4fe9e6e742b4a3c53a","18a7f6fede854c7defd84aad30be9541f7102eb047e2884977f54d5cd9d2d174","9e7388343664b6997b7a7fcec592c0d1d7517ac4f1726f7eee9d2e4149996821","b53f885847dab9a62f3c3128a52703fd4a97e2ace17f0402d4ff559fe8769fd2","de4be4d883cd94e1e1216b570edd09eb6022ba189d0f78f443719b1304820dca","aad607c87bda03aad0534d0bd33ad843a7d684f88c6781afe03c9fbd55ac2d76","bdcb0eb75451843b1cdf965aea3128cbc9b58b2970e0885f21aa209c3d00536a","cc5c1f7fea205ad2880ee2f90107387c1e7f1751a1eee87bb8e82321a3ba72e2","83d98ee987badca746f0c2af03f366715e8f4c662486cf2d7c31da40c322b8fc","906ea4b3946d0daa5733d98a4ca62f317d047d94f0205790f006b3ffa8618adb","559807cb592bc737ea9d3d6310c4a4fe47c9935347f1d01530bc2ba22df3db81","2f9e430b1b5d1c0fde8a082702f8ef48cc1c7812d9bd21a56a34e8b671c8bd80","785746fcdd9907726a1fdeaf58d0d7f22ff2e1ecebca9ce9c8d3cc77ae96bb96","119b16ad90dc28c306f200780e0804a4ba37ed6fb88f88a0394d28bc3f258c03","1b98fa79be1f51ffcc5acbf0a682768fe76e3bf16dc050def8ceeb74c3d25096","789588499ba542dac5ef2427e98c8c34b8adb354d7cde0a47a7bad25cafb117d","e2157ebbc72e73f7d5ea1bbc145676e1e0cc57b003117bf075d64ce7b7a8b7b6","c4134efd1d27117191325b765c46fff0a875f74f75ed5aabaab27385a92d2685",{"version":"024db4d6a85c865015edaf07872b14de1782ec1b6808dd1eccf2902d54179671","signature":"80935ec7670ba84d6c8994b736f8d5d5f7d360b3f462f8e806646ecbeede8f57"},{"version":"e8eb52500cda607420db830d3b0a43801ff1696e38a1f1ba6a30572047f8edc7","signature":"015d8b0924a1ab14230f0cea3943a99266cea731eb55a31af6321c048afb4137"},{"version":"cdcc132f207d097d7d3aa75615ab9a2e71d6a478162dde8b67f88ea19f3e54de","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"c085e9aa62d1ae1375794c1fb927a445fa105fed891a7e24edbb1c3300f7384a","impliedFormat":1},{"version":"f315e1e65a1f80992f0509e84e4ae2df15ecd9ef73df975f7c98813b71e4c8da","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"3e70a7e67c2cb16f8cd49097360c0309fe9d1e3210ff9222e9dac1f8df9d4fb6","impliedFormat":1},{"version":"ab68d2a3e3e8767c3fba8f80de099a1cfc18c0de79e42cb02ae66e22dfe14a66","impliedFormat":1},{"version":"d96cc6598148bf1a98fb2e8dcf01c63a4b3558bdaec6ef35e087fd0562eb40ec","impliedFormat":1},{"version":"f8db4fea512ab759b2223b90ecbbe7dae919c02f8ce95ec03f7fb1cf757cfbeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true,"impliedFormat":1},{"version":"2d1319e6b5d0efd8c5eae07eb864a00102151e8b9afddd2d45db52e9aae002c4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"24bd580b5743dc56402c440dc7f9a4f5d592ad7a419f25414d37a7bfe11e342b","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"6bdc71028db658243775263e93a7db2fd2abfce3ca569c3cca5aee6ed5eb186d","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"4d2b0eb911816f66abe4970898f97a2cfc902bcd743cbfa5017fad79f7ef90d8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","impliedFormat":1},{"version":"24b8685c62562f5d98615c5a0c1d05f297cf5065f15246edfe99e81ec4c0e011","impliedFormat":1},{"version":"93507c745e8f29090efb99399c3f77bec07db17acd75634249dc92f961573387","impliedFormat":1},{"version":"339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"ca6d304b929748ea15c33f28c1f159df18a94470b424ab78c52d68d40a41e1e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"a72ffc815104fb5c075106ebca459b2d55d07862a773768fce89efc621b3964b","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36","impliedFormat":1},{"version":"d674383111e06b6741c4ad2db962131b5b0fa4d0294b998566c635e86195a453","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","impliedFormat":1},{"version":"a3e8bafb2af8e850c644f4be7f5156cf7d23b7bfdc3b786bd4d10ed40329649c","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","impliedFormat":1},{"version":"c521f961c1606c94dc831992e659f426b6def6e2e6e327ee25d3c642eb393f95","affectsGlobalScope":true,"impliedFormat":1},{"version":"b0c0d1d13be149f790a75b381b413490f98558649428bb916fd2d71a3f47a134","impliedFormat":1},{"version":"3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","impliedFormat":1},{"version":"5a369483ac4cfbdf0331c248deeb36140e6907db5e1daed241546b4a2055f82c","impliedFormat":1},{"version":"e8f5b5cc36615c17d330eaf8eebbc0d6bdd942c25991f96ef122f246f4ff722f","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true,"impliedFormat":1},{"version":"4d7da7075068195f8f127f41c61e304cdca5aafb1be2d0f4fb67c6b4c3e98d50","affectsGlobalScope":true,"impliedFormat":1},{"version":"a4bdde4e601e9554a844e1e0d0ccfa05e183ef9d82ab3ac25f17c1709033d360","impliedFormat":1},{"version":"ad23fd126ff06e72728dd7bfc84326a8ca8cec2b9d2dac0193d42a777df0e7d8","impliedFormat":1},{"version":"9dd9f50652a176469e85fb65aa081d2e7eb807e2c476f378233de4f1f6604962","impliedFormat":1},{"version":"93bd413918fa921c8729cef45302b24d8b6c7855d72d5bf82d3972595ae8dcbf","impliedFormat":1},{"version":"4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","impliedFormat":1},{"version":"dccdf1677e531e33f8ac961a68bc537418c9a414797c1ea7e91307501cdc3f5e","impliedFormat":1},{"version":"7edec695cdb707c7146ac34c44ca364469c7ea504344b3206c686e79f61b61a2","affectsGlobalScope":true,"impliedFormat":1},{"version":"d206b4baf4ddcc15d9d69a9a2f4999a72a2c6adeaa8af20fa7a9960816287555","impliedFormat":1},{"version":"93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","impliedFormat":1},{"version":"d1b1295af3667779be43eb6d4fbaa342e656aa2c4b77a4ad3cf42ec55baeea00","impliedFormat":1},{"version":"70731d10d5311bd4cf710ef7f6539b62660f4b0bfdbb3f9fbe1d25fe6366a7fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"a20f1e119615bf7632729fd89b6c0b5ffdc2df3b512d6304146294528e3ebe19","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"137c2894e8f3e9672d401cc0a305dc7b1db7c69511cf6d3970fb53302f9eae09","impliedFormat":1},{"version":"e9b18bef86287c3e6319addddfd57dfaa14a7a6d8353c042e1806383f5a9472e","impliedFormat":1},{"version":"e432b0e3761ca9ba734bdd41e19a75fec1454ca8e9769bfdf8b31011854cf06a","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"5fe5bdd4b7cdbbe00c862ec8a925fabd8cc5738a6a9adda343b59d0efa21ea57","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","impliedFormat":1},{"version":"bb715efb4857eb94539eafb420352105a0cff40746837c5140bf6b035dd220ba","affectsGlobalScope":true,"impliedFormat":1},{"version":"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb","impliedFormat":1},{"version":"fdedf82878e4c744bc2a1c1e802ae407d63474da51f14a54babe039018e53d8f","affectsGlobalScope":true,"impliedFormat":1},{"version":"08353b04a3501d84fc8d7b49de99f6c1cc26026e6d9d697a18315f3bfe92ed03","affectsGlobalScope":true,"impliedFormat":1},{"version":"578d8bb6dcb2a1c03c4c3f8eb71abc9677e1a5c788b7f24848e3138ce17f3400","impliedFormat":1},{"version":"4f029899f9bae07e225c43aef893590541b2b43267383bf5e32e3a884d219ed5","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"5b566927cad2ed2139655d55d690ffa87df378b956e7fe1c96024c4d9f75c4cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"183b5b2e211391e91b1e171079c4bfde5339fba0238167dc254978b3337eea72","affectsGlobalScope":true,"impliedFormat":1},{"version":"efeedd8bbc5c0d53e760d8b120a010470722982e6ae14de8d1bcff66ebc2ae71","impliedFormat":1},{"version":"b718a94332858862943630649a310d6f8e9a09f86ae7215d8554e75bbbfd7817","impliedFormat":1},{"version":"d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c","impliedFormat":1},{"version":"616075a6ac578cf5a013ee12964188b4412823796ce0b202c6f1d2e4ca8480d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","impliedFormat":1},{"version":"9091e564b81e7b4c382a33c62de704a699e10508190547d4f7c1c3e039d2db2b","impliedFormat":1},{"version":"7d2b7fe4adb76d8253f20e4dbdce044f1cdfab4902ec33c3604585f553883f7d","impliedFormat":1},{"version":"393d0ee0144b9500d1a98f98edbfd1a1a3bab8095723665afb3c43734eb067cf","affectsGlobalScope":true,"impliedFormat":1}],"root":[[47,49],84,85],"options":{"allowJs":false,"allowSyntheticDefaultImports":true,"alwaysStrict":true,"composite":true,"declaration":true,"esModuleInterop":true,"experimentalDecorators":true,"jsx":1,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":false,"outDir":"./","removeComments":false,"rootDir":"../src","skipLibCheck":true,"sourceMap":false,"strict":true,"strictNullChecks":true,"target":5,"tsBuildInfoFile":"./tsconfig.build.tsbuildinfo"},"referencedMap":[[86,1],[89,2],[88,1],[94,3],[139,4],[140,4],[141,5],[142,6],[143,7],[144,8],[95,1],[98,9],[96,1],[97,1],[145,10],[146,11],[147,12],[148,13],[149,14],[150,15],[151,15],[153,16],[152,17],[154,18],[155,19],[156,20],[138,21],[157,22],[158,23],[159,24],[160,25],[161,26],[162,27],[163,28],[164,29],[165,30],[166,31],[167,32],[168,33],[169,34],[170,34],[171,35],[172,1],[173,36],[175,37],[174,38],[176,39],[177,40],[178,41],[179,42],[180,43],[181,44],[182,45],[100,46],[99,1],[191,47],[183,48],[184,49],[185,50],[186,51],[187,52],[188,53],[189,54],[190,55],[192,1],[193,1],[46,56],[50,1],[87,1],[45,1],[93,57],[91,58],[92,59],[90,60],[43,1],[44,1],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[18,1],[4,1],[19,1],[23,1],[20,1],[21,1],[22,1],[24,1],[25,1],[26,1],[5,1],[27,1],[28,1],[29,1],[30,1],[6,1],[34,1],[31,1],[32,1],[33,1],[35,1],[7,1],[36,1],[41,1],[42,1],[37,1],[38,1],[39,1],[40,1],[1,1],[116,61],[126,62],[115,61],[136,63],[107,64],[106,65],[135,66],[129,67],[134,68],[109,69],[123,70],[108,71],[132,72],[104,73],[103,66],[133,74],[105,75],[110,76],[111,1],[114,76],[101,1],[137,77],[127,78],[118,79],[119,80],[121,81],[117,82],[120,83],[130,66],[112,84],[113,85],[122,86],[102,87],[125,78],[124,76],[128,1],[131,88],[81,89],[82,1],[53,90],[52,91],[51,91],[83,92],[79,93],[78,94],[77,95],[76,96],[75,95],[74,97],[73,95],[55,95],[56,98],[58,99],[59,100],[57,101],[62,102],[61,103],[60,104],[63,95],[64,105],[80,106],[70,95],[71,107],[72,108],[54,89],[67,109],[66,110],[65,95],[69,111],[68,95],[49,112],[47,1],[48,113],[85,114],[84,115]],"latestChangedDtsFile":"./index.d.ts","version":"5.6.3"}
|
package/dist/utils.d.ts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
+ * Delays execution for the specified duration
|
3
|
+
+ * @param milliseconds The time to sleep in milliseconds
|
4
|
+
+ * @throws {Error} If milliseconds is negative
|
5
|
+
+ * @returns Promise that resolves after the specified duration
|
6
|
+
+ */
|
7
|
+
export declare const sleep: (milliseconds: number) => Promise<void>;
|
8
|
+
/**
|
9
|
+
* Check microphone permission,return boolean
|
10
|
+
*/
|
11
|
+
export declare const checkPermission: () => Promise<boolean>;
|
package/dist/utils.js
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.checkPermission = exports.sleep = void 0;
|
7
|
+
const rtc_1 = __importDefault(require("@volcengine/rtc"));
|
8
|
+
/**
|
9
|
+
+ * Delays execution for the specified duration
|
10
|
+
+ * @param milliseconds The time to sleep in milliseconds
|
11
|
+
+ * @throws {Error} If milliseconds is negative
|
12
|
+
+ * @returns Promise that resolves after the specified duration
|
13
|
+
+ */
|
14
|
+
const sleep = (milliseconds) => {
|
15
|
+
if (milliseconds < 0) {
|
16
|
+
throw new Error('Sleep duration must be non-negative');
|
17
|
+
}
|
18
|
+
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
19
|
+
};
|
20
|
+
exports.sleep = sleep;
|
21
|
+
/**
|
22
|
+
* Check microphone permission,return boolean
|
23
|
+
*/
|
24
|
+
const checkPermission = async () => (await rtc_1.default.enableDevices({ audio: true, video: false })).audio;
|
25
|
+
exports.checkPermission = checkPermission;
|
package/package.json
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"name": "@coze/realtime-api",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "Coze Realtime API",
|
5
|
+
"homepage": "https://github.com/coze-dev/coze-js/packages/realtime-api",
|
6
|
+
"repository": {
|
7
|
+
"type": "git",
|
8
|
+
"url": "https://github.com/coze-dev/coze-js.git",
|
9
|
+
"directory": "packages/realtime-api"
|
10
|
+
},
|
11
|
+
"license": "MIT",
|
12
|
+
"author": "jackshen <jackshen310@gmail.com>",
|
13
|
+
"type": "module",
|
14
|
+
"exports": {
|
15
|
+
".": "./dist/index.js"
|
16
|
+
},
|
17
|
+
"main": "dist/index.js",
|
18
|
+
"types": "dist/index.d.ts",
|
19
|
+
"files": [
|
20
|
+
"dist",
|
21
|
+
"assets",
|
22
|
+
"LICENSE",
|
23
|
+
"README.md"
|
24
|
+
],
|
25
|
+
"scripts": {
|
26
|
+
"build": "rm -rf dist && tsc -b tsconfig.build.json",
|
27
|
+
"buildAll": "npm run build && cd examples/realtime-console && npm run build",
|
28
|
+
"demo": "npm run build && cd examples/realtime-console && npm run start",
|
29
|
+
"format": "prettier --write .",
|
30
|
+
"lint": "eslint ./ --cache --quiet",
|
31
|
+
"prepublishOnly": "npm run build",
|
32
|
+
"start": "rm -rf dist && tsc -b -w tsconfig.build.json",
|
33
|
+
"test": "jest --coverage --config=jest.config.cjs ./test/*"
|
34
|
+
},
|
35
|
+
"dependencies": {
|
36
|
+
"@coze/api": "1.0.0",
|
37
|
+
"@volcengine/rtc": "^4.62.1"
|
38
|
+
},
|
39
|
+
"devDependencies": {
|
40
|
+
"@coze-infra/eslint-config": "workspace:*",
|
41
|
+
"@coze-infra/ts-config": "workspace:*",
|
42
|
+
"@swc/core": "^1.3.14",
|
43
|
+
"@types/jest": "^29.2.2",
|
44
|
+
"@types/node": "^20",
|
45
|
+
"@types/uuid": "^9.0.1",
|
46
|
+
"@types/whatwg-fetch": "^0.0.33",
|
47
|
+
"axios": "^1.7.7",
|
48
|
+
"jest": "^29.3.0",
|
49
|
+
"ts-jest": "^29.0.3",
|
50
|
+
"typescript": "^5.5.3"
|
51
|
+
},
|
52
|
+
"peerDependencies": {
|
53
|
+
"axios": "^1.7.1"
|
54
|
+
}
|
55
|
+
}
|