@spatialwalk/avatarkit 1.0.0-beta.69 → 1.0.0-beta.70
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/CHANGELOG.md +6 -0
- package/dist/{StreamingAudioPlayer-DiIRp5nx.js → StreamingAudioPlayer-Bi2685bX.js} +1 -1
- package/dist/config/app-config.d.ts +3 -3
- package/dist/config/sdk-config-loader.d.ts +4 -13
- package/dist/core/Avatar.d.ts +0 -8
- package/dist/core/AvatarController.d.ts +0 -82
- package/dist/core/AvatarManager.d.ts +0 -8
- package/dist/core/AvatarSDK.d.ts +0 -13
- package/dist/core/AvatarView.d.ts +0 -141
- package/dist/{index-BT9yxWW8.js → index-CvW_c7G-.js} +273 -196
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/renderer/covariance.d.ts +3 -10
- package/dist/renderer/sortSplats.d.ts +3 -9
- package/dist/renderer/webgl/reorderData.d.ts +4 -10
- package/dist/types/character.d.ts +3 -3
- package/dist/types/index.d.ts +0 -8
- package/dist/utils/animation-interpolation.d.ts +4 -34
- package/dist/utils/client-id.d.ts +2 -2
- package/dist/utils/conversationId.d.ts +6 -15
- package/dist/utils/id-manager.d.ts +3 -33
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/posthog-tracker.d.ts +6 -31
- package/dist/utils/pwa-cache-manager.d.ts +0 -35
- package/dist/utils/usage-tracker.d.ts +3 -17
- package/dist/wasm/avatarCoreAdapter.d.ts +4 -175
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.0-beta.70] - 2026-01-17
|
|
9
|
+
|
|
10
|
+
### 🔧 Improvements
|
|
11
|
+
- **Code Cleanup** - Removed unused `FlatSplatData` interface from public API
|
|
12
|
+
- **Internal Documentation** - Translated all internal code comments to English for consistency
|
|
13
|
+
|
|
8
14
|
## [1.0.0-beta.69] - 2026-01-17
|
|
9
15
|
|
|
10
16
|
### 🔧 Improvements
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-
|
|
4
|
+
import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-CvW_c7G-.js";
|
|
5
5
|
class StreamingAudioPlayer {
|
|
6
6
|
// 标记是否正在恢复 AudioContext,避免并发恢复请求
|
|
7
7
|
constructor(options) {
|
|
@@ -3,9 +3,9 @@ export declare const APP_CONFIG: {
|
|
|
3
3
|
readonly debug: boolean;
|
|
4
4
|
rendering: {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* - 'balance':
|
|
8
|
-
* - 'quality':
|
|
6
|
+
* Sort mode
|
|
7
|
+
* - 'balance': Performance first, sort first frame then reuse (default)
|
|
8
|
+
* - 'quality': Quality first, re-sort every frame
|
|
9
9
|
*/
|
|
10
10
|
sortMode: "balance" | "quality";
|
|
11
11
|
};
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { Environment } from '../types';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* SDK configuration loader
|
|
3
|
+
* Fetch SDK endpoint configuration from remote config API
|
|
4
|
+
* @internal
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
-
/**
|
|
7
|
-
* 从远程配置接口获取 SDK 配置
|
|
8
|
-
* @param version SDK 版本号
|
|
9
|
-
* @returns 解析后的配置映射
|
|
10
|
-
*/
|
|
11
|
-
export declare function fetchSdkConfig(version: string): Promise<Partial<Record<Environment, string>>>;
|
|
12
|
-
/**
|
|
13
|
-
* 清除配置缓存(用于测试或重新加载)
|
|
14
|
-
*/
|
|
15
|
-
export declare function clearSdkConfigCache(): void;
|
|
6
|
+
export {};
|
package/dist/core/Avatar.d.ts
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import { CharacterMeta } from '../types';
|
|
2
|
-
import { PreloadResult } from './AvatarDownloader';
|
|
3
2
|
export declare class Avatar {
|
|
4
3
|
readonly id: string;
|
|
5
4
|
private characterMeta;
|
|
6
5
|
private resources;
|
|
7
|
-
/**
|
|
8
|
-
* 构造函数(内部使用)
|
|
9
|
-
* @param id 数字人 ID
|
|
10
|
-
* @param characterMeta 角色元数据
|
|
11
|
-
* @param resources 资源数据
|
|
12
|
-
*/
|
|
13
|
-
constructor(id: string, characterMeta: CharacterMeta, resources: PreloadResult);
|
|
14
6
|
/**
|
|
15
7
|
* Get character metadata
|
|
16
8
|
* @returns Character metadata, including all configuration information (version, resource URLs, camera config, etc.)
|
|
@@ -63,11 +63,6 @@ export declare class AvatarController {
|
|
|
63
63
|
* })
|
|
64
64
|
*/
|
|
65
65
|
initializeAudioContext(): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Check if audio context is initialized
|
|
68
|
-
* @throws AvatarError if audio context is not initialized
|
|
69
|
-
*/
|
|
70
|
-
private checkAudioContextInitialized;
|
|
71
66
|
/**
|
|
72
67
|
* Start service (SDK mode only)
|
|
73
68
|
*/
|
|
@@ -130,26 +125,6 @@ export declare class AvatarController {
|
|
|
130
125
|
* Clear all data and resources
|
|
131
126
|
*/
|
|
132
127
|
clear(): void;
|
|
133
|
-
/**
|
|
134
|
-
* Generate new conversation ID and log conversation started event
|
|
135
|
-
* @private
|
|
136
|
-
*/
|
|
137
|
-
private generateAndLogNewConversationId;
|
|
138
|
-
/**
|
|
139
|
-
* Clear playback data (keyframes, audio chunks, and playback state)
|
|
140
|
-
* @private
|
|
141
|
-
*/
|
|
142
|
-
private clearPlaybackData;
|
|
143
|
-
/**
|
|
144
|
-
* Reset conversation ID state (for both network and external modes)
|
|
145
|
-
* @private
|
|
146
|
-
*/
|
|
147
|
-
private resetConversationIdState;
|
|
148
|
-
/**
|
|
149
|
-
* Get effective conversation ID (handles both SDK and host modes)
|
|
150
|
-
* @private
|
|
151
|
-
*/
|
|
152
|
-
private getEffectiveConversationId;
|
|
153
128
|
/**
|
|
154
129
|
* Get point cloud count of the current avatar
|
|
155
130
|
* @returns Point cloud count, or null if avatar is not loaded
|
|
@@ -161,16 +136,6 @@ export declare class AvatarController {
|
|
|
161
136
|
* @param config Post-processing configuration, or null to clear
|
|
162
137
|
*/
|
|
163
138
|
setPostProcessingConfig(config: PostProcessingConfig | null): void;
|
|
164
|
-
/**
|
|
165
|
-
* 设置完整的 eye tracking 配置到 C++
|
|
166
|
-
* @private
|
|
167
|
-
*/
|
|
168
|
-
private setEyeTrackingConfig;
|
|
169
|
-
/**
|
|
170
|
-
* 重新渲染当前帧(用于暂停状态下更新后处理参数)
|
|
171
|
-
* @private
|
|
172
|
-
*/
|
|
173
|
-
private rerenderCurrentFrame;
|
|
174
139
|
/**
|
|
175
140
|
* Set audio playback volume
|
|
176
141
|
* Note: This only controls the avatar audio player volume, not the system volume
|
|
@@ -182,33 +147,6 @@ export declare class AvatarController {
|
|
|
182
147
|
* @returns Current volume value (0.0 - 1.0)
|
|
183
148
|
*/
|
|
184
149
|
getVolume(): number;
|
|
185
|
-
/**
|
|
186
|
-
* Start streaming playback (internal implementation)
|
|
187
|
-
*/
|
|
188
|
-
private startStreamingPlaybackInternal;
|
|
189
|
-
private startPlaybackLoop;
|
|
190
|
-
/**
|
|
191
|
-
* Stop playback loop
|
|
192
|
-
*/
|
|
193
|
-
private stopPlaybackLoop;
|
|
194
|
-
/**
|
|
195
|
-
* 启用音频独立播放模式(当服务器错误或超时时调用)
|
|
196
|
-
* 此模式下,音频会独立播放,不依赖动画数据
|
|
197
|
-
* 一旦启用,本次会话后续的动画数据将被忽略
|
|
198
|
-
* @private
|
|
199
|
-
*/
|
|
200
|
-
private enableAudioOnlyMode;
|
|
201
|
-
/**
|
|
202
|
-
* 音频独立播放(完全独立的逻辑,不影响正常播放流程)
|
|
203
|
-
* @private
|
|
204
|
-
*/
|
|
205
|
-
private startAudioOnlyPlayback;
|
|
206
|
-
/**
|
|
207
|
-
* 音频监控循环(仅用于音频独立模式)
|
|
208
|
-
* 只检测音频是否结束,不进行动画渲染
|
|
209
|
-
* @private
|
|
210
|
-
*/
|
|
211
|
-
private startAudioMonitoringLoop;
|
|
212
150
|
/**
|
|
213
151
|
* Stop playback
|
|
214
152
|
*/
|
|
@@ -217,28 +155,8 @@ export declare class AvatarController {
|
|
|
217
155
|
* Clean up players
|
|
218
156
|
*/
|
|
219
157
|
protected cleanupPlayers(): void;
|
|
220
|
-
/**
|
|
221
|
-
* Add audio chunk to buffer
|
|
222
|
-
* Note: animationPlayer should already be initialized before calling this method
|
|
223
|
-
*/
|
|
224
|
-
private addAudioChunkToBuffer;
|
|
225
|
-
/**
|
|
226
|
-
* Event system
|
|
227
|
-
*/
|
|
228
|
-
private registerEventListener;
|
|
229
158
|
/**
|
|
230
159
|
* Emit event
|
|
231
160
|
*/
|
|
232
161
|
protected emit(event: string, data?: any): void;
|
|
233
|
-
/**
|
|
234
|
-
* Apply post-processing parameters to animation parameters
|
|
235
|
-
* @private
|
|
236
|
-
*/
|
|
237
|
-
private applyPostProcessingToParams;
|
|
238
|
-
/**
|
|
239
|
-
* 上报 driving_service_latency 事件(Host 模式)
|
|
240
|
-
* 每轮会话只上报一次(在收到首帧时)
|
|
241
|
-
* @private
|
|
242
|
-
*/
|
|
243
|
-
private reportDrivingServiceLatency;
|
|
244
162
|
}
|
|
@@ -18,14 +18,6 @@ export declare class AvatarManager {
|
|
|
18
18
|
* @returns Promise<Avatar>
|
|
19
19
|
*/
|
|
20
20
|
load(id: string, onProgress?: (progress: LoadProgressInfo) => void): Promise<Avatar>;
|
|
21
|
-
/**
|
|
22
|
-
* 处理下载队列(确保串行执行)
|
|
23
|
-
*/
|
|
24
|
-
private processDownloadQueue;
|
|
25
|
-
/**
|
|
26
|
-
* 执行实际的加载逻辑(私有方法)
|
|
27
|
-
*/
|
|
28
|
-
private doLoad;
|
|
29
21
|
/**
|
|
30
22
|
* Get cached avatar
|
|
31
23
|
* @param id Avatar ID
|
package/dist/core/AvatarSDK.d.ts
CHANGED
|
@@ -11,15 +11,6 @@ export declare class AvatarSDK {
|
|
|
11
11
|
* @param configuration Configuration parameters
|
|
12
12
|
*/
|
|
13
13
|
static initialize(appId: string, configuration: Configuration): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* 初始化WASM模块(跟随整个SDK生命周期)
|
|
16
|
-
*/
|
|
17
|
-
private static initializeWASMModule;
|
|
18
|
-
/**
|
|
19
|
-
* 初始化模板资源(在SDK初始化时加载)
|
|
20
|
-
* 从全局 CDN 加载模板资源,失败时直接抛出错误,阻止SDK初始化
|
|
21
|
-
*/
|
|
22
|
-
private static initializeTemplateResources;
|
|
23
14
|
/**
|
|
24
15
|
* Set sessionToken
|
|
25
16
|
* Developer Client -> Developer Server -> AvatarKit Server -> return sessionToken (max 1 hour validity)
|
|
@@ -41,8 +32,4 @@ export declare class AvatarSDK {
|
|
|
41
32
|
* Cleanup resources
|
|
42
33
|
*/
|
|
43
34
|
static cleanup(): void;
|
|
44
|
-
/**
|
|
45
|
-
* 从远程配置接口获取SDK配置(已简化,逻辑移到 config/sdk-config-loader.ts)
|
|
46
|
-
*/
|
|
47
|
-
private static _fetchSdkConfig;
|
|
48
35
|
}
|
|
@@ -32,22 +32,6 @@ export declare class AvatarView {
|
|
|
32
32
|
private isPureRenderingMode;
|
|
33
33
|
private avatarActiveTimer;
|
|
34
34
|
private readonly AVATAR_ACTIVE_INTERVAL;
|
|
35
|
-
/**
|
|
36
|
-
* 对齐两端 Flame 维度:标量统一长度,expression 取最大长度并零填充
|
|
37
|
-
*/
|
|
38
|
-
private alignFlamePair;
|
|
39
|
-
/**
|
|
40
|
-
* 生成并对齐过渡帧,确保首尾帧与起止帧完全一致
|
|
41
|
-
* @param from 起始帧
|
|
42
|
-
* @param to 目标帧
|
|
43
|
-
* @param durationMs 过渡时长(开头或结尾)
|
|
44
|
-
* @param useLinearInterpolation 是否使用线性插值(旧实现),true 用于 idle->speaking,false 用于 speaking->idle(使用 Bezier 曲线)
|
|
45
|
-
*/
|
|
46
|
-
private generateAndAlignTransitionFrames;
|
|
47
|
-
/**
|
|
48
|
-
* 获取缓存的 Idle 首帧,如果未缓存则获取并缓存
|
|
49
|
-
*/
|
|
50
|
-
private getCachedIdleFirstFrame;
|
|
51
35
|
/**
|
|
52
36
|
* Constructor
|
|
53
37
|
* Creates a unified AvatarController, internally composes network layer based on configuration
|
|
@@ -59,105 +43,6 @@ export declare class AvatarView {
|
|
|
59
43
|
* Get controller (public interface)
|
|
60
44
|
*/
|
|
61
45
|
get controller(): AvatarController;
|
|
62
|
-
/**
|
|
63
|
-
* 创建canvas元素
|
|
64
|
-
*/
|
|
65
|
-
private createCanvas;
|
|
66
|
-
/**
|
|
67
|
-
* 初始化视图系统
|
|
68
|
-
*/
|
|
69
|
-
private initializeView;
|
|
70
|
-
/**
|
|
71
|
-
* 初始化渲染系统
|
|
72
|
-
*/
|
|
73
|
-
private initializeRenderSystem;
|
|
74
|
-
/**
|
|
75
|
-
* 获取默认相机配置
|
|
76
|
-
*/
|
|
77
|
-
private getDefaultCameraConfig;
|
|
78
|
-
/**
|
|
79
|
-
* 根据资源解析最终的相机配置,优先使用角色设置,其次 camera.json
|
|
80
|
-
*/
|
|
81
|
-
private resolveCameraConfig;
|
|
82
|
-
/**
|
|
83
|
-
* 从角色设置中推导相机配置
|
|
84
|
-
*/
|
|
85
|
-
private deriveCameraConfigFromSettings;
|
|
86
|
-
/**
|
|
87
|
-
* 渲染第一帧
|
|
88
|
-
*/
|
|
89
|
-
private renderFirstFrame;
|
|
90
|
-
/**
|
|
91
|
-
* 更新 FPS 统计(在 requestAnimationFrame 回调中调用)
|
|
92
|
-
*/
|
|
93
|
-
private updateFPS;
|
|
94
|
-
/**
|
|
95
|
-
* 初始化 FPS 计算
|
|
96
|
-
*/
|
|
97
|
-
private initFPS;
|
|
98
|
-
/**
|
|
99
|
-
* 开始idle动画循环
|
|
100
|
-
*/
|
|
101
|
-
private startIdleAnimationLoop;
|
|
102
|
-
/**
|
|
103
|
-
* 开始实时对话动画循环
|
|
104
|
-
*/
|
|
105
|
-
private startRealtimeAnimationLoop;
|
|
106
|
-
/**
|
|
107
|
-
* 停止idle动画循环
|
|
108
|
-
*/
|
|
109
|
-
private stopIdleAnimationLoop;
|
|
110
|
-
/**
|
|
111
|
-
* 停止实时对话动画循环
|
|
112
|
-
*/
|
|
113
|
-
private stopRealtimeAnimationLoop;
|
|
114
|
-
/**
|
|
115
|
-
* 停止所有动画循环
|
|
116
|
-
*/
|
|
117
|
-
private stopAllAnimationLoops;
|
|
118
|
-
/**
|
|
119
|
-
* 渲染实时帧(由播放层回调调用)
|
|
120
|
-
*/
|
|
121
|
-
private renderRealtimeFrame;
|
|
122
|
-
/**
|
|
123
|
-
* 状态转换方法
|
|
124
|
-
* 统一管理状态转换,确保状态一致性
|
|
125
|
-
*/
|
|
126
|
-
private setState;
|
|
127
|
-
/**
|
|
128
|
-
* 检查是否在实时播放状态(Speaking 或过渡到 Speaking)
|
|
129
|
-
*/
|
|
130
|
-
private get isRealtimePlaying();
|
|
131
|
-
/**
|
|
132
|
-
* 检查是否在过渡中
|
|
133
|
-
*/
|
|
134
|
-
private get isTransitioning();
|
|
135
|
-
/**
|
|
136
|
-
* 检查过渡结束后是否回到 Idle
|
|
137
|
-
*/
|
|
138
|
-
private get endToIdleAfterTransition();
|
|
139
|
-
/**
|
|
140
|
-
* 处理打断
|
|
141
|
-
* 打断时应该生成过渡动画,而不是直接跳回 Idle
|
|
142
|
-
*/
|
|
143
|
-
private handleInterrupt;
|
|
144
|
-
/**
|
|
145
|
-
* 设置 AvatarController 事件监听器
|
|
146
|
-
*/
|
|
147
|
-
private setupControllerEventListeners;
|
|
148
|
-
/**
|
|
149
|
-
* 准备实时渲染(生成过渡到 Speaking)
|
|
150
|
-
* 统一逻辑:从当前正在播放的帧 -> Speaking 第一帧
|
|
151
|
-
*/
|
|
152
|
-
private prepareRealtimeRendering;
|
|
153
|
-
/**
|
|
154
|
-
* 开始实时渲染循环
|
|
155
|
-
*/
|
|
156
|
-
private startRealtimeRendering;
|
|
157
|
-
/**
|
|
158
|
-
* 停止实时对话渲染
|
|
159
|
-
*/
|
|
160
|
-
private stopRealtimeRendering;
|
|
161
46
|
/**
|
|
162
47
|
* Cleanup view resources
|
|
163
48
|
* Closes avatarController and cleans up all related resources
|
|
@@ -178,17 +63,6 @@ export declare class AvatarView {
|
|
|
178
63
|
* @returns Transition frame array with length of frameCount
|
|
179
64
|
*/
|
|
180
65
|
generateTransitionFromIdle(toKeyframeData: KeyframeData, frameCount: number, transitionType?: 'start' | 'end'): Promise<KeyframeData[]>;
|
|
181
|
-
/**
|
|
182
|
-
* 使用新的相机配置重新渲染当前帧(用于暂停状态下更新相机)
|
|
183
|
-
* 复用 AvatarController 的重新渲染逻辑,因为 renderCallback 会调用 renderRealtimeFrame,
|
|
184
|
-
* 而 renderRealtimeFrame 会使用已更新的相机配置(通过 renderSystem.updateCamera)
|
|
185
|
-
* @private
|
|
186
|
-
*/
|
|
187
|
-
private rerenderCurrentFrameWithNewCamera;
|
|
188
|
-
/**
|
|
189
|
-
* 处理尺寸变化:通知渲染系统更新视口与投影
|
|
190
|
-
*/
|
|
191
|
-
private handleResize;
|
|
192
66
|
/**
|
|
193
67
|
* Get or set avatar transform in canvas
|
|
194
68
|
*
|
|
@@ -209,19 +83,4 @@ export declare class AvatarView {
|
|
|
209
83
|
y: number;
|
|
210
84
|
scale: number;
|
|
211
85
|
});
|
|
212
|
-
/**
|
|
213
|
-
* 上报 avatar_active 埋点
|
|
214
|
-
* @private
|
|
215
|
-
*/
|
|
216
|
-
private reportAvatarActive;
|
|
217
|
-
/**
|
|
218
|
-
* 启动 avatar_active 心跳埋点(每10分钟一次)
|
|
219
|
-
* @private
|
|
220
|
-
*/
|
|
221
|
-
private startAvatarActiveHeartbeat;
|
|
222
|
-
/**
|
|
223
|
-
* 停止 avatar_active 心跳埋点
|
|
224
|
-
* @private
|
|
225
|
-
*/
|
|
226
|
-
private stopAvatarActiveHeartbeat;
|
|
227
86
|
}
|