@asiyst/sdk 0.1.28 → 0.1.30
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 +5 -2
- package/dist/index.cjs +833 -664
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -3
- package/dist/index.d.ts +51 -3
- package/dist/index.js +833 -665
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
|
|
3
|
+
interface AvatarLoadingTimestamps {
|
|
4
|
+
sdkInit: number;
|
|
5
|
+
containerCreated: number;
|
|
6
|
+
configRetrieved: number;
|
|
7
|
+
assetRequestStart: number;
|
|
8
|
+
assetDownloadComplete: number;
|
|
9
|
+
parseAndDecodeComplete: number;
|
|
10
|
+
sceneInitComplete: number;
|
|
11
|
+
firstRenderedFrame: number;
|
|
12
|
+
firstVisibleCorrectlyFramed: number;
|
|
13
|
+
}
|
|
14
|
+
interface AvatarPerformanceMetrics {
|
|
15
|
+
timestamps: AvatarLoadingTimestamps;
|
|
16
|
+
durations: {
|
|
17
|
+
configRetrievalMs: number;
|
|
18
|
+
downloadDurationMs: number;
|
|
19
|
+
parseDurationMs: number;
|
|
20
|
+
sceneInitDurationMs: number;
|
|
21
|
+
firstRenderDurationMs: number;
|
|
22
|
+
timeToFirstVisibleMs: number;
|
|
23
|
+
};
|
|
24
|
+
asset: {
|
|
25
|
+
format?: string;
|
|
26
|
+
byteSize?: number;
|
|
27
|
+
meshCount?: number;
|
|
28
|
+
vertexCount?: number;
|
|
29
|
+
animationCount?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
declare class AvatarMetricsTracker {
|
|
33
|
+
private readonly timestamps;
|
|
34
|
+
private assetInfo;
|
|
35
|
+
record<K extends keyof AvatarLoadingTimestamps>(step: K, timestamp?: number): void;
|
|
36
|
+
setAssetInfo(info: Partial<AvatarPerformanceMetrics["asset"]>): void;
|
|
37
|
+
getMetrics(): AvatarPerformanceMetrics | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
3
40
|
interface AsiystEventMap {
|
|
4
41
|
"asiyst:initialized": {
|
|
5
42
|
projectId: string;
|
|
@@ -181,6 +218,7 @@ interface AvatarAnimation {
|
|
|
181
218
|
loopMode?: string;
|
|
182
219
|
durationMs?: number;
|
|
183
220
|
assetUrl?: string | null;
|
|
221
|
+
integrity?: string;
|
|
184
222
|
}
|
|
185
223
|
interface AvatarBranding {
|
|
186
224
|
siteLogoUrl?: string | null;
|
|
@@ -192,6 +230,8 @@ interface ProjectConfig {
|
|
|
192
230
|
avatar: string;
|
|
193
231
|
avatarId?: string;
|
|
194
232
|
assetUrl?: string;
|
|
233
|
+
modelFormat?: "fbx" | "glb";
|
|
234
|
+
assetIntegrity?: string;
|
|
195
235
|
thumbnailUrl?: string | null;
|
|
196
236
|
publishedVersion?: string;
|
|
197
237
|
animations?: AvatarAnimation[];
|
|
@@ -211,6 +251,7 @@ interface ProjectConfig {
|
|
|
211
251
|
rules: AvatarRuntimeRule[];
|
|
212
252
|
dataSources: AvatarDataSource[];
|
|
213
253
|
elementSelectors: Record<string, string>;
|
|
254
|
+
maxMessageChars?: number;
|
|
214
255
|
}
|
|
215
256
|
interface Rect {
|
|
216
257
|
x: number;
|
|
@@ -286,6 +327,7 @@ declare const Asiyst: {
|
|
|
286
327
|
getConnectionStatus(): "connected" | "disconnected" | "offline";
|
|
287
328
|
getVerificationStatus(): "connected" | "inactive" | "not_detected" | "error";
|
|
288
329
|
isRuntimeConnected(): boolean;
|
|
330
|
+
getAvatarPerformanceMetrics(): AvatarPerformanceMetrics | null;
|
|
289
331
|
avatar: {
|
|
290
332
|
show(): void;
|
|
291
333
|
hide(): void;
|
|
@@ -458,13 +500,15 @@ interface LoadedFbxAsset {
|
|
|
458
500
|
}
|
|
459
501
|
type LoadedAvatarAsset = LoadedFbxAsset | LoadedGlbAsset | LoadedImageAsset | LoadedManifestAsset;
|
|
460
502
|
declare class AssetLoader {
|
|
461
|
-
private
|
|
503
|
+
private readonly inFlightControllers;
|
|
462
504
|
private readonly createdObjectUrls;
|
|
463
505
|
private readonly inFlightLoads;
|
|
464
506
|
private readonly cachedAssets;
|
|
465
507
|
load(assetUrl: string, options?: {
|
|
466
508
|
signal?: AbortSignal;
|
|
467
509
|
timeoutMs?: number;
|
|
510
|
+
integrity?: string;
|
|
511
|
+
expectedFormat?: "fbx" | "glb";
|
|
468
512
|
}): Promise<LoadedAvatarAsset>;
|
|
469
513
|
private performLoad;
|
|
470
514
|
isFbxBuffer(buffer: ArrayBuffer): boolean;
|
|
@@ -508,6 +552,7 @@ interface FbxMountOptions {
|
|
|
508
552
|
config?: ProjectConfig;
|
|
509
553
|
width?: number;
|
|
510
554
|
height?: number;
|
|
555
|
+
metricsTracker?: AvatarMetricsTracker;
|
|
511
556
|
}
|
|
512
557
|
declare class FbxRenderer {
|
|
513
558
|
private canvas;
|
|
@@ -527,6 +572,7 @@ declare class FbxRenderer {
|
|
|
527
572
|
private currentPose;
|
|
528
573
|
private initialRenderCompleted;
|
|
529
574
|
private resizeListener?;
|
|
575
|
+
private baseScale;
|
|
530
576
|
mount(container: HTMLElement, asset: LoadedFbxAsset | LoadedGlbAsset, options?: FbxMountOptions): Promise<FbxRenderMetrics>;
|
|
531
577
|
setFacing(direction: "left" | "right"): void;
|
|
532
578
|
setPose(pose: AvatarPose): void;
|
|
@@ -576,11 +622,13 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
576
622
|
private activeAssetUrl;
|
|
577
623
|
private lastErrorMessage;
|
|
578
624
|
private renderMetrics;
|
|
625
|
+
private metricsTracker?;
|
|
626
|
+
setMetricsTracker(tracker: AvatarMetricsTracker): void;
|
|
579
627
|
mount(container: HTMLElement, config: ProjectConfig): void;
|
|
580
628
|
unmount(): void;
|
|
581
629
|
applyConfig(config: ProjectConfig): void;
|
|
582
630
|
setPanelOpen(open: boolean): void;
|
|
583
|
-
loadAsset(config: ProjectConfig): Promise<boolean>;
|
|
631
|
+
loadAsset(config: ProjectConfig, metricsTracker?: AvatarMetricsTracker): Promise<boolean>;
|
|
584
632
|
renderLoader(): void;
|
|
585
633
|
private renderLoadedAsset;
|
|
586
634
|
private renderFallback;
|
|
@@ -611,4 +659,4 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
611
659
|
getNameTag(): HTMLElement | undefined;
|
|
612
660
|
}
|
|
613
661
|
|
|
614
|
-
export { type ActionKind, ActionNotAllowedError, Asiyst, AsiystError, type AsiystEventMap, type AsiystEventName, AssetLoader, type AssistantMode, AuthenticationError, type AvatarAnimation, type AvatarBranding, ConfigurationError, CssAvatarRenderer, FbxRenderer, type HighlightStyle, type InitOptions, InitializationError, type MappedElement, NetworkError, type ProjectConfig, SDK_VERSION, type TargetInput, TargetNotFoundError, type TargetRef, type TaskDefinition, TaskExecutionError, TaskStatus, type TaskStep, type WebsiteMapSnapshot, type WorkflowDefinition, anchorToViewport, canNavigateTo, canTransition, computeAvatarDestination, evaluateActionPermission, fallbackConfig, isActionAllowed, isSafeSelector, normalizeProjectConfig, sanitizeText, validateInitOptions, validateWebsiteDomain };
|
|
662
|
+
export { type ActionKind, ActionNotAllowedError, Asiyst, AsiystError, type AsiystEventMap, type AsiystEventName, AssetLoader, type AssistantMode, AuthenticationError, type AvatarAnimation, type AvatarBranding, type AvatarLoadingTimestamps, AvatarMetricsTracker, type AvatarPerformanceMetrics, ConfigurationError, CssAvatarRenderer, FbxRenderer, type HighlightStyle, type InitOptions, InitializationError, type MappedElement, NetworkError, type ProjectConfig, SDK_VERSION, type TargetInput, TargetNotFoundError, type TargetRef, type TaskDefinition, TaskExecutionError, TaskStatus, type TaskStep, type WebsiteMapSnapshot, type WorkflowDefinition, anchorToViewport, canNavigateTo, canTransition, computeAvatarDestination, evaluateActionPermission, fallbackConfig, isActionAllowed, isSafeSelector, normalizeProjectConfig, sanitizeText, validateInitOptions, validateWebsiteDomain };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
|
|
3
|
+
interface AvatarLoadingTimestamps {
|
|
4
|
+
sdkInit: number;
|
|
5
|
+
containerCreated: number;
|
|
6
|
+
configRetrieved: number;
|
|
7
|
+
assetRequestStart: number;
|
|
8
|
+
assetDownloadComplete: number;
|
|
9
|
+
parseAndDecodeComplete: number;
|
|
10
|
+
sceneInitComplete: number;
|
|
11
|
+
firstRenderedFrame: number;
|
|
12
|
+
firstVisibleCorrectlyFramed: number;
|
|
13
|
+
}
|
|
14
|
+
interface AvatarPerformanceMetrics {
|
|
15
|
+
timestamps: AvatarLoadingTimestamps;
|
|
16
|
+
durations: {
|
|
17
|
+
configRetrievalMs: number;
|
|
18
|
+
downloadDurationMs: number;
|
|
19
|
+
parseDurationMs: number;
|
|
20
|
+
sceneInitDurationMs: number;
|
|
21
|
+
firstRenderDurationMs: number;
|
|
22
|
+
timeToFirstVisibleMs: number;
|
|
23
|
+
};
|
|
24
|
+
asset: {
|
|
25
|
+
format?: string;
|
|
26
|
+
byteSize?: number;
|
|
27
|
+
meshCount?: number;
|
|
28
|
+
vertexCount?: number;
|
|
29
|
+
animationCount?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
declare class AvatarMetricsTracker {
|
|
33
|
+
private readonly timestamps;
|
|
34
|
+
private assetInfo;
|
|
35
|
+
record<K extends keyof AvatarLoadingTimestamps>(step: K, timestamp?: number): void;
|
|
36
|
+
setAssetInfo(info: Partial<AvatarPerformanceMetrics["asset"]>): void;
|
|
37
|
+
getMetrics(): AvatarPerformanceMetrics | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
3
40
|
interface AsiystEventMap {
|
|
4
41
|
"asiyst:initialized": {
|
|
5
42
|
projectId: string;
|
|
@@ -181,6 +218,7 @@ interface AvatarAnimation {
|
|
|
181
218
|
loopMode?: string;
|
|
182
219
|
durationMs?: number;
|
|
183
220
|
assetUrl?: string | null;
|
|
221
|
+
integrity?: string;
|
|
184
222
|
}
|
|
185
223
|
interface AvatarBranding {
|
|
186
224
|
siteLogoUrl?: string | null;
|
|
@@ -192,6 +230,8 @@ interface ProjectConfig {
|
|
|
192
230
|
avatar: string;
|
|
193
231
|
avatarId?: string;
|
|
194
232
|
assetUrl?: string;
|
|
233
|
+
modelFormat?: "fbx" | "glb";
|
|
234
|
+
assetIntegrity?: string;
|
|
195
235
|
thumbnailUrl?: string | null;
|
|
196
236
|
publishedVersion?: string;
|
|
197
237
|
animations?: AvatarAnimation[];
|
|
@@ -211,6 +251,7 @@ interface ProjectConfig {
|
|
|
211
251
|
rules: AvatarRuntimeRule[];
|
|
212
252
|
dataSources: AvatarDataSource[];
|
|
213
253
|
elementSelectors: Record<string, string>;
|
|
254
|
+
maxMessageChars?: number;
|
|
214
255
|
}
|
|
215
256
|
interface Rect {
|
|
216
257
|
x: number;
|
|
@@ -286,6 +327,7 @@ declare const Asiyst: {
|
|
|
286
327
|
getConnectionStatus(): "connected" | "disconnected" | "offline";
|
|
287
328
|
getVerificationStatus(): "connected" | "inactive" | "not_detected" | "error";
|
|
288
329
|
isRuntimeConnected(): boolean;
|
|
330
|
+
getAvatarPerformanceMetrics(): AvatarPerformanceMetrics | null;
|
|
289
331
|
avatar: {
|
|
290
332
|
show(): void;
|
|
291
333
|
hide(): void;
|
|
@@ -458,13 +500,15 @@ interface LoadedFbxAsset {
|
|
|
458
500
|
}
|
|
459
501
|
type LoadedAvatarAsset = LoadedFbxAsset | LoadedGlbAsset | LoadedImageAsset | LoadedManifestAsset;
|
|
460
502
|
declare class AssetLoader {
|
|
461
|
-
private
|
|
503
|
+
private readonly inFlightControllers;
|
|
462
504
|
private readonly createdObjectUrls;
|
|
463
505
|
private readonly inFlightLoads;
|
|
464
506
|
private readonly cachedAssets;
|
|
465
507
|
load(assetUrl: string, options?: {
|
|
466
508
|
signal?: AbortSignal;
|
|
467
509
|
timeoutMs?: number;
|
|
510
|
+
integrity?: string;
|
|
511
|
+
expectedFormat?: "fbx" | "glb";
|
|
468
512
|
}): Promise<LoadedAvatarAsset>;
|
|
469
513
|
private performLoad;
|
|
470
514
|
isFbxBuffer(buffer: ArrayBuffer): boolean;
|
|
@@ -508,6 +552,7 @@ interface FbxMountOptions {
|
|
|
508
552
|
config?: ProjectConfig;
|
|
509
553
|
width?: number;
|
|
510
554
|
height?: number;
|
|
555
|
+
metricsTracker?: AvatarMetricsTracker;
|
|
511
556
|
}
|
|
512
557
|
declare class FbxRenderer {
|
|
513
558
|
private canvas;
|
|
@@ -527,6 +572,7 @@ declare class FbxRenderer {
|
|
|
527
572
|
private currentPose;
|
|
528
573
|
private initialRenderCompleted;
|
|
529
574
|
private resizeListener?;
|
|
575
|
+
private baseScale;
|
|
530
576
|
mount(container: HTMLElement, asset: LoadedFbxAsset | LoadedGlbAsset, options?: FbxMountOptions): Promise<FbxRenderMetrics>;
|
|
531
577
|
setFacing(direction: "left" | "right"): void;
|
|
532
578
|
setPose(pose: AvatarPose): void;
|
|
@@ -576,11 +622,13 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
576
622
|
private activeAssetUrl;
|
|
577
623
|
private lastErrorMessage;
|
|
578
624
|
private renderMetrics;
|
|
625
|
+
private metricsTracker?;
|
|
626
|
+
setMetricsTracker(tracker: AvatarMetricsTracker): void;
|
|
579
627
|
mount(container: HTMLElement, config: ProjectConfig): void;
|
|
580
628
|
unmount(): void;
|
|
581
629
|
applyConfig(config: ProjectConfig): void;
|
|
582
630
|
setPanelOpen(open: boolean): void;
|
|
583
|
-
loadAsset(config: ProjectConfig): Promise<boolean>;
|
|
631
|
+
loadAsset(config: ProjectConfig, metricsTracker?: AvatarMetricsTracker): Promise<boolean>;
|
|
584
632
|
renderLoader(): void;
|
|
585
633
|
private renderLoadedAsset;
|
|
586
634
|
private renderFallback;
|
|
@@ -611,4 +659,4 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
611
659
|
getNameTag(): HTMLElement | undefined;
|
|
612
660
|
}
|
|
613
661
|
|
|
614
|
-
export { type ActionKind, ActionNotAllowedError, Asiyst, AsiystError, type AsiystEventMap, type AsiystEventName, AssetLoader, type AssistantMode, AuthenticationError, type AvatarAnimation, type AvatarBranding, ConfigurationError, CssAvatarRenderer, FbxRenderer, type HighlightStyle, type InitOptions, InitializationError, type MappedElement, NetworkError, type ProjectConfig, SDK_VERSION, type TargetInput, TargetNotFoundError, type TargetRef, type TaskDefinition, TaskExecutionError, TaskStatus, type TaskStep, type WebsiteMapSnapshot, type WorkflowDefinition, anchorToViewport, canNavigateTo, canTransition, computeAvatarDestination, evaluateActionPermission, fallbackConfig, isActionAllowed, isSafeSelector, normalizeProjectConfig, sanitizeText, validateInitOptions, validateWebsiteDomain };
|
|
662
|
+
export { type ActionKind, ActionNotAllowedError, Asiyst, AsiystError, type AsiystEventMap, type AsiystEventName, AssetLoader, type AssistantMode, AuthenticationError, type AvatarAnimation, type AvatarBranding, type AvatarLoadingTimestamps, AvatarMetricsTracker, type AvatarPerformanceMetrics, ConfigurationError, CssAvatarRenderer, FbxRenderer, type HighlightStyle, type InitOptions, InitializationError, type MappedElement, NetworkError, type ProjectConfig, SDK_VERSION, type TargetInput, TargetNotFoundError, type TargetRef, type TaskDefinition, TaskExecutionError, TaskStatus, type TaskStep, type WebsiteMapSnapshot, type WorkflowDefinition, anchorToViewport, canNavigateTo, canTransition, computeAvatarDestination, evaluateActionPermission, fallbackConfig, isActionAllowed, isSafeSelector, normalizeProjectConfig, sanitizeText, validateInitOptions, validateWebsiteDomain };
|