@aether-stack-dev/client-sdk 1.2.4 → 1.3.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 +152 -0
- package/dist/avatar/VRMAvatar.d.ts +36 -2
- package/dist/avatar/compatibility.d.ts +12 -0
- package/dist/avatar/constants.d.ts +3 -0
- package/dist/avatar/environment.d.ts +6 -0
- package/dist/avatar/index.d.ts +2 -2
- package/dist/avatar/postProcessing.d.ts +20 -0
- package/dist/index.esm.js +3 -0
- package/dist/index.js +3 -0
- package/dist/react/index.d.ts +3 -2
- package/dist/react/useAStackCSR.d.ts +9 -0
- package/dist/react.esm.js +3975 -166
- package/dist/react.js +3973 -164
- package/package.json +3 -2
- package/dist/AnalyticsCollector.d.ts +0 -62
- package/dist/BillingMonitor.d.ts +0 -36
- package/dist/ConnectionStateManager.d.ts +0 -49
- package/dist/MediaManager.d.ts +0 -21
- package/dist/PerformanceMonitor.d.ts +0 -33
- package/dist/SecurityLogger.d.ts +0 -26
- package/dist/SessionManager.d.ts +0 -20
- package/dist/UsageTracker.d.ts +0 -21
package/README.md
CHANGED
|
@@ -137,6 +137,158 @@ The hook returns:
|
|
|
137
137
|
|
|
138
138
|
Pass `autoConnect: true` in options to connect automatically on mount.
|
|
139
139
|
|
|
140
|
+
The hook also accepts a `character` config for custom avatars (see below).
|
|
141
|
+
|
|
142
|
+
## Custom Characters
|
|
143
|
+
|
|
144
|
+
AStack supports custom VRM characters. Any VRM model with ARKit blendshapes will animate with the server's Audio2Face output.
|
|
145
|
+
|
|
146
|
+
### VRMAvatar Props
|
|
147
|
+
|
|
148
|
+
| Prop | Type | Default | Description |
|
|
149
|
+
|------|------|---------|-------------|
|
|
150
|
+
| `blendshapes` | `number[]` | **required** | 52 ARKit blendshape values |
|
|
151
|
+
| `modelUrl` | `string` | Supabase-hosted VRM | URL of the VRM model |
|
|
152
|
+
| `blendshapeMap` | `Record<string, string>` | — | Custom blendshape name mapping (ARKit → model) |
|
|
153
|
+
| `expressionOverrides` | `Record<string, number>` | — | Manual VRM expression values (0–1) |
|
|
154
|
+
| `onModelLoad` | `(report: ModelCompatibilityReport) => void` | — | Callback with compatibility report after load |
|
|
155
|
+
| `maxModelSize` | `number` | `31457280` (30MB) | Max model file size in bytes (0 to disable) |
|
|
156
|
+
| `width` | `number` | `400` | Canvas width |
|
|
157
|
+
| `height` | `number` | `400` | Canvas height |
|
|
158
|
+
| `backgroundColor` | `number \| null` | `0xffffff` | Background color, or null for transparent |
|
|
159
|
+
| `cameraPosition` | `[number, number, number]` | `[0, 1.4, 1.2]` | Camera position in world space |
|
|
160
|
+
| `cameraTarget` | `[number, number, number]` | `[0, 1.3, 0]` | Camera look-at target |
|
|
161
|
+
| `cameraFov` | `number` | `30` | Camera field of view (degrees) |
|
|
162
|
+
| `lightIntensity` | `number` | `1` | Multiplier for all scene lights |
|
|
163
|
+
| `idleAnimationUrl` | `string` | — | URL of a .vrma animation clip for idle loop |
|
|
164
|
+
| `postProcessing` | `PostProcessingConfig` | — | Post-processing effects (bloom, ao, dof) |
|
|
165
|
+
| `environmentUrl` | `string` | — | URL of an .hdr environment map |
|
|
166
|
+
| `environmentIntensity` | `number` | `1` | HDRI lighting intensity |
|
|
167
|
+
| `environmentBlur` | `number` | `0` | HDRI background blur |
|
|
168
|
+
| `environmentZoom` | `number` | `1` | HDRI background zoom level |
|
|
169
|
+
| `onEnvironmentLoad` | `() => void` | — | Callback when HDRI environment finishes loading |
|
|
170
|
+
| `animationSpeed` | `number` | `1` | Playback speed multiplier for idle animation clip |
|
|
171
|
+
| `animationWeight` | `number` | `1` | Blend weight for idle animation clip (0–1) |
|
|
172
|
+
| `animationCrossfade` | `number` | `0.5` | Crossfade duration (seconds) when switching animations |
|
|
173
|
+
| `orbitAngle` | `number` | — | Camera azimuth angle (radians) for orbit control |
|
|
174
|
+
| `orbitElevation` | `number` | — | Camera elevation angle (radians) for orbit control |
|
|
175
|
+
| `avatarRotation` | `number` | — | Avatar Y-axis rotation (radians) |
|
|
176
|
+
| `onOrbitChange` | `(angle: number, elevation: number) => void` | — | Callback when camera orbit changes |
|
|
177
|
+
| `features` | `VRMAvatarFeatures` | — | Feature toggles (see below) |
|
|
178
|
+
|
|
179
|
+
### VRMAvatarFeatures
|
|
180
|
+
|
|
181
|
+
Control which built-in behaviors are active:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
interface VRMAvatarFeatures {
|
|
185
|
+
idleAnimation?: boolean; // Subtle breathing/swaying (default: true)
|
|
186
|
+
microExpressions?: boolean; // Random blinks, smiles, brow raises (default: true)
|
|
187
|
+
springBones?: boolean; // Hair/clothing physics simulation (default: true)
|
|
188
|
+
postProcessing?: PostProcessingConfig;
|
|
189
|
+
expressionPresets?: boolean; // VRM expression preset support (default: true)
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Custom Model URL
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
<VRMAvatar blendshapes={blendshapes} modelUrl="https://cdn.example.com/my-character.vrm" />
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Blendshape Mapping
|
|
200
|
+
|
|
201
|
+
For models with non-standard blendshape names, provide a mapping from ARKit names to your model's names:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { VROID_BLENDSHAPE_MAP } from '@aether-stack-dev/client-sdk';
|
|
205
|
+
|
|
206
|
+
// Use the built-in VRoid Studio preset
|
|
207
|
+
<VRMAvatar blendshapes={blendshapes} blendshapeMap={VROID_BLENDSHAPE_MAP} />
|
|
208
|
+
|
|
209
|
+
// Or provide a custom mapping
|
|
210
|
+
<VRMAvatar blendshapes={blendshapes} blendshapeMap={{ jawOpen: 'mouth_open', eyeBlinkLeft: 'blink_L' }} />
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Advanced Rendering
|
|
214
|
+
|
|
215
|
+
VRMAvatar supports expression presets, animation clips, HDRI environments, post-processing (bloom, ambient occlusion, depth of field), and camera control. See the [Rendering Features documentation](https://astack.dev/docs/characters/rendering) for full details and examples.
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
<VRMAvatar
|
|
219
|
+
blendshapes={blendshapes}
|
|
220
|
+
expressionOverrides={{ happy: 0.5 }}
|
|
221
|
+
idleAnimationUrl="https://cdn.example.com/idle.vrma"
|
|
222
|
+
environmentUrl="https://cdn.example.com/studio.hdr"
|
|
223
|
+
postProcessing={{ bloom: 0.3, ao: 0.5, dof: true }}
|
|
224
|
+
/>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Compatibility Report
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
<VRMAvatar
|
|
231
|
+
blendshapes={blendshapes}
|
|
232
|
+
modelUrl="/custom.vrm"
|
|
233
|
+
onModelLoad={(report) => {
|
|
234
|
+
console.log(`${report.supported}/52 blendshapes supported`);
|
|
235
|
+
console.log('Missing:', report.missing);
|
|
236
|
+
console.log('Warnings:', report.warnings);
|
|
237
|
+
console.log('Stats:', report.modelStats);
|
|
238
|
+
}}
|
|
239
|
+
/>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Hook Character Config
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
const { blendshapes, characterConfig } = useAStackCSR({
|
|
246
|
+
workerUrl, sessionToken,
|
|
247
|
+
character: {
|
|
248
|
+
modelUrl: 'https://cdn.example.com/my-character.vrm',
|
|
249
|
+
blendshapeMap: VROID_BLENDSHAPE_MAP,
|
|
250
|
+
onModelLoad: (report) => console.log(report),
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// Spread characterConfig directly on VRMAvatar
|
|
255
|
+
<VRMAvatar blendshapes={blendshapes} {...characterConfig} />
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
See the [full character documentation](https://astack.dev/docs/characters) for VRM requirements, ecosystem links, and integration guides.
|
|
259
|
+
|
|
260
|
+
## Exports
|
|
261
|
+
|
|
262
|
+
### Types
|
|
263
|
+
|
|
264
|
+
| Export | Description |
|
|
265
|
+
|--------|-------------|
|
|
266
|
+
| `AStackCSRConfig` | Constructor config interface |
|
|
267
|
+
| `AStackCSREvents` | Event name/payload map |
|
|
268
|
+
| `CallStatus` | `'idle' \| 'starting' \| 'active' \| 'stopping' \| 'error'` |
|
|
269
|
+
| `VRMAvatarProps` | VRMAvatar component props (react subpath) |
|
|
270
|
+
| `VRMAvatarFeatures` | Feature toggle interface (react subpath) |
|
|
271
|
+
| `ModelCompatibilityReport` | Model load report (react subpath) |
|
|
272
|
+
| `PostProcessingConfig` | Post-processing config (react subpath) |
|
|
273
|
+
| `ARKitBlendshapeName` | Union of 52 ARKit blendshape name strings |
|
|
274
|
+
| `AudioChunk` | Audio player chunk interface |
|
|
275
|
+
| `AudioPlayerEvents` | Audio player event map |
|
|
276
|
+
| `CharacterConfig` | Character config from useAStackCSR (react subpath) |
|
|
277
|
+
| `UseAStackCSROptions` | Hook options (react subpath) |
|
|
278
|
+
| `UseAStackCSRReturn` | Hook return type (react subpath) |
|
|
279
|
+
| `AStackError` | Error class with error code |
|
|
280
|
+
| `ErrorCodes` | Error code constants |
|
|
281
|
+
|
|
282
|
+
### Constants
|
|
283
|
+
|
|
284
|
+
| Export | Description |
|
|
285
|
+
|--------|-------------|
|
|
286
|
+
| `ARKIT_BLENDSHAPES` | Array of 52 ARKit blendshape name strings |
|
|
287
|
+
| `BLENDSHAPE_COUNT` | `52` |
|
|
288
|
+
| `CRITICAL_BLENDSHAPES` | `['jawOpen', 'eyeBlinkLeft', 'eyeBlinkRight']` |
|
|
289
|
+
| `DEFAULT_BLENDSHAPE_MAP` | Identity map (ARKit name → same name) |
|
|
290
|
+
| `VROID_BLENDSHAPE_MAP` | VRoid Studio naming preset (react subpath) |
|
|
291
|
+
|
|
140
292
|
## License
|
|
141
293
|
|
|
142
294
|
MIT
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
import { type ModelCompatibilityReport } from './compatibility';
|
|
2
|
+
import { type PostProcessingConfig } from './postProcessing';
|
|
3
|
+
export type { ModelCompatibilityReport } from './compatibility';
|
|
4
|
+
export type { PostProcessingConfig } from './postProcessing';
|
|
5
|
+
export interface VRMAvatarFeatures {
|
|
6
|
+
idleAnimation?: boolean;
|
|
7
|
+
microExpressions?: boolean;
|
|
8
|
+
springBones?: boolean;
|
|
9
|
+
postProcessing?: PostProcessingConfig;
|
|
10
|
+
expressionPresets?: boolean;
|
|
11
|
+
}
|
|
1
12
|
export interface VRMAvatarProps {
|
|
2
13
|
blendshapes: number[];
|
|
3
14
|
width?: number;
|
|
4
15
|
height?: number;
|
|
5
16
|
modelUrl?: string;
|
|
6
|
-
backgroundColor?: number;
|
|
17
|
+
backgroundColor?: number | null;
|
|
18
|
+
blendshapeMap?: Record<string, string>;
|
|
19
|
+
expressionOverrides?: Record<string, number>;
|
|
20
|
+
onModelLoad?: (report: ModelCompatibilityReport) => void;
|
|
21
|
+
maxModelSize?: number;
|
|
22
|
+
cameraPosition?: [number, number, number];
|
|
23
|
+
cameraTarget?: [number, number, number];
|
|
24
|
+
cameraFov?: number;
|
|
25
|
+
lightIntensity?: number;
|
|
26
|
+
idleAnimationUrl?: string;
|
|
27
|
+
animationSpeed?: number;
|
|
28
|
+
animationWeight?: number;
|
|
29
|
+
animationCrossfade?: number;
|
|
30
|
+
postProcessing?: PostProcessingConfig;
|
|
31
|
+
environmentUrl?: string;
|
|
32
|
+
environmentIntensity?: number;
|
|
33
|
+
environmentBlur?: number;
|
|
34
|
+
environmentZoom?: number;
|
|
35
|
+
onEnvironmentLoad?: () => void;
|
|
36
|
+
features?: VRMAvatarFeatures;
|
|
37
|
+
orbitAngle?: number;
|
|
38
|
+
orbitElevation?: number;
|
|
39
|
+
avatarRotation?: number;
|
|
40
|
+
onOrbitChange?: (angle: number, elevation: number) => void;
|
|
7
41
|
}
|
|
8
|
-
export declare function VRMAvatar({ blendshapes, width, height, modelUrl, backgroundColor }: VRMAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function VRMAvatar({ blendshapes, width, height, modelUrl, backgroundColor, blendshapeMap, expressionOverrides, onModelLoad, maxModelSize, cameraPosition, cameraTarget, cameraFov, lightIntensity, idleAnimationUrl, animationSpeed, animationWeight, animationCrossfade, postProcessing, environmentUrl, environmentIntensity, environmentBlur, environmentZoom, onEnvironmentLoad, features, orbitAngle, orbitElevation, avatarRotation, onOrbitChange, }: VRMAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
9
43
|
export default VRMAvatar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VRM } from '@pixiv/three-vrm';
|
|
2
|
+
export interface ModelCompatibilityReport {
|
|
3
|
+
supported: number;
|
|
4
|
+
missing: string[];
|
|
5
|
+
warnings: string[];
|
|
6
|
+
modelStats: {
|
|
7
|
+
vertexCount: number;
|
|
8
|
+
textureCount: number;
|
|
9
|
+
morphTargetCount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function buildCompatibilityReport(vrm: VRM): ModelCompatibilityReport;
|
|
@@ -1,3 +1,6 @@
|
|
|
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
|
+
export declare const CRITICAL_BLENDSHAPES: ARKitBlendshapeName[];
|
|
5
|
+
export declare const DEFAULT_BLENDSHAPE_MAP: Record<string, string>;
|
|
6
|
+
export declare const VROID_BLENDSHAPE_MAP: Record<string, string>;
|
package/dist/avatar/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { VRMAvatar } from './VRMAvatar';
|
|
2
|
-
export type { VRMAvatarProps } from './VRMAvatar';
|
|
3
|
-
export { ARKIT_BLENDSHAPES, BLENDSHAPE_COUNT } from './constants';
|
|
2
|
+
export type { VRMAvatarProps, VRMAvatarFeatures, ModelCompatibilityReport, PostProcessingConfig } from './VRMAvatar';
|
|
3
|
+
export { ARKIT_BLENDSHAPES, BLENDSHAPE_COUNT, CRITICAL_BLENDSHAPES, DEFAULT_BLENDSHAPE_MAP, VROID_BLENDSHAPE_MAP, } from './constants';
|
|
4
4
|
export type { ARKitBlendshapeName } from './constants';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
3
|
+
export interface PostProcessingConfig {
|
|
4
|
+
bloom?: number;
|
|
5
|
+
ao?: number;
|
|
6
|
+
dof?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface PostProcessingPipeline {
|
|
9
|
+
composer: EffectComposer;
|
|
10
|
+
dispose: () => void;
|
|
11
|
+
setSize: (w: number, h: number) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createPostProcessing(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.PerspectiveCamera, config: PostProcessingConfig, width: number, height: number): PostProcessingPipeline;
|
|
14
|
+
export declare class FpsMonitor {
|
|
15
|
+
private samples;
|
|
16
|
+
private lastTime;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
tick(time: number): void;
|
|
19
|
+
reset(): void;
|
|
20
|
+
}
|
package/dist/index.esm.js
CHANGED
|
@@ -18,6 +18,9 @@ const ARKIT_BLENDSHAPES = [
|
|
|
18
18
|
'browDownLeft', 'browDownRight', 'browInnerUp', 'browOuterUpLeft', 'browOuterUpRight'
|
|
19
19
|
];
|
|
20
20
|
const BLENDSHAPE_COUNT = 52;
|
|
21
|
+
const DEFAULT_BLENDSHAPE_MAP = Object.fromEntries(ARKIT_BLENDSHAPES.map(name => [name, name]));
|
|
22
|
+
({
|
|
23
|
+
...DEFAULT_BLENDSHAPE_MAP});
|
|
21
24
|
|
|
22
25
|
const IDX_JAW_OPEN = ARKIT_BLENDSHAPES.indexOf('jawOpen');
|
|
23
26
|
const IDX_MOUTH_FUNNEL = ARKIT_BLENDSHAPES.indexOf('mouthFunnel');
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,9 @@ const ARKIT_BLENDSHAPES = [
|
|
|
22
22
|
'browDownLeft', 'browDownRight', 'browInnerUp', 'browOuterUpLeft', 'browOuterUpRight'
|
|
23
23
|
];
|
|
24
24
|
const BLENDSHAPE_COUNT = 52;
|
|
25
|
+
const DEFAULT_BLENDSHAPE_MAP = Object.fromEntries(ARKIT_BLENDSHAPES.map(name => [name, name]));
|
|
26
|
+
({
|
|
27
|
+
...DEFAULT_BLENDSHAPE_MAP});
|
|
25
28
|
|
|
26
29
|
const IDX_JAW_OPEN = ARKIT_BLENDSHAPES.indexOf('jawOpen');
|
|
27
30
|
const IDX_MOUTH_FUNNEL = ARKIT_BLENDSHAPES.indexOf('mouthFunnel');
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useAStackCSR } from './useAStackCSR';
|
|
2
|
-
export type { UseAStackCSROptions, UseAStackCSRReturn } from './useAStackCSR';
|
|
2
|
+
export type { UseAStackCSROptions, UseAStackCSRReturn, CharacterConfig } from './useAStackCSR';
|
|
3
3
|
export { VRMAvatar } from '../avatar/VRMAvatar';
|
|
4
|
-
export type { VRMAvatarProps } from '../avatar/VRMAvatar';
|
|
4
|
+
export type { VRMAvatarProps, VRMAvatarFeatures, ModelCompatibilityReport, PostProcessingConfig } from '../avatar/VRMAvatar';
|
|
5
|
+
export { VROID_BLENDSHAPE_MAP } from '../avatar/constants';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { AStackCSRClient, AStackCSRConfig, CallStatus } from '../AStackCSRClient';
|
|
2
|
+
import type { ModelCompatibilityReport } from '../avatar/VRMAvatar';
|
|
3
|
+
export interface CharacterConfig {
|
|
4
|
+
modelUrl?: string;
|
|
5
|
+
blendshapeMap?: Record<string, string>;
|
|
6
|
+
onModelLoad?: (report: ModelCompatibilityReport) => void;
|
|
7
|
+
maxModelSize?: number;
|
|
8
|
+
}
|
|
2
9
|
export interface UseAStackCSROptions extends AStackCSRConfig {
|
|
3
10
|
autoConnect?: boolean;
|
|
11
|
+
character?: CharacterConfig;
|
|
4
12
|
}
|
|
5
13
|
export interface UseAStackCSRReturn {
|
|
6
14
|
client: AStackCSRClient | null;
|
|
@@ -10,6 +18,7 @@ export interface UseAStackCSRReturn {
|
|
|
10
18
|
transcript: string;
|
|
11
19
|
response: string;
|
|
12
20
|
error: Error | null;
|
|
21
|
+
characterConfig: CharacterConfig;
|
|
13
22
|
connect: () => Promise<void>;
|
|
14
23
|
disconnect: () => void;
|
|
15
24
|
startCall: () => Promise<void>;
|