@aether-stack-dev/client-sdk 1.0.0 → 1.1.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 +105 -220
- package/dist/AStackCSRClient.d.ts +26 -9
- package/dist/AnalyticsCollector.d.ts +1 -2
- package/dist/BillingMonitor.d.ts +5 -4
- package/dist/ConnectionStateManager.d.ts +4 -3
- package/dist/{WebRTCManager.d.ts → MediaManager.d.ts} +1 -6
- package/dist/PerformanceMonitor.d.ts +2 -3
- package/dist/SecurityLogger.d.ts +1 -5
- package/dist/SupabaseSignalingClient.d.ts +0 -1
- package/dist/UsageTracker.d.ts +0 -1
- package/dist/__tests__/setup.d.ts +12 -2
- package/dist/audio/AudioPlayer.d.ts +1 -1
- package/dist/audio/index.d.ts +0 -1
- package/dist/avatar/TalkingHeadAvatar.d.ts +0 -1
- package/dist/avatar/VRMAvatar.d.ts +0 -1
- package/dist/avatar/constants.d.ts +0 -1
- package/dist/avatar/index.d.ts +0 -1
- package/dist/core.d.ts +2 -7
- package/dist/index.d.ts +3 -15
- package/dist/index.esm.js +283 -1868
- package/dist/index.js +283 -1871
- package/dist/react/index.d.ts +0 -3
- package/dist/react/useAStackCSR.d.ts +0 -1
- package/dist/react.esm.js +263 -2088
- package/dist/react.js +261 -2087
- package/dist/types.d.ts +20 -19
- package/package.json +10 -10
- package/dist/AStackCSRClient.d.ts.map +0 -1
- package/dist/AStackClient.d.ts +0 -90
- package/dist/AStackClient.d.ts.map +0 -1
- package/dist/AStackEventSetup.d.ts +0 -35
- package/dist/AStackEventSetup.d.ts.map +0 -1
- package/dist/AStackMediaController.d.ts +0 -34
- package/dist/AStackMediaController.d.ts.map +0 -1
- package/dist/AnalyticsCollector.d.ts.map +0 -1
- package/dist/BillingMonitor.d.ts.map +0 -1
- package/dist/ConnectionStateManager.d.ts.map +0 -1
- package/dist/PerformanceMonitor.d.ts.map +0 -1
- package/dist/SecurityLogger.d.ts.map +0 -1
- package/dist/SessionManager.d.ts.map +0 -1
- package/dist/SupabaseSignalingClient.d.ts.map +0 -1
- package/dist/UsageTracker.d.ts.map +0 -1
- package/dist/WebRTCManager.d.ts.map +0 -1
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/audio/AudioPlayer.d.ts.map +0 -1
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/avatar/TalkingHeadAvatar.d.ts.map +0 -1
- package/dist/avatar/VRMAvatar.d.ts.map +0 -1
- package/dist/avatar/constants.d.ts.map +0 -1
- package/dist/avatar/index.d.ts.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/useAStack.d.ts +0 -34
- package/dist/react/useAStack.d.ts.map +0 -1
- package/dist/react/useAStackCSR.d.ts.map +0 -1
- package/dist/react.esm.js.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AStack Team
|
|
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
CHANGED
|
@@ -1,257 +1,142 @@
|
|
|
1
1
|
# AStack Client SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🎥 **Real-time WebRTC** - Low-latency audio/video communication
|
|
8
|
-
- 🤖 **AI Conversations** - Text, voice, and video input support
|
|
9
|
-
- ⚡ **<1s Latency** - Optimized for real-time interactions
|
|
10
|
-
- 🔒 **Secure Sessions** - Token-based authentication
|
|
11
|
-
- 📊 **Usage Tracking** - Built-in metrics and analytics
|
|
12
|
-
- ⚛️ **React Support** - Hooks for easy React integration
|
|
13
|
-
- 🔄 **Auto-Reconnect** - Resilient connection handling
|
|
14
|
-
- 📱 **Cross-Platform** - Works in all modern browsers
|
|
3
|
+
Browser SDK for AStack real-time conversational AI — voice input, AI voice + avatar animation output over WebSocket.
|
|
15
4
|
|
|
16
5
|
## Installation
|
|
17
6
|
|
|
18
7
|
```bash
|
|
19
|
-
npm install @
|
|
8
|
+
npm install @aether-stack-dev/client-sdk
|
|
20
9
|
```
|
|
21
10
|
|
|
22
11
|
## Quick Start
|
|
23
12
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import { AStackClient } from '@astack/client-sdk';
|
|
13
|
+
```typescript
|
|
14
|
+
import { AStackCSRClient } from '@aether-stack-dev/client-sdk';
|
|
28
15
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
sessionToken:
|
|
32
|
-
userId: 'user-id'
|
|
16
|
+
const client = new AStackCSRClient({
|
|
17
|
+
workerUrl: 'wss://your-worker-url',
|
|
18
|
+
sessionToken: sessionToken, // from your backend via developer-sdk
|
|
33
19
|
});
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
client.on('message', (message) => {
|
|
37
|
-
console.log('AI response:', message.text);
|
|
38
|
-
});
|
|
21
|
+
await client.connect();
|
|
39
22
|
|
|
40
|
-
client.on('
|
|
41
|
-
|
|
23
|
+
client.on('transcript', (text) => console.log('User said:', text));
|
|
24
|
+
client.on('response', (text) => console.log('AI:', text));
|
|
25
|
+
client.on('blendshapeUpdate', (bs) => {
|
|
26
|
+
// 52 ARKit blendshape values for avatar animation
|
|
42
27
|
});
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
await client.connect();
|
|
29
|
+
await client.startCall();
|
|
46
30
|
|
|
47
|
-
//
|
|
48
|
-
|
|
31
|
+
// When done
|
|
32
|
+
client.stopCall();
|
|
33
|
+
client.disconnect();
|
|
34
|
+
```
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
await client.sendAudio(audioBlob);
|
|
36
|
+
## Constructor
|
|
52
37
|
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
```typescript
|
|
39
|
+
new AStackCSRClient(config: AStackCSRConfig)
|
|
55
40
|
```
|
|
56
41
|
|
|
57
|
-
|
|
42
|
+
| Option | Type | Default | Description |
|
|
43
|
+
|--------|------|---------|-------------|
|
|
44
|
+
| `workerUrl` | `string` | **required** | WebSocket URL of the worker container |
|
|
45
|
+
| `sessionToken` | `string` | `''` | Auth token from developer SDK (required) |
|
|
46
|
+
| `sampleRate` | `number` | `24000` | Audio playback sample rate |
|
|
47
|
+
| `fps` | `number` | `30` | Blendshape animation frame rate |
|
|
48
|
+
| `enableImageCapture` | `boolean` | `true` | Capture webcam frames for vision |
|
|
49
|
+
| `imageCaptureInterval` | `number` | `5000` | Image capture interval (ms) |
|
|
50
|
+
| `autoReconnect` | `boolean` | `true` | Auto-reconnect on disconnect |
|
|
51
|
+
| `maxRetries` | `number` | `5` | Max reconnection attempts |
|
|
52
|
+
| `reconnectDelay` | `number` | `1000` | Base delay between reconnects (ms) |
|
|
53
|
+
| `audioProcessorUrl` | `string` | `'/audio-processor.js'` | Path to AudioWorklet processor |
|
|
54
|
+
| `debug` | `boolean` | `false` | Enable debug logging |
|
|
55
|
+
|
|
56
|
+
## Methods
|
|
57
|
+
|
|
58
|
+
| Method | Description |
|
|
59
|
+
|--------|-------------|
|
|
60
|
+
| `connect(): Promise<void>` | Connect to the worker via WebSocket and authenticate |
|
|
61
|
+
| `startCall(): Promise<void>` | Start microphone capture and begin the conversation |
|
|
62
|
+
| `stopCall(): void` | Stop the call and release media resources |
|
|
63
|
+
| `sendText(message: string): void` | Send a text message during a call |
|
|
64
|
+
| `disconnect(): void` | Close WebSocket connection |
|
|
65
|
+
| `destroy(): Promise<void>` | Disconnect, clean up audio player, remove all listeners |
|
|
66
|
+
| `isConnected(): boolean` | Check if WebSocket is open |
|
|
67
|
+
| `getCallStatus(): CallStatus` | Get current call status (`idle` \| `starting` \| `active` \| `stopping` \| `error`) |
|
|
68
|
+
| `getCurrentBlendshapes(): number[]` | Get the latest 52 blendshape values |
|
|
69
|
+
|
|
70
|
+
## Events
|
|
71
|
+
|
|
72
|
+
| Event | Payload | Description |
|
|
73
|
+
|-------|---------|-------------|
|
|
74
|
+
| `connected` | — | WebSocket connected and authenticated |
|
|
75
|
+
| `disconnected` | — | WebSocket closed |
|
|
76
|
+
| `reconnecting` | `attempt: number` | Attempting reconnection |
|
|
77
|
+
| `reconnected` | — | Successfully reconnected |
|
|
78
|
+
| `error` | `Error` | Connection or call error |
|
|
79
|
+
| `callStarted` | — | Call is active, mic streaming |
|
|
80
|
+
| `callStopped` | — | Call ended |
|
|
81
|
+
| `interim` | `text: string` | Interim ASR transcript |
|
|
82
|
+
| `transcript` | `text: string` | Final ASR transcript |
|
|
83
|
+
| `response` | `text: string` | AI response text (streamed) |
|
|
84
|
+
| `responseComplete` | — | AI response fully delivered |
|
|
85
|
+
| `speechStarted` | — | User started speaking |
|
|
86
|
+
| `utteranceEnd` | — | End of user utterance detected |
|
|
87
|
+
| `asrError` | `message: string` | ASR processing error |
|
|
88
|
+
| `blendshapeUpdate` | `number[]` | 52 ARKit blendshape values |
|
|
89
|
+
| `playbackStarted` | — | Audio playback started |
|
|
90
|
+
| `playbackEnded` | — | Audio playback ended |
|
|
91
|
+
| `modelStatus` | `{ model_loaded?: boolean; blendshape_count?: number }` | Worker model status |
|
|
92
|
+
|
|
93
|
+
## React Hook
|
|
58
94
|
|
|
59
|
-
```
|
|
60
|
-
import {
|
|
95
|
+
```typescript
|
|
96
|
+
import { useAStackCSR } from '@aether-stack-dev/client-sdk/react';
|
|
61
97
|
|
|
62
|
-
function
|
|
98
|
+
function CallUI() {
|
|
63
99
|
const {
|
|
64
|
-
isConnected,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
startRecording,
|
|
70
|
-
stopRecording
|
|
71
|
-
} = useAStack({
|
|
72
|
-
sessionToken: 'your-session-token',
|
|
73
|
-
userId: 'user-id'
|
|
100
|
+
isConnected, callStatus, transcript, response,
|
|
101
|
+
blendshapes, error, connect, startCall, stopCall, sendText
|
|
102
|
+
} = useAStackCSR({
|
|
103
|
+
workerUrl: 'wss://your-worker-url',
|
|
104
|
+
sessionToken: sessionToken,
|
|
74
105
|
});
|
|
75
106
|
|
|
76
107
|
return (
|
|
77
108
|
<div>
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<button onClick={() => sendMessage('Hello!')}>
|
|
85
|
-
Send Message
|
|
109
|
+
<p>Status: {callStatus}</p>
|
|
110
|
+
<p>Transcript: {transcript}</p>
|
|
111
|
+
<p>Response: {response}</p>
|
|
112
|
+
<button onClick={() => connect().then(() => startCall())}>
|
|
113
|
+
Start Call
|
|
86
114
|
</button>
|
|
115
|
+
<button onClick={stopCall}>Stop Call</button>
|
|
87
116
|
</div>
|
|
88
117
|
);
|
|
89
118
|
}
|
|
90
119
|
```
|
|
91
120
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#### Methods
|
|
112
|
-
|
|
113
|
-
- `connect()` - Establish WebRTC connection
|
|
114
|
-
- `disconnect()` - Close connection and cleanup
|
|
115
|
-
- `sendMessage(text: string)` - Send text message
|
|
116
|
-
- `sendAudio(audio: Blob | ArrayBuffer)` - Send audio data
|
|
117
|
-
- `sendVideo(video: Blob)` - Send video frame
|
|
118
|
-
- `setAudioEnabled(enabled: boolean)` - Toggle audio input
|
|
119
|
-
- `setVideoEnabled(enabled: boolean)` - Toggle video input
|
|
120
|
-
|
|
121
|
-
#### Events
|
|
122
|
-
|
|
123
|
-
- `connected` - Connection established
|
|
124
|
-
- `disconnected` - Connection closed
|
|
125
|
-
- `error` - Error occurred
|
|
126
|
-
- `message` - Text response received
|
|
127
|
-
- `audio` - Audio response received
|
|
128
|
-
- `video` - Video response received
|
|
129
|
-
- `usage` - Usage metrics update
|
|
130
|
-
|
|
131
|
-
### React Hook
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
const {
|
|
135
|
-
// State
|
|
136
|
-
isConnected,
|
|
137
|
-
isLoading,
|
|
138
|
-
error,
|
|
139
|
-
messages,
|
|
140
|
-
usage,
|
|
141
|
-
|
|
142
|
-
// Methods
|
|
143
|
-
connect,
|
|
144
|
-
disconnect,
|
|
145
|
-
sendMessage,
|
|
146
|
-
sendAudio,
|
|
147
|
-
sendVideo,
|
|
148
|
-
startRecording,
|
|
149
|
-
stopRecording,
|
|
150
|
-
|
|
151
|
-
// Media controls
|
|
152
|
-
setAudioEnabled,
|
|
153
|
-
setVideoEnabled
|
|
154
|
-
} = useAStack(config);
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Advanced Usage
|
|
158
|
-
|
|
159
|
-
### Custom Audio Processing
|
|
160
|
-
|
|
161
|
-
```javascript
|
|
162
|
-
// Configure audio constraints
|
|
163
|
-
const client = new AStackClient({
|
|
164
|
-
sessionToken: 'token',
|
|
165
|
-
userId: 'user',
|
|
166
|
-
mediaConstraints: {
|
|
167
|
-
audio: {
|
|
168
|
-
echoCancellation: true,
|
|
169
|
-
noiseSuppression: true,
|
|
170
|
-
sampleRate: 48000
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Process audio before sending
|
|
176
|
-
client.on('audioInput', (audioData) => {
|
|
177
|
-
const processed = processAudio(audioData);
|
|
178
|
-
client.sendAudio(processed);
|
|
179
|
-
});
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Usage Monitoring
|
|
183
|
-
|
|
184
|
-
```javascript
|
|
185
|
-
// Monitor usage in real-time
|
|
186
|
-
client.on('usage', (metrics) => {
|
|
187
|
-
console.log('Characters:', metrics.characterCount);
|
|
188
|
-
console.log('Audio minutes:', metrics.audioMinutes);
|
|
189
|
-
console.log('Session duration:', metrics.sessionDuration);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// Get cumulative usage
|
|
193
|
-
const totalUsage = client.getUsage();
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Error Handling
|
|
197
|
-
|
|
198
|
-
```javascript
|
|
199
|
-
client.on('error', (error) => {
|
|
200
|
-
switch (error.code) {
|
|
201
|
-
case 'CONNECTION_FAILED':
|
|
202
|
-
// Handle connection errors
|
|
203
|
-
break;
|
|
204
|
-
case 'QUOTA_EXCEEDED':
|
|
205
|
-
// Handle usage limits
|
|
206
|
-
break;
|
|
207
|
-
case 'AUTHENTICATION_FAILED':
|
|
208
|
-
// Handle auth errors
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Browser Support
|
|
215
|
-
|
|
216
|
-
- Chrome/Edge 88+
|
|
217
|
-
- Firefox 78+
|
|
218
|
-
- Safari 14+
|
|
219
|
-
- Mobile browsers with WebRTC support
|
|
220
|
-
|
|
221
|
-
## Development
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
# Install dependencies
|
|
225
|
-
npm install
|
|
226
|
-
|
|
227
|
-
# Run tests
|
|
228
|
-
npm test
|
|
229
|
-
|
|
230
|
-
# Build SDK
|
|
231
|
-
npm run build
|
|
232
|
-
|
|
233
|
-
# Development mode with watch
|
|
234
|
-
npm run dev
|
|
235
|
-
|
|
236
|
-
# Type checking
|
|
237
|
-
npm run typecheck
|
|
238
|
-
|
|
239
|
-
# Linting
|
|
240
|
-
npm run lint
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## Examples
|
|
244
|
-
|
|
245
|
-
See the `examples/` directory for complete working examples:
|
|
246
|
-
- `basic-usage.html` - Vanilla JavaScript implementation
|
|
247
|
-
- `react-example.tsx` - React component with full UI
|
|
121
|
+
The hook returns:
|
|
122
|
+
|
|
123
|
+
| Field | Type | Description |
|
|
124
|
+
|-------|------|-------------|
|
|
125
|
+
| `client` | `AStackCSRClient \| null` | Underlying client instance |
|
|
126
|
+
| `isConnected` | `boolean` | WebSocket connection state |
|
|
127
|
+
| `callStatus` | `CallStatus` | `idle` \| `starting` \| `active` \| `stopping` \| `error` |
|
|
128
|
+
| `blendshapes` | `number[]` | Current blendshape values |
|
|
129
|
+
| `transcript` | `string` | Latest user transcript |
|
|
130
|
+
| `response` | `string` | Latest AI response |
|
|
131
|
+
| `error` | `Error \| null` | Latest error |
|
|
132
|
+
| `connect` | `() => Promise<void>` | Connect to worker |
|
|
133
|
+
| `disconnect` | `() => void` | Disconnect |
|
|
134
|
+
| `startCall` | `() => Promise<void>` | Start call |
|
|
135
|
+
| `stopCall` | `() => void` | Stop call |
|
|
136
|
+
| `sendText` | `(message: string) => void` | Send text input |
|
|
137
|
+
|
|
138
|
+
Pass `autoConnect: true` in options to connect automatically on mount.
|
|
248
139
|
|
|
249
140
|
## License
|
|
250
141
|
|
|
251
|
-
MIT
|
|
252
|
-
|
|
253
|
-
## Support
|
|
254
|
-
|
|
255
|
-
- [Documentation](https://docs.astack.ai)
|
|
256
|
-
- [GitHub Issues](https://github.com/aether-stack/astack-mono/issues)
|
|
257
|
-
- [Discord Community](https://discord.gg/astack)
|
|
142
|
+
MIT
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import { CallOptions } from './types';
|
|
2
3
|
export interface AStackCSRConfig {
|
|
3
4
|
workerUrl: string;
|
|
4
5
|
sessionToken?: string;
|
|
5
|
-
sessionId?: string;
|
|
6
6
|
sampleRate?: number;
|
|
7
|
-
providers?: {
|
|
8
|
-
asr?: 'deepinfra' | 'self';
|
|
9
|
-
llm?: 'deepinfra' | 'self';
|
|
10
|
-
tts?: 'deepinfra' | 'self';
|
|
11
|
-
};
|
|
12
7
|
fps?: number;
|
|
13
8
|
enableImageCapture?: boolean;
|
|
14
9
|
imageCaptureInterval?: number;
|
|
10
|
+
autoReconnect?: boolean;
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
reconnectDelay?: number;
|
|
13
|
+
audioProcessorUrl?: string;
|
|
14
|
+
debug?: boolean;
|
|
15
15
|
}
|
|
16
16
|
export interface AStackCSREvents {
|
|
17
17
|
connected: () => void;
|
|
18
18
|
disconnected: () => void;
|
|
19
|
+
reconnecting: (attempt: number) => void;
|
|
20
|
+
reconnected: () => void;
|
|
19
21
|
error: (error: Error) => void;
|
|
20
22
|
callStarted: () => void;
|
|
21
23
|
callStopped: () => void;
|
|
24
|
+
interim: (text: string) => void;
|
|
22
25
|
transcript: (text: string) => void;
|
|
23
26
|
response: (text: string) => void;
|
|
27
|
+
responseComplete: () => void;
|
|
28
|
+
speechStarted: () => void;
|
|
29
|
+
utteranceEnd: () => void;
|
|
30
|
+
asrError: (message: string) => void;
|
|
24
31
|
blendshapeUpdate: (blendshapes: number[]) => void;
|
|
25
32
|
playbackStarted: () => void;
|
|
26
33
|
playbackEnded: () => void;
|
|
@@ -42,19 +49,29 @@ export declare class AStackCSRClient extends EventEmitter<AStackCSREvents> {
|
|
|
42
49
|
private imageCaptureInterval;
|
|
43
50
|
private callStatus;
|
|
44
51
|
private currentBlendshapes;
|
|
52
|
+
private reconnectAttempts;
|
|
53
|
+
private reconnectTimer;
|
|
54
|
+
private intentionalClose;
|
|
55
|
+
private hasConnected;
|
|
56
|
+
private clientId;
|
|
57
|
+
private pendingAuth;
|
|
45
58
|
constructor(config: AStackCSRConfig);
|
|
46
59
|
private setupAudioPlayerEvents;
|
|
47
60
|
connect(): Promise<void>;
|
|
61
|
+
private connectInternal;
|
|
62
|
+
private sendAuthentication;
|
|
63
|
+
private attemptReconnect;
|
|
48
64
|
private handleMessage;
|
|
49
|
-
startCall(): Promise<void>;
|
|
65
|
+
startCall(options?: CallOptions): Promise<void>;
|
|
50
66
|
private startImageCapture;
|
|
51
67
|
private captureAndSendImage;
|
|
52
68
|
stopCall(): void;
|
|
53
69
|
sendText(message: string): void;
|
|
54
|
-
disconnect(): void
|
|
70
|
+
disconnect(): Promise<void>;
|
|
71
|
+
private waitForFlush;
|
|
55
72
|
getCallStatus(): CallStatus;
|
|
56
73
|
getCurrentBlendshapes(): number[];
|
|
57
74
|
isConnected(): boolean;
|
|
75
|
+
getReconnectAttempts(): number;
|
|
58
76
|
destroy(): Promise<void>;
|
|
59
77
|
}
|
|
60
|
-
//# sourceMappingURL=AStackCSRClient.d.ts.map
|
|
@@ -36,7 +36,7 @@ export interface AnalyticsCollectorConfig {
|
|
|
36
36
|
flushInterval?: number;
|
|
37
37
|
batchSize?: number;
|
|
38
38
|
apiEndpoint: string;
|
|
39
|
-
|
|
39
|
+
sessionToken: string;
|
|
40
40
|
sessionId?: string;
|
|
41
41
|
userId?: string;
|
|
42
42
|
organizationId?: string;
|
|
@@ -60,4 +60,3 @@ export declare class AnalyticsCollector extends EventEmitter {
|
|
|
60
60
|
private sendSessionAnalytics;
|
|
61
61
|
destroy(): void;
|
|
62
62
|
}
|
|
63
|
-
//# sourceMappingURL=AnalyticsCollector.d.ts.map
|
package/dist/BillingMonitor.d.ts
CHANGED
|
@@ -4,23 +4,25 @@ export interface BillingUpdateCallback {
|
|
|
4
4
|
}
|
|
5
5
|
export interface BillingAlertCallback {
|
|
6
6
|
(alert: {
|
|
7
|
-
type: 'low_balance' | 'limit_exceeded';
|
|
7
|
+
type: 'low_balance' | 'limit_exceeded' | 'billing_unavailable';
|
|
8
8
|
details: any;
|
|
9
9
|
}): void;
|
|
10
10
|
}
|
|
11
11
|
export declare class BillingMonitor {
|
|
12
12
|
private apiEndpoint;
|
|
13
|
-
private
|
|
13
|
+
private sessionToken;
|
|
14
14
|
private billingInfo?;
|
|
15
15
|
private updateCallbacks;
|
|
16
16
|
private alertCallbacks;
|
|
17
17
|
private checkInterval?;
|
|
18
|
+
private consecutiveFailures;
|
|
18
19
|
private warningThresholds;
|
|
19
|
-
constructor(apiEndpoint: string,
|
|
20
|
+
constructor(apiEndpoint: string, sessionToken: string);
|
|
20
21
|
fetchBillingInfo(): Promise<BillingInfo>;
|
|
21
22
|
private updateBillingInfo;
|
|
22
23
|
private checkForAlerts;
|
|
23
24
|
private triggerAlert;
|
|
25
|
+
private handleFetchFailure;
|
|
24
26
|
startMonitoring(intervalMs?: number): void;
|
|
25
27
|
stopMonitoring(): void;
|
|
26
28
|
onUpdate(callback: BillingUpdateCallback): void;
|
|
@@ -32,4 +34,3 @@ export declare class BillingMonitor {
|
|
|
32
34
|
checkRateLimit(): Promise<boolean>;
|
|
33
35
|
destroy(): void;
|
|
34
36
|
}
|
|
35
|
-
//# sourceMappingURL=BillingMonitor.d.ts.map
|
|
@@ -2,9 +2,11 @@ import { EventEmitter } from 'eventemitter3';
|
|
|
2
2
|
export interface ConnectionState {
|
|
3
3
|
signaling: 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
4
4
|
websocket: 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
|
|
5
|
+
workerWs: 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
5
6
|
overall: 'disconnected' | 'connecting' | 'connected' | 'degraded' | 'error';
|
|
6
7
|
lastActivity: Date;
|
|
7
8
|
reconnectAttempts: number;
|
|
9
|
+
workerReconnectAttempts: number;
|
|
8
10
|
errors: Error[];
|
|
9
11
|
}
|
|
10
12
|
export interface ConnectionQuality {
|
|
@@ -21,10 +23,10 @@ export declare class ConnectionStateManager extends EventEmitter {
|
|
|
21
23
|
private stateHistory;
|
|
22
24
|
private maxHistorySize;
|
|
23
25
|
constructor();
|
|
26
|
+
updateWorkerWsState(state: ConnectionState['workerWs']): void;
|
|
24
27
|
updateSignalingState(state: ConnectionState['signaling']): void;
|
|
25
28
|
updateWebSocketState(state: ConnectionState['websocket']): void;
|
|
26
|
-
|
|
27
|
-
updateICEState(state: string): void;
|
|
29
|
+
updateWebSocketStateCompat(state: string): void;
|
|
28
30
|
private updateOverallState;
|
|
29
31
|
addError(error: Error): void;
|
|
30
32
|
clearErrors(): void;
|
|
@@ -45,4 +47,3 @@ export declare class ConnectionStateManager extends EventEmitter {
|
|
|
45
47
|
reset(): void;
|
|
46
48
|
destroy(): void;
|
|
47
49
|
}
|
|
48
|
-
//# sourceMappingURL=ConnectionStateManager.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { AStackConfig, MediaStreamInfo } from './types';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class MediaManager extends EventEmitter {
|
|
4
4
|
private config;
|
|
5
5
|
private localStream;
|
|
6
6
|
constructor(config: AStackConfig);
|
|
@@ -17,10 +17,5 @@ export declare class WebRTCManager extends EventEmitter {
|
|
|
17
17
|
unmuteAudio(): void;
|
|
18
18
|
muteVideo(): void;
|
|
19
19
|
unmuteVideo(): void;
|
|
20
|
-
createOffer(): Promise<RTCSessionDescriptionInit>;
|
|
21
|
-
createAnswer(remoteSdp: string): Promise<RTCSessionDescriptionInit>;
|
|
22
|
-
handleAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
|
|
23
|
-
addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
|
|
24
20
|
close(): Promise<void>;
|
|
25
21
|
}
|
|
26
|
-
//# sourceMappingURL=WebRTCManager.d.ts.map
|
|
@@ -19,16 +19,15 @@ export declare class PerformanceMonitor extends EventEmitter {
|
|
|
19
19
|
private initializeMetrics;
|
|
20
20
|
startCollection(sessionId?: string): void;
|
|
21
21
|
stopCollection(): void;
|
|
22
|
-
recordLatency(type: 'signaling' | 'websocket' | 'audio' | '
|
|
22
|
+
recordLatency(type: 'signaling' | 'websocket' | 'audio' | 'video', latency: number): void;
|
|
23
23
|
updateThroughput(type: 'audio' | 'video' | 'data', direction: 'inbound' | 'outbound', bytesPerSecond: number): void;
|
|
24
24
|
updateQuality(quality: Partial<PerformanceMetrics['quality']>): void;
|
|
25
25
|
updateResources(resources: Partial<PerformanceMetrics['resources']>): void;
|
|
26
26
|
recordBenchmark(benchmark: Omit<PerformanceBenchmark, 'timestamp'>): void;
|
|
27
27
|
getMetrics(): PerformanceMetrics;
|
|
28
28
|
getBenchmarks(): PerformanceBenchmark[];
|
|
29
|
-
getLatencyStats(type?: 'signaling' | 'websocket' | 'audio' | '
|
|
29
|
+
getLatencyStats(type?: 'signaling' | 'websocket' | 'audio' | 'video'): any;
|
|
30
30
|
reportMetrics(): Promise<void>;
|
|
31
31
|
private collectMetrics;
|
|
32
32
|
destroy(): void;
|
|
33
33
|
}
|
|
34
|
-
//# sourceMappingURL=PerformanceMonitor.d.ts.map
|
package/dist/SecurityLogger.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SecurityEvent } from './types';
|
|
2
2
|
export interface SecurityLoggerConfig {
|
|
3
3
|
apiEndpoint: string;
|
|
4
|
-
|
|
4
|
+
sessionToken: string;
|
|
5
5
|
sessionId?: string;
|
|
6
6
|
organizationId?: string;
|
|
7
|
-
enableLocalLogging?: boolean;
|
|
8
7
|
batchSize?: number;
|
|
9
8
|
flushInterval?: number;
|
|
10
9
|
}
|
|
@@ -20,11 +19,8 @@ export declare class SecurityLogger {
|
|
|
20
19
|
logInvalidRequest(reason: string, request?: any): void;
|
|
21
20
|
logSessionHijackAttempt(details: Record<string, any>): void;
|
|
22
21
|
private sanitizeRequest;
|
|
23
|
-
private logToConsole;
|
|
24
|
-
private getConsoleLogLevel;
|
|
25
22
|
flush(): Promise<void>;
|
|
26
23
|
private startAutoFlush;
|
|
27
24
|
private stopAutoFlush;
|
|
28
25
|
destroy(): Promise<void>;
|
|
29
26
|
}
|
|
30
|
-
//# sourceMappingURL=SecurityLogger.d.ts.map
|
package/dist/UsageTracker.d.ts
CHANGED
|
@@ -15,7 +15,15 @@ declare class MockMediaStream {
|
|
|
15
15
|
active: boolean;
|
|
16
16
|
audioTracks: any[];
|
|
17
17
|
videoTracks: any[];
|
|
18
|
-
|
|
18
|
+
getTracks: jest.Mock;
|
|
19
|
+
getAudioTracks: jest.Mock;
|
|
20
|
+
getVideoTracks: jest.Mock;
|
|
21
|
+
addTrack: jest.Mock;
|
|
22
|
+
removeTrack: jest.Mock;
|
|
23
|
+
clone: jest.Mock;
|
|
24
|
+
addEventListener: jest.Mock;
|
|
25
|
+
removeEventListener: jest.Mock;
|
|
26
|
+
constructor(constraints?: any);
|
|
19
27
|
}
|
|
20
28
|
declare const mockMediaStreamTrack: {
|
|
21
29
|
kind: string;
|
|
@@ -29,4 +37,6 @@ declare const mockMediaStreamTrack: {
|
|
|
29
37
|
addEventListener: jest.Mock<any, any, any>;
|
|
30
38
|
removeEventListener: jest.Mock<any, any, any>;
|
|
31
39
|
};
|
|
32
|
-
|
|
40
|
+
declare const MockMediaRecorder: any;
|
|
41
|
+
declare const MockWebSocket: any;
|
|
42
|
+
declare const MockFileReader: any;
|
|
@@ -14,6 +14,7 @@ export declare class AudioPlayer extends EventEmitter<AudioPlayerEvents> {
|
|
|
14
14
|
private audioContext;
|
|
15
15
|
private audioQueue;
|
|
16
16
|
private isPlaying;
|
|
17
|
+
private animationFrameId;
|
|
17
18
|
private sampleRate;
|
|
18
19
|
constructor(sampleRate?: number);
|
|
19
20
|
private ensureAudioContext;
|
|
@@ -24,4 +25,3 @@ export declare class AudioPlayer extends EventEmitter<AudioPlayerEvents> {
|
|
|
24
25
|
private playChunk;
|
|
25
26
|
destroy(): Promise<void>;
|
|
26
27
|
}
|
|
27
|
-
//# sourceMappingURL=AudioPlayer.d.ts.map
|
package/dist/audio/index.d.ts
CHANGED
|
@@ -6,4 +6,3 @@ export interface TalkingHeadAvatarProps {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function TalkingHeadAvatar({ blendshapes, width, height, avatarUrl }: TalkingHeadAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default TalkingHeadAvatar;
|
|
9
|
-
//# sourceMappingURL=TalkingHeadAvatar.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const ARKIT_BLENDSHAPES: readonly ["jawOpen", "jawForward", "jawLeft", "jawRight", "mouthClose", "mouthFunnel", "mouthPucker", "mouthLeft", "mouthRight", "mouthSmileLeft", "mouthSmileRight", "mouthFrownLeft", "mouthFrownRight", "mouthDimpleLeft", "mouthDimpleRight", "mouthStretchLeft", "mouthStretchRight", "mouthRollLower", "mouthRollUpper", "mouthShrugLower", "mouthShrugUpper", "mouthPressLeft", "mouthPressRight", "mouthLowerDownLeft", "mouthLowerDownRight", "mouthUpperUpLeft", "mouthUpperUpRight", "tongueOut", "cheekPuff", "cheekSquintLeft", "cheekSquintRight", "noseSneerLeft", "noseSneerRight", "eyeBlinkLeft", "eyeBlinkRight", "eyeLookDownLeft", "eyeLookDownRight", "eyeLookInLeft", "eyeLookInRight", "eyeLookOutLeft", "eyeLookOutRight", "eyeLookUpLeft", "eyeLookUpRight", "eyeSquintLeft", "eyeSquintRight", "eyeWideLeft", "eyeWideRight", "browDownLeft", "browDownRight", "browInnerUp", "browOuterUpLeft", "browOuterUpRight"];
|
|
2
2
|
export type ARKitBlendshapeName = typeof ARKIT_BLENDSHAPES[number];
|
|
3
3
|
export declare const BLENDSHAPE_COUNT = 52;
|
|
4
|
-
//# sourceMappingURL=constants.d.ts.map
|