@chanl/widget-sdk 0.2.0-canary.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/README.md +257 -0
- package/dist/auth.d.ts +26 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +36 -0
- package/dist/auth.js.map +1 -0
- package/dist/chat/chat-client.d.ts +81 -0
- package/dist/chat/chat-client.d.ts.map +1 -0
- package/dist/chat/chat-client.js +192 -0
- package/dist/chat/chat-client.js.map +1 -0
- package/dist/chat/stream-parser.d.ts +20 -0
- package/dist/chat/stream-parser.d.ts.map +1 -0
- package/dist/chat/stream-parser.js +134 -0
- package/dist/chat/stream-parser.js.map +1 -0
- package/dist/chat/widget-config.d.ts +7 -0
- package/dist/chat/widget-config.d.ts.map +1 -0
- package/dist/chat/widget-config.js +26 -0
- package/dist/chat/widget-config.js.map +1 -0
- package/dist/client.d.ts +66 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +49 -0
- package/dist/client.js.map +1 -0
- package/dist/defaults.d.ts +12 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +27 -0
- package/dist/defaults.js.map +1 -0
- package/dist/embed/loader-types.d.ts +119 -0
- package/dist/embed/loader-types.d.ts.map +1 -0
- package/dist/embed/loader-types.js +20 -0
- package/dist/embed/loader-types.js.map +1 -0
- package/dist/embed/loader.d.ts +101 -0
- package/dist/embed/loader.d.ts.map +1 -0
- package/dist/embed/loader.js +439 -0
- package/dist/embed/loader.js.map +1 -0
- package/dist/embed/v1.global.js +5 -0
- package/dist/embed/v1.global.js.map +1 -0
- package/dist/events.d.ts +10 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +25 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +14 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +3 -0
- package/dist/logger.js.map +1 -0
- package/dist/next/index.d.ts +58 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +83 -0
- package/dist/next/index.js.map +1 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +20 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/types.d.ts +27 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/types.js +8 -0
- package/dist/react/types.js.map +1 -0
- package/dist/react/use-chanl.d.ts +27 -0
- package/dist/react/use-chanl.d.ts.map +1 -0
- package/dist/react/use-chanl.js +57 -0
- package/dist/react/use-chanl.js.map +1 -0
- package/dist/react/use-chat.d.ts +32 -0
- package/dist/react/use-chat.d.ts.map +1 -0
- package/dist/react/use-chat.js +224 -0
- package/dist/react/use-chat.js.map +1 -0
- package/dist/react/use-voice.d.ts +37 -0
- package/dist/react/use-voice.d.ts.map +1 -0
- package/dist/react/use-voice.js +268 -0
- package/dist/react/use-voice.js.map +1 -0
- package/dist/react/widget.d.ts +43 -0
- package/dist/react/widget.d.ts.map +1 -0
- package/dist/react/widget.js +188 -0
- package/dist/react/widget.js.map +1 -0
- package/dist/storage/session-storage.d.ts +48 -0
- package/dist/storage/session-storage.d.ts.map +1 -0
- package/dist/storage/session-storage.js +84 -0
- package/dist/storage/session-storage.js.map +1 -0
- package/dist/types.d.ts +140 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/voice/audio-recorder.d.ts +43 -0
- package/dist/voice/audio-recorder.d.ts.map +1 -0
- package/dist/voice/audio-recorder.js +127 -0
- package/dist/voice/audio-recorder.js.map +1 -0
- package/dist/voice/index.d.ts +13 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +16 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/mock-mode.d.ts +93 -0
- package/dist/voice/mock-mode.d.ts.map +1 -0
- package/dist/voice/mock-mode.js +375 -0
- package/dist/voice/mock-mode.js.map +1 -0
- package/dist/voice/transports/index.d.ts +5 -0
- package/dist/voice/transports/index.d.ts.map +1 -0
- package/dist/voice/transports/index.js +10 -0
- package/dist/voice/transports/index.js.map +1 -0
- package/dist/voice/transports/transport.d.ts +70 -0
- package/dist/voice/transports/transport.d.ts.map +1 -0
- package/dist/voice/transports/transport.js +12 -0
- package/dist/voice/transports/transport.js.map +1 -0
- package/dist/voice/transports/vapi.d.ts +147 -0
- package/dist/voice/transports/vapi.d.ts.map +1 -0
- package/dist/voice/transports/vapi.js +337 -0
- package/dist/voice/transports/vapi.js.map +1 -0
- package/dist/voice/transports/webrtc.d.ts +58 -0
- package/dist/voice/transports/webrtc.d.ts.map +1 -0
- package/dist/voice/transports/webrtc.js +318 -0
- package/dist/voice/transports/webrtc.js.map +1 -0
- package/dist/voice/transports/websocket.d.ts +39 -0
- package/dist/voice/transports/websocket.d.ts.map +1 -0
- package/dist/voice/transports/websocket.js +280 -0
- package/dist/voice/transports/websocket.js.map +1 -0
- package/dist/voice/types.d.ts +323 -0
- package/dist/voice/types.d.ts.map +1 -0
- package/dist/voice/types.js +41 -0
- package/dist/voice/types.js.map +1 -0
- package/dist/voice/utils.d.ts +22 -0
- package/dist/voice/utils.d.ts.map +1 -0
- package/dist/voice/utils.js +44 -0
- package/dist/voice/utils.js.map +1 -0
- package/dist/voice/voice-client.d.ts +231 -0
- package/dist/voice/voice-client.d.ts.map +1 -0
- package/dist/voice/voice-client.js +1187 -0
- package/dist/voice/voice-client.js.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-recorder.js","sourceRoot":"","sources":["../../src/voice/audio-recorder.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,yEAKmC;AACnC,iGAAgE;AAChE,mCAAuC;AAiBvC;;;GAGG;AACH,MAAa,aAAa;IAKxB,YAAY,EACV,gBAAgB,GAAG,EAAE,gBAAgB,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AI,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACxF,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACtD,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AA7HD,sCA6HC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @chanl/widget-sdk/voice — direct VoiceClient surface for real-time voice calls.
|
|
3
|
+
*
|
|
4
|
+
* Browser only. Pulls in `extendable-media-recorder` + `pcm-player` which
|
|
5
|
+
* require `Worker` and other browser globals — do not import from node test
|
|
6
|
+
* environments. For node-safe lazy access use `createChanlClient().voice`.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import { VoiceClient, type WebsocketCallCreatePayload, type InboundServerMessage } from '@chanl/widget-sdk/voice';
|
|
10
|
+
*/
|
|
11
|
+
export { VoiceClient } from './voice-client';
|
|
12
|
+
export type { AssistantOverrides, AudialConfig, AudialState, ChatHistoryResponse, ChatMessage, ChatMessageResponse, ChatSessionCreatePayload, ChatSessionResponse, ChatSessionState, ChatState, ConnectionStatus, InboundServerMessage, OutboundClientMessage, RoomConnectionState, RetryPolicy, SenderRole, TranscriptMessage, WebsocketCallCreatePayload, WebsocketRoomResponse, WebsocketRoomStatus, WsMessageType, } from './types';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/voice/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GACd,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @chanl/widget-sdk/voice — direct VoiceClient surface for real-time voice calls.
|
|
4
|
+
*
|
|
5
|
+
* Browser only. Pulls in `extendable-media-recorder` + `pcm-player` which
|
|
6
|
+
* require `Worker` and other browser globals — do not import from node test
|
|
7
|
+
* environments. For node-safe lazy access use `createChanlClient().voice`.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* import { VoiceClient, type WebsocketCallCreatePayload, type InboundServerMessage } from '@chanl/widget-sdk/voice';
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.VoiceClient = void 0;
|
|
14
|
+
var voice_client_1 = require("./voice-client");
|
|
15
|
+
Object.defineProperty(exports, "VoiceClient", { enumerable: true, get: function () { return voice_client_1.VoiceClient; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/voice/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,+CAA6C;AAApC,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MockMode.ts - Simulated conversation responses for testing and demos
|
|
3
|
+
*
|
|
4
|
+
* This class provides a complete simulation of the Audial backend without
|
|
5
|
+
* requiring a real connection. Perfect for testing, examples, and demos.
|
|
6
|
+
*/
|
|
7
|
+
import { CustomEventEmitter } from '../events';
|
|
8
|
+
export interface MockResponse {
|
|
9
|
+
delay: number;
|
|
10
|
+
type: 'text' | 'audio' | 'transcript' | 'system';
|
|
11
|
+
content?: string;
|
|
12
|
+
audioUrl?: string;
|
|
13
|
+
metadata?: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
export interface MockConversation {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
responses: MockResponse[];
|
|
19
|
+
}
|
|
20
|
+
export interface MockModeConfig {
|
|
21
|
+
conversation?: string;
|
|
22
|
+
customResponses?: MockResponse[];
|
|
23
|
+
enableAudioSimulation?: boolean;
|
|
24
|
+
enableTypingIndicator?: boolean;
|
|
25
|
+
averageResponseDelay?: number;
|
|
26
|
+
debug?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface MockModeEventMap extends Record<string, (...args: any[]) => void> {
|
|
29
|
+
ready: () => void;
|
|
30
|
+
closed: (code: number, reason: string) => void;
|
|
31
|
+
message: (message: any) => void;
|
|
32
|
+
transcript: (transcript: any) => void;
|
|
33
|
+
typing: (isTyping: boolean) => void;
|
|
34
|
+
speechStart: () => void;
|
|
35
|
+
speechEnd: () => void;
|
|
36
|
+
audio: (audio: any) => void;
|
|
37
|
+
qualityChanged: (quality: any) => void;
|
|
38
|
+
}
|
|
39
|
+
export declare class MockMode extends CustomEventEmitter<MockModeEventMap> {
|
|
40
|
+
private config;
|
|
41
|
+
private messageCount;
|
|
42
|
+
private isActive;
|
|
43
|
+
private responseTimeout;
|
|
44
|
+
private typingTimeout;
|
|
45
|
+
private static readonly CONVERSATIONS;
|
|
46
|
+
constructor(config?: MockModeConfig);
|
|
47
|
+
/**
|
|
48
|
+
* Start the mock conversation
|
|
49
|
+
*/
|
|
50
|
+
start(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Stop the mock conversation
|
|
53
|
+
*/
|
|
54
|
+
stop(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Simulate sending a message and get a response
|
|
57
|
+
*/
|
|
58
|
+
send(message: any): void;
|
|
59
|
+
/**
|
|
60
|
+
* Generate a simulated response
|
|
61
|
+
*/
|
|
62
|
+
private generateResponse;
|
|
63
|
+
/**
|
|
64
|
+
* Get responses for current conversation
|
|
65
|
+
*/
|
|
66
|
+
private getResponses;
|
|
67
|
+
/**
|
|
68
|
+
* Clear all active timeouts
|
|
69
|
+
*/
|
|
70
|
+
private clearTimeouts;
|
|
71
|
+
/**
|
|
72
|
+
* Get available conversation templates
|
|
73
|
+
*/
|
|
74
|
+
static getAvailableConversations(): Record<string, MockConversation>;
|
|
75
|
+
/**
|
|
76
|
+
* Simulate audio recording (for voice mode testing)
|
|
77
|
+
*/
|
|
78
|
+
simulateAudioRecording(duration?: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Simulate connection quality changes
|
|
81
|
+
*/
|
|
82
|
+
simulateConnectionQuality(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get current mock status
|
|
85
|
+
*/
|
|
86
|
+
getStatus(): {
|
|
87
|
+
active: boolean;
|
|
88
|
+
messageCount: number;
|
|
89
|
+
conversation: string;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export default MockMode;
|
|
93
|
+
//# sourceMappingURL=mock-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-mode.d.ts","sourceRoot":"","sources":["../../src/voice/mock-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3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CACxC;AAED,qBAAa,QAAS,SAAQ,kBAAkB,CAAC,gBAAgB,CAAC;IAChE,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,eAAe,CAA+B;IACtD,OAAO,CAAC,aAAa,CAA+B;IAGpD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CA6InC;gBAEU,MAAM,GAAE,cAAmB;IAgBvC;;OAEG;IACH,KAAK,IAAI,IAAI;IAqBb;;OAEG;IACH,IAAI,IAAI,IAAI;IAeZ;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IA8BxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0ExB;;OAEG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,OAAO,CAAC,aAAa;IAYrB;;OAEG;IACH,MAAM,CAAC,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAIpE;;OAEG;IACH,sBAAsB,CAAC,QAAQ,GAAE,MAAa,GAAG,IAAI;IAqBrD;;OAEG;IACH,yBAAyB,IAAI,IAAI;IAWjC;;OAEG;IACH,SAAS,IAAI;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE;CAO7E;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MockMode.ts - Simulated conversation responses for testing and demos
|
|
4
|
+
*
|
|
5
|
+
* This class provides a complete simulation of the Audial backend without
|
|
6
|
+
* requiring a real connection. Perfect for testing, examples, and demos.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MockMode = void 0;
|
|
10
|
+
const events_1 = require("../events");
|
|
11
|
+
class MockMode extends events_1.CustomEventEmitter {
|
|
12
|
+
constructor(config = {}) {
|
|
13
|
+
super();
|
|
14
|
+
this.messageCount = 0;
|
|
15
|
+
this.isActive = false;
|
|
16
|
+
this.responseTimeout = null;
|
|
17
|
+
this.typingTimeout = null;
|
|
18
|
+
this.config = {
|
|
19
|
+
conversation: 'customer-support',
|
|
20
|
+
enableAudioSimulation: true,
|
|
21
|
+
enableTypingIndicator: true,
|
|
22
|
+
averageResponseDelay: 1500,
|
|
23
|
+
debug: false,
|
|
24
|
+
...config
|
|
25
|
+
};
|
|
26
|
+
if (this.config.debug) {
|
|
27
|
+
console.debug('🎭 MockMode initialized:', this.config);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Start the mock conversation
|
|
32
|
+
*/
|
|
33
|
+
start() {
|
|
34
|
+
if (this.isActive) {
|
|
35
|
+
throw new Error('MockMode: already active');
|
|
36
|
+
}
|
|
37
|
+
this.isActive = true;
|
|
38
|
+
this.messageCount = 0;
|
|
39
|
+
if (this.config.debug) {
|
|
40
|
+
console.debug('🎭 MockMode started');
|
|
41
|
+
}
|
|
42
|
+
// Emit ready event after short delay
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
this.emit('ready');
|
|
45
|
+
if (this.config.debug) {
|
|
46
|
+
console.debug('🎭 MockMode ready event emitted');
|
|
47
|
+
}
|
|
48
|
+
}, 100);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Stop the mock conversation
|
|
52
|
+
*/
|
|
53
|
+
stop() {
|
|
54
|
+
if (!this.isActive) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.isActive = false;
|
|
58
|
+
this.clearTimeouts();
|
|
59
|
+
if (this.config.debug) {
|
|
60
|
+
console.debug('🎭 MockMode stopped');
|
|
61
|
+
}
|
|
62
|
+
this.emit('closed', 1000, 'mock-stop');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Simulate sending a message and get a response
|
|
66
|
+
*/
|
|
67
|
+
send(message) {
|
|
68
|
+
if (!this.isActive) {
|
|
69
|
+
console.warn('🎭 MockMode: cannot send message, not active');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (this.config.debug) {
|
|
73
|
+
console.debug('🎭 MockMode received message:', message);
|
|
74
|
+
}
|
|
75
|
+
// Emit message back for logging
|
|
76
|
+
this.emit('message', {
|
|
77
|
+
type: 'user-message',
|
|
78
|
+
content: message.content || message.text,
|
|
79
|
+
timestamp: new Date().toISOString()
|
|
80
|
+
});
|
|
81
|
+
// Simulate typing indicator
|
|
82
|
+
if (this.config.enableTypingIndicator && message.type === 'text') {
|
|
83
|
+
this.emit('typing', true);
|
|
84
|
+
this.typingTimeout = setTimeout(() => {
|
|
85
|
+
this.emit('typing', false);
|
|
86
|
+
}, 800);
|
|
87
|
+
}
|
|
88
|
+
// Generate response after delay
|
|
89
|
+
this.generateResponse(message);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Generate a simulated response
|
|
93
|
+
*/
|
|
94
|
+
generateResponse(_userMessage) {
|
|
95
|
+
const responses = this.getResponses();
|
|
96
|
+
const responseIndex = this.messageCount % responses.length;
|
|
97
|
+
const response = responses[responseIndex];
|
|
98
|
+
this.responseTimeout = setTimeout(() => {
|
|
99
|
+
if (!this.isActive)
|
|
100
|
+
return;
|
|
101
|
+
// Clear typing indicator
|
|
102
|
+
if (this.typingTimeout) {
|
|
103
|
+
clearTimeout(this.typingTimeout);
|
|
104
|
+
this.emit('typing', false);
|
|
105
|
+
}
|
|
106
|
+
// Handle different response types
|
|
107
|
+
switch (response.type) {
|
|
108
|
+
case 'text':
|
|
109
|
+
this.emit('message', {
|
|
110
|
+
type: 'text',
|
|
111
|
+
content: response.content,
|
|
112
|
+
sender: 'assistant',
|
|
113
|
+
timestamp: new Date().toISOString(),
|
|
114
|
+
metadata: response.metadata
|
|
115
|
+
});
|
|
116
|
+
break;
|
|
117
|
+
case 'transcript':
|
|
118
|
+
this.emit('transcript', {
|
|
119
|
+
text: response.content,
|
|
120
|
+
role: 'assistant',
|
|
121
|
+
confidence: response.metadata?.confidence || 0.9,
|
|
122
|
+
timestamp: new Date().toISOString()
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
case 'audio':
|
|
126
|
+
if (this.config.enableAudioSimulation) {
|
|
127
|
+
// Simulate speech start
|
|
128
|
+
this.emit('speechStart');
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
this.emit('audio', {
|
|
131
|
+
audioUrl: response.audioUrl,
|
|
132
|
+
transcript: response.content,
|
|
133
|
+
timestamp: new Date().toISOString()
|
|
134
|
+
});
|
|
135
|
+
// Simulate speech end
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
this.emit('speechEnd');
|
|
138
|
+
}, 1000);
|
|
139
|
+
}, 200);
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
case 'system':
|
|
143
|
+
this.emit('message', {
|
|
144
|
+
type: 'system',
|
|
145
|
+
content: response.content,
|
|
146
|
+
timestamp: new Date().toISOString(),
|
|
147
|
+
metadata: response.metadata
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
this.messageCount++;
|
|
152
|
+
if (this.config.debug) {
|
|
153
|
+
console.debug(`🎭 MockMode sent response ${this.messageCount}:`, response);
|
|
154
|
+
}
|
|
155
|
+
}, response.delay);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get responses for current conversation
|
|
159
|
+
*/
|
|
160
|
+
getResponses() {
|
|
161
|
+
if (this.config.customResponses) {
|
|
162
|
+
return this.config.customResponses;
|
|
163
|
+
}
|
|
164
|
+
const conversationKey = this.config.conversation || 'customer-support';
|
|
165
|
+
const conversation = MockMode.CONVERSATIONS[conversationKey];
|
|
166
|
+
if (!conversation) {
|
|
167
|
+
console.warn(`🎭 MockMode: conversation '${conversationKey}' not found, using default`);
|
|
168
|
+
return MockMode.CONVERSATIONS['customer-support'].responses;
|
|
169
|
+
}
|
|
170
|
+
return conversation.responses;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Clear all active timeouts
|
|
174
|
+
*/
|
|
175
|
+
clearTimeouts() {
|
|
176
|
+
if (this.responseTimeout) {
|
|
177
|
+
clearTimeout(this.responseTimeout);
|
|
178
|
+
this.responseTimeout = null;
|
|
179
|
+
}
|
|
180
|
+
if (this.typingTimeout) {
|
|
181
|
+
clearTimeout(this.typingTimeout);
|
|
182
|
+
this.typingTimeout = null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get available conversation templates
|
|
187
|
+
*/
|
|
188
|
+
static getAvailableConversations() {
|
|
189
|
+
return { ...MockMode.CONVERSATIONS };
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Simulate audio recording (for voice mode testing)
|
|
193
|
+
*/
|
|
194
|
+
simulateAudioRecording(duration = 2000) {
|
|
195
|
+
if (!this.isActive)
|
|
196
|
+
return;
|
|
197
|
+
this.emit('speechStart');
|
|
198
|
+
if (this.config.debug) {
|
|
199
|
+
console.debug(`🎭 MockMode simulating ${duration}ms audio recording`);
|
|
200
|
+
}
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
this.emit('speechEnd');
|
|
203
|
+
// Simulate sending voice message
|
|
204
|
+
this.send({
|
|
205
|
+
type: 'voice',
|
|
206
|
+
content: 'Simulated voice input',
|
|
207
|
+
duration: duration
|
|
208
|
+
});
|
|
209
|
+
}, duration);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Simulate connection quality changes
|
|
213
|
+
*/
|
|
214
|
+
simulateConnectionQuality() {
|
|
215
|
+
const qualities = ['excellent', 'good', 'fair', 'poor'];
|
|
216
|
+
const randomQuality = qualities[Math.floor(Math.random() * qualities.length)];
|
|
217
|
+
this.emit('qualityChanged', {
|
|
218
|
+
connection: randomQuality,
|
|
219
|
+
latency: Math.random() * 200 + 50, // 50-250ms
|
|
220
|
+
stability: Math.random() * 0.3 + 0.7 // 70-100%
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get current mock status
|
|
225
|
+
*/
|
|
226
|
+
getStatus() {
|
|
227
|
+
return {
|
|
228
|
+
active: this.isActive,
|
|
229
|
+
messageCount: this.messageCount,
|
|
230
|
+
conversation: this.config.conversation || 'customer-support'
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
exports.MockMode = MockMode;
|
|
235
|
+
// Predefined conversation templates
|
|
236
|
+
MockMode.CONVERSATIONS = {
|
|
237
|
+
'customer-support': {
|
|
238
|
+
name: 'Customer Support',
|
|
239
|
+
description: 'Helpful customer support conversation',
|
|
240
|
+
responses: [
|
|
241
|
+
{
|
|
242
|
+
delay: 1000,
|
|
243
|
+
type: 'text',
|
|
244
|
+
content: 'Hello! I\'m your customer support assistant. How can I help you today?'
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
delay: 1500,
|
|
248
|
+
type: 'text',
|
|
249
|
+
content: 'I understand you need assistance. Let me help you with that right away.'
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
delay: 2000,
|
|
253
|
+
type: 'text',
|
|
254
|
+
content: 'Is there anything else I can help you with? I\'m here to make sure you have a great experience.'
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
delay: 1200,
|
|
258
|
+
type: 'text',
|
|
259
|
+
content: 'Thank you for contacting us! Feel free to reach out anytime if you need help.'
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
'sales-assistant': {
|
|
264
|
+
name: 'Sales Assistant',
|
|
265
|
+
description: 'Enthusiastic sales conversation',
|
|
266
|
+
responses: [
|
|
267
|
+
{
|
|
268
|
+
delay: 800,
|
|
269
|
+
type: 'text',
|
|
270
|
+
content: 'Hi there! I\'m excited to show you what Audial can do for your business. What brings you here today?'
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
delay: 1800,
|
|
274
|
+
type: 'text',
|
|
275
|
+
content: 'That\'s fantastic! Our voice and text SDK can really transform how you interact with your customers. Would you like to see a demo?'
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
delay: 2200,
|
|
279
|
+
type: 'text',
|
|
280
|
+
content: 'Perfect! Let me walk you through our key features. We offer voice, text, and hybrid conversations all in one SDK.'
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
delay: 1600,
|
|
284
|
+
type: 'text',
|
|
285
|
+
content: 'Would you like to schedule a call with our team to discuss how this could work for your specific use case?'
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
'text-only': {
|
|
290
|
+
name: 'Text-Only Chat',
|
|
291
|
+
description: 'Pure text conversation without voice',
|
|
292
|
+
responses: [
|
|
293
|
+
{
|
|
294
|
+
delay: 600,
|
|
295
|
+
type: 'text',
|
|
296
|
+
content: 'Welcome to our text-only chat! I can help you with any questions you have.'
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
delay: 1200,
|
|
300
|
+
type: 'text',
|
|
301
|
+
content: 'I noticed you\'re using our text mode - it\'s perfect for quick questions and when you prefer typing over talking.'
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
delay: 1500,
|
|
305
|
+
type: 'text',
|
|
306
|
+
content: 'I can process markdown **formatting**, links, and even emojis! 😊 What would you like to know?'
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
delay: 900,
|
|
310
|
+
type: 'text',
|
|
311
|
+
content: 'Thanks for chatting! Remember, you can switch to voice mode anytime if you prefer speaking.'
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
'voice-demo': {
|
|
316
|
+
name: 'Voice Demonstration',
|
|
317
|
+
description: 'Voice conversation with simulated audio',
|
|
318
|
+
responses: [
|
|
319
|
+
{
|
|
320
|
+
delay: 1000,
|
|
321
|
+
type: 'transcript',
|
|
322
|
+
content: 'Hello! I can hear you clearly. This is a simulated voice conversation.',
|
|
323
|
+
metadata: { confidence: 0.95 }
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
delay: 1500,
|
|
327
|
+
type: 'audio',
|
|
328
|
+
audioUrl: 'data:audio/wav;base64,mock-audio-data',
|
|
329
|
+
content: 'I\'m responding with simulated audio. In a real conversation, you\'d hear my voice here.'
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
delay: 2000,
|
|
333
|
+
type: 'transcript',
|
|
334
|
+
content: 'Voice conversations feel natural and are great for complex discussions.',
|
|
335
|
+
metadata: { confidence: 0.92 }
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
delay: 1200,
|
|
339
|
+
type: 'audio',
|
|
340
|
+
audioUrl: 'data:audio/wav;base64,mock-audio-data-2',
|
|
341
|
+
content: 'Thanks for trying our voice demo! Feel free to speak anytime.'
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
'hybrid-demo': {
|
|
346
|
+
name: 'Hybrid Voice + Text',
|
|
347
|
+
description: 'Demonstration of mixed voice and text',
|
|
348
|
+
responses: [
|
|
349
|
+
{
|
|
350
|
+
delay: 800,
|
|
351
|
+
type: 'text',
|
|
352
|
+
content: 'Hi! I can communicate through both text and voice. Try speaking or typing to me!'
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
delay: 1400,
|
|
356
|
+
type: 'transcript',
|
|
357
|
+
content: 'I heard you speak! Now I\'ll respond with voice...',
|
|
358
|
+
metadata: { confidence: 0.88 }
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
delay: 1800,
|
|
362
|
+
type: 'audio',
|
|
363
|
+
audioUrl: 'data:audio/wav;base64,hybrid-audio',
|
|
364
|
+
content: 'This is my voice response. I can seamlessly switch between text and voice.'
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
delay: 1600,
|
|
368
|
+
type: 'text',
|
|
369
|
+
content: 'And now back to text! This hybrid approach gives users maximum flexibility. 🎯'
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
exports.default = MockMode;
|
|
375
|
+
//# sourceMappingURL=mock-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-mode.js","sourceRoot":"","sources":["../../src/voice/mock-mode.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,sCAA+C;AAsC/C,MAAa,QAAS,SAAQ,2BAAoC;IAuJhE,YAAY,SAAyB,EAAE;QACrC,KAAK,EAAE,CAAC;QAtJF,iBAAY,GAAW,CAAC,CAAC;QACzB,aAAQ,GAAY,KAAK,CAAC;QAC1B,oBAAe,GAA0B,IAAI,CAAC;QAC9C,kBAAa,GAA0B,IAAI,CAAC;QAoJlD,IAAI,CAAC,MAAM,GAAG;YACZ,YAAY,EAAE,kBAAkB;YAChC,qBAAqB,EAAE,IAAI;YAC3B,qBAAqB,EAAE,IAAI;YAC3B,oBAAoB,EAAE,IAAI;YAC1B,KAAK,EAAE,KAAK;YACZ,GAAG,MAAM;SACV,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QAEtB,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACvC,CAAC;QAED,qCAAqC;QACrC,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,OAA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wEAAwE;gBACjF,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;aAC/B;YACD;gBACE,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,uCAAuC;gBACjD,OAAO,EAAE,0FAA0F;aACpG;YACD;gBACE,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,yEAAyE;gBAClF,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;aAC/B;YACD;gBACE,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,yCAAyC;gBACnD,OAAO,EAAE,+DAA+D;aACzE;SACF;KACF;IAED,aAAa,EAAE;QACb,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,uCAAuC;QACpD,SAAS,EAAE;YACT;gBACE,KAAK,EAAE,GAAG;gBACV,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,kFAAkF;aAC5F;YACD;gBACE,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,oDAAoD;gBAC7D,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;aAC/B;YACD;gBACE,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,oCAAoC;gBAC9C,OAAO,EAAE,4EAA4E;aACtF;YACD;gBACE,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,gFAAgF;aAC1F;SACF;KACF;CACF,AA7IoC,CA6InC;AAqQJ,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { ITransport, TransportCallbacks, TransportConnectConfig, TransportType, } from './transport';
|
|
2
|
+
export { WebSocketTransport } from './websocket';
|
|
3
|
+
export { WebRTCTransport } from './webrtc';
|
|
4
|
+
export { VapiTransport } from './vapi';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/voice/transports/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VapiTransport = exports.WebRTCTransport = exports.WebSocketTransport = void 0;
|
|
4
|
+
var websocket_1 = require("./websocket");
|
|
5
|
+
Object.defineProperty(exports, "WebSocketTransport", { enumerable: true, get: function () { return websocket_1.WebSocketTransport; } });
|
|
6
|
+
var webrtc_1 = require("./webrtc");
|
|
7
|
+
Object.defineProperty(exports, "WebRTCTransport", { enumerable: true, get: function () { return webrtc_1.WebRTCTransport; } });
|
|
8
|
+
var vapi_1 = require("./vapi");
|
|
9
|
+
Object.defineProperty(exports, "VapiTransport", { enumerable: true, get: function () { return vapi_1.VapiTransport; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/voice/transports/index.ts"],"names":[],"mappings":";;;AAMA,yCAAiD;AAAxC,+GAAA,kBAAkB,OAAA;AAC3B,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+BAAuC;AAA9B,qGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ITransport — abstraction over voice connection transports.
|
|
3
|
+
*
|
|
4
|
+
* WebSocketTransport: base64-encoded audio over JSON WebSocket (legacy).
|
|
5
|
+
* WebRTCTransport: native browser audio over RTP + data channel (new).
|
|
6
|
+
*
|
|
7
|
+
* Audial.ts delegates all connection and audio I/O to the active transport.
|
|
8
|
+
* The public API (events, methods) stays identical regardless of transport.
|
|
9
|
+
*/
|
|
10
|
+
import type { AssistantOverrides, RoomConnectionState, InboundServerMessage, OutboundClientMessage } from '../types';
|
|
11
|
+
export interface TransportCallbacks {
|
|
12
|
+
/** Voice bot sent 'ready' — connection is live. */
|
|
13
|
+
onReady: () => void;
|
|
14
|
+
/** Inbound message from server (all types except audio for WS). */
|
|
15
|
+
onMessage: (msg: InboundServerMessage) => void;
|
|
16
|
+
/** Connection error. */
|
|
17
|
+
onError: (error: Error) => void;
|
|
18
|
+
/** Connection closed. */
|
|
19
|
+
onClose: (code: number, reason: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface TransportConnectConfig {
|
|
22
|
+
/**
|
|
23
|
+
* Room state from POST /interactions/websocket.
|
|
24
|
+
* Required for WebSocket / WebRTC transports.
|
|
25
|
+
* Optional for provider sessions (VAPI) that supply a join URL directly.
|
|
26
|
+
*/
|
|
27
|
+
roomState?: RoomConnectionState;
|
|
28
|
+
/** Optional assistant overrides for the session */
|
|
29
|
+
overrides?: AssistantOverrides;
|
|
30
|
+
/** Enable verbose logging */
|
|
31
|
+
debug?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Direct join URL for provider sessions (e.g. VAPI Daily.co web-call URL).
|
|
34
|
+
* When present, the transport connects to this URL instead of using roomState.
|
|
35
|
+
* Used by `connectProviderSession()` to bypass room creation entirely.
|
|
36
|
+
*/
|
|
37
|
+
joinUrl?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Provider identifier for the session (e.g. 'vapi').
|
|
40
|
+
* Used by the transport to apply provider-specific connection logic.
|
|
41
|
+
*/
|
|
42
|
+
provider?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ITransport {
|
|
45
|
+
/** Establish the voice connection. Resolves when transport is wired up
|
|
46
|
+
* (not necessarily when 'ready' fires — that comes via onReady callback). */
|
|
47
|
+
connect(config: TransportConnectConfig): Promise<void>;
|
|
48
|
+
/** Tear down the connection. */
|
|
49
|
+
disconnect(code?: number, reason?: string): void;
|
|
50
|
+
/** Send a non-audio message (text, overrides, etc.). */
|
|
51
|
+
sendMessage(message: OutboundClientMessage): void;
|
|
52
|
+
/** Whether the transport has an active connection. */
|
|
53
|
+
isConnected(): boolean;
|
|
54
|
+
/** Mute the microphone. WS: stop AudioRecorder. WebRTC: track.enabled=false. */
|
|
55
|
+
muteMic(): void;
|
|
56
|
+
/** Unmute the microphone. WS: start AudioRecorder. WebRTC: track.enabled=true. */
|
|
57
|
+
unmuteMic(): Promise<void>;
|
|
58
|
+
/** Mute audio output. WS: PCMPlayer.volume(0). WebRTC: audio.muted=true. */
|
|
59
|
+
deafen(): void;
|
|
60
|
+
/** Unmute audio output. WS: PCMPlayer.volume(1). WebRTC: audio.muted=false. */
|
|
61
|
+
undeafen(): void;
|
|
62
|
+
/** Set output volume (0.0–1.0). */
|
|
63
|
+
setVolume(volume: number): void;
|
|
64
|
+
/** Clear buffered audio (on interruption). WS: destroy+recreate player. WebRTC: no-op. */
|
|
65
|
+
clearAudioBuffer(): void;
|
|
66
|
+
/** Full teardown — release all resources (mic, player, connections). */
|
|
67
|
+
destroy(): void;
|
|
68
|
+
}
|
|
69
|
+
export type TransportType = 'websocket' | 'webrtc' | 'vapi' | 'auto';
|
|
70
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/voice/transports/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAIlB,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,OAAO,EAAE,MAAM,IAAI,CAAC;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E,OAAO,IAAI,IAAI,CAAC;CACjB;AAID,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ITransport — abstraction over voice connection transports.
|
|
4
|
+
*
|
|
5
|
+
* WebSocketTransport: base64-encoded audio over JSON WebSocket (legacy).
|
|
6
|
+
* WebRTCTransport: native browser audio over RTP + data channel (new).
|
|
7
|
+
*
|
|
8
|
+
* Audial.ts delegates all connection and audio I/O to the active transport.
|
|
9
|
+
* The public API (events, methods) stays identical regardless of transport.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/voice/transports/transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
|