@spatialwalk/avatarkit 1.0.0-beta.2 โ†’ 1.0.0-beta.20

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +325 -0
  2. package/README.md +499 -194
  3. package/dist/StreamingAudioPlayer-Dv4D0GIN.js +334 -0
  4. package/dist/StreamingAudioPlayer-Dv4D0GIN.js.map +1 -0
  5. package/dist/animation/AnimationWebSocketClient.d.ts +7 -4
  6. package/dist/animation/AnimationWebSocketClient.d.ts.map +1 -1
  7. package/dist/audio/AnimationPlayer.d.ts +12 -0
  8. package/dist/audio/AnimationPlayer.d.ts.map +1 -1
  9. package/dist/audio/StreamingAudioPlayer.d.ts +11 -0
  10. package/dist/audio/StreamingAudioPlayer.d.ts.map +1 -1
  11. package/dist/avatar_core_wasm-BPIbbUx_.js +1664 -0
  12. package/dist/avatar_core_wasm-BPIbbUx_.js.map +1 -0
  13. package/dist/avatar_core_wasm.wasm +0 -0
  14. package/dist/config/app-config.d.ts +3 -7
  15. package/dist/config/app-config.d.ts.map +1 -1
  16. package/dist/config/constants.d.ts +19 -3
  17. package/dist/config/constants.d.ts.map +1 -1
  18. package/dist/config/sdk-config-loader.d.ts.map +1 -1
  19. package/dist/core/Avatar.d.ts +0 -8
  20. package/dist/core/Avatar.d.ts.map +1 -1
  21. package/dist/core/AvatarController.d.ts +112 -65
  22. package/dist/core/AvatarController.d.ts.map +1 -1
  23. package/dist/core/AvatarDownloader.d.ts +1 -20
  24. package/dist/core/AvatarDownloader.d.ts.map +1 -1
  25. package/dist/core/AvatarKit.d.ts +8 -15
  26. package/dist/core/AvatarKit.d.ts.map +1 -1
  27. package/dist/core/AvatarManager.d.ts +1 -4
  28. package/dist/core/AvatarManager.d.ts.map +1 -1
  29. package/dist/core/AvatarView.d.ts +65 -53
  30. package/dist/core/AvatarView.d.ts.map +1 -1
  31. package/dist/core/NetworkLayer.d.ts +8 -0
  32. package/dist/core/NetworkLayer.d.ts.map +1 -0
  33. package/dist/index-Cm5BwNVd.js +6395 -0
  34. package/dist/index-Cm5BwNVd.js.map +1 -0
  35. package/dist/index.d.ts +0 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +14 -15
  38. package/dist/renderer/RenderSystem.d.ts +9 -76
  39. package/dist/renderer/RenderSystem.d.ts.map +1 -1
  40. package/dist/renderer/webgl/reorderData.d.ts.map +1 -1
  41. package/dist/renderer/webgl/webglRenderer.d.ts.map +1 -1
  42. package/dist/types/character.d.ts +0 -11
  43. package/dist/types/character.d.ts.map +1 -1
  44. package/dist/types/index.d.ts +18 -6
  45. package/dist/types/index.d.ts.map +1 -1
  46. package/dist/utils/cls-tracker.d.ts +17 -0
  47. package/dist/utils/cls-tracker.d.ts.map +1 -0
  48. package/dist/utils/{reqId.d.ts โ†’ conversationId.d.ts} +6 -6
  49. package/dist/utils/conversationId.d.ts.map +1 -0
  50. package/dist/utils/logger.d.ts +2 -10
  51. package/dist/utils/logger.d.ts.map +1 -1
  52. package/dist/vanilla/vite.config.d.ts +3 -0
  53. package/dist/vanilla/vite.config.d.ts.map +1 -0
  54. package/dist/wasm/avatarCoreAdapter.d.ts +58 -9
  55. package/dist/wasm/avatarCoreAdapter.d.ts.map +1 -1
  56. package/dist/wasm/avatarCoreMemory.d.ts +5 -1
  57. package/dist/wasm/avatarCoreMemory.d.ts.map +1 -1
  58. package/package.json +10 -4
  59. package/dist/StreamingAudioPlayer-CMEiGwxE.js +0 -288
  60. package/dist/StreamingAudioPlayer-CMEiGwxE.js.map +0 -1
  61. package/dist/avatar_core_wasm-DmkU6dYn.js +0 -1666
  62. package/dist/avatar_core_wasm-DmkU6dYn.js.map +0 -1
  63. package/dist/index-CNhquYUE.js +0 -9712
  64. package/dist/index-CNhquYUE.js.map +0 -1
  65. package/dist/utils/posthog-tracker.d.ts +0 -82
  66. package/dist/utils/posthog-tracker.d.ts.map +0 -1
  67. package/dist/utils/reqId.d.ts.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,325 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0-beta.20] - 2025-01-25
9
+
10
+ ### ๐Ÿ”ง Improvements
11
+ - Removed 1-second audio buffer requirement for auto-starting playback in Host mode
12
+
13
+ ## [1.0.0-beta.19] - 2025-01-25
14
+
15
+ ### ๐Ÿ“š Documentation
16
+ - **Fixed misleading documentation** - Corrected Host mode API documentation to accurately reflect that `yieldAudioData()` can be called directly to start a new session without requiring `playback()` first
17
+ - Removed misleading "after playback() is called" comments
18
+ - Clarified two ways to start a session: using `playback()` for existing data, or `yieldAudioData()` directly for streaming
19
+ - Updated all examples and workflow descriptions to reflect correct API usage
20
+
21
+ ## [1.0.0-beta.18] - 2025-01-25
22
+
23
+ ### ๐Ÿ”ง API Changes
24
+ - **Renamed `reqId` to `conversationId`** - Updated terminology for better clarity
25
+ - All methods and parameters that used `reqId` now use `conversationId`
26
+ - `getCurrentReqId()` โ†’ `getCurrentConversationId()`
27
+ - `generateReqId()` โ†’ `generateConversationId()`
28
+ - Updated all event logs and documentation to use `conversationId`
29
+ - Note: Protobuf protocol still uses `reqId` field name internally, but SDK API uses `conversationId`
30
+
31
+ ### ๐Ÿ“š Documentation
32
+ - Enhanced Host mode documentation to clearly emphasize the workflow: send audio data first to get conversationId, then use that conversationId to send animation data
33
+ - Updated Host Mode Example and Host Mode Flow sections with clearer step-by-step instructions
34
+
35
+ ## [1.0.0-beta.17] - 2025-01-24
36
+
37
+ ### โœจ New Features
38
+ - **Audio-Only Fallback Mechanism** - SDK now includes automatic fallback to audio-only playback when animation data is unavailable
39
+ - SDK mode: Automatically enters audio-only mode when server returns an error
40
+ - Host mode: Automatically enters audio-only mode when empty animation data is provided
41
+ - Once in audio-only mode, subsequent animation data for that session is ignored
42
+ - Fallback mode is interruptible, just like normal playback mode
43
+
44
+ ### ๐Ÿ”ง API Changes
45
+ - **Playback Mode Configuration** - Moved playback mode configuration from `AvatarView` constructor to `AvatarKit.initialize()`
46
+ - Playback mode is now determined by `drivingServiceMode` in `AvatarKit.initialize()` configuration
47
+ - `AvatarView` constructor now only requires `avatar` and `container` parameters
48
+ - Removed `AvatarViewOptions` interface
49
+ - `container` parameter is now required (no longer optional)
50
+ - **Method Renames** - Renamed methods in `AvatarController` for Host mode to better reflect their purpose
51
+ - `play()` โ†’ `playback()`: Renamed to better reflect that the method is used for playback of existing data (replay mode)
52
+ - Old API: `avatarController.play(initialAudioChunks, initialKeyframes)`
53
+ - New API: `avatarController.playback(initialAudioChunks, initialKeyframes)`
54
+ - `sendAudioChunk()` โ†’ `yieldAudioData()`: Renamed to better reflect that the method yields/streams audio data
55
+ - Old API: `avatarController.sendAudioChunk(data, isLast)`
56
+ - New API: `avatarController.yieldAudioData(data, isLast)`
57
+ - `sendKeyframes()` โ†’ `yieldFramesData()`: Renamed to better reflect that the method yields/streams animation keyframes
58
+ - Old API: `avatarController.sendKeyframes(keyframes, reqId)`
59
+ - New API: `avatarController.yieldFramesData(keyframes, conversationId)`
60
+
61
+ ### ๐Ÿ”ง Improvements
62
+ - Extended transition animation duration from 200ms to 400ms for smoother end-of-playback transitions
63
+
64
+ ### ๐Ÿ“š Documentation
65
+ - Updated README.md to use "SDK mode" and "Host mode" terminology instead of "Network mode" and "External data mode"
66
+ - Added fallback mechanism documentation
67
+ - Updated API reference to reflect new constructor signature
68
+
69
+ ## [1.0.0-beta.16] - 2025-11-21
70
+
71
+ ### โœจ New Features
72
+ - **Multi-AvatarView Support** - SDK now supports multiple `AvatarView` instances simultaneously
73
+ - Each `AvatarView` instance can manage its own character independently
74
+ - Multiple characters can be displayed and controlled at the same time
75
+ - Each instance maintains its own rendering context, playback state, and network connection
76
+ - Removed the previous limitation of "only one AvatarView instance at a time"
77
+
78
+ ### ๐Ÿ“š Documentation
79
+ - Updated README.md to reflect multi-character support capabilities
80
+ - Added multi-character usage examples
81
+ - Removed outdated limitation notes about single AvatarView instance
82
+
83
+ ---
84
+
85
+ ## [1.0.0-beta.15] - 2025-01-20
86
+
87
+ ### โœจ New Features
88
+ - Added authentication support for API requests
89
+ - `appId` is now automatically included in HTTP headers (`X-App-Id`) and WebSocket URL query parameters
90
+ - `sessionToken` is now automatically included in HTTP headers (`Authorization: Bearer {token}`) and WebSocket URL query parameters
91
+ - All network requests (character loading, resource downloads, WebSocket connections) now include authentication credentials
92
+
93
+ ### ๐Ÿ”ง Improvements
94
+ - Fixed canvas resize handling for different aspect ratios
95
+ - Projection matrix is now correctly updated when canvas aspect ratio changes
96
+ - Rendering system properly handles portrait (9:16) and landscape (16:9) aspect ratios
97
+ - Canvas automatically adapts to container size changes via ResizeObserver
98
+
99
+ ### ๐Ÿ› Bug Fixes
100
+ - Fixed `RenderSystem.handleResize()` to update projection matrix when canvas size changes
101
+ - Previously only updated aspect ratio, now also updates projection matrix for correct rendering
102
+
103
+ ---
104
+
105
+ ## [1.0.0-beta.14] - 2025-11-18
106
+
107
+ ### โœจ New Features
108
+ - Added pause and resume functionality for avatar playback
109
+ - New `pause()` method to pause audio and animation playback
110
+ - New `resume()` method to resume playback from paused state
111
+ - Added `paused` state to `AvatarState` enum
112
+ - State changes are communicated via `onAvatarState` callback
113
+ - Works in both network mode and external data mode
114
+
115
+ ### ๐Ÿ”ง Improvements
116
+ - Canvas now uses container's full dimensions instead of fixed 1:1 aspect ratio
117
+ - Canvas automatically adapts to container size (width and height)
118
+ - External developers can control canvas aspect ratio by setting container dimensions
119
+ - Rendering system correctly handles any aspect ratio without distortion
120
+
121
+ ---
122
+
123
+ ## [1.0.0-beta.13] - 2025-11-17
124
+
125
+ ### ๐Ÿ”’ API Improvements
126
+ - Reduced console noise by setting default log level to Warning
127
+ - Logger now only outputs warnings and errors by default
128
+ - Set `VITE_DEBUG_LOG=true` to enable all logs
129
+ - Simplified logger configuration using `setGlobalLogLevel(LogLevel.Warning)`
130
+
131
+ ### ๐Ÿ› Bug Fixes
132
+ - Fixed SDK config loader warning in non-debug mode
133
+ - Config loading failures are now silently handled in production
134
+ - Warnings only shown when `VITE_DEBUG_LOG=true`
135
+
136
+ ---
137
+
138
+ ## [1.0.0-beta.12] - 2025-11-17
139
+
140
+ ### ๐Ÿ”’ API Improvements
141
+ - Marked performance monitoring APIs as internal
142
+ - `RenderPerformanceStats` interface and `getPerformanceStats()` method are now marked with `@internal` tag
143
+ - These APIs are not exposed in the public TypeScript definitions
144
+ - Reverted performance monitoring implementation to simpler version (only `renderTime` and `sortTime`)
145
+
146
+ ---
147
+
148
+ ## [1.0.0-beta.11] - 2025-11-17
149
+
150
+ ### ๐Ÿ“š Documentation
151
+ - Updated demo repository link in README.md
152
+ - Changed example project link from `Avatarkit-web-demo` to `AvatarKit-Web-Demo` to match the new repository name
153
+
154
+ ---
155
+
156
+ ## [1.0.0-beta.10] - 2025-11-16
157
+
158
+ ### ๐Ÿ”’ API Improvements
159
+ - Cleaned up public API to hide internal implementation details
160
+ - Marked internal methods with `@internal` JSDoc tag to exclude them from TypeScript declarations
161
+ - Removed unused environment configuration options (`realtimeApiBaseUrl`, `realtimeWsUrl`)
162
+ - Added `appId` getter to `AvatarKit` for accessing initialized app ID
163
+ - Internal methods like `getEnvironmentConfig`, `logEvent`, `getCanvas`, `getCameraConfig`, `updateCameraConfig` are now properly hidden from public API
164
+
165
+ ### ๐Ÿ› Bug Fixes
166
+ - Fixed memory leaks when disposing AvatarView instances
167
+ - Improved resource cleanup to prevent memory leaks when switching or disposing avatar instances
168
+ - Properly clears all callbacks, event listeners, and large data buffers on disposal
169
+
170
+ ---
171
+ ## [1.0.0-beta.9] - 2025-11-15
172
+
173
+ ### ๐Ÿ› Bug Fixes
174
+ - Fixed memory leaks when disposing AvatarView instances
175
+ - Improved resource cleanup to prevent memory leaks when switching or disposing avatar instances
176
+ - Properly clears all callbacks, event listeners, and large data buffers on disposal
177
+
178
+ ---
179
+
180
+ ## [1.0.0-beta.8] - 2025-11-14
181
+
182
+ ### ๐Ÿ› Bug Fixes
183
+ - Fixed audio-animation synchronization issue after normal playback completion
184
+ - Playback state is now properly cleaned up when audio finishes normally, preventing synchronization issues in subsequent conversations
185
+
186
+ ---
187
+
188
+ ## [1.0.0-beta.7] - 2025-11-14
189
+
190
+ ### ๐Ÿ”„ Refactoring
191
+ - Improved rendering state management for better stability and maintainability
192
+
193
+ ### ๐Ÿ› Bug Fixes
194
+ - Fixed interrupt not generating transition animation when interrupting during playback
195
+ - Fixed transition animation being regenerated and reset in external data mode when sending keyframes after playback starts
196
+
197
+ ---
198
+
199
+ ## [1.0.0-beta.6] - 2025-11-14
200
+
201
+ ### ๐Ÿ› Bug Fixes
202
+ - Fixed transition animation being regenerated and reset in external data mode when sending keyframes after playback starts, causing the transition to play twice
203
+
204
+ ---
205
+
206
+ ## [1.0.0-beta.5] - 2025-11-14
207
+
208
+ ### ๐Ÿ› Bug Fixes
209
+ - Fixed missing `AvatarPlaybackMode` enum export in published package
210
+
211
+ ---
212
+
213
+ ## [1.0.0-beta.4] - 2025-11-14
214
+
215
+ ### ๐Ÿ”„ Updates
216
+ - Updated WASM module (avatar_core_wasm.wasm)
217
+
218
+ ---
219
+
220
+ ## [1.0.0-beta.3] - 2025-11-13
221
+
222
+ ### ๐ŸŽ‰ Major Changes
223
+
224
+ #### Architecture Refactoring - Three-Layer Architecture
225
+ - **Rendering Layer (AvatarView)**: Pure rendering responsibility, receives rendering instructions from the playback layer
226
+ - **Playback Layer (AvatarController)**: Unified data controller responsible for audio playback and animation rendering synchronization
227
+ - **Network Layer (NetworkLayer)**: Optional network communication layer, automatically composed only in network mode
228
+
229
+ #### Dual Playback Mode Support
230
+ - **Network Mode**:
231
+ - Send audio data to server via WebSocket
232
+ - Automatically receive and play animation data returned from server
233
+ - Use `controller.start()` and `controller.send()` methods
234
+
235
+ - **External Data Mode**:
236
+ - External components fully control audio and animation data acquisition
237
+ - SDK only responsible for synchronized playback of externally provided data
238
+ - Use `controller.playback()`, `controller.yieldAudioData()` and `controller.yieldFramesData()` methods
239
+
240
+ ### โœจ New Features
241
+
242
+ - **Transition Animation Optimization**:
243
+ - Transition animation duration adjusted to 200ms
244
+ - Improved audio-animation synchronization logic, ensuring audio and animation start playing together after transition animation ends
245
+ - Optimized transition frame generation and alignment logic
246
+
247
+ - **Camera Configuration Enhancement**:
248
+ - Default transparent background, background rendering functionality removed
249
+ - Camera configuration aligned with iOS (Reversed-Z projection, near=0.01, far=100)
250
+ - Support dynamic camera configuration loading from characterSettings and camera.json
251
+
252
+ - **Audio Sample Rate Configuration**:
253
+ - Updated default audio sample rate to 16kHz (previously 24kHz) to match backend requirements
254
+ - Audio format requirement: 16kHz mono PCM16
255
+
256
+ - **Telemetry Migration**:
257
+ - Migrated from PostHog to Tencent Cloud CLS (Cloud Log Service)
258
+ - Support environment-based dynamic configuration (cn/test/us)
259
+ - Support both Token and SecretId/SecretKey authentication methods
260
+ - Aligned with iOS SDK configuration
261
+
262
+ ### ๐Ÿ”ง API Changes
263
+
264
+ #### Breaking Changes
265
+
266
+ - **AvatarView Constructor**:
267
+ ```typescript
268
+ // Old API
269
+ new AvatarView(avatar, container)
270
+
271
+ // New API
272
+ new AvatarView(avatar, {
273
+ container: container,
274
+ playbackMode: AvatarPlaybackMode.network // or AvatarPlaybackMode.external
275
+ })
276
+ ```
277
+
278
+ - **AvatarController Methods**:
279
+ - Network Mode: `start()` / `close()` / `send()`
280
+ - External Data Mode: `play()` / `sendAudioChunk()` / `sendKeyframes()`
281
+ - Common Methods: `interrupt()` / `clear()` / `dispose()`
282
+
283
+ - **Removed Properties**:
284
+ - `realtimeStartTime` property removed (no longer needed)
285
+
286
+ ### ๐Ÿ› Bug Fixes
287
+
288
+ - Fixed audio-animation desynchronization during transition animation
289
+ - Fixed animation freezing issue in external data mode
290
+ - Fixed audio playback speed abnormality caused by sample rate mismatch
291
+ - Fixed camera configuration priority logic
292
+ - Fixed WebSocket connection state callback timing issues
293
+
294
+ ### ๐Ÿ“š Documentation
295
+
296
+ - Updated README.md with detailed explanation of three-layer architecture and two playback modes
297
+ - Added audio format requirements documentation (16kHz mono PCM16)
298
+ - Updated API reference documentation and code examples
299
+ - Added architecture diagrams and flowcharts
300
+
301
+ ### ๐Ÿงช Testing
302
+
303
+ - Updated unit tests to cover new architecture
304
+ - Added unit tests for external data mode
305
+ - Updated E2E tests to use new API
306
+ - All tests passing (69 unit tests + 24 E2E tests)
307
+
308
+ ### ๐Ÿ”„ Internal Changes
309
+
310
+ - Refactored `AvatarController` into unified playback layer
311
+ - Extracted `NetworkLayer` as independent component
312
+ - Optimized animation playback loop and audio-animation synchronization logic
313
+ - Updated WASM module (avatar_core_wasm.wasm)
314
+ - Improved error handling and logging
315
+
316
+ ### ๐Ÿ“ฆ Dependencies
317
+
318
+ - No new dependencies added
319
+ - Maintained existing dependency versions
320
+
321
+ ---
322
+
323
+ ## [1.0.0-beta.2] - Previous Version
324
+
325
+ (Previous version changelog entries...)